const char *surface(int x, int y) { struct rm *loc = &level->locations[x][y]; if ((x == u.ux) && (y == u.uy) && u.uswallow && is_animal(u.ustuck->data)) return "maw"; else if (IS_AIR(loc->typ) && Is_airlevel(&u.uz)) return "air"; else if (is_pool(level, x, y)) return (Underwater && !Is_waterlevel(&u.uz)) ? "bottom" : "water"; else if (is_ice(level, x, y)) return "ice"; else if (is_lava(level, x, y)) return "lava"; else if (loc->typ == DRAWBRIDGE_DOWN) return "bridge"; else if (IS_ALTAR(level->locations[x][y].typ)) return "altar"; else if (IS_GRAVE(level->locations[x][y].typ)) return "headstone"; else if (IS_FOUNTAIN(level->locations[x][y].typ)) return "fountain"; else if ((IS_ROOM(loc->typ) && !Is_earthlevel(&u.uz)) || IS_WALL(loc->typ) || IS_DOOR(loc->typ) || loc->typ == SDOOR) return "floor"; else return "ground"; }
const char *ceiling(int x, int y) { struct rm *loc = &level->locations[x][y]; const char *what; /* other room types will no longer exist when we're interested -- * see check_special_room() */ if (*in_rooms(level, x, y, VAULT)) what = "vault's ceiling"; else if (*in_rooms(level, x, y, TEMPLE)) what = "temple's ceiling"; else if (*in_rooms(level, x, y, SHOPBASE)) what = "shop's ceiling"; else if (IS_AIR(loc->typ)) what = "sky"; else if (Underwater) what = "water's surface"; else if ((IS_ROOM(loc->typ) && !Is_earthlevel(&u.uz)) || IS_WALL(loc->typ) || IS_DOOR(loc->typ) || loc->typ == SDOOR) what = "ceiling"; else what = "rock above"; return what; }
/* build a level name for historic events * in_or_on = TRUE: "On T:12345 you killed Kenny ..." * - in The Castle * - on level 3 of Sokoban * - on level 45 in Gehennom * in_or_on = FALSE: "On T:12345 you reached ..." * - The Castle * - level 3 of The Quest * - level 12 in The Dungeons of Doom * */ const char * hist_lev_name(const d_level * l, boolean in_or_on) { const char *hlnbuf; if (Is_astralevel(l)) hlnbuf = "on the Astral Plane"; else if (Is_waterlevel(l)) hlnbuf = "on the Plane of Water"; else if (Is_firelevel(l)) hlnbuf = "on the Plane of Fire"; else if (Is_airlevel(l)) hlnbuf = "on the Plane of Air"; else if (Is_earthlevel(l)) hlnbuf = "on the Plane of Earth"; else if (Is_knox(l)) hlnbuf = "in Fort Ludios"; else if (Is_stronghold(l)) hlnbuf = "in The Castle"; else if (Is_valley(l)) hlnbuf = "in The Valley of the Dead"; else hlnbuf = msgprintf("on level %d of %s", l->dlevel, find_dungeon(l).dname); if (!in_or_on) hlnbuf += 3; return hlnbuf; }