Angband
Functions
ui-map.h File Reference

Writing level map info to the screen. More...

Go to the source code of this file.

Functions

void grid_data_as_text (struct grid_data *g, int *ap, wchar_t *cp, int *tap, wchar_t *tcp)
 This function takes a pointer to a grid info struct describing the contents of a grid location (as obtained through the function map_info) and fills in the character and attr pairs for display. More...
 
void move_cursor_relative (int y, int x)
 Move the cursor to a given map location. More...
 
void print_rel (wchar_t c, byte a, int y, int x)
 Display an attr/char pair at the given map location. More...
 
void prt_map (void)
 Redraw (on the screen) the current map panel. More...
 
void display_map (int *cy, int *cx)
 Display a "small-scale" map of the dungeon in the active Term. More...
 
void do_cmd_view_map (void)
 

Detailed Description

Writing level map info to the screen.

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Function Documentation

void display_map ( int cy,
int cx 
)

Display a "small-scale" map of the dungeon in the active Term.

Note that this function must "disable" the special lighting effects so that the "priority" function will work.

Note the use of a specialized "priority" function to allow this function to work with any graphic attr/char mappings, and the attempts to optimize this function where possible.

If "cy" and "cx" are not NULL, then returns the screen location at which the player was displayed, so the cursor can be moved to that location, and restricts the horizontal map size to SCREEN_WID. Otherwise, nothing is returned (obviously), and no restrictions are enforced.

References cave, COLOUR_WHITE, grid_data::f_idx, f_info, grid_data_as_text(), chunk::height, term::hgt, grid_data::lighting, LIGHTING_LIT, map_info(), mem_free(), mem_zalloc(), monster_x_attr, monster_x_char, NULL, feature::priority, player::px, player::py, r_info, monster_race::ridx, row, Term, Term_big_putch(), Term_big_queue_char(), Term_putch(), Term_queue_char(), tile_height, tile_width, term::wid, chunk::width, and window_make().

Referenced by do_cmd_view_map(), and update_minimap_subwindow().

void do_cmd_view_map ( void  )
void grid_data_as_text ( struct grid_data g,
int ap,
wchar_t *  cp,
int tap,
wchar_t *  tcp 
)

This function takes a pointer to a grid info struct describing the contents of a grid location (as obtained through the function map_info) and fills in the character and attr pairs for display.

ap and cp are filled with the attr/char pair for the monster, object or floor tile that is at the "top" of the grid (monsters covering objects, which cover floor, assuming all are present).

tap and tcp are filled with the attr/char pair for the floor, regardless of what is on it. This can be used by graphical displays with transparency to place an object onto a floor tile, is desired.

Any lighting effects are also applied to these pairs, clear monsters allow the underlying colour or feature to show through (ATTR_CLEAR and CHAR_CLEAR), multi-hued colour-changing (ATTR_MULTI) is applied, and so on. Technically, the flag "CHAR_MULTI" is supposed to indicate that a monster looks strange when examined, but this flag is currently ignored.

NOTES: This is called pretty frequently, whenever a grid on the map display needs updating, so don't overcomplicate it.

The "zero" entry in the feature/object/monster arrays are used to provide "special" attr/char codes, with "monster zero" being used for the player attr/char, "object zero" being used for the "pile" attr/char, and "feature zero" being used for the "darkness" attr/char.

TODO: The transformations for tile colors, or brightness for the 16x16 tiles should be handled differently. One possibility would be to extend feature_type with attr/char definitions for the different states. This will probably be done outside of the current text->graphics mappings though.

References monster::attr, cave, cave_monster(), player::chp, COLOUR_L_RED, COLOUR_ORANGE, COLOUR_RED, COLOUR_VIOLET, COLOUR_WHITE, COLOUR_YELLOW, grid_data::f_idx, f_info, feat_x_attr, feat_x_char, feature::fidx, grid_data::first_kind, FLAG_END, monster_race::flags, flags_test(), get_trap_graphics(), GRAPHICS_NONE, grid_get_attr(), grid_data::hallucinate, hallucinatory_monster(), hallucinatory_object(), grid_data::is_player, grid_data::lighting, grid_data::m_idx, player::mhp, monster_is_mimicking(), monster_x_attr, monster_x_char, grid_data::multiple_objects, object_kind_attr(), object_kind_char(), OPT, pile_kind, r_info, monster::race, rf_has, RF_SIZE, RF_UNIQUE, monster_race::ridx, grid_data::trap, unknown_gold_kind, unknown_item_kind, grid_data::unseen_money, grid_data::unseen_object, and use_graphics.

Referenced by display_map(), prt_map(), prt_map_aux(), and update_maps().

void move_cursor_relative ( int  y,
int  x 
)
void print_rel ( wchar_t  c,
byte  a,
int  y,
int  x 
)

Display an attr/char pair at the given map location.

Note the inline use of "panel_contains()" for efficiency.

Note the use of "Term_queue_char()" for efficiency.

The main screen will always be at least 24x80 in size.

References COL_MAP, term::offset_x, term::offset_y, print_rel_map(), ROW_MAP, SCREEN_HGT, SCREEN_WID, Term, Term_big_queue_char(), Term_queue_char(), tile_height, and tile_width.

Referenced by display_bolt(), display_explosion(), display_missile(), do_cmd_wiz_features(), do_cmd_wiz_hack_nick(), and do_cmd_wiz_query().

void prt_map ( void  )

Redraw (on the screen) the current map panel.

Note the inline use of "light_spot()" for efficiency.

The main screen will always be at least 24x80 in size.

References cave, COL_MAP, COLOUR_WHITE, grid_data_as_text(), map_info(), term::offset_x, term::offset_y, prt_map_aux(), ROW_MAP, SCREEN_HGT, SCREEN_WID, square_in_bounds(), Term, Term_big_queue_char(), Term_queue_char(), tile_height, and tile_width.

Referenced by do_cmd_wiz_features(), do_cmd_wiz_hack_nick(), do_cmd_wiz_query(), and update_maps().