#ifndef WH_DISPLAY_H_1769061d_ #define WH_DISPLAY_H_1769061d_ /* * APIs exported by display.c, and associated definitions. */ #include #include "structs.h" /* * Values for the second argument to loc_char(). ORDINARY is used for * routine game display; DEBUG for debugging investigation, and MAP * for looking at maps. */ typedef enum { LC_ORDINARY = 1, LC_DEBUG, LC_MAP, } LCHOW; /* * Return values from the third argument to display_list(). */ typedef enum { DL_K_IGNORE = 1, DL_K_CONTINUE, DL_K_ABORT, } DLKS; /* * Return values from the first argument to display_list(). */ typedef enum { DL_L_MORE = 1, DL_L_DONE, } DLLS; /* * Interactively align a map to visible reality. Arguments: the map, * pointers to x and y offset variables, and a prompt string. */ extern int place_map(OBJ *, int *, int *, const char *); /* * Display/examine a map. Argument is the map. */ extern void view_map(OBJ *); /* * Compute and return the display character for a given location and * display method. */ extern char loc_char(LOC *, LCHOW); /* * Clear the display, eg, when the player switches levels. */ extern void cleardisp(void); /* * Draw those portions of a level which are mapepd or visible. */ extern void drawmapped(LEVEL *); /* * Update the display according to the data saved by upddisp/upddisp1. */ extern void showdisp(void); /* * Off-level marking. This allows, for example, a potion of perception * to light up parts of the level that don't actually exist because * they're off-level. Without this, potion-of-perception display * clips to the level boundaries, which can reveal them incorrectly. * * The API supports multiple off-level things. They are named with * (usually small) integers, allocated with alloc_showdisp_offlevel. * They are set with set_showdisp_offlevel. Each off-level marking * consists of a rectangle of cell flags. This rectangle's size, * location, and contents are set with set_showdisp_offlevel. The * display is scrolled to keep off-level things visible, to the extent * possible without pushing any real visible level cells off-screen. * Except for display scrolling, on-level cells of an off-level thing, * and off-level cells that have zero data, have no effect; off-level * cells which have nonzero data are displayed as standout spaces. As * a special case, if either size is zero, an off-level thing doesn't * affect even scrolling. If off-level things overlap, the rectangles * are effectively ORed together: the display marks a cell if any of * the things mark it. * * alloc_showdisp_offlevel() allocates and returns a new off-level * thing ID, which is a nonnegative int. It initially is zero size in * each dimension (and thus of no display effect). * * set_showdisp_offlevel(ID, W, H, DATA, X, Y) sets the off-level thing * with id ID to be WxH. DATA points to the data, which must be WxH * unsigned chars, each of which is either 0 or 1 (other values are * reserved for future expansion), stored as if for an array * dimensioned [W][H]. X and Y are the level coordinates to which the * first element of DATA corresponds. */ extern int alloc_showdisp_offlevel(void); extern void set_showdisp_offlevel(int, int, int, const unsigned char *, int, int); /* * Update the display according to data in the arguments. * * showdisp2(fv,cv,ox,oy,ol) updates according to flags fv, characters * cv, offset (ox,oy). This does not refer to the dungeon at all. If * ol is true, it does use the offlev globals; if ol is false, it is * as if there were no off-level things, and its actions are driven * entirely off the arguments. * * The flags are zero or more of the DF_* bits. */ extern void showdisp2(unsigned char (*)[LEV_Y], char (*)[LEV_Y], int, int, int); #define DF_LIT 0x01 // Lit; display with standout. /* * Initialize the display routines. */ extern void initdisplay(void); /* * Update the display for a cell if it's visible (if not, do nothing). */ extern void upddisp(LOC *); /* * Display a level for debugging. */ extern void lvdisp(LEVEL *); /* * Update the display for a cell which may have changed (this is used, * eg, when a monster moves, to perform any display updates). */ extern void upddisp1(LOC *l); /* * Set the subtype for a wall location (first arg) when seen from * another location (second arg). */ extern void checkwall_from(LOC *, LOC *); /* * Display a list of lines. This can be used to just display text or * to choose from a list, depending on the arguments. */ extern void display_list(DLLS (*)(FILE *), const char *, DLKS (*)(int)); /* * A keystroke function for display_list() designed for just displaying * text lines. */ extern DLKS dl_justmore(int); #endif