[Scummvm-git-logs] scummvm master -> 78573390f59a7e35fb498e6f988afa35b4e3b775
neuromancer
noreply at scummvm.org
Tue Aug 20 19:57:54 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:
78573390f5 FREESCAPE: improved general approach for detecting frontal collisions
Commit: 78573390f59a7e35fb498e6f988afa35b4e3b775
https://github.com/scummvm/scummvm/commit/78573390f59a7e35fb498e6f988afa35b4e3b775
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2024-08-20T21:59:19+02:00
Commit Message:
FREESCAPE: improved general approach for detecting frontal collisions
Changed paths:
engines/freescape/games/eclipse/cpc.cpp
engines/freescape/movement.cpp
diff --git a/engines/freescape/games/eclipse/cpc.cpp b/engines/freescape/games/eclipse/cpc.cpp
index ea8798c0e78..557ee43b917 100644
--- a/engines/freescape/games/eclipse/cpc.cpp
+++ b/engines/freescape/games/eclipse/cpc.cpp
@@ -196,6 +196,14 @@ void EclipseEngine::drawCPCUI(Graphics::Surface *surface) {
drawIndicator(surface, 45, 4, 12);
drawEclipseIndicator(surface, 228, 0, front, other);
+ uint32 blue = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x55, 0x55, 0xFF);
+
+ Common::Rect jarBackground(124, 165, 148, 192);
+ surface->fillRect(jarBackground, back);
+
+ Common::Rect jarWater(124, 192 - _gameStateVars[k8bitVariableEnergy], 148, 192);
+ surface->fillRect(jarWater, blue);
+
surface->fillRect(Common::Rect(225, 168, 235, 187), front);
drawCompass(surface, 229, 177, _yaw, 10, back);
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index 9cb5ede2646..fbf68a09888 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -439,16 +439,21 @@ bool FreescapeEngine::runCollisionConditions(Math::Vector3d const lastPosition,
Math::Vector3d direction = newPosition - lastPosition;
direction.normalize();
- ray = Math::Ray(lastPosition, direction);
int rayLenght = 45;
if (_currentArea->getScale() >= 5)
rayLenght = MAX(5, 45 / (2 * _currentArea->getScale()));
- collided = _currentArea->checkCollisionRay(ray, rayLenght);
- if (collided) {
- gobj = (GeometricObject *)collided;
- debugC(1, kFreescapeDebugMove, "Collided with object id %d of size %f %f %f", gobj->getObjectID(), gobj->getSize().x(), gobj->getSize().y(), gobj->getSize().z());
- executed |= executeObjectConditions(gobj, false, true, false);
+ for (int i = 0; i <= 2; i++) {
+ Math::Vector3d rayPosition = lastPosition;
+ rayPosition.y() = rayPosition.y() - _playerHeight * (i / 4.0);
+ ray = Math::Ray(rayPosition, direction);
+ collided = _currentArea->checkCollisionRay(ray, rayLenght);
+ if (collided) {
+ gobj = (GeometricObject *)collided;
+ debugC(1, kFreescapeDebugMove, "Collided with object id %d of size %f %f %f", gobj->getObjectID(), gobj->getSize().x(), gobj->getSize().y(), gobj->getSize().z());
+ executed |= executeObjectConditions(gobj, false, true, false);
+ break;
+ }
}
return executed;
More information about the Scummvm-git-logs
mailing list