From 4aa5de689ce1bc015ab03181d91ee702135c65dd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Aug 2022 17:27:07 +0200 Subject: [PATCH] - renamed old FAFcansee function for easier searching. --- source/games/sw/src/draw.cpp | 4 ++-- source/games/sw/src/game.h | 4 ++-- source/games/sw/src/player.cpp | 8 ++++---- source/games/sw/src/rooms.cpp | 2 +- source/games/sw/src/sector.cpp | 4 ++-- source/games/sw/src/sounds.cpp | 4 ++-- source/games/sw/src/sprite.cpp | 4 ++-- source/games/sw/src/track.cpp | 4 ++-- source/games/sw/src/vis.cpp | 2 +- source/games/sw/src/weapon.cpp | 10 +++++----- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index b5bdee153..d1571de53 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -1088,8 +1088,8 @@ void CameraView(PLAYER* pp, int *tx, int *ty, int *tz, sectortype** tsect, DAngl ang_test = deltaangle(ang, actor->spr.angle) < DAngle::fromBuild(actor->spr.lotag); FAFcansee_test = - (FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), *tx, *ty, *tz, pp->cursector) || - FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), *tx, *ty, *tz + int_ActorSizeZ(pp->actor), pp->cursector)); + (FAFcansee_(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), *tx, *ty, *tz, pp->cursector) || + FAFcansee_(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), *tx, *ty, *tz + int_ActorSizeZ(pp->actor), pp->cursector)); player_in_camera = ang_test && FAFcansee_test; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 34da3da93..95b6a27c5 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1771,10 +1771,10 @@ void FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect, int32_t xvect, int32_t yvect, int32_t zvect, HitInfo& hit, int32_t clipmask); -bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, int32_t xe, int32_t ye, int32_t ze, sectortype* secte); +bool FAFcansee_(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, int32_t xe, int32_t ye, int32_t ze, sectortype* secte); inline bool FAFcansee(const DVector3& start, sectortype* sects, const DVector3& end, sectortype* secte) { - return FAFcansee(int(start.X * worldtoint), int(start.Y * worldtoint), int(start.Z * zworldtoint), sects, + return FAFcansee_(int(start.X * worldtoint), int(start.Y * worldtoint), int(start.Z * zworldtoint), sects, int(end.X * worldtoint), int(end.Y * worldtoint), int(end.Z * zworldtoint), secte); } diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 58e5ff67a..923304d4e 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1194,9 +1194,9 @@ DSWActor* DoPickTarget(DSWActor* actor, uint32_t max_delta_ang, int skip_targets ezhl = int_ActorZOfBottom(itActor) - (int_ActorSizeZ(itActor) >> 2); // If you can't see 'em you can't shoot 'em - if (!FAFcansee(actor->int_pos().X, actor->int_pos().Y, zh, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ezh, itActor->sector()) && - !FAFcansee(actor->int_pos().X, actor->int_pos().Y, zh, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ezhm, itActor->sector()) && - !FAFcansee(actor->int_pos().X, actor->int_pos().Y, zh, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ezhl, itActor->sector()) + if (!FAFcansee_(actor->int_pos().X, actor->int_pos().Y, zh, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ezh, itActor->sector()) && + !FAFcansee_(actor->int_pos().X, actor->int_pos().Y, zh, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ezhm, itActor->sector()) && + !FAFcansee_(actor->int_pos().X, actor->int_pos().Y, zh, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ezhl, itActor->sector()) ) continue; @@ -5660,7 +5660,7 @@ void DoPlayerDeathFollowKiller(PLAYER* pp) DSWActor* killer = pp->KillerActor; if (killer) { - if (FAFcansee(killer->int_pos().X, killer->int_pos().Y, int_ActorZOfTop(killer), killer->sector(), pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector)) + if (FAFcansee_(killer->int_pos().X, killer->int_pos().Y, int_ActorZOfTop(killer), killer->sector(), pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector)) { pp->angle.addadjustment(deltaangle(pp->angle.ang, VecToAngle(killer->int_pos().X - pp->int_ppos().X, killer->int_pos().Y - pp->int_ppos().Y)) * (1. / 16.)); } diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index 81f4fbb87..bb8642d5f 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -222,7 +222,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, sectortype* sect, } } -bool FAFcansee(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, +bool FAFcansee_(int32_t xs, int32_t ys, int32_t zs, sectortype* sects, int32_t xe, int32_t ye, int32_t ze, sectortype* secte) { int loz, hiz; diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 88f1050fd..dd9b6b342 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -1145,7 +1145,7 @@ void WeaponExplodeSectorInRange(DSWActor* wActor) if ((unsigned int)dist > (wActor->user.Radius/2) + radius) continue; - if (!FAFcansee(wActor->int_pos().X,wActor->int_pos().Y,wActor->int_pos().Z,wActor->sector(),actor->int_pos().X,actor->int_pos().Y,actor->int_pos().Z,actor->sector())) + if (!FAFcansee_(wActor->int_pos().X,wActor->int_pos().Y,wActor->int_pos().Z,wActor->sector(),actor->int_pos().X,actor->int_pos().Y,actor->int_pos().Z,actor->sector())) continue; @@ -1382,7 +1382,7 @@ int OperateSprite(DSWActor* actor, short player_is_operating) { pp = GlobPlayerP; - if (!FAFcansee(pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1), actor->sector())) + if (!FAFcansee_(pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1), actor->sector())) return false; } diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index 2838498ed..4213b8dd5 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -380,7 +380,7 @@ static void UpdateAmbients() if (sdist < 255 && amb->vocIndex == DIGI_WHIPME) { PLAYER* pp = Player + screenpeek; - if (!FAFcansee(spot->int_pos().X, spot->int_pos().Y, spot->int_pos().Z, spot->sector(), pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector)) + if (!FAFcansee_(spot->int_pos().X, spot->int_pos().Y, spot->int_pos().Z, spot->sector(), pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector)) { sdist = 255; } @@ -562,7 +562,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3], // Can the ambient sound see the player? If not, tone it down some. if ((chanflags & CHANF_LOOP)) { - if (!FAFcansee(vpos.X, vpos.Y, vpos.Z, spot->sector(), pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector)) + if (!FAFcansee_(vpos.X, vpos.Y, vpos.Z, spot->sector(), pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector)) { auto distvec = npos - campos; npos = campos + distvec * 1.75f; // Play more quietly diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 2505d66a2..326aa2a7f 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -5034,7 +5034,7 @@ int DoGet(DSWActor* actor) auto cstat_bak = actor->spr.cstat; actor->spr.cstat |= (CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); - can_see = FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), + can_see = FAFcansee_(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector); actor->spr.cstat = cstat_bak; @@ -5901,7 +5901,7 @@ void AdjustActiveRange(PLAYER* pp, DSWActor* actor, int dist) // if actor can still see the player look_height = int_ActorZOfTop(actor); - if (FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), plActor->int_pos().X, plActor->int_pos().Y, int_ActorUpperZ(plActor), plActor->sector())) + if (FAFcansee_(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), plActor->int_pos().X, plActor->int_pos().Y, int_ActorUpperZ(plActor), plActor->sector())) { // Player is visible // adjust update range of this sprite diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index cd530aa00..8ebb028c8 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -249,7 +249,7 @@ short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, int* tr updatesector(near_tp->x, near_tp->y, &track_sect); // if can see the point, return the track number - if (track_sect && FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - Z(16), actor->sector(), near_tp->x, near_tp->y, track_sect->int_floorz() - Z(32), track_sect)) + if (track_sect && FAFcansee_(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - Z(16), actor->sector(), near_tp->x, near_tp->y, track_sect->int_floorz() - Z(32), track_sect)) { return short(near_track - &Track[0]); } @@ -2746,7 +2746,7 @@ void DoAutoTurretObject(SECTOR_OBJECT* sop) if (sActor->spr.statnum == STAT_SO_SHOOT_POINT) { - if (!FAFcansee(sActor->int_pos().X, sActor->int_pos().Y, sActor->int_pos().Z-Z(4), sActor->sector(), + if (!FAFcansee_(sActor->int_pos().X, sActor->int_pos().Y, sActor->int_pos().Z-Z(4), sActor->sector(), actor->user.targetActor->int_pos().X, actor->user.targetActor->int_pos().Y, int_ActorUpperZ(actor->user.targetActor), actor->user.targetActor->sector())) { return; diff --git a/source/games/sw/src/vis.cpp b/source/games/sw/src/vis.cpp index a02dec93a..57ec34adc 100644 --- a/source/games/sw/src/vis.cpp +++ b/source/games/sw/src/vis.cpp @@ -110,7 +110,7 @@ void VisViewChange(PLAYER* pp, int *vis) } // save off the brightest vis that you can see - if (FAFcansee(pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector, x, y, z, sectp)) + if (FAFcansee_(pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector, x, y, z, sectp)) { if (VIS_VisCur(actor) < BrightestVis) BrightestVis = VIS_VisCur(actor); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 6dbb8679d..ea7034319 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_(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())) continue; } @@ -7187,7 +7187,7 @@ void TraverseBreakableWalls(sectortype* start_sect, int x, int y, int z, short a sectortype* sectp = nullptr; if (WallBreakPosition(&wal, §p, &hit_x, &hit_y, &hit_z, &wall_ang)) { - if (hit_x != INT32_MAX && sectp != nullptr && FAFcansee(x, y, z, start_sect, hit_x, hit_y, hit_z, sectp)) + if (hit_x != INT32_MAX && sectp != nullptr && FAFcansee_(x, y, z, start_sect, hit_x, hit_y, hit_z, sectp)) { HitBreakWall(&wal, INT32_MAX, INT32_MAX, INT32_MAX, ang, 0); @@ -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->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())) 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_(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())) continue; return true;