Scenery now works correctly in scenario editor

There were a couple bugs that were causing functions to return unsuccessful if you were in scenario editor.
This commit is contained in:
Duncan Frost 2015-05-07 18:57:14 +01:00
parent d9cd873ad7
commit 6b8709aed0
1 changed files with 76 additions and 68 deletions

View File

@ -749,11 +749,13 @@ 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 ||
@ -765,7 +767,7 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i
map_invalidate_tile_full(x3, y3);
map_element_remove(map_element);
}
}
i++;
}
}
@ -837,11 +839,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 +867,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 +1016,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 +1037,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 +1060,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 +1084,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;
}