From d4189cb0308511fc5d7e12790993f6844974e0c7 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Fri, 13 Nov 2009 14:54:20 +0100 Subject: Hack player LOS routines for arena. Player now sees everything in the arena. --- crawl-ref/source/actor-los.cc | 21 ++++++++++++++++++++- crawl-ref/source/los.cc | 4 +--- crawl-ref/source/player.cc | 3 +++ crawl-ref/source/player.h | 2 ++ 4 files changed, 26 insertions(+), 4 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/actor-los.cc b/crawl-ref/source/actor-los.cc index 06eb063a13..bc7f1c4868 100644 --- a/crawl-ref/source/actor-los.cc +++ b/crawl-ref/source/actor-los.cc @@ -4,10 +4,12 @@ #include "player.h" #include "monster.h" #include "state.h" +#include "viewgeom.h" bool actor::observable() const { - return (crawl_state.arena || this == &you || you.can_see(this)); + return (crawl_state.arena && this != &you + || this == &you || you.can_see(this)); } bool actor::see_cell(const coord_def &p) const @@ -52,3 +54,20 @@ void player::update_los() actor::update_los(); } +// Player LOS overrides for arena. + +bool player::see_cell(const coord_def &c) const +{ + if (crawl_state.arena) + return (crawl_view.in_grid_los(c)); + else + return (actor::see_cell(c)); +} + +bool player::can_see(const actor* a) const +{ + if (crawl_state.arena) + return (see_cell(a->pos())); + else + return (actor::can_see(a)); +} diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index e771360f63..bb4ce58d29 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -909,9 +909,7 @@ void calc_show_los() // Usually the same as player LOS. bool observe_cell(const coord_def &p) { - return (((crawl_state.arena || crawl_state.arena_suspended) - && crawl_view.in_grid_los(p)) - || you.see_cell(p)); + return (you.see_cell(p)); } // Is the cell visible, but a translucent wall is in the way? diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 7af59e3b10..3b1516551a 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -6885,6 +6885,9 @@ bool player::invisible() const bool player::visible_to(const actor *looker) const { + if (crawl_state.arena) + return (false); + if (this == looker) return (can_see_invisible() || !invisible()); diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index f6fc6bcdd8..4cc53caab8 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -324,6 +324,8 @@ public: bool can_see_invisible() const; bool can_see_invisible(bool unid) const; bool visible_to(const actor *looker) const; + bool can_see(const actor* a) const; + bool see_cell(const coord_def& c) const; bool see_cell_no_trans(const coord_def &c) const; void update_los(); -- cgit v1.2.3-54-g00ecf