[Scummvm-git-logs] scummvm master -> 87efa1ae4fd3139af77f43590a873689abdb47d3

neuromancer noreply at scummvm.org
Sun May 12 18:28:21 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:
79095547e5 FREESCAPE: ordinates are floats to solve some rendering issues
4e443d2eb9 FREESCAPE: reduce separation offset for planar rendering
87efa1ae4f FREESCAPE: added some code to handle ghosts in castle


Commit: 79095547e5788dd1a0f921dd0e79cab36ef0d034
    https://github.com/scummvm/scummvm/commit/79095547e5788dd1a0f921dd0e79cab36ef0d034
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-05-12T20:26:23+02:00

Commit Message:
FREESCAPE: ordinates are floats to solve some rendering issues

Changed paths:
    engines/freescape/gfx.cpp
    engines/freescape/gfx.h
    engines/freescape/loaders/8bitBinaryLoader.cpp
    engines/freescape/objects/geometricobject.cpp
    engines/freescape/objects/geometricobject.h


diff --git a/engines/freescape/gfx.cpp b/engines/freescape/gfx.cpp
index 141f458d5b4..c50873ab09f 100644
--- a/engines/freescape/gfx.cpp
+++ b/engines/freescape/gfx.cpp
@@ -530,7 +530,7 @@ bool Renderer::computeScreenViewport() {
 	return true;
 }
 
-void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d &size, const Common::Array<uint16> *ordinates, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, int type) {
+void Renderer::renderPyramid(const Math::Vector3d &origin, const Math::Vector3d &size, const Common::Array<float> *ordinates, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, int type) {
 	Math::Vector3d vertices[8] = { origin, origin, origin, origin, origin, origin, origin, origin };
 	switch (type) {
 	default:
@@ -969,8 +969,8 @@ void Renderer::renderRectangle(const Math::Vector3d &originalOrigin, const Math:
 	polygonOffset(false);
 }
 
-void Renderer::renderPolygon(const Math::Vector3d &origin, const Math::Vector3d &size, const Common::Array<uint16> *originalOrdinates, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, float offset) {
-	Common::Array<uint16> *ordinates = new Common::Array<uint16>(*originalOrdinates);
+void Renderer::renderPolygon(const Math::Vector3d &origin, const Math::Vector3d &size, const Common::Array<float> *originalOrdinates, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, float offset) {
+	Common::Array<float> *ordinates = new Common::Array<float>(*originalOrdinates);
 
 	uint8 r1, g1, b1, r2, g2, b2;
 	byte *stipple = nullptr;
diff --git a/engines/freescape/gfx.h b/engines/freescape/gfx.h
index 297c2e9fd89..afac13cad00 100644
--- a/engines/freescape/gfx.h
+++ b/engines/freescape/gfx.h
@@ -91,8 +91,8 @@ public:
 
 	virtual void renderCube(const Math::Vector3d &position, const Math::Vector3d &size, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, float offset = 0.0);
 	virtual void renderRectangle(const Math::Vector3d &position, const Math::Vector3d &size, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, float offset = 0.0);
-	virtual void renderPolygon(const Math::Vector3d &origin, const Math::Vector3d &size, const Common::Array<uint16> *ordinates, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, float offset = 0.0);
-	virtual void renderPyramid(const Math::Vector3d &origin, const Math::Vector3d &size, const Common::Array<uint16> *ordinates, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, int type);
+	virtual void renderPolygon(const Math::Vector3d &origin, const Math::Vector3d &size, const Common::Array<float> *ordinates, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, float offset = 0.0);
+	virtual void renderPyramid(const Math::Vector3d &origin, const Math::Vector3d &size, const Common::Array<float> *ordinates, Common::Array<uint8> *colours, Common::Array<uint8> *ecolours, int type);
 	virtual void renderFace(const Common::Array<Math::Vector3d> &vertices) = 0;
 
 	void setColorRemaps(ColorReMap *colorRemaps);
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index e39cd167205..99a1f7cb253 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -377,10 +377,10 @@ Object *FreescapeEngine::load8bitObject(Common::SeekableReadStream *file) {
 		// read extra vertices if required...
 		int numberOfOrdinates = GeometricObject::numberOfOrdinatesForType(objectType);
 		debugC(1, kFreescapeDebugParser, "number of ordinates %d", numberOfOrdinates);
-		Common::Array<uint16> *ordinates = nullptr;
+		Common::Array<float> *ordinates = nullptr;
 
 		if (numberOfOrdinates) {
-			ordinates = new Common::Array<uint16>;
+			ordinates = new Common::Array<float>;
 			uint16 ord = 0;
 			if (byteSizeOfObject < numberOfOrdinates) {
 				error("Not enough bytes to read all the ordinates");
diff --git a/engines/freescape/objects/geometricobject.cpp b/engines/freescape/objects/geometricobject.cpp
index 0b33db69d42..66528412642 100644
--- a/engines/freescape/objects/geometricobject.cpp
+++ b/engines/freescape/objects/geometricobject.cpp
@@ -122,7 +122,7 @@ GeometricObject::GeometricObject(
 	const Math::Vector3d &size_,
 	Common::Array<uint8> *colours_,
 	Common::Array<uint8> *ecolours_,
-	Common::Array<uint16> *ordinates_,
+	Common::Array<float> *ordinates_,
 	FCLInstructionVector conditionInstructions_,
 	Common::String conditionSource_) {
 	_type = type_;
@@ -157,7 +157,7 @@ GeometricObject::GeometricObject(
 
 	if (ordinates_) {
 		_ordinates = ordinates_;
-		_initialOrdinates = new Common::Array<uint16>(*_ordinates);
+		_initialOrdinates = new Common::Array<float>(*_ordinates);
 	}
 	_condition = conditionInstructions_;
 	_conditionSource = conditionSource_;
@@ -169,7 +169,7 @@ GeometricObject::GeometricObject(
 
 			_type = kLineType;
 			assert(!_ordinates);
-			_ordinates = new Common::Array<uint16>();
+			_ordinates = new Common::Array<float>();
 			_ordinates->push_back(_origin.x());
 			_ordinates->push_back(_origin.y());
 			_ordinates->push_back(_origin.z());
@@ -241,7 +241,7 @@ void GeometricObject::restoreOrdinates() {
 Object *GeometricObject::duplicate() {
 	Common::Array<uint8> *coloursCopy = nullptr;
 	Common::Array<uint8> *ecoloursCopy = nullptr;
-	Common::Array<uint16> *ordinatesCopy = nullptr;
+	Common::Array<float> *ordinatesCopy = nullptr;
 	FCLInstructionVector *conditionCopy = nullptr;
 
 	if (_colours)
@@ -251,7 +251,7 @@ Object *GeometricObject::duplicate() {
 		ecoloursCopy = new Common::Array<uint8>(*_ecolours);
 
 	if (_ordinates)
-		ordinatesCopy = new Common::Array<uint16>(*_ordinates);
+		ordinatesCopy = new Common::Array<float>(*_ordinates);
 
 	conditionCopy = duplicateCondition(&_condition);
 	assert(conditionCopy);
diff --git a/engines/freescape/objects/geometricobject.h b/engines/freescape/objects/geometricobject.h
index 3b164d4e986..804f4b3b104 100644
--- a/engines/freescape/objects/geometricobject.h
+++ b/engines/freescape/objects/geometricobject.h
@@ -46,7 +46,7 @@ public:
 		const Math::Vector3d &size,
 		Common::Array<uint8> *colours,
 		Common::Array<uint8> *ecolours,
-		Common::Array<uint16> *ordinates,
+		Common::Array<float> *ordinates,
 		FCLInstructionVector conditionInstructions,
 		Common::String conditionSource = "");
 	virtual ~GeometricObject();
@@ -69,8 +69,8 @@ public:
 private:
 	Common::Array<uint8> *_colours;
 	Common::Array<uint8> *_ecolours;
-	Common::Array<uint16> *_ordinates;
-	Common::Array<uint16> *_initialOrdinates;
+	Common::Array<float> *_ordinates;
+	Common::Array<float> *_initialOrdinates;
 };
 
 } // End of namespace Freescape


Commit: 4e443d2eb9dcd2ef4ab6d7a2d8df889cd51dd11b
    https://github.com/scummvm/scummvm/commit/4e443d2eb9dcd2ef4ab6d7a2d8df889cd51dd11b
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-05-12T20:26:23+02:00

Commit Message:
FREESCAPE: reduce separation offset for planar rendering

Changed paths:
    engines/freescape/area.cpp


diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index ee5ac8c9867..61719c3a66f 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -228,6 +228,7 @@ void Area::draw(Freescape::Renderer *gfx, uint32 animationTicks, Math::Vector3d
 	ObjectArray planarObjects;
 	ObjectArray nonPlanarObjects;
 	Object *floor = nullptr;
+	float offset = 0.5;
 
 	for (auto &obj : _drawableObjects) {
 		if (!obj->isDestroyed() && !obj->isInvisible()) {
@@ -267,7 +268,6 @@ void Area::draw(Freescape::Renderer *gfx, uint32 animationTicks, Math::Vector3d
 			if (distance.length() > 0)
 				continue;
 
-			float offset = 1;
 			if (planar->getSize().x() == 0) {
 				if (object->getOrigin().x() >= centerPlanar.x())
 					offsetMap[planar] = -offset;
@@ -316,7 +316,6 @@ void Area::draw(Freescape::Renderer *gfx, uint32 animationTicks, Math::Vector3d
 			if (offsetMap[planar] == offsetMap[object] && offsetMap[object] != 0) {
 				// Nothing to do?
 			} else if (offsetMap[planar] == offsetMap[object] && offsetMap[object] == 0) {
-				float offset = 1.0;
 				if (planar->getSize().x() == 0) {
 					if (object->getOrigin().x() < centerPlanar.x())
 						offsetMap[planar] = -offset;


Commit: 87efa1ae4fd3139af77f43590a873689abdb47d3
    https://github.com/scummvm/scummvm/commit/87efa1ae4fd3139af77f43590a873689abdb47d3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-05-12T20:26:23+02:00

Commit Message:
FREESCAPE: added some code to handle ghosts in castle

Changed paths:
    engines/freescape/area.cpp
    engines/freescape/area.h
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/games/castle/castle.cpp
    engines/freescape/games/castle/castle.h
    engines/freescape/games/castle/dos.cpp
    engines/freescape/language/instruction.cpp
    engines/freescape/objects/geometricobject.cpp
    engines/freescape/objects/group.cpp
    engines/freescape/objects/group.h


diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index 61719c3a66f..61eefb8b42a 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -358,6 +358,17 @@ void Area::drawGroup(Freescape::Renderer *gfx, Group* group, bool runAnimation)
 		group->draw(gfx);
 }
 
+bool Area::hasActiveGroups() {
+	for (auto &obj : _drawableObjects) {
+		if (obj->getType() == kGroupType) {
+			Group *group = (Group *)obj;
+			if (group->isActive())
+				return true;
+		}
+	}
+	return false;
+}
+
 Object *Area::checkCollisionRay(const Math::Ray &ray, int raySize) {
 	float distance = 1.0;
 	float size = 16.0 * 8192.0; // TODO: check if this is the max size
@@ -508,7 +519,7 @@ void Area::addGroupFromArea(int16 id, Area *global) {
 	assert(obj->getType() == ObjectType::kGroupType);
 
 	addObjectFromArea(id, global);
-	//Group *group = (Group *)objectWithID(id);
+	Group *group = (Group *)objectWithID(id);
 	for (auto &it : ((Group *)obj)->_objectIds) {
 		if (it == 0 || it == 0xffff)
 			break;
@@ -516,7 +527,7 @@ void Area::addGroupFromArea(int16 id, Area *global) {
 			continue;
 
 		addObjectFromArea(it, global);
-		//group->linkObject(objectWithID(it));
+		group->linkObject(objectWithID(it));
 	}
 }
 
diff --git a/engines/freescape/area.h b/engines/freescape/area.h
index 32dd19b8e06..0c128aa6805 100644
--- a/engines/freescape/area.h
+++ b/engines/freescape/area.h
@@ -68,6 +68,7 @@ public:
 	void removeObject(int16 id);
 	void resetArea();
 	bool isOutside();
+	bool hasActiveGroups();
 
 	Common::Array<Common::String> _conditionSources;
 	Common::Array<FCLInstructionVector> _conditions;
diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index d6fff544b5e..b354c3d2094 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -347,9 +347,12 @@ void FreescapeEngine::drawFrame() {
 	}
 
 	drawBackground();
-	if (_avoidRenderingFrames == 0) // Avoid rendering inside objects
+	if (_avoidRenderingFrames == 0) { // Avoid rendering inside objects
 		_currentArea->draw(_gfx, _ticks / 10, _position, _cameraFront);
-	else
+		if (_currentArea->hasActiveGroups() && _ticks % 50 == 0) {
+			executeMovementConditions();
+		}
+	} else
 		_avoidRenderingFrames--;
 
 	if (_underFireFrames > 0) {
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index b55bcae3f2c..0c74167eceb 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -454,7 +454,7 @@ public:
 	bool _forceEndGame;
 	bool _playerWasCrushed;
 	ObjectArray _sensors;
-	void checkSensors();
+	virtual void checkSensors();
 	virtual void drawSensorShoot(Sensor *sensor);
 	void takeDamageFromSensor();
 
diff --git a/engines/freescape/games/castle/castle.cpp b/engines/freescape/games/castle/castle.cpp
index cc854fcfb01..fd3b9a33d1a 100644
--- a/engines/freescape/games/castle/castle.cpp
+++ b/engines/freescape/games/castle/castle.cpp
@@ -387,6 +387,70 @@ void CastleEngine::drawRiddle(uint16 riddle, uint32 front, uint32 back, Graphics
 	drawFullscreenSurface(surface);
 }
 
+void CastleEngine::addGhosts() {
+	for (auto &it : _areaMap) {
+		for (auto &sensor : it._value->getSensors()) {
+			if (sensor->getObjectID() == 125) {
+				_areaMap[it._key]->addGroupFromArea(195, _areaMap[255]);
+				_areaMap[it._key]->addGroupFromArea(212, _areaMap[255]);
+			} else if (sensor->getObjectID() == 126)
+				_areaMap[it._key]->addGroupFromArea(191, _areaMap[255]);
+			else if (sensor->getObjectID() == 127)
+				_areaMap[it._key]->addGroupFromArea(182, _areaMap[255]);
+			else
+				debugC(1, kFreescapeDebugParser, "Sensor %d in area %d", sensor->getObjectID(), it._key);
+		}
+	}
+}
+
+void CastleEngine::checkSensors() {
+	if (_disableSensors)
+		return;
+
+	if (_lastTick == _ticks)
+		return;
+
+	_lastTick = _ticks;
+
+	if (_sensors.empty())
+		return;
+
+	Sensor *sensor = (Sensor *)&_sensors[0];
+	if (sensor->getObjectID() == 125) {
+		Group *group = (Group *)_currentArea->objectWithID(195);
+		if (!group->isDestroyed() && !group->isInvisible()) {
+			group->_active = true;
+		} else
+			return;
+
+		group = (Group *)_currentArea->objectWithID(212);
+		if (!group->isDestroyed() && !group->isInvisible()) {
+			group->_active = true;
+		} else
+			return;
+
+	} else if (sensor->getObjectID() == 126) {
+		Group *group = (Group *)_currentArea->objectWithID(191);
+		if (!group->isDestroyed() && !group->isInvisible()) {
+			group->_active = true;
+		} else
+			return;
+	} else if (sensor->getObjectID() == 197) {
+		Group *group = (Group *)_currentArea->objectWithID(182);
+		if (!group->isDestroyed() && !group->isInvisible()) {
+			group->_active = true;
+		} else
+			return;
+	}
+
+	/*int firingInterval = 10; // This is fixed for all the ghosts?
+	if (_ticks % firingInterval == 0) {
+		if (_underFireFrames <= 0)
+			_underFireFrames = 4;
+		takeDamageFromSensor();
+	}*/
+}
+
 
 Common::Error CastleEngine::saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave) {
 	return Common::kNoError;
diff --git a/engines/freescape/games/castle/castle.h b/engines/freescape/games/castle/castle.h
index 6c01a2943bf..c796c79e7dc 100644
--- a/engines/freescape/games/castle/castle.h
+++ b/engines/freescape/games/castle/castle.h
@@ -35,6 +35,7 @@ public:
 
 	void drawDOSUI(Graphics::Surface *surface) override;
 	void pressedKey(const int keycode) override;
+	void checkSensors() override;
 
 	void executePrint(FCLInstruction &instruction) override;
 	void gotoArea(uint16 areaID, int entranceID) override;
@@ -47,6 +48,7 @@ private:
 	void loadRiddles(Common::SeekableReadStream *file, int offset, int number);
 	void drawFullscreenRiddleAndWait(uint16 riddle);
 	void drawRiddle(uint16 riddle, uint32 front, uint32 back, Graphics::Surface *surface);
+	void addGhosts();
 };
 
 extern byte kFreescapeCastleFont[];
diff --git a/engines/freescape/games/castle/dos.cpp b/engines/freescape/games/castle/dos.cpp
index cd704a1a7d0..469f1b9b1a8 100644
--- a/engines/freescape/games/castle/dos.cpp
+++ b/engines/freescape/games/castle/dos.cpp
@@ -114,18 +114,7 @@ void CastleEngine::loadAssetsDOSFullGame() {
 	} else
 		error("Not implemented yet");
 
-	for (auto &it : _areaMap) {
-		for (auto &sensor : it._value->getSensors()) {
-			if (sensor->getObjectID() == 125)
-				_areaMap[it._key]->addGroupFromArea(195, _areaMap[255]);
-			else if (sensor->getObjectID() == 126)
-				_areaMap[it._key]->addGroupFromArea(191, _areaMap[255]);
-			else if (sensor->getObjectID() == 127)
-				_areaMap[it._key]->addGroupFromArea(182, _areaMap[255]);
-			else
-				debugC(1, kFreescapeDebugParser, "Sensor %d in area %d", sensor->getObjectID(), it._key);
-		}
-	}
+	addGhosts();
 	// CPC
 	// file = gameDir.createReadStreamForMember("cm.bin");
 	// if (file == nullptr)
diff --git a/engines/freescape/language/instruction.cpp b/engines/freescape/language/instruction.cpp
index 5cba30f4295..3681d50005d 100644
--- a/engines/freescape/language/instruction.cpp
+++ b/engines/freescape/language/instruction.cpp
@@ -112,8 +112,6 @@ bool FreescapeEngine::executeObjectConditions(GeometricObject *obj, bool shot, b
 }
 
 void FreescapeEngine::executeLocalGlobalConditions(bool shot, bool collided, bool timer) {
-	if (isCastle())
-		return;
 	debugC(1, kFreescapeDebugCode, "Executing room conditions");
 	Common::Array<FCLInstructionVector> conditions = _currentArea->_conditions;
 	Common::Array<Common::String> conditionSources = _currentArea->_conditionSources;
@@ -363,6 +361,8 @@ bool FreescapeEngine::executeEndIfVisibilityIsEqual(FCLInstruction &instruction)
 	Object *obj = nullptr;
 	if (additional == 0) {
 		obj = _currentArea->objectWithID(source);
+		if (!obj && isCastle())
+			return false; // The value is not important
 		assert(obj);
 		debugC(1, kFreescapeDebugCode, "End condition if visibility of obj with id %d is %d!", source, value);
 	} else {
@@ -498,6 +498,8 @@ void FreescapeEngine::executeMakeInvisible(FCLInstruction &instruction) {
 	debugC(1, kFreescapeDebugCode, "Making obj %d invisible in area %d!", objectID, areaID);
 	if (_areaMap.contains(areaID)) {
 		Object *obj = _areaMap[areaID]->objectWithID(objectID);
+		if (!obj && isCastle())
+			return; // No side effects
 		assert(obj); // We assume the object was there
 		obj->makeInvisible();
 	} else {
@@ -522,6 +524,8 @@ void FreescapeEngine::executeMakeVisible(FCLInstruction &instruction) {
 	debugC(1, kFreescapeDebugCode, "Making obj %d visible in area %d!", objectID, areaID);
 	if (_areaMap.contains(areaID)) {
 		Object *obj = _areaMap[areaID]->objectWithID(objectID);
+		if (!obj && isCastle())
+			return; // No side effects
 		assert(obj); // We assume an object should be there
 		obj->makeVisible();
 		if (!isDriller()) {
diff --git a/engines/freescape/objects/geometricobject.cpp b/engines/freescape/objects/geometricobject.cpp
index 66528412642..46d175998ad 100644
--- a/engines/freescape/objects/geometricobject.cpp
+++ b/engines/freescape/objects/geometricobject.cpp
@@ -192,23 +192,22 @@ void GeometricObject::setOrigin(Math::Vector3d origin_) {
 void GeometricObject::offsetOrigin(Math::Vector3d origin_) {
 	if (isPolygon(_type)) {
 		Math::Vector3d offset = origin_ - _origin;
-		offset = 32 * offset;
 		for (int i = 0; i < int(_ordinates->size()); i = i + 3) {
-			int16 ordinate = 0;
+			float ordinate = 0;
 			ordinate = (*_ordinates)[i];
-			ordinate +=  int16(offset.x());
+			ordinate +=  offset.x();
 			assert(ordinate >= 0);
-			(*_ordinates)[i] = uint16(ordinate);
+			(*_ordinates)[i] = ordinate;
 
 			ordinate = (*_ordinates)[i + 1];
-			ordinate +=  int16(offset.y());
+			ordinate +=  offset.y();
 			assert(ordinate >= 0);
-			(*_ordinates)[i + 1] = uint16(ordinate);
+			(*_ordinates)[i + 1] = ordinate;
 
 			ordinate = (*_ordinates)[i + 2];
-			ordinate +=  int16(offset.z());
+			ordinate +=  offset.z();
 			assert(ordinate >= 0);
-			(*_ordinates)[i + 2] = uint16(ordinate);
+			(*_ordinates)[i + 2] = ordinate;
 		}
 	}
 	setOrigin(origin_);
@@ -219,7 +218,6 @@ void GeometricObject::scale(int factor) {
 	_size = _size / factor;
 	if (_ordinates) {
 		for (uint i = 0; i < _ordinates->size(); i++) {
-			// This division is always exact because each ordinate was multipled by 32
 			(*_ordinates)[i] = (*_ordinates)[i] / factor;
 			if (_initialOrdinates)
 				(*_initialOrdinates)[i] = (*_initialOrdinates)[i] / factor;
diff --git a/engines/freescape/objects/group.cpp b/engines/freescape/objects/group.cpp
index c6f4099df03..0839edde65e 100644
--- a/engines/freescape/objects/group.cpp
+++ b/engines/freescape/objects/group.cpp
@@ -89,10 +89,7 @@ void Group::assemble(int index) {
 	//gobj->makeVisible();
 	Math::Vector3d position = _operations[_step]->position;
 
-	if (!GeometricObject::isPolygon(gobj->getType()))
-		position = 32 * position / _scale;
-	else
-		position = position / _scale;
+	position = 32 * position / _scale;
 	gobj->offsetOrigin(position + _origins[index] - _origins[0]);
 }
 
@@ -102,7 +99,9 @@ void Group::run() {
 
 	int opcode = _operations[_step]->opcode;
 	if (opcode == 0x80 || opcode == 0xff) {
-		reset();
+		_step = -1;
+		_active = false;
+		_finished = false;
 	} else if (opcode == 0x01) {
 		g_freescape->executeCode(_operations[_step]->condition, false, true, false, false);
 	} else if (opcode == 0x6e) {
@@ -124,18 +123,18 @@ void Group::run() {
 }
 
 void Group::reset() {
-	_step = -1;
+	/*_step = -1;
 	_active = false;
 	_finished = false;
 	uint32 groupSize = _objects.size();
 	for (uint32 i = 0; i < groupSize ; i++) {
 		GeometricObject *gobj = (GeometricObject *)_objects[i];
 		if (GeometricObject::isPolygon(_objects[i]->getType())) {
-			gobj->setOrigin(_origins[i]);
-			gobj->restoreOrdinates();
-			gobj->makeInvisible();
+			//gobj->setOrigin(_origins[i]);
+			//gobj->restoreOrdinates();
+			//gobj->makeInvisible();
 		}
-	}
+	}*/
 }
 
 void Group::draw(Renderer *gfx, float offset) {
diff --git a/engines/freescape/objects/group.h b/engines/freescape/objects/group.h
index f1514eb8424..3232098e9f8 100644
--- a/engines/freescape/objects/group.h
+++ b/engines/freescape/objects/group.h
@@ -63,6 +63,7 @@ public:
 	bool isDrawable() override { return true; }
 	void draw(Renderer *gfx, float offset = 0.0) override;
 	void scale(int scale_) override { _scale = scale_; };
+	bool isActive() { return !isDestroyed() && !isInvisible() && _step > 0 && !_finished; };
 	Object *duplicate() override;
 };
 




More information about the Scummvm-git-logs mailing list