augment the Planes of Water (for bubbles) and Air (for clouds); called from goto_level() when arriving and moveloop_core() when on the level */
| 1536 | /* augment the Planes of Water (for bubbles) and Air (for clouds); called |
| 1537 | from goto_level() when arriving and moveloop_core() when on the level */ |
| 1538 | void |
| 1539 | movebubbles(void) |
| 1540 | { |
| 1541 | static const struct rm water_pos = { |
| 1542 | cmap_b_to_glyph(S_water), WATER, 0, 0, 0, 0, 0, 0, 0, 0 |
| 1543 | }, air_pos = { |
| 1544 | cmap_b_to_glyph(S_cloud), AIR, 0, 0, 0, 1, 0, 0, 0, 0 |
| 1545 | }; |
| 1546 | static boolean up = FALSE; |
| 1547 | struct bubble *b; |
| 1548 | struct container *cons; |
| 1549 | struct trap *btrap; |
| 1550 | coordxy x, y; |
| 1551 | int i, j, bcpin = 0; |
| 1552 | |
| 1553 | /* set up the portal the first time bubbles are moved */ |
| 1554 | if (!gw.wportal) |
| 1555 | set_wportal(); |
| 1556 | |
| 1557 | vision_recalc(2); |
| 1558 | |
| 1559 | hero_bubble = NULL; |
| 1560 | |
| 1561 | if (Is_waterlevel(&u.uz)) { |
| 1562 | /* keep attached ball&chain separate from bubble objects */ |
| 1563 | if (Punished) |
| 1564 | bcpin = unplacebc_and_covet_placebc(); |
| 1565 | |
| 1566 | /* |
| 1567 | * Pick up everything inside of a bubble then fill all bubble |
| 1568 | * locations. |
| 1569 | */ |
| 1570 | for (b = up ? svb.bbubbles : ge.ebubbles; b; |
| 1571 | b = up ? b->next : b->prev) { |
| 1572 | if (b->cons) |
| 1573 | panic("movebubbles: cons != null"); |
| 1574 | for (i = 0, x = b->x; i < (int) b->bm[0]; i++, x++) |
| 1575 | for (j = 0, y = b->y; j < (int) b->bm[1]; j++, y++) |
| 1576 | if (b->bm[j + 2] & (1 << i)) { |
| 1577 | if (!isok(x, y)) { |
| 1578 | impossible("movebubbles: bad pos (%d,%d)", x, y); |
| 1579 | continue; |
| 1580 | } |
| 1581 | |
| 1582 | /* pick up objects, monsters, hero, and traps */ |
| 1583 | if (OBJ_AT(x, y)) { |
| 1584 | struct obj *olist = (struct obj *) 0, *otmp; |
| 1585 | |
| 1586 | while ((otmp = svl.level.objects[x][y]) != 0) { |
| 1587 | remove_object(otmp); |
| 1588 | otmp->ox = otmp->oy = 0; |
| 1589 | otmp->nexthere = olist; |
| 1590 | olist = otmp; |
| 1591 | } |
| 1592 | |
| 1593 | cons = (struct container *) alloc(sizeof *cons); |
| 1594 | cons->x = x; |
| 1595 | cons->y = y; |
no test coverage detected