… | |
… | |
1008 | int mflags; |
1008 | int mflags; |
1009 | sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir]; |
1009 | sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir]; |
1010 | maptile *m; |
1010 | maptile *m; |
1011 | |
1011 | |
1012 | mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy); |
1012 | mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy); |
|
|
1013 | |
|
|
1014 | // when creating a bomb below ourself it should always work, even |
|
|
1015 | // when movement is blocked (somehow we got here, somehow we are here, |
|
|
1016 | // so we should also be able to make a bomb here). (originally added |
|
|
1017 | // to fix create bomb traps in doors, which cast with dir=0). |
|
|
1018 | if (dir) |
|
|
1019 | { |
1013 | if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) |
1020 | if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) |
1014 | { |
1021 | { |
1015 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
1022 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
1016 | return 0; |
1023 | return 0; |
|
|
1024 | } |
1017 | } |
1025 | } |
1018 | |
1026 | |
1019 | tmp = arch_to_object (spell->other_arch); |
1027 | tmp = arch_to_object (spell->other_arch); |
1020 | |
1028 | |
1021 | /* level dependencies for bomb */ |
1029 | /* level dependencies for bomb */ |
… | |
… | |
1489 | /* If there is nothing living on this space, no need to go further */ |
1497 | /* If there is nothing living on this space, no need to go further */ |
1490 | if (!(mflags & P_IS_ALIVE)) |
1498 | if (!(mflags & P_IS_ALIVE)) |
1491 | continue; |
1499 | continue; |
1492 | |
1500 | |
1493 | // players can only affect spaces that they can actually see |
1501 | // players can only affect spaces that they can actually see |
|
|
1502 | if (caster |
1494 | if (caster && caster->contr |
1503 | && caster->contr |
1495 | && caster->contr->visibility_at (m, nx, ny) < 70) |
1504 | && caster->contr->darkness_at (m, nx, ny) == LOS_BLOCKED) |
1496 | continue; |
1505 | continue; |
1497 | |
1506 | |
1498 | for (tmp = GET_MAP_TOP (m, nx, ny); tmp; tmp = tmp->below) |
1507 | for (tmp = GET_MAP_TOP (m, nx, ny); tmp; tmp = tmp->below) |
1499 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |
1508 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |
1500 | break; |
1509 | break; |
… | |
… | |
1610 | } /* for y */ |
1619 | } /* for y */ |
1611 | |
1620 | |
1612 | return 1; |
1621 | return 1; |
1613 | } |
1622 | } |
1614 | |
1623 | |
1615 | |
|
|
1616 | /* Move_ball_spell: This handles ball type spells that just sort of wander |
1624 | /* Move_ball_spell: This handles ball type spells that just sort of wander |
1617 | * about. was called move_ball_lightning, but since more than the ball |
1625 | * about. was called move_ball_lightning, but since more than the ball |
1618 | * lightning spell used it, that seemed misnamed. |
1626 | * lightning spell used it, that seemed misnamed. |
1619 | * op is the spell effect. |
1627 | * op is the spell effect. |
1620 | * note that duration is handled by process_object() in time.c |
1628 | * note that duration is handled by process_object() in time.c |
… | |
… | |
1645 | for (i = 1; i < 9; i++) |
1653 | for (i = 1; i < 9; i++) |
1646 | { |
1654 | { |
1647 | /* i bit 0: alters sign of offset |
1655 | /* i bit 0: alters sign of offset |
1648 | * other bits (i / 2): absolute value of offset |
1656 | * other bits (i / 2): absolute value of offset |
1649 | */ |
1657 | */ |
1650 | |
|
|
1651 | int offset = ((i ^ j) & 1) ? (i / 2) : -(i / 2); |
1658 | int offset = ((i ^ j) & 1) ? (i / 2) : -(i / 2); |
1652 | int tmpdir = absdir (op->direction + offset); |
1659 | int tmpdir = absdir (op->direction + offset); |
1653 | |
1660 | |
1654 | nx = op->x + freearr_x[tmpdir]; |
1661 | nx = op->x + freearr_x[tmpdir]; |
1655 | ny = op->y + freearr_y[tmpdir]; |
1662 | ny = op->y + freearr_y[tmpdir]; |
… | |
… | |
1657 | { |
1664 | { |
1658 | dir = tmpdir; |
1665 | dir = tmpdir; |
1659 | break; |
1666 | break; |
1660 | } |
1667 | } |
1661 | } |
1668 | } |
|
|
1669 | |
1662 | if (dir == 0) |
1670 | if (dir == 0) |
1663 | { |
1671 | { |
1664 | nx = op->x; |
1672 | nx = op->x; |
1665 | ny = op->y; |
1673 | ny = op->y; |
1666 | m = op->map; |
1674 | m = op->map; |