Small refactor

This commit is contained in:
duncanspumpkin 2016-06-09 20:10:50 +01:00 committed by Marijn van der Werf
parent 63f42c6d47
commit a36a6c3ef9
6 changed files with 28 additions and 22 deletions

View File

@ -127,7 +127,7 @@ static void cheat_remove_litter()
continue;
sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(it.element));
if(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_BIN)
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN)
it.element->properties.path.addition_status = 0xFF;
} while (map_element_iterator_next(&it));

View File

@ -688,17 +688,17 @@ void sub_6A3F61(rct_map_element * map_element, uint16 bp, uint16 height, rct_foo
// Draw additional path bits (bins, benchs, lamps, queue screens)
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
switch (sceneryEntry->path_bit.var_08) {
case 0:
switch (sceneryEntry->path_bit.draw_type) {
case PATH_BIT_DRAW_TYPE_LIGHTS:
path_bit_lights_paint(sceneryEntry, map_element, height, (uint8)bp, dword_F3EF74);
break;
case 1:
case PATH_BIT_DRAW_TYPE_BINS:
path_bit_bins_paint(sceneryEntry, map_element, height, (uint8)bp, dword_F3EF74);
break;
case 2:
case PATH_BIT_DRAW_TYPE_BENCHES:
path_bit_benches_paint(sceneryEntry, map_element, height, (uint8)bp, dword_F3EF74);
break;
case 3:
case PATH_BIT_DRAW_TYPE_JUMPING_FOUNTAINS:
path_bit_jumping_fountains_paint(sceneryEntry, map_element, height, (uint8)bp, dword_F3EF74, dpi);
break;
}

View File

@ -626,7 +626,7 @@ static void sub_68F41A(rct_peep *peep, int index)
if (footpath_element_has_path_scenery(mapElement) && footpath_element_path_scenery_is_ghost(mapElement)){
uint8 pathSceneryIndex = footpath_element_get_path_scenery_index(mapElement);
rct_scenery_entry *sceneryEntry = get_footpath_item_entry(pathSceneryIndex);
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_QUEUE_MONITOR) {
if (sceneryEntry->path_bit.flags & PAHT_BIT_FLAG_IS_QUEUE_SCREEN){
found = 1;
}
}
@ -4272,7 +4272,7 @@ static void peep_update_emptying_bin(rct_peep* peep){
rct_scenery_entry* scenery_entry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
if (
!(scenery_entry->path_bit.flags & PATH_BIT_FLAG_BIN)
!(scenery_entry->path_bit.flags & PATH_BIT_FLAG_IS_BIN)
|| map_element->flags & (1 << 5)
|| footpath_element_path_scenery_is_ghost(map_element)
) {
@ -4532,7 +4532,7 @@ static int peep_update_walking_find_bench(rct_peep* peep){
if (!footpath_element_has_path_scenery(map_element)) return 0;
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_BENCH))return 0;
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BENCH))return 0;
if (map_element->flags & MAP_ELEMENT_FLAG_BROKEN)return 0;
@ -4607,7 +4607,7 @@ static int peep_update_walking_find_bin(rct_peep* peep){
if (!footpath_element_has_path_scenery(map_element)) return 0;
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_BIN))return 0;
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN))return 0;
if (map_element->flags & MAP_ELEMENT_FLAG_BROKEN)return 0;
@ -4859,7 +4859,7 @@ static void peep_update_using_bin(rct_peep* peep){
}
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_BIN)){
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN)){
peep_state_reset(peep);
return;
}
@ -5256,7 +5256,7 @@ static int peep_update_patrolling_find_bin(rct_peep* peep){
if (!footpath_element_has_path_scenery(map_element)) return 0;
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_BIN))
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN))
return 0;
if (map_element->flags & MAP_ELEMENT_FLAG_BROKEN)
@ -5560,7 +5560,7 @@ static void peep_update_walking(rct_peep* peep){
if (!footpath_element_path_scenery_is_ghost(map_element)) {
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_BENCH)) ebp = 9;
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BENCH)) ebp = 9;
}
}

View File

@ -238,13 +238,12 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement
return MONEY32_UNDEFINED;
}
uint16 jfMask = PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER | PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW;
if (!(unk6 & jfMask) && (mapElement->properties.path.edges & 0x0F) == 0x0F) {
if (!(unk6 & (PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER | PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW)) && (mapElement->properties.path.edges & 0x0F) == 0x0F) {
gGameCommandErrorText = STR_NONE;
return MONEY32_UNDEFINED;
}
if ((unk6 & PATH_BIT_FLAG_QUEUE_MONITOR) && !footpath_element_is_queue(mapElement)) {
if ((unk6 & PAHT_BIT_FLAG_IS_QUEUE_SCREEN) && !footpath_element_is_queue(mapElement)) {
gGameCommandErrorText = STR_CAN_ONLY_PLACE_THESE_ON_QUEUE_AREA;
return MONEY32_UNDEFINED;
}
@ -282,7 +281,7 @@ static money32 footpath_element_update(int x, int y, rct_map_element *mapElement
mapElement->flags &= ~MAP_ELEMENT_FLAG_BROKEN;
if (pathItemType != 0) {
rct_scenery_entry* scenery_entry = get_footpath_item_entry(pathItemType - 1);
if (scenery_entry->path_bit.flags & PATH_BIT_FLAG_BIN) {
if (scenery_entry->path_bit.flags & PATH_BIT_FLAG_IS_BIN) {
mapElement->properties.path.addition_status = 255;
}
}

View File

@ -36,7 +36,7 @@ typedef struct rct_footpath_entry {
uint8 flags; // 0x0B
uint8 scrolling_mode; // 0x0C
} rct_footpath_entry;
assert_struct_size(rct_footpath_entry, 12);
assert_struct_size(rct_footpath_entry, 13);
#pragma pack(pop)
enum {

View File

@ -136,7 +136,7 @@ typedef enum {
typedef struct rct_path_bit_scenery_entry {
uint16 flags; // 0x06
uint8 pad_08;
uint8 draw_type; // 0x08
uint8 tool_id; // 0x09
sint16 price; // 0x0A
uint8 scenery_tab_id; // 0x0C
@ -180,15 +180,22 @@ assert_struct_size(rct_scenery_set_entry, 14 + 2 * 0x80);
#pragma pack(pop)
enum {
PATH_BIT_FLAG_BIN = 1 << 0,
PATH_BIT_FLAG_BENCH = 1 << 1,
PATH_BIT_FLAG_IS_BIN = 1 << 0,
PATH_BIT_FLAG_IS_BENCH = 1 << 1,
PATH_BIT_FLAG_BREAKABLE = 1 << 2,
PATH_BIT_FLAG_LAMP = 1 << 3,
PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER = 1 << 4,
PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW = 1 << 5,
PATH_BIT_FLAG_DONT_ALLOW_ON_QUEUE = 1 << 6,
PATH_BIT_FLAG_DONT_ALLOW_ON_SLOPE = 1 << 7,
PATH_BIT_FLAG_QUEUE_MONITOR = 1 << 8,
PAHT_BIT_FLAG_IS_QUEUE_SCREEN = 1 << 8
};
enum {
PATH_BIT_DRAW_TYPE_LIGHTS,
PATH_BIT_DRAW_TYPE_BINS,
PATH_BIT_DRAW_TYPE_BENCHES,
PATH_BIT_DRAW_TYPE_JUMPING_FOUNTAINS
};
enum {