1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

game_command_remove_banner

This commit is contained in:
zsilencer
2015-04-22 01:46:44 -06:00
parent b8657da99f
commit c40a6f4789
6 changed files with 54 additions and 5 deletions

View File

@@ -925,7 +925,7 @@ static uint32 game_do_command_table[58] = {
0,
0x006CDEE4,
0x006B9E6D, // 50
0x006BA058,
0,
0,
0,
0,
@@ -988,7 +988,7 @@ static GAME_COMMAND_POINTER* new_game_command_table[58] = {
game_command_start_campaign,
game_command_emptysub,
game_command_emptysub, // 50
game_command_emptysub,
game_command_remove_banner,
game_command_set_scenery_colour,
game_command_set_fence_colour,
game_command_set_large_scenery_colour,

View File

@@ -75,7 +75,7 @@ enum GAME_COMMAND {
GAME_COMMAND_START_MARKETING_CAMPAIGN, // 48
GAME_COMMAND_49,
GAME_COMMAND_50, // New banner? (possibly scenery)
GAME_COMMAND_51, // Remove banner
GAME_COMMAND_REMOVE_BANNER, // Remove banner
GAME_COMMAND_52,
GAME_COMMAND_53,
GAME_COMMAND_54,

View File

@@ -201,7 +201,7 @@ static void window_banner_mouseup()
window_close(w);
break;
case WIDX_BANNER_DEMOLISH:
game_do_command(x, 1, y, map_element->base_height | (map_element->properties.banner.position << 8), GAME_COMMAND_51, 0, 0);
game_do_command(x, 1, y, map_element->base_height | (map_element->properties.banner.position << 8), GAME_COMMAND_REMOVE_BANNER, 0, 0);
break;
case WIDX_BANNER_TEXT:
window_text_input_open(w, WIDX_BANNER_TEXT, 2982, 2983, gBanners[w->number].string_idx, 0, 32);

View File

@@ -345,7 +345,7 @@ void remove_banners_at_element(int x, int y, rct_map_element* mapElement){
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_PATH)return;
else if (map_element_get_type(mapElement) != MAP_ELEMENT_TYPE_BANNER)continue;
game_do_command(x, 1, y, mapElement->base_height | mapElement->properties.banner.position << 8, GAME_COMMAND_51, 0, 0);
game_do_command(x, 1, y, mapElement->base_height | mapElement->properties.banner.position << 8, GAME_COMMAND_REMOVE_BANNER, 0, 0);
mapElement--;
}
}

View File

@@ -768,6 +768,54 @@ void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, i
}
}
/**
*
* rct2: 0x006BA058
*/
void game_command_remove_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp)
{
int x = *eax;
int y = *ecx;
uint8 base_height = *edx;
uint8 banner_position = *edx >> 8;
int z = base_height * 8;
RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = 12;
RCT2_GLOBAL(0x009DEA5E, uint16) = x + 16;
RCT2_GLOBAL(0x009DEA60, uint16) = y + 16;
RCT2_GLOBAL(0x009DEA62, uint16) = z;
if(!(*ebx & 0x40) && RCT2_GLOBAL(0x009DEA6E, uint8) != 0){
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED;
*ebx = MONEY32_UNDEFINED;
return;
}
if(!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) && !map_is_location_owned(x, y, z - 16)){
*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_BANNER ||
map_element->properties.banner.position != banner_position){
map_element++;
if((map_element - 1)->flags & MAP_ELEMENT_FLAG_LAST_TILE){
*ebx = 0;
return;
}
}
if(*ebx & GAME_COMMAND_FLAG_APPLY){
window_close_by_number(WC_BANNER, map_element->properties.banner.index);
rct_banner *banner = &gBanners[map_element->properties.banner.index];
user_string_free(banner->string_idx);
banner->type = BANNER_NULL;
map_invalidate_tile(x, y, z, z + 32);
map_element_remove(map_element);
}
rct_scenery_entry *scenery_entry = object_entry_groups[OBJECT_TYPE_BANNERS].chunks[map_element->properties.banner.index];
*ebx = (scenery_entry->banner.price * -3) / 4;
if(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY){
*ebx = 0;
}
}
/**
*
* rct2: 0x006E0F26

View File

@@ -276,6 +276,7 @@ int map_can_construct_at(int x, int y, int zLow, int zHigh, uint8 bl);
void game_command_remove_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
void game_command_remove_large_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
void game_command_remove_banner(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
void game_command_set_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
void game_command_set_fence_colour(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
void game_command_set_large_scenery_colour(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);