1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00

implement game_command_set_park_open

This commit is contained in:
IntelOrca
2015-01-25 00:20:53 +00:00
parent 9c3c396243
commit ba4d9b3975
5 changed files with 56 additions and 9 deletions

View File

@@ -893,7 +893,7 @@ static uint32 game_do_command_table[58] = {
0x006C0B83,
0x006C0BB5,
0x00669C6D,
0x00669D4A,
0,
0x006649BD,
0x006666E7,
0x00666A63,
@@ -956,7 +956,7 @@ static GAME_COMMAND_POINTER* new_game_command_table[58] = {
game_command_emptysub,
game_command_emptysub,
game_command_emptysub,
game_command_emptysub,
game_command_set_park_open,
game_command_emptysub,
game_command_emptysub,
game_command_emptysub,

View File

@@ -23,6 +23,7 @@
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../world/park.h"
#include "../peep/peep.h"
#include "../ride/ride.h"
#include "../scenario.h"
@@ -478,8 +479,7 @@ static void window_cheats_misc_mouseup()
w->widgets[widgetIndex].image = w->widgets[widgetIndex].image == 2767 ? 2768 : 2767;
break;
case WIDX_OPEN_CLOSE_PARK:
game_do_command(0, 1, 0, park_is_open() ? 0 : 0x101, GAME_COMMAND_SET_PARK_OPEN, 0, 0);
window_invalidate_by_class(WC_PARK_INFORMATION);
park_set_open(park_is_open() ? 0 : 1);
break;
case WIDX_DECREASE_GAME_SPEED:
game_reduce_game_speed();

View File

@@ -755,19 +755,17 @@ static void window_park_entrance_dropdown()
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
if (widgetIndex == WIDX_OPEN_OR_CLOSE) {
if (dropdownIndex == -1)
dropdownIndex = RCT2_GLOBAL(0x009DEBA2, sint16);
if (dropdownIndex != 0) {
dropdownIndex &= 0x00FF;
dropdownIndex |= 0x0100;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1724;
park_set_open(1);
} else {
dropdownIndex &= 0x00FF;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1723;
park_set_open(0);
}
game_do_command(0, 1, 0, dropdownIndex, GAME_COMMAND_SET_PARK_OPEN, 0, 0);
}
}

View File

@@ -19,6 +19,7 @@
*****************************************************************************/
#include "../addresses.h"
#include "../game.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../management/award.h"
@@ -612,4 +613,49 @@ void game_command_set_park_entrance_fee()
#else
__asm__("mov ebx, 0 ");
#endif
}
void park_set_open(int open)
{
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, open << 8, GAME_COMMAND_SET_PARK_OPEN, 0, 0);
}
/**
*
* rct2: 0x00669D4A
*/
void game_command_set_park_open(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp)
{
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
*ebx = 0;
return;
}
int dh = (*edx >> 8) & 0xFF;
RCT2_GLOBAL(0x0141F56C, uint8) = 16;
switch (dh) {
case 0:
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_OPEN) {
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_PARK_OPEN;
window_invalidate_by_class(WC_PARK_INFORMATION);
}
break;
case 1:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_PARK_OPEN)) {
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) |= PARK_FLAGS_PARK_OPEN;
window_invalidate_by_class(WC_PARK_INFORMATION);
}
break;
case 2:
RCT2_GLOBAL(0x01358838, uint32) = *edi;
window_invalidate_by_class(WC_RIDE);
break;
case 3:
RCT2_GLOBAL(0x0135934C, uint32) = *edi;
window_invalidate_by_class(WC_RIDE);
break;
}
*ebx = 0;
}

View File

@@ -61,6 +61,9 @@ void park_update_histories();
uint8 calculate_guest_initial_happiness(uint8 percentage);
void park_set_open(int open);
void game_command_set_park_entrance_fee();
void game_command_set_park_open(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
#endif