vision.h

Go to the documentation of this file.
00001 /*      SCCS Id: @(#)vision.h   3.4     1995/01/26      */
00002 /* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */
00003 /* NetHack may be freely redistributed.  See license for details.       */
00004 
00005 #ifndef VISION_H
00006 #define VISION_H
00007 
00008 #if 0   /* (moved to decl.h) */
00009 extern boolean vision_full_recalc;      /* TRUE if need vision recalc */
00010 extern char **viz_array;                /* could see/in sight row pointers */
00011 extern char *viz_rmin;                  /* min could see indices */
00012 extern char *viz_rmax;                  /* max could see indices */
00013 #endif
00014 #define COULD_SEE 0x1           /* location could be seen, if it were lit */
00015 #define IN_SIGHT  0x2           /* location can be seen */
00016 #define TEMP_LIT  0x4           /* location is temporarily lit */
00017 
00018 /*
00019  * Light source sources
00020  */
00021 #define LS_OBJECT 0
00022 #define LS_MONSTER 1
00023 
00024 /*
00025  *  cansee()    - Returns true if the hero can see the location.
00026  *
00027  *  couldsee()  - Returns true if the hero has a clear line of sight to
00028  *                the location.
00029  */
00030 #define cansee(x,y)     (viz_array[y][x] & IN_SIGHT)
00031 #define couldsee(x,y)   (viz_array[y][x] & COULD_SEE)
00032 #define templit(x,y)    (viz_array[y][x] & TEMP_LIT)
00033 
00034 /*
00035  *  The following assume the monster is not blind.
00036  *
00037  *  m_cansee()  - Returns true if the monster can see the given location.
00038  *
00039  *  m_canseeu() - Returns true if the monster could see the hero.  Assumes
00040  *                that if the hero has a clear line of sight to the monster's
00041  *                location and the hero is visible, then monster can see the
00042  *                hero.
00043  */
00044 #define m_cansee(mtmp,x2,y2)    clear_path((mtmp)->mx,(mtmp)->my,(x2),(y2))
00045 
00046 #define m_canseeu(m)    ((!Invis || perceives((m)->data)) && \
00047                           !(Underwater || u.uburied || (m)->mburied) ? \
00048                              couldsee((m)->mx,(m)->my) : 0)
00049 
00050 /*
00051  *  Circle information
00052  */
00053 #define MAX_RADIUS 15   /* this is in points from the source */
00054 
00055 /* Use this macro to get a list of distances of the edges (see vision.c). */
00056 #define circle_ptr(z) (&circle_data[(int)circle_start[z]])
00057 
00058 #endif /* VISION_H */