mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #2735. 1/4 tile scenery can now correctly be recoloured.
Issue was caused by an assumption made during writing this function.
This commit is contained in:
parent
06fd1436ca
commit
3865bf9381
|
@ -985,6 +985,9 @@ void game_command_set_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int
|
|||
uint8 color1 = *ebp;
|
||||
uint8 color2 = *ebp >> 8;
|
||||
uint8 flags = *ebx & 0xFF;
|
||||
// Note this is not just the type it also contains quadrant information
|
||||
// for small tiles that take up less than a full tile.
|
||||
uint8 type = (*ebx >> 8) & 0xFF;
|
||||
int z = base_height * 8;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16) = x + 16;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16) = y + 16;
|
||||
|
@ -997,15 +1000,31 @@ void game_command_set_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int
|
|||
}
|
||||
}
|
||||
|
||||
// Previously it would do a search for type of bh (set from calling function) instead of just small scenery
|
||||
// Unsure if this was a mistake.
|
||||
rct_map_element* map_element = map_get_small_scenery_element_at(x, y, base_height, scenery_type);
|
||||
bool found = false;
|
||||
rct_map_element *map_element = map_get_first_element_at(x >> 5, y >> 5);
|
||||
|
||||
if (map_element == NULL) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
// Note this is not just checking for type. See above.
|
||||
if (map_element->type != type)
|
||||
continue;
|
||||
if (map_element->base_height != base_height)
|
||||
continue;
|
||||
if (map_element->properties.scenery.type != scenery_type)
|
||||
continue;
|
||||
found = true;
|
||||
break;
|
||||
} while (!map_element_is_last_for_tile(map_element++));
|
||||
|
||||
if (found == false) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if((flags & GAME_COMMAND_FLAG_GHOST) && !(map_element->flags & MAP_ELEMENT_FLAG_GHOST)){
|
||||
*ebx = 0;
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue