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
154
src/world/map.c
154
src/world/map.c
|
@ -749,23 +749,41 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i
|
||||||
x3 += x2;
|
x3 += x2;
|
||||||
y3 += y2;
|
y3 += y2;
|
||||||
z3 += z2;
|
z3 += z2;
|
||||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||||
if(!map_is_location_owned(x3, y3, z3)){
|
if (!map_is_location_owned(x3, y3, z3)){
|
||||||
*ebx = MONEY32_UNDEFINED;
|
*ebx = MONEY32_UNDEFINED;
|
||||||
return;
|
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 ||
|
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||||
(map_element->type & MAP_ELEMENT_DIRECTION_MASK) != map_element_direction ||
|
rct_map_element* map_element = map_get_first_element_at(x3 / 32, y3 / 32);
|
||||||
map_element->properties.scenerymultiple.type >> 10 != i ||
|
uint8 tile_not_found = 1;
|
||||||
map_element->base_height != base_height){
|
do
|
||||||
map_element++;
|
{
|
||||||
}
|
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_invalidate_tile_full(x3, y3);
|
||||||
map_element_remove(map_element);
|
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++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -837,33 +855,35 @@ void game_command_set_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int
|
||||||
RCT2_GLOBAL(0x009DEA5E, uint16) = x + 16;
|
RCT2_GLOBAL(0x009DEA5E, uint16) = x + 16;
|
||||||
RCT2_GLOBAL(0x009DEA60, uint16) = y + 16;
|
RCT2_GLOBAL(0x009DEA60, uint16) = y + 16;
|
||||||
RCT2_GLOBAL(0x009DEA62, uint16) = z;
|
RCT2_GLOBAL(0x009DEA62, uint16) = z;
|
||||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||||
if(!map_is_location_owned(x, y, z)){
|
if (!map_is_location_owned(x, y, z)){
|
||||||
*ebx = MONEY32_UNDEFINED;
|
*ebx = MONEY32_UNDEFINED;
|
||||||
return;
|
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 ||
|
rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32);
|
||||||
map_element->properties.scenery.type != scenery_type){
|
while(map_element->type != map_element_type ||
|
||||||
map_element++;
|
map_element->base_height != base_height ||
|
||||||
if((map_element - 1)->flags & MAP_ELEMENT_FLAG_LAST_TILE){
|
map_element->properties.scenery.type != scenery_type){
|
||||||
*ebx = 0;
|
map_element++;
|
||||||
return;
|
if((map_element - 1)->flags & MAP_ELEMENT_FLAG_LAST_TILE){
|
||||||
}
|
|
||||||
}
|
|
||||||
if((*ebx & 0x40) && !(map_element->flags & MAP_ELEMENT_FLAG_5)){
|
|
||||||
*ebx = 0;
|
*ebx = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
|
||||||
map_element->properties.scenery.colour_1 &= 0xE0;
|
|
||||||
map_element->properties.scenery.colour_1 |= color1;
|
|
||||||
map_element->properties.scenery.colour_2 &= 0xE0;
|
|
||||||
map_element->properties.scenery.colour_2 |= color2;
|
|
||||||
map_invalidate_tile_full(x, y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if((*ebx & 0x40) && !(map_element->flags & MAP_ELEMENT_FLAG_5)){
|
||||||
|
*ebx = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(*ebx & GAME_COMMAND_FLAG_APPLY){
|
||||||
|
map_element->properties.scenery.colour_1 &= 0xE0;
|
||||||
|
map_element->properties.scenery.colour_1 |= color1;
|
||||||
|
map_element->properties.scenery.colour_2 &= 0xE0;
|
||||||
|
map_element->properties.scenery.colour_2 |= color2;
|
||||||
|
map_invalidate_tile_full(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
*ebx = 0;
|
*ebx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,26 +1032,28 @@ void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* ed
|
||||||
x3 += x2;
|
x3 += x2;
|
||||||
y3 += y2;
|
y3 += y2;
|
||||||
z3 += z2;
|
z3 += z2;
|
||||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||||
if(!map_is_location_owned(x3, y3, z3)){
|
if (!map_is_location_owned(x3, y3, z3)){
|
||||||
*ebx = MONEY32_UNDEFINED;
|
*ebx = MONEY32_UNDEFINED;
|
||||||
return;
|
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++;
|
|
||||||
}
|
|
||||||
map_element->properties.scenerymultiple.colour[0] &= 0xE0;
|
|
||||||
map_element->properties.scenerymultiple.colour[0] |= color1;
|
|
||||||
map_element->properties.scenerymultiple.colour[1] &= 0xE0;
|
|
||||||
map_element->properties.scenerymultiple.colour[1] |= color2;
|
|
||||||
map_invalidate_tile_full(x3, y3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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++;
|
||||||
|
}
|
||||||
|
map_element->properties.scenerymultiple.colour[0] &= 0xE0;
|
||||||
|
map_element->properties.scenerymultiple.colour[0] |= color1;
|
||||||
|
map_element->properties.scenerymultiple.colour[1] &= 0xE0;
|
||||||
|
map_element->properties.scenerymultiple.colour[1] |= color2;
|
||||||
|
map_invalidate_tile_full(x3, y3);
|
||||||
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
*ebx = 0;
|
*ebx = 0;
|
||||||
|
@ -1054,29 +1076,31 @@ void game_command_set_banner_colour(int* eax, int* ebx, int* ecx, int* edx, int*
|
||||||
RCT2_GLOBAL(0x009DEA60, uint16) = y + 16;
|
RCT2_GLOBAL(0x009DEA60, uint16) = y + 16;
|
||||||
RCT2_GLOBAL(0x009DEA62, uint16) = z;
|
RCT2_GLOBAL(0x009DEA62, uint16) = z;
|
||||||
|
|
||||||
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR)){
|
||||||
if(!map_is_location_owned(x, y, z - 16)){
|
if (!map_is_location_owned(x, y, z - 16)){
|
||||||
*ebx = MONEY32_UNDEFINED;
|
*ebx = MONEY32_UNDEFINED;
|
||||||
return;
|
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 ||
|
|
||||||
map_element->properties.banner.position != banner_position){
|
|
||||||
map_element++;
|
|
||||||
if((map_element - 1)->flags & MAP_ELEMENT_FLAG_LAST_TILE){
|
|
||||||
*ebx = MONEY32_UNDEFINED;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rct_window* window = window_find_by_number(WC_BANNER, map_element->properties.banner.index);
|
|
||||||
if(window){
|
|
||||||
window_invalidate(window);
|
|
||||||
}
|
|
||||||
gBanners[map_element->properties.banner.index].colour = color;
|
|
||||||
map_invalidate_tile(x, y, z, z + 32);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 ||
|
||||||
|
map_element->properties.banner.position != banner_position){
|
||||||
|
map_element++;
|
||||||
|
if((map_element - 1)->flags & MAP_ELEMENT_FLAG_LAST_TILE){
|
||||||
|
*ebx = MONEY32_UNDEFINED;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rct_window* window = window_find_by_number(WC_BANNER, map_element->properties.banner.index);
|
||||||
|
if(window){
|
||||||
|
window_invalidate(window);
|
||||||
|
}
|
||||||
|
gBanners[map_element->properties.banner.index].colour = color;
|
||||||
|
map_invalidate_tile(x, y, z, z + 32);
|
||||||
|
}
|
||||||
|
|
||||||
*ebx = 0;
|
*ebx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue