* 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
| 2284 | * variables. |
| 2285 | */ |
| 2286 | int |
| 2287 | back_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; |