From 633154d46f6aed2372cf3a7c136bbe7808e9800f Mon Sep 17 00:00:00 2001 From: Randy Heit <rheit@zdoom.fake> Date: Sun, 19 Oct 2008 02:00:00 +0000 Subject: [PATCH] - Rewrote the SeePastShootableLines check in P_SightCheckLine() to be more readable. SVN r1270 (trunk) --- docs/rh-log.txt | 2 ++ src/p_sight.cpp | 26 +++++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index e4608f3a9f..52cfc21f16 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ October 18, 2008 +- Rewrote the SeePastShootableLines check in P_SightCheckLine() to be + more readable. - Commented out the MugShot state nulling in DSBarInfo::AttachToPlayer() so that fiddling with player options does not reset the mug shot. - Fixed: SetMugShotState ACS command did not pop the stack. diff --git a/src/p_sight.cpp b/src/p_sight.cpp index bedd1b40f8..3076040a38 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -134,16 +134,24 @@ static bool P_SightCheckLine (line_t *ld) { return false; } - if (SeePastShootableLines && - (!(ld->activation & SPAC_Impact) || - (ld->special != ACS_Execute && ld->special != ACS_ExecuteAlways)) || - (ld->args[1] != 0 && ld->args[1] != level.levelnum)) + // Pretend the other side is invisible if this is not an impact line + // that runs a script on the current map. Used to prevent monsters + // from trying to attack through a block everything line unless + // there's a chance their attack will make it nonblocking. + if (!SeePastShootableLines) { - // Pretend the other side is invisible if this is not an impact line - // or it does not run a script on the current map. Used to prevent - // monsters from trying to attack through a block everything line - // unless there's a chance their attack will make it nonblocking. - return false; + if (!(ld->activation & SPAC_Impact)) + { + return false; + } + if (ld->special != ACS_Execute && ld->special != ACS_ExecuteAlways) + { + return false; + } + if (ld->args[1] != 0 && ld->args[1] != level.levelnum) + { + return false; + } } }