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

neuromancer noreply at scummvm.org
Wed Jan 11 12:14:22 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:
c94b421c58 FREESCAPE: improved drill position checking in driller


Commit: c94b421c58a295de470ec686ee475d0011f5f085
    https://github.com/scummvm/scummvm/commit/c94b421c58a295de470ec686ee475d0011f5f085
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-01-11T09:13:58-03:00

Commit Message:
FREESCAPE: improved drill position checking in driller

Changed paths:
    engines/freescape/freescape.h
    engines/freescape/games/driller.cpp


diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 6605a9db304..db3226b9327 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -358,6 +358,7 @@ enum DrillerReleaseFlags {
 class DrillerEngine : public FreescapeEngine {
 public:
 	DrillerEngine(OSystem *syst, const ADGameDescription *gd);
+	~DrillerEngine();
 
 	uint32 _initialJetEnergy;
 	uint32 _initialJetShield;
@@ -388,6 +389,7 @@ public:
 private:
 	void loadGlobalObjects(Common::SeekableReadStream *file, int offset);
 	bool drillDeployed(Area *area);
+	GeometricObject *_drillBase;
 	Math::Vector3d drillPosition();
 	void addDrill(const Math::Vector3d position, bool gasFound);
 	bool checkDrill(const Math::Vector3d position);
diff --git a/engines/freescape/games/driller.cpp b/engines/freescape/games/driller.cpp
index d30288a79f4..2214ec3f522 100644
--- a/engines/freescape/games/driller.cpp
+++ b/engines/freescape/games/driller.cpp
@@ -133,8 +133,18 @@ DrillerEngine::DrillerEngine(OSystem *syst, const ADGameDescription *gd) : Frees
 	_initialTankShield = 50;
 	_initialJetEnergy = 29;
 	_initialJetShield = 34;
+
+	Math::Vector3d drillBaseOrigin = Math::Vector3d(0, 0, 0);
+	Math::Vector3d drillBaseSize = Math::Vector3d(3, 2, 3);
+	_drillBase = new GeometricObject(kCubeType, 0, 0, drillBaseOrigin, drillBaseSize, nullptr, nullptr, FCLInstructionVector(), "");
+	assert(!_drillBase->isDestroyed() && !_drillBase->isInvisible());
+}
+
+DrillerEngine::~DrillerEngine() {
+	delete _drillBase;
 }
 
+
 void DrillerEngine::gotoArea(uint16 areaID, int entranceID) {
 	int prevAreaID = _currentArea ? _currentArea->getAreaID(): -1;
 	debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);
@@ -1315,8 +1325,8 @@ Math::Vector3d DrillerEngine::drillPosition() {
 
 	Object *obj = (GeometricObject *)_areaMap[255]->objectWithID(255); // Drill base
 	assert(obj);
-	position.setValue(0, position.x() - obj->getSize().x() / 2);
-	position.setValue(2, position.z() - obj->getSize().z() / 2);
+	position.setValue(0, position.x() - 128);
+	position.setValue(2, position.z() - 128);
 	return position;
 }
 
@@ -1331,15 +1341,26 @@ bool DrillerEngine::checkDrill(const Math::Vector3d position) {
 	int16 id;
 	int heightLastObject;
 
+	origin.setValue(0, origin.x() + 128);
+	origin.setValue(1, origin.y() - 5);
+	origin.setValue(2, origin.z() + 128);
+
+	_drillBase->setOrigin(origin);
+	if (_currentArea->checkCollisions(_drillBase->_boundingBox).empty())
+		return false;
+
+	origin.setValue(0, origin.x() - 128);
+	origin.setValue(2, origin.z() - 128);
+
 	id = 255;
 	obj = (GeometricObject *)_areaMap[255]->objectWithID(id);
 	assert(obj);
 	obj = (GeometricObject *)obj->duplicate();
-	origin.setValue(1, origin.y() - 5);
+	origin.setValue(1, origin.y() + 6);
 	obj->setOrigin(origin);
 
 	// This bounding box is too large and can result in the drill to float next to a wall
-	if (_currentArea->checkCollisions(obj->_boundingBox).empty())
+	if (!_currentArea->checkCollisions(obj->_boundingBox).empty())
 		return false;
 
 	origin.setValue(1, origin.y() + 15);




More information about the Scummvm-git-logs mailing list