[Scummvm-git-logs] scummvm master -> 06df655cc7df24e7e101688b353cc8dae7280ed5

OMGPizzaGuy noreply at scummvm.org
Sat Jun 8 18:57:30 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:
06df655cc7 ULTIMA8: Use Point3 in map sweep test


Commit: 06df655cc7df24e7e101688b353cc8dae7280ed5
    https://github.com/scummvm/scummvm/commit/06df655cc7df24e7e101688b353cc8dae7280ed5
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-06-08T13:56:44-05:00

Commit Message:
ULTIMA8: Use Point3 in map sweep test

Changed paths:
    engines/ultima/ultima8/world/actors/animation_tracker.cpp
    engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
    engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp
    engines/ultima/ultima8/world/current_map.cpp
    engines/ultima/ultima8/world/current_map.h
    engines/ultima/ultima8/world/item.cpp
    engines/ultima/ultima8/world/minimap.cpp
    engines/ultima/ultima8/world/missile_tracker.cpp
    engines/ultima/ultima8/world/super_sprite_process.cpp


diff --git a/engines/ultima/ultima8/world/actors/animation_tracker.cpp b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
index 7086d022df2..3bc964ca43b 100644
--- a/engines/ultima/ultima8/world/actors/animation_tracker.cpp
+++ b/engines/ultima/ultima8/world/actors/animation_tracker.cpp
@@ -270,8 +270,8 @@ bool AnimationTracker::step() {
 	// Only for particularly large steps we do a full sweepTest
 	if (ABS(dx) >= xd - 8 || ABS(dy) >= yd - 8 || ABS(dz) >= zd - 8) {
 
-		int32 start[3] = { _curr.x, _curr.y, _curr.z };
-		int32 end[3] = { tx, ty, tz };
+		Point3 start = _curr;
+		Point3 end(tx, ty, tz);
 		int32 dims[3] = { xd, yd, zd };
 
 		// Do the sweep test
@@ -290,10 +290,7 @@ bool AnimationTracker::step() {
 				}
 #endif
 				_blocked = true;
-				it->GetInterpolatedCoords(end, start, end);
-				_curr.x = end[0];
-				_curr.y = end[1];
-				_curr.z = end[2];
+				_curr = it->GetInterpolatedCoords(end, start);
 				return false;
 			}
 		}
diff --git a/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp b/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
index f8465b54f67..ad73445d0fc 100644
--- a/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
+++ b/engines/ultima/ultima8/world/actors/cru_avatar_mover_process.cpp
@@ -493,10 +493,6 @@ void CruAvatarMoverProcess::step(Animation::Sequence action, Direction direction
 
 		int32 dims[3];
 		avatar->getFootpadWorld(dims[0], dims[1], dims[2]);
-		int32 start[3];
-		start[0] = origpt.x;
-		start[1] = origpt.y;
-		start[2] = origpt.z;
 
 		// Double the values in original to match our coordinate space
 		static const int ADJUSTMENTS[] = {0x20, 0x20, 0x40, 0x40, 0x60, 0x60,
@@ -516,12 +512,9 @@ void CruAvatarMoverProcess::step(Animation::Sequence action, Direction direction
 			//
 			bool startvalid = true;
 			Std::list<CurrentMap::SweepItem> collisions;
-			int32 end[3];
-			end[0] = x;
-			end[1] = y;
-			end[2] = z;
+			Point3 end(x, y, z);
 			avatar->setLocation(origpt);
-			currentmap->sweepTest(start, end, dims, avatar->getShapeInfo()->_flags,
+			currentmap->sweepTest(origpt, end, dims, avatar->getShapeInfo()->_flags,
 								  avatar->getObjId(), true, &collisions);
 			for (Std::list<CurrentMap::SweepItem>::iterator it = collisions.begin();
 				 it != collisions.end(); it++) {
diff --git a/engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp b/engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp
index 3977deb8507..dc9c65c1091 100644
--- a/engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp
+++ b/engines/ultima/ultima8/world/actors/rolling_thunder_process.cpp
@@ -264,8 +264,8 @@ bool RollingThunderProcess::fireDistance(Direction dir, int32 x, int32 y, int32
 		} else {
 			Point3 oc = target->getCentre();
 			oc.z = target->getTargetZRelativeToAttackerZ(z);
-			const int32 start[3] = {cx, cy, cz};
-			const int32 end[3] = {oc.x, oc.y, oc.z};
+			const Point3 start(cx, cy, cz);
+			const Point3 end = oc;
 			const int32 dims[3] = {2, 2, 2};
 
 			Std::list<CurrentMap::SweepItem> collisions;
@@ -277,9 +277,8 @@ bool RollingThunderProcess::fireDistance(Direction dir, int32 x, int32 y, int32
 					continue;
 				if (it->_item != target->getObjId())
 					break;
-				int32 out[3];
-				it->GetInterpolatedCoords(out, start, end);
-				dist = MAX(abs(x - out[0]), abs(y - out[1]));
+				Point3 out = it->GetInterpolatedCoords(start, end);
+				dist = MAX(abs(x - out.x), abs(y - out.y));
 				break;
 			}
 		}
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index 7a5c35a097a..0ed495fcbe2 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -980,22 +980,22 @@ bool CurrentMap::scanForValidPosition(int32 x, int32 y, int32 z, const Item *ite
 // blocking_only forces us to check against blocking items only.
 // Returns item hit or 0 if no hit.
 // end is set to the colision point
-bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
+bool CurrentMap::sweepTest(const Point3 &start, const Point3 &end,
 						   const int32 dims[3], uint32 shapeflags,
 						   ObjId item, bool blocking_only,
 						   Std::list<SweepItem> *hit) const {
 	const uint32 blockflagmask = (ShapeInfo::SI_SOLID | ShapeInfo::SI_DAMAGING | ShapeInfo::SI_LAND);
 
-	int minx = ((start[0] - dims[0]) / _mapChunkSize) - 1;
-	int maxx = (start[0] / _mapChunkSize) + 1;
-	int miny = ((start[1] - dims[1]) / _mapChunkSize) - 1;
-	int maxy = (start[1] / _mapChunkSize) + 1;
+	int minx = ((start.x - dims[0]) / _mapChunkSize) - 1;
+	int maxx = (start.x / _mapChunkSize) + 1;
+	int miny = ((start.y - dims[1]) / _mapChunkSize) - 1;
+	int maxy = (start.y / _mapChunkSize) + 1;
 
 	{
-		int dminx = ((end[0] - dims[0]) / _mapChunkSize) - 1;
-		int dmaxx = (end[0] / _mapChunkSize) + 1;
-		int dminy = ((end[1] - dims[1]) / _mapChunkSize) - 1;
-		int dmaxy = (end[1] / _mapChunkSize) + 1;
+		int dminx = ((end.x - dims[0]) / _mapChunkSize) - 1;
+		int dmaxx = (end.x / _mapChunkSize) + 1;
+		int dminy = ((end.y - dims[1]) / _mapChunkSize) - 1;
+		int dmaxy = (end.y / _mapChunkSize) + 1;
 		if (dminx < minx)
 			minx = dminx;
 		if (dmaxx > maxx)
@@ -1011,14 +1011,19 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
 	// Get velocity, extents, and centre of item
 	int32 vel[3];
 	int32 ext[3];
-	int32 centre[3];
-	for (int i = 0; i < 3; i++) {
-		vel[i] = end[i] - start[i];
-		ext[i] = dims[i] / 2;
-		centre[i] = start[i] - ext[i];
-	}
+	Point3 centre;
+	vel[0] = end.x - start.x;
+	vel[1] = end.y - start.y;
+	vel[2] = end.z - start.z;
+
+	ext[0] = dims[0] / 2;
+	ext[1] = dims[1] / 2;
+	ext[2] = dims[2] / 2;
+
+	centre.x = start.x - ext[0];
+	centre.y = start.y - ext[1];
 	// Z is opposite direction to x and y..
-	centre[2] = start[2] + ext[2];
+	centre.z = start.z + ext[2];
 
 	debugC(kDebugCollision, "Sweeping from (%d, %d, %d) - (%d, %d, %d) to (%d, %d, %d) - (%d, %d, %d)",
 		   -ext[0], -ext[1], -ext[2],
@@ -1063,12 +1068,12 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
 				// off-by-one error (hypothetically, but they do happen so
 				// protect against it).
 				if ( /* not non-overlapping start position */
-				    !(start[0] <= other[0] - (oext[0] - 1) ||
-				      start[0] - dims[0] >= other[0] - 1 ||
-				      start[1] <= other[1] - (oext[1] - 1) ||
-				      start[1] - dims[1] >= other[1] - 1 ||
-				      start[2] + dims[2] <= other[2] + 1 ||
-				      start[2] >= other[2] + (oext[2] - 1))) {
+				    !(start.x <= other[0] - (oext[0] - 1) ||
+				      start.x - dims[0] >= other[0] - 1 ||
+				      start.y <= other[1] - (oext[1] - 1) ||
+				      start.y - dims[1] >= other[1] - 1 ||
+				      start.z + dims[2] <= other[2] + 1 ||
+				      start.z >= other[2] + (oext[2] - 1))) {
 					// Overlapped at the start, and not just touching so
 					// ignore collision
 					continue;
@@ -1080,9 +1085,9 @@ bool CurrentMap::sweepTest(const int32 start[3], const int32 end[3],
 				oext[2] /= 2;
 
 				// Put other into our coord frame
-				other[0] -= oext[0] + centre[0];
-				other[1] -= oext[1] + centre[1];
-				other[2] += oext[2] - centre[2];
+				other[0] -= oext[0] + centre.x;
+				other[1] -= oext[1] + centre.y;
+				other[2] += oext[2] - centre.z;
 
 				//first times of overlap along each axis
 				int32 u_1[3] = {0, 0, 0};
diff --git a/engines/ultima/ultima8/world/current_map.h b/engines/ultima/ultima8/world/current_map.h
index c9196731aa7..e0f463264a7 100644
--- a/engines/ultima/ultima8/world/current_map.h
+++ b/engines/ultima/ultima8/world/current_map.h
@@ -26,6 +26,7 @@
 #include "ultima/ultima8/usecode/intrinsics.h"
 #include "ultima/ultima8/world/position_info.h"
 #include "ultima/ultima8/misc/direction.h"
+#include "ultima/ultima8/misc/point3.h"
 
 namespace Ultima {
 namespace Ultima8 {
@@ -143,9 +144,12 @@ public:
 		// Bitmask. Bit 0 is x, 1 is y, 2 is z.
 
 		// Use this func to get the interpolated location of the hit
-		void GetInterpolatedCoords(int32 out[3], const int32 start[3], const int32 end[3]) const {
-			for (int i = 0; i < 3; i++)
-				out[i] = start[i] + ((end[i] - start[i]) * (_hitTime >= 0 ? _hitTime : 0) + (end[i] > start[i] ? 0x2000 : -0x2000)) / 0x4000;
+		Point3 GetInterpolatedCoords(const Point3 &start, const Point3 &end) const {
+			Point3 pt;
+			pt.x = start.x + ((end.x - start.x) * (_hitTime >= 0 ? _hitTime : 0) + (end.x > start.x ? 0x2000 : -0x2000)) / 0x4000;
+			pt.y = start.y + ((end.y - start.y) * (_hitTime >= 0 ? _hitTime : 0) + (end.y > start.y ? 0x2000 : -0x2000)) / 0x4000;
+			pt.z = start.z + ((end.z - start.z) * (_hitTime >= 0 ? _hitTime : 0) + (end.z > start.z ? 0x2000 : -0x2000)) / 0x4000;
+			return pt;
 		}
 	};
 
@@ -161,7 +165,7 @@ public:
 	//!            by SweepItem::hit_time
 	//! \return false if no items were hit.
 	//!         true if any items were hit.
-	bool sweepTest(const int32 start[3], const int32 end[3],
+	bool sweepTest(const Point3 &start, const Point3 &end,
 	               const int32 dims[3], uint32 shapeflags,
 	               ObjId item, bool solid_only, Std::list<SweepItem> *hit) const;
 
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index dd12ae78c1c..25490bb207b 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -744,15 +744,13 @@ int Item::getRangeIfVisible(const Item &item2) const {
 	CurrentMap *map = world->getCurrentMap();
 	Std::list<CurrentMap::SweepItem> hitItems;
 
-	Point3 pt1 = getCentre();
-	Point3 pt2 = item2.getCentre();
-	int32 start[3] = {pt1.x, pt1.y, pt1.z};
-	int32 end[3] = {pt2.x, pt2.y, pt2.z};
+	Point3 start = getCentre();
+	Point3 end = item2.getCentre();
 	int32 dims[3] = {1, 1, 1};
 
-	int xdiff = abs(start[0] - end[0]);
-	int ydiff = abs(start[1] - end[1]);
-	int zdiff = abs(start[2] - end[2]);
+	int xdiff = abs(start.x - end.x);
+	int ydiff = abs(start.y - end.y);
+	int zdiff = abs(start.z - end.z);
 
 	map->sweepTest(start, end, dims, getShapeInfo()->_flags, _objId, true, &hitItems);
 
@@ -1054,20 +1052,13 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
 	if (hititem) *hititem = 0;
 	if (dirs) *dirs = 0;
 
-	int32 end[3] = { dx, dy, dz };
+	Point3 start(dx, dy, dz);
+	Point3 end(dx, dy, dz);
 
-	int32 start[3];
-	if (_parent) {
-		// If we are moving from a container, only check the destination
-		start[0] = end[0];
-		start[1] = end[1];
-		start[2] = end[2];
-	} else {
-		// Otherwise check from where we are to where we want to go
-		Point3 pt = getLocation();
-		start[0] = pt.x;
-		start[1] = pt.y;
-		start[2] = pt.z;
+	// If we are moving from a container, only check the destination
+	// Otherwise check from where we are to where we want to go
+	if (!_parent) {
+		start = getLocation();
 	}
 
 	int32 dims[3];
@@ -1082,9 +1073,9 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
 
 
 	// the force of the hit, used for the gotHit/hit usecode calls
-	int deltax = ABS(start[0] - end[0]) / 4;
-	int deltay = ABS(start[1] - end[1]) / 4;
-	int deltaz = ABS(start[2] - end[2]);
+	int deltax = ABS(start.x - end.x) / 4;
+	int deltay = ABS(start.y - end.y) / 4;
+	int deltaz = ABS(start.z - end.z);
 	int maxdirdelta = deltay;
 	if (deltay > maxdirdelta) maxdirdelta = deltay;
 	if (deltaz > maxdirdelta) maxdirdelta = deltaz;
@@ -1137,7 +1128,7 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
 		if (we_were_released) callUsecodeEvent_release();
 
 		// Move US!
-		move(end[0], end[1], end[2]);
+		move(end);
 
 		// We reached the end
 		return 0x4000;
@@ -1160,11 +1151,11 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
 
 			if (hit != 0x4000) {
 				debugC(kDebugCollision, "Hit time: %d; Start: %d, %d, %d; End: %d, %d, %d",
-					hit, start[0], start[1], start[2], end[0], end[1], end[2]);
+					hit, start.x, start.y, start.z, end.x, end.y, end.z);
 
-				it->GetInterpolatedCoords(end, start, end);
+				end = it->GetInterpolatedCoords(start, end);
 
-				debugC(kDebugCollision, "Collision: %d, %d, %d", end[0], end[1], end[2]);
+				debugC(kDebugCollision, "Collision: %d, %d, %d", end.x, end.y, end.z);
 			}
 		}
 
@@ -1211,7 +1202,7 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
 		if (we_were_released) callUsecodeEvent_release();
 
 		// Move US!
-		move(end[0], end[1], end[2]);
+		move(end);
 
 		return hit;
 	}
@@ -1459,8 +1450,8 @@ uint16 Item::fireDistance(const Item *other, Direction dir, int16 xoff, int16 yo
 		} else {
 			Point3 oc = other->getCentre();
 			oc.z = other->getTargetZRelativeToAttackerZ(getZ());
-			const int32 start[3] = {cx, cy, cz};
-			const int32 end[3] = {oc.x, oc.y, oc.z};
+			const Point3 start(cx, cy, cz);
+			const Point3 end = oc;
 			const int32 dims[3] = {2, 2, 2};
 
 			Std::list<CurrentMap::SweepItem> collisions;
@@ -1474,9 +1465,8 @@ uint16 Item::fireDistance(const Item *other, Direction dir, int16 xoff, int16 yo
 					continue;
 				if (it->_item != other->getObjId())
 					break;
-				int32 out[3];
-				it->GetInterpolatedCoords(out, start, end);
-				dist = MAX(abs(_x - out[0]), abs(_y - out[1]));
+				Point3 out = it->GetInterpolatedCoords(start, end);
+				dist = MAX(abs(_x - out.x), abs(_y - out.y));
 				break;
 			}
 		}
@@ -2486,18 +2476,12 @@ bool Item::canReach(const Item *other, int range,
 
 
 	// if not, do line of sight between origins of items
-	int32 start[3];
-	int32 end[3];
+	Point3 start = pt1;
+	Point3 end(otherX, otherY, otherZ);
 	int32 dims[3] = { 2, 2, 2 };
 
-	start[0] = pt1.x;
-	start[1] = pt1.y;
-	start[2] = pt1.z;
-	end[0] = otherX;
-	end[1] = otherY;
-	end[2] = otherZ;
 	if (otherZ > pt1.z && otherZ < pt1.z + thisZd)
-		start[2] = end[2]; // bottom of other between bottom and top of this
+		start.z = end.z; // bottom of other between bottom and top of this
 
 	Std::list<CurrentMap::SweepItem> collisions;
 	Std::list<CurrentMap::SweepItem>::iterator it;
@@ -2510,15 +2494,15 @@ bool Item::canReach(const Item *other, int range,
 		return true;
 
 	// if that fails, try line of sight between centers
-	start[0] = pt1.x - thisXd / 2; // xy center of this
-	start[1] = pt1.y - thisYd / 2;
-	start[2] = pt1.z;
+	start.x = pt1.x - thisXd / 2; // xy center of this
+	start.y = pt1.y - thisYd / 2;
+	start.z = pt1.z;
 	if (thisZd > 16)
-		start[2] += thisZd - 8; // eye height
+		start.z += thisZd - 8; // eye height
 
-	end[0] = otherX - otherXd / 2; // xyz center of other
-	end[1] = otherY - otherYd / 2;
-	end[2] = otherZ + otherZd / 2;
+	end.x = otherX - otherXd / 2; // xyz center of other
+	end.y = otherY - otherYd / 2;
+	end.z = otherZ + otherZd / 2;
 
 	collisions.clear();
 	map->sweepTest(start, end, dims, ShapeInfo::SI_SOLID,
@@ -2528,7 +2512,7 @@ bool Item::canReach(const Item *other, int range,
 		return true;
 
 	// if that fails, try line of sight between eye level and top of 2nd
-	end[2] = otherZ + otherZd;
+	end.z = otherZ + otherZd;
 
 	collisions.clear();
 	map->sweepTest(start, end, dims, ShapeInfo::SI_SOLID,
@@ -3632,14 +3616,9 @@ uint32 Item::I_legalMoveToPoint(const uint8 *args, unsigned int argsize) {
 	//
 	int retval = 1;
 	Std::list<CurrentMap::SweepItem> collisions;
-	int32 start[3], end[3], dims[3];
-	end[0] = x;
-	end[1] = y;
-	end[2] = z;
-	Point3 pt = item->getLocation();
-	start[0] = pt.x;
-	start[1] = pt.y;
-	start[2] = pt.z;
+	Point3 start = item->getLocation();
+	Point3 end(x, y, z);
+	int32 dims[3];
 	item->getFootpadWorld(dims[0], dims[1], dims[2]);
 	CurrentMap *map = World::get_instance()->getCurrentMap();
 	map->sweepTest(start, end, dims, item->getShapeInfo()->_flags,
diff --git a/engines/ultima/ultima8/world/minimap.cpp b/engines/ultima/ultima8/world/minimap.cpp
index bcb4bef9f98..669c469916f 100644
--- a/engines/ultima/ultima8/world/minimap.cpp
+++ b/engines/ultima/ultima8/world/minimap.cpp
@@ -83,8 +83,8 @@ Common::Point MiniMap::getItemLocation(const Item &item, unsigned int chunkSize)
 }
 
 uint32 MiniMap::sampleAtPoint(const CurrentMap &map, int x, int y) {
-	int32 start[3] = {x, y, 1 << 15};
-	int32 end[3] = {x, y, -1};
+	Point3 start(x, y, 1 << 15);
+	Point3 end(x, y, -1);
 	int32 dims[3] = {0, 0, 0};
 	uint32 shflags = ShapeInfo::SI_ROOF | ShapeInfo::SI_OCCL | ShapeInfo::SI_LAND | ShapeInfo::SI_SEA;
 	Std::list<CurrentMap::SweepItem> collisions;
diff --git a/engines/ultima/ultima8/world/missile_tracker.cpp b/engines/ultima/ultima8/world/missile_tracker.cpp
index aa7222602d4..9a0503affa0 100644
--- a/engines/ultima/ultima8/world/missile_tracker.cpp
+++ b/engines/ultima/ultima8/world/missile_tracker.cpp
@@ -119,8 +119,8 @@ MissileTracker::~MissileTracker() {
 }
 
 bool MissileTracker::isPathClear() const {
-	int32 start[3];
-	int32 end[3];
+	Point3 start;
+	Point3 end;
 	int32 dims[3];
 	int32 sx, sy, sz;
 
@@ -138,15 +138,12 @@ bool MissileTracker::isPathClear() const {
 	}
 
 	item->getFootpadWorld(dims[0], dims[1], dims[2]);
-	Point3 pt = item->getLocation();
-	start[0] = pt.x;
-	start[1] = pt.y;
-	start[2] = pt.z;
+	start = item->getLocation();
 
 	for (int f = 0; f < _frames; ++f) {
-		end[0] = start[0] + sx;
-		end[1] = start[1] + sy;
-		end[2] = start[2] + sz;
+		end.x = start.x + sx;
+		end.y = start.y + sy;
+		end.z = start.z + sz;
 
 		// Do the sweep test
 		Std::list<CurrentMap::SweepItem> collisions;
@@ -167,7 +164,7 @@ bool MissileTracker::isPathClear() const {
 		}
 
 		sz -= _gravity;
-		for (int i = 0; i < 3; ++i) start[i] = end[i];
+		start = end;
 	}
 
 	return true;
diff --git a/engines/ultima/ultima8/world/super_sprite_process.cpp b/engines/ultima/ultima8/world/super_sprite_process.cpp
index 52eb19db9ea..3569dadf061 100644
--- a/engines/ultima/ultima8/world/super_sprite_process.cpp
+++ b/engines/ultima/ultima8/world/super_sprite_process.cpp
@@ -306,9 +306,9 @@ void SuperSpriteProcess::makeBulletSplash(const Point3 &pt) {
 	firetypedat->makeBulletSplashShapeAndPlaySound(pt.x, pt.y, pt.z);
 }
 
-static bool _pointOutOfMap(const int32 pt[3], int32 maxxy) {
-	return (pt[0] < 0     || pt[1] < 0     || pt[2] < 0 ||
-			pt[0] > maxxy || pt[1] > maxxy || pt[2] > 255);
+static bool _pointOutOfMap(const Point3 &pt, int32 maxxy) {
+	return (pt.x < 0     || pt.y < 0     || pt.z < 0 ||
+			pt.x > maxxy || pt.y > maxxy || pt.z > 255);
 }
 
 void SuperSpriteProcess::hitAndFinish() {
@@ -319,8 +319,8 @@ void SuperSpriteProcess::hitAndFinish() {
 	int ystep = _pt3.y - _nowpt.y;
 	int zstep = _pt3.z - _nowpt.z;
 	// We add a slight hack - our sweep test is off-by-one on Z??
-	int32 start[3] = {_nowpt.x, _nowpt.y, _nowpt.z + 1};
-	int32 end[3] = {_pt3.x, _pt3.y, _pt3.z + 1};
+	Point3 start(_nowpt.x, _nowpt.y, _nowpt.z + 1);
+	Point3 end(_pt3.x, _pt3.y, _pt3.z + 1);
 	int32 dims[3] = {1, 1, 1};
 	// will never get a collision if not stepping at all..
 	bool collision = !(xstep || ystep || zstep);
@@ -332,12 +332,12 @@ void SuperSpriteProcess::hitAndFinish() {
 								   _source, true, &hits);
 		if (collision)
 			break;
-		start[0] += xstep;
-		start[1] += ystep;
-		start[2] += zstep;
-		end[0] += xstep;
-		end[1] += ystep;
-		end[2] += zstep;
+		start.x += xstep;
+		start.y += ystep;
+		start.z += zstep;
+		end.x += xstep;
+		end.y += ystep;
+		end.z += zstep;
 		const int32 mapmax = map->getChunkSize() * MAP_NUM_CHUNKS;
 		if (_pointOutOfMap(start, mapmax) || _pointOutOfMap(end, mapmax))
 			break;
@@ -346,9 +346,7 @@ void SuperSpriteProcess::hitAndFinish() {
 	if (collision && hits.size()) {
 		const CurrentMap::SweepItem &firsthit = hits.front();
 		_item0x77 = firsthit._item;
-		int32 hitpt[3] = {pt.x, pt.y, pt.z};
-		firsthit.GetInterpolatedCoords(hitpt, start, end);
-		pt = Point3(hitpt[0], hitpt[1], hitpt[2]);
+		pt = firsthit.GetInterpolatedCoords(start, end);
 	}
 
 	Item *item = getItem(_item0x77);
@@ -441,16 +439,13 @@ void SuperSpriteProcess::advanceFrame() {
 bool SuperSpriteProcess::areaSearch() {
 	CurrentMap *map = World::get_instance()->getCurrentMap();
 
-	int32 start[3] = {_nowpt.x, _nowpt.y, _nowpt.z + 1};
-	int32 end[3] = {_pt3.x, _pt3.y, _pt3.z + 1};
+	Point3 start(_nowpt.x, _nowpt.y, _nowpt.z + 1);
+	Point3 end(_pt3.x, _pt3.y, _pt3.z + 1);
 	int32 dims[3] = {1, 1, 1};
 
 	Item *item = getItem(_itemNum);
 	if (item) {
-		Point3 pt = item->getLocation();
-		start[0] = pt.x;
-		start[1] = pt.y;
-		start[2] = pt.z;
+		start = item->getLocation();
 	}
 
 	Std::list<CurrentMap::SweepItem> hits;




More information about the Scummvm-git-logs mailing list