* swallowed() * * The hero is swallowed. Show a special graphics sequence for this. This * bypasses all of the display routines and messes with buffered screen * directly. This method works because both vision and display check for * being swallowed. */
| 1329 | * being swallowed. |
| 1330 | */ |
| 1331 | void |
| 1332 | swallowed(int first) |
| 1333 | { |
| 1334 | static coordxy lastx, lasty; /* last swallowed position */ |
| 1335 | int swallower, left_ok, rght_ok; |
| 1336 | |
| 1337 | if (first) { |
| 1338 | cls(); |
| 1339 | bot(); |
| 1340 | } else { |
| 1341 | coordxy x, y; |
| 1342 | |
| 1343 | /* Clear old location */ |
| 1344 | for (y = lasty - 1; y <= lasty + 1; y++) |
| 1345 | for (x = lastx - 1; x <= lastx + 1; x++) |
| 1346 | if (isok(x, y)) |
| 1347 | show_glyph(x, y, GLYPH_UNEXPLORED); |
| 1348 | } |
| 1349 | |
| 1350 | swallower = monsndx(u.ustuck->data); |
| 1351 | /* assume isok(u.ux,u.uy) */ |
| 1352 | left_ok = isok(u.ux - 1, u.uy); |
| 1353 | rght_ok = isok(u.ux + 1, u.uy); |
| 1354 | /* |
| 1355 | * Display the hero surrounded by the monster's stomach. |
| 1356 | */ |
| 1357 | if (isok(u.ux, u.uy - 1)) { |
| 1358 | if (left_ok) |
| 1359 | show_glyph(u.ux - 1, u.uy - 1, |
| 1360 | swallow_to_glyph(swallower, S_sw_tl)); |
| 1361 | show_glyph(u.ux, u.uy - 1, swallow_to_glyph(swallower, S_sw_tc)); |
| 1362 | if (rght_ok) |
| 1363 | show_glyph(u.ux + 1, u.uy - 1, |
| 1364 | swallow_to_glyph(swallower, S_sw_tr)); |
| 1365 | } |
| 1366 | |
| 1367 | if (left_ok) |
| 1368 | show_glyph(u.ux - 1, u.uy, swallow_to_glyph(swallower, S_sw_ml)); |
| 1369 | display_self(); |
| 1370 | if (rght_ok) |
| 1371 | show_glyph(u.ux + 1, u.uy, swallow_to_glyph(swallower, S_sw_mr)); |
| 1372 | |
| 1373 | if (isok(u.ux, u.uy + 1)) { |
| 1374 | if (left_ok) |
| 1375 | show_glyph(u.ux - 1, u.uy + 1, |
| 1376 | swallow_to_glyph(swallower, S_sw_bl)); |
| 1377 | show_glyph(u.ux, u.uy + 1, swallow_to_glyph(swallower, S_sw_bc)); |
| 1378 | if (rght_ok) |
| 1379 | show_glyph(u.ux + 1, u.uy + 1, |
| 1380 | swallow_to_glyph(swallower, S_sw_br)); |
| 1381 | } |
| 1382 | |
| 1383 | /* Update the swallowed position. */ |
| 1384 | lastx = u.ux; |
| 1385 | lasty = u.uy; |
| 1386 | } |
| 1387 | |
| 1388 | /* |
no test coverage detected