From 4bd335dab6488ac58d412f8b640801350207c398 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Tue, 10 Nov 2009 10:28:04 +0100 Subject: Make disintegration splatter not end up behind actors. Also not at actors' feet. Might be even nicer to have them thrown as missiles: You are hit by a piece of orc flesh. The giant bat is hit by a chunk of yak flesh. The giant bat dies. --- crawl-ref/source/losparam.cc | 8 ++++++++ crawl-ref/source/losparam.h | 10 ++++++++++ crawl-ref/source/monstuff.cc | 5 +++-- 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc index 0c8f41cead..3666081897 100644 --- a/crawl-ref/source/losparam.cc +++ b/crawl-ref/source/losparam.cc @@ -78,3 +78,11 @@ opacity_type opacity_monmove::operator()(const coord_def& p) const else return (OPC_CLEAR); } + +opacity_type opacity_no_actor::operator()(const coord_def& p) const +{ + if (feat_is_solid(env.grid(p)) || actor_at(p)) + return (OPC_OPAQUE); + else + return (OPC_CLEAR); +} diff --git a/crawl-ref/source/losparam.h b/crawl-ref/source/losparam.h index ccdd548f19..0b3a1c64dd 100644 --- a/crawl-ref/source/losparam.h +++ b/crawl-ref/source/losparam.h @@ -82,6 +82,16 @@ struct opacity_monmove : opacity_func opacity_type operator()(const coord_def& p) const; }; +// Make any actor (as well as solid features) block. +// Note that the blocking actors are still "visible". +struct opacity_no_actor : opacity_func +{ + CLONE(opacity_no_actor) + + opacity_type operator()(const coord_def& p) const; +}; +static opacity_no_actor opc_no_actor; + // Subclasses of this are passed to losight() to modify the // LOS calculation. Implementations will have to translate between // relative coordinates (-8,-8)..(8,8) and real coordinates, diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index bd3e6d08a5..4aa5ecfa4c 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -344,7 +344,8 @@ monster_type fill_out_corpse(const monsters* monster, item_def& corpse, bool explode_corpse(item_def& corpse, const coord_def& where) { - los_def ld(where, opc_solid); + // Don't want chunks to show up behind the player. + los_def ld(where, opc_no_actor); if (monster_descriptor(corpse.plus, MDSC_LEAVES_HIDE) && mons_genus(corpse.plus) == MONS_DRAGON) @@ -396,7 +397,7 @@ bool explode_corpse(item_def& corpse, const coord_def& where) mprf(MSGCH_DIAGNOSTICS, "Cell is visible..."); #endif - if (feat_is_solid(grd(cp))) + if (feat_is_solid(grd(cp)) || actor_at(cp)) continue; --nchunks; -- cgit v1.2.3-54-g00ecf