… | |
… | |
218 | |
218 | |
219 | return 0; |
219 | return 0; |
220 | } |
220 | } |
221 | |
221 | |
222 | /* When the map is loaded, load_object does not actually insert objects |
222 | /* When the map is loaded, load_object does not actually insert objects |
223 | * into inventory, but just links them. What this does is go through |
223 | * into inventory, but just links them. What this does is go through |
224 | * and insert them properly. |
224 | * and insert them properly. |
225 | * The object 'container' is the object that contains the inventory. |
225 | * The object 'container' is the object that contains the inventory. |
226 | * This is needed so that we can update the containers weight. |
226 | * This is needed so that we can update the containers weight. |
227 | */ |
227 | */ |
228 | static void |
228 | static void |
… | |
… | |
448 | * map archetype. Mimic that behaviour. |
448 | * map archetype. Mimic that behaviour. |
449 | */ |
449 | */ |
450 | width = 16; |
450 | width = 16; |
451 | height = 16; |
451 | height = 16; |
452 | timeout = 300; |
452 | timeout = 300; |
453 | max_nrof = 1000; // 1000 items of anything |
453 | max_items = MAX_ITEM_PER_ACTION; |
454 | max_items = 25; |
|
|
455 | max_volume = 2000000; // 2m³ |
454 | max_volume = 2000000; // 2m³ |
456 | } |
455 | } |
457 | |
456 | |
458 | maptile::maptile (int w, int h) |
457 | maptile::maptile (int w, int h) |
459 | { |
458 | { |
… | |
… | |
1032 | object *last = 0; |
1031 | object *last = 0; |
1033 | uint8 flags = P_UPTODATE; |
1032 | uint8 flags = P_UPTODATE; |
1034 | sint8 light = 0; |
1033 | sint8 light = 0; |
1035 | MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; |
1034 | MoveType move_block = 0, move_slow = 0, move_on = 0, move_off = 0, move_allow = 0; |
1036 | uint64_t volume = 0; |
1035 | uint64_t volume = 0; |
1037 | uint32_t nrof = 0; |
1036 | uint32_t items = 0; |
1038 | object *anywhere = 0; |
1037 | object *anywhere = 0; |
|
|
1038 | uint8_t middle_visibility = 0; |
1039 | |
1039 | |
1040 | //object *middle = 0; |
1040 | //object *middle = 0; |
1041 | //object *top = 0; |
1041 | //object *top = 0; |
1042 | //object *floor = 0; |
1042 | //object *floor = 0; |
1043 | // this seems to generate better code than using locals, above |
1043 | // this seems to generate better code than using locals, above |
… | |
… | |
1060 | * |
1060 | * |
1061 | * Always put the player down for drawing. |
1061 | * Always put the player down for drawing. |
1062 | */ |
1062 | */ |
1063 | if (expect_true (!tmp->invisible)) |
1063 | if (expect_true (!tmp->invisible)) |
1064 | { |
1064 | { |
1065 | if (tmp->type == PLAYER || tmp->flag [FLAG_MONSTER]) |
1065 | if (expect_false (tmp->type == PLAYER || tmp->flag [FLAG_MONSTER])) |
1066 | top = tmp; |
1066 | top = tmp; |
|
|
1067 | else if (expect_false (tmp->flag [FLAG_IS_FLOOR])) |
|
|
1068 | { |
|
|
1069 | /* If we got a floor, that means middle and top were below it, |
|
|
1070 | * so should not be visible, so we clear them. |
|
|
1071 | */ |
|
|
1072 | middle = 0; |
|
|
1073 | top = 0; |
|
|
1074 | floor = tmp; |
|
|
1075 | volume = 0; |
|
|
1076 | items = 0; |
|
|
1077 | } |
1067 | else |
1078 | else |
1068 | { |
1079 | { |
1069 | if (expect_false (tmp->flag [FLAG_IS_FLOOR])) |
1080 | if (expect_true (!tmp->flag [FLAG_NO_PICK])) |
1070 | { |
1081 | { |
1071 | /* If we got a floor, that means middle and top were below it, |
|
|
1072 | * so should not be visible, so we clear them. |
|
|
1073 | */ |
1082 | ++items; |
1074 | middle = 0; |
|
|
1075 | top = 0; |
|
|
1076 | floor = tmp; |
|
|
1077 | volume = 0; |
1083 | volume += tmp->volume (); |
1078 | nrof = 0; |
|
|
1079 | } |
1084 | } |
|
|
1085 | |
|
|
1086 | /* Flag anywhere have high priority */ |
|
|
1087 | if (expect_false (tmp->flag [FLAG_SEE_ANYWHERE])) |
|
|
1088 | anywhere = tmp; |
|
|
1089 | |
|
|
1090 | /* Find the highest visible face around. If equal |
|
|
1091 | * visibilities, we still want the one nearer to the |
|
|
1092 | * top |
1080 | else |
1093 | */ |
|
|
1094 | if (expect_false (::faces [tmp->face].visibility >= middle_visibility)) |
1081 | { |
1095 | { |
1082 | if (expect_true (!tmp->flag [FLAG_NO_PICK])) |
1096 | middle_visibility = ::faces [tmp->face].visibility; |
1083 | { |
|
|
1084 | ++nrof; |
|
|
1085 | volume += tmp->volume (); |
|
|
1086 | } |
|
|
1087 | |
|
|
1088 | /* Flag anywhere have high priority */ |
|
|
1089 | if (expect_false (tmp->flag [FLAG_SEE_ANYWHERE])) |
|
|
1090 | anywhere = tmp; |
|
|
1091 | /* Find the highest visible face around. If equal |
|
|
1092 | * visibilities, we still want the one nearer to the |
|
|
1093 | * top |
|
|
1094 | */ |
|
|
1095 | else if (!middle || (::faces [tmp->face].visibility > ::faces [middle->face].visibility)) |
|
|
1096 | middle = tmp; |
1097 | middle = tmp; |
1097 | } |
1098 | } |
1098 | } |
1099 | } |
1099 | } |
1100 | } |
1100 | |
1101 | |
1101 | move_slow |= tmp->move_slow; |
1102 | move_slow |= tmp->move_slow; |
… | |
… | |
1124 | this->flags_ = flags; |
1125 | this->flags_ = flags; |
1125 | this->move_block = move_block & ~move_allow; |
1126 | this->move_block = move_block & ~move_allow; |
1126 | this->move_on = move_on; |
1127 | this->move_on = move_on; |
1127 | this->move_off = move_off; |
1128 | this->move_off = move_off; |
1128 | this->move_slow = move_slow; |
1129 | this->move_slow = move_slow; |
1129 | this->volume_ = volume / 1024; |
1130 | this->volume_ = (volume + 1023) / 1024; |
1130 | this->nrof_ = upos_min (nrof, 65535); // assume nrof <= 2**31 |
1131 | this->items_ = upos_min (items, 65535); // assume nrof <= 2**31 |
1131 | |
1132 | |
1132 | /* At this point, we have a floor face (if there is a floor), |
1133 | /* At this point, we have a floor face (if there is a floor), |
1133 | * and the floor is set - we are not going to touch it at |
1134 | * and the floor is set - we are not going to touch it at |
1134 | * this point. |
1135 | * this point. |
1135 | * middle contains the highest visibility face. |
1136 | * middle contains the highest visibility face. |