display.h cleanup
I started out just to replace the weird partial expression in the maybe_display_usteed macro but ended up cleaning up some other stuff such as line wrapping. There are still tabs present.
This commit is contained in:
+25
-24
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.6 display.h $NHDT-Date: 1429757270 2015/04/23 02:47:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.19 $ */
|
/* NetHack 3.6 display.h $NHDT-Date: 1431215630 2015/05/09 23:53:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.22 $ */
|
||||||
/* NetHack 3.6 display.h $Date: 2009/05/06 10:44:38 $ $Revision: 1.14 $ */
|
/* NetHack 3.6 display.h $Date: 2009/05/06 10:44:38 $ $Revision: 1.14 $ */
|
||||||
/* SCCS Id: @(#)display.h 3.5 2005/06/21 */
|
/* SCCS Id: @(#)display.h 3.5 2005/06/21 */
|
||||||
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
|
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
#ifndef VISION_H
|
#ifndef VISION_H
|
||||||
#include "vision.h"
|
#include "vision.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MONDATA_H
|
#ifndef MONDATA_H
|
||||||
#include "mondata.h" /* for mindless() */
|
#include "mondata.h" /* for mindless() */
|
||||||
#endif
|
#endif
|
||||||
@@ -39,7 +38,8 @@
|
|||||||
(distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM)))) \
|
(distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM)))) \
|
||||||
)
|
)
|
||||||
|
|
||||||
#define sensemon(mon) (tp_sensemon(mon) || Detect_monsters || MATCH_WARN_OF_MON(mon))
|
#define sensemon(mon) \
|
||||||
|
(tp_sensemon(mon) || Detect_monsters || MATCH_WARN_OF_MON(mon))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mon_warning() is used to warn of any dangerous monsters in your
|
* mon_warning() is used to warn of any dangerous monsters in your
|
||||||
@@ -73,7 +73,9 @@
|
|||||||
* invisible to infravision), because this is usually called from within
|
* invisible to infravision), because this is usually called from within
|
||||||
* canseemon() or canspotmon() which already check that.
|
* canseemon() or canspotmon() which already check that.
|
||||||
*/
|
*/
|
||||||
#define see_with_infrared(mon) (!Blind && Infravision && infravisible(mon->data) && couldsee(mon->mx, mon->my))
|
#define see_with_infrared(mon) \
|
||||||
|
(!Blind && Infravision && infravisible(mon->data) \
|
||||||
|
&& couldsee(mon->mx, mon->my))
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -83,11 +85,11 @@
|
|||||||
* routines. Like mon_visible(), but it checks to see if the hero sees the
|
* routines. Like mon_visible(), but it checks to see if the hero sees the
|
||||||
* location instead of assuming it. (And also considers worms.)
|
* location instead of assuming it. (And also considers worms.)
|
||||||
*/
|
*/
|
||||||
#define canseemon(mon) ((mon->wormno ? worm_known(mon) : \
|
#define canseemon(mon) \
|
||||||
|
((mon->wormno ? worm_known(mon) : \
|
||||||
(cansee(mon->mx, mon->my) || see_with_infrared(mon))) \
|
(cansee(mon->mx, mon->my) || see_with_infrared(mon))) \
|
||||||
&& mon_visible(mon))
|
&& mon_visible(mon))
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* canspotmon(mon)
|
* canspotmon(mon)
|
||||||
*
|
*
|
||||||
@@ -95,8 +97,7 @@
|
|||||||
* telepathy, and is what you usually call for monsters about which nothing is
|
* telepathy, and is what you usually call for monsters about which nothing is
|
||||||
* known.
|
* known.
|
||||||
*/
|
*/
|
||||||
#define canspotmon(mon) \
|
#define canspotmon(mon) (canseemon(mon) || sensemon(mon))
|
||||||
(canseemon(mon) || sensemon(mon))
|
|
||||||
|
|
||||||
/* knowninvisible(mon)
|
/* knowninvisible(mon)
|
||||||
* This one checks to see if you know a monster is both there and invisible.
|
* This one checks to see if you know a monster is both there and invisible.
|
||||||
@@ -110,10 +111,11 @@
|
|||||||
* invisible to infravision.
|
* invisible to infravision.
|
||||||
*/
|
*/
|
||||||
#define knowninvisible(mon) \
|
#define knowninvisible(mon) \
|
||||||
(mtmp->minvis && \
|
(mtmp->minvis \
|
||||||
((cansee(mon->mx, mon->my) && (See_invisible || Detect_monsters)) || \
|
&& ((cansee(mon->mx, mon->my) \
|
||||||
(!Blind && (HTelepat & ~INTRINSIC) && \
|
&& (See_invisible || Detect_monsters)) \
|
||||||
distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM) \
|
|| (!Blind && (HTelepat & ~INTRINSIC) \
|
||||||
|
&& distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM) \
|
||||||
) \
|
) \
|
||||||
) \
|
) \
|
||||||
)
|
)
|
||||||
@@ -128,7 +130,6 @@
|
|||||||
(mon && mon->mtame && canspotmon(mon) && flags.safe_dog \
|
(mon && mon->mtame && canspotmon(mon) && flags.safe_dog \
|
||||||
&& !Confusion && !Hallucination && !Stunned)
|
&& !Confusion && !Hallucination && !Stunned)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* canseeself()
|
* canseeself()
|
||||||
* senseself()
|
* senseself()
|
||||||
@@ -191,30 +192,29 @@
|
|||||||
#define DISP_END (-6) /* Clean up. */
|
#define DISP_END (-6) /* Clean up. */
|
||||||
#define DISP_FREEMEM (-7) /* Free all memory during exit only. */
|
#define DISP_FREEMEM (-7) /* Free all memory during exit only. */
|
||||||
|
|
||||||
|
|
||||||
/* Total number of cmap indices in the sheild_static[] array. */
|
/* Total number of cmap indices in the sheild_static[] array. */
|
||||||
#define SHIELD_COUNT 21
|
#define SHIELD_COUNT 21
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* display_self()
|
* display_self()
|
||||||
*
|
*
|
||||||
* Display the hero. It is assumed that all checks necessary to determine
|
* Display the hero. It is assumed that all checks necessary to determine
|
||||||
* _if_ the hero can be seen have already been done.
|
* _if_ the hero can be seen have already been done.
|
||||||
*/
|
*/
|
||||||
#define maybe_display_usteed (u.usteed && mon_visible(u.usteed)) ? \
|
#define maybe_display_usteed(otherwise_self) \
|
||||||
ridden_mon_to_glyph(u.usteed) :
|
((u.usteed && mon_visible(u.usteed)) ? \
|
||||||
|
ridden_mon_to_glyph(u.usteed) : (otherwise_self))
|
||||||
|
|
||||||
#define display_self() \
|
#define display_self() \
|
||||||
show_glyph(u.ux, u.uy, \
|
show_glyph(u.ux, u.uy, maybe_display_usteed( \
|
||||||
maybe_display_usteed /* else */ \
|
|
||||||
youmonst.m_ap_type == M_AP_NOTHING ? \
|
youmonst.m_ap_type == M_AP_NOTHING ? \
|
||||||
hero_glyph : \
|
hero_glyph : \
|
||||||
youmonst.m_ap_type == M_AP_FURNITURE ? \
|
youmonst.m_ap_type == M_AP_FURNITURE ? \
|
||||||
cmap_to_glyph(youmonst.mappearance) : \
|
cmap_to_glyph(youmonst.mappearance) : \
|
||||||
youmonst.m_ap_type == M_AP_OBJECT ? \
|
youmonst.m_ap_type == M_AP_OBJECT ? \
|
||||||
objnum_to_glyph(youmonst.mappearance) : \
|
objnum_to_glyph(youmonst.mappearance) : \
|
||||||
/* else M_AP_MONSTER */ monnum_to_glyph(youmonst.mappearance))
|
/* else M_AP_MONSTER */ \
|
||||||
|
monnum_to_glyph(youmonst.mappearance)))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A glyph is an abstraction that represents a _unique_ monster, object,
|
* A glyph is an abstraction that represents a _unique_ monster, object,
|
||||||
@@ -335,9 +335,8 @@
|
|||||||
*/
|
*/
|
||||||
#define hero_glyph \
|
#define hero_glyph \
|
||||||
monnum_to_glyph((Upolyd || !flags.showrace) ? u.umonnum : \
|
monnum_to_glyph((Upolyd || !flags.showrace) ? u.umonnum : \
|
||||||
(flags.female && urace.femalenum != NON_PM) ? urace.femalenum : \
|
(flags.female && urace.femalenum != NON_PM) ? \
|
||||||
urace.malenum)
|
urace.femalenum : urace.malenum)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change the given glyph into it's given type. Note:
|
* Change the given glyph into it's given type. Note:
|
||||||
@@ -413,7 +412,9 @@
|
|||||||
#define glyph_is_cmap(glyph) \
|
#define glyph_is_cmap(glyph) \
|
||||||
((glyph) >= GLYPH_CMAP_OFF && (glyph) < (GLYPH_CMAP_OFF+MAXPCHARS))
|
((glyph) >= GLYPH_CMAP_OFF && (glyph) < (GLYPH_CMAP_OFF+MAXPCHARS))
|
||||||
#define glyph_is_swallow(glyph) \
|
#define glyph_is_swallow(glyph) \
|
||||||
((glyph) >= GLYPH_SWALLOW_OFF && (glyph) < (GLYPH_SWALLOW_OFF+(NUMMONS << 3)))
|
((glyph) >= GLYPH_SWALLOW_OFF \
|
||||||
|
&& (glyph) < (GLYPH_SWALLOW_OFF+(NUMMONS << 3)))
|
||||||
#define glyph_is_warning(glyph) \
|
#define glyph_is_warning(glyph) \
|
||||||
((glyph) >= GLYPH_WARNING_OFF && (glyph) < (GLYPH_WARNING_OFF + WARNCOUNT))
|
((glyph) >= GLYPH_WARNING_OFF && (glyph) < (GLYPH_WARNING_OFF + WARNCOUNT))
|
||||||
|
|
||||||
#endif /* DISPLAY_H */
|
#endif /* DISPLAY_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user