1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 14:54:30 +01:00

Label known offsets and flags of wall/fence

This commit is contained in:
duncanspumpkin
2017-02-02 18:52:35 +00:00
parent e1ea820111
commit e384b9a508
9 changed files with 29 additions and 27 deletions

View File

@@ -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;

View File

@@ -33,7 +33,7 @@ void WallObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
_legacyType.wall.flags2 = stream->ReadValue<uint8>();
_legacyType.wall.price = stream->ReadValue<uint16>();
_legacyType.wall.scenery_tab_id = stream->ReadValue<uint8>();
_legacyType.wall.var_0D = stream->ReadValue<uint8>();
_legacyType.wall.scrolling_mode = stream->ReadValue<uint8>();
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);

View File

@@ -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];

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;