mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-23 10:51:58 -05:00
fix issues with a few game commands
This commit is contained in:
parent
85d77bb838
commit
8c608b6f6c
3 changed files with 44 additions and 10 deletions
|
@ -64,6 +64,8 @@ int gGameSpeed = 1;
|
|||
float gDayNightCycle = 0;
|
||||
bool gInUpdateCode = false;
|
||||
|
||||
extern void game_command_callback_place_banner(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
|
||||
|
||||
GAME_COMMAND_CALLBACK_POINTER* game_command_callback = 0;
|
||||
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_table[] = {
|
||||
0,
|
||||
|
@ -71,6 +73,7 @@ GAME_COMMAND_CALLBACK_POINTER* game_command_callback_table[] = {
|
|||
game_command_callback_ride_construct_placed_front,
|
||||
game_command_callback_ride_construct_placed_back,
|
||||
game_command_callback_ride_remove_track_piece,
|
||||
game_command_callback_place_banner,
|
||||
};
|
||||
int game_command_playerid = -1;
|
||||
|
||||
|
@ -514,13 +517,13 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
|
|||
// Second call to actually perform the operation
|
||||
new_game_command_table[command](eax, ebx, ecx, edx, esi, edi, ebp);
|
||||
|
||||
game_command_playerid = -1;
|
||||
|
||||
if (game_command_callback) {
|
||||
if (game_command_callback && !(flags & GAME_COMMAND_FLAG_GHOST)) {
|
||||
game_command_callback(*eax, *ebx, *ecx, *edx, *esi, *edi, *ebp);
|
||||
game_command_callback = 0;
|
||||
}
|
||||
|
||||
game_command_playerid = -1;
|
||||
|
||||
*edx = *ebx;
|
||||
|
||||
if (*edx != MONEY32_UNDEFINED && *edx < cost)
|
||||
|
|
|
@ -1405,6 +1405,15 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
|
|||
}
|
||||
}
|
||||
|
||||
void game_command_callback_place_banner(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp)
|
||||
{
|
||||
if (ebx != MONEY32_UNDEFINED) {
|
||||
int bannerId = edi;
|
||||
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
window_banner_open(bannerId);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E2CC6
|
||||
|
@ -1619,13 +1628,8 @@ static void window_top_toolbar_scenery_tool_down(short x, short y, rct_window *w
|
|||
.esi = GAME_COMMAND_PLACE_BANNER,
|
||||
.edi = parameter_3
|
||||
};
|
||||
money32 cost = game_do_command_p(GAME_COMMAND_PLACE_BANNER, ®s.eax, ®s.ebx, ®s.ecx, ®s.edx, ®s.esi, ®s.edi, ®s.ebp);
|
||||
if (cost != MONEY32_UNDEFINED) {
|
||||
int bannerId = regs.edi;
|
||||
|
||||
audio_play_sound_at_location(SOUND_PLACE_ITEM, RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Y, uint16), RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_Z, uint16));
|
||||
window_banner_open(bannerId);
|
||||
}
|
||||
game_command_callback = game_command_callback_place_banner;
|
||||
game_do_command_p(GAME_COMMAND_PLACE_BANNER, ®s.eax, ®s.ebx, ®s.ecx, ®s.edx, ®s.esi, ®s.edi, ®s.ebp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4850,6 +4850,11 @@ void game_command_set_banner_name(int* eax, int* ebx, int* ecx, int* edx, int* e
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY)) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
utf8 *buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, utf8);
|
||||
utf8 *dst = buffer;
|
||||
dst = utf8_write_codepoint(dst, FORMAT_COLOUR_CODE_START + banner->text_colour);
|
||||
|
@ -4903,6 +4908,11 @@ void game_command_set_sign_name(int* eax, int* ebx, int* ecx, int* edx, int* esi
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY)) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (newName[0] != 0) {
|
||||
rct_string_id string_id = user_string_allocate(128, newName);
|
||||
if (string_id != 0) {
|
||||
|
@ -4944,6 +4954,12 @@ void game_command_set_banner_style(int* eax, int* ebx, int* ecx, int* edx, int*
|
|||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY)) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
rct_banner* banner = &gBanners[*ecx];
|
||||
|
||||
banner->colour = (uint8)*edx;
|
||||
|
@ -5037,6 +5053,12 @@ void game_command_set_sign_style(int* eax, int* ebx, int* ecx, int* edx, int* es
|
|||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY)) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
map_element->flags &= 0x9F;
|
||||
map_element->properties.fence.item[1] =
|
||||
mainColour |
|
||||
|
@ -5052,6 +5074,11 @@ void game_command_set_sign_style(int* eax, int* ebx, int* ecx, int* edx, int* es
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(*ebx & GAME_COMMAND_FLAG_APPLY)) {
|
||||
*ebx = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sign_set_colour(
|
||||
banner->x * 32,
|
||||
banner->y * 32,
|
||||
|
|
Loading…
Add table
Reference in a new issue