… | |
… | |
641 | case KW_sky: thawer.get (sky); break; |
641 | case KW_sky: thawer.get (sky); break; |
642 | |
642 | |
643 | case KW_per_player: thawer.get (per_player); break; |
643 | case KW_per_player: thawer.get (per_player); break; |
644 | case KW_per_party: thawer.get (per_party); break; |
644 | case KW_per_party: thawer.get (per_party); break; |
645 | case KW_no_reset: thawer.get (no_reset); break; |
645 | case KW_no_reset: thawer.get (no_reset); break; |
|
|
646 | case KW_no_drop: thawer.get (no_drop); break; |
646 | |
647 | |
647 | case KW_region: default_region = region::find (thawer.get_str ()); break; |
648 | case KW_region: default_region = region::find (thawer.get_str ()); break; |
648 | case KW_shopitems: shopitems = parse_shop_string (thawer.get_str ()); break; |
649 | case KW_shopitems: shopitems = parse_shop_string (thawer.get_str ()); break; |
649 | |
650 | |
650 | // old names new names |
651 | // old names new names |
… | |
… | |
724 | MAP_OUT (swap_time); |
725 | MAP_OUT (swap_time); |
725 | MAP_OUT (reset_time); |
726 | MAP_OUT (reset_time); |
726 | MAP_OUT (reset_timeout); |
727 | MAP_OUT (reset_timeout); |
727 | MAP_OUT (fixed_resettime); |
728 | MAP_OUT (fixed_resettime); |
728 | MAP_OUT (no_reset); |
729 | MAP_OUT (no_reset); |
|
|
730 | MAP_OUT (no_drop); |
729 | MAP_OUT (difficulty); |
731 | MAP_OUT (difficulty); |
730 | |
732 | |
731 | if (default_region) MAP_OUT2 (region, default_region->name); |
733 | if (default_region) MAP_OUT2 (region, default_region->name); |
732 | |
734 | |
733 | if (shopitems) |
735 | if (shopitems) |
… | |
… | |
981 | |
983 | |
982 | if (QUERY_FLAG (op, FLAG_GENERATOR)) |
984 | if (QUERY_FLAG (op, FLAG_GENERATOR)) |
983 | { |
985 | { |
984 | total_exp += op->stats.exp; |
986 | total_exp += op->stats.exp; |
985 | |
987 | |
986 | if (archetype *at = type_to_archetype (GENERATE_TYPE (op))) |
988 | if (archetype *at = op->other_arch) |
|
|
989 | { |
987 | total_exp += at->stats.exp * 8; |
990 | total_exp += at->stats.exp * 8; |
988 | |
|
|
989 | monster_cnt++; |
991 | monster_cnt++; |
|
|
992 | } |
|
|
993 | |
|
|
994 | for (object *inv = op->inv; inv; inv = inv->below) |
|
|
995 | { |
|
|
996 | total_exp += op->stats.exp * 8; |
|
|
997 | monster_cnt++; |
|
|
998 | } |
990 | } |
999 | } |
991 | } |
1000 | } |
992 | |
1001 | |
993 | avgexp = (double) total_exp / monster_cnt; |
1002 | avgexp = (double) total_exp / monster_cnt; |
994 | |
1003 | |
… | |
… | |
1033 | else |
1042 | else |
1034 | darkness = new_level; |
1043 | darkness = new_level; |
1035 | |
1044 | |
1036 | /* All clients need to get re-updated for the change */ |
1045 | /* All clients need to get re-updated for the change */ |
1037 | update_all_map_los (this); |
1046 | update_all_map_los (this); |
|
|
1047 | |
1038 | return 1; |
1048 | return 1; |
1039 | } |
1049 | } |
1040 | |
1050 | |
1041 | /* |
1051 | /* |
1042 | * This function updates various attributes about a specific space |
1052 | * This function updates various attributes about a specific space |
… | |
… | |
1045 | * through, etc) |
1055 | * through, etc) |
1046 | */ |
1056 | */ |
1047 | void |
1057 | void |
1048 | mapspace::update_ () |
1058 | mapspace::update_ () |
1049 | { |
1059 | { |
1050 | object *tmp, *last = 0; |
1060 | object *last = 0; |
1051 | uint8 flags = P_UPTODATE, light = 0, anywhere = 0; |
1061 | uint8 flags = P_UPTODATE, light = 0, anywhere = 0; |
1052 | MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; |
1062 | MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; |
1053 | |
1063 | |
1054 | //object *middle = 0; |
1064 | //object *middle = 0; |
1055 | //object *top = 0; |
1065 | //object *top = 0; |
… | |
… | |
1057 | // this seems to generate better code than using locals, above |
1067 | // this seems to generate better code than using locals, above |
1058 | object *&top = faces_obj[0] = 0; |
1068 | object *&top = faces_obj[0] = 0; |
1059 | object *&middle = faces_obj[1] = 0; |
1069 | object *&middle = faces_obj[1] = 0; |
1060 | object *&floor = faces_obj[2] = 0; |
1070 | object *&floor = faces_obj[2] = 0; |
1061 | |
1071 | |
1062 | for (tmp = bot; tmp; last = tmp, tmp = tmp->above) |
1072 | for (object *tmp = bot; tmp; last = tmp, tmp = tmp->above) |
1063 | { |
1073 | { |
1064 | /* This could be made additive I guess (two lights better than |
1074 | /* This could be made additive I guess (two lights better than |
1065 | * one). But if so, it shouldn't be a simple additive - 2 |
1075 | * one). But if so, it shouldn't be a simple additive - 2 |
1066 | * light bulbs do not illuminate twice as far as once since |
1076 | * light bulbs do not illuminate twice as far as once since |
1067 | * it is a dissapation factor that is cubed. |
1077 | * it is a dissapation factor that is cubed. |
1068 | */ |
1078 | */ |
1069 | if (tmp->glow_radius > light) |
|
|
1070 | light = tmp->glow_radius; |
1079 | light = max (light, tmp->glow_radius); |
1071 | |
1080 | |
1072 | /* This call is needed in order to update objects the player |
1081 | /* This call is needed in order to update objects the player |
1073 | * is standing in that have animations (ie, grass, fire, etc). |
1082 | * is standing in that have animations (ie, grass, fire, etc). |
1074 | * However, it also causes the look window to be re-drawn |
1083 | * However, it also causes the look window to be re-drawn |
1075 | * 3 times each time the player moves, because many of the |
1084 | * 3 times each time the player moves, because many of the |
… | |
… | |
1152 | * 1) top face is set, need middle to be set. |
1161 | * 1) top face is set, need middle to be set. |
1153 | * 2) middle is set, need to set top. |
1162 | * 2) middle is set, need to set top. |
1154 | * 3) neither middle or top is set - need to set both. |
1163 | * 3) neither middle or top is set - need to set both. |
1155 | */ |
1164 | */ |
1156 | |
1165 | |
1157 | for (tmp = last; tmp; tmp = tmp->below) |
1166 | for (object *tmp = last; tmp; tmp = tmp->below) |
1158 | { |
1167 | { |
1159 | /* Once we get to a floor, stop, since we already have a floor object */ |
1168 | /* Once we get to a floor, stop, since we already have a floor object */ |
1160 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
1169 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
1161 | break; |
1170 | break; |
1162 | |
1171 | |
… | |
… | |
1565 | } |
1574 | } |
1566 | |
1575 | |
1567 | object * |
1576 | object * |
1568 | maptile::insert (object *op, int x, int y, object *originator, int flags) |
1577 | maptile::insert (object *op, int x, int y, object *originator, int flags) |
1569 | { |
1578 | { |
1570 | if (!op->flag [FLAG_REMOVED]) |
|
|
1571 | op->remove (); |
|
|
1572 | |
|
|
1573 | return insert_ob_in_map_at (op, this, originator, flags, x, y); |
1579 | return insert_ob_in_map_at (op, this, originator, flags, x, y); |
1574 | } |
1580 | } |
1575 | |
1581 | |
1576 | region * |
1582 | region * |
1577 | maptile::region (int x, int y) const |
1583 | maptile::region (int x, int y) const |
… | |
… | |
1587 | |
1593 | |
1588 | return ::region::default_region (); |
1594 | return ::region::default_region (); |
1589 | } |
1595 | } |
1590 | |
1596 | |
1591 | /* picks a random object from a style map. |
1597 | /* picks a random object from a style map. |
1592 | * Redone by MSW so it should be faster and not use static |
|
|
1593 | * variables to generate tables. |
|
|
1594 | */ |
1598 | */ |
1595 | object * |
1599 | object * |
1596 | maptile::pick_random_object () const |
1600 | maptile::pick_random_object (rand_gen &gen) const |
1597 | { |
1601 | { |
1598 | /* while returning a null object will result in a crash, that |
1602 | /* while returning a null object will result in a crash, that |
1599 | * is actually preferable to an infinite loop. That is because |
1603 | * is actually preferable to an infinite loop. That is because |
1600 | * most servers will automatically restart in case of crash. |
1604 | * most servers will automatically restart in case of crash. |
1601 | * Change the logic on getting the random space - shouldn't make |
1605 | * Change the logic on getting the random space - shouldn't make |
1602 | * any difference, but this seems clearer to me. |
1606 | * any difference, but this seems clearer to me. |
1603 | */ |
1607 | */ |
1604 | for (int i = 1000; --i;) |
1608 | for (int i = 1000; --i;) |
1605 | { |
1609 | { |
1606 | object *pick = at (rndm (width), rndm (height)).bot; |
1610 | object *pick = at (gen (width), gen (height)).bot; |
1607 | |
1611 | |
1608 | // do not prefer big monsters just because they are big. |
1612 | // do not prefer big monsters just because they are big. |
1609 | if (pick && pick->head_ () == pick) |
1613 | if (pick && pick->is_head ()) |
1610 | return pick->head_ (); |
1614 | return pick->head_ (); |
1611 | } |
1615 | } |
1612 | |
1616 | |
1613 | // instead of crashing in the unlikely(?) case, try to return *something* |
1617 | // instead of crashing in the unlikely(?) case, try to return *something* |
1614 | return get_archetype ("blocked"); |
1618 | return archetype::find ("bug"); |
1615 | } |
1619 | } |
1616 | |
1620 | |
1617 | void |
1621 | void |
1618 | maptile::play_sound (faceidx sound, int x, int y) const |
1622 | maptile::play_sound (faceidx sound, int x, int y) const |
1619 | { |
1623 | { |