MCPcopy Create free account
hub / github.com/crawl/crawl / draw_cell

Function draw_cell

crawl-ref/source/view.cc:892–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

890}
891
892void draw_cell(screen_cell_t *cell, const coord_def &gc,
893 bool anim_updates, int flash_colour)
894{
895#ifdef USE_TILE
896 cell->tile.clear();
897#endif
898
899 if (!map_bounds(gc))
900 _draw_out_of_bounds(cell);
901 else if (!crawl_view.in_los_bounds_g(gc))
902 _draw_outside_los(cell, gc);
903 else if (gc == you.pos() && you.on_current_level
904 && _layers & Layer::PLAYER
905 && !crawl_state.game_is_arena()
906 && !crawl_state.arena_suspended)
907 {
908 _draw_player(cell, gc, anim_updates);
909 }
910 else if (you.see_cell(gc))
911 _draw_los(cell, gc, anim_updates);
912 else
913 _draw_outside_los(cell, gc); // in los bounds but not visible
914
915#ifdef USE_TILE
916 cell->tile.map_knowledge = map_bounds(gc) ? env.map_knowledge(gc) : map_cell();
917 cell->flash_colour = BLACK;
918 cell->flash_alpha = 0;
919#endif
920
921 // Don't hide important information by recolouring monsters.
922 bool allow_mon_recolour = query_map_knowledge(true, gc, [](const map_cell& m) {
923 return m.monster() == MONS_NO_MONSTER || mons_class_is_firewood(m.monster());
924 });
925
926 // Is this cell excluded from movement by mesmerise-related statuses?
927 // MAP_WITHHELD is set in `show.cc:_update_feat_at`.
928 bool mesmerise_excluded = (gc != you.pos() // for fungus form
929 && map_bounds(gc)
930 && you.on_current_level
931 && (env.map_knowledge(gc).flags & MAP_WITHHELD)
932 && !feat_is_solid(env.grid(gc)));
933
934#ifdef USE_TILE
935 if (you.duration[DUR_BLIND] && you.see_cell(gc))
936 {
937 cell->flash_colour = real_colour(you.props[BLIND_COLOUR_KEY].get_int(), gc);
938 // Using a square curve for the alpha is nicer on the eyes than a straight multiple.
939 // The effect of alpha is already disproportionate depending on the flash colour
940 // and may need to be revised: for a white flash the effect is already extreme by
941 // around alpha 80, but for darker colours it is way dimmer and needs more like 150.
942 const int alpha_base = gc.distance_from(you.pos());
943 cell->flash_alpha = max(1, alpha_base * alpha_base);
944 }
945#endif
946
947 // Alter colour if flashing the characters vision.
948 if (flash_colour)
949 {

Callers 2

_send_mapMethod · 0.85
view_dungeonFunction · 0.85

Calls 15

map_boundsFunction · 0.85
_draw_out_of_boundsFunction · 0.85
_draw_outside_losFunction · 0.85
_draw_playerFunction · 0.85
_draw_losFunction · 0.85
query_map_knowledgeFunction · 0.85
mons_class_is_firewoodFunction · 0.85
feat_is_solidFunction · 0.85
real_colourFunction · 0.85
tile_apply_propertiesFunction · 0.85
travel_colour_overrideFunction · 0.85
is_exclude_rootFunction · 0.85

Tested by

no test coverage detected