3 * Summary: Parameters for the LOS algorithm
9 // Note: find_ray relies on the fact that 2*OPC_HALF == OPC_OPAQUE.
10 // On the other hand, losight tracks this explicitly.
14 OPC_HALF
= 1, // for opaque clouds; two or more block
23 virtual opacity_type
operator()(const coord_def
& p
) const = 0;
24 virtual ~opacity_func() {}
25 virtual opacity_func
* clone() const = 0;
28 #define CLONE(typename) \
29 typename* clone() const \
31 return (new typename(*this)); \
35 class opacity_default
: public opacity_func
38 CLONE(opacity_default
)
40 opacity_type
operator()(const coord_def
& p
) const;
42 static opacity_default opc_default
;
44 // Default LOS rules, but only consider fully opaque features blocking.
45 // In particular, clouds don't affect the result.
46 class opacity_fullyopaque
: public opacity_func
49 CLONE(opacity_fullyopaque
)
51 opacity_type
operator()(const coord_def
& p
) const;
53 static opacity_fullyopaque opc_fullyopaque
;
55 // Make transparent features block in addition to normal LOS.
56 // * Translocations opacity: blink, apportation, portal projectile.
57 // * Various "I feel safe"-related stuff.
58 class opacity_no_trans
: public opacity_func
61 CLONE(opacity_no_trans
)
63 opacity_type
operator()(const coord_def
& p
) const;
65 static opacity_no_trans opc_no_trans
;
67 // Make immobile monsters block in addition to no_trans.
68 // This is used for monster movement.
69 class opacity_immob
: public opacity_func
74 opacity_type
operator()(const coord_def
& p
) const;
76 static opacity_immob opc_immob
;
78 // Make anything solid block in addition to normal LOS.
79 class opacity_solid
: public opacity_func
84 opacity_type
operator()(const coord_def
& p
) const;
86 static opacity_solid opc_solid
;
88 // Opacity for monster movement, based on the late monster_los.
89 class opacity_monmove
: public opacity_func
92 opacity_monmove(const monster
& m
)
97 CLONE(opacity_monmove
)
99 opacity_type
operator()(const coord_def
& p
) const;
104 // Make any actor (as well as solid features) block.
105 // Note that the blocking actors are still "visible".
106 class opacity_no_actor
: public opacity_func
109 CLONE(opacity_no_actor
)
111 opacity_type
operator()(const coord_def
& p
) const;
113 static opacity_no_actor opc_no_actor
;
115 // Subclasses of this are passed to losight() to modify the
116 // LOS calculation. Implementations will have to translate between
117 // relative coordinates (-8,-8)..(8,8) and real coordinates,
118 // specify how opaque the cells are and determine what values
119 // are written to the visible cells.
123 virtual ~los_param() {}
125 // Whether the translated coordinate lies within the map
126 // (including boundary) and within the LOS area
127 virtual bool los_bounds(const coord_def
& p
) const = 0;
129 virtual opacity_type
opacity(const coord_def
& p
) const = 0;