mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-25 07:44:38 +01:00
Use functions to set and get secondary colour
This commit is contained in:
@@ -150,7 +150,7 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element)
|
||||
uint32 dword_141F718 = imageColourFlags + 0x23800006;
|
||||
|
||||
if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) {
|
||||
uint8 secondaryColour = (map_element->properties.wall.colour_1 >> 5) | ((map_element->flags & 0x60) >> 2);
|
||||
uint8 secondaryColour = wall_element_get_secondary_colour(map_element);
|
||||
imageColourFlags |= secondaryColour << 24 | 0x80000000;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element)
|
||||
if (sceneryEntry->wall.flags & WALL_SCENERY_IS_DOOR) {
|
||||
rct_xyz16 offset;
|
||||
rct_xyz16 boundsR1, boundsR1_, boundsR2, boundsR2_, boundsL1, boundsL1_;
|
||||
uint8 animationFrame = wall_get_animation_frame(map_element);
|
||||
uint8 animationFrame = wall_element_get_animation_frame(map_element);
|
||||
// Add the direction as well
|
||||
animationFrame |= (map_element->properties.wall.animation & 0x80) >> 3;
|
||||
uint32 imageId;
|
||||
@@ -345,7 +345,7 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element)
|
||||
set_format_arg(0, uint32, 0);
|
||||
set_format_arg(4, uint32, 0);
|
||||
|
||||
uint8 secondaryColour = map_element->properties.wall.colour_1 >> 5 | (map_element->flags & 0x60) >> 2;
|
||||
uint8 secondaryColour = wall_element_get_secondary_colour(map_element);
|
||||
|
||||
if (dword_141F710 != 0) {
|
||||
secondaryColour = COLOUR_GREY;
|
||||
|
||||
@@ -339,7 +339,7 @@ static void track_design_save_add_wall(sint32 x, sint32 y, rct_map_element *mapE
|
||||
flags |= mapElement->type & 3;
|
||||
flags |= mapElement->properties.wall.colour_3 << 2;
|
||||
|
||||
uint8 secondaryColour = ((mapElement->flags & 0x60) >> 2) | (mapElement->properties.wall.colour_1 >> 5);
|
||||
uint8 secondaryColour = wall_element_get_secondary_colour(mapElement);
|
||||
uint8 primaryColour = mapElement->properties.wall.colour_1 & 0x1F;
|
||||
|
||||
track_design_save_push_map_element(x, y, mapElement);
|
||||
@@ -522,7 +522,7 @@ static void track_design_save_remove_wall(sint32 x, sint32 y, rct_map_element *m
|
||||
flags |= mapElement->type & 3;
|
||||
flags |= mapElement->properties.wall.colour_3 << 2;
|
||||
|
||||
uint8 secondaryColour = ((mapElement->flags & 0x60) >> 2) | (mapElement->properties.wall.colour_1 >> 5);
|
||||
uint8 secondaryColour = wall_element_get_secondary_colour(mapElement);
|
||||
uint8 primaryColour = mapElement->properties.wall.colour_1 & 0x1F;
|
||||
|
||||
track_design_save_pop_map_element(x, y, mapElement);
|
||||
|
||||
@@ -448,8 +448,7 @@ void window_sign_small_open(rct_windownumber number){
|
||||
w->frame_no = view_z;
|
||||
|
||||
w->list_information_type = map_element->properties.wall.colour_1 & 0x1F;
|
||||
w->var_492 =
|
||||
((map_element->properties.wall.colour_1 >> 5) | ((map_element->flags & 0x60) >> 2));
|
||||
w->var_492 = wall_element_get_secondary_colour(map_element);
|
||||
w->var_48C = map_element->properties.wall.type;
|
||||
|
||||
view_x += 16;
|
||||
|
||||
@@ -39,7 +39,8 @@ assert_struct_size(rct_banner, 8);
|
||||
enum{
|
||||
BANNER_FLAG_NO_ENTRY = (1 << 0),
|
||||
BANNER_FLAG_IS_LARGE_SCENERY = (1 << 1),
|
||||
BANNER_FLAG_LINKED_TO_RIDE = (1 << 2)
|
||||
BANNER_FLAG_LINKED_TO_RIDE = (1 << 2),
|
||||
BANNER_FLAG_4 = (1 << 3)
|
||||
};
|
||||
|
||||
extern rct_banner gBanners[MAX_BANNERS];
|
||||
|
||||
@@ -4907,7 +4907,7 @@ void game_command_set_sign_style(sint32* eax, sint32* ebx, sint32* ecx, sint32*
|
||||
if (*ebp == 0) { // small sign
|
||||
|
||||
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
|
||||
bool fence_found = false;
|
||||
bool wall_found = false;
|
||||
do{
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
@@ -4917,11 +4917,11 @@ void game_command_set_sign_style(sint32* eax, sint32* ebx, sint32* ecx, sint32*
|
||||
continue;
|
||||
if (map_element->properties.wall.banner_index != bannerId)
|
||||
continue;
|
||||
fence_found = true;
|
||||
wall_found = true;
|
||||
break;
|
||||
} while (!map_element_is_last_for_tile(map_element++));
|
||||
|
||||
if (fence_found == false) {
|
||||
if (wall_found == false) {
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
@@ -4930,13 +4930,9 @@ void game_command_set_sign_style(sint32* eax, sint32* ebx, sint32* ecx, sint32*
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
map_element->flags &= 0x9F;
|
||||
map_element->properties.wall.colour_1 =
|
||||
mainColour |
|
||||
((textColour & 0x7) << 5);
|
||||
map_element->flags |= ((textColour & 0x18) << 2);
|
||||
|
||||
map_element->properties.wall.colour_1 = mainColour;
|
||||
wall_element_set_secondary_colour(map_element, textColour);
|
||||
|
||||
map_invalidate_tile(x, y, map_element->base_height * 8, map_element->clearance_height * 8);
|
||||
} else { // large sign
|
||||
rct_map_element *mapElement = banner_get_map_element(bannerId);
|
||||
|
||||
@@ -540,6 +540,8 @@ rct_map_element *map_get_track_element_at_with_direction_from_ride(sint32 x, sin
|
||||
|
||||
bool map_is_location_at_edge(sint32 x, sint32 y);
|
||||
void map_obstruction_set_error_text(rct_map_element *mapElement);
|
||||
uint8 wall_get_animation_frame(rct_map_element *fenceElement);
|
||||
uint8 wall_element_get_animation_frame(rct_map_element *fenceElement);
|
||||
uint8 wall_element_get_secondary_colour(rct_map_element * wallElement);
|
||||
void wall_element_set_secondary_colour(rct_map_element * wallElement, uint8 secondaryColour);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -474,7 +474,7 @@ static bool map_animation_invalidate_wall_door(sint32 x, sint32 y, sint32 baseZ)
|
||||
|
||||
bool invalidate = false;
|
||||
uint8 bl = mapElement->properties.wall.animation & 0x87;
|
||||
uint8 currentFrame = wall_get_animation_frame(mapElement);
|
||||
uint8 currentFrame = wall_element_get_animation_frame(mapElement);
|
||||
if (currentFrame != 0) {
|
||||
if (currentFrame == 15) {
|
||||
currentFrame = 0;
|
||||
|
||||
@@ -346,7 +346,7 @@ static money32 WallPlace(uint8 wallType,
|
||||
}
|
||||
}
|
||||
|
||||
uint8 bp = 0;
|
||||
uint8 edgeSlope = 0;
|
||||
if (position.z == 0)
|
||||
{
|
||||
rct_map_element * surfaceElement = map_get_surface_element_at(position.x / 32, position.y / 32);
|
||||
@@ -357,11 +357,11 @@ static money32 WallPlace(uint8 wallType,
|
||||
position.z = surfaceElement->base_height * 8;
|
||||
|
||||
uint8 slope = surfaceElement->properties.surface.slope & MAP_ELEMENT_SLOPE_MASK;
|
||||
bp = EdgeSlopes[slope][edge & 3];
|
||||
if (bp & EDGE_SLOPE_ELEVATED)
|
||||
edgeSlope = EdgeSlopes[slope][edge & 3];
|
||||
if (edgeSlope & EDGE_SLOPE_ELEVATED)
|
||||
{
|
||||
position.z += 16;
|
||||
bp &= ~(1 << 0);
|
||||
edgeSlope &= ~EDGE_SLOPE_ELEVATED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ static money32 WallPlace(uint8 wallType,
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (!(bp & 0xC0))
|
||||
if (!(edgeSlope & (EDGE_SLOPE_UPWARDS | EDGE_SLOPE_DOWNWARDS)))
|
||||
{
|
||||
uint8 newEdge = (edge + 2) & 3;
|
||||
uint8 newBaseHeight = surfaceElement->base_height;
|
||||
@@ -473,7 +473,7 @@ static money32 WallPlace(uint8 wallType,
|
||||
rct_banner * banner = &gBanners[bannerIndex];
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY)
|
||||
{
|
||||
banner->flags |= (1 << 3);
|
||||
banner->flags |= BANNER_FLAG_4;
|
||||
banner->type = 0;
|
||||
banner->x = position.x / 32;
|
||||
banner->y = position.y / 32;
|
||||
@@ -488,7 +488,7 @@ static money32 WallPlace(uint8 wallType,
|
||||
}
|
||||
|
||||
uint8 clearanceHeight = position.z / 8;
|
||||
if (bp & (EDGE_SLOPE_UPWARDS | EDGE_SLOPE_DOWNWARDS))
|
||||
if (edgeSlope & (EDGE_SLOPE_UPWARDS | EDGE_SLOPE_DOWNWARDS))
|
||||
{
|
||||
if (wallEntry->wall.flags & WALL_SCENERY_CANT_BUILD_ON_SLOPE)
|
||||
{
|
||||
@@ -537,11 +537,10 @@ static money32 WallPlace(uint8 wallType,
|
||||
|
||||
mapElement->clearance_height = clearanceHeight;
|
||||
|
||||
mapElement->type = bp | edge | MAP_ELEMENT_TYPE_WALL;
|
||||
mapElement->type = edgeSlope | edge | MAP_ELEMENT_TYPE_WALL;
|
||||
|
||||
mapElement->properties.wall.colour_1 = primaryColour;
|
||||
mapElement->properties.wall.colour_1 |= (secondaryColour & 7) << 5;
|
||||
mapElement->flags |= (secondaryColour & 0x18) << 2;
|
||||
wall_element_set_secondary_colour(mapElement, secondaryColour);
|
||||
|
||||
if (wallAcrossTrack)
|
||||
{
|
||||
@@ -559,7 +558,7 @@ static money32 WallPlace(uint8 wallType,
|
||||
mapElement->properties.wall.colour_3 = tertiaryColour;
|
||||
}
|
||||
|
||||
if (flags & (1 << 6))
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||
{
|
||||
mapElement->flags |= MAP_ELEMENT_FLAG_GHOST;
|
||||
}
|
||||
@@ -679,12 +678,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 &= 0xE0;
|
||||
wallElement->properties.wall.colour_1 |= primaryColour;
|
||||
wallElement->properties.wall.colour_1 &= 0x1F;
|
||||
wallElement->flags &= 0x9F;
|
||||
wallElement->properties.wall.colour_1 |= (secondaryColour & 0x7) * 32;
|
||||
wallElement->flags |= (secondaryColour & 0x18) * 4;
|
||||
wallElement->properties.wall.colour_1 = primaryColour;
|
||||
wall_element_set_secondary_colour(wallElement, secondaryColour);
|
||||
|
||||
if(scenery_entry->wall.flags & WALL_SCENERY_HAS_TERNARY_COLOUR)
|
||||
{
|
||||
@@ -698,10 +693,26 @@ static money32 WallSetColour(sint16 x,
|
||||
|
||||
extern "C"
|
||||
{
|
||||
uint8 wall_get_animation_frame(rct_map_element * wallElement) {
|
||||
uint8 wall_element_get_animation_frame(rct_map_element * wallElement)
|
||||
{
|
||||
return (wallElement->properties.wall.animation >> 3) & 0xF;
|
||||
}
|
||||
|
||||
|
||||
uint8 wall_element_get_secondary_colour(rct_map_element * wallElement)
|
||||
{
|
||||
uint8 secondaryColour = (wallElement->properties.wall.colour_1 & 0xE0) >> 5;
|
||||
secondaryColour |= (wallElement->flags & 0x60) >> 2;
|
||||
return secondaryColour;
|
||||
}
|
||||
|
||||
void wall_element_set_secondary_colour(rct_map_element * wallElement, uint8 secondaryColour)
|
||||
{
|
||||
wallElement->properties.wall.colour_1 &= 0x1F;
|
||||
wallElement->properties.wall.colour_1 |= (secondaryColour & 0x7) << 5;
|
||||
wallElement->flags &= 0x9F;
|
||||
wallElement->flags |= (secondaryColour & 0x18) << 2;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E588E
|
||||
|
||||
Reference in New Issue
Block a user