[Scummvm-git-logs] scummvm master -> 99c9c041a79ae31b423a8951db0d2ac578bbc08a
neuromancer
noreply at scummvm.org
Fri Oct 25 18:50:52 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:
99c9c041a7 FREESCAPE: support some special entrances in castle
Commit: 99c9c041a79ae31b423a8951db0d2ac578bbc08a
https://github.com/scummvm/scummvm/commit/99c9c041a79ae31b423a8951db0d2ac578bbc08a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-10-25T20:40:31+02:00
Commit Message:
FREESCAPE: support some special entrances in castle
Changed paths:
engines/freescape/area.cpp
engines/freescape/loaders/8bitBinaryLoader.cpp
engines/freescape/movement.cpp
diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index eb82798d292..f56c02255aa 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -406,7 +406,7 @@ Object *Area::checkCollisionRay(const Math::Ray &ray, int raySize) {
GeometricObject *gobj = (GeometricObject *)obj;
Math::Vector3d collidedNormal;
float collidedDistance = sweepAABB(boundingBox, gobj->_boundingBox, raySize * ray.getDirection(), collidedNormal);
- debugC(1, kFreescapeDebugMove, "shot obj id: %d with distance %f", obj->getObjectID(), collidedDistance);
+ debugC(1, kFreescapeDebugMove, "reached obj id: %d with distance %f", obj->getObjectID(), collidedDistance);
if (collidedDistance >= 1.0)
continue;
diff --git a/engines/freescape/loaders/8bitBinaryLoader.cpp b/engines/freescape/loaders/8bitBinaryLoader.cpp
index 9bd84806bc9..b0ce40f7f03 100644
--- a/engines/freescape/loaders/8bitBinaryLoader.cpp
+++ b/engines/freescape/loaders/8bitBinaryLoader.cpp
@@ -487,11 +487,44 @@ Object *FreescapeEngine::load8bitObject(Common::SeekableReadStream *file) {
}
assert(byteSizeOfObject == 0);
debugC(1, kFreescapeDebugParser, "End of object at %lx", long(file->pos()));
+
+ if (isCastle()) {
+
+ if (position.x() == 255)
+ position.x() = -8096;
+ else
+ position.x() = 32 * position.x();
+
+ if (position.y() == 255)
+ position.y() = -8096;
+ else
+ position.y() = 32 * position.y();
+
+ if (position.z() == 255)
+ position.z() = -8096;
+ else
+ position.z() = 32 * position.z();
+
+ if (v.x() == 255 && v.y() == 255 && v.z() == 255) {
+ v.x() = -8096;
+ v.y() = -8096;
+ v.z() = -8096;
+ } else {
+ v.x() = 5 * v.x();
+ v.y() = 5 * v.y();
+ v.z() = 5 * v.z();
+ }
+
+ } else {
+ v = 5 * v;
+ position = 32 * position;
+ }
+
// create an entrance
return new Entrance(
objectID,
- 32 * position,
- 5 * v, // rotation
+ position,
+ v, // rotation
instructions,
conditionSource);
} break;
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index cee3c57e2c7..1d82482bae3 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -130,29 +130,47 @@ void FreescapeEngine::traverseEntrance(uint16 entranceID) {
Math::Vector3d rotation = entrance->getRotation();
_position = entrance->getOrigin();
- if (scale == 1) {
+ if (_position.x() < 0) {
+ assert(isCastle());
+ _position.x() = _lastPosition.x();
+ }
+
+ if (_position.y() < 0) {
+ assert(isCastle());
+ _position.y() = _lastPosition.y();
+ }
+
+ if (_position.z() < 0) {
+ assert(isCastle());
+ _position.z() = _lastPosition.z();
+ }
+
+ // TODO: verify if this is needed
+ /*if (scale == 1) {
_position.x() = _position.x() + 16;
_position.z() = _position.z() + 16;
} else if (scale == 5) {
_position.x() = _position.x() + 4;
_position.z() = _position.z() + 4;
+ }*/
+
+ if (rotation.x() >= 0 && rotation.y() >= 0 && rotation.z() >= 0) {
+ _pitch = rotation.x();
+ float y = rotation.y();
+
+ // Adjust _yaw based on normalized angle
+ if (y >= 0 && y < 90)
+ _yaw = 90 - y; // 0 to 90 maps to 90 to 0 (yaw should be 90 to 0)
+ else if (y >= 90 && y <= 180)
+ _yaw = 450 - y; // 90 to 180 maps to 360 to 270 (yaw should be 360 to 270)
+ else if (y > 180 && y <= 225)
+ _yaw = y; // 180 to 225 maps to 180 to 225 (yaw should be 180 to 225)
+ else if (y > 225 && y < 270)
+ _yaw = y - 90; // 180 to 270 maps to 90 to 0 (yaw should be 90 to 0)
+ else
+ _yaw = 360 + 90 - y; // 270 to 360 maps to 90 to 180 (yaw should be 90 to 180)
}
- _pitch = rotation.x();
- float y = rotation.y();
-
- // Adjust _yaw based on normalized angle
- if (y >= 0 && y < 90)
- _yaw = 90 - y; // 0 to 90 maps to 90 to 0 (yaw should be 90 to 0)
- else if (y >= 90 && y <= 180)
- _yaw = 450 - y; // 90 to 180 maps to 360 to 270 (yaw should be 360 to 270)
- else if (y > 180 && y <= 225)
- _yaw = y; // 180 to 225 maps to 180 to 225 (yaw should be 180 to 225)
- else if (y > 225 && y < 270)
- _yaw = y - 90; // 180 to 270 maps to 90 to 0 (yaw should be 90 to 0)
- else
- _yaw = 360 + 90 - y; // 270 to 360 maps to 90 to 180 (yaw should be 90 to 180)
-
debugC(1, kFreescapeDebugMove, "entrace position: %f %f %f", _position.x(), _position.y(), _position.z());
// Set the player height
_playerHeight = 0;
@@ -463,6 +481,9 @@ bool FreescapeEngine::runCollisionConditions(Math::Vector3d const lastPosition,
executed |= executeObjectConditions(gobj, false, true, false);
//break;
}
+ if (areaID != _currentArea->getAreaID()) {
+ return true;
+ }
}
return executed;
More information about the Scummvm-git-logs
mailing list