From 7a60b0d53b25c842c58d4a9d1d739b6ff2e25913 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Mon, 14 Jul 2014 19:46:45 +0100 Subject: [PATCH] Implemented check affordability and cleanedup some function calls to use openrct --- src/game.c | 17 +++++++++++------ src/game.h | 3 +++ src/screenshot.c | 3 ++- src/title.c | 6 +++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/game.c b/src/game.c index 65b25027f6..da32409add 100644 --- a/src/game.c +++ b/src/game.c @@ -231,7 +231,7 @@ void game_handle_input() if (RCT2_GLOBAL(0x009DEA64, uint16) & 2) { RCT2_GLOBAL(0x009DEA64, uint16) &= ~2; - RCT2_CALLPROC_X(0x006677F2, 0, 1, 0, 0, 5, 2, 0); + game_do_command(0, 1, 0, 0, 5, 2, 0); } if (RCT2_GLOBAL(0x009ABDF2, uint8) != 0) { @@ -1617,16 +1617,21 @@ void game_handle_keyboard_input() /** * - * rct2: 0x006677F2 + * rct2: 0x0069C62C * * @param cost (ebp) */ static int game_check_affordability(int cost) { - int eax, ebx, ecx, edx, esi, edi, ebp; - ebp = cost; - RCT2_CALLFUNC_X(0x0069C62C, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); - return ebp; + if (cost <= 0)return cost; + if (RCT2_GLOBAL(0x141F568, uint8) & 0xF0)return cost; + + if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32)&(1 << 8))){ + if (cost <= (sint32)(DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32))))return cost; + } + RCT2_GLOBAL(0x13CE952, uint32) = cost; + RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 827; + return 0x80000000; } static uint32 game_do_command_table[58]; diff --git a/src/game.h b/src/game.h index 47d7f51ceb..7eecf29f77 100644 --- a/src/game.h +++ b/src/game.h @@ -25,11 +25,14 @@ void game_create_windows(); void game_update(); void game_logic_update(); void sub_0x0069E9A7(); +void update_rain_animation(); +void update_water_animation(); int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp); void game_load_or_quit_no_save_prompt(); int game_load_save(); +void game_pause_toggle(); char save_game(); #endif diff --git a/src/screenshot.c b/src/screenshot.c index 6db7d4f2bb..bae591dd53 100644 --- a/src/screenshot.c +++ b/src/screenshot.c @@ -25,6 +25,7 @@ #include "addresses.h" #include "config.h" #include "gfx.h" +#include "game.h" #include "rct2.h" #include "screenshot.h" #include "string_ids.h" @@ -47,7 +48,7 @@ void screenshot_check() if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) != 0) { RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8)--; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, uint8) == 0) { - RCT2_CALLPROC_EBPSAFE(0x00684218); + update_rain_animation(); screenshotIndex = screenshot_dump(); RCT2_GLOBAL(0x013CE952, uint16) = STR_SCR_BMP; RCT2_GLOBAL(0x013CE952 + 2, uint16) = screenshotIndex; diff --git a/src/title.c b/src/title.c index 06a451667e..bd318a3688 100644 --- a/src/title.c +++ b/src/title.c @@ -91,7 +91,7 @@ static void title_create_windows(); void title_load() { if (RCT2_GLOBAL(0x009DEA6E, uint8) & 1) - RCT2_CALLPROC_X(0x00667C15, 0, 1, 0, 0, 0, 0, 0); + RCT2_CALLPROC_X(0x00667C15, 0, 1, 0, 0, 0, 0, 0);//Game pause toggle RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TITLE_DEMO; @@ -289,8 +289,8 @@ void title_update() // RCT2_CALLPROC_EBPSAFE(0x006EA627); // window_manager_handle_input(); game_handle_input(); - RCT2_CALLPROC_EBPSAFE(0x006838BD); - RCT2_CALLPROC_EBPSAFE(0x00684218); + update_water_animation(); + update_rain_animation(); if (RCT2_GLOBAL(0x009AAC73, uint8) != 255) { RCT2_GLOBAL(0x009AAC73, uint8)++;