Replace direct access to large scenery colour with helper functions

This commit is contained in:
Michael Steenbeek 2017-11-17 17:15:55 +01:00
parent 8ffe7d5b43
commit bb483b0c5f
14 changed files with 133 additions and 108 deletions

View File

@ -161,13 +161,15 @@ rct_window * window_sign_open(rct_windownumber number)
rct_tile_element* tile_element = map_get_first_element_at(view_x / 32, view_y / 32);
while (1){
if (tile_element_get_type(tile_element) == TILE_ELEMENT_TYPE_SCENERY_MULTIPLE) {
while (1)
{
if (tile_element_get_type(tile_element) == TILE_ELEMENT_TYPE_SCENERY_MULTIPLE)
{
rct_scenery_entry* scenery_entry = get_large_scenery_entry(scenery_large_get_type(tile_element));
if (scenery_entry->large_scenery.scrolling_mode != 0xFF){
sint32 id = (tile_element->type & 0xC0) |
((tile_element->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
((tile_element->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
if (scenery_entry->large_scenery.scrolling_mode != 0xFF)
{
sint32 id = scenery_large_get_banner_id(tile_element);
if (id == w->number)
break;
}
@ -226,8 +228,10 @@ static void window_sign_mouseup(rct_window *w, rct_widgetindex widgetIndex)
window_close(w);
break;
case WIDX_SIGN_DEMOLISH:
while (1){
if (tile_element_get_type(tile_element) == TILE_ELEMENT_TYPE_SCENERY_MULTIPLE) {
while (1)
{
if (tile_element_get_type(tile_element) == TILE_ELEMENT_TYPE_SCENERY_MULTIPLE)
{
rct_scenery_entry* scenery_entry = get_large_scenery_entry(scenery_large_get_type(tile_element));
if (scenery_entry->large_scenery.scrolling_mode != 0xFF)
{
@ -441,8 +445,8 @@ rct_window * window_sign_small_open(rct_windownumber number){
sint32 view_z = tile_element->base_height << 3;
w->frame_no = view_z;
w->list_information_type = tile_element->properties.wall.colour_1 & 0x1F;
w->var_492 = wall_element_get_secondary_colour(tile_element);
w->list_information_type = wall_get_primary_colour(tile_element);
w->var_492 = wall_get_secondary_colour(tile_element);
w->var_48C = tile_element->properties.wall.type;
view_x += 16;

View File

@ -1050,12 +1050,14 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex wid
{
sint32 entryIndex = tileElement->properties.scenery.type;
rct_scenery_entry * sceneryEntry = get_small_scenery_entry(entryIndex);
if (sceneryEntry != nullptr) {
if (sceneryEntry != nullptr)
{
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_SMALL_SCENERY, entryIndex);
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) {
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId))
{
gWindowSceneryRotation = (get_current_rotation() + tile_element_get_direction(tileElement)) & 3;
gWindowSceneryPrimaryColour = tileElement->properties.scenery.colour_1 & 0x1F;
gWindowScenerySecondaryColour = tileElement->properties.scenery.colour_2 & 0x1F;
gWindowSceneryPrimaryColour = scenery_small_get_primary_colour(tileElement);
gWindowScenerySecondaryColour = scenery_small_get_secondary_colour(tileElement);
gWindowSceneryEyedropperEnabled = false;
}
}
@ -1065,12 +1067,14 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex wid
{
sint32 entryIndex = tileElement->properties.wall.type;
rct_scenery_entry * sceneryEntry = get_wall_entry(entryIndex);
if (sceneryEntry != nullptr) {
if (sceneryEntry != nullptr)
{
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_WALLS, entryIndex);
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) {
gWindowSceneryPrimaryColour = tileElement->properties.wall.colour_1 & 0x1F;
gWindowScenerySecondaryColour = wall_element_get_secondary_colour(tileElement);
gWindowSceneryTertiaryColour = tileElement->properties.wall.colour_3 & 0x1F;
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);
gWindowSceneryEyedropperEnabled = false;
}
}
@ -1080,12 +1084,14 @@ static void scenery_eyedropper_tool_down(sint16 x, sint16 y, rct_widgetindex wid
{
sint32 entryIndex = scenery_large_get_type(tileElement);
rct_scenery_entry * sceneryEntry = get_large_scenery_entry(entryIndex);
if (sceneryEntry != nullptr) {
if (sceneryEntry != nullptr)
{
sint32 sceneryId = get_scenery_id_from_entry_index(OBJECT_TYPE_LARGE_SCENERY, entryIndex);
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId)) {
if (sceneryId != -1 && window_scenery_set_selected_item(sceneryId))
{
gWindowSceneryRotation = (get_current_rotation() + tile_element_get_direction(tileElement)) & 3;
gWindowSceneryPrimaryColour = tileElement->properties.scenerymultiple.colour[0] & 0x1F;
gWindowScenerySecondaryColour = tileElement->properties.scenerymultiple.colour[1] & 0x1F;
gWindowSceneryPrimaryColour = scenery_large_get_primary_colour(tileElement);
gWindowScenerySecondaryColour = scenery_large_get_secondary_colour(tileElement);
gWindowSceneryEyedropperEnabled = false;
}
}

View File

@ -126,9 +126,9 @@ enum {
COLOUR_FLAG_8 = (1 << 8)
};
#define TRANSLUCENT(x) ((x) | COLOUR_FLAG_TRANSLUCENT)
#define NOT_TRANSLUCENT(x) ((x) & ~COLOUR_FLAG_TRANSLUCENT)
#define BASE_COLOUR(x) ((x) & 0x1F)
#define TRANSLUCENT(x) ((x) | COLOUR_FLAG_TRANSLUCENT)
#define NOT_TRANSLUCENT(x) ((x) & ~COLOUR_FLAG_TRANSLUCENT)
#define BASE_COLOUR(x) ((x) & 0x1F)
typedef struct rct_colour_map
{

View File

@ -533,10 +533,9 @@ static void viewport_interaction_remove_large_scenery(rct_tile_element *tileElem
{
rct_scenery_entry *sceneryEntry = get_large_scenery_entry(scenery_large_get_type(tileElement));
if (sceneryEntry->large_scenery.scrolling_mode != 0xFF){
sint32 id = (tileElement->type & 0xC0) |
((tileElement->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
((tileElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
if (sceneryEntry->large_scenery.scrolling_mode != 0xFF)
{
sint32 id = scenery_large_get_banner_id(tileElement);
context_open_detail_window(WD_SIGN, id);
} else {
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;

View File

@ -146,12 +146,12 @@ void fence_paint(paint_session * session, uint8 direction, sint32 height, rct_ti
}
sint32 primaryColour = tile_element->properties.wall.colour_1 & 0x1F;
sint32 primaryColour = wall_get_primary_colour(tile_element);
uint32 imageColourFlags = primaryColour << 19 | IMAGE_TYPE_REMAP;
uint32 dword_141F718 = imageColourFlags + 0x23800006;
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) {
uint8 secondaryColour = wall_element_get_secondary_colour(tile_element);
uint8 secondaryColour = wall_get_secondary_colour(tile_element);
imageColourFlags |= secondaryColour << 24 | IMAGE_TYPE_REMAP_2_PLUS;
}
@ -346,7 +346,7 @@ void fence_paint(paint_session * session, uint8 direction, sint32 height, rct_ti
set_format_arg(0, uint32, 0);
set_format_arg(4, uint32, 0);
uint8 secondaryColour = wall_element_get_secondary_colour(tile_element);
uint8 secondaryColour = wall_get_secondary_colour(tile_element);
if (dword_141F710 != 0) {
secondaryColour = COLOUR_GREY;

View File

@ -183,7 +183,7 @@ static const boundbox s98E3C4[] = {
*
* rct2: 0x006B7F0C
*/
void scenery_multiple_paint(paint_session * session, uint8 direction, uint16 height, rct_tile_element *tileElement)
void scenery_multiple_paint(paint_session * session, uint8 direction, uint16 height, rct_tile_element * tileElement)
{
session->InteractionType = VIEWPORT_INTERACTION_ITEM_LARGE_SCENERY;
uint32 sequenceNum = scenery_large_get_sequence(tileElement);
@ -194,7 +194,7 @@ void scenery_multiple_paint(paint_session * session, uint8 direction, uint16 hei
uint32 image_id = (sequenceNum << 2) + entry->image + 4 + direction;
rct_large_scenery_tile *tile = &entry->large_scenery.tiles[sequenceNum];
uint32 dword_F4387C = 0;
image_id |= ((tileElement->properties.scenerymultiple.colour[0] & 0x1F) << 19) | ((tileElement->properties.scenerymultiple.colour[1] & 0x1F) << 24) | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS;
image_id |= SPRITE_ID_PALETTE_COLOUR_2(scenery_large_get_primary_colour(tileElement), scenery_large_get_secondary_colour(tileElement));
LocationXYZ16 boxlength;
LocationXYZ16 boxoffset;
if (gTrackDesignSaveMode) {
@ -252,12 +252,12 @@ void scenery_multiple_paint(paint_session * session, uint8 direction, uint16 hei
// Draw sign text:
set_format_arg(0, uint32, 0);
set_format_arg(4, uint32, 0);
sint32 textColour = tileElement->properties.scenerymultiple.colour[1] & 0x1F;
sint32 textColour = scenery_large_get_secondary_colour(tileElement);
if (dword_F4387C) {
textColour = COLOUR_GREY;
}
textColour = (textColour << 19) | IMAGE_TYPE_REMAP;
uint32 bannerIndex = (tileElement->type & 0xC0) | ((tileElement->properties.scenerymultiple.colour[0] & 0xE0) >> 2) | ((tileElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
uint32 bannerIndex = scenery_large_get_banner_id(tileElement);
rct_banner *banner = &gBanners[bannerIndex];
rct_string_id stringId = banner->string_idx;
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE) {
@ -337,7 +337,7 @@ void scenery_multiple_paint(paint_session * session, uint8 direction, uint16 hei
// Draw scrolling text:
set_format_arg(0, uint32, 0);
set_format_arg(4, uint32, 0);
uint8 textColour = tileElement->properties.banner.unused & 0x1F;
uint8 textColour = scenery_large_get_secondary_colour(tileElement);
if (dword_F4387C) {
textColour = COLOUR_GREY;
}
@ -346,7 +346,7 @@ void scenery_multiple_paint(paint_session * session, uint8 direction, uint16 hei
}
// 6B809A:
set_format_arg(7, uint8, textColour);
uint32 bannerIndex = (tileElement->type & 0xC0) | ((tileElement->properties.scenerymultiple.colour[0] & 0xE0) >> 2) | ((tileElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
uint32 bannerIndex = scenery_large_get_banner_id(tileElement);
uint16 scrollMode = entry->large_scenery.scrolling_mode + ((direction + 1) & 0x3);
rct_banner *banner = &gBanners[bannerIndex];
set_format_arg(0, rct_string_id, banner->string_idx);

View File

@ -2306,13 +2306,12 @@ private:
tileElement->properties.wall.type |= (colour & 7) << 5;
break;
case TILE_ELEMENT_TYPE_SCENERY_MULTIPLE:
colour = RCT1::GetColour(tileElement->properties.scenerymultiple.colour[0] & 0x1F);
tileElement->properties.scenerymultiple.colour[0] &= 0xE0;
tileElement->properties.scenerymultiple.colour[0] |= colour;
colour = RCT1::GetColour(scenery_large_get_primary_colour(tileElement));
scenery_large_set_primary_colour(tileElement, colour);
colour = RCT1::GetColour(scenery_large_get_secondary_colour(tileElement));
scenery_large_set_secondary_colour(tileElement, colour);
colour = RCT1::GetColour(tileElement->properties.scenerymultiple.colour[1] & 0x1F);
tileElement->properties.scenerymultiple.colour[1] &= 0xE0;
tileElement->properties.scenerymultiple.colour[1] |= colour;
break;
}
}

View File

@ -327,11 +327,13 @@ static void track_design_save_add_large_scenery(sint32 x, sint32 y, rct_tile_ele
y = y0 + offsetY;
z = (z0 + tile->z_offset) / 8;
tileElement = map_get_large_scenery_segment(x, y, z, direction, sequence);
if (tileElement != NULL) {
if (sequence == 0) {
if (tileElement != NULL)
{
if (sequence == 0)
{
uint8 flags = tileElement->type & 3;
uint8 primaryColour = tileElement->properties.scenerymultiple.colour[0] & 0x1F;
uint8 secondaryColour = tileElement->properties.scenerymultiple.colour[1] & 0x1F;
uint8 primaryColour = scenery_large_get_primary_colour(tileElement);
uint8 secondaryColour = scenery_large_get_secondary_colour(tileElement);
track_design_save_push_tile_element_desc(entry, x, y, z, flags, primaryColour, secondaryColour);
}
@ -349,8 +351,8 @@ static void track_design_save_add_wall(sint32 x, sint32 y, rct_tile_element *til
flags |= tileElement->type & 3;
flags |= tileElement->properties.wall.colour_3 << 2;
uint8 secondaryColour = wall_element_get_secondary_colour(tileElement);
uint8 primaryColour = tileElement->properties.wall.colour_1 & 0x1F;
uint8 secondaryColour = wall_get_secondary_colour(tileElement);
uint8 primaryColour = wall_get_primary_colour(tileElement);
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);
@ -510,11 +512,13 @@ static void track_design_save_remove_large_scenery(sint32 x, sint32 y, rct_tile_
y = y0 + offsetY;
z = (z0 + tile->z_offset) / 8;
tileElement = map_get_large_scenery_segment(x, y, z, direction, sequence);
if (tileElement != NULL) {
if (sequence == 0) {
if (tileElement != NULL)
{
if (sequence == 0)
{
uint8 flags = tileElement->type & 3;
uint8 primaryColour = tileElement->properties.scenerymultiple.colour[0] & 0x1F;
uint8 secondaryColour = tileElement->properties.scenerymultiple.colour[1] & 0x1F;
uint8 primaryColour = scenery_large_get_primary_colour(tileElement);
uint8 secondaryColour = scenery_large_get_secondary_colour(tileElement);
track_design_save_pop_tile_element_desc(entry, x, y, z, flags, primaryColour, secondaryColour);
}
@ -532,8 +536,8 @@ static void track_design_save_remove_wall(sint32 x, sint32 y, rct_tile_element *
flags |= tileElement->type & 3;
flags |= tileElement->properties.wall.colour_3 << 2;
uint8 secondaryColour = wall_element_get_secondary_colour(tileElement);
uint8 primaryColour = tileElement->properties.wall.colour_1 & 0x1F;
uint8 secondaryColour = wall_get_secondary_colour(tileElement);
uint8 primaryColour = wall_get_primary_colour(tileElement);
track_design_save_pop_tile_element(x, y, tileElement);
track_design_save_pop_tile_element_desc(entry, x, y, tileElement->base_height, flags, primaryColour, secondaryColour);

View File

@ -1883,10 +1883,9 @@ static void window_tile_inspector_paint(rct_window *w, rct_drawpixelinfo *dpi)
// Banner info
rct_scenery_entry *largeSceneryEntry = get_large_scenery_entry(scenery_large_get_type(tileElement));
if (largeSceneryEntry->large_scenery.scrolling_mode != 0xFF) {
const sint32 bannerIndex = (tileElement->type & 0xC0) |
((tileElement->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
((tileElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
if (largeSceneryEntry->large_scenery.scrolling_mode != 0xFF)
{
const sint32 bannerIndex = scenery_large_get_banner_id(tileElement);
//window_sign_open(bannerIndex);
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, &gBanners[bannerIndex].string_idx, COLOUR_DARK_GREEN, x, y + 22);
}

View File

@ -562,4 +562,4 @@ extern "C"
*ebx & 0xFF
);
}
}
}

View File

@ -533,8 +533,8 @@ static money32 WallPlace(uint8 wallType,
tileElement->type = edgeSlope | edge | TILE_ELEMENT_TYPE_WALL;
tileElement->properties.wall.colour_1 = primaryColour;
wall_element_set_secondary_colour(tileElement, secondaryColour);
wall_set_primary_colour(tileElement, primaryColour);
wall_set_secondary_colour(tileElement, secondaryColour);
if (wallAcrossTrack)
{
@ -670,8 +670,8 @@ static money32 WallSetColour(sint16 x,
if (flags & GAME_COMMAND_FLAG_APPLY)
{
rct_scenery_entry * scenery_entry = get_wall_entry(wallElement->properties.wall.type);
wallElement->properties.wall.colour_1 = primaryColour;
wall_element_set_secondary_colour(wallElement, secondaryColour);
wall_set_primary_colour(wallElement, primaryColour);
wall_set_secondary_colour(wallElement, secondaryColour);
if (scenery_entry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
{
@ -696,21 +696,45 @@ extern "C"
wallElement->properties.wall.animation |= (frameNum & 0xF) << 3;
}
uint8 wall_element_get_secondary_colour(rct_tile_element * wallElement)
colour_t wall_get_primary_colour(const rct_tile_element * tileElement)
{
uint8 secondaryColour = (wallElement->properties.wall.colour_1 & 0xE0) >> 5;
return tileElement->properties.wall.colour_1 & TILE_ELEMENT_COLOUR_MASK;
}
colour_t wall_get_secondary_colour(rct_tile_element * wallElement)
{
uint8 secondaryColour = (wallElement->properties.wall.colour_1 &~ TILE_ELEMENT_COLOUR_MASK) >> 5;
secondaryColour |= (wallElement->flags & 0x60) >> 2;
return secondaryColour;
}
void wall_element_set_secondary_colour(rct_tile_element * wallElement, uint8 secondaryColour)
colour_t wall_get_tertiary_colour(const rct_tile_element * tileElement)
{
wallElement->properties.wall.colour_1 &= 0x1F;
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 &= 0x9F;
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

@ -1080,10 +1080,8 @@ void game_command_set_large_scenery_colour(sint32* eax, sint32* ebx, sint32* ecx
tile_element_direction,
i);
tileElement->properties.scenerymultiple.colour[0] &= 0xE0;
tileElement->properties.scenerymultiple.colour[0] |= colour1;
tileElement->properties.scenerymultiple.colour[1] &= 0xE0;
tileElement->properties.scenerymultiple.colour[1] |= colour2;
scenery_large_set_primary_colour(tileElement, colour1);
scenery_large_set_secondary_colour(tileElement, colour2);
map_invalidate_tile_full(currentTile.x, currentTile.y);
}
@ -2648,8 +2646,8 @@ void game_command_place_large_scenery(sint32* eax, sint32* ebx, sint32* ecx, sin
sint32 x = (sint16)*eax;
sint32 y = (sint16)*ecx;
sint32 z = (sint16)*ebp;
uint8 colour1 = *edx;
uint8 colour2 = *edx >> 8;
colour_t colour1 = *edx & TILE_ELEMENT_COLOUR_MASK;
colour_t colour2 = (*edx >> 8) & TILE_ELEMENT_COLOUR_MASK;
uint8 flags = *ebx;
uint8 rotation = *ebx >> 8;
uint8 entry_index = *edi;
@ -2840,13 +2838,12 @@ void game_command_place_large_scenery(sint32* eax, sint32* ebx, sint32* ecx, sin
scenery_large_set_type(new_tile_element, entry_index);
scenery_large_set_sequence(new_tile_element, tile_num);
new_tile_element->properties.scenerymultiple.colour[0] = colour1;
new_tile_element->properties.scenerymultiple.colour[1] = colour2;
scenery_large_set_primary_colour(new_tile_element, colour1);
scenery_large_set_secondary_colour(new_tile_element, colour2);
if (banner_id != 0xFF) {
new_tile_element->type |= banner_id & 0xC0;
new_tile_element->properties.scenerymultiple.colour[0] |= (banner_id & 0x38) << 2;
new_tile_element->properties.scenerymultiple.colour[1] |= (banner_id & 7) << 5;
if (banner_id != 0xFF)
{
scenery_large_set_banner_id(new_tile_element, banner_id);
}
if (flags & GAME_COMMAND_FLAG_GHOST) {
@ -3481,10 +3478,7 @@ sint32 tile_element_get_banner_index(rct_tile_element *tileElement)
if (sceneryEntry->large_scenery.scrolling_mode == 0xFF)
return -1;
return
(tileElement->type & TILE_ELEMENT_QUADRANT_MASK) |
((tileElement->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
((tileElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
return scenery_large_get_banner_id(tileElement);
case TILE_ELEMENT_TYPE_WALL:
sceneryEntry = get_wall_entry(tileElement->properties.wall.type);
if (sceneryEntry == NULL || sceneryEntry->wall.scrolling_mode == 0xFF)
@ -3581,7 +3575,7 @@ void map_extend_boundary_surface()
newTileElement = map_get_surface_element_at(x, y);
newTileElement->type = (newTileElement->type & 0x7C) | (existingTileElement->type & 0x83);
newTileElement->properties.surface.slope = existingTileElement->properties.surface.slope & 0xE0;
newTileElement->properties.surface.slope = existingTileElement->properties.surface.slope & TILE_ELEMENT_SLOPE_EDGE_STYLE_MASK;
newTileElement->properties.surface.terrain = existingTileElement->properties.surface.terrain;
newTileElement->properties.surface.grass_length = existingTileElement->properties.surface.grass_length;
newTileElement->properties.surface.ownership = 0;
@ -3912,11 +3906,10 @@ bool sign_set_colour(sint32 x, sint32 y, sint32 z, sint32 direction, sint32 sequ
y = y0 + offsetY;
z = (z0 + tile->z_offset) / 8;
tileElement = map_get_large_scenery_segment(x, y, z, direction, sequence);
if (tileElement != NULL) {
tileElement->properties.scenerymultiple.colour[0] &= 0xE0;
tileElement->properties.scenerymultiple.colour[1] &= 0xE0;
tileElement->properties.scenerymultiple.colour[0] |= mainColour;
tileElement->properties.scenerymultiple.colour[1] |= textColour;
if (tileElement != NULL)
{
scenery_large_set_primary_colour(tileElement, mainColour);
scenery_large_set_secondary_colour(tileElement, textColour);
map_invalidate_tile(x, y, tileElement->base_height * 8 , tileElement->clearance_height * 8);
}
@ -4230,8 +4223,8 @@ void game_command_set_sign_style(sint32* eax, sint32* ebx, sint32* ecx, sint32*
*ebx = 0;
return;
}
tile_element->properties.wall.colour_1 = mainColour;
wall_element_set_secondary_colour(tile_element, textColour);
wall_set_primary_colour(tile_element, mainColour);
wall_set_secondary_colour(tile_element, textColour);
map_invalidate_tile(x, y, tile_element->base_height * 8, tile_element->clearance_height * 8);
} else { // large sign

View File

@ -542,8 +542,6 @@ bool map_is_location_at_edge(sint32 x, sint32 y);
void map_obstruction_set_error_text(rct_tile_element *tileElement);
uint8 wall_element_get_animation_frame(rct_tile_element *fenceElement);
void wall_element_set_animation_frame(rct_tile_element * wallElement, uint8 frameNum);
uint8 wall_element_get_secondary_colour(rct_tile_element * wallElement);
void wall_element_set_secondary_colour(rct_tile_element * wallElement, uint8 secondaryColour);
uint32 map_get_available_peep_spawn_index_list(uint32* peepSpawnIndexList);
uint16 check_max_allowable_land_rights_for_tile(uint8 x, uint8 y, uint8 base_z);

View File

@ -325,37 +325,36 @@ sint32 get_scenery_id_from_entry_index(uint8 objectType, sint32 entryIndex)
}
}
sint32 scenery_small_get_primary_colour(const rct_tile_element *tileElement)
sint32 scenery_small_get_primary_colour(const rct_tile_element * tileElement)
{
return (tileElement->properties.scenery.colour_1 & 0x1F);
return tileElement->properties.scenery.colour_1 & TILE_ELEMENT_COLOUR_MASK;
}
sint32 scenery_small_get_secondary_colour(const rct_tile_element *tileElement)
sint32 scenery_small_get_secondary_colour(const rct_tile_element * tileElement)
{
return (tileElement->properties.scenery.colour_2 & 0x1F);
return tileElement->properties.scenery.colour_2 & TILE_ELEMENT_COLOUR_MASK;
}
void scenery_small_set_primary_colour(rct_tile_element *tileElement, uint32 colour)
void scenery_small_set_primary_colour(rct_tile_element * tileElement, uint32 colour)
{
assert(colour <= 31);
tileElement->properties.scenery.colour_1 &= ~0x1F;
tileElement->properties.scenery.colour_1 &= ~TILE_ELEMENT_COLOUR_MASK;
tileElement->properties.scenery.colour_1 |= colour;
}
void scenery_small_set_secondary_colour(rct_tile_element *tileElement, uint32 colour)
void scenery_small_set_secondary_colour(rct_tile_element * tileElement, uint32 colour)
{
assert(colour <= 31);
tileElement->properties.scenery.colour_2 &= ~0x1F;
tileElement->properties.scenery.colour_2 &= ~TILE_ELEMENT_COLOUR_MASK;
tileElement->properties.scenery.colour_2 |= colour;
}
bool scenery_small_get_supports_needed(const rct_tile_element *tileElement)
bool scenery_small_get_supports_needed(const rct_tile_element * tileElement)
{
return (bool)(tileElement->properties.scenery.colour_1 & MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS);
}
void scenery_small_set_supports_needed(rct_tile_element *tileElement)
void scenery_small_set_supports_needed(rct_tile_element * tileElement)
{
tileElement->properties.scenery.colour_1 |= MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS;
}