mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #1047 from duncanspumpkin/fix_scenery_bugs
Fix scenery bugs
This commit is contained in:
commit
85daa7c5ac
|
@ -749,23 +749,41 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i
|
|||
x3 += x2;
|
||||
y3 += y2;
|
||||
z3 += z2;
|
||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||
if(!map_is_location_owned(x3, y3, z3)){
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||
if (!map_is_location_owned(x3, y3, z3)){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||
rct_map_element* map_element = map_get_first_element_at(x3 / 32, y3 / 32);
|
||||
while(map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SCENERY_MULTIPLE ||
|
||||
(map_element->type & MAP_ELEMENT_DIRECTION_MASK) != map_element_direction ||
|
||||
map_element->properties.scenerymultiple.type >> 10 != i ||
|
||||
map_element->base_height != base_height){
|
||||
map_element++;
|
||||
}
|
||||
uint8 tile_not_found = 1;
|
||||
do
|
||||
{
|
||||
if (map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SCENERY_MULTIPLE)
|
||||
continue;
|
||||
|
||||
if ((map_element->type & MAP_ELEMENT_DIRECTION_MASK) != map_element_direction)
|
||||
continue;
|
||||
|
||||
if ((map_element->properties.scenerymultiple.type >> 10) != i)
|
||||
continue;
|
||||
|
||||
if (map_element->base_height != z3 / 8)
|
||||
continue;
|
||||
|
||||
map_invalidate_tile_full(x3, y3);
|
||||
map_element_remove(map_element);
|
||||
tile_not_found = 0;
|
||||
break;
|
||||
} while (!map_element_is_last_for_tile(map_element++));
|
||||
|
||||
if (tile_not_found){
|
||||
log_error("Tile not found when trying to remove element!");
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
@ -837,11 +855,13 @@ void game_command_set_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int
|
|||
RCT2_GLOBAL(0x009DEA5E, uint16) = x + 16;
|
||||
RCT2_GLOBAL(0x009DEA60, uint16) = y + 16;
|
||||
RCT2_GLOBAL(0x009DEA62, uint16) = z;
|
||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||
if(!map_is_location_owned(x, y, z)){
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||
if (!map_is_location_owned(x, y, z)){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
|
||||
while(map_element->type != map_element_type ||
|
||||
map_element->base_height != base_height ||
|
||||
|
@ -863,7 +883,7 @@ void game_command_set_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int
|
|||
map_element->properties.scenery.colour_2 |= color2;
|
||||
map_invalidate_tile_full(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
*ebx = 0;
|
||||
}
|
||||
|
||||
|
@ -1012,11 +1032,13 @@ void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* ed
|
|||
x3 += x2;
|
||||
y3 += y2;
|
||||
z3 += z2;
|
||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||
if(!map_is_location_owned(x3, y3, z3)){
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||
if (!map_is_location_owned(x3, y3, z3)){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||
rct_map_element* map_element = map_get_first_element_at(x3 / 32, y3 / 32);
|
||||
while(map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SCENERY_MULTIPLE ||
|
||||
|
@ -1031,7 +1053,7 @@ void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* ed
|
|||
map_element->properties.scenerymultiple.colour[1] |= color2;
|
||||
map_invalidate_tile_full(x3, y3);
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
*ebx = 0;
|
||||
|
@ -1054,11 +1076,13 @@ void game_command_set_banner_colour(int* eax, int* ebx, int* ecx, int* edx, int*
|
|||
RCT2_GLOBAL(0x009DEA60, uint16) = y + 16;
|
||||
RCT2_GLOBAL(0x009DEA62, uint16) = z;
|
||||
|
||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||
if(!map_is_location_owned(x, y, z - 16)){
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||
if (!map_is_location_owned(x, y, z - 16)){
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
|
||||
while(map_element->type != MAP_ELEMENT_TYPE_BANNER ||
|
||||
|
@ -1076,7 +1100,7 @@ void game_command_set_banner_colour(int* eax, int* ebx, int* ecx, int* edx, int*
|
|||
gBanners[map_element->properties.banner.index].colour = color;
|
||||
map_invalidate_tile(x, y, z, z + 32);
|
||||
}
|
||||
}
|
||||
|
||||
*ebx = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue