Defines | Functions | Variables

vision.c File Reference

#include "hack.h"
Include dependency graph for vision.c:

Defines

#define sign(z)   ((z) < 0 ? -1 : ((z) ? 1 : 0 ))
#define v_abs(z)   ((z) < 0 ? -(z) : (z))
#define new_angle(lev, sv, row, col)   (*sv)
#define set_cs(rowp, col)   (rowp[col] = COULD_SEE)
#define good_row(z)   ((z) >= 0 && (z) < ROWNO)
#define set_min(z)   if (*row_min > (z)) *row_min = (z)
#define set_max(z)   if (*row_max < (z)) *row_max = (z)
#define is_clear(row, col)   viz_clear_rows[row][col]
#define q1_path(sy, sx, y, x, dummy)   result = _q1_path(sy,sx,y,x)
#define q2_path(sy, sx, y, x, dummy)   result = _q2_path(sy,sx,y,x)
#define q3_path(sy, sx, y, x, dummy)   result = _q3_path(sy,sx,y,x)
#define q4_path(sy, sx, y, x, dummy)   result = _q4_path(sy,sx,y,x)

Functions

STATIC_DCL void FDECL (fill_point,(int, int))
STATIC_DCL void FDECL (dig_point,(int, int))
STATIC_DCL void NDECL (view_init)
STATIC_DCL void FDECL (view_from,(int, int, char **, char *, char *, int, void(*)(int, int, genericptr_t), genericptr_t))
STATIC_DCL void FDECL (get_unused_cs,(char ***, char **, char **))
void vision_init ()
int does_block (int x, int y, struct rm *lev)
void vision_reset ()
STATIC_OVL void get_unused_cs (char ***rows, char **rmin, char **rmax)
void vision_recalc (int control)
void block_point (int x, int y)
void unblock_point (int x, int y)
STATIC_OVL void dig_point (int row, int col)
STATIC_OVL void fill_point (int row, int col)
static void FDECL ((*vis_func),(int, int, genericptr_t))
STATIC_DCL int FDECL (_q1_path,(int, int, int, int))
STATIC_DCL int FDECL (_q2_path,(int, int, int, int))
STATIC_DCL int FDECL (_q3_path,(int, int, int, int))
STATIC_DCL int FDECL (_q4_path,(int, int, int, int))
STATIC_OVL int _q1_path (int srow, int scol, int y2, int x2)
STATIC_OVL int _q4_path (int srow, int scol, int y2, int x2)
STATIC_OVL int _q2_path (int srow, int scol, int y2, int x2)
STATIC_OVL int _q3_path (int srow, int scol, int y2, int x2)
boolean clear_path (int col1, int row1, int col2, int row2)
STATIC_DCL void FDECL (right_side,(int, int, int, char *))
STATIC_DCL void FDECL (left_side,(int, int, int, char *))
STATIC_OVL void view_init ()
STATIC_OVL void right_side (int row, int left, int right_mark, char *limits)
STATIC_OVL void left_side (int row, int left_mark, int right, char *limits)
STATIC_OVL void view_from (void FDECL((*func) int, void FDECL((*func) int, char **loc_cs_rows, char *left_most, char *right_most, void FDECL((*func) int, func, genericptr_t arg)
void do_clear_area (void FDECL((*func) int, void FDECL((*func) int, void FDECL((*func) int, func, genericptr_t arg)

Variables

char circle_data []
char circle_start []
char * viz_rmin
char * viz_rmax
static char could_see [2][ROWNO][COLNO]
static char * cs_rows0 [ROWNO]
static char * cs_rows1 [ROWNO]
static char cs_rmin0 [ROWNO]
static char cs_rmax0 [ROWNO]
static char cs_rmin1 [ROWNO]
static char cs_rmax1 [ROWNO]
static char viz_clear [ROWNO][COLNO]
static char * viz_clear_rows [ROWNO]
static char left_ptrs [ROWNO][COLNO]
static char right_ptrs [ROWNO][COLNO]
static int start_row
static int start_col
static int step
static char ** cs_rows
static char * cs_left
static char * cs_right
static genericptr_t varg

Define Documentation

#define good_row (   z )    ((z) >= 0 && (z) < ROWNO)

Referenced by left_side(), and right_side().

#define is_clear (   row,
  col 
)    viz_clear_rows[row][col]
#define new_angle (   lev,
  sv,
  row,
  col 
)    (*sv)

Referenced by vision_recalc().

#define q1_path (   sy,
  sx,
  y,
  x,
  dummy 
)    result = _q1_path(sy,sx,y,x)

Referenced by clear_path(), and right_side().

#define q2_path (   sy,
  sx,
  y,
  x,
  dummy 
)    result = _q2_path(sy,sx,y,x)

Referenced by clear_path(), and left_side().

#define q3_path (   sy,
  sx,
  y,
  x,
  dummy 
)    result = _q3_path(sy,sx,y,x)

Referenced by clear_path(), and left_side().

#define q4_path (   sy,
  sx,
  y,
  x,
  dummy 
)    result = _q4_path(sy,sx,y,x)

Referenced by clear_path(), and right_side().

#define set_cs (   rowp,
  col 
)    (rowp[col] = COULD_SEE)

Referenced by left_side(), right_side(), and view_from().

#define set_max (   z )    if (*row_max < (z)) *row_max = (z)

Referenced by left_side(), and right_side().

#define set_min (   z )    if (*row_min > (z)) *row_min = (z)

Referenced by left_side(), and right_side().

#define sign (   z )    ((z) < 0 ? -1 : ((z) ? 1 : 0 ))

Referenced by vision_recalc().

#define v_abs (   z )    ((z) < 0 ? -(z) : (z))

Referenced by do_clear_area(), and vision_recalc().


Function Documentation

STATIC_OVL int _q1_path ( int  srow,
int  scol,
int  y2,
int  x2 
)

References is_clear.

STATIC_OVL int _q2_path ( int  srow,
int  scol,
int  y2,
int  x2 
)

References is_clear.

STATIC_OVL int _q3_path ( int  srow,
int  scol,
int  y2,
int  x2 
)

References is_clear.

STATIC_OVL int _q4_path ( int  srow,
int  scol,
int  y2,
int  x2 
)

References is_clear.

void block_point ( int  x,
int  y 
)

References fill_point(), vision_full_recalc, and viz_array.

Referenced by clear_fcorr(), close_drawbridge(), create_monster(), doclose(), doorlock(), movebubbles(), place_object(), readobjnam(), repair_damage(), set_mimic_blocking(), set_mimic_sym(), still_chewing(), and wallify_vault().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean clear_path ( int  col1,
int  row1,
int  col2,
int  row2 
)

References q1_path, q2_path, q3_path, and q4_path.

Referenced by do_light_sources(), and linedup().

Here is the caller graph for this function:

STATIC_OVL void dig_point ( int  row,
int  col 
)

References COLNO, left_ptrs, right_ptrs, and viz_clear.

Referenced by unblock_point().

Here is the caller graph for this function:

void do_clear_area ( void FDECL((*func)  int,
void FDECL((*func)  int,
void FDECL((*func)  int,
func  ,
genericptr_t  arg 
)

References circle_ptr, COLNO, couldsee, MAX_RADIUS, ROWNO, u, you::ux, you::uy, v_abs, view_from(), vision_full_recalc, and vision_recalc().

Referenced by dog_goal(), dogushforth(), findit(), litroom(), openit(), and seffects().

Here is the call graph for this function:

Here is the caller graph for this function:

int does_block ( int  x,
int  y,
struct rm lev 
)
STATIC_DCL void FDECL ( view_from  ,
(int, int, char **, char *, char *, int, void(*)(int, int, genericptr_t), genericptr_t  
)
STATIC_DCL int FDECL ( _q1_path  ,
(int, int, int, int)   
)
STATIC_DCL int FDECL ( _q2_path  ,
(int, int, int, int)   
)
STATIC_DCL int FDECL ( _q3_path  ,
(int, int, int, int)   
)
STATIC_DCL int FDECL ( _q4_path  ,
(int, int, int, int)   
)
STATIC_DCL void FDECL ( dig_point  ,
(int, int)   
)
STATIC_DCL void FDECL ( get_unused_cs  ,
(char ***, char **, char **)   
)
STATIC_DCL void FDECL ( fill_point  ,
(int, int)   
)
STATIC_DCL void FDECL ( right_side  ,
(int, int, int, char *)   
)
STATIC_DCL void FDECL ( left_side  ,
(int, int, int, char *)   
)
static void FDECL ( vis_func,
(int, int, genericptr_t  
) [static]
STATIC_OVL void fill_point ( int  row,
int  col 
)

References COLNO, left_ptrs, right_ptrs, and viz_clear.

Referenced by block_point().

Here is the caller graph for this function:

STATIC_OVL void get_unused_cs ( char ***  rows,
char **  rmin,
char **  rmax 
)

References COLNO, cs_rmax0, cs_rmax1, cs_rmin0, cs_rmin1, cs_rows0, cs_rows1, ROWNO, and viz_array.

Referenced by vision_recalc().

Here is the caller graph for this function:

STATIC_OVL void left_side ( int  row,
int  left_mark,
int  right,
char *  limits 
)

References good_row, is_clear, left_ptrs, q2_path, q3_path, set_cs, set_max, set_min, step, and varg.

Referenced by view_from().

Here is the caller graph for this function:

STATIC_DCL void NDECL ( view_init   )
STATIC_OVL void right_side ( int  row,
int  left,
int  right_mark,
char *  limits 
)

References COLNO, good_row, is_clear, q1_path, q4_path, right_ptrs, set_cs, set_max, set_min, step, and varg.

Referenced by view_from().

Here is the caller graph for this function:

void unblock_point ( int  x,
int  y 
)
STATIC_OVL void view_from ( void FDECL((*func)  int,
void FDECL((*func)  int,
char **  loc_cs_rows,
char *  left_most,
char *  right_most,
void FDECL((*func)  int,
func  ,
genericptr_t  arg 
)

References circle_ptr, COLNO, is_clear, left_ptrs, left_side(), MAX_RADIUS, right_ptrs, right_side(), ROWNO, and set_cs.

Referenced by do_clear_area(), and vision_recalc().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void view_init (  )

Referenced by vision_init().

Here is the caller graph for this function:

void vision_init (  )

References could_see, cs_rmax0, cs_rmin0, cs_rows0, cs_rows1, ROWNO, view_init(), vision_full_recalc, viz_array, viz_clear, viz_clear_rows, viz_rmax, and viz_rmin.

Here is the call graph for this function:

void vision_recalc ( int  control )
void vision_reset (  )

References COLNO, could_see, cs_rmax0, cs_rmin0, cs_rows0, does_block(), iflags, IS_ROCK, left_ptrs, levl, right_ptrs, ROWNO, TRUE, vision_full_recalc, instance_flags::vision_inited, viz_array, viz_clear, viz_rmax, and viz_rmin.

Referenced by dorecover(), goto_level(), and newgame().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char circle_data[]
Initial value:
 {
         1, 1,
         2, 2, 1,
         3, 3, 2, 1,
         4, 4, 4, 3, 2,
         5, 5, 5, 4, 3, 2,
         6, 6, 6, 5, 5, 4, 2,
         7, 7, 7, 6, 6, 5, 4, 2,
         8, 8, 8, 7, 7, 6, 6, 4, 2,
         9, 9, 9, 9, 8, 8, 7, 6, 5, 3,
        10,10,10,10, 9, 9, 8, 7, 6, 5, 3,
        11,11,11,11,10,10, 9, 9, 8, 7, 5, 3,
        12,12,12,12,11,11,10,10, 9, 8, 7, 5, 3,
        13,13,13,13,12,12,12,11,10,10, 9, 7, 6, 3,
        14,14,14,14,13,13,13,12,12,11,10, 9, 8, 6, 3,
        15,15,15,15,14,14,14,13,13,12,11,10, 9, 8, 6, 3,
 16 
}
char circle_start[]
Initial value:
 {
          0,    
    0,
          2,
          5,
          9,
         14,
         20,
         27,
         35,
         44,
         54,
         65,
         77,
         90,
        104,
        119,
}
char could_see[2][ROWNO][COLNO] [static]

Referenced by vision_init(), and vision_reset().

char* cs_left [static]
char* cs_right [static]
char cs_rmax0[ROWNO]
char cs_rmax1[ROWNO]

Referenced by get_unused_cs().

char cs_rmin0[ROWNO] [static]
char cs_rmin1[ROWNO] [static]

Referenced by get_unused_cs().

char** cs_rows [static]
char* cs_rows0[ROWNO] [static]
char * cs_rows1[ROWNO]

Referenced by get_unused_cs(), and vision_init().

char left_ptrs[ROWNO][COLNO] [static]
char right_ptrs[ROWNO][COLNO] [static]
int start_col [static]
int start_row [static]
int step [static]

Referenced by in_rooms(), left_side(), and right_side().

genericptr_t varg [static]

Referenced by left_side(), and right_side().

char viz_clear[ROWNO][COLNO] [static]
char* viz_clear_rows[ROWNO] [static]

Referenced by vision_init().

char * viz_rmax
char* viz_rmin