MCPcopy Create free account
hub / github.com/NetHack/NetHack / back_to_glyph

Function back_to_glyph

src/display.c:2286–2427  ·  view source on GitHub ↗

* back_to_glyph() * * Use the information in the rm structure at the given position to create * a glyph of a background. * * I had to add a field in the rm structure (horizontal) so that we knew * if open doors and secret doors were horizontal or vertical. Previously, * the screen symbol had the horizontal/vertical information set at * level generation time. * * I used the 'ladder' fiel

Source from the content-addressed store, hash-verified

2284 * variables.
2285 */
2286int
2287back_to_glyph(coordxy x, coordxy y)
2288{
2289 int idx, bypass_glyph = NO_GLYPH;
2290 struct rm *ptr = &(levl[x][y]);
2291 struct stairway *sway;
2292
2293 switch (ptr->typ) {
2294 case SCORR:
2295 case STONE:
2296 idx = svl.level.flags.arboreal ? S_tree : S_stone;
2297 break;
2298 case ROOM:
2299 idx = S_room;
2300 break;
2301 case CORR:
2302 idx = (ptr->waslit || flags.lit_corridor) ? S_litcorr : S_corr;
2303 break;
2304 case SDOOR:
2305 if (ptr->arboreal_sdoor) {
2306 idx = S_tree;
2307 break;
2308 }
2309 FALLTHROUGH;
2310 /*FALLTHRU*/
2311 case HWALL:
2312 case VWALL:
2313 case TLCORNER:
2314 case TRCORNER:
2315 case BLCORNER:
2316 case BRCORNER:
2317 case CROSSWALL:
2318 case TUWALL:
2319 case TDWALL:
2320 case TLWALL:
2321 case TRWALL:
2322 idx = ptr->seenv ? wall_angle(ptr) : S_stone;
2323 break;
2324 case DOOR:
2325 if (ptr->doormask) {
2326 if (ptr->doormask & D_BROKEN)
2327 idx = S_ndoor;
2328 else if (ptr->doormask & D_ISOPEN)
2329 idx = (ptr->horizontal) ? S_hodoor : S_vodoor;
2330 else /* else is closed */
2331 idx = (ptr->horizontal) ? S_hcdoor : S_vcdoor;
2332 } else
2333 idx = S_ndoor;
2334 break;
2335 case IRONBARS:
2336 idx = S_bars;
2337 break;
2338 case TREE:
2339 idx = S_tree;
2340 break;
2341 case POOL:
2342 case MOAT:
2343 idx = S_pool;

Callers 12

findoneFunction · 0.85
reveal_terrain_getglyphFunction · 0.85
test_moveFunction · 0.85
domove_fight_emptyFunction · 0.85
magic_map_backgroundFunction · 0.85
map_backgroundFunction · 0.85
flash_glyph_atFunction · 0.85
mkstairsFunction · 0.85
flip_visualsFunction · 0.85
gloc_filter_floodfillFunction · 0.85
getposFunction · 0.85

Calls 4

wall_angleFunction · 0.85
stairway_atFunction · 0.85
known_branch_stairsFunction · 0.85
impossibleFunction · 0.70

Tested by 1

test_moveFunction · 0.68