Merge pull request #213 from duncanspumpkin/game_cleanup

Implemented check affordability and clean up
This commit is contained in:
Ted John 2014-07-19 11:12:36 +01:00
commit a2240932e2
4 changed files with 19 additions and 10 deletions

View File

@ -252,7 +252,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) {
@ -1639,16 +1639,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];

View File

@ -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();
void rct2_exit();

View File

@ -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;

View File

@ -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)++;