[Scummvm-git-logs] scummvm master -> d1bb58f3ed7276f6bfe7824a7d9ab72c13839884
neuromancer
noreply at scummvm.org
Fri Jun 12 06:39:01 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
d1bb58f3ed FREESCAPE: ignore fully transparent objects when shooting
Commit: d1bb58f3ed7276f6bfe7824a7d9ab72c13839884
https://github.com/scummvm/scummvm/commit/d1bb58f3ed7276f6bfe7824a7d9ab72c13839884
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-06-12T08:38:29+02:00
Commit Message:
FREESCAPE: ignore fully transparent objects when shooting
Changed paths:
engines/freescape/area.cpp
engines/freescape/area.h
engines/freescape/movement.cpp
engines/freescape/objects/geometricobject.cpp
engines/freescape/objects/geometricobject.h
diff --git a/engines/freescape/area.cpp b/engines/freescape/area.cpp
index 09de952404a..65b6d3b4fbd 100644
--- a/engines/freescape/area.cpp
+++ b/engines/freescape/area.cpp
@@ -751,19 +751,23 @@ bool Area::hasActiveGroups() {
return false;
}
-Object *Area::checkCollisionRay(const Math::Ray &ray, int raySize) {
+Object *Area::checkCollisionRay(const Math::Ray &ray, int raySize, bool skipTransparent) {
float distance = 1.0;
float size = 16.0 * 8192.0; // TODO: check if this is the max size
Math::AABB boundingBox(ray.getOrigin(), ray.getOrigin());
Object *collided = nullptr;
for (auto &obj : _drawableObjects) {
- if (obj->getType() == kLineType)
+ if (obj->getType() == kLineType) {
// If the line is not along an axis, the AABB is wildly inaccurate so we skip it
if (((GeometricObject *)obj)->isLineButNotStraight())
continue;
+ }
if (!obj->isDestroyed() && !obj->isInvisible() && obj->isGeometric()) {
GeometricObject *gobj = (GeometricObject *)obj;
+ if (skipTransparent && gobj->isFullyTransparent())
+ continue;
+
Math::Vector3d collidedNormal;
float collidedDistance = sweepAABB(boundingBox, gobj->_boundingBox, raySize * ray.getDirection(), collidedNormal);
debugC(1, kFreescapeDebugMove, "reached obj id: %d with distance %f", obj->getObjectID(), collidedDistance);
diff --git a/engines/freescape/area.h b/engines/freescape/area.h
index 4c6bb1ed9e0..18604f84736 100644
--- a/engines/freescape/area.h
+++ b/engines/freescape/area.h
@@ -69,7 +69,7 @@ public:
void drawGroup(Renderer *gfx, Group *group, bool runAnimation);
void show();
- Object *checkCollisionRay(const Math::Ray &ray, int raySize);
+ Object *checkCollisionRay(const Math::Ray &ray, int raySize, bool skipTransparent = false);
bool checkInSight(const Math::Ray &ray, float maxDistance);
Math::Vector3d separateFromWall(const Math::Vector3d &position);
ObjectArray checkCollisions(const Math::AABB &boundingBox);
diff --git a/engines/freescape/movement.cpp b/engines/freescape/movement.cpp
index b694793a5bb..5303d8c79a5 100644
--- a/engines/freescape/movement.cpp
+++ b/engines/freescape/movement.cpp
@@ -327,7 +327,8 @@ void FreescapeEngine::shoot() {
Math::Vector3d direction = directionToVector(_pitch + angleOffsetY, _yaw - angleOffsetX, false);
Math::Ray ray(_position, direction);
- Object *shot = _currentArea->checkCollisionRay(ray, 8192);
+ // Original shooting picks from rendered faces, so fully transparent geometry does not catch shots.
+ Object *shot = _currentArea->checkCollisionRay(ray, 8192, true);
if (shot) {
GeometricObject *gobj = (GeometricObject *)shot;
debugC(1, kFreescapeDebugMove, "Shot object %d with flags %x", gobj->getObjectID(), gobj->getObjectFlags());
diff --git a/engines/freescape/objects/geometricobject.cpp b/engines/freescape/objects/geometricobject.cpp
index ff9cad736d8..311f462698e 100644
--- a/engines/freescape/objects/geometricobject.cpp
+++ b/engines/freescape/objects/geometricobject.cpp
@@ -490,4 +490,19 @@ void GeometricObject::setColor(uint idx, int color) {
(*_colours)[idx] = color;
}
+bool GeometricObject::isFullyTransparent() const {
+ if (!_colours || _colours->size() == 0)
+ return false;
+
+ for (uint i = 0; i < _colours->size(); i++) {
+ if ((*_colours)[i] != 0)
+ return false;
+
+ if (_ecolours && i < _ecolours->size() && (*_ecolours)[i] != 0)
+ return false;
+ }
+
+ return true;
+}
+
} // End of namespace Freescape
diff --git a/engines/freescape/objects/geometricobject.h b/engines/freescape/objects/geometricobject.h
index 9a08ecf12b9..850d71eced1 100644
--- a/engines/freescape/objects/geometricobject.h
+++ b/engines/freescape/objects/geometricobject.h
@@ -60,6 +60,7 @@ public:
bool collides(const Math::AABB &boundingBox);
void draw(Freescape::Renderer *gfx, float offset = 0.0) override;
void setColor(uint idx, int color);
+ bool isFullyTransparent() const;
bool isDrawable() override;
bool isPlanar() override;
bool _cyclingColors;
More information about the Scummvm-git-logs
mailing list