* under_water() * * Similar to swallowed() in operation. Shows hero when underwater * except when in water level. Special routines exist for that. */
| 1392 | * except when in water level. Special routines exist for that. |
| 1393 | */ |
| 1394 | void |
| 1395 | under_water(int mode) |
| 1396 | { |
| 1397 | static coordxy lastx, lasty; |
| 1398 | static boolean dela; |
| 1399 | coordxy x, y; |
| 1400 | |
| 1401 | /* swallowing has a higher precedence than under water */ |
| 1402 | if (Is_waterlevel(&u.uz) || u.uswallow) |
| 1403 | return; |
| 1404 | |
| 1405 | /* full update */ |
| 1406 | if (mode == 1 || dela) { |
| 1407 | cls(); |
| 1408 | dela = FALSE; |
| 1409 | |
| 1410 | /* delayed full update */ |
| 1411 | } else if (mode == 2) { |
| 1412 | dela = TRUE; |
| 1413 | return; |
| 1414 | |
| 1415 | /* limited update */ |
| 1416 | } else { |
| 1417 | for (y = lasty - 1; y <= lasty + 1; y++) |
| 1418 | for (x = lastx - 1; x <= lastx + 1; x++) |
| 1419 | if (isok(x, y)) |
| 1420 | show_glyph(x, y, GLYPH_UNEXPLORED); |
| 1421 | } |
| 1422 | |
| 1423 | /* |
| 1424 | * TODO? Should this honor Xray radius rather than force radius 1? |
| 1425 | */ |
| 1426 | |
| 1427 | for (x = u.ux - 1; x <= u.ux + 1; x++) |
| 1428 | for (y = u.uy - 1; y <= u.uy + 1; y++) |
| 1429 | if (isok(x, y) && (is_pool_or_lava(x, y) || is_ice(x, y))) { |
| 1430 | if (Blind && !u_at(x, y)) |
| 1431 | show_glyph(x, y, GLYPH_UNEXPLORED); |
| 1432 | else |
| 1433 | newsym(x, y); |
| 1434 | } |
| 1435 | lastx = u.ux; |
| 1436 | lasty = u.uy; |
| 1437 | } |
| 1438 | |
| 1439 | /* |
| 1440 | * under_ground() |
no test coverage detected