… | |
… | |
712 | |
712 | |
713 | if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) |
713 | if (QUERY_FLAG (op, FLAG_IS_FLOOR) && QUERY_FLAG (op, FLAG_UNIQUE)) |
714 | unique = 1; |
714 | unique = 1; |
715 | |
715 | |
716 | if (op->head_ () == op && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) |
716 | if (op->head_ () == op && (QUERY_FLAG (op, FLAG_UNIQUE) || unique)) |
717 | { |
|
|
718 | op->destroy_inv (false); |
|
|
719 | op->destroy (); |
717 | op->destroy (); |
720 | } |
|
|
721 | |
718 | |
722 | op = above; |
719 | op = above; |
723 | } |
720 | } |
724 | } |
721 | } |
725 | } |
722 | } |
… | |
… | |
813 | |
810 | |
814 | op->flag [FLAG_REMOVED] = true; |
811 | op->flag [FLAG_REMOVED] = true; |
815 | |
812 | |
816 | object *head = op->head_ (); |
813 | object *head = op->head_ (); |
817 | if (op == head) |
814 | if (op == head) |
818 | { |
|
|
819 | op->destroy_inv (false); |
|
|
820 | op->destroy (); |
815 | op->destroy (); |
821 | } |
|
|
822 | else if (head->map != op->map) |
816 | else if (head->map != op->map) |
823 | { |
817 | { |
824 | LOG (llevDebug, "bad luck for object crossing map borders: %s", head->debug_desc ()); |
818 | LOG (llevDebug, "bad luck for object crossing map borders: %s", head->debug_desc ()); |
825 | head->destroy (); |
819 | head->destroy (); |
826 | } |
820 | } |
… | |
… | |
1067 | */ |
1061 | */ |
1068 | void |
1062 | void |
1069 | mapspace::update_ () |
1063 | mapspace::update_ () |
1070 | { |
1064 | { |
1071 | object *last = 0; |
1065 | object *last = 0; |
1072 | uint8 flags = P_UPTODATE, light = 0, anywhere = 0; |
1066 | uint8 flags = P_UPTODATE, anywhere = 0; |
|
|
1067 | sint8 light = 0; |
1073 | MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; |
1068 | MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; |
1074 | |
1069 | |
1075 | //object *middle = 0; |
1070 | //object *middle = 0; |
1076 | //object *top = 0; |
1071 | //object *top = 0; |
1077 | //object *floor = 0; |
1072 | //object *floor = 0; |
… | |
… | |
1080 | object *&middle = faces_obj[1] = 0; |
1075 | object *&middle = faces_obj[1] = 0; |
1081 | object *&floor = faces_obj[2] = 0; |
1076 | object *&floor = faces_obj[2] = 0; |
1082 | |
1077 | |
1083 | for (object *tmp = bot; tmp; last = tmp, tmp = tmp->above) |
1078 | for (object *tmp = bot; tmp; last = tmp, tmp = tmp->above) |
1084 | { |
1079 | { |
1085 | /* This could be made additive I guess (two lights better than |
1080 | // Lights are additive, up to MAX_LIGHT_RADIUS, see los.C) |
1086 | * one). But if so, it shouldn't be a simple additive - 2 |
|
|
1087 | * light bulbs do not illuminate twice as far as once since |
|
|
1088 | * it is a dissapation factor that is cubed. |
|
|
1089 | */ |
|
|
1090 | light = max (light, tmp->glow_radius); |
1081 | light += tmp->glow_radius; |
1091 | |
1082 | |
1092 | /* This call is needed in order to update objects the player |
1083 | /* This call is needed in order to update objects the player |
1093 | * is standing in that have animations (ie, grass, fire, etc). |
1084 | * is standing in that have animations (ie, grass, fire, etc). |
1094 | * However, it also causes the look window to be re-drawn |
1085 | * However, it also causes the look window to be re-drawn |
1095 | * 3 times each time the player moves, because many of the |
1086 | * 3 times each time the player moves, because many of the |
… | |
… | |
1143 | if (tmp->type == SAFE_GROUND) flags |= P_SAFE; |
1134 | if (tmp->type == SAFE_GROUND) flags |= P_SAFE; |
1144 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) flags |= P_IS_ALIVE; |
1135 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) flags |= P_IS_ALIVE; |
1145 | if (QUERY_FLAG (tmp, FLAG_DAMNED)) flags |= P_NO_CLERIC; |
1136 | if (QUERY_FLAG (tmp, FLAG_DAMNED)) flags |= P_NO_CLERIC; |
1146 | } |
1137 | } |
1147 | |
1138 | |
1148 | this->light = light; |
1139 | this->light = min (light, MAX_LIGHT_RADIUS); |
1149 | this->flags_ = flags; |
1140 | this->flags_ = flags; |
1150 | this->move_block = move_block & ~move_allow; |
1141 | this->move_block = move_block & ~move_allow; |
1151 | this->move_on = move_on; |
1142 | this->move_on = move_on; |
1152 | this->move_off = move_off; |
1143 | this->move_off = move_off; |
1153 | this->move_slow = move_slow; |
1144 | this->move_slow = move_slow; |
… | |
… | |
1634 | maptile::play_sound (faceidx sound, int x, int y) const |
1625 | maptile::play_sound (faceidx sound, int x, int y) const |
1635 | { |
1626 | { |
1636 | if (!sound) |
1627 | if (!sound) |
1637 | return; |
1628 | return; |
1638 | |
1629 | |
1639 | for_all_players (pl) |
1630 | for_all_players_on_map (pl, this) |
1640 | if (pl->ob->map == this) |
|
|
1641 | if (client *ns = pl->ns) |
1631 | if (client *ns = pl->ns) |
1642 | { |
1632 | { |
1643 | int dx = x - pl->ob->x; |
1633 | int dx = x - pl->ob->x; |
1644 | int dy = y - pl->ob->y; |
1634 | int dy = y - pl->ob->y; |
1645 | |
1635 | |
1646 | int distance = idistance (dx, dy); |
1636 | int distance = idistance (dx, dy); |
1647 | |
1637 | |
1648 | if (distance <= MAX_SOUND_DISTANCE) |
1638 | if (distance <= MAX_SOUND_DISTANCE) |
1649 | ns->play_sound (sound, dx, dy); |
1639 | ns->play_sound (sound, dx, dy); |
1650 | } |
1640 | } |
1651 | } |
1641 | } |
1652 | |
1642 | |