… | |
… | |
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 |
… | |
… | |
1033 | sint8 light = 0; |
1033 | sint8 light = 0; |
1034 | 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; |
1035 | uint64_t volume = 0; |
1035 | uint64_t volume = 0; |
1036 | uint32_t items = 0; |
1036 | uint32_t items = 0; |
1037 | object *anywhere = 0; |
1037 | object *anywhere = 0; |
|
|
1038 | uint8_t middle_visibility = 0; |
1038 | |
1039 | |
1039 | //object *middle = 0; |
1040 | //object *middle = 0; |
1040 | //object *top = 0; |
1041 | //object *top = 0; |
1041 | //object *floor = 0; |
1042 | //object *floor = 0; |
1042 | // this seems to generate better code than using locals, above |
1043 | // this seems to generate better code than using locals, above |
… | |
… | |
1059 | * |
1060 | * |
1060 | * Always put the player down for drawing. |
1061 | * Always put the player down for drawing. |
1061 | */ |
1062 | */ |
1062 | if (expect_true (!tmp->invisible)) |
1063 | if (expect_true (!tmp->invisible)) |
1063 | { |
1064 | { |
1064 | if (tmp->type == PLAYER || tmp->flag [FLAG_MONSTER]) |
1065 | if (expect_false (tmp->type == PLAYER || tmp->flag [FLAG_MONSTER])) |
1065 | 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 | } |
1066 | else |
1078 | else |
1067 | { |
1079 | { |
1068 | if (expect_false (tmp->flag [FLAG_IS_FLOOR])) |
1080 | if (expect_true (!tmp->flag [FLAG_NO_PICK])) |
1069 | { |
1081 | { |
1070 | /* If we got a floor, that means middle and top were below it, |
|
|
1071 | * so should not be visible, so we clear them. |
|
|
1072 | */ |
|
|
1073 | middle = 0; |
|
|
1074 | top = 0; |
|
|
1075 | floor = tmp; |
|
|
1076 | volume = 0; |
|
|
1077 | items = 0; |
1082 | ++items; |
|
|
1083 | volume += tmp->volume (); |
1078 | } |
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 |
1079 | else |
1093 | */ |
|
|
1094 | if (expect_false (::faces [tmp->face].visibility >= middle_visibility)) |
1080 | { |
1095 | { |
1081 | if (expect_true (!tmp->flag [FLAG_NO_PICK])) |
1096 | middle_visibility = ::faces [tmp->face].visibility; |
1082 | { |
|
|
1083 | ++items; |
|
|
1084 | volume += tmp->volume (); |
|
|
1085 | } |
|
|
1086 | |
|
|
1087 | /* Flag anywhere have high priority */ |
|
|
1088 | if (expect_false (tmp->flag [FLAG_SEE_ANYWHERE])) |
|
|
1089 | anywhere = tmp; |
|
|
1090 | /* Find the highest visible face around. If equal |
|
|
1091 | * visibilities, we still want the one nearer to the |
|
|
1092 | * top |
|
|
1093 | */ |
|
|
1094 | else if (!middle || (::faces [tmp->face].visibility > ::faces [middle->face].visibility)) |
|
|
1095 | middle = tmp; |
1097 | middle = tmp; |
1096 | } |
1098 | } |
1097 | } |
1099 | } |
1098 | } |
1100 | } |
1099 | |
1101 | |
1100 | move_slow |= tmp->move_slow; |
1102 | move_slow |= tmp->move_slow; |