From e384b9a508ec1f2ebe4c13d52520a8813c8c62d4 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Thu, 2 Feb 2017 18:52:35 +0000 Subject: [PATCH] Label known offsets and flags of wall/fence --- src/openrct2/interface/viewport_interaction.c | 4 ++-- src/openrct2/object/WallObject.cpp | 4 ++-- src/openrct2/paint/map_element/fence.c | 14 +++++++------- src/openrct2/windows/scenery.c | 6 +++--- src/openrct2/windows/sign.c | 6 +++--- src/openrct2/windows/top_toolbar.c | 4 ++-- src/openrct2/world/map.c | 8 ++++---- src/openrct2/world/map_animation.c | 2 +- src/openrct2/world/scenery.h | 8 +++++--- 9 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/openrct2/interface/viewport_interaction.c b/src/openrct2/interface/viewport_interaction.c index a271c06684..b1638c3c7a 100644 --- a/src/openrct2/interface/viewport_interaction.c +++ b/src/openrct2/interface/viewport_interaction.c @@ -256,7 +256,7 @@ sint32 viewport_interaction_get_item_right(sint32 x, sint32 y, viewport_interact case VIEWPORT_INTERACTION_ITEM_WALL: sceneryEntry = get_wall_entry(mapElement->properties.scenery.type); - if (sceneryEntry->wall.var_0D != 255) { + if (sceneryEntry->wall.scrolling_mode != 255) { set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY); set_map_tooltip_format_arg(2, rct_string_id, sceneryEntry->name); return info->type; @@ -491,7 +491,7 @@ void viewport_interaction_remove_park_entrance(rct_map_element *mapElement, sint static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, sint32 x, sint32 y) { rct_scenery_entry *sceneryEntry = get_wall_entry(mapElement->properties.fence.type); - if (sceneryEntry->wall.var_0D != 0xFF){ + if (sceneryEntry->wall.scrolling_mode != 0xFF){ window_sign_small_open(mapElement->properties.fence.item[0]); } else { gGameCommandErrorTitle = STR_CANT_REMOVE_THIS; diff --git a/src/openrct2/object/WallObject.cpp b/src/openrct2/object/WallObject.cpp index 7a8194dc5e..f204655b2b 100644 --- a/src/openrct2/object/WallObject.cpp +++ b/src/openrct2/object/WallObject.cpp @@ -33,7 +33,7 @@ void WallObject::ReadLegacy(IReadObjectContext * context, IStream * stream) _legacyType.wall.flags2 = stream->ReadValue(); _legacyType.wall.price = stream->ReadValue(); _legacyType.wall.scenery_tab_id = stream->ReadValue(); - _legacyType.wall.var_0D = stream->ReadValue(); + _legacyType.wall.scrolling_mode = stream->ReadValue(); GetStringTable()->Read(context, stream, OBJ_STRING_ID_NAME); @@ -81,7 +81,7 @@ void WallObject::DrawPreview(rct_drawpixelinfo * dpi, sint32 width, sint32 heigh gfx_draw_sprite(dpi, imageId, x, y, 0); - if (_legacyType.wall.flags & WALL_SCENERY_FLAG2) + if (_legacyType.wall.flags & WALL_SCENERY_HAS_GLASS) { imageId = _legacyType.image + 0x44500006; gfx_draw_sprite(dpi, imageId, x, y, 0); diff --git a/src/openrct2/paint/map_element/fence.c b/src/openrct2/paint/map_element/fence.c index 8d59bab397..e7f8a1dc1d 100644 --- a/src/openrct2/paint/map_element/fence.c +++ b/src/openrct2/paint/map_element/fence.c @@ -54,7 +54,7 @@ static void fence_paint_door(uint32 imageId, rct_xyz16 boundsR2, rct_xyz16 boundsR2_, rct_xyz16 boundsL1, rct_xyz16 boundsL1_) { - if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG1) { + if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_PRIMARY_COLOUR) { imageId |= imageColourFlags; } @@ -95,8 +95,8 @@ static void fence_paint_wall(uint32 frameNum, const rct_scenery_entry * sceneryE uint32 imageId = baseImageId; - if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG2) { - if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG1) { + if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_GLASS) { + if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_PRIMARY_COLOUR) { imageId |= imageColourFlags; } @@ -110,7 +110,7 @@ static void fence_paint_wall(uint32 frameNum, const rct_scenery_entry * sceneryE sub_98199C(imageId, (sint8)offset.x, (sint8)offset.y, bounds.x, bounds.y, (sint8)bounds.z, offset.z, boundsOffset.x, boundsOffset.y, boundsOffset.z, get_current_rotation()); } } else { - if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG1) { + if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_PRIMARY_COLOUR) { imageId |= imageColourFlags; } @@ -281,7 +281,7 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element) imageOffset = 0; } - if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG2) { + if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_GLASS) { if (sceneryEntry->wall.flags & WALL_SCENERY_IS_BANNER) { imageOffset += 12; } @@ -332,7 +332,7 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element) fence_paint_wall(frameNum, sceneryEntry, dword_141F710, imageColourFlags, dword_141F718, tertiaryColour, imageOffset, offset, bounds, boundsOffset); - if (sceneryEntry->wall.var_0D == 0xFF) { + if (sceneryEntry->wall.scrolling_mode == 0xFF) { return; } @@ -355,7 +355,7 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element) set_format_arg(7, uint8, al_2); - uint16 scrollingMode = sceneryEntry->wall.var_0D + ((direction + 1) & 0x3); + uint16 scrollingMode = sceneryEntry->wall.scrolling_mode + ((direction + 1) & 0x3); uint8 bannerIndex = map_element->properties.fence.item[0]; rct_banner * banner = &gBanners[bannerIndex]; diff --git a/src/openrct2/windows/scenery.c b/src/openrct2/windows/scenery.c index c12bea6f27..52596a31af 100644 --- a/src/openrct2/windows/scenery.c +++ b/src/openrct2/windows/scenery.c @@ -969,13 +969,13 @@ void window_scenery_invalidate(rct_window *w) window_scenery_widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WWT_COLOURBTN; } else if (tabSelectedSceneryId >= 0x200) { sceneryEntry = get_wall_entry(tabSelectedSceneryId - 0x200); - if (sceneryEntry->wall.flags & (WALL_SCENERY_FLAG1 | WALL_SCENERY_FLAG2)) { + if (sceneryEntry->wall.flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS)) { window_scenery_widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WWT_COLOURBTN; if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) { window_scenery_widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WWT_COLOURBTN; - if (sceneryEntry->wall.flags2 & WALL_SCENERY_FLAG1) + if (sceneryEntry->wall.flags2 & WALL_SCENERY_2_NO_SELECT_PRIMARY_COLOUR) window_scenery_widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WWT_EMPTY; if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR) window_scenery_widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WWT_COLOURBTN; @@ -1142,7 +1142,7 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32 sc uint8 tertiaryColour = w->colours[1]; uint16 spriteTop = (sceneryEntry->wall.height * 2) + 0x32; - if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG2) { + if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_GLASS) { imageId |= (gWindowSceneryPrimaryColour << 19) | 0x20000000; if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) { diff --git a/src/openrct2/windows/sign.c b/src/openrct2/windows/sign.c index bf18535a6c..344a7290d0 100644 --- a/src/openrct2/windows/sign.c +++ b/src/openrct2/windows/sign.c @@ -436,7 +436,7 @@ void window_sign_small_open(rct_windownumber number){ while (1){ if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_FENCE) { rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.fence.type); - if (scenery_entry->wall.var_0D != 0xFF){ + if (scenery_entry->wall.scrolling_mode != 0xFF){ if (map_element->properties.fence.item[0] == w->number) break; } @@ -498,7 +498,7 @@ static void window_sign_small_mouseup(rct_window *w, sint32 widgetIndex) while (1){ if (map_element_get_type(map_element) == MAP_ELEMENT_TYPE_FENCE) { rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.fence.type); - if (scenery_entry->wall.var_0D != 0xFF){ + if (scenery_entry->wall.scrolling_mode != 0xFF){ if (map_element->properties.fence.item[0] == w->number) break; } @@ -570,7 +570,7 @@ static void window_sign_small_invalidate(rct_window *w) main_colour_btn->type = WWT_EMPTY; text_colour_btn->type = WWT_EMPTY; - if (scenery_entry->wall.flags & WALL_SCENERY_FLAG1) { + if (scenery_entry->wall.flags & WALL_SCENERY_HAS_PRIMARY_COLOUR) { main_colour_btn->type = WWT_COLOURBTN; } if (scenery_entry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) { diff --git a/src/openrct2/windows/top_toolbar.c b/src/openrct2/windows/top_toolbar.c index 3feb68b2e2..d17df37c8a 100644 --- a/src/openrct2/windows/top_toolbar.c +++ b/src/openrct2/windows/top_toolbar.c @@ -940,8 +940,8 @@ static void repaint_scenery_tool_down(sint16 x, sint16 y, sint16 widgetIndex){ // If can't repaint if (!(scenery_entry->wall.flags & - (WALL_SCENERY_FLAG1 | - WALL_SCENERY_FLAG2))) + (WALL_SCENERY_HAS_PRIMARY_COLOUR | + WALL_SCENERY_HAS_GLASS))) return; gGameCommandErrorTitle = STR_CANT_REPAINT_THIS; diff --git a/src/openrct2/world/map.c b/src/openrct2/world/map.c index fb8add3792..6e7fedacb8 100644 --- a/src/openrct2/world/map.c +++ b/src/openrct2/world/map.c @@ -3617,8 +3617,8 @@ void game_command_place_fence(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx *ebx = MONEY32_UNDEFINED; return; } - if (fence->wall.var_0D != 0xFF){ - banner_index = create_new_banner(fence->wall.var_0D); + if (fence->wall.scrolling_mode != 0xFF){ + banner_index = create_new_banner(flags); if (banner_index == 0xFF){ *ebx = MONEY32_UNDEFINED; @@ -4581,7 +4581,7 @@ sint32 map_element_get_banner_index(rct_map_element *mapElement) ((mapElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5); case MAP_ELEMENT_TYPE_FENCE: sceneryEntry = get_wall_entry(mapElement->properties.fence.type); - if (sceneryEntry->wall.var_0D == 0xFF) + if (sceneryEntry->wall.scrolling_mode == 0xFF) return -1; return mapElement->properties.fence.item[0]; @@ -5539,7 +5539,7 @@ void game_command_set_sign_style(sint32* eax, sint32* ebx, sint32* ecx, sint32* continue; rct_scenery_entry* scenery_entry = get_wall_entry(map_element->properties.fence.type); - if (scenery_entry->wall.var_0D == 0xFF) + if (scenery_entry->wall.scrolling_mode == 0xFF) continue; if (map_element->properties.fence.item[0] != bannerId) continue; diff --git a/src/openrct2/world/map_animation.c b/src/openrct2/world/map_animation.c index 14653e3c67..87511bf20a 100644 --- a/src/openrct2/world/map_animation.c +++ b/src/openrct2/world/map_animation.c @@ -520,7 +520,7 @@ static bool map_animation_invalidate_wall(sint32 x, sint32 y, sint32 baseZ) continue; sceneryEntry = get_wall_entry(mapElement->properties.scenery.type); - if (!(sceneryEntry->wall.flags2 & (1 << 4)) && sceneryEntry->wall.var_0D == 255) + if (!(sceneryEntry->wall.flags2 & WALL_SCENERY_2_FLAG5) && sceneryEntry->wall.scrolling_mode == 255) continue; sint32 z = mapElement->base_height * 8; diff --git a/src/openrct2/world/scenery.h b/src/openrct2/world/scenery.h index c959503b78..7af2ea8238 100644 --- a/src/openrct2/world/scenery.h +++ b/src/openrct2/world/scenery.h @@ -117,13 +117,13 @@ typedef struct rct_wall_scenery_entry { uint8 flags2; // 0x09 sint16 price; // 0x0A uint8 scenery_tab_id; // 0x0C - uint8 var_0D; + uint8 scrolling_mode; // 0x0D 0xFF if no scrolling } rct_wall_scenery_entry; assert_struct_size(rct_wall_scenery_entry, 8); typedef enum { - WALL_SCENERY_FLAG1 = (1 << 0), // 0x1 - WALL_SCENERY_FLAG2 = (1 << 1), // 0x2 + WALL_SCENERY_HAS_PRIMARY_COLOUR = (1 << 0), // 0x1 + WALL_SCENERY_HAS_GLASS = (1 << 1), // 0x2 WALL_SCENERY_CANT_BUILD_ON_SLOPE = (1 << 2), // 0x4 WALL_SCENERY_IS_BANNER = (1 << 3), // 0x8 // Probably indicates translucency WALL_SCENERY_IS_DOOR = (1 << 4), // 0x10 @@ -133,6 +133,8 @@ typedef enum { } WALL_SCENERY_FLAGS; typedef enum { + WALL_SCENERY_2_NO_SELECT_PRIMARY_COLOUR = (1 << 0), // 0x1 + // Flags 2 and 3 are the door sound type WALL_SCENERY_2_FLAG4 = (1 << 3), // 0x8 WALL_SCENERY_2_FLAG5 = (1 << 4), // 0x10 } WALL_SCENERY_2_FLAGS;