Merge branch 'master' of https://github.com/MaciekBaron/OpenRCT2 into MaciekBaron-master

This commit is contained in:
IntelOrca 2014-05-07 00:37:13 +01:00
commit 18d95968f2
17 changed files with 147 additions and 110 deletions

View File

@ -215,6 +215,10 @@
#define RCT2_ADDRESS_NEW_WINDOW_PTR 0x014234B8
#define RCT2_ADDRESS_VIEWPORT_LIST 0x014234BC
#define RCT2_ADDRESS_NEW_VIEWPORT_PTR 0x01423570
#define RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER 0x00F1EE06
#define RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_TAB 0x00F1EE12
#define RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_VIEW 0x00F1EE13
#define RCT2_ADDRESS_OS_TIME_MINUTE 0x01424654
#define RCT2_ADDRESS_OS_TIME_HOUR 0x01424656

View File

@ -20,6 +20,7 @@
#include "audio.h"
#include "addresses.h"
#include "rct2.h"
void get_dsound_devices()
{
@ -45,3 +46,24 @@ void sound_stop(rct_sound* sound)
{
RCT2_CALLPROC_1(0x00404DD8, rct_sound*, sound);
}
/**
*
* rct2: 0x006BABB4
*/
void pause_sounds() {
if (++RCT2_GLOBAL(0x009AF59C, uint8) == 1) {
RCT2_CALLPROC_EBPSAFE(0x006BCAE5);
RCT2_CALLPROC_EBPSAFE(0x006BABDF);
RCT2_CALLPROC_EBPSAFE(0x006BCA9F);
RCT2_CALLPROC_EBPSAFE(0x006BD07F);
}
}
/**
*
* rct2: 0x006BABD8
*/
void unpause_sounds() {
RCT2_GLOBAL(0x009AF59C, uint8)--;
}

View File

@ -48,6 +48,8 @@ int sound_prepare(int sound_id, rct_sound *sound, int var_8, int var_c);
void sound_play_panned(int sound_id, int x);
int sound_play(rct_sound* sound, int looping, int volume, int pan, int frequency);
void sound_stop(rct_sound *sound);
void pause_sounds();
void unpause_sounds();
typedef enum {
RCT2_SOUND_SCREAM = 11,

View File

@ -29,6 +29,9 @@
#include "ride.h"
#include "window.h"
#include "viewport.h"
#include "finance.h"
#include "audio.h"
#include "strings.h"
static void set_all_land_owned();
@ -49,12 +52,12 @@ void editor_load()
reset_saved_strings();
RCT2_CALLPROC_EBPSAFE(0x0069EB13); // sprites_init
ride_init_all();
RCT2_CALLPROC_EBPSAFE(0x0068F083); // window_guest_list_init_vars_a
window_guest_list_init_vars_a();
RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
park_init();
finance_init();
date_reset();
RCT2_CALLPROC_EBPSAFE(0x0068F050); // window_guest_list_init_vars_b
window_guest_list_init_vars_b();
RCT2_CALLPROC_EBPSAFE(0x006BD39C);
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_SCENARIO_EDITOR;
RCT2_GLOBAL(0x0141F570, uint8) = 0;
@ -98,12 +101,12 @@ void trackdesigner_load()
reset_saved_strings();
RCT2_CALLPROC_EBPSAFE(0x0069EB13); // reset_sprites
ride_init_all();
RCT2_CALLPROC_EBPSAFE(0x0068F083); // window_guest_list_init_vars_a
window_guest_list_init_vars_a();
RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
park_init();
finance_init();
date_reset();
RCT2_CALLPROC_EBPSAFE(0x0068F050); // window_guest_list_init_vars_b
window_guest_list_init_vars_b();
RCT2_CALLPROC_EBPSAFE(0x006BD39C);
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_DESIGNER;
RCT2_GLOBAL(0x0141F570, uint8) = 0;
@ -136,12 +139,12 @@ void trackmanager_load()
reset_saved_strings();
RCT2_CALLPROC_EBPSAFE(0x0069EB13); // reset_sprites
ride_init_all();
RCT2_CALLPROC_EBPSAFE(0x0068F083); // window_guest_list_init_vars_a
window_guest_list_init_vars_a();
RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
park_init();
finance_init();
date_reset();
RCT2_CALLPROC_EBPSAFE(0x0068F050); // window_guest_list_init_vars_b
window_guest_list_init_vars_b();
RCT2_CALLPROC_EBPSAFE(0x006BD39C);
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_MANAGER;
RCT2_GLOBAL(0x0141F570, uint8) = 0;
@ -167,87 +170,4 @@ static void set_all_land_owned()
int mapSize = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, sint16);
game_do_command(64, 1, 64, 2, 56, (mapSize - 2) * 32, (mapSize - 2) * 32);
}
/**
*
* rct2: 0x00667104
*/
void reset_park_entrances() {
RCT2_GLOBAL(0x013573D4, uint16) = 0;
for (short i = 0; i < 4; i++) {
RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[i] = 0x8000;
}
RCT2_GLOBAL(0x013573F2, uint16) = 0xFFFF;
RCT2_GLOBAL(0x013573F8, uint16) = 0xFFFF;
}
/**
*
* rct2: 0x006C4209
*/
void reset_saved_strings() {
for (int i = 0; i < 1024; i++) {
RCT2_ADDRESS(0x135A8F4, uint8)[i * 32] = 0;
}
}
/**
*
* rct2: 0x006BABB4
*/
void pause_sounds() {
if (++RCT2_GLOBAL(0x009AF59C, uint8) == 1) {
RCT2_CALLPROC_EBPSAFE(0x006BCAE5);
RCT2_CALLPROC_EBPSAFE(0x006BABDF);
RCT2_CALLPROC_EBPSAFE(0x006BCA9F);
RCT2_CALLPROC_EBPSAFE(0x006BD07F);
}
}
/**
*
* rct2: 0x006BABD8
*/
void unpause_sounds() {
RCT2_GLOBAL(0x009AF59C, uint8)--;
}
/**
*
* rct2: 0x0069DEFB
*/
void finance_init() {
for (short i = 0; i < 56; i++) {
RCT2_ADDRESS(0x01357848, uint32)[i] = 0;
}
RCT2_GLOBAL(0x0135832C, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, uint32) = 0;
RCT2_GLOBAL(0x01358334, uint32) = 0;
RCT2_GLOBAL(0x01358338, uint16) = 0;
RCT2_GLOBAL(0x013573DC, uint32) = 100000;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(100000);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, sint32) = 100000;
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, uint32) = 200000;
RCT2_GLOBAL(0x013587D0, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, uint8) = 10;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, sint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, sint32) = 0x80000000;
RCT2_GLOBAL(RCT2_ADDRESS_TOTAL_ADMISSIONS, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INCOME_FROM_ADMISSIONS, uint32) = 0;
RCT2_GLOBAL(0x013587D8, uint16) = 0x3F;
RCT2_CALLPROC_EBPSAFE(0x0069E869);
}

View File

@ -25,10 +25,5 @@ void editor_load();
void editor_convert_save_to_scenario();
void trackdesigner_load();
void trackmanager_load();
void reset_park_entrances();
void reset_saved_strings();
void pause_sounds();
void unpause_sounds();
void finance_init();
#endif

View File

@ -101,3 +101,40 @@ void finance_pay_interest()
finance_payment((sint32)tempcost, RCT_EXPENDITURE_TYPE_INTEREST);
}
/**
*
* rct2: 0x0069DEFB
*/
void finance_init() {
for (short i = 0; i < 56; i++) {
RCT2_ADDRESS(0x01357848, uint32)[i] = 0;
}
RCT2_GLOBAL(0x0135832C, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, uint32) = 0;
RCT2_GLOBAL(0x01358334, uint32) = 0;
RCT2_GLOBAL(0x01358338, uint16) = 0;
RCT2_GLOBAL(0x013573DC, uint32) = 100000;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(100000);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, sint32) = 100000;
RCT2_GLOBAL(RCT2_ADDRESS_MAXIMUM_LOAN, uint32) = 200000;
RCT2_GLOBAL(0x013587D0, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, uint8) = 10;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, sint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, sint32) = 0x80000000;
RCT2_GLOBAL(RCT2_ADDRESS_TOTAL_ADMISSIONS, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_INCOME_FROM_ADMISSIONS, uint32) = 0;
RCT2_GLOBAL(0x013587D8, uint16) = 0x3F;
RCT2_CALLPROC_EBPSAFE(0x0069E869);
}

View File

@ -36,5 +36,6 @@ void finance_payment(int amount, rct_expenditure_type type);
void finance_pay_wages();
void finance_pay_research();
void finance_pay_interest();
void finance_init();
#endif

View File

@ -1097,9 +1097,9 @@ static void game_pause_toggle()
RCT2_GLOBAL(0x009DEA6E, uint32) ^= 1;
window_invalidate_by_id(WC_TOP_TOOLBAR, 0);
if (RCT2_GLOBAL(0x009DEA6E, uint32) & 1)
RCT2_CALLPROC_EBPSAFE(0x006BABB4); // pause_sounds
pause_sounds();
else
RCT2_CALLPROC_EBPSAFE(0x006BABD8); // unpause_sounds
unpause_sounds();
}
__asm mov ebx, 0
@ -1147,9 +1147,9 @@ static int open_landscape_file_dialog()
format_string(0x0141ED68, STR_LOAD_LANDSCAPE_DIALOG_TITLE, 0);
strcpy(0x0141EF68, RCT2_ADDRESS_LANDSCAPES_PATH);
format_string(0x0141EE68, STR_RCT2_LANDSCAPE_FILE, 0);
RCT2_CALLPROC_EBPSAFE(0x006BABB4); // pause_sounds
pause_sounds();
osinterface_open_common_file_dialog(1, 0x0141ED68, 0x0141EF68, "*.SV6;*.SV4;*.SC6", 0x0141EE68);
RCT2_CALLPROC_EBPSAFE(0x006BABD8); // unpause_sounds
unpause_sounds();
// window_proc
}
@ -1162,9 +1162,9 @@ static int open_load_game_dialog()
format_string(0x0141ED68, STR_LOAD_GAME_DIALOG_TITLE, 0);
strcpy(0x0141EF68, RCT2_ADDRESS_SAVED_GAMES_PATH);
format_string(0x0141EE68, STR_RCT2_SAVED_GAME, 0);
RCT2_CALLPROC_EBPSAFE(0x006BABB4); // pause_sounds
pause_sounds();
osinterface_open_common_file_dialog(1, 0x0141ED68, 0x0141EF68, "*.SV6", 0x0141EE68);
RCT2_CALLPROC_EBPSAFE(0x006BABD8); // unpause_sounds
unpause_sounds();
// window_proc
}

View File

@ -273,3 +273,18 @@ int calculate_company_value()
return result;
}
/**
*
* rct2: 0x00667104
*/
void reset_park_entrances() {
RCT2_GLOBAL(0x013573D4, uint16) = 0;
for (short i = 0; i < 4; i++) {
RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, uint16)[i] = 0x8000;
}
RCT2_GLOBAL(0x013573F2, uint16) = 0xFFFF;
RCT2_GLOBAL(0x013573F8, uint16) = 0xFFFF;
}

View File

@ -74,5 +74,6 @@ int park_calculate_size();
int calculate_park_rating();
int calculate_park_value();
int calculate_company_value();
void reset_park_entrances();
#endif

View File

@ -123,11 +123,11 @@ void rct2_init()
viewport_init_all();
news_item_init_queue();
get_local_time();
RCT2_CALLPROC_EBPSAFE(0x00667104);
RCT2_CALLPROC_EBPSAFE(0x006C4209);
reset_park_entrances();
reset_saved_strings();
RCT2_CALLPROC_EBPSAFE(0x0069EB13);
ride_init_all();
RCT2_CALLPROC_EBPSAFE(0x0068F083); // window guest list init vars a
window_guest_list_init_vars_a();
RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
map_init();
park_init();
@ -136,7 +136,7 @@ void rct2_init()
climate_reset(CLIMATE_COOL_AND_WET);
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
RCT2_CALLPROC_EBPSAFE(0x006ACA58);
RCT2_CALLPROC_EBPSAFE(0x0068F050); // window guest list init vars b
window_guest_list_init_vars_b();
RCT2_CALLPROC_EBPSAFE(0x006BD39C);
title_load();

View File

@ -124,3 +124,13 @@ void generate_string_file()
fclose(f);
}
/**
*
* rct2: 0x006C4209
*/
void reset_saved_strings() {
for (int i = 0; i < 1024; i++) {
RCT2_ADDRESS(0x135A8F4, uint8)[i * 32] = 0;
}
}

View File

@ -25,6 +25,7 @@ typedef unsigned short rct_string_id;
void format_string(char *dest, rct_string_id format, void *args);
void generate_string_file();
void reset_saved_strings();
enum {
FORMAT_TINYFONT = 7,

View File

@ -34,6 +34,7 @@
#include "scenario.h"
#include "strings.h"
#include "viewport.h"
#include "editor.h"
static const int gOldMusic = 0;
static const int gRandomShowcase = 0;
@ -91,11 +92,11 @@ void title_load()
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TITLE_DEMO;
RCT2_CALLPROC_EBPSAFE(0x00667104);
RCT2_CALLPROC_EBPSAFE(0x006C4209);
reset_park_entrances();
reset_saved_strings();
RCT2_CALLPROC_EBPSAFE(0x0069EB13);
ride_init_all();
RCT2_CALLPROC_EBPSAFE(0x0068F083); // window_guest_list_init_vars_a
window_guest_list_init_vars_a();
RCT2_CALLPROC_EBPSAFE(0x006BD3A4);
map_init();
park_init();
@ -103,7 +104,7 @@ void title_load()
RCT2_CALLPROC_X(0x006C45ED, 0, 0, 0, 0, 0, 0, 0);
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
RCT2_CALLPROC_EBPSAFE(0x006ACA58);
RCT2_CALLPROC_EBPSAFE(0x0068F050); // window_guest_list_init_vars_b
window_guest_list_init_vars_b();
RCT2_CALLPROC_EBPSAFE(0x006BD39C);
RCT2_CALLPROC_EBPSAFE(0x0068AFFD);
RCT2_CALLPROC_EBPSAFE(0x0069EBE4);

View File

@ -1179,4 +1179,28 @@ void tool_cancel()
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_ABORT], 0, 0, 0, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), w, 0, 0);
}
}
}
/**
*
* rct2: 0x0068F083
*/
void window_guest_list_init_vars_a() {
RCT2_GLOBAL(0x013B0E6C, uint32) = 1;
RCT2_GLOBAL(0x00F1AF1C, uint32) = 0xFFFFFFFF;
RCT2_GLOBAL(0x00F1EE02, uint32) = 0xFFFFFFFF;
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER, uint8) = 0xFF;
}
/**
*
* rct2: 0x0068F050
*/
void window_guest_list_init_vars_b() {
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_TAB, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_VIEW, uint8) = 0;
RCT2_GLOBAL(0x00F1AF1C, uint32) = 0xFFFFFFFF;
RCT2_GLOBAL(0x00F1EE02, uint32) = 0xFFFFFFFF;
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER, uint8) = 0xFF;
RCT2_GLOBAL(0x00F1AF20, uint16) = 0;
}

View File

@ -347,4 +347,7 @@ void window_park_objective_open();
void window_ride_list_open();
void window_cheats_open();
void window_guest_list_init_vars_a();
void window_guest_list_init_vars_b();
#endif

View File

@ -26,6 +26,7 @@
#include "tutorial.h"
#include "widget.h"
#include "window.h"
#include "audio.h"
static enum WINDOW_SAVE_PROMPT_WIDGET_IDX {
WIDX_BACKGROUND,
@ -118,7 +119,7 @@ void window_save_prompt_open()
// Pause the game
RCT2_GLOBAL(0x009DEA6E, uint8) |= 2;
RCT2_CALLPROC_EBPSAFE(0x006BABB4);
pause_sounds();
window_invalidate_by_id(0x80 | WC_TOP_TOOLBAR, 0);
}
@ -161,7 +162,7 @@ static void window_save_prompt_close()
{
// Unpause the game
RCT2_GLOBAL(0x009DEA6E, uint8) &= ~2;
RCT2_CALLPROC_EBPSAFE(0x006BABD8);
unpause_sounds();
window_invalidate_by_id(0x80 | WC_TOP_TOOLBAR, 0);
}