… | |
… | |
1061 | */ |
1061 | */ |
1062 | void |
1062 | void |
1063 | mapspace::update_ () |
1063 | mapspace::update_ () |
1064 | { |
1064 | { |
1065 | object *last = 0; |
1065 | object *last = 0; |
1066 | uint8 flags = P_UPTODATE, light = 0, anywhere = 0; |
1066 | uint8 flags = P_UPTODATE, anywhere = 0; |
|
|
1067 | sint8 light = 0; |
1067 | 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; |
1068 | |
1069 | |
1069 | //object *middle = 0; |
1070 | //object *middle = 0; |
1070 | //object *top = 0; |
1071 | //object *top = 0; |
1071 | //object *floor = 0; |
1072 | //object *floor = 0; |
… | |
… | |
1074 | object *&middle = faces_obj[1] = 0; |
1075 | object *&middle = faces_obj[1] = 0; |
1075 | object *&floor = faces_obj[2] = 0; |
1076 | object *&floor = faces_obj[2] = 0; |
1076 | |
1077 | |
1077 | for (object *tmp = bot; tmp; last = tmp, tmp = tmp->above) |
1078 | for (object *tmp = bot; tmp; last = tmp, tmp = tmp->above) |
1078 | { |
1079 | { |
1079 | /* This could be made additive I guess (two lights better than |
1080 | // Lights are additive, up to MAX_LIGHT_RADIUS, see los.C) |
1080 | * one). But if so, it shouldn't be a simple additive - 2 |
|
|
1081 | * light bulbs do not illuminate twice as far as once since |
|
|
1082 | * it is a dissapation factor that is cubed. |
|
|
1083 | */ |
|
|
1084 | light = max (light, tmp->glow_radius); |
1081 | light += tmp->glow_radius; |
1085 | |
1082 | |
1086 | /* This call is needed in order to update objects the player |
1083 | /* This call is needed in order to update objects the player |
1087 | * is standing in that have animations (ie, grass, fire, etc). |
1084 | * is standing in that have animations (ie, grass, fire, etc). |
1088 | * However, it also causes the look window to be re-drawn |
1085 | * However, it also causes the look window to be re-drawn |
1089 | * 3 times each time the player moves, because many of the |
1086 | * 3 times each time the player moves, because many of the |
… | |
… | |
1137 | if (tmp->type == SAFE_GROUND) flags |= P_SAFE; |
1134 | if (tmp->type == SAFE_GROUND) flags |= P_SAFE; |
1138 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) flags |= P_IS_ALIVE; |
1135 | if (QUERY_FLAG (tmp, FLAG_ALIVE)) flags |= P_IS_ALIVE; |
1139 | if (QUERY_FLAG (tmp, FLAG_DAMNED)) flags |= P_NO_CLERIC; |
1136 | if (QUERY_FLAG (tmp, FLAG_DAMNED)) flags |= P_NO_CLERIC; |
1140 | } |
1137 | } |
1141 | |
1138 | |
1142 | this->light = light; |
1139 | this->light = min (light, MAX_LIGHT_RADIUS); |
1143 | this->flags_ = flags; |
1140 | this->flags_ = flags; |
1144 | this->move_block = move_block & ~move_allow; |
1141 | this->move_block = move_block & ~move_allow; |
1145 | this->move_on = move_on; |
1142 | this->move_on = move_on; |
1146 | this->move_off = move_off; |
1143 | this->move_off = move_off; |
1147 | this->move_slow = move_slow; |
1144 | this->move_slow = move_slow; |
… | |
… | |
1628 | maptile::play_sound (faceidx sound, int x, int y) const |
1625 | maptile::play_sound (faceidx sound, int x, int y) const |
1629 | { |
1626 | { |
1630 | if (!sound) |
1627 | if (!sound) |
1631 | return; |
1628 | return; |
1632 | |
1629 | |
1633 | for_all_players (pl) |
1630 | for_all_players_on_map (pl, this) |
1634 | if (pl->ob->map == this) |
|
|
1635 | if (client *ns = pl->ns) |
1631 | if (client *ns = pl->ns) |
1636 | { |
1632 | { |
1637 | int dx = x - pl->ob->x; |
1633 | int dx = x - pl->ob->x; |
1638 | int dy = y - pl->ob->y; |
1634 | int dy = y - pl->ob->y; |
1639 | |
1635 | |
1640 | int distance = idistance (dx, dy); |
1636 | int distance = idistance (dx, dy); |
1641 | |
1637 | |
1642 | if (distance <= MAX_SOUND_DISTANCE) |
1638 | if (distance <= MAX_SOUND_DISTANCE) |
1643 | ns->play_sound (sound, dx, dy); |
1639 | ns->play_sound (sound, dx, dy); |
1644 | } |
1640 | } |
1645 | } |
1641 | } |
1646 | |
1642 | |