1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

Move wall colour functions over to the struct methods

This commit is contained in:
Michael Steenbeek
2018-09-17 14:22:17 +02:00
parent 533e937926
commit dcabdeb805
7 changed files with 21 additions and 66 deletions

View File

@@ -423,8 +423,8 @@ rct_window* window_sign_small_open(rct_windownumber number)
int32_t view_z = tile_element->base_height << 3;
w->frame_no = view_z;
w->list_information_type = wall_get_primary_colour(tile_element);
w->var_492 = wall_get_secondary_colour(tile_element);
w->list_information_type = tile_element->AsWall()->GetPrimaryColour();
w->var_492 = tile_element->AsWall()->GetSecondaryColour();
w->var_48C = tile_element->properties.wall.type;
view_x += 16;

View File

@@ -1087,9 +1087,9 @@ static void scenery_eyedropper_tool_down(int16_t x, int16_t y, rct_widgetindex w
int32_t sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_WALLS, entryIndex);
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId))
{
gWindowSceneryPrimaryColour = wall_get_primary_colour(tileElement);
gWindowScenerySecondaryColour = wall_get_secondary_colour(tileElement);
gWindowSceneryTertiaryColour = wall_get_tertiary_colour(tileElement);
gWindowSceneryPrimaryColour = tileElement->AsWall()->GetPrimaryColour();
gWindowScenerySecondaryColour = tileElement->AsWall()->GetSecondaryColour();
gWindowSceneryTertiaryColour = tileElement->AsWall()->GetTertiaryColour();
gWindowSceneryEyedropperEnabled = false;
}
}

View File

@@ -170,20 +170,20 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
frameNum = (gCurrentTicks & 7) * 2;
}
int32_t primaryColour = wall_get_primary_colour(tile_element);
int32_t primaryColour = tile_element->AsWall()->GetPrimaryColour();
uint32_t imageColourFlags = primaryColour << 19 | IMAGE_TYPE_REMAP;
uint32_t dword_141F718 = imageColourFlags + 0x23800006;
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR)
{
uint8_t secondaryColour = wall_get_secondary_colour(tile_element);
uint8_t secondaryColour = tile_element->AsWall()->GetSecondaryColour();
imageColourFlags |= secondaryColour << 24 | IMAGE_TYPE_REMAP_2_PLUS;
}
uint32_t tertiaryColour = 0;
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
{
tertiaryColour = wall_get_tertiary_colour(tile_element);
tertiaryColour = tile_element->AsWall()->GetTertiaryColour();
imageColourFlags &= 0x0DFFFFFFF;
}
@@ -413,7 +413,7 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
set_format_arg(0, uint32_t, 0);
set_format_arg(4, uint32_t, 0);
uint8_t secondaryColour = wall_get_secondary_colour(tile_element);
uint8_t secondaryColour = tile_element->AsWall()->GetSecondaryColour();
if (dword_141F710 != 0)
{

View File

@@ -359,10 +359,10 @@ static void track_design_save_add_wall(int32_t x, int32_t y, rct_tile_element* t
uint8_t flags = 0;
flags |= tileElement->type & 3;
flags |= wall_get_tertiary_colour(tileElement) << 2;
flags |= tileElement->AsWall()->GetTertiaryColour() << 2;
uint8_t secondaryColour = wall_get_secondary_colour(tileElement);
uint8_t primaryColour = wall_get_primary_colour(tileElement);
uint8_t secondaryColour = tileElement->AsWall()->GetSecondaryColour();
uint8_t primaryColour = tileElement->AsWall()->GetPrimaryColour();
track_design_save_push_tile_element(x, y, tileElement);
track_design_save_push_tile_element_desc(entry, x, y, tileElement->base_height, flags, primaryColour, secondaryColour);
@@ -547,7 +547,7 @@ static void track_design_save_remove_wall(int32_t x, int32_t y, rct_tile_element
uint8_t flags = 0;
flags |= tileElement->type & 3;
flags |= wall_get_tertiary_colour(tileElement) << 2;
flags |= tileElement->AsWall()->GetTertiaryColour() << 2;
track_design_save_pop_tile_element(x, y, tileElement);
track_design_save_pop_tile_element_desc(entry, x, y, tileElement->base_height, flags);

View File

@@ -4408,8 +4408,8 @@ void game_command_set_sign_style(
*ebx = 0;
return;
}
wall_set_primary_colour(tileElement, mainColour);
wall_set_secondary_colour(tileElement, textColour);
tileElement->AsWall()->SetPrimaryColour(mainColour);
tileElement->AsWall()->SetSecondaryColour(textColour);
map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
}

View File

@@ -515,8 +515,8 @@ static money32 WallPlace(
tileElement->type = edgeSlope | edge | TILE_ELEMENT_TYPE_WALL;
wall_set_primary_colour(tileElement, primaryColour);
wall_set_secondary_colour(tileElement, secondaryColour);
tileElement->AsWall()->SetPrimaryColour(primaryColour);
tileElement->AsWall()->SetSecondaryColour(secondaryColour);
if (wallAcrossTrack)
{
@@ -531,7 +531,7 @@ static money32 WallPlace(
if (wallEntry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
{
wall_set_tertiary_colour(tileElement, tertiaryColour);
tileElement->AsWall()->SetTertiaryColour(tertiaryColour);
}
if (flags & GAME_COMMAND_FLAG_GHOST)
@@ -583,12 +583,12 @@ static money32 WallSetColour(
if (flags & GAME_COMMAND_FLAG_APPLY)
{
rct_scenery_entry* scenery_entry = get_wall_entry(wallElement->properties.wall.type);
wall_set_primary_colour(wallElement, primaryColour);
wall_set_secondary_colour(wallElement, secondaryColour);
wallElement->AsWall()->SetPrimaryColour(primaryColour);
wallElement->AsWall()->SetSecondaryColour(secondaryColour);
if (scenery_entry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
{
wall_set_tertiary_colour(wallElement, tertiaryColour);
wallElement->AsWall()->SetTertiaryColour(tertiaryColour);
}
map_invalidate_tile_zoom1(x, y, z, z + 72);
}
@@ -607,45 +607,6 @@ void wall_set_animation_frame(rct_tile_element* wallElement, uint8_t frameNum)
wallElement->properties.wall.animation |= (frameNum & 0xF) << 3;
}
colour_t wall_get_primary_colour(const rct_tile_element* tileElement)
{
return tileElement->properties.wall.colour_1 & TILE_ELEMENT_COLOUR_MASK;
}
colour_t wall_get_secondary_colour(const rct_tile_element* wallElement)
{
uint8_t secondaryColour = (wallElement->properties.wall.colour_1 & ~TILE_ELEMENT_COLOUR_MASK) >> 5;
secondaryColour |= (wallElement->flags & 0x60) >> 2;
return secondaryColour;
}
colour_t wall_get_tertiary_colour(const rct_tile_element* tileElement)
{
return tileElement->properties.wall.colour_3 & TILE_ELEMENT_COLOUR_MASK;
}
void wall_set_primary_colour(rct_tile_element* tileElement, colour_t colour)
{
assert(colour <= 31);
tileElement->properties.wall.colour_1 &= ~TILE_ELEMENT_COLOUR_MASK;
tileElement->properties.wall.colour_1 |= colour;
}
void wall_set_secondary_colour(rct_tile_element* wallElement, colour_t secondaryColour)
{
wallElement->properties.wall.colour_1 &= TILE_ELEMENT_COLOUR_MASK;
wallElement->properties.wall.colour_1 |= (secondaryColour & 0x7) << 5;
wallElement->flags &= ~0x60;
wallElement->flags |= (secondaryColour & 0x18) << 2;
}
void wall_set_tertiary_colour(rct_tile_element* tileElement, colour_t colour)
{
assert(colour <= 31);
tileElement->properties.wall.colour_3 &= ~TILE_ELEMENT_COLOUR_MASK;
tileElement->properties.wall.colour_3 |= colour;
}
/**
*
* rct2: 0x006E588E

View File

@@ -20,12 +20,6 @@ enum
WALL_ANIMATION_FLAG_ALL_FLAGS = WALL_ANIMATION_FLAG_ACROSS_TRACK | WALL_ANIMATION_FLAG_DIRECTION_BACKWARD
};
colour_t wall_get_primary_colour(const rct_tile_element* tileElement);
colour_t wall_get_secondary_colour(const rct_tile_element* wallElement);
colour_t wall_get_tertiary_colour(const rct_tile_element* tileElement);
void wall_set_primary_colour(rct_tile_element* tileElement, colour_t colour);
void wall_set_secondary_colour(rct_tile_element* wallElement, colour_t secondaryColour);
void wall_set_tertiary_colour(rct_tile_element* tileElement, colour_t colour);
uint8_t wall_get_animation_frame(const rct_tile_element* fenceElement);
void wall_set_animation_frame(rct_tile_element* wallElement, uint8_t frameNum);