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

Function under_water

src/display.c:1394–1437  ·  view source on GitHub ↗

* under_water() * * Similar to swallowed() in operation. Shows hero when underwater * except when in water level. Special routines exist for that. */

Source from the content-addressed store, hash-verified

1392 * except when in water level. Special routines exist for that.
1393 */
1394void
1395under_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()

Callers 4

allmain.cFile · 0.85
map_redisplayFunction · 0.85
docrt_flagsFunction · 0.85
drownFunction · 0.85

Calls 6

clsFunction · 0.85
isokFunction · 0.85
show_glyphFunction · 0.85
is_pool_or_lavaFunction · 0.85
is_iceFunction · 0.85
newsymFunction · 0.85

Tested by

no test coverage detected