From 9444bd437055b9fac0204709626fe8fc84fcb510 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Aug 2022 17:51:41 +0200 Subject: [PATCH] - last FAFcansee bunch --- source/games/sw/src/game.h | 6 ++++++ source/games/sw/src/weapon.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 95b6a27c5..75ade5cb4 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2203,6 +2203,12 @@ inline double ActorLowerZ(DSWActor* actor) return (int_ActorZOfBottom(actor) - (int_ActorSizeZ(actor) * 0.25)) * zinttoworld; } +inline DVector3 ActorLowerVect(DSWActor* actor) +{ + return DVector3(actor->spr.pos.XY(), ActorLowerZ(actor)); +} + + // Z size of top (TOS) and bottom (BOS) part of sprite inline int ActorSizeToTop(DSWActor* a) { diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index ea7034319..bdb884263 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -7042,7 +7042,7 @@ int DoDamageTest(DSWActor* actor) // For speed's sake, try limiting check only to radius weapons! if (actor->user.Radius > 200) { - if (!FAFcansee_(itActor->int_pos().X,itActor->int_pos().Y, int_ActorUpperZ(actor), itActor->sector(),actor->int_pos().X,actor->int_pos().Y,actor->int_pos().Z,actor->sector())) + if (!FAFcansee(ActorUpperVect(itActor), itActor->sector(),actor->spr.pos,actor->sector())) continue; } @@ -7259,8 +7259,8 @@ int DoExpDamageTest(DSWActor* actor) // Second parameter MUST have blocking bits set or cansee won't work // added second check for FAF water - hitscans were hitting ceiling - if (!FAFcansee_(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, int_ActorUpperZ(actor), itActor->sector()) && - !FAFcansee_(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, int_ActorLowerZ(actor), itActor->sector())) + if (!FAFcansee(actor->spr.pos, actor->sector(), ActorUpperVect(itActor), itActor->sector()) && + !FAFcansee(actor->spr.pos, actor->sector(), ActorLowerVect(itActor), itActor->sector())) continue; DoDamage(itActor, actor); @@ -8603,7 +8603,7 @@ int DoMineRangeTest(DSWActor* actor, int range) if (dist > range) continue; - if (!FAFcansee_(itActor->int_pos().X,itActor->int_pos().Y,int_ActorUpperZ(actor),itActor->sector(),actor->int_pos().X,actor->int_pos().Y,actor->int_pos().Z,actor->sector())) + if (!FAFcansee(ActorUpperVect(actor),itActor->sector(),actor->spr.pos,actor->sector())) continue; return true;