From aaa88a11f32b53a5d980106afadee5f0833eb6d1 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Wed, 16 Feb 2022 15:22:21 +0000 Subject: [PATCH] Fix: shooting through roof. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9302 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/LOS.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index 09c0ef8b9..5689f2b83 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -3929,15 +3929,17 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) } else if (pStructure->fFlags & STRUCTURE_ROOF) { - // only consider roofs if the flag is set; don't add them to the array since they - // are a special case - if (pBullet->fCheckForRoof) + // only consider roofs if the flag is set; don't add them to the array since they are a special case + // sevenfm: always check roof + //if (pBullet->fCheckForRoof) { pRoofStructure = pStructure; if ( pRoofStructure ) { - qLastZ = pBullet->qCurrZ - pBullet->qIncrZ; + // sevenfm: improved check to catch roof crossing + //qLastZ = pBullet->qCurrZ - pBullet->qIncrZ; + qLastZ = pBullet->qCurrZ - pBullet->qIncrZ * 10; // if just on going to next tile we cross boundary, then roof stops bullet here! if ( (qLastZ > qWallHeight && pBullet->qCurrZ <= qWallHeight) || (qLastZ < qWallHeight && pBullet->qCurrZ >= qWallHeight)) @@ -3948,7 +3950,6 @@ UINT8 CalcChanceToGetThrough( BULLET * pBullet ) return( 0 ); } } - } } else if (pStructure->fFlags & STRUCTURE_PERSON)