diff options
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/los.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/losparam.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/losparam.h | 10 | ||||
-rw-r--r-- | crawl-ref/source/spells3.cc | 2 |
4 files changed, 28 insertions, 5 deletions
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index f3c57856b6..c3d06066f5 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -933,8 +933,7 @@ void calc_show_los() you.update_los(); // What would be visible, if all of the translucent walls were // made opaque. - // XXX: figure out what this should really do. - losight(env.no_trans_show, you.pos(), opc_solid); + losight(env.no_trans_show, you.pos(), opc_no_trans); } } diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc index 68e6aa2e18..0c8f41cead 100644 --- a/crawl-ref/source/losparam.cc +++ b/crawl-ref/source/losparam.cc @@ -37,8 +37,24 @@ opacity_type opacity_fullyopaque::operator()(const coord_def& p) const return OPC_CLEAR; } +// Make transparent walls block in addition to normal LOS. +opacity_type opacity_no_trans::operator()(const coord_def& p) const +{ + dungeon_feature_type f = env.grid(p); + if (feat_is_opaque(f) || feat_is_wall(f)) + return OPC_OPAQUE; + else if (is_opaque_cloud(env.cgrid(p))) + return OPC_HALF; + else if (f == DNGN_TREES) + return OPC_HALF; + else if (monster_at(p) && monster_at(p)->type == MONS_BUSH) + return OPC_HALF; + else + return OPC_CLEAR; +} + // Make anything solid block in addition to normal LOS. -// XXX: Are trees, bushes solid? +// That's just granite statues in addition to opacity_no_trans. opacity_type opacity_solid::operator()(const coord_def& p) const { dungeon_feature_type f = env.grid(p); diff --git a/crawl-ref/source/losparam.h b/crawl-ref/source/losparam.h index 31a7f4bc1a..6d770428e1 100644 --- a/crawl-ref/source/losparam.h +++ b/crawl-ref/source/losparam.h @@ -49,8 +49,16 @@ struct opacity_fullyopaque : opacity_func }; static opacity_fullyopaque opc_fullyopaque; +// Make transparent walls block in addition to normal LOS. +struct opacity_no_trans : opacity_func +{ + CLONE(opacity_no_trans) + + opacity_type operator()(const coord_def& p) const; +}; +static opacity_no_trans opc_no_trans; + // Make anything solid block in addition to normal LOS. -// XXX: Are trees, bushes solid? struct opacity_solid : opacity_func { CLONE(opacity_solid) diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 12ba4f2df9..a15b02fd32 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1065,7 +1065,7 @@ int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting, // Use an alternate LOS grid, based on the caster's LOS. env_show_grid losgrid; if (caster->atype() != ACT_PLAYER) - losight(losgrid, caster->pos(), opc_solid); + losight(losgrid, caster->pos(), opc_no_trans); int number_raised = 0; int number_seen = 0; |