1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Merge remote-tracking branch 'upstream/master'

Conflicts:
	src/config.c
This commit is contained in:
Jørn Lomax
2014-05-12 17:31:25 +02:00
62 changed files with 2093 additions and 583 deletions

View File

@@ -74,7 +74,6 @@
<ClCompile Include="..\src\sawyercoding.c" />
<ClCompile Include="..\src\scenario.c" />
<ClCompile Include="..\src\screenshot.c" />
<ClCompile Include="..\src\settings.c" />
<ClCompile Include="..\src\strings.c" />
<ClCompile Include="..\src\title.c" />
<ClCompile Include="..\src\track.c" />
@@ -84,6 +83,7 @@
<ClCompile Include="..\src\widget.c" />
<ClCompile Include="..\src\window.c" />
<ClCompile Include="..\src\window_about.c" />
<ClCompile Include="..\src\window_banner.c" />
<ClCompile Include="..\src\window_cheats.c" />
<ClCompile Include="..\src\window_clear_scenery.c" />
<ClCompile Include="..\src\window_error.c" />
@@ -93,9 +93,13 @@
<ClCompile Include="..\src\window_land.c" />
<ClCompile Include="..\src\window_news.c" />
<ClCompile Include="..\src\window_park.c" />
<ClCompile Include="..\src\window_finances.c" />
<ClCompile Include="..\src\window_footpath.c" />
<ClCompile Include="..\src\window_new_ride.c" />
<ClCompile Include="..\src\window_options.c" />
<ClCompile Include="..\src\window_ride_list.c" />
<ClCompile Include="..\src\window_save_prompt.c" />
<ClCompile Include="..\src\window_staff.c" />
<ClCompile Include="..\src\window_title_exit.c" />
<ClCompile Include="..\src\window_title_logo.c" />
<ClCompile Include="..\src\window_main.c" />
@@ -155,6 +159,7 @@
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -167,13 +172,15 @@
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<SDLCheck>
</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>1Byte</StructMemberAlignment>
<TreatSpecificWarningsAsErrors>4013</TreatSpecificWarningsAsErrors>
<OmitFramePointers>
</OmitFramePointers>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

View File

@@ -269,9 +269,6 @@
<ClCompile Include="..\src\window_save_prompt.c">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\settings.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\window_news.c">
<Filter>Windows</Filter>
</ClCompile>
@@ -281,6 +278,21 @@
<ClCompile Include="..\src\finance.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\window_finances.c">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\window_staff.c">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\window_banner.c">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\window_new_ride.c">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\window_options.c">
<Filter>Windows</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\openrct2.exe">

View File

@@ -120,6 +120,9 @@
#define RCT2_ADDRESS_WINDOW_DPI 0x009DEA74
#define RCT2_ADDRESS_NUM_DSOUND_DEVICES 0x009E2B88
#define RCT2_ADDRESS_DSOUND_DEVICES 0x009E2B8C
#define RCT2_ADDRESS_CMDLINE 0x009E2D98
#define RCT2_ADDRESS_LAND_RAISE_COST 0x009E2E1C
@@ -154,8 +157,11 @@
#define RCT2_ADDRESS_OBJECTIVE_YEAR 0x013580F9
#define RCT2_ADDRESS_OBJECTIVE_CURRENCY 0x013580FC
#define RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS 0x01358100
#define RCT2_ADDRESS_BALANCE_HISTORY 0x0135812C
#define RCT2_ADDRESS_CURRENT_PROFIT 0x01358330
#define RCT2_ADDRESS_WEEKLY_PROFIT_HISTORY 0x0135833C
#define RCT2_ADDRESS_CURRENT_PARK_VALUE 0x0135853C
#define RCT2_ADDRESS_PARK_VALUE_HISTORY 0x01358540
#define RCT2_ADDRESS_COMPLETED_COMPANY_VALUE 0x01358740
#define RCT2_ADDRESS_TOTAL_ADMISSIONS 0x01358744
#define RCT2_ADDRESS_INCOME_FROM_ADMISSIONS 0x01358748
@@ -165,6 +171,11 @@
#define RCT2_ADDRESS_CURRENT_INTEREST_RATE 0x0135934A
#define RCT2_ADDRESS_EXPENDITURE_TABLE 0x01357848
#define RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL 0x013573FF
#define RCT2_ADDRESS_HANDYMAN_COLOUR 0x01357BCD
#define RCT2_ADDRESS_MECHANIC_COLOUR 0x01357BCE
#define RCT2_ADDRESS_SECURITY_COLOUR 0x01357BCF
#define RCT2_ADDRESS_CURRENT_INTEREST_RATE 0x0135934A
#define RCT2_ADDRESS_MAP_SIZE 0x01358834
@@ -209,8 +220,6 @@
#define RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID 0x0141E9AE
#define RCT2_ADDRESS_CURRENT_ROTATION 0x0141E9E0
#define RCT2_ADDRESS_SCENARIO_NAME 0x0141F5B8
#define RCT2_ADDRESS_WATER_RAISE_COST 0x0141F738
#define RCT2_ADDRESS_WATER_LOWER_COST 0x0141F73C
@@ -229,6 +238,8 @@
#define RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB 0x00F4390A
#define RCT2_ADDRESS_WINDOW_MAP_SELECTED_TAB 0x014209E4
#define RCT2_ADDRESS_OS_TIME_MINUTE 0x01424654
#define RCT2_ADDRESS_OS_TIME_HOUR 0x01424656
#define RCT2_ADDRESS_OS_TIME_DAY 0x01424304

View File

@@ -25,6 +25,9 @@
#include "addresses.h"
#include "config.h"
#include "rct2.h"
#include <tchar.h>
#include "osinterface.h"
// Current keyboard shortcuts
uint16 gShortcutKeys[SHORTCUT_COUNT];
@@ -142,10 +145,10 @@ void config_save()
HANDLE hFile;
DWORD bytesWritten;
hFile = CreateFile(get_file_path(PATH_ID_GAMECFG), GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(get_file_path(PATH_ID_GAMECFG), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
WriteFile(hFile, &MagicNumber, 4, &bytesWritten, NULL);
WriteFile(hFile, 0x009AAC5C, 2155, &bytesWritten, NULL);
WriteFile(hFile, (LPCVOID)0x009AAC5C, 2155, &bytesWritten, NULL);
CloseHandle(hFile);
}
}
@@ -154,6 +157,7 @@ void config_save()
general_configuration_t gGeneral_config;
static char *config_show_directory_browser();
static void config_parse_settings(FILE *fp);
static int config_get_line(FILE *fp, char *setting, char *value);
static int config_parse_setting(FILE *fp, char *setting);
@@ -178,7 +182,7 @@ void config_init()
DWORD dwAttrib = GetFileAttributes(path);
if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) { // folder does not exist
if (!CreateDirectory(path, NULL)) {
config_error("Could not create config file (do you have write acces to you documents folder?)");
config_error("Could not create config file (do you have write access to your documents folder?)");
}
}
strcat(path, "\\config.ini");
@@ -236,9 +240,11 @@ static void config_create_default(char *path)
{
FILE* fp;
if (!config_find_rct2_path(gGeneral_config.game_path)) {
MessageBox(NULL, "Unable to find RCT2 installation directory. Please correct in config.ini.", "OpenRCT2", MB_OK);
strcpy(gGeneral_config.game_path, "C:\\");
if (!config_find_rct2_path(gConfig.game_path)) {
osinterface_show_messagebox("Unable to find RCT2 installation directory. Please select the directory where you installed RCT2!");
char *res = osinterface_open_directory_browser("Please select your RCT2 directory");
strcpy(gConfig.game_path, res);
}
fp = fopen(path, "w");
@@ -253,13 +259,14 @@ static void config_create_default(char *path)
fclose(fp);
}
/**
* Parse settings and set the game veriables
* @param fp file pointer to the settings file
*/
static void config_parse_settings(FILE *fp)
{
int c = NULL, pos = 0;
int pos = 0;
char *setting;
char *value;
char *section;
@@ -428,36 +435,36 @@ static int config_parse_setting(FILE *fp, char *setting){
* @param value a pointer to where to store the value
* @return < 0 if EOF is reached
*/
static int config_parse_value(FILE *fp, char *value){
static int config_parse_value(FILE *fp, char *value)
{
long start, end;
int size, c, pos = 0;
start = ftell(fp);
c = fgetc(fp);
while (isspace(c)){
while (isspace(c)) {
start = ftell(fp);
c = fgetc(fp);
}
while (c != EOF && c != '\n'){
while (c != EOF && c != '\n') {
c = fgetc(fp);
}
end = ftell(fp);
size = end - start;
if (size > MAX_CONFIG_LENGTH){
if (size > MAX_CONFIG_LENGTH)
config_error("One of your settings is too long");
}
fseek(fp, start, SEEK_SET);
c = fgetc(fp);
while (c != EOF && c != '\n'){
while (c != EOF && c != '\n') {
value[pos] = (char)c;
c = fgetc(fp);
pos++;
}
value[pos] = '\0';
return;
return 0;
}
/**
@@ -540,8 +547,10 @@ static int config_parse_currency(char* currency){
* @param msg Message to print in message box
*/
static void config_error(char *msg){
MessageBox(NULL, msg, "OpenRCT2", MB_OK);
exit(-1);
osinterface_show_messagebox(msg);
//TODO:SHUT DOWN EVERYTHING!
}

View File

@@ -58,11 +58,11 @@ void editor_load()
finance_init();
date_reset();
window_guest_list_init_vars_b();
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN;
window_staff_init_vars();
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_SCENARIO_EDITOR;
RCT2_GLOBAL(0x0141F570, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
window_ride_list_init_vars();
window_new_ride_init_vars();
RCT2_GLOBAL(0x0141F571, uint8) = 4;
viewport_init_all();
news_item_init_queue();
@@ -107,10 +107,10 @@ void trackdesigner_load()
finance_init();
date_reset();
window_guest_list_init_vars_b();
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN;
window_staff_init_vars();
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_DESIGNER;
RCT2_GLOBAL(0x0141F570, uint8) = 0;
window_ride_list_init_vars();
window_new_ride_init_vars();
viewport_init_all();
news_item_init_queue();
RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create
@@ -145,10 +145,10 @@ void trackmanager_load()
finance_init();
date_reset();
window_guest_list_init_vars_b();
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN;
window_staff_init_vars();
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_TRACK_MANAGER;
RCT2_GLOBAL(0x0141F570, uint8) = 0;
window_ride_list_init_vars();
window_new_ride_init_vars();
viewport_init_all();
news_item_init_queue();
RCT2_CALLPROC_EBPSAFE(0x0066EF38); // window_main_editor_create

View File

@@ -23,6 +23,7 @@
#include "sprite.h"
#include "park.h"
#include "peep.h"
#include "ride.h"
#include "window.h"
// monthly cost
@@ -102,6 +103,35 @@ void finance_pay_interest()
finance_payment((sint32)tempcost, RCT_EXPENDITURE_TYPE_INTEREST);
}
/**
*
* rct2: 0x006AC885
*/
void finance_pay_ride_upkeep()
{
rct_ride* ride;
for (int i = 0; i < MAX_RIDES; i++) {
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->type == RIDE_TYPE_NULL)
continue;
if (!(ride->var_1D0 & 0x1000)) {
ride->build_date = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
ride->var_196 = 25855; // durability?
}
if (ride->status != RIDE_STATUS_CLOSED && !(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800)) {
sint16 upkeep = ride->upkeep_cost;
if (upkeep != -1) {
ride->var_158 -= upkeep;
ride->var_14D |= 2;
finance_payment(upkeep, RCT2_EXPENDITURE_TYPE_RIDE_UPKEEP);
}
}
}
}
/**
*
* rct2: 0x0069DEFB

View File

@@ -23,9 +23,12 @@
#include "rct2.h"
#define CURRENCY(whole, fraction) ((whole) * 10 + ((fraction) / 10))
typedef int rct_expenditure_type;
enum {
RCT2_EXPENDITURE_TYPE_RIDE_UPKEEP = 1,
RCT_EXPENDITURE_TYPE_WAGES = 10,
RCT_EXPENDITURE_TYPE_RESEARCH = 12,
RCT_EXPENDITURE_TYPE_INTEREST = 13
@@ -36,6 +39,7 @@ void finance_payment(int amount, rct_expenditure_type type);
void finance_pay_wages();
void finance_pay_research();
void finance_pay_interest();
void finance_pay_ride_upkeep();
void finance_init();
#endif

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* Copyright (c) 2014 Ted John, Peter Hill
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
@@ -195,13 +195,14 @@ void game_handle_input()
if (RCT2_GLOBAL(0x009ABDF2, uint8) != 0) {
for (w = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window); w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++)
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_07], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_07], 0, 0, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_EBPSAFE(0x006EA73F);
RCT2_CALLPROC_EBPSAFE(0x006E8346); // update_cursor_position
{
int eax, ebx, ecx, edx, esi, edi, ebp;
// int eax, ebx, ecx, edx, esi, edi, ebp;
int eax, ebx, ecx;
for (;;) {
game_get_next_input(&eax, &ebx, &ecx);
@@ -228,7 +229,7 @@ void game_handle_input()
}
for (w = RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_LIST, rct_window); w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++)
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_08], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_08], 0, 0, 0, 0, (int)w, 0, 0);
}
/**
@@ -288,11 +289,9 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex);
*/
static void game_handle_input_mouse(int x, int y, int state)
{
rct_window *w, *w2;
rct_window *w;
rct_widget *widget;
int widgetIndex;
rct_windowclass windowClass;
rct_windownumber windowNumber;
// Get window and widget under cursor position
w = window_find_from_point(x, y);
@@ -347,7 +346,7 @@ static void game_handle_input_mouse(int x, int y, int state)
break;
case INPUT_STATE_WIDGET_PRESSED:
RCT2_CALLPROC_X(0x006E8DA7, x, y, state, widgetIndex, w, widget, 0);
RCT2_CALLPROC_X(0x006E8DA7, x, y, state, widgetIndex, (int)w, (int)widget, 0);
break;
case INPUT_STATE_DRAGGING:
// RCT2_CALLPROC_X(0x006E8C5C, x, y, state, widgetIndex, w, widget, 0);
@@ -370,7 +369,7 @@ static void game_handle_input_mouse(int x, int y, int state)
} else if (state == 2) {
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = INPUT_STATE_NORMAL;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, sint16);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, sint16);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER, rct_windownumber) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber);
y = clamp(29, y, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 34);
@@ -382,7 +381,7 @@ static void game_handle_input_mouse(int x, int y, int state)
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_X, sint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, sint16) = y;
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_18], 0, 0, x, y, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_18], 0, 0, x, y, (int)w, 0, 0);
}
break;
case INPUT_STATE_VIEWPORT_DRAG:
@@ -460,13 +459,13 @@ static void game_handle_input_mouse(int x, int y, int state)
break;
}
case INPUT_STATE_DROPDOWN_ACTIVE:
RCT2_CALLPROC_X(0x006E8DA7, x, y, state, widgetIndex, w, widget, 0);
RCT2_CALLPROC_X(0x006E8DA7, x, y, state, widgetIndex, (int)w, (int)widget, 0);
break;
case INPUT_STATE_VIEWPORT_LEFT:
RCT2_CALLPROC_X(0x006E87B4, x, y, state, widgetIndex, w, widget, 0);
RCT2_CALLPROC_X(0x006E87B4, x, y, state, widgetIndex, (int)w, (int)widget, 0);
break;
case INPUT_STATE_SCROLL_LEFT:
RCT2_CALLPROC_X(0x006E8676, x, y, state, widgetIndex, w, widget, 0);
RCT2_CALLPROC_X(0x006E8676, x, y, state, widgetIndex, (int)w, (int)widget, 0);
break;
case INPUT_STATE_RESIZING:
// RCT2_CALLPROC_X(0x006E8B46, x, y, state, widgetIndex, w, widget, 0);
@@ -482,7 +481,7 @@ static void game_handle_input_mouse(int x, int y, int state)
if (state == 2) {
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = INPUT_STATE_NORMAL;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, sint16);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, sint16);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, rct_windowclass) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER, rct_windownumber) = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber);
}
@@ -498,7 +497,7 @@ static void game_handle_input_mouse(int x, int y, int state)
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, sint16) = y;
break;
case 9:
RCT2_CALLPROC_X(0x006E8ACB, x, y, state, widgetIndex, w, widget, 0);
RCT2_CALLPROC_X(0x006E8ACB, x, y, state, widgetIndex, (int)w, (int)widget, 0);
break;
}
}
@@ -527,8 +526,8 @@ static void input_mouseover(int x, int y, rct_window *w, int widgetIndex)
int eax, ebx, ecx, edx, esi, edi, ebp;
eax = x;
ebx = y;
esi = w;
edi = widget;
esi = (int)w;
edi = (int)widget;
RCT2_CALLFUNC_X(0x006E9F92, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); // widget_scoll_get_part
eax &= 0xFFFF;
ebx &= 0xFFFF;
@@ -537,7 +536,7 @@ static void input_mouseover(int x, int y, rct_window *w, int widgetIndex)
if (ecx < 0)
goto showTooltip;
if (ecx == 0) {
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_MOUSEOVER], edx, 0, eax, ebx, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_MOUSEOVER], edx, 0, eax, ebx, (int)w, 0, 0);
goto showTooltip;
} else {
@@ -585,8 +584,6 @@ static void input_mouseover(int x, int y, rct_window *w, int widgetIndex)
*/
static void input_mouseover_widget_check(rct_windowclass windowClass, rct_windownumber windowNumber, int widgetIndex)
{
rct_window *w;
// Check if widget cursor was over has changed
if (windowClass != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) ||
windowNumber != RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber) ||
@@ -597,8 +594,8 @@ static void input_mouseover_widget_check(rct_windowclass windowClass, rct_window
// Set new cursor over widget
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass) = windowClass;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windowclass) = windowNumber;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, rct_windowclass) = widgetIndex;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber) = windowNumber;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, uint16) = widgetIndex;
// Invalidate new widget cursor is on if widget is a flat button
if (windowClass != 255)
@@ -612,7 +609,7 @@ static void input_mouseover_widget_flatbutton_invalidate()
if (w == NULL)
return;
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
if (w->widgets[RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, rct_windownumber)].type == WWT_FLATBTN)
widget_invalidate(RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass), RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber), RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, rct_windownumber));
}
@@ -676,7 +673,7 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
if (w == NULL)
break;
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_DOWN], x, y, 0, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_DOWN], x, y, 0, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), (int)w, 0, 0);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 4);
break;
case WWT_CAPTION:
@@ -698,8 +695,8 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
int eax, ebx, ecx, edx, esi, edi, ebp;
eax = x;
ebx = y;
esi = w;
edi = widget;
esi = (int)w;
edi = (int)widget;
RCT2_CALLFUNC_X(0x006E9F92, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); // widget_scoll_get_part
eax &= 0xFFFF;
ebx &= 0xFFFF;
@@ -708,42 +705,42 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
RCT2_GLOBAL(0x009DE548, uint16) = ecx;
RCT2_GLOBAL(0x009DE54C, uint32) = edx;
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_15], RCT2_GLOBAL(0x009DE54C, uint32), ebx, ecx, edx, w, widget, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_15], RCT2_GLOBAL(0x009DE54C, uint32), ebx, ecx, edx, (int)w, (int)widget, 0);
switch (ecx) {
case SCROLL_PART_VIEW:
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_MOUSEDOWN], edx / sizeof(rct_scroll), ebx, eax, ebx, w, widget, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_MOUSEDOWN], edx / sizeof(rct_scroll), ebx, eax, ebx, (int)w, (int)widget, 0);
break;
case SCROLL_PART_HSCROLLBAR_LEFT:
// 0x006E9A60
RCT2_CALLPROC_X(0x006E9A60, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006E9A60, 0, 0, 0, 0, (int)w, 0, 0);
break;
case SCROLL_PART_HSCROLLBAR_RIGHT:
// 0x006E9ABF
RCT2_CALLPROC_X(0x006E9ABF, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006E9ABF, 0, 0, 0, 0, (int)w, 0, 0);
break;
case SCROLL_PART_HSCROLLBAR_LEFT_TROUGH:
// 0x006E9B47
RCT2_CALLPROC_X(0x006E9B47, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006E9B47, 0, 0, 0, 0, (int)w, 0, 0);
break;
case SCROLL_PART_HSCROLLBAR_RIGHT_TROUGH:
// 0x006E9BB7
RCT2_CALLPROC_X(0x006E9BB7, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006E9BB7, 0, 0, 0, 0, (int)w, 0, 0);
break;
case SCROLL_PART_VSCROLLBAR_TOP:
// 0x006E9C37
RCT2_CALLPROC_X(0x006E9C37, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006E9C37, 0, 0, 0, 0, (int)w, 0, 0);
break;
case SCROLL_PART_VSCROLLBAR_BOTTOM:
// 0x006E9C96
RCT2_CALLPROC_X(0x006E9C96, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006E9C96, 0, 0, 0, 0, (int)w, 0, 0);
break;
case SCROLL_PART_VSCROLLBAR_TOP_TROUGH:
// 0x006E9D1E
RCT2_CALLPROC_X(0x006E9D1E, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006E9D1E, 0, 0, 0, 0, (int)w, 0, 0);
break;
case SCROLL_PART_VSCROLLBAR_BOTTOM_TROUGH:
// 0x006E9D8E
RCT2_CALLPROC_X(0x006E9D8E, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006E9D8E, 0, 0, 0, 0, (int)w, 0, 0);
break;
}
break;
@@ -757,14 +754,14 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
// Set new cursor down widget
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, rct_windowclass) = windowClass;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windowclass) = windowNumber;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, rct_windowclass) = widgetIndex;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, rct_windownumber) = windowNumber;
RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WIDGETINDEX, uint16) = widgetIndex;
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 0);
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = INPUT_STATE_WIDGET_PRESSED;
RCT2_GLOBAL(0x009DE528, uint16) = 1;
widget_invalidate(windowClass, windowNumber, widgetIndex);
RCT2_CALLPROC_X(w->event_handlers[WE_MOUSE_DOWN], 0, 0, 0, widgetIndex, w, widget, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_MOUSE_DOWN], 0, 0, 0, widgetIndex, (int)w, (int)widget, 0);
break;
}
}
@@ -866,6 +863,228 @@ int get_next_key()
return 0;
}
void handle_shortcut_command(int shortcutIndex)
{
rct_window *window;
switch (shortcutIndex) {
case SHORTCUT_CLOSE_TOP_MOST_WINDOW:
window_close_top();
break;
case SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2))
window_close_all();
else if (RCT2_GLOBAL(0x0141F570, uint8) == 1)
window_close_top();
break;
case SHORTCUT_CANCEL_CONSTRUCTION_MODE:
window = window_find_by_id(WC_ERROR, 0);
if (window != NULL)
window_close(window);
else if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
tool_cancel();
break;
case SHORTCUT_PAUSE_GAME:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 10)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 0, WE_MOUSE_UP);
}
}
break;
case SHORTCUT_ZOOM_VIEW_OUT:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 2, WE_MOUSE_UP);
}
}
}
break;
case SHORTCUT_ZOOM_VIEW_IN:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 3, WE_MOUSE_UP);
}
}
}
break;
case SHORTCUT_ROTATE_VIEW:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 8)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 4, WE_MOUSE_UP);
}
}
}
break;
case SHORTCUT_ROTATE_CONSTRUCTION_OBJECT:
RCT2_CALLPROC_EBPSAFE(0x006E4182);
break;
case SHORTCUT_UNDERGROUND_VIEW_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 0, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_REMOVE_BASE_LAND_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 1, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_REMOVE_VERTICAL_LAND_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 2, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_SEE_THROUGH_RIDES_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 4, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_SEE_THROUGH_SCENERY_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 5, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_INVISIBLE_SUPPORTS_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 6, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_INVISIBLE_PEOPLE_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 7, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_HEIGHT_MARKS_ON_LAND_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 9, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_HEIGHT_MARKS_ON_RIDE_TRACKS_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 10, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_HEIGHT_MARKS_ON_PATHS_TOGGLE:
RCT2_CALLPROC_X(0x0066CF8A, 11, 0, 0, 0, 0, 0, 0);
break;
case SHORTCUT_ADJUST_LAND:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 7, WE_MOUSE_UP);
}
}
}
break;
case SHORTCUT_ADJUST_WATER:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 8, WE_MOUSE_UP);
}
}
}
break;
case SHORTCUT_BUILD_SCENERY:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 9, WE_MOUSE_UP);
}
}
}
break;
case SHORTCUT_BUILD_PATHS:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 10, WE_MOUSE_UP);
}
}
}
break;
case SHORTCUT_BUILD_NEW_RIDE:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 11, WE_MOUSE_UP);
}
}
}
break;
case SHORTCUT_SHOW_FINANCIAL_INFORMATION:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800))
RCT2_CALLPROC_EBPSAFE(0x0069DDF1);
break;
case SHORTCUT_SHOW_RESEARCH_INFORMATION:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
// Open new ride window
RCT2_CALLPROC_EBPSAFE(0x006B3CFF);
window = window_find_by_id(WC_CONSTRUCT_RIDE, 0);
if (window != NULL)
window_event_helper(window, 10, WE_MOUSE_DOWN);
}
break;
case SHORTCUT_SHOW_RIDES_LIST:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 12, WE_MOUSE_UP);
}
}
break;
case SHORTCUT_SHOW_PARK_INFORMATION:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 13, WE_MOUSE_UP);
}
}
break;
case SHORTCUT_SHOW_GUEST_LIST:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 15, WE_MOUSE_UP);
}
}
break;
case SHORTCUT_SHOW_STAFF_LIST:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 14, WE_MOUSE_UP);
}
}
break;
case SHORTCUT_SHOW_RECENT_MESSAGES:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0E))
window_news_open();
break;
case SHORTCUT_SHOW_MAP:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_GLOBAL(0x0141F570, uint8) == 1) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C)) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
window_event_helper(window, 6, WE_MOUSE_UP);
}
}
}
break;
case SHORTCUT_SCREENSHOT:
RCT2_CALLPROC_EBPSAFE(0x006E4034); // set screenshot countdown to 2
break;
}
}
/**
*
* rct2: 0x006E3E68
@@ -873,9 +1092,9 @@ int get_next_key()
void handle_shortcut(int key)
{
int i;
for (i = 0; i < 32; i++) {
for (i = 0; i < SHORTCUT_COUNT; i++) {
if (key == gShortcutKeys[i]) {
RCT2_CALLPROC_EBPSAFE(RCT2_ADDRESS(0x006E3FB4, uint32)[i]);
handle_shortcut_command(i);
break;
}
}
@@ -911,7 +1130,7 @@ void set_shortcut(int key)
void game_handle_keyboard_input()
{
rct_window *w;
int key, i;
int key;
// Handle mouse scrolling
if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) == 0)
@@ -960,7 +1179,7 @@ void game_handle_keyboard_input()
if (RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & 4) {
window_tooltip_close();
if ((w = window_get_main()) != NULL) {
RCT2_CALLPROC_X(0x006EA2AA, 0, 0, 0, 0, w, RCT2_GLOBAL(0x009DEA72, uint16), 0);
RCT2_CALLPROC_X(0x006EA2AA, 0, 0, 0, 0, (int)w, RCT2_GLOBAL(0x009DEA72, uint16), 0);
RCT2_GLOBAL(0x009DEA72, uint16)++;
}
}
@@ -968,7 +1187,7 @@ void game_handle_keyboard_input()
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PLACE_OBJECT_MODIFIER, uint8) & 4)) {
window_tooltip_close();
if ((w = window_get_main()) != NULL) {
RCT2_CALLPROC_X(0x006EA2AA, 0, 0, 0, 0, w, RCT2_GLOBAL(0x009DEA72, uint16), 0);
RCT2_CALLPROC_X(0x006EA2AA, 0, 0, 0, 0, (int)w, RCT2_GLOBAL(0x009DEA72, uint16), 0);
RCT2_GLOBAL(0x009DEA72, uint16)++;
}
}
@@ -1089,9 +1308,7 @@ int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int eb
*/
static void game_pause_toggle()
{
rct_window *w;
char input_bl, input_dl;
short input_di;
char input_bl;
__asm mov input_bl, bl
@@ -1113,7 +1330,6 @@ static void game_pause_toggle()
*/
static void game_load_or_quit()
{
rct_window *w;
char input_bl, input_dl;
short input_di;
@@ -1122,7 +1338,7 @@ static void game_load_or_quit()
__asm mov input_di, di
if (!(input_bl & 1))
return 0;
return; // 0;
switch (input_dl) {
case 0:
@@ -1146,13 +1362,15 @@ static void game_load_or_quit()
*/
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);
int result;
format_string((char*)0x0141ED68, STR_LOAD_LANDSCAPE_DIALOG_TITLE, 0);
strcpy((char*)0x0141EF68, (char*)RCT2_ADDRESS_LANDSCAPES_PATH);
format_string((char*)0x0141EE68, STR_RCT2_LANDSCAPE_FILE, 0);
pause_sounds();
osinterface_open_common_file_dialog(1, 0x0141ED68, 0x0141EF68, "*.SV6;*.SV4;*.SC6", 0x0141EE68);
result = osinterface_open_common_file_dialog(1, (char*)0x0141ED68, (char*)0x0141EF68, "*.SV6;*.SV4;*.SC6", (char*)0x0141EE68);
unpause_sounds();
// window_proc
return result;
}
/**
@@ -1162,11 +1380,11 @@ static int open_landscape_file_dialog()
static int open_load_game_dialog()
{
int result;
format_string(0x0141ED68, STR_LOAD_GAME_DIALOG_TITLE, 0);
strcpy(0x0141EF68, RCT2_ADDRESS_SAVED_GAMES_PATH);
format_string(0x0141EE68, STR_RCT2_SAVED_GAME, 0);
format_string((char*)0x0141ED68, STR_LOAD_GAME_DIALOG_TITLE, 0);
strcpy((char*)0x0141EF68, (char*)RCT2_ADDRESS_SAVED_GAMES_PATH);
format_string((char*)0x0141EE68, STR_RCT2_SAVED_GAME, 0);
pause_sounds();
result = osinterface_open_common_file_dialog(1, 0x0141ED68, 0x0141EF68, "*.SV6", 0x0141EE68);
result = osinterface_open_common_file_dialog(1, (char*)0x0141ED68, (char*)0x0141EF68, "*.SV6", (char*)0x0141EE68);
unpause_sounds();
// window_proc
return result;
@@ -1182,7 +1400,7 @@ static void load_landscape()
gfx_invalidate_screen();
} else {
// Set default filename
char *esi = 0x0141EF67;
char *esi = (char*)0x0141EF67;
while (1) {
esi++;
if (*esi == '.')
@@ -1192,7 +1410,7 @@ static void load_landscape()
strcpy(esi, ".SC6");
break;
}
strcpy(0x009ABB37, 0x0141EF68);
strcpy((char*)0x009ABB37, (char*)0x0141EF68);
RCT2_CALLPROC_EBPSAFE(0x006758C0); // landscape_load
if (1) {
@@ -1234,11 +1452,11 @@ int game_load_save()
return 0;
}
rct_s6_header *s6Header = 0x009E34E4;
rct_s6_info *s6Info = 0x0141F570;
rct_s6_header *s6Header = (rct_s6_header*)0x009E34E4;
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
// Read first chunk
sawyercoding_read_chunk(hFile, s6Header);
sawyercoding_read_chunk(hFile, (uint8*)s6Header);
if (s6Header->type == S6_TYPE_SAVEDGAME) {
// Read packed objects
if (s6Header->num_packed_objects > 0) {
@@ -1253,14 +1471,14 @@ int game_load_save()
object_read_and_load_entries(hFile);
// Read flags (16 bytes)
sawyercoding_read_chunk(hFile, RCT2_ADDRESS_CURRENT_MONTH_YEAR);
sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_CURRENT_MONTH_YEAR);
// Read map elements
memset(RCT2_ADDRESS_MAP_ELEMENTS, 0, MAX_MAP_ELEMENTS * sizeof(rct_map_element));
sawyercoding_read_chunk(hFile, RCT2_ADDRESS_MAP_ELEMENTS);
memset((void*)RCT2_ADDRESS_MAP_ELEMENTS, 0, MAX_MAP_ELEMENTS * sizeof(rct_map_element));
sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_MAP_ELEMENTS);
// Read game data, including sprites
sawyercoding_read_chunk(hFile, 0x010E63B8);
sawyercoding_read_chunk(hFile, (uint8*)0x010E63B8);
CloseHandle(hFile);
@@ -1298,7 +1516,7 @@ int game_load_save()
RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
window_ride_list_init_vars();
window_new_ride_init_vars();
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
if (RCT2_GLOBAL(0x0013587C4, uint32) == 0) // this check is not in scenario play
RCT2_CALLPROC_EBPSAFE(0x0069E869);
@@ -1318,7 +1536,7 @@ static void load_game()
gfx_invalidate_screen();
} else {
// Set default filename
char *esi = 0x0141EF67;
char *esi = (char*)0x0141EF67;
while (1) {
esi++;
if (*esi == '.')
@@ -1328,7 +1546,7 @@ static void load_game()
strcpy(esi, ".SV6");
break;
}
strcpy(0x009ABB37, 0x0141EF68);
strcpy((char*)0x009ABB37, (char*)0x0141EF68);
if (game_load_save()) {
gfx_invalidate_screen();
@@ -1380,10 +1598,10 @@ void game_load_or_quit_no_save_prompt()
static uint32 game_do_command_table[58] = {
0x006B2FC5,
0x0066397F,
game_pause_toggle,
(uint32)game_pause_toggle,
0x006C511D,
0x006C5B69,
game_load_or_quit,
(uint32)game_load_or_quit,
0x006B3F0F,
0x006B49D9,
0x006B4EA6,

147
src/gfx.c
View File

@@ -98,8 +98,53 @@ void gfx_draw_pixel(rct_drawpixelinfo *dpi, int x, int y, int colour)
gfx_fill_rect(dpi, x, y, x, y, colour);
}
/*
* Draws a horizontal line of specified colour to a buffer.
* rct2: 0x68474C
*/
void gfx_draw_line_on_buffer(rct_drawpixelinfo *dpi, char colour, int y, int x, int no_pixels)
{
y -= dpi->y;
//Check to make sure point is in the y range
if (y < 0)return;
if (y >= dpi->height)return;
//Check to make sure we are drawing at least a pixel
if (!no_pixels) return;
no_pixels++;
x -= dpi->x;
//If x coord outside range leave
if (x < 0){
//Unless the number of pixels is enough to be in range
no_pixels += x;
if (no_pixels <= 0)return;
//Resets starting point to 0 as we don't draw outside the range
x = 0;
}
//Ensure that the end point of the line is within range
if (x + no_pixels - dpi->width > 0){
//If the end point has any pixels outside range
//cut them off. If there are now no pixels return.
no_pixels -= x + no_pixels - dpi->width;
if (no_pixels <= 0)return;
}
char* bits_pointer;
//Get the buffer we are drawing to and move to the first coordinate.
bits_pointer = dpi->bits + y*(dpi->pitch + dpi->width) + x;
//Draw the line to the specified colour
for (; no_pixels > 0; --no_pixels, ++bits_pointer){
*((uint8*)bits_pointer) = colour;
}
}
/**
*
* Draws a line on dpi if within dpi boundaries
* rct2: 0x00684466
* dpi (edi)
* x1 (ax)
@@ -110,7 +155,78 @@ void gfx_draw_pixel(rct_drawpixelinfo *dpi, int x, int y, int colour)
*/
void gfx_draw_line(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int colour)
{
RCT2_CALLPROC_X(0x00684466, x1, y1, x2, y2, 0, dpi, colour);
// Check to make sure the line is within the drawing area
if ((x1 < dpi->x) && (x2 < dpi->x)){
return;
}
if ((y1 < dpi->y) && (y2 < dpi->y)){
return;
}
if ((x1 >(dpi->x + dpi->width)) && (x2 >(dpi->x + dpi->width))){
return;
}
if ((y1 > (dpi->y + dpi->height)) && (y2 > (dpi->y + dpi->height))){
return;
}
//Bresenhams algorithm
//If vertical plot points upwards
int steep = abs(y2 - y1) > abs(x2 - x1);
if (steep){
int temp_y2 = y2;
int temp_x2 = x2;
y2 = x1;
x2 = y1;
y1 = temp_x2;
x1 = temp_y2;
}
//If line is right to left swap direction
if (x1 > x2){
int temp_y2 = y2;
int temp_x2 = x2;
y2 = y1;
x2 = x1;
y1 = temp_y2;
x1 = temp_x2;
}
int delta_x = x2 - x1;
int delta_y = abs(y2 - y1);
int error = delta_x / 2;
int y_step;
int y = y1;
//Direction of step
if (y1 < y2)y_step = 1;
else y_step = -1;
for (int x = x1, x_start = x1, no_pixels = 1; x < x2; ++x,++no_pixels){
//Vertical lines are drawn 1 pixel at a time
if (steep)gfx_draw_line_on_buffer(dpi, colour, x, y, 1);
error -= delta_y;
if (error < 0){
//Non vertical lines are drawn with as many pixels in a horizontal line as possible
if (!steep)gfx_draw_line_on_buffer(dpi, colour, y, x_start, no_pixels);
//Reset non vertical line vars
x_start = x + 1;
no_pixels = 1;
y += y_step;
error += delta_x;
}
//Catch the case of the last line
if (x + 1 == x2 && !steep){
gfx_draw_line_on_buffer(dpi, colour, y, x_start, no_pixels);
}
}
return;
}
/**
@@ -125,7 +241,7 @@ void gfx_draw_line(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int c
*/
void gfx_fill_rect(rct_drawpixelinfo *dpi, int left, int top, int right, int bottom, int colour)
{
RCT2_CALLPROC_X(0x00678AD4, left, right, top, bottom, 0, dpi, colour);
RCT2_CALLPROC_X(0x00678AD4, left, right, top, bottom, 0, (int)dpi, colour);
}
/**
@@ -141,7 +257,7 @@ void gfx_fill_rect(rct_drawpixelinfo *dpi, int left, int top, int right, int bot
*/
void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, short left, short top, short right, short bottom, int colour, short _si)
{
RCT2_CALLPROC_X(0x006E6F81, left, right, top, bottom, _si, dpi, colour);
RCT2_CALLPROC_X(0x006E6F81, left, right, top, bottom, _si, (int)dpi, colour);
}
/**
@@ -153,7 +269,7 @@ void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, short left, short top, short ri
*/
void gfx_draw_sprite(rct_drawpixelinfo *dpi, int image_id, int x, int y)
{
RCT2_CALLPROC_X(0x0067A28E, 0, image_id, x, y, 0, dpi, 0);
RCT2_CALLPROC_X(0x0067A28E, 0, image_id, x, y, 0, (int)dpi, 0);
}
/**
@@ -196,7 +312,7 @@ void gfx_transpose_palette(int pal, unsigned char product)
*/
void gfx_draw_string_centred(rct_drawpixelinfo *dpi, int format, int x, int y, int colour, void *args)
{
RCT2_CALLPROC_X(0x006C1D6C, colour, format, x, y, args, dpi, 0);
RCT2_CALLPROC_X(0x006C1D6C, colour, format, x, y, (int)args, (int)dpi, 0);
}
/**
@@ -253,7 +369,6 @@ void gfx_set_dirty_blocks(int left, int top, int right, int bottom)
void gfx_draw_all_dirty_blocks()
{
int x, y, xx, yy, columns, rows;
short left, top, right, bottom;
uint8 *screenDirtyBlocks = RCT2_ADDRESS(0x00EDE408, uint8);
for (x = 0; x < RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32); x++) {
@@ -346,7 +461,7 @@ int gfx_get_string_width(char *buffer)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
esi = buffer;
esi = (int)buffer;
RCT2_CALLFUNC_X(0x006C2321, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
return ecx & 0xFFFF;
@@ -366,7 +481,7 @@ int gfx_get_string_width(char *buffer)
*/
void gfx_draw_string_left_clipped(rct_drawpixelinfo* dpi, int format, void* args, int colour, int x, int y, int width)
{
RCT2_CALLPROC_X(0x006C1B83, colour, format, x, y, args, dpi, width);
RCT2_CALLPROC_X(0x006C1B83, colour, format, x, y, (int)args, (int)dpi, width);
//char* buffer;
@@ -391,7 +506,7 @@ void gfx_draw_string_left_clipped(rct_drawpixelinfo* dpi, int format, void* args
*/
void gfx_draw_string_centred_clipped(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y, int width)
{
RCT2_CALLPROC_X(0x006C1BBA, colour, format, x, y, args, dpi, width);
RCT2_CALLPROC_X(0x006C1BBA, colour, format, x, y, (int)args, (int)dpi, width);
//char* buffer;
//short text_width;
@@ -452,8 +567,8 @@ int gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, int x, i
ebx = format;
ecx = x;
edx = y;
esi = args;
edi = dpi;
esi = (int)args;
edi = (int)dpi;
ebp = width;
RCT2_CALLFUNC_X(0x006C1E53, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
@@ -479,8 +594,8 @@ int gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *format, int x, in
ebx = colour;
ecx = x;
edx = y;
esi = format;
edi = dpi;
esi = (int)format;
edi = (int)dpi;
ebp = width;
RCT2_CALLFUNC_X(0x006C2105, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
@@ -523,8 +638,8 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *format, int colour, int x, in
ebx = 0;
ecx = x;
edx = y;
esi = format;
edi = dpi;
esi = (int)format;
edi = (int)dpi;
ebp = 0;
RCT2_CALLFUNC_X(0x00682702, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);

View File

@@ -146,7 +146,6 @@ void map_update_tile_pointers()
*/
int map_element_height(int x, int y)
{
int i;
rct_map_element *mapElement;
// Off the map
@@ -298,13 +297,13 @@ void sub_68B089()
i++;
if (i >= MAX_TILE_MAP_ELEMENT_POINTERS)
i = 0;
} while (TILE_MAP_ELEMENT_POINTER(i) == 0xFFFFFFFF);
} while (TILE_MAP_ELEMENT_POINTER(i) == TILE_UNDEFINED_MAP_ELEMENT);
RCT2_GLOBAL(0x0010E63B8, uint32) = i;
mapElementFirst = mapElement = TILE_MAP_ELEMENT_POINTER(i);
do {
mapElement--;
if (mapElement < RCT2_ADDRESS_MAP_ELEMENTS)
if (mapElement < (rct_map_element*)RCT2_ADDRESS_MAP_ELEMENTS)
break;
} while (mapElement->base_height == 255);
mapElement++;

View File

@@ -180,7 +180,7 @@ enum {
#define MAX_MAP_ELEMENTS 196608
#define MAX_TILE_MAP_ELEMENT_POINTERS (256 * 256)
#define TILE_UNDEFINED_MAP_ELEMENT -1
#define TILE_UNDEFINED_MAP_ELEMENT (rct_map_element*)-1
void map_init();
void map_update_tile_pointers();

View File

@@ -191,7 +191,7 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
*z = map_element_height(*x, *y);
break;
case NEWS_ITEM_PEEP_ON_RIDE:
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]);
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]).peep;
*x = peep->x;
*y = peep->y;
*z = peep->z;
@@ -212,16 +212,16 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int *
}
// Find the first car of the train peep is on
car = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[ride->train_car_map[peep->current_train]]);
car = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[ride->train_car_map[peep->current_train]]).car;
// Find the actual car peep is on
for (i = 0; i < peep->current_car; i++)
car = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[car->next_car]);
car = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[car->next_car]).car;
*x = car->x;
*y = car->y;
*z = car->z;
break;
case NEWS_ITEM_PEEP:
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]);
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]).peep;
*x = peep->x;
*y = peep->y;
*z = peep->z;
@@ -252,7 +252,7 @@ void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc)
// find first open slot
while (newsItem->type != NEWS_ITEM_NULL) {
if (newsItem + sizeof(newsItem) >= 0x13CB1CC)
if (newsItem + sizeof(newsItem) >= (rct_news_item*)0x13CB1CC)
news_item_close_current();
else
newsItem++;
@@ -263,12 +263,12 @@ void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc)
newsItem->flags = 0;
newsItem->assoc = assoc;
newsItem->ticks = 0;
newsItem->month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
newsItem->day = (days_in_month[(newsItem->month & 7)] * RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16)) >> 16;
newsItem->month_year = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
newsItem->day = (days_in_month[(newsItem->month_year & 7)] * RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16)) >> 16;
format_string(0x0141EF68, string_id, 0x013CE952); // overflows possible?
format_string((char*)0x0141EF68, string_id, (void*)0x013CE952); // overflows possible?
newsItem->colour = ((char*)0x0141EF68)[0];
strncpy(newsItem->text, 0x0141EF68, 255);
strncpy(newsItem->text, (char*)0x0141EF68, 255);
newsItem->text[254] = 0;
// blatant disregard for what happens on the last element.
@@ -276,3 +276,71 @@ void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc)
newsItem++;
newsItem->type = 0;
}
/**
* Opens the window/tab for the subject of the news item
*
* rct2: 0x0066EBE6
*
**/
void news_item_open_subject(int type, int subject) {
int eax;
rct_peep* peep;
rct_window* window;
switch (type) {
case NEWS_ITEM_RIDE:
RCT2_CALLPROC_X(0x006ACC28, subject, 0, 0, 0, 0, 0, 0);
break;
case NEWS_ITEM_PEEP_ON_RIDE:
case NEWS_ITEM_PEEP:
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]).peep;
RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, (int)peep, 0, 0, 0);
break;
case NEWS_ITEM_MONEY:
// Open finances window
RCT2_CALLPROC_EBPSAFE(0x0069DDF1);
break;
case NEWS_ITEM_RESEARCH:
if (subject >= 0x10000) {
// Open ride list window
RCT2_CALLPROC_EBPSAFE(0x006B3CFF);
eax = (subject & 0xFF00) >> 8;
eax += (subject & 0xFF) << 8;
// Switch to right tab and scroll to ride location
RCT2_CALLPROC_X(0x006B3EBA, eax, 0, subject, 0, 0, 0, 0);
break;
}
// Check if window is already open
window = window_bring_to_front_by_id(WC_SCENERY, 0);
if (window == NULL) {
window = window_find_by_id(WC_TOP_TOOLBAR, 0);
if (window != NULL) {
window_invalidate(window);
if (tool_set(window, 9, 0)){
RCT2_CALLPROC_X(0x006E1172, (subject & 0xFFFF), 0, subject, 0, 0, 0, 0);
}
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
// Open scenery window
RCT2_CALLPROC_EBPSAFE(0x006E0FEF);
}
}
// Switch to new scenery tab
RCT2_CALLPROC_X(0x006E1172, (subject & 0xFFFF), 0, subject, 0, 0, 0, 0);
break;
case NEWS_ITEM_PEEPS:
// Open guest list to right tab
RCT2_CALLPROC_X(0x006993BA, 3, subject, 0, 0, 0, 0, 0);
break;
case NEWS_ITEM_AWARD:
window_park_awards_open();
break;
case NEWS_ITEM_GRAPH:
window_park_rating_open();
break;
}
}

View File

@@ -33,7 +33,7 @@ enum {
NEWS_ITEM_PEEP,
NEWS_ITEM_MONEY,
NEWS_ITEM_BLANK,
NEWS_ITEM_SCENERY,
NEWS_ITEM_RESEARCH,
NEWS_ITEM_PEEPS,
NEWS_ITEM_AWARD,
NEWS_ITEM_GRAPH
@@ -48,8 +48,7 @@ typedef struct {
uint8 flags; // 0x01
uint32 assoc; // 0x02
uint16 ticks; // 0x06
uint8 month; // 0x08
uint8 pad_09; // 0x09
uint16 month_year; // 0x08
uint8 day; // 0x0A
uint8 pad_0B; // 0x0B
uint8 colour; // 0x0C
@@ -61,5 +60,6 @@ void news_item_update_current();
void news_item_close_current();
void news_item_get_subject_location(int type, int subject, int *x, int *y, int *z);
void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc);
void news_item_open_subject(int type, int subject);
#endif

View File

@@ -34,7 +34,7 @@ void object_load_list()
*
* rct2: 0x006AA0C6
*/
void object_read_and_load_entries(HFILE hFile)
void object_read_and_load_entries(HANDLE hFile)
{
RCT2_CALLPROC_EBPSAFE(0x006AA0C6);

View File

@@ -35,7 +35,7 @@ typedef struct {
} rct_object_entry;
void object_load_list();
void object_read_and_load_entries(HFILE hFile);
void object_read_and_load_entries(HANDLE hFile);
int object_load_packed();
#endif

View File

@@ -19,6 +19,8 @@
*****************************************************************************/
#include <stdio.h>
#include <shlobj.h>
#include <tchar.h>
#include <windows.h>
#include <SDL.h>
#include <SDL_syswm.h>
@@ -31,8 +33,8 @@
typedef void(*update_palette_func)(char*, int, int);
openrct2_cursor gCursorState;
unsigned char* gKeysState;
unsigned char* gKeysPressed;
const unsigned char *gKeysState;
unsigned char *gKeysPressed;
unsigned int gLastKeyPressed;
static void osinterface_create_window();
@@ -323,12 +325,12 @@ int osinterface_open_common_file_dialog(int type, char *title, char *filename, c
openFileName.lpstrTitle = title;
// Copy filter name
strcpy(0x01423800, filterName);
strcpy((char*)0x01423800, filterName);
// Copy filter pattern
strcpy(0x01423800 + strlen(filterName) + 1, filterPattern);
strcpy((char*)0x01423800 + strlen(filterName) + 1, filterPattern);
*((char*)(0x01423800 + strlen(filterName) + 1 + strlen(filterPattern) + 1)) = 0;
openFileName.lpstrFilter = 0x01423800;
openFileName.lpstrFilter = (char*)0x01423800;
//
tmp = RCT2_GLOBAL(0x009E2C74, uint32);
@@ -348,4 +350,49 @@ int osinterface_open_common_file_dialog(int type, char *title, char *filename, c
RCT2_GLOBAL(0x009E2C74, uint32) = tmp;
return result;
}
}
void osinterface_show_messagebox(char* message){
MessageBox(NULL, message, "OpenRCT2", MB_OK);
}
char* osinterface_open_directory_browser(char *title) {
BROWSEINFO bi;
char pszBuffer[MAX_PATH];
LPITEMIDLIST pidl;
LPMALLOC lpMalloc;
// Initialize COM
if (CoInitializeEx(0, COINIT_APARTMENTTHREADED) != S_OK) {
MessageBox(NULL, _T("Error opening browse window"), _T("ERROR"), MB_OK);
CoUninitialize();
return 0;
}
// Get a pointer to the shell memory allocator
if (SHGetMalloc(&lpMalloc) != S_OK) {
MessageBox(NULL, _T("Error opening browse window"), _T("ERROR"), MB_OK);
CoUninitialize();
return 0;
}
bi.hwndOwner = NULL;
bi.pidlRoot = NULL;
bi.pszDisplayName = pszBuffer;
bi.lpszTitle = _T(title);
bi.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
bi.lParam = 0;
char *outPath = "C:\\";
if (pidl = SHBrowseForFolder(&bi)) {
// Copy the path directory to the buffer
if (SHGetPathFromIDList(pidl, pszBuffer)) {
// Store pszBuffer (and the path) in the outPath
outPath = strcat("", pszBuffer);
}
}
CoUninitialize();
return outPath;
}

View File

@@ -37,8 +37,8 @@ typedef struct {
} openrct2_cursor;
extern openrct2_cursor gCursorState;
extern unsigned char* gKeysState;
extern unsigned char* gKeysPressed;
extern const unsigned char *gKeysState;
extern unsigned char *gKeysPressed;
extern unsigned int gLastKeyPressed;
void osinterface_init();
@@ -47,5 +47,7 @@ void osinterface_draw();
void osinterface_free();
int osinterface_open_common_file_dialog(int type, char *title, char *filename, char *filterPattern, char *filterName);
void osinterface_show_messagebox(char* message);
char* osinterface_open_directory_browser(char *title);
#endif

View File

@@ -19,11 +19,14 @@
*****************************************************************************/
#include "addresses.h"
#include "finance.h"
#include "map.h"
#include "park.h"
#include "peep.h"
#include "ride.h"
#include "scenario.h"
#include "sprite.h"
#include "strings.h"
#include "window.h"
int park_is_open()
@@ -37,7 +40,84 @@ int park_is_open()
*/
void park_init()
{
RCT2_CALLPROC_EBPSAFE(0x00667132);
int i;
RCT2_GLOBAL(0x013CA740, uint8) = 0;
RCT2_GLOBAL(0x013573D4, uint16) = 777;
RCT2_GLOBAL(RCT2_ADDRESS_HANDYMAN_COLOUR, uint8) = 28;
RCT2_GLOBAL(RCT2_ADDRESS_MECHANIC_COLOUR, uint8) = 28;
RCT2_GLOBAL(RCT2_ADDRESS_SECURITY_COLOUR, uint8) = 28;
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16) = 0;
RCT2_GLOBAL(0x01357BC8, uint16) = 0;
RCT2_GLOBAL(0x01357846, uint16) = 0;
RCT2_GLOBAL(0x013573FE, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, uint16) = 0;
RCT2_GLOBAL(0x013580EC, uint16) = 0;
RCT2_GLOBAL(0x013580EE, uint16) = 0;
RCT2_GLOBAL(0x01357CF4, sint32) = -1;
for (i = 0; i < 20; i++)
RCT2_ADDRESS(0x01358102, uint8)[i] = 0;
RCT2_GLOBAL(0x01358844, uint32) = 0xFFFFFFFF;
RCT2_GLOBAL(0x01358849, uint32) = 0xFFFFFFFE;
RCT2_GLOBAL(0x0135884E, uint32) = 0xFFFFFFFD;
finance_init();
for (i = 0; i < 2; i++)
RCT2_ADDRESS(0x01357404, uint32)[i] = 0;
for (i = 0; i < 56; i++)
RCT2_ADDRESS(0x01357BD0, sint32)[i] = -1;
RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16) = CURRENCY(10, 00);
RCT2_GLOBAL(0x013573F2, sint16) = -1;
RCT2_GLOBAL(0x013573F8, sint16) = -1;
RCT2_GLOBAL(0x01357CF2, uint16) = 127;
RCT2_GLOBAL(0x013573FF, uint8) = 2;
RCT2_GLOBAL(0x013580F4, uint16) = 500;
RCT2_GLOBAL(0x013580E9, uint8) = 128;
RCT2_GLOBAL(0x013580F6, uint8) = 200;
RCT2_GLOBAL(0x013580F7, uint8) = 200;
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) = 1;
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_YEAR, uint8) = 4;
RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS, uint16) = 1000;
RCT2_GLOBAL(0x01358770, uint16) = 900;
RCT2_GLOBAL(0x01358772, uint16) = 400;
RCT2_GLOBAL(0x01358774, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = PARK_FLAGS_11 | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
park_reset_awards_and_history();
rct_s6_info *info = (rct_s6_info*)0x0141F570;
info->name[0] = '\0';
format_string(info->details, STR_NO_DETAILS_YET, NULL);
}
/**
*
* rct2: 0x0066729F
*/
void park_reset_awards_and_history()
{
int i;
// Reset park rating and guests in park history
for (i = 0; i < 32; i++) {
RCT2_ADDRESS(RCT2_ADDRESS_PARK_RATING_HISTORY, uint8)[i] = 255;
RCT2_ADDRESS(RCT2_ADDRESS_GUESTS_IN_PARK_HISTORY, uint8)[i] = 255;
}
// Reset finance history
for (i = 0; i < 128; i++) {
RCT2_ADDRESS(RCT2_ADDRESS_BALANCE_HISTORY, uint32)[i] = 0x80000000;
RCT2_ADDRESS(RCT2_ADDRESS_WEEKLY_PROFIT_HISTORY, uint32)[i] = 0x80000000;
RCT2_ADDRESS(RCT2_ADDRESS_PARK_VALUE_HISTORY, uint32)[i] = 0x80000000;
}
// Reset awards
for (i = 0; i < 4; i++)
RCT2_ADDRESS(RCT2_ADDRESS_AWARD_LIST, rct_award)[i].time = 0;
}
/**

View File

@@ -59,7 +59,8 @@ enum {
PARK_FLAGS_FORBID_HIGH_CONSTRUCTION = (1 << 5), // below tree height
PARK_FLAGS_PREF_LESS_INTENSE_RIDES = (1 << 6),
PARK_FLAGS_FORBID_MARKETING_CAMPAIGN = (1 << 7),
PARK_FLAGS_PREF_MORE_INTENSE_RIDES = (1 << 11),
PARK_FLAGS_PREF_MORE_INTENSE_RIDES = (1 << 8),
PARK_FLAGS_11 = (1 << 11),
PARK_FLAGS_DIFFICULT_GUEST_GENERATION = (1 << 12),
PARK_FLAGS_PARK_FREE_ENTRY = (1 << 13),
PARK_FLAGS_DIFFICULT_PARK_RATING = (1 << 14),
@@ -69,6 +70,7 @@ enum {
int park_is_open();
void park_init();
void park_reset_awards_and_history();
int park_calculate_size();
int calculate_park_rating();

View File

@@ -63,11 +63,11 @@ void peep_update_all()
sprite_index = peep->next;
if ((i & 0x7F) != (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, uint32) & 0x7F)) {
RCT2_CALLPROC_X(0x0068FC1E, 0, 0, 0, 0, peep, 0, 0);
RCT2_CALLPROC_X(0x0068FC1E, 0, 0, 0, 0, (int)peep, 0, 0);
} else {
RCT2_CALLPROC_X(0x0068F41A, 0, 0, 0, i, peep, 0, 0);
RCT2_CALLPROC_X(0x0068F41A, 0, 0, 0, i, (int)peep, 0, 0);
if (peep->var_08 == 4)
RCT2_CALLPROC_X(0x0068FC1E, 0, 0, 0, 0, peep, 0, 0);
RCT2_CALLPROC_X(0x0068FC1E, 0, 0, 0, 0, (int)peep, 0, 0);
}
i++;

View File

@@ -388,7 +388,9 @@ typedef struct {
uint8 no_of_food; // 0xEC
uint8 no_of_drinks; // 0xED
uint8 no_of_souvenirs; // 0xEE
uint8 pad_EF[0x07];
uint8 pad_EF[0x04];
uint8 var_F3;
uint8 pad_F4[0x02];
uint8 balloon_colour; // 0xF6
uint8 umbrella_colour; // 0xF7
uint8 hat_colour; // 0xF8

View File

@@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable : 4996) // GetVersionExA deprecated
#include <string.h>
#include <setjmp.h>
@@ -43,7 +43,6 @@
#include "title.h"
#include "track.h"
#include "viewport.h"
#include "settings.h"
void rct2_init_directories();
@@ -135,9 +134,9 @@ void rct2_init()
date_reset();
climate_reset(CLIMATE_COOL_AND_WET);
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
window_ride_list_init_vars();
window_new_ride_init_vars();
window_guest_list_init_vars_b();
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN;
window_staff_init_vars();
title_load();
@@ -151,7 +150,7 @@ void rct2_init_directories()
// check install directory
DWORD dwAttrib = GetFileAttributes(gGeneral_config.game_path);
if (dwAttrib == INVALID_FILE_ATTRIBUTES || !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) {
MessageBox(NULL, "Invalid RCT2 installation path. Please correct in config.ini.", "OpenRCT2", MB_OK);
osinterface_show_messagebox("Invalid RCT2 installation path. Please correct in config.ini.");
exit(-1);
}
@@ -231,16 +230,16 @@ void check_cmdline_arg()
}
processed_arg[j ++] = 0;
if(!stricmp(processed_arg + last_period, "sv6"))
if (!_stricmp(processed_arg + last_period, "sv6"))
{
strcpy(0x00141EF68, processed_arg);
strcpy((char*)0x00141EF68, processed_arg);
game_load_save();
}
else if(!stricmp(processed_arg + last_period, "sc6"))
else if (!_stricmp(processed_arg + last_period, "sc6"))
{
//TODO: scenario install
}
else if(!stricmp(processed_arg + last_period, "td6") || !stricmp(processed_arg + last_period, "td4"))
else if (!_stricmp(processed_arg + last_period, "td6") || !_stricmp(processed_arg + last_period, "td4"))
{
//TODO: track design install
}
@@ -321,7 +320,7 @@ void get_system_info()
GetSystemInfo(&sysInfo);
// RCT2 only has 2 bytes reserved for OEM_ID even though it should be a DWORD
RCT2_GLOBAL(RCT2_ADDRESS_SYS_OEM_ID, uint16) = sysInfo.dwOemId;
RCT2_GLOBAL(RCT2_ADDRESS_SYS_OEM_ID, uint16) = (uint16)sysInfo.dwOemId;
RCT2_GLOBAL(RCT2_ADDRESS_SYS_CPU_LEVEL, uint16) = sysInfo.wProcessorLevel;
RCT2_GLOBAL(RCT2_ADDRESS_SYS_CPU_REVISION, uint16) = sysInfo.wProcessorRevision;
RCT2_GLOBAL(RCT2_ADDRESS_SYS_CPU_NUMBER, uint32) = sysInfo.dwNumberOfProcessors;
@@ -332,9 +331,9 @@ void get_system_info()
RCT2_GLOBAL(RCT2_ADDRESS_MEM_TOTAL_VIRTUAL, uint32) = memInfo.dwTotalVirtual;
uint32 size = 80;
GetUserName(RCT2_ADDRESS_OS_USER_NAME, &size);
GetUserName((char*)RCT2_ADDRESS_OS_USER_NAME, &size);
size = 80;
GetComputerName(RCT2_ADDRESS_OS_COMPUTER_NAME, &size);
GetComputerName((char*)RCT2_ADDRESS_OS_COMPUTER_NAME, &size);
// Screen Display Width/Height but RCT_ADDRESS_SCREEN_HEIGHT/WIDTH already taken?
RCT2_GLOBAL(0x01423C08, sint32) = GetSystemMetrics(SM_CXSCREEN);

View File

@@ -20,6 +20,9 @@
#include "addresses.h"
#include "ride.h"
#include "sprite.h"
#include "peep.h"
#include "window.h"
#define GET_RIDE(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[x]))
#define GET_RIDE_MEASUREMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_MEASUREMENTS, rct_ride_measurement)[x]))
@@ -150,3 +153,50 @@ void ride_init_all()
ride_measurement->var_00 = 0xFF;
}
}
/**
*
* rct2: 0x006B7A38
*/
void reset_all_ride_build_dates() {
int i;
rct_ride *ride;
for (i = 0; i < MAX_RIDES; i++) {
ride = GET_RIDE(i);
if (ride->type != RIDE_TYPE_NULL) {
//mov ax, current_month_year
//sub [esi + 180h], ax
ride->build_date -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16);
}
}
}
/**
* rct2: 0x006AC916
*/
void ride_update_favourited_stat()
{
rct_ride *ride;
rct_peep* peep;
for (int i = 0; i < MAX_RIDES; i++) {
ride = GET_RIDE(i);
if (ride->type != RIDE_TYPE_NULL)
ride->guests_favourite = 0;
}
for (int sprite_idx = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_idx != SPRITE_INDEX_NULL; sprite_idx = peep->next) {
peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[sprite_idx].peep);
if (peep->var_08 != 4)
return;
if (peep->favourite_ride != 0xff) {
ride = GET_RIDE(peep->favourite_ride);
ride->guests_favourite++;
ride->var_14D |= 1;
}
}
window_invalidate_by_id(WC_RIDE_LIST, 0);
}

View File

@@ -72,7 +72,10 @@ typedef struct {
uint8 var_14D;
uint8 pad_14E[0x0A];
uint16 var_158;
uint8 pad_15A[0x3C];
uint8 pad_15A[0x26];
uint16 build_date;
sint16 upkeep_cost; // 0x182
uint8 pad_184[0x12];
uint16 var_196;
uint8 pad_198;
uint8 var_199;
@@ -257,5 +260,7 @@ int ride_get_count();
int ride_get_total_queue_length(rct_ride *ride);
int ride_get_max_queue_time(rct_ride *ride);
void ride_init_all();
void reset_all_ride_build_dates();
void ride_update_favourited_stat();
#endif

View File

@@ -31,16 +31,15 @@ static void decode_chunk_rotate(char *buffer, int length);
*
* rct2: 0x00676FD2
*/
int sawyercoding_validate_checksum(HFILE hFile)
int sawyercoding_validate_checksum(HANDLE hFile)
{
int i;
uint32 checksum, fileChecksum;
uint32 i, checksum, fileChecksum;
DWORD dataSize, bufferSize, numBytesRead;
uint8 buffer[1024];
// Get data size
if ((dataSize = SetFilePointer(hFile, 0, NULL, FILE_END)) < 8)
return;
return 0;
dataSize -= 4;
// Calculate checksum
@@ -74,7 +73,7 @@ int sawyercoding_validate_checksum(HFILE hFile)
* rct2: 0x0067685F
* buffer (esi)
*/
int sawyercoding_read_chunk(HFILE hFile, uint8 *buffer)
int sawyercoding_read_chunk(HANDLE hFile, uint8 *buffer)
{
DWORD numBytesRead;
sawyercoding_chunk_header chunkHeader;
@@ -145,7 +144,7 @@ static int decode_chunk_rle(char *buffer, int length)
static int decode_chunk_repeat(char *buffer, int length)
{
int i, j, count;
uint8 *src, *dst, *copyOffset, rleCodeByte;
uint8 *src, *dst, *copyOffset;
// Backup buffer
src = malloc(length);

View File

@@ -36,7 +36,7 @@ enum {
CHUNK_ENCODING_ROTATE
};
int sawyercoding_validate_checksum(HFILE hFile);
int sawyercoding_read_chunk(HFILE hFile, uint8 *buffer);
int sawyercoding_validate_checksum(HANDLE hFile);
int sawyercoding_read_chunk(HANDLE hFile, uint8 *buffer);
#endif

View File

@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include "addresses.h"
#include "date.h"
@@ -103,9 +101,8 @@ void scenario_load_list()
static void scenario_list_add(char *path)
{
int i;
rct_scenario_basic *scenario;
rct_s6_info *s6Info = 0x0141F570;
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
// Check if scenario already exists in list, likely if in scores
scenario = get_scenario_by_filename(path);
@@ -138,7 +135,7 @@ static void scenario_list_add(char *path)
}
// Check if the scenario list buffer has room for another scenario
if ((RCT2_NUM_SCENARIOS + 1) * sizeof(rct_scenario_basic) > _scenarioListSize) {
if ((RCT2_NUM_SCENARIOS + 1) * (int)sizeof(rct_scenario_basic) > _scenarioListSize) {
// Allocate more room
_scenarioListSize += 16 * sizeof(rct_scenario_basic);
RCT2_SCENARIO_LIST = (rct_scenario_basic*)rct2_realloc(RCT2_SCENARIO_LIST, _scenarioListSize);
@@ -267,8 +264,8 @@ static int scenario_load_basic(char *path)
{
HANDLE hFile;
int _eax;
rct_s6_header *s6Header = 0x009E34E4;
rct_s6_info *s6Info = 0x0141F570;
rct_s6_header *s6Header = (rct_s6_header*)0x009E34E4;
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
hFile = CreateFile(
path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS | FILE_ATTRIBUTE_NORMAL, NULL
@@ -277,10 +274,10 @@ static int scenario_load_basic(char *path)
RCT2_GLOBAL(0x009E382C, HANDLE*) = hFile;
// Read first chunk
sawyercoding_read_chunk(hFile, s6Header);
sawyercoding_read_chunk(hFile, (uint8*)s6Header);
if (s6Header->type == S6_TYPE_SCENARIO) {
// Read second chunk
sawyercoding_read_chunk(hFile, s6Info);
sawyercoding_read_chunk(hFile, (uint8*)s6Info);
CloseHandle(hFile);
RCT2_GLOBAL(0x009AA00C, uint8) = 0;
if (s6Info->flags != 255) {
@@ -322,8 +319,8 @@ void scenario_load(char *path)
{
HANDLE hFile;
int i, j;
rct_s6_header *s6Header = 0x009E34E4;
rct_s6_info *s6Info = 0x0141F570;
rct_s6_header *s6Header = (rct_s6_header*)0x009E34E4;
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
hFile = CreateFile(
path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS | FILE_ATTRIBUTE_NORMAL, NULL
@@ -338,10 +335,10 @@ void scenario_load(char *path)
}
// Read first chunk
sawyercoding_read_chunk(hFile, s6Header);
sawyercoding_read_chunk(hFile, (uint8*)s6Header);
if (s6Header->type == S6_TYPE_SCENARIO) {
// Read second chunk
sawyercoding_read_chunk(hFile, s6Info);
sawyercoding_read_chunk(hFile, (uint8*)s6Info);
// Read packed objects
if (s6Header->num_packed_objects > 0) {
@@ -355,35 +352,35 @@ void scenario_load(char *path)
object_read_and_load_entries(hFile);
// Read flags (16 bytes)
sawyercoding_read_chunk(hFile, RCT2_ADDRESS_CURRENT_MONTH_YEAR);
sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_CURRENT_MONTH_YEAR);
// Read map elements
memset(RCT2_ADDRESS_MAP_ELEMENTS, 0, MAX_MAP_ELEMENTS * sizeof(rct_map_element));
sawyercoding_read_chunk(hFile, RCT2_ADDRESS_MAP_ELEMENTS);
memset((void*)RCT2_ADDRESS_MAP_ELEMENTS, 0, MAX_MAP_ELEMENTS * sizeof(rct_map_element));
sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_MAP_ELEMENTS);
// Read game data, including sprites
sawyercoding_read_chunk(hFile, 0x010E63B8);
sawyercoding_read_chunk(hFile, (uint8*)0x010E63B8);
// Read number of guests in park and something else
sawyercoding_read_chunk(hFile, RCT2_ADDRESS_GUESTS_IN_PARK);
sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_GUESTS_IN_PARK);
// Read ?
sawyercoding_read_chunk(hFile, 0x01357BC8);
sawyercoding_read_chunk(hFile, (uint8*)0x01357BC8);
// Read park rating
sawyercoding_read_chunk(hFile, RCT2_ADDRESS_CURRENT_PARK_RATING);
sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_CURRENT_PARK_RATING);
// Read ?
sawyercoding_read_chunk(hFile, 0x01357CF2);
sawyercoding_read_chunk(hFile, (uint8*)0x01357CF2);
// Read ?
sawyercoding_read_chunk(hFile, 0x0135832C);
sawyercoding_read_chunk(hFile, (uint8*)0x0135832C);
// Read ?
sawyercoding_read_chunk(hFile, RCT2_ADDRESS_CURRENT_PARK_VALUE);
sawyercoding_read_chunk(hFile, (uint8*)RCT2_ADDRESS_CURRENT_PARK_VALUE);
// Read more game data, including research items and rides
sawyercoding_read_chunk(hFile, 0x01358740);
sawyercoding_read_chunk(hFile, (uint8*)0x01358740);
CloseHandle(hFile);
@@ -411,7 +408,7 @@ void scenario_load(char *path)
void scenario_load_and_play(rct_scenario_basic *scenario)
{
rct_window *mainWindow;
rct_s6_info *s6Info = 0x0141F570;
rct_s6_info *s6Info = (rct_s6_info*)0x0141F570;
RCT2_GLOBAL(0x009AA0F0, uint32) = RCT2_GLOBAL(0x00F663B0, uint32) ^ timeGetTime();
RCT2_GLOBAL(0x009AA0F4, uint32) = RCT2_GLOBAL(0x00F663B4, uint32) ^ timeGetTime();
@@ -422,7 +419,7 @@ void scenario_load_and_play(rct_scenario_basic *scenario)
RCT2_ADDRESS(RCT2_ADDRESS_SCENARIOS_PATH, char),
scenario->path
);
scenario_load(0x0141EF68);
scenario_load((char*)0x0141EF68);
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING;
viewport_init_all();
game_create_windows();
@@ -450,7 +447,7 @@ void scenario_load_and_play(rct_scenario_basic *scenario)
window_invalidate(mainWindow);
RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
window_ride_list_init_vars();
window_new_ride_init_vars();
RCT2_GLOBAL(0x00F663B0, sint32) = RCT2_GLOBAL(0x009AA0F0, sint32);
RCT2_GLOBAL(0x00F663B4, sint32) = RCT2_GLOBAL(0x009AA0F4, sint32);
@@ -461,24 +458,24 @@ void scenario_load_and_play(rct_scenario_basic *scenario)
RCT2_CALLPROC_EBPSAFE(0x00684AC3);
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
news_item_init_queue();
if (RCT2_ADDRESS(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) != OBJECTIVE_NONE)
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) != OBJECTIVE_NONE)
window_park_objective_open();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_RATING, sint16) = calculate_park_rating();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PARK_VALUE, sint16) = calculate_park_value();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, sint16) = calculate_company_value();
RCT2_GLOBAL(0x013587D0, sint16) = RCT2_GLOBAL(0x013573DC, sint16) - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, sint16);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint16) = ENCRYPT_MONEY(RCT2_GLOBAL(0x013573DC, sint32));
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(RCT2_GLOBAL(0x013573DC, sint32));
RCT2_CALLPROC_EBPSAFE(0x0069E869); // (loan related)
strcpy(0x0135924A, s6Info->details);
strcpy(0x0135920A, s6Info->name);
strcpy((char*)0x0135924A, s6Info->details);
strcpy((char*)0x0135920A, s6Info->name);
if (RCT2_GLOBAL(0x009ADAE4, sint32) != -1) {
char *ebp = RCT2_GLOBAL(0x009ADAE4, char*);
//
format_string(0x0141ED68, RCT2_GLOBAL(ebp + 2, uint16), 0);
format_string((char*)0x0141ED68, RCT2_GLOBAL(ebp + 2, uint16), 0);
// Set park name
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_RENAME_PARK;
@@ -487,22 +484,22 @@ void scenario_load_and_play(rct_scenario_basic *scenario)
game_do_command(0, 1, 0, *((int*)(0x0141ED68 + 24)), 33, *((int*)(0x0141ED68 + 32)), *((int*)(0x0141ED68 + 28)));
//
format_string(0x0141ED68, RCT2_GLOBAL(ebp + 0, uint16), 0);
strncpy(RCT2_ADDRESS_SCENARIO_NAME, 0x0141ED68, 31);
format_string((char*)0x0141ED68, RCT2_GLOBAL(ebp + 0, uint16), 0);
strncpy((char*)RCT2_ADDRESS_SCENARIO_NAME, (char*)0x0141ED68, 31);
((char*)RCT2_ADDRESS_SCENARIO_NAME)[31] = '\0';
// Set scenario details
format_string(0x0141ED68, RCT2_GLOBAL(ebp + 4, uint16), 0);
strncpy(RCT2_ADDRESS_SCENARIO_DETAILS, 0x0141ED68, 255);
format_string((char*)0x0141ED68, RCT2_GLOBAL(ebp + 4, uint16), 0);
strncpy((char*)RCT2_ADDRESS_SCENARIO_DETAILS, (char*)0x0141ED68, 255);
((char*)RCT2_ADDRESS_SCENARIO_DETAILS)[255] = '\0';
}
// Set the last saved game path
strcpy(0x009ABB37, 0x009AB5DA);
format_string(0x009ABB37 + strlen(0x009ABB37), RCT2_GLOBAL(0x0013573D4, uint16), 0x0013573D8);
strcat(0x009ABB37, ".SV6");
strcpy((char*)0x009ABB37, (char*)0x009AB5DA);
format_string((char*)0x009ABB37 + strlen((char*)0x009ABB37), RCT2_GLOBAL(0x0013573D4, uint16), (void*)0x0013573D8);
strcat((char*)0x009ABB37, ".SV6");
memset(0x001357848, 0, 56);
memset((void*)0x001357848, 0, 56);
RCT2_GLOBAL(0x0135832C, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, sint32) = 0;
RCT2_GLOBAL(0x01358334, uint32) = 0;
@@ -512,14 +509,14 @@ void scenario_load_and_play(rct_scenario_basic *scenario)
RCT2_GLOBAL(RCT2_ADDRESS_INCOME_FROM_ADMISSIONS, uint32) = 0;
RCT2_GLOBAL(0x013587D8, uint16) = 63;
RCT2_CALLPROC_EBPSAFE(0x0069E869); // (loan related, called above already)
RCT2_CALLPROC_EBPSAFE(0x0066729F); // reset history / finance / awards
RCT2_CALLPROC_EBPSAFE(0x006B7A38); // reset_all_ride_build_dates
park_reset_awards_and_history();
reset_all_ride_build_dates();
date_reset();
RCT2_CALLPROC_EBPSAFE(0x00674576);
park_calculate_size();
RCT2_CALLPROC_EBPSAFE(0x006C1955);
RCT2_GLOBAL(0x01358840, uint8) = 0;
memset(0x001358102, 0, 20);
memset((void*)0x001358102, 0, 20);
RCT2_GLOBAL(0x00135882E, uint16) = 0;
// Open park with free entry when there is no money
@@ -572,7 +569,7 @@ void scenario_success()
RCT2_CALLPROC_EBPSAFE(0x0069BE9B); // celebration
for (i = 0; i < RCT2_GLOBAL(RCT2_ADDRESS_NUM_SCENARIOS, sint32); i++) {
char* cur_scenario_name = RCT2_ADDRESS(0x135936C, char*);
char *cur_scenario_name = RCT2_ADDRESS(0x135936C, char);
scenario = &(RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_LIST, rct_scenario_basic*)[i]);
if (0 == strncmp(cur_scenario_name, scenario->path, 256)){
@@ -604,7 +601,7 @@ void scenario_objective5_check()
memset(type_already_counted, 0, 256);
for (int i = 0; i < 255; i++) {
for (int i = 0; i < MAX_RIDES; i++) {
uint8 subtype_id;
uint32 subtype_p;
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
@@ -640,7 +637,7 @@ void scenario_objective8_check()
memset(type_already_counted, 0, 256);
for (int i = 0; i < 255; i++) {
for (int i = 0; i < MAX_RIDES; i++) {
uint8 subtype_id;
uint32 subtype_p;
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
@@ -660,7 +657,7 @@ void scenario_objective8_check()
for (int j = 0; j < limit; ++j) {
sum += ((uint32*)&ride->pad_088[92])[j];
}
if ((sum >> 16) > objective_length) {
if ((sum >> 16) > (uint32)objective_length) {
type_already_counted[subtype_id]++;
rcs++;
}
@@ -741,7 +738,7 @@ void scenario_objectives_check()
{
rct_ride* ride;
int rcs = 0;
for (int i = 0; i < 255; i++) {
for (int i = 0; i < MAX_RIDES; i++) {
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
if (ride->status && ride->excitement > objective_currency)
rcs++;
@@ -847,7 +844,7 @@ void scenario_update()
uint32 month_tick = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16),
next_month_tick = month_tick + 4;
uint8 month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7,
current_days_in_month = days_in_month[month],
current_days_in_month = (uint8)days_in_month[month],
objective_type = RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8);
if (screen_flags & (~SCREEN_FLAGS_PLAYING)) // only in normal play mode
@@ -875,7 +872,7 @@ void scenario_update()
scenario_marketing_update();
peep_problem_warnings_update();
RCT2_CALLPROC_EBPSAFE(0x006B7A5E); // check ride reachability
RCT2_CALLPROC_EBPSAFE(0x006AC916); // ride update favourited
ride_update_favourited_stat();
if (month <= 1 && RCT2_GLOBAL(0x009ADAE0, sint32) != -1 && RCT2_GLOBAL(0x009ADAE0 + 14, uint16) & 1) {
for (int i = 0; i < 100; ++i) {
@@ -893,11 +890,11 @@ void scenario_update()
//if ( (unsigned int)((2 * current_day) & 0xFFFF) >= 0xFFF8) {
if (next_month_tick % 0x8000 == 0) {
// biweekly checks
RCT2_CALLPROC_EBPSAFE(0x006AC885);
// fortnightly
finance_pay_ride_upkeep();
}
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) = next_month_tick;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) = (uint16)next_month_tick;
if (next_month_tick >= 0x10000) {
// month ends actions
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16)++;

View File

@@ -117,9 +117,9 @@ int screenshot_dump_bmp()
BitmapFileHeader header;
BitmapInfoHeader info;
int i, x, y, index, width, height, stride;
char *buffer, path[MAX_PATH], *row, *dst;
HFILE hFile;
int i, y, index, width, height, stride;
char *buffer, path[MAX_PATH], *row;
HANDLE hFile;
DWORD bytesWritten;
// Get a free screenshot path
@@ -127,7 +127,7 @@ int screenshot_dump_bmp()
return -1;
// Open file for writing
hFile = CreateFile(path, GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return -1;

View File

@@ -32,7 +32,7 @@
*/
void format_string(char *dest, rct_string_id format, void *args)
{
RCT2_CALLPROC_X(0x006C2555, format, 0, args, 0, 0, dest, 0);
RCT2_CALLPROC_X(0x006C2555, format, 0, (int)args, 0, 0, (int)dest, 0);
}
void generate_string_file()

View File

@@ -217,6 +217,8 @@ enum {
STR_PLACE_SCENERY_TIP = 1159,
STR_ADJUST_WATER_TIP = 1160,
STR_OPTIONS = 1168,
STR_BUILD_FOOTPATH_TIP = 1173,
STR_CANT_BUILD_FOOTPATH_HERE = 1176,
STR_CANT_REMOVE_FOOTPATH_FROM_HERE = 1177,
@@ -278,6 +280,8 @@ enum {
STR_SUMMARISED_GUESTS_TIP = 1753,
STR_ADMISSION_PRICE = 1756,
STR_MUSIC = 1777,
STR_ACTIONS = 1814,
STR_THOUGHTS = STR_ACTIONS + 1,
STR_INFORMATION_TYPE_TIP = 1816,
@@ -355,6 +359,20 @@ enum {
STR_CHANGE_BASE_LAND_TIP = 2294,
STR_CHANGE_VERTICAL_LAND_TIP = 2295,
STR_SOUND_QUALITY = 2317,
STR_CURRENCY = 2328,
STR_DISTANCE_AND_SPEED = 2329,
STR_TEMPERATURE = 2330,
STR_HEIGHT_LABELS = 2331,
STR_UNITS = 2332,
STR_SOUND = 2333,
STR_DISPLAY = 2346,
STR_DISPLAY_RESOLUTION = 2360,
STR_TILE_SMOOTHING = 2361,
STR_TILE_SMOOTHING_TIP = 2362,
STR_GRIDLINES = 2363,
STR_GRIDLINES_TIP = 2364,
//STR_NONE = 2368,
STR_LOW = 2369,
STR_AVERAGE = 2370,
@@ -404,12 +422,22 @@ enum {
STR_PROFIT_PER_WEEK_AND_PARK_VALUE_TIP = 2482,
STR_CONTROLS = 2485,
STR_GENERAL = 2486,
STR_REAL_NAME = 2487,
STR_REAL_NAME_TIP = 2488,
STR_HOTKEY = 2489,
STR_ENTER_NAME_INTO_SCENARIO_CHART = 2790,
STR_COMPLETED_BY_WITH_COMPANY_VALUE = 2794,
STR_SORT = 2795,
STR_RIDE_LIST_SORT_TIP = 2796,
STR_SCREEN_EDGE_SCROLLING = 2797,
STR_SCREEN_EDGE_SCROLLING_TIP = 2798,
STR_HOTKEY_TIP = 2799,
STR_TOTAL_ADMISSIONS = 2800,
STR_INCOME_FROM_ADMISSIONS = 2801,
@@ -466,6 +494,8 @@ enum {
STR_UNABLE_TO_LOAD_FILE = 3010,
STR_FILE_CONTAINS_INVALID_DATA = 3011,
STR_CONSTRUCTION_MARKER = 3057,
STR_BEGINNER_PARKS = 3064,
STR_CHALLENGING_PARKS = STR_BEGINNER_PARKS + 1,
STR_EXPERT_PARKS = STR_BEGINNER_PARKS + 2,
@@ -490,14 +520,22 @@ enum {
STR_LIST = 3159,
STR_NO_DETAILS_YET = 3317,
STR_OBJECTIVE = 3322,
STR_SAVE_PLUGIN_DATA = 3333,
STR_SAVE_PLUGIN_DATA_TIP = 3334,
STR_GAME_TOOLS = 3341,
STR_SCENARIO_EDITOR = 3342,
STR_CONVERT_SAVED_GAME_TO_SCENARIO = 3343,
STR_ROLLER_COASTER_DESIGNER = 3344,
STR_TRACK_DESIGNS_MANAGER = 3345,
STR_SOUND_FORCED_SOFTWARE_BUFFER_MIXING = 3362,
STR_SOUND_FORCED_SOFTWARE_BUFFER_MIXING_TIP = 3363,
STR_TUTORIAL_BEGINNERS = 3385,
STR_TUTORIAL_CUSTOM_RIDES = 3386,
STR_TUTORIAL_ROLLER_COASTER = 3387,

View File

@@ -103,9 +103,9 @@ void title_load()
date_reset();
RCT2_CALLPROC_X(0x006C45ED, 0, 0, 0, 0, 0, 0, 0);
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
window_ride_list_init_vars();
window_new_ride_init_vars();
window_guest_list_init_vars_b();
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN;
window_staff_init_vars();
RCT2_CALLPROC_EBPSAFE(0x0068AFFD);
RCT2_CALLPROC_EBPSAFE(0x0069EBE4);
viewport_init_all();
@@ -154,7 +154,7 @@ static void title_update_showcase()
rct_window* w;
uint8 script_opcode, script_operand;
short x, y, z;
int i, _edx;
int i;
if (_scriptWaitCounter <= 0) {
do {
@@ -191,7 +191,7 @@ static void title_update_showcase()
window_invalidate(w);
RCT2_CALLPROC_EBPSAFE(0x0069E9A7);
window_ride_list_init_vars();
window_new_ride_init_vars();
RCT2_CALLPROC_EBPSAFE(0x00684AC3);
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
news_item_init_queue();
@@ -223,7 +223,7 @@ static void title_update_showcase()
_currentScript = _magicMountainScript;
if (gRandomShowcase) {
if (_currentScript != NULL)
free(_currentScript);
free((uint8*)_currentScript);
_currentScript = generate_random_script();
}
break;
@@ -322,7 +322,7 @@ static void title_play_music()
strcat(musicPath, "\\data\\css50.dat");
}
if (RCT2_CALLFUNC_3(0x0040194E, int, int, int, int, 3, musicPath, 0)) // play music
if (RCT2_CALLFUNC_3(0x0040194E, int, int, char*, int, 3, musicPath, 0)) // play music
RCT2_CALLPROC_5(0x00401999, int, int, int, int, int, 3, 1, 0, 0, 0);
RCT2_GLOBAL(0x009AF600, uint8) = 1;
@@ -333,7 +333,7 @@ static uint8 *generate_random_script()
int i, j;
const int views = 16;
srand(time(NULL));
srand((unsigned int)time(NULL));
uint8 *script = malloc(views * 8 + 2);
i = 0;

View File

@@ -78,7 +78,7 @@ void viewport_create(rct_window *w, int x, int y, int width, int height, int ecx
{
x &= 0xFFFF;
y &= 0xFFFF;
RCT2_CALLPROC_X(0x006EB009, (y << 16) | x, (height << 16) | width, ecx, edx, w, 0, 0);
RCT2_CALLPROC_X(0x006EB009, (y << 16) | x, (height << 16) | width, ecx, edx, (int)w, 0, 0);
}
/**
@@ -103,7 +103,7 @@ void viewport_update_pointers()
*/
void viewport_update_position(rct_window *window)
{
RCT2_CALLPROC_X(0x006E7A3A, 0, 0, 0, 0, window, 0, 0);
RCT2_CALLPROC_X(0x006E7A3A, 0, 0, 0, 0, (int)window, 0, 0);
}
/**
@@ -112,7 +112,7 @@ void viewport_update_position(rct_window *window)
*/
void viewport_render(rct_drawpixelinfo *dpi, rct_viewport *viewport, int left, int top, int right, int bottom)
{
RCT2_CALLPROC_X(0x00685C02, left , top, 0, right, viewport, dpi, bottom);
RCT2_CALLPROC_X(0x00685C02, left , top, 0, right, (int)viewport, (int)dpi, bottom);
}
/**

View File

@@ -37,6 +37,7 @@ static void widget_text_inset(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
static void widget_text_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
static void widget_groupbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour);
@@ -153,8 +154,9 @@ void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
case WWT_SCROLL:
widget_scroll_draw(dpi, w, widgetIndex);
break;
case WWT_23:
case WWT_CHECKBOX:
case WWT_24:
widget_checkbox_draw(dpi, w, widgetIndex);
break;
case WWT_25:
break;
@@ -246,7 +248,6 @@ static void widget_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
{
rct_widget* widget;
int l, t, r, b, press;
uint32 image;
uint8 colour;
// Get the widget
@@ -329,8 +330,7 @@ static void widget_tab_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetInd
static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
rct_widget* widget;
int l, t, r, b, press;
uint32 image;
int l, t, r, b;
uint8 colour;
if (!widget_is_disabled(w, widgetIndex) && widget_is_highlighted(w, widgetIndex)) {
@@ -373,7 +373,7 @@ static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int w
static void widget_text_button(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
rct_widget* widget;
int l, t, r, b, width, press, stringId;
int l, t, r, b, press;
uint8 colour;
// Get the widget
@@ -403,7 +403,7 @@ static void widget_text_button(rct_drawpixelinfo *dpi, rct_window *w, int widget
static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
rct_widget* widget;
int l, t, r, b, width, press, stringId;
int l, t, r, b, stringId;
uint8 colour;
// Get the widget
@@ -431,7 +431,7 @@ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widge
gfx_draw_string_left_clipped(
dpi,
stringId,
0x013CE952,
(void*)0x013CE952,
colour,
l + 1,
t,
@@ -443,7 +443,7 @@ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widge
gfx_draw_string_centred_clipped(
dpi,
stringId,
0x013CE952,
(void*)0x013CE952,
colour,
(w->x + w->x + widget->left + widget->right + 1) / 2 - 1,
t,
@@ -459,7 +459,7 @@ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widge
static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
rct_widget* widget;
int l, t, r, b, width, press;
int l, t, r, b;
uint8 colour;
// Get the widget
@@ -479,7 +479,7 @@ static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
if (widget_is_disabled(w, widgetIndex))
colour |= 0x40;
gfx_draw_string_left(dpi, widget->image, 0x013CE952, colour, l + 1, t);
gfx_draw_string_left(dpi, widget->image, (void*)0x013CE952, colour, l + 1, t);
}
/**
@@ -489,7 +489,7 @@ static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
static void widget_text_inset(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
rct_widget* widget;
int l, t, r, b, width, press;
int l, t, r, b;
uint8 colour;
// Get the widget
@@ -564,9 +564,9 @@ static void widget_groupbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
// Text
if (widget->image != (uint32)-1) {
colour = w->colours[widget->colour] & 0x7F;
if (colour & 1)
if (widget_is_disabled(w, widgetIndex))
colour |= 0x40;
gfx_draw_string_left(dpi, widget->image, 0x013CE952, colour, l, t);
gfx_draw_string_left(dpi, widget->image, (void*)0x013CE952, colour, l, t);
textRight = gLastDrawStringX + 1;
}
@@ -711,6 +711,48 @@ static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
gfx_draw_string_centred_clipped(dpi, widget->image, (void*)0x013CE952, colour, l, t, widget->right - widget->left - 2);
}
/**
*
* rct2: 0x006EBAD9
*/
static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
rct_widget* widget;
int l, t, b;
uint8 colour;
// Get the widget
widget = &w->widgets[widgetIndex];
// Resolve the absolute ltb
l = w->x + widget->left;
t = w->y + widget->top;
b = w->y + widget->bottom;
// Get the colour
colour = w->colours[widget->colour];
// checkbox
if (widget->type != WWT_24) {
gfx_fill_rect_inset(dpi, l, t, l + 9, b - 1, colour, 0x60);
// fill it when checkbox is pressed
if (widget_is_pressed(w, widgetIndex)) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
gfx_draw_string(dpi, (char*)0x009DED72, colour & 0x7F, l, t);
}
}
// draw the text
if (widget->image == -1)
return;
if (widget_is_disabled(w, widgetIndex)) {
colour |= 0x40;
}
gfx_draw_string_left(dpi, widget->image, (char*)0x013CE952, colour, l + 14, t);
}
/**
*
* rct2: 0x006EBD96
@@ -720,7 +762,7 @@ static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
rct_widget* widget;
rct_scroll* scroll;
int scrollIndex;
int l, t, r, b, press, ebp;
int l, t, r, b;
int cl, ct, cr, cb;
uint8 colour;
rct_drawpixelinfo scroll_dpi;
@@ -782,7 +824,7 @@ static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
// Draw the scroll contents
if (scroll_dpi.width > 0 && scroll_dpi.height > 0)
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_PAINT], 0, 0, 0, 0, w, &scroll_dpi, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_SCROLL_PAINT], 0, 0, 0, 0, (int)w, (int)&scroll_dpi, 0);
}
static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour)
@@ -870,20 +912,20 @@ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
colour = w->colours[widget->colour];
colour = RCT2_ADDRESS(0x00141FC4A, uint8)[(colour & 0x7F) * 8] & 0xFF;
RCT2_GLOBAL(0x009ABDA4, uint32) = 0x009DED74;
memset(0x009DED74, colour, 256);
memset((void*)0x009DED74, colour, 256);
RCT2_GLOBAL(0x009DED74, uint8) = 0;
RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000;
image &= 0x7FFFF;
RCT2_CALLPROC_X(0x0067A46E, 0, image, l + 1, t + 1, 0, dpi, 0);
RCT2_CALLPROC_X(0x0067A46E, 0, image, l + 1, t + 1, 0, (int)dpi, 0);
// Draw greyed out (dark)
colour = w->colours[widget->colour];
colour = RCT2_ADDRESS(0x00141FC48, uint8)[(colour & 0x7F) * 8] & 0xFF;
RCT2_GLOBAL(0x009ABDA4, uint32) = 0x009DED74;
memset(0x009DED74, colour, 256);
memset((void*)0x009DED74, colour, 256);
RCT2_GLOBAL(0x009DED74, uint8) = 0;
RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000;
RCT2_CALLPROC_X(0x0067A46E, 0, image, l, t, 0, dpi, 0);
RCT2_CALLPROC_X(0x0067A46E, 0, image, l, t, 0, (int)dpi, 0);
} else {
if (image & 0x80000000) {
// ?

View File

@@ -47,7 +47,7 @@ typedef enum {
WWT_CAPTION = 20,
WWT_CLOSEBOX = 21,
WWT_SCROLL = 22,
WWT_23,
WWT_CHECKBOX,
WWT_24,
WWT_25,
WWT_LAST = 26,

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* Copyright (c) 2014 Ted John, Peter Hill
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
@@ -111,7 +111,7 @@ void window_dispatch_update_all()
RCT2_GLOBAL(0x01423604, sint32)++;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, sint16)++;
for (w = RCT2_LAST_WINDOW; w >= RCT2_FIRST_WINDOW; w--)
RCT2_CALLPROC_X(w->event_handlers[WE_UPDATE], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_UPDATE], 0, 0, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_EBPSAFE(0x006EE411); // handle_text_input
}
@@ -142,7 +142,7 @@ void window_update_all()
if (RCT2_GLOBAL(0x009DEB7C, sint16) >= 1000) {
RCT2_GLOBAL(0x009DEB7C, sint16) = 0;
for (w = RCT2_LAST_WINDOW; w >= RCT2_FIRST_WINDOW; w--)
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_07], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_UNKNOWN_07], 0, 0, 0, 0, (int)w, 0, 0);
}
// Border flash invalidation
@@ -164,7 +164,7 @@ void window_update_all()
*/
static void window_scroll_wheel_input(rct_window *w, int scrollIndex, int wheel)
{
int widgetIndex, newValue, size;
int widgetIndex, size;
rct_scroll *scroll;
rct_widget *widget;
@@ -238,7 +238,7 @@ static void window_viewport_wheel_input(rct_window *w, int wheel)
*/
static void window_all_wheel_input()
{
int i, raw, wheel, widgetIndex;
int raw, wheel, widgetIndex;
rct_window *w;
rct_widget *widget;
rct_scroll *scroll;
@@ -402,9 +402,9 @@ rct_window *window_create_auto_pos(int width, int height, uint32 *event_handlers
ebx = (height << 16) | width;
ecx = (flags << 8) | cls;
edx = event_handlers;
edx = (int)event_handlers;
RCT2_CALLFUNC_X(0x006EA9B1, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
return esi;
return (rct_window*)esi;
}
/**
@@ -421,7 +421,7 @@ void window_close(rct_window* window)
return;
// Call close event of window
RCT2_CALLPROC_X(window->event_handlers[WE_CLOSE], 0, 0, 0, 0, window, 0, 0);
RCT2_CALLPROC_X(window->event_handlers[WE_CLOSE], 0, 0, 0, 0, (int)window, 0, 0);
window = window_find_by_id(window->classification, window->number);
@@ -493,13 +493,54 @@ rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number)
return NULL;
}
/**
* Closes the top-most window
*
* rct2: 0x006E403C
*/
void window_close_top()
{
rct_window* w;
window_close_by_id(WC_DROPDOWN, 0);
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)
if (RCT2_GLOBAL(0x0141F570, uint8) != 1)
return;
for (w = RCT2_FIRST_WINDOW; w < RCT2_LAST_WINDOW; w++) {
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) {
window_close(w);
return;
}
}
}
/**
* Closes all open windows
*
* rct2: 0x006EE927
*/
void window_close_all() {
rct_window* w;
window_close_by_id(WC_DROPDOWN, 0);
for (w = RCT2_FIRST_WINDOW; w < RCT2_LAST_WINDOW; w++){
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) {
window_close(w);
w = RCT2_FIRST_WINDOW;
}
}
}
/**
*
* rct2: 0x006EA845
*/
rct_window *window_find_from_point(int x, int y)
{
rct_window *w, *w2;
rct_window *w;
rct_widget *widget;
int widget_index;
@@ -535,7 +576,7 @@ int window_find_widget_from_point(rct_window *w, int x, int y)
int i, widget_index;
// Invalidate the window
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
// Find the widget at point x, y
widget_index = -1;
@@ -668,7 +709,7 @@ void window_init_scroll_widgets(rct_window *w)
*/
void window_update_scroll_widgets(rct_window *w)
{
RCT2_CALLPROC_X(0x006EAE4E, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006EAE4E, 0, 0, 0, 0, (int)w, 0, 0);
}
int window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *height)
@@ -676,7 +717,7 @@ int window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *heig
rct_widget *widget = window_get_scroll_widget(w, scrollIndex);
int widgetIndex = window_get_widget_index(w, widget);
int eax = 0, ebx = scrollIndex * sizeof(rct_scroll), ecx = 0, edx = 0, esi = w, edi = widgetIndex * sizeof(rct_widget), ebp = 0;
int eax = 0, ebx = scrollIndex * sizeof(rct_scroll), ecx = 0, edx = 0, esi = (int)w, edi = widgetIndex * sizeof(rct_widget), ebp = 0;
RCT2_CALLFUNC_X(w->event_handlers[WE_SCROLL_GETSIZE], & eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
*width = ecx;
*height = edx;
@@ -817,7 +858,7 @@ rct_window *window_get_main()
*/
void window_scroll_to_location(rct_window *w, int x, int y, int z)
{
RCT2_CALLPROC_X(0x006E7C9C, x, 0, y, z, w, 0, 0);
RCT2_CALLPROC_X(0x006E7C9C, x, 0, y, z, (int)w, 0, 0);
}
/**
@@ -826,7 +867,7 @@ void window_scroll_to_location(rct_window *w, int x, int y, int z)
*/
void window_rotate_camera(rct_window *w)
{
RCT2_CALLPROC_X(0x0068881A, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x0068881A, 0, 0, 0, 0, (int)w, 0, 0);
}
/**
@@ -835,7 +876,7 @@ void window_rotate_camera(rct_window *w)
*/
void window_zoom_in(rct_window *w)
{
RCT2_CALLPROC_X(0x006887A6, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006887A6, 0, 0, 0, 0, (int)w, 0, 0);
}
/**
@@ -844,7 +885,7 @@ void window_zoom_in(rct_window *w)
*/
void window_zoom_out(rct_window *w)
{
RCT2_CALLPROC_X(0x006887E0, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006887E0, 0, 0, 0, 0, (int)w, 0, 0);
}
/**
@@ -853,7 +894,7 @@ void window_zoom_out(rct_window *w)
*/
void window_show_textinput(rct_window *w, int widgetIndex, uint16 title, uint16 text, int value)
{
RCT2_CALLPROC_X(0x006EE308, title, text, value, widgetIndex, w, 0, 0);
RCT2_CALLPROC_X(0x006EE308, title, text, value, widgetIndex, (int)w, 0, 0);
}
/**
@@ -870,11 +911,6 @@ void window_draw(rct_window *w, int left, int top, int right, int bottom)
rct_drawpixelinfo *dpi, copy;
int overflow;
char *copyBits;
int copyLeft;
int copyWidth;
int copyPitch;
// RCT2_CALLPROC_X(0x006E756C, left, top, 0, right, w, 0, bottom);
// return;
@@ -948,10 +984,10 @@ void window_draw(rct_window *w, int left, int top, int right, int bottom)
RCT2_GLOBAL(0x0141F743, uint8) = v->colours[3] & 0x7F;
// Invalidate the window
RCT2_CALLPROC_X(v->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, v, 0, 0);
RCT2_CALLPROC_X(v->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)v, 0, 0);
// Paint the window
RCT2_CALLPROC_X(v->event_handlers[WE_PAINT], 0, 0, 0, 0, v, dpi, 0);
RCT2_CALLPROC_X(v->event_handlers[WE_PAINT], 0, 0, 0, 0, (int)v, (int)dpi, 0);
}
}
@@ -1074,8 +1110,8 @@ void window_resize(rct_window *w, int dw, int dh)
w->width = clamp(w->min_width, w->width + dw, w->max_width);
w->height = clamp(w->min_height, w->height + dh, w->max_height);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], w->width, w->height, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], w->width, w->height, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
// Update scroll widgets
for (i = 0; i < 3; i++) {
@@ -1176,7 +1212,7 @@ void tool_cancel()
RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber)
);
if (w != NULL)
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_ABORT], 0, 0, 0, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_TOOL_ABORT], 0, 0, 0, RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WIDGETINDEX, uint16), (int)w, 0, 0);
}
}
}
@@ -1185,7 +1221,8 @@ void tool_cancel()
*
* rct2: 0x0068F083
*/
void window_guest_list_init_vars_a() {
void window_guest_list_init_vars_a()
{
RCT2_GLOBAL(0x013B0E6C, uint32) = 1;
RCT2_GLOBAL(0x00F1AF1C, uint32) = 0xFFFFFFFF;
RCT2_GLOBAL(0x00F1EE02, uint32) = 0xFFFFFFFF;
@@ -1196,7 +1233,8 @@ void window_guest_list_init_vars_a() {
*
* rct2: 0x0068F050
*/
void window_guest_list_init_vars_b() {
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;
@@ -1206,25 +1244,9 @@ void window_guest_list_init_vars_b() {
}
/**
*
* rct2: 0x006ACA58
*/
void window_ride_list_init_vars() {
// If we are in the track designer, default to the Roller Coaster tab
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) {
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_RIDE_LIST_TAB_ROLLER_COASTER;
}
else {
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_RIDE_LIST_TAB_TRANSPORT;
}
for (short i = 0; i < 6; i++) {
/*
Reset what is highlighted in each tab.
Each 16bit number represents the item in its respective tab.
*/
RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, uint16)[i] = 0xFFFF;
}
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_INFORMATION_TYPE, uint8) = 0;
}
* Wrapper for window events so C functions can call them
*/
void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event)
{
RCT2_CALLPROC_X(w->event_handlers[event], 0, 0, 0, widgetIndex, (int)w, 0, 0);
}

View File

@@ -275,6 +275,7 @@ enum {
WC_CHANGE_KEYBOARD_SHORTCUT = 37,
WC_MAP = 38,
WC_TITLE_LOGO = 39,
WC_BANNER = 40,
WC_EDITOR_OBJECT_SELECTION = 42,
WC_EDITOR_INVENTION_LIST = 43,
WC_EDITOR_SCENARIO_OPTIONS = 45,
@@ -284,22 +285,6 @@ enum {
WC_CHEATS = 110,
} WINDOW_CLASS;
enum {
WINDOW_RIDE_LIST_TAB_TRANSPORT,
WINDOW_RIDE_LIST_TAB_GENTLE,
WINDOW_RIDE_LIST_TAB_ROLLER_COASTER,
WINDOW_RIDE_LIST_TAB_THRILL,
WINDOW_RIDE_LIST_TAB_WATER,
WINDOW_RIDE_LIST_TAB_SHOP,
WINDOW_RIDE_LIST_TAB_RESEARCH
} WINDOW_RIDE_LIST_TAB;
enum {
WINDOW_STAFF_LIST_TAB_HANDYMEN,
WINDOW_STAFF_LIST_TAB_MECHANICS,
WINDOW_STAFF_LIST_TAB_SECURITY,
WINDOW_STAFF_LIST_TAB_ENTERTAINERS
} WINDOW_STAFF_LIST_TAB;
void window_dispatch_update_all();
void window_update_all();
@@ -307,6 +292,8 @@ rct_window *window_create(int x, int y, int width, int height, uint32 *event_han
rct_window *window_create_auto_pos(int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags);
void window_close(rct_window *window);
void window_close_by_id(rct_windowclass cls, rct_windownumber number);
void window_close_top();
void window_close_all();
rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number);
rct_window *window_find_from_point(int x, int y);
int window_find_widget_from_point(rct_window *w, int x, int y);
@@ -359,13 +346,23 @@ void window_clear_scenery_open();
void window_land_open();
void window_water_open();
void window_guest_list_open();
void window_options_open();
void window_park_awards_open();
void window_park_entrance_open();
void window_park_guests_open();
void window_park_objective_open();
void window_park_rating_open();
void window_ride_list_open();
void window_banner_open();
void window_cheats_open();
void window_guest_list_init_vars_a();
void window_guest_list_init_vars_b();
void window_ride_list_init_vars();
void window_new_ride_init_vars();
void window_staff_init_vars();
void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event);
#endif

View File

@@ -46,7 +46,7 @@ static void window_about_emptysub() { }
static void window_about_mouseup();
static void window_about_paint();
static uint32 window_about_events[] = {
static void* window_about_events[] = {
window_about_emptysub,
window_about_mouseup,
window_about_emptysub,
@@ -83,7 +83,6 @@ static uint32 window_about_events[] = {
*/
void window_about_open()
{
int x, y;
rct_window* window;
// Check if window is already open
@@ -96,7 +95,7 @@ void window_about_open()
max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 165),
400,
330,
window_about_events,
(uint32*)window_about_events,
WC_ABOUT,
0
);
@@ -115,7 +114,6 @@ void window_about_open()
*/
static void window_about_mouseup()
{
int i;
short widgetIndex;
rct_window *w;
@@ -155,40 +153,40 @@ static void window_about_paint()
// Version
RCT2_GLOBAL(0x009C383C, uint8) = 49;
gfx_draw_string_centred(dpi, STR_VERSION_X, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_VERSION_X, x, y, 0, (void*)0x009E2D28);
// Credits
RCT2_GLOBAL(0x009C383C, uint8) = 48;
y += 10;
gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, x, y, 0, (void*)0x009E2D28);
y += 79;
gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, x, y, 0, (void*)0x009E2D28);
y += 13;
gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, x, y, 0, (void*)0x009E2D28);
y += 25;
gfx_draw_string_centred(dpi, STR_THANKS_TO, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_THANKS_TO, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_1, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_1, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_2, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_2, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_3, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_3, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_4, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_4, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_5, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_5, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_6, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_6, x, y, 0, (void*)0x009E2D28);
y += 10;
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_7, x, y, 0, 0x009E2D28);
gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_7, x, y, 0, (void*)0x009E2D28);
// Images
gfx_draw_sprite(dpi, SPR_CREDITS_CHRIS_SAWYER_SMALL, w->x + 92, w->y + 40);

233
src/window_banner.c Normal file
View File

@@ -0,0 +1,233 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John, Dennis Devriendt
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "addresses.h"
#include "config.h"
#include "strings.h"
#include "viewport.h"
#include "widget.h"
#include "window.h"
static enum WINDOW_BANNER_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_VIEWPORT,
WIDX_BANNER_TEXT,
WIDX_BANNER_NO_ENTRY,
WIDX_BANNER_DEMOLISH,
WIDX_MAIN_COLOR,
WIDX_TEXT_COLOR_DROPDOWN,
WIDX_TEXT_COLOR_DROPDOWN_BUTTON
};
static rct_widget window_banner_widgets[] = {
{ WWT_FRAME, 0, 0, 112, 0, 95, 0x0FFFFFFFF, 65535}, // panel / background
{ WWT_CAPTION, 0, 1, 111, 1, 14, 0xBA9, STR_WINDOW_TITLE_TIP}, // title bar
{ WWT_CLOSEBOX, 0, 100, 110, 2, 13, 0x338, STR_CLOSE_WINDOW_TIP}, // close x button
{ WWT_VIEWPORT, 1, 3, 87, 17, 76, 0x0FFFFFFFE, 65535}, // tab content panel
{ WWT_FLATBTN, 1, 88, 111, 19, 42, 0x1430, STR_CHANGE_BANNER_TEXT_TIP}, // change banner button
{ WWT_FLATBTN, 1, 88, 111, 43, 66, 0x143A, STR_SET_AS_NO_ENTRY_BANNER_TIP}, // no entry button
{ WWT_FLATBTN, 1, 88, 111, 67, 90, 0x142D, STR_DEMOLISH_BANNER_TIP}, // demolish button
{ WWT_COLORBTN, 1, 5, 16, 80, 91, 0x0FFFFFFFF, STR_SELECT_MAIN_COLOR_TIP}, // high money
{ WWT_DROPDOWN, 1, 43, 81, 80, 91, 0x0FFFFFFFF, 65535}, // high money
{ WWT_DROPDOWN_BUTTON, 1, 70, 80, 81, 90, 0x36C, STR_SELECT_TEXT_COLOR_TIP}, // high money
{ WIDGETS_END },
};
static void window_banner_emptysub() { }
static void window_banner_mouseup();
static void window_banner_mousedown();
static void window_banner_dropdown();
static void window_banner_textinput();
static void window_banner_invalidate();
static void window_banner_paint();
static void* window_banner_events[] = {
window_banner_emptysub,
window_banner_mouseup,
window_banner_emptysub,
window_banner_mousedown,
window_banner_dropdown,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_textinput,
(void*)0x006BA7B5,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_emptysub,
window_banner_invalidate,
window_banner_paint,
window_banner_emptysub
};
/**
*
* rct2: 0x006BA305
*/
void window_banner_open()
{
rct_windownumber windownumber;
rct_window* w;
rct_widget *viewportWidget;
//__asm mov windownumber, ax // not quite right I think
windownumber = 0;
// Check if window is already open
w = window_bring_to_front_by_id(WC_BANNER, windownumber);
if (w != NULL)
return;
w = window_create_auto_pos(113, 96, (uint32*)window_banner_events, WC_BANNER, 0);
w->widgets = window_banner_widgets;
w->enabled_widgets =
(1 << WIDX_CLOSE) |
(1 << WIDX_BANNER_TEXT) |
(1 << WIDX_BANNER_NO_ENTRY) |
(1 << WIDX_BANNER_DEMOLISH) |
(1 << WIDX_MAIN_COLOR) |
(1 << WIDX_TEXT_COLOR_DROPDOWN) |
(1 << WIDX_TEXT_COLOR_DROPDOWN_BUTTON);
w->number = windownumber;
window_init_scroll_widgets(w);
w->colours[0] = 24;
w->colours[1] = 24;
w->colours[2] = 24;
/*
TODO: MISSING CODE 006BA377 -> 006BA3F6, need the banner map element
*/
// Create viewport
viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
viewport_create(
w,
w->x + viewportWidget->left + 1,
w->y + viewportWidget->top + 1,
(viewportWidget->right - viewportWidget->left) - 2,
(viewportWidget->bottom - viewportWidget->top) - 2,
100, // TODO: needs banner map position
100 // TODO: needs banner map position
);
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
w->flags |= WF_2 | WF_TRANSPARENT;
window_invalidate(w);
}
static void window_banner_mouseup()
{
short widgetIndex;
rct_window *w;
__asm mov widgetIndex, dx
__asm mov w, esi
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
case WIDX_BANNER_DEMOLISH:
RCT2_CALLPROC_EBPSAFE(0x006BA739);
break;
case WIDX_BANNER_TEXT:
RCT2_CALLPROC_EBPSAFE(0x006BA6BC);
break;
case WIDX_BANNER_NO_ENTRY:
RCT2_CALLPROC_EBPSAFE(0x006BA64D);
break;
}
}
static void window_banner_mousedown()
{
short widgetIndex;
__asm mov widgetIndex, dx
switch (widgetIndex) {
case WIDX_MAIN_COLOR:
RCT2_CALLPROC_EBPSAFE(0x006BA528);
break;
case WIDX_TEXT_COLOR_DROPDOWN_BUTTON:
RCT2_CALLPROC_EBPSAFE(0x006BA563);
break;
}
}
static void window_banner_dropdown()
{
short widgetIndex;
__asm mov widgetIndex, dx;
if (widgetIndex == WIDX_MAIN_COLOR)
RCT2_CALLPROC_EBPSAFE(0x006BA548);
else if (widgetIndex == WIDX_TEXT_COLOR_DROPDOWN_BUTTON)
RCT2_CALLPROC_EBPSAFE(0x006BA5D0);
}
static void window_banner_textinput()
{
short widgetIndex;
__asm mov widgetIndex, dx;
if (widgetIndex == WIDX_BANNER_TEXT) {
RCT2_CALLPROC_EBPSAFE(0x006BA6D8);
}
}
static void window_banner_invalidate()
{
RCT2_CALLPROC_EBPSAFE(0x006BA44D);
}
static void window_banner_paint()
{
rct_window *w;
rct_drawpixelinfo *dpi;
__asm mov w, esi
__asm mov dpi, edi
window_draw_widgets(w, dpi);
// Draw viewport
if (w->viewport != NULL) {
window_draw_viewport(dpi, w);
}
}

View File

@@ -84,7 +84,7 @@ static void window_cheats_invalidate();
static void window_cheats_paint();
static void window_cheats_set_page(rct_window *w, int page);
static uint32 window_cheats_money_events[] = {
static void* window_cheats_money_events[] = {
window_cheats_emptysub,
window_cheats_money_mouseup,
window_cheats_emptysub,
@@ -115,7 +115,7 @@ static uint32 window_cheats_money_events[] = {
window_cheats_emptysub
};
static uint32 window_cheats_guests_events[] = {
static void* window_cheats_guests_events[] = {
window_cheats_emptysub,
window_cheats_guests_mouseup,
window_cheats_emptysub,
@@ -146,7 +146,7 @@ static uint32 window_cheats_guests_events[] = {
window_cheats_emptysub
};
static uint32 *window_cheats_page_events[] = {
static void* window_cheats_page_events[] = {
window_cheats_money_events,
window_cheats_guests_events,
};
@@ -167,7 +167,7 @@ void window_cheats_open()
if (window != NULL)
return;
window = window_create(32, 32, WW, WH, window_cheats_money_events, WC_CHEATS, 0);
window = window_create(32, 32, WW, WH, (uint32*)window_cheats_money_events, WC_CHEATS, 0);
window->widgets = window_cheats_money_widgets;
window->enabled_widgets = window_cheats_page_enabled_widgets[0];
window_init_scroll_widgets(window);
@@ -211,7 +211,6 @@ static void window_cheats_money_mouseup()
static void window_cheats_guests_mouseup()
{
int i;
short widgetIndex;
rct_window *w;
@@ -260,7 +259,7 @@ static void window_cheats_invalidate()
__asm mov w, esi
strcpy((char*)0x009BC677, "Cheats");
rct_widget **widgets = window_cheats_page_widgets[w->page];
rct_widget *widgets = window_cheats_page_widgets[w->page];
if (w->widgets != widgets) {
w->widgets = widgets;
window_init_scroll_widgets(w);
@@ -269,7 +268,7 @@ static void window_cheats_invalidate()
// Set correct active tab
for (i = 0; i < 7; i++)
w->pressed_widgets &= ~(1 << (WIDX_TAB_1 + i));
w->pressed_widgets |= 1 << (WIDX_TAB_1 + w->page);
w->pressed_widgets |= 1LL << (WIDX_TAB_1 + w->page);
}
static void window_cheats_paint()

View File

@@ -53,7 +53,7 @@ static void window_clear_scenery_update();
static void window_clear_scenery_invalidate();
static void window_clear_scenery_paint();
static uint32 window_clear_scenery_events[] = {
static void* window_clear_scenery_events[] = {
window_clear_scenery_close,
window_clear_scenery_mouseup,
window_clear_scenery_emptysub,
@@ -96,7 +96,7 @@ void window_clear_scenery_open()
if (window_find_by_id(WC_CLEAR_SCENERY, 0) != NULL)
return;
window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 67, window_clear_scenery_events, WC_CLEAR_SCENERY, 0);
window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 67, (uint32*)window_clear_scenery_events, WC_CLEAR_SCENERY, 0);
window->widgets = window_clear_scenery_widgets;
window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_INCREMENT) | (1 << WIDX_DECREMENT);
window_init_scroll_widgets(window);

View File

@@ -51,13 +51,13 @@ int _dropdown_item_height;
int _dropdown_highlighted_index;
uint16 gDropdownItemsFormat[64];
sint32 gDropdownItemsArgs[64];
sint64 gDropdownItemsArgs[64];
uint32 gDropdownItemsChecked;
static void window_dropdown_emptysub() { }
static void window_dropdown_paint();
static uint32 window_dropdown_events[] = {
static void* window_dropdown_events[] = {
window_dropdown_emptysub,
window_dropdown_emptysub,
window_dropdown_emptysub,
@@ -130,12 +130,10 @@ void window_dropdown_show_text(int x, int y, int extray, uint8 colour, uint8 fla
void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colour, uint8 flags, int num_items, int width)
{
rct_window* w;
int i, string_width, max_string_width;
char buffer[256];
// Copy the formats and arguments until all use of it is decompiled
memcpy(0x009DEBA4, gDropdownItemsFormat, 37 * 2);
memcpy(0x009DEBF4, gDropdownItemsArgs, 80 * 4);
memcpy((void*)0x009DEBA4, gDropdownItemsFormat, 40 * 2);
memcpy((void*)0x009DEBF4, gDropdownItemsArgs, 40 * 8);
RCT2_GLOBAL(0x009DE518, uint32) &= ~(0x04 | 0x02);
if (flags & 0x80)
@@ -159,7 +157,7 @@ void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colo
x, y + extray,
window_dropdown_widgets[WIDX_BACKGROUND].right + 1,
window_dropdown_widgets[WIDX_BACKGROUND].bottom + 1,
window_dropdown_events,
(uint32*)window_dropdown_events,
WC_DROPDOWN,
0x02
);
@@ -199,12 +197,12 @@ void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colo
*/
void window_dropdown_show_image(int x, int y, int extray, uint8 colour, uint8 flags, int numItems, int itemWidth, int itemHeight, int numColumns)
{
int i, width, height;
int width, height;
rct_window* w;
// Copy the formats and arguments until all use of it is decompiled
memcpy(0x009DEBA4, gDropdownItemsFormat, 37 * 2);
memcpy(0x009DEBF4, gDropdownItemsArgs, 80 * 4);
memcpy((void*)0x009DEBA4, gDropdownItemsFormat, 40 * 2);
memcpy((void*)0x009DEBF4, gDropdownItemsArgs, 40 * 8);
RCT2_GLOBAL(0x009DE518, uint32) &= ~(0x04 | 0x02);
if (flags & 0x80)
@@ -237,7 +235,7 @@ void window_dropdown_show_image(int x, int y, int extray, uint8 colour, uint8 fl
x, y + extray,
window_dropdown_widgets[WIDX_BACKGROUND].right + 1,
window_dropdown_widgets[WIDX_BACKGROUND].bottom + 1,
window_dropdown_events,
(uint32*)window_dropdown_events,
WC_DROPDOWN,
WF_STICK_TO_FRONT
);
@@ -312,7 +310,7 @@ static void window_dropdown_paint()
item = gDropdownItemsFormat[i];
if (item == (uint16)-1 || item == (uint16)-2) {
// Image item
image = gDropdownItemsArgs[i];
image = *((uint32*)&gDropdownItemsArgs[i]);
if (item == (uint16)-2 && _dropdown_highlighted_index == i)
image++;

View File

@@ -28,7 +28,7 @@
extern int gAppropriateImageDropdownItemsPerRow[];
extern uint16 gDropdownItemsFormat[64];
extern sint32 gDropdownItemsArgs[64];
extern sint64 gDropdownItemsArgs[64];
extern uint32 gDropdownItemsChecked;
void window_dropdown_show_text(int x, int y, int extray, uint8 colour, uint8 flags, int num_items);

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John
* Copyright (c) 2014 Maciek Baron
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
@@ -18,11 +18,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <windows.h>
#include <ShlObj.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "settings.h"
#include "screenshot.h"
#include "addresses.h"
#include "game.h"
#include "window.h"
enum {
WINDOW_FINANCES_TAB_SUMMARY,
WINDOW_FINANCES_TAB_FINANCIAL_GRAPH,
WINDOW_FINANCES_TAB_VALUE_GRAPH,
WINDOW_FINANCES_TAB_PROFIT_GRAPH,
WINDOW_FINANCES_TAB_MARKETING,
WINDOW_FINANCES_TAB_RESEARCH
} WINDOW_FINANCIAL_TAB;

View File

@@ -116,7 +116,7 @@ static void window_footpath_toolup();
static void window_footpath_invalidate();
static void window_footpath_paint();
static uint32 window_footpath_events[] = {
static void* window_footpath_events[] = {
window_footpath_close,
window_footpath_mouseup,
window_footpath_emptysub,
@@ -174,7 +174,7 @@ void window_footpath_open()
29,
106,
381,
window_footpath_events,
(uint32*)window_footpath_events,
WC_FOOTPATH,
0
);
@@ -270,7 +270,7 @@ static void window_footpath_mouseup()
break;
_window_footpath_cost = 0x80000000;
RCT2_CALLPROC_EBPSAFE(0x006EE281);
tool_cancel();
RCT2_CALLPROC_EBPSAFE(0x006A7831);
RCT2_CALLPROC_EBPSAFE(0x0068AB1B);
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~2;
@@ -305,25 +305,25 @@ static void window_footpath_mousedown()
window_footpath_show_footpath_types_dialog(w, widget, 1);
break;
case WIDX_DIRECTION_NW:
RCT2_CALLPROC_X(0x006A8111, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A8111, 0, 0, 0, 0, (int)w, 0, 0);
break;
case WIDX_DIRECTION_NE:
RCT2_CALLPROC_X(0x006A8135, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A8135, 0, 0, 0, 0, (int)w, 0, 0);
break;
case WIDX_DIRECTION_SW:
RCT2_CALLPROC_X(0x006A815C, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A815C, 0, 0, 0, 0, (int)w, 0, 0);
break;
case WIDX_DIRECTION_SE:
RCT2_CALLPROC_X(0x006A8183, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A8183, 0, 0, 0, 0, (int)w, 0, 0);
break;
case WIDX_SLOPEDOWN:
RCT2_CALLPROC_X(0x006A81AA, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A81AA, 0, 0, 0, 0, (int)w, 0, 0);
break;
case WIDX_LEVEL:
RCT2_CALLPROC_X(0x006A81C5, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A81C5, 0, 0, 0, 0, (int)w, 0, 0);
break;
case WIDX_SLOPEUP:
RCT2_CALLPROC_X(0x006A81E0, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A81E0, 0, 0, 0, 0, (int)w, 0, 0);
break;
}
}
@@ -388,10 +388,9 @@ static void window_footpath_dropdown()
*/
static void window_footpath_toolupdate()
{
int x, y, z;
int x, y;
short widgetIndex;
rct_window *w;
rct_map_element *mapElement;
__asm mov x, eax
__asm mov y, ebx
@@ -401,7 +400,7 @@ static void window_footpath_toolupdate()
if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) {
window_footpath_set_provisional_path_at_point(x, y);
} else if (widgetIndex == WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL) {
RCT2_CALLPROC_X(0x006A8388, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A8388, 0, 0, 0, 0, (int)w, 0, 0);
}
}
@@ -411,10 +410,9 @@ static void window_footpath_toolupdate()
*/
static void window_footpath_tooldown()
{
int x, y, z;
int x, y;
short widgetIndex;
rct_window *w;
rct_map_element *mapElement;
__asm mov x, eax
__asm mov y, ebx
@@ -424,7 +422,7 @@ static void window_footpath_tooldown()
if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) {
window_footpath_place_path_at_point(x, y);
} else if (widgetIndex == WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL) {
RCT2_CALLPROC_X(0x006A840F, x, y, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A840F, x, y, 0, 0, (int)w, 0, 0);
}
}
@@ -444,7 +442,7 @@ static void window_footpath_tooldrag()
__asm mov w, esi
if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) {
RCT2_CALLPROC_X(0x006A82C5, x, y, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A82C5, x, y, 0, 0, (int)w, 0, 0);
}
}
@@ -464,7 +462,7 @@ static void window_footpath_toolup()
__asm mov w, esi
if (widgetIndex == WIDX_CONSTRUCT_ON_LAND) {
RCT2_CALLPROC_X(0x006A8380, x, y, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x006A8380, x, y, 0, 0, (int)w, 0, 0);
}
}
@@ -649,7 +647,7 @@ static void window_footpath_set_provisional_path_at_point(int x, int y)
x = eax & 0xFFFF;
z = ebx & 0xFF;
y = ecx & 0xFFFF;
mapElement = edx;
mapElement = (rct_map_element*)edx;
if (z == 0) {
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= ~1;
@@ -686,8 +684,7 @@ static void window_footpath_set_provisional_path_at_point(int x, int y)
*/
static int window_footpath_set_provisional_path(int type, int x, int y, int z, int slope)
{
int cost;
int eax, ebx, ecx, edx, esi, edi, ebp;
int eax, cost;
RCT2_CALLPROC_EBPSAFE(0x006A77FF);
@@ -732,7 +729,7 @@ static void window_footpath_place_path_at_point(int x, int y)
x = eax & 0xFFFF;
z = ebx & 0xFF;
y = ecx & 0xFFFF;
mapElement = edx;
mapElement = (rct_map_element*)edx;
if (z == 0)
return;
@@ -775,7 +772,7 @@ static void window_footpath_construct()
*/
static void window_footpath_remove()
{
int x, y, z, lastTile;
int x, y, lastTile;
rct_map_element *mapElement;
// RCT2_CALLPROC_EBPSAFE(0x006A7863);

View File

@@ -77,7 +77,7 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi,
static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rct_window *w);
static void window_game_bottom_toolbar_draw_tutorial_text(rct_drawpixelinfo *dpi, rct_window *w);
static uint32 window_game_bottom_toolbar_events[] = {
static void* window_game_bottom_toolbar_events[] = {
window_game_bottom_toolbar_emptysub,
window_game_bottom_toolbar_mouseup,
window_game_bottom_toolbar_emptysub,
@@ -119,7 +119,7 @@ void window_game_bottom_toolbar_open()
window = window_create(
0, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 32,
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), 32,
window_game_bottom_toolbar_events,
(uint32*)window_game_bottom_toolbar_events,
WC_BOTTOM_TOOLBAR,
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5
);
@@ -163,17 +163,17 @@ static void window_game_bottom_toolbar_mouseup()
RCT2_CALLPROC_EBPSAFE(0x0069DDF1);
break;
case WIDX_GUESTS:
RCT2_CALLPROC_EBPSAFE(0x00667D35);
window_park_guests_open();
break;
case WIDX_PARK_RATING:
RCT2_CALLPROC_EBPSAFE(0x00667CA4);
window_park_rating_open();
break;
case WIDX_MIDDLE_INSET:
news_item_close_current();
break;
case WIDX_NEWS_SUBJECT:
newsItem = &(RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item)[0]);
RCT2_CALLPROC_X(0x0066EBE6, 0, newsItem->type, newsItem->assoc, 0, 0, 0, 0);
news_item_open_subject(newsItem->type, newsItem->assoc);
break;
case WIDX_NEWS_LOCATE:
newsItem = &(RCT2_ADDRESS(RCT2_ADDRESS_NEWS_ITEM_LIST, rct_news_item)[0]);
@@ -204,8 +204,7 @@ static void window_game_bottom_toolbar_tooltip()
{
int month, day;
short widgetIndex;
rct_window *w, *mainWindow;
rct_news_item *newsItem;
rct_window *w;
__asm mov widgetIndex, dx
__asm mov w, esi
@@ -332,7 +331,6 @@ void window_game_bottom_toolbar_invalidate_news_item()
*/
static void window_game_bottom_toolbar_paint()
{
int x, y, imgId;
rct_window *w;
rct_drawpixelinfo *dpi;
@@ -525,7 +523,7 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
(window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].left + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].right) / 2 + w->x,
w->y + window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].top + 11,
0,
dpi,
(int)dpi,
(newsItem->ticks << 16) | (window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].right - window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].left - 62)
);
@@ -615,7 +613,7 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rc
break;
case NEWS_ITEM_MONEY:
gfx_draw_sprite(dpi, SPR_FINANCE, x, y);
case NEWS_ITEM_SCENERY:
case NEWS_ITEM_RESEARCH:
gfx_draw_sprite(dpi, (newsItem->assoc < 0x10000 ? SPR_NEW_RIDE : SPR_SCENERY), x, y);
break;
case NEWS_ITEM_PEEPS:

View File

@@ -82,7 +82,7 @@ static void window_game_top_toolbar_dropdown();
static void window_game_top_toolbar_invalidate();
static void window_game_top_toolbar_paint();
static uint32 window_game_top_toolbar_events[] = {
static void* window_game_top_toolbar_events[] = {
window_game_top_toolbar_emptysub,
window_game_top_toolbar_mouseup,
window_game_top_toolbar_emptysub,
@@ -92,11 +92,11 @@ static uint32 window_game_top_toolbar_events[] = {
window_game_top_toolbar_emptysub,
window_game_top_toolbar_emptysub,
window_game_top_toolbar_emptysub,
0x0066CB25,
0x0066CB73,
0x0066CB4E,
0x0066CC5B,
0x0066CA58,
(void*)0x0066CB25,
(void*)0x0066CB73,
(void*)0x0066CB4E,
(void*)0x0066CC5B,
(void*)0x0066CA58,
window_game_top_toolbar_emptysub,
window_game_top_toolbar_emptysub,
window_game_top_toolbar_emptysub,
@@ -124,7 +124,7 @@ void window_game_top_toolbar_open()
window = window_create(
0, 0,
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16), 28,
window_game_top_toolbar_events,
(uint32*)window_game_top_toolbar_events,
WC_TOP_TOOLBAR,
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_5
);
@@ -208,9 +208,10 @@ static void window_game_top_toolbar_mouseup()
}
break;
case WIDX_SCENERY:
tool_set(w, WIDX_SCENERY, 0);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_CALLPROC_EBPSAFE(0x006E0FEF);
if (!tool_set(w, WIDX_SCENERY, 0)) {
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 6);
RCT2_CALLPROC_EBPSAFE(0x006E0FEF);
}
break;
case WIDX_PATH:
if (window_find_by_id(WC_FOOTPATH, 0) == NULL) {
@@ -355,7 +356,7 @@ static void window_game_top_toolbar_dropdown()
break;
}
char *src = 0x0141EF67;
char *src = (char*)0x0141EF67;
do {
src++;
} while (*src != '.' && *src != '\0');
@@ -376,7 +377,8 @@ static void window_game_top_toolbar_dropdown()
window_about_open();
break;
case 4: // options
RCT2_CALLPROC_EBPSAFE(0x006BAC5B);
window_options_open();
//RCT2_CALLPROC_EBPSAFE(0x006BAC5B);
break;
case 5: // screenshot
RCT2_GLOBAL(RCT2_ADDRESS_SCREENSHOT_COUNTDOWN, sint8) = 10;

View File

@@ -84,7 +84,7 @@ static void window_guest_list_invalidate();
static void window_guest_list_paint();
static void window_guest_list_scrollpaint();
static uint32 window_guest_list_events[] = {
static void* window_guest_list_events[] = {
window_guest_list_emptysub,
window_guest_list_mouseup,
window_guest_list_resize,
@@ -130,7 +130,8 @@ static uint8 _window_guest_list_groups_guest_faces[240 * 58];
static int window_guest_list_is_peep_in_filter(rct_peep* peep);
static void window_guest_list_find_groups();
static int get_guest_face_sprite(rct_peep *peep);
static int get_guest_face_sprite_small(rct_peep *peep);
static int get_guest_face_sprite_large(rct_peep *peep);
/**
*
@@ -141,11 +142,11 @@ void window_guest_list_open()
rct_window* window;
// Check if window is already open
window = window_bring_to_front_by_id(WC_RIDE_LIST, 0);
window = window_bring_to_front_by_id(WC_GUEST_LIST, 0);
if (window != NULL)
return;
window = window_create_auto_pos(350, 330, window_guest_list_events, WC_GUEST_LIST, 0x0400);
window = window_create_auto_pos(350, 330, (uint32*)window_guest_list_events, WC_GUEST_LIST, 0x0400);
window->widgets = window_guest_list_widgets;
window->enabled_widgets =
(1 << WIDX_CLOSE) |
@@ -160,7 +161,7 @@ void window_guest_list_open()
window_init_scroll_widgets(window);
_window_guest_list_highlighted_index = -1;
window->var_490 = 0;
_window_guest_list_selected_tab = 1;
_window_guest_list_selected_tab = PAGE_INDIVIDUAL;
_window_guest_list_selected_filter = -1;
_window_guest_list_selected_page = 0;
_window_guest_list_num_pages = 1;
@@ -183,7 +184,6 @@ void window_guest_list_open()
*/
static void window_guest_list_mouseup()
{
int i;
short widgetIndex;
rct_window *w;
@@ -441,7 +441,7 @@ static void window_guest_list_scrollmousedown()
if (i == 0) {
// Open guest window
RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, peep, 0, 0, 0);
RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, (int)peep, 0, 0, 0);
break;
} else {
i--;
@@ -504,7 +504,7 @@ static void window_guest_list_invalidate()
w->pressed_widgets &= ~(1 << WIDX_TAB_1);
w->pressed_widgets &= ~(1 << WIDX_TAB_2);
w->pressed_widgets |= (1 << (_window_guest_list_selected_tab + WIDX_TAB_1));
w->pressed_widgets |= (1LL << (_window_guest_list_selected_tab + WIDX_TAB_1));
window_guest_list_widgets[WIDX_INFO_TYPE_DROPDOWN].image = STR_ACTIONS + _window_guest_list_selected_view;
window_guest_list_widgets[WIDX_MAP].type = WWT_EMPTY;
@@ -575,14 +575,14 @@ static void window_guest_list_paint()
} else {
format = STR_ALL_GUESTS_SUMMARISED;
}
gfx_draw_string_left_clipped(dpi, format, 0x00F1EDF6, 0, x, y, 310);
gfx_draw_string_left_clipped(dpi, format, (void*)0x00F1EDF6, 0, x, y, 310);
// Number of guests (list items)
if (_window_guest_list_selected_tab == PAGE_INDIVIDUAL) {
x = w->x + 4;
y = w->y + window_guest_list_widgets[WIDX_GUEST_LIST].bottom + 2;
RCT2_GLOBAL(0x013CE952, sint16) = w->var_492;
gfx_draw_string_left(dpi, (w->var_492 == 1 ? 1755 : 1754), 0x013CE952, 0, x, y);
gfx_draw_string_left(dpi, (w->var_492 == 1 ? 1755 : 1754), (void*)0x013CE952, 0, x, y);
}
}
@@ -593,7 +593,7 @@ static void window_guest_list_paint()
static void window_guest_list_scrollpaint()
{
int eax, ebx, ecx, edx, esi, edi, ebp;
int spriteIdx, format, numGuests, i, j, x, y;
int spriteIdx, format, numGuests, i, j, y;
rct_window *w;
rct_drawpixelinfo *dpi;
rct_peep *peep;
@@ -644,12 +644,12 @@ static void window_guest_list_scrollpaint()
// Guest name
RCT2_GLOBAL(0x013CE952, uint16) = peep->name_string_idx;
RCT2_GLOBAL(0x013CE954, uint32) = peep->id;
gfx_draw_string_left_clipped(dpi, format, 0x013CE952, 0, 0, y - 1, 113);
gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 0, y - 1, 113);
switch (_window_guest_list_selected_view) {
case VIEW_ACTIONS:
// Guest face
gfx_draw_sprite(dpi, get_guest_face_sprite(peep), 118, y);
gfx_draw_sprite(dpi, get_guest_face_sprite_small(peep), 118, y);
// Tracking icon
if (peep->flags & PEEP_FLAGS_TRACKING)
@@ -664,7 +664,7 @@ static void window_guest_list_scrollpaint()
RCT2_GLOBAL(0x013CE952, uint16) = ebx;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = ecx;
RCT2_GLOBAL(0x013CE952 + 4, uint32) = edx;
gfx_draw_string_left_clipped(dpi, format, 0x013CE952, 0, 133, y - 1, 314);
gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 133, y - 1, 314);
break;
case VIEW_THOUGHTS:
// For each thought
@@ -685,7 +685,7 @@ static void window_guest_list_scrollpaint()
RCT2_GLOBAL(0x013CE952, uint16) = ebx;
RCT2_GLOBAL(0x013CE952 + 2, uint32) = *((uint32*)esi);
RCT2_GLOBAL(0x013CE952 + 6, uint16) = *((uint16*)(esi + 4));
gfx_draw_string_left_clipped(dpi, format, 0x013CE952, 0, 118, y - 1, 329);
gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 118, y - 1, 329);
break;
}
break;
@@ -725,11 +725,11 @@ static void window_guest_list_scrollpaint()
RCT2_GLOBAL(0x013CE952 + 2, uint16) = _window_guest_list_groups_argument_1[i] >> 16;
RCT2_GLOBAL(0x013CE952 + 4, uint32) = _window_guest_list_groups_argument_2[i];
RCT2_GLOBAL(0x013CE952 + 10, uint32) = numGuests;
gfx_draw_string_left_clipped(dpi, format, 0x013CE952, 0, 0, y - 1, 414);
gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 0, y - 1, 414);
// Draw guest count
RCT2_GLOBAL(0x013CE95A, uint16) = STR_GUESTS_COUNT_COMMA_SEP;
gfx_draw_string_right(dpi, format, 0x0013CE95A, 0, 326, y - 1);
gfx_draw_string_right(dpi, format, (void*)0x0013CE95A, 0, 326, y - 1);
}
y += 21;
}
@@ -749,7 +749,7 @@ static int window_guest_list_is_peep_in_filter(rct_peep* peep)
temp = _window_guest_list_selected_view;
_window_guest_list_selected_view = _window_guest_list_selected_filter;
esi = peep;
esi = (int)peep;
RCT2_CALLFUNC_X(0x0069B7EA, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
ebx &= 0xFFFF;
@@ -797,6 +797,8 @@ static int sub_69B7EA(rct_peep *peep, int *outEAX)
*outEAX = 0;
return 0;
}
return 0;
}
/**
@@ -856,7 +858,7 @@ static void window_guest_list_find_groups()
_window_guest_list_groups_argument_2[groupIndex] = RCT2_GLOBAL(0x013CE952 + 2, uint32);
RCT2_ADDRESS(0x00F1AF26, uint8)[groupIndex] = groupIndex;
faceIndex = groupIndex * 56;
_window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite(peep) - 5486;
_window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite_small(peep) - 5486;
// Find more peeps that belong to same group
spriteIdx2 = peep->next;
@@ -880,7 +882,7 @@ static void window_guest_list_find_groups()
// Add face sprite, cap at 56 though
if (_window_guest_list_groups_num_guests[groupIndex] < 56)
continue;
_window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite(peep2) - 5486;
_window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite_small(peep2) - 5486;
}
if (RCT2_GLOBAL(0x00F1EDF6, uint16) == 0) {
@@ -927,14 +929,70 @@ static void window_guest_list_find_groups()
}
/**
*
* Function split into large and small sprite
* rct2: 0x00698721
*/
static int get_guest_face_sprite(rct_peep *peep)
static int get_guest_face_sprite_small(rct_peep *peep)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
esi = peep;
ebp = 999;
RCT2_CALLFUNC_X(0x00698721, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
return ebp;
}
int sprite;
sprite = 0x157A;
if (peep->var_F3) return sprite;
sprite = 0x1579;
if (peep->nausea > 200) return sprite;
sprite--;
if (peep->nausea > 170) return sprite;
sprite--;
if (peep->nausea > 140) return sprite;
sprite = 0x1576;
if (peep->energy < 46) return sprite;
sprite--;
if (peep->energy < 70) return sprite;
sprite = 0x156E;
for (int i = 37; peep->happiness >= i; i += 37)
{
sprite++;
}
return sprite;
}
/**
* Function split into large and small sprite
* rct2: 0x00698721
*/
static int get_guest_face_sprite_large(rct_peep* peep){
int sprite;
sprite = 5314;
if (peep->var_F3) return sprite;
sprite = 5298;
if (peep->nausea > 200) return sprite;
sprite = 0x14AE;
if (peep->nausea > 170) return sprite;
sprite = 0x14AD;
if (peep->nausea > 140) return sprite;
sprite = 0x14AC;
if (peep->energy < 46) return sprite;
sprite--;
if (peep->energy < 70) return sprite;
sprite = 0x14A4;
for (int i = 37; peep->happiness >= i; i += 37)
{
sprite++;
}
return sprite;
}

View File

@@ -58,7 +58,7 @@ static void window_land_update();
static void window_land_invalidate();
static void window_land_paint();
static uint32 window_land_events[] = {
static void* window_land_events[] = {
window_land_close,
window_land_mouseup,
window_land_emptysub,
@@ -122,7 +122,7 @@ void window_land_open()
if (window_find_by_id(WC_LAND, 0) != NULL)
return;
window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 126, window_land_events, WC_LAND, 0);
window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 98, 29, 98, 126, (uint32*)window_land_events, WC_LAND, 0);
window->widgets = window_land_widgets;
window->enabled_widgets =
(1 << WIDX_CLOSE) |
@@ -277,7 +277,7 @@ static void window_land_dropdown()
type = (dropdownIndex == -1) ?
_selectedFloorTexture :
gDropdownItemsArgs[dropdownIndex] - SPR_FLOOR_TEXTURE_GRASS;
*((uint32*)&gDropdownItemsArgs[dropdownIndex]) - SPR_FLOOR_TEXTURE_GRASS;
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) == type) {
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_SURFACE, uint8) = 255;
@@ -293,7 +293,7 @@ static void window_land_dropdown()
type = (dropdownIndex == -1) ?
_selectedWallTexture :
gDropdownItemsArgs[dropdownIndex] - SPR_WALL_TEXTURE_ROCK;
*((uint32*)&gDropdownItemsArgs[dropdownIndex]) - SPR_WALL_TEXTURE_ROCK;
if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) == type) {
RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_TERRAIN_EDGE, uint8) = 255;
@@ -368,19 +368,19 @@ static void window_land_paint()
RCT2_GLOBAL(0x009BC678, char) = FORMAT_COMMA16;
RCT2_GLOBAL(0x009BC679, char) = 0;
RCT2_GLOBAL(0x013CE952, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16);
gfx_draw_string_centred(dpi, 3165, x, y - 2, 0, 0x013CE952);
gfx_draw_string_centred(dpi, 3165, x, y - 2, 0, (void*)0x013CE952);
}
y = w->y + window_land_widgets[WIDX_PREVIEW].bottom + 5;
// Draw raise cost amount
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) != 0x80000000 && RCT2_GLOBAL(RCT2_ADDRESS_LAND_RAISE_COST, uint32) != 0)
gfx_draw_string_centred(dpi, 984, x, y, 0, RCT2_ADDRESS_LAND_RAISE_COST);
gfx_draw_string_centred(dpi, 984, x, y, 0, (void*)RCT2_ADDRESS_LAND_RAISE_COST);
y += 10;
// Draw lower cost amount
if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) != 0x80000000 && RCT2_GLOBAL(RCT2_ADDRESS_LAND_LOWER_COST, uint32) != 0)
gfx_draw_string_centred(dpi, 985, x, y, 0, RCT2_ADDRESS_LAND_LOWER_COST);
gfx_draw_string_centred(dpi, 985, x, y, 0, (void*)RCT2_ADDRESS_LAND_LOWER_COST);
y += 50;
// Draw paint price
@@ -393,7 +393,7 @@ static void window_land_paint()
if (price != 0 && !(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
RCT2_GLOBAL(0x013CE952, sint32) = price;
gfx_draw_string_centred(dpi, 986, x, y, 0, 0x013CE952);
gfx_draw_string_centred(dpi, 986, x, y, 0, (void*)0x013CE952);
}
}

View File

@@ -34,14 +34,14 @@ rct_widget window_main_widgets[] = {
void window_main_open()
{
rct_window* window;
rct_widget* main_widgets = 0x009A9414;
rct_widget* main_widgets = (rct_widget*)0x009A9414;
main_widgets[0].right = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
main_widgets[0].bottom = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16);
window = window_create(
0, 0,
window_main_widgets[0].right, window_main_widgets[0].bottom,
0x0097C0BC,
(uint32*)0x0097C0BC,
WC_MAIN_WINDOW,
WF_STICK_TO_BACK
);

58
src/window_new_ride.c Normal file
View File

@@ -0,0 +1,58 @@
/*****************************************************************************
* Copyright (c) 2014 Maciek Baron
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "addresses.h"
#include "game.h"
#include "window.h"
enum {
WINDOW_NEW_RIDE_TAB_TRANSPORT,
WINDOW_NEW_RIDE_TAB_GENTLE,
WINDOW_NEW_RIDE_TAB_ROLLER_COASTER,
WINDOW_NEW_RIDE_TAB_THRILL,
WINDOW_NEW_RIDE_TAB_WATER,
WINDOW_NEW_RIDE_TAB_SHOP,
WINDOW_NEW_RIDE_TAB_RESEARCH
} WINDOW_RIDE_CONSTRUCTION_TAB;
/**
*
* rct2: 0x006ACA58
*/
void window_new_ride_init_vars() {
// If we are in the track designer, default to the Roller Coaster tab
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) {
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_NEW_RIDE_TAB_ROLLER_COASTER;
}
else {
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_SELECTED_TAB, uint8) = WINDOW_NEW_RIDE_TAB_TRANSPORT;
}
for (short i = 0; i < 6; i++) {
/*
Reset what is highlighted in each tab.
Each 16bit number represents the item in its respective tab.
*/
RCT2_ADDRESS(RCT2_ADDRESS_WINDOW_RIDE_LIST_HIGHLIGHTED_ITEM, uint16)[i] = 0xFFFF;
}
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_RIDE_LIST_INFORMATION_TYPE, uint8) = 0;
}

View File

@@ -52,7 +52,7 @@ static void window_news_tooltip();
static void window_news_paint();
static void window_news_scrollpaint();
static uint32 window_news_events[] = {
static void* window_news_events[] = {
window_news_emptysub,
window_news_mouseup,
window_news_emptysub,
@@ -89,7 +89,6 @@ static uint32 window_news_events[] = {
*/
void window_news_open()
{
int x, y;
rct_window* window;
// Check if window is already open
@@ -98,7 +97,7 @@ void window_news_open()
window = window_create_auto_pos(
400,
300,
window_news_events,
(uint32*)window_news_events,
WC_RECENT_NEWS,
0
);
@@ -127,7 +126,6 @@ void window_news_open()
*/
static void window_news_mouseup()
{
int i;
short widgetIndex;
rct_window *w;
@@ -169,7 +167,7 @@ static void window_news_update()
if (newsItems[i].flags & 1)
return;
if (w->var_482 == 1) {
RCT2_CALLPROC_X(0x0066EBE6, 0, newsItems[i].type, newsItems[i].assoc, 0, 0, 0, 0);
news_item_open_subject(newsItems[i].type, newsItems[i].assoc);
return;
} else if (w->var_482 > 1) {
news_item_get_subject_location(newsItems[i].type, newsItems[i].assoc, &x, &y, &z);
@@ -276,7 +274,6 @@ static void window_news_tooltip()
*/
static void window_news_paint()
{
int x, y;
rct_window *w;
rct_drawpixelinfo *dpi;
@@ -318,12 +315,12 @@ static void window_news_scrollpaint()
// Date text
RCT2_GLOBAL(0x013CE952, uint16) = STR_DATE_DAY_1 + newsItem->day - 1;
RCT2_GLOBAL(0x013CE952 + 2, uint16) = STR_MONTH_MARCH + (newsItem->month % 8);
gfx_draw_string_left(dpi, 2235, 0x013CE952, 2, 4, y);
RCT2_GLOBAL(0x013CE952 + 2, uint16) = STR_MONTH_MARCH + (newsItem->month_year % 8);
gfx_draw_string_left(dpi, 2235, (void*)0x013CE952, 2, 4, y);
// Item text
RCT2_GLOBAL(0x009B5F2C, uint8) = newsItem->colour;
strcpy(0x009B5F2D, newsItem->text);
strcpy((char*)0x009B5F2D, newsItem->text);
gfx_draw_string_left_wrapped(dpi, 0, 2, y + 10, 325, 1926, 14);
// Subject button
@@ -352,7 +349,7 @@ static void window_news_scrollpaint()
case NEWS_ITEM_MONEY:
gfx_draw_sprite(dpi, SPR_FINANCE, x, yy);
break;
case NEWS_ITEM_SCENERY:
case NEWS_ITEM_RESEARCH:
gfx_draw_sprite(dpi, newsItem->assoc < 0x10000 ? SPR_NEW_RIDE : SPR_SCENERY, x, yy);
break;
case NEWS_ITEM_PEEPS:

332
src/window_options.c Normal file
View File

@@ -0,0 +1,332 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John, Dennis Devriendt
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "addresses.h"
#include "strings.h"
#include "widget.h"
#include "window.h"
#include "window_dropdown.h"
static enum WINDOW_OPTIONS_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_SOUND_GROUP,
WIDX_SOUND,
WIDX_SOUND_DROPDOWN,
WIDX_MUSIC,
WIDX_MUSIC_DROPDOWN,
WIDX_SOUND_QUALITY,
WIDX_SOUND_QUALITY_DROPDOWN,
WIDX_SOUND_SW_BUFFER_CHECKBOX,
WIDX_UNITS_GROUP,
WIDX_CURRENCY,
WIDX_CURRENCY_DROPDOWN,
WIDX_DISTANCE,
WIDX_DISTANCE_DROPDOWN,
WIDX_TEMPERATURE,
WIDX_TEMPERATURE_DROPDOWN,
WIDX_HEIGHT_LABELS,
WIDX_HEIGHT_LABELS_DROPDOWN,
WIDX_DISPLAY_GROUP,
WIDX_RESOLUTION,
WIDX_RESOLUTION_DROPDOWN,
WIDX_TILE_SMOOTHING_CHECKBOX,
WIDX_GRIDLINES_CHECKBOX,
WIDX_CONSTRUCTION_MARKER,
WIDX_CONSTRUCTION_MARKER_DROPDOWN,
WIDX_CONTROLS_GROUP,
WIDX_SCREEN_EDGE_SCROLLING,
WIDX_HOTKEY_DROPDOWN,
WIDX_GENERAL_GROUP,
WIDX_REAL_NAME_CHECKBOX,
WIDX_SAVE_PLUGIN_DATA_CHECKBOX
};
static rct_widget window_options_widgets[] = {
{ WWT_FRAME, 0, 0, 309, 0, 371, STR_NONE, STR_NONE },
{ WWT_CAPTION, 0, 1, 308, 1, 14, STR_OPTIONS, STR_WINDOW_TITLE_TIP },
{ WWT_CLOSEBOX, 0, 297, 307, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP },
{ WWT_GROUPBOX, 0, 3, 306, 17, 93, STR_SOUND, STR_NONE },
{ WWT_DROPDOWN, 0, 10, 299, 31, 42, 0x361, STR_NONE }, // sound
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 32, 41, 0x36C, STR_NONE },
{ WWT_DROPDOWN, 0, 155, 299, 46, 57, 0x365, STR_NONE }, // music
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 47, 56, 0x36C, STR_NONE },
{ WWT_DROPDOWN, 0, 155, 299, 61, 72, 0x366, STR_NONE }, // sound quality
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 62, 71, 0x36C, STR_NONE },
{ WWT_CHECKBOX, 0, 10, 299, 76, 87, STR_SOUND_FORCED_SOFTWARE_BUFFER_MIXING, STR_SOUND_FORCED_SOFTWARE_BUFFER_MIXING_TIP },
{ WWT_GROUPBOX, 0, 3, 306, 100, 176, STR_UNITS, STR_NONE },
{ WWT_DROPDOWN, 0, 155, 299, 114, 125, 0x367, STR_NONE }, // currency
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 115, 124, 0x36C, STR_NONE },
{ WWT_DROPDOWN, 0, 155, 299, 129, 140, 0x368, STR_NONE }, // distance
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 130, 139, 0x36C, STR_NONE },
{ WWT_DROPDOWN, 0, 155, 299, 144, 155, 0x36B, STR_NONE }, // temperature
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 145, 154, 0x36C, STR_NONE },
{ WWT_DROPDOWN, 0, 155, 299, 159, 170, 0x364, STR_NONE }, // height labels
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 160, 169, 0x36C, STR_NONE },
{ WWT_GROUPBOX, 0, 3, 306, 182, 258, STR_DISPLAY, STR_NONE },
{ WWT_DROPDOWN, 0, 155, 299, 196, 207, 0x348, STR_NONE }, // resolution
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 197, 206, 0x36C, STR_NONE },
{ WWT_CHECKBOX, 0, 10, 299, 212, 223, STR_TILE_SMOOTHING, STR_TILE_SMOOTHING_TIP },
{ WWT_CHECKBOX, 0, 10, 299, 227, 238, STR_GRIDLINES, STR_GRIDLINES_TIP },
{ WWT_DROPDOWN, 0, 155, 299, 241, 252, STR_NONE, STR_NONE }, // construction marker
{ WWT_DROPDOWN_BUTTON, 0, 288, 298, 242, 251, 0x36C, STR_NONE },
{ WWT_GROUPBOX, 0, 3, 306, 264, 310, STR_CONTROLS, STR_NONE },
{ WWT_CHECKBOX, 2, 10, 299, 279, 290, STR_SCREEN_EDGE_SCROLLING, STR_SCREEN_EDGE_SCROLLING_TIP },
{ WWT_DROPDOWN_BUTTON, 0, 26, 185, 293, 304, STR_HOTKEY, STR_HOTKEY_TIP },
{ WWT_GROUPBOX, 0, 3, 306, 317, 365, STR_GENERAL, STR_NONE },
{ WWT_CHECKBOX, 2, 10, 299, 331, 342, STR_REAL_NAME, STR_REAL_NAME_TIP },
{ WWT_CHECKBOX, 2, 10, 299, 346, 357, STR_SAVE_PLUGIN_DATA, STR_SAVE_PLUGIN_DATA_TIP },
{ WIDGETS_END },
};
static void window_options_emptysub() { }
static void window_options_mouseup();
static void window_options_mousedown();
static void window_options_dropdown();
static void window_options_update();
static void window_options_paint();
static void* window_options_events[] = {
window_options_emptysub,
window_options_mouseup,
window_options_emptysub,
window_options_mousedown,
window_options_dropdown,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_emptysub,
window_options_update,
window_options_paint,
window_options_emptysub
};
/**
*
* rct2: 0x006BAC5B
*/
void window_options_open()
{
rct_window* w;
// Check if window is already open
w = window_bring_to_front_by_id(WC_OPTIONS, 0);
if (w != NULL)
return;
w = window_create_auto_pos(310, 372, (uint32*)window_options_events, WC_OPTIONS, 0);
w->widgets = window_options_widgets;
w->enabled_widgets =
(1 << WIDX_CLOSE) |
(1 << WIDX_SOUND) |
(1 << WIDX_SOUND_DROPDOWN) |
(1 << WIDX_MUSIC) |
(1 << WIDX_MUSIC_DROPDOWN) |
(1 << WIDX_SOUND_QUALITY) |
(1 << WIDX_SOUND_QUALITY_DROPDOWN) |
(1 << WIDX_CURRENCY) |
(1 << WIDX_CURRENCY_DROPDOWN) |
(1 << WIDX_DISTANCE) |
(1 << WIDX_DISTANCE_DROPDOWN) |
(1 << WIDX_RESOLUTION) |
(1 << WIDX_RESOLUTION_DROPDOWN) |
(1 << WIDX_TEMPERATURE) |
(1 << WIDX_TEMPERATURE_DROPDOWN) |
(1 << WIDX_HOTKEY_DROPDOWN) |
(1 << WIDX_SCREEN_EDGE_SCROLLING) |
(1 << WIDX_REAL_NAME_CHECKBOX) |
(1 << WIDX_CONSTRUCTION_MARKER) |
(1 << WIDX_CONSTRUCTION_MARKER_DROPDOWN) |
(1 << WIDX_HEIGHT_LABELS) |
(1 << WIDX_HEIGHT_LABELS_DROPDOWN) |
(1 << WIDX_TILE_SMOOTHING_CHECKBOX) |
(1 << WIDX_GRIDLINES_CHECKBOX) |
(1 << WIDX_SOUND_SW_BUFFER_CHECKBOX);
// TODO: missing .text:006BAD22 or dword ptr [esi+0Ch], 1
window_init_scroll_widgets(w);
w->colours[0] = 7;
w->colours[1] = 7;
w->colours[2] = 7;
}
/**
*
* rct2: 0x006BAFCA
*/
static void window_options_mouseup()
{
RCT2_CALLPROC_EBPSAFE(0x006BAFCA);
}
/**
*
* rct2: 0x006BB01B
*/
static void window_options_mousedown()
{
//RCT2_CALLPROC_EBPSAFE(0x006BB01B);
int numItems, i;
sint64 device;
short widgetIndex;
rct_window *w;
rct_widget *widget;
__asm mov widgetIndex, dx
__asm mov w, esi
widget = &w->widgets[widgetIndex - 1];
switch (widgetIndex) {
case WIDX_SOUND_DROPDOWN:
numItems = RCT2_GLOBAL(RCT2_ADDRESS_NUM_DSOUND_DEVICES, uint32);
if (numItems == 0)
break;
window_dropdown_show_text_custom_width(
w->x + widget->left,
w->y + widget->top,
widget->bottom - widget->top + 1,
w->colours[1],
0x80,
numItems,
widget->right - widget->left - 3
);
// populate the list with the sound devices
device = RCT2_GLOBAL(RCT2_ADDRESS_DSOUND_DEVICES, sint32) + 0x10;
for (i = 0; i < numItems; i++) {
gDropdownItemsFormat[i] = 1142;
gDropdownItemsArgs[i] = 1170 | (device << 16);
device += 0x210;
}
gDropdownItemsChecked |= (1 << RCT2_GLOBAL(0x9AF280, uint32));
break;
case WIDX_HEIGHT_LABELS_DROPDOWN:
RCT2_CALLPROC_EBPSAFE(0x006BB517);
break;
case WIDX_MUSIC_DROPDOWN:
RCT2_CALLPROC_EBPSAFE(0x006BB5A8);
break;
case WIDX_SOUND_QUALITY_DROPDOWN:
RCT2_CALLPROC_EBPSAFE(0x006BB631);
break;
case WIDX_CURRENCY_DROPDOWN:
RCT2_CALLPROC_EBPSAFE(0x006BB494);
break;
case WIDX_DISTANCE_DROPDOWN:
RCT2_CALLPROC_EBPSAFE(0x006BB3E6);
break;
case WIDX_RESOLUTION_DROPDOWN:
RCT2_CALLPROC_EBPSAFE(0x006BB2AF);
break;
case WIDX_TEMPERATURE_DROPDOWN:
RCT2_CALLPROC_EBPSAFE(0x006BB21F);
break;
case WIDX_CONSTRUCTION_MARKER_DROPDOWN:
RCT2_CALLPROC_EBPSAFE(0x006BB18F);
break;
}
}
/**
*
* rct2: 0x006BB076
*/
static void window_options_dropdown()
{
RCT2_CALLPROC_EBPSAFE(0x006BB076);
/*short widgetIndex;
rct_window *w;
__asm mov widgetIndex, dx
__asm mov w, esi
switch (widgetIndex) {
case WIDX_SOUND_DROPDOWN:
RCT2_CALLPROC_EBPSAFE(0x006BB757);
break;
}*/
}
/**
*
* rct2: 0x006BAD48
*/
static void window_options_update()
{
RCT2_CALLPROC_EBPSAFE(0x006BAD48);
}
/**
*
* rct2: 0x006BAEB4
*/
static void window_options_paint()
{
rct_window *w;
rct_drawpixelinfo *dpi;
__asm mov w, esi
__asm mov dpi, edi
window_draw_widgets(w, dpi);
// units
gfx_draw_string_left(dpi, STR_CURRENCY, w, 0, w->x + 10,
w->y + window_options_widgets[WIDX_CURRENCY].top + 1);
gfx_draw_string_left(dpi, STR_DISTANCE_AND_SPEED, w, 0, w->x + 10,
w->y + window_options_widgets[WIDX_DISTANCE].top + 1);
gfx_draw_string_left(dpi, STR_TEMPERATURE, w, 0, w->x + 10,
w->y + window_options_widgets[WIDX_TEMPERATURE].top + 1);
gfx_draw_string_left(dpi, STR_HEIGHT_LABELS, w, 0, w->x + 10,
w->y + window_options_widgets[WIDX_HEIGHT_LABELS].top + 1);
// display
gfx_draw_string_left(dpi, STR_DISPLAY_RESOLUTION, w, 0, w->x + 10,
w->y + window_options_widgets[WIDX_RESOLUTION].top + 1);
gfx_draw_string_left(dpi, STR_CONSTRUCTION_MARKER, w, 0, w->x + 10,
w->y + window_options_widgets[WIDX_CONSTRUCTION_MARKER].top + 1);
// sound
gfx_draw_string_left(dpi, STR_MUSIC, w, 0, w->x + 10,
w->y + window_options_widgets[WIDX_MUSIC].top + 1);
gfx_draw_string_left(dpi, STR_SOUND_QUALITY, w, 0, w->x + 10,
w->y + window_options_widgets[WIDX_SOUND_QUALITY].top + 1);
}

View File

@@ -264,7 +264,7 @@ static void window_park_awards_update();
static void window_park_awards_invalidate();
static void window_park_awards_paint();
static uint32 window_park_entrance_events[] = {
static void* window_park_entrance_events[] = {
window_park_entrance_close,
window_park_entrance_mouseup,
window_park_entrance_resize,
@@ -295,7 +295,7 @@ static uint32 window_park_entrance_events[] = {
window_park_emptysub
};
static uint32 window_park_rating_events[] = {
static void* window_park_rating_events[] = {
window_park_emptysub,
window_park_rating_mouseup,
window_park_rating_resize,
@@ -326,7 +326,7 @@ static uint32 window_park_rating_events[] = {
window_park_emptysub
};
static uint32 window_park_guests_events[] = {
static void* window_park_guests_events[] = {
window_park_emptysub,
window_park_guests_mouseup,
window_park_guests_resize,
@@ -357,7 +357,7 @@ static uint32 window_park_guests_events[] = {
window_park_emptysub
};
static uint32 window_park_price_events[] = {
static void* window_park_price_events[] = {
window_park_emptysub,
window_park_price_mouseup,
window_park_price_resize,
@@ -388,7 +388,7 @@ static uint32 window_park_price_events[] = {
window_park_emptysub
};
static uint32 window_park_stats_events[] = {
static void* window_park_stats_events[] = {
window_park_emptysub,
window_park_stats_mouseup,
window_park_stats_resize,
@@ -419,7 +419,7 @@ static uint32 window_park_stats_events[] = {
window_park_emptysub
};
static uint32 window_park_objective_events[] = {
static void* window_park_objective_events[] = {
window_park_emptysub,
window_park_objective_mouseup,
window_park_objective_resize,
@@ -450,7 +450,7 @@ static uint32 window_park_objective_events[] = {
window_park_emptysub
};
static uint32 window_park_awards_events[] = {
static void* window_park_awards_events[] = {
window_park_emptysub,
window_park_awards_mouseup,
window_park_awards_resize,
@@ -481,7 +481,7 @@ static uint32 window_park_awards_events[] = {
window_park_emptysub
};
static uint32 *window_park_page_events[] = {
static void* window_park_page_events[] = {
window_park_entrance_events,
window_park_rating_events,
window_park_guests_events,
@@ -589,7 +589,7 @@ rct_window *window_park_open()
{
rct_window* w;
w = window_create_auto_pos(230, 174, window_park_entrance_events, WC_PARK_INFORMATION, 0x0400);
w = window_create_auto_pos(230, 174, (uint32*)window_park_entrance_events, WC_PARK_INFORMATION, 0x0400);
w->widgets = window_park_entrance_widgets;
w->enabled_widgets = window_park_page_enabled_widgets[WINDOW_PARK_PAGE_ENTRANCE];
w->number = 0;
@@ -599,7 +599,7 @@ rct_window *window_park_open()
w->var_490 = -1;
w->var_48C = -1;
w->var_492 = 0;
RCT2_CALLPROC_X(0x00667F8B, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x00667F8B, 0, 0, 0, 0, (int)w, 0, 0);
w->colours[0] = 1;
w->colours[1] = 19;
w->colours[2] = 19;
@@ -628,7 +628,7 @@ void window_park_entrance_open()
window_invalidate(window);
window->widgets = window_park_entrance_widgets;
window->enabled_widgets = window_park_page_enabled_widgets[WINDOW_PARK_PAGE_ENTRANCE];
window->event_handlers = window_park_entrance_events;
window->event_handlers = (uint32*)window_park_entrance_events;
window->pressed_widgets = 0;
window_init_scroll_widgets(window);
window_park_init_viewport(window);
@@ -646,7 +646,7 @@ static void window_park_entrance_close()
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
RCT2_CALLPROC_EBPSAFE(0x006EE281);
tool_cancel();
}
/**
@@ -675,10 +675,10 @@ static void window_park_entrance_mouseup()
window_park_set_page(w, widgetIndex - WIDX_TAB_1);
break;
case WIDX_BUY_LAND_RIGHTS:
RCT2_CALLPROC_X(0x006682F7, 0, 0, 0, widgetIndex, w, 0, 0);
RCT2_CALLPROC_X(0x006682F7, 0, 0, 0, widgetIndex, (int)w, 0, 0);
break;
case WIDX_BUY_CONSTRUCTION_RIGHTS:
RCT2_CALLPROC_X(0x00668393, 0, 0, 0, widgetIndex, w, 0, 0);
RCT2_CALLPROC_X(0x00668393, 0, 0, 0, widgetIndex, (int)w, 0, 0);
break;
case WIDX_LOCATE:
window_park_scroll_to_viewport(w);
@@ -791,7 +791,7 @@ static void window_park_entrance_toolupdate()
{
int x, y;
short widgetIndex;
rct_window *w, *mainWindow;
rct_window *w;
__asm mov x, eax
__asm mov y, ebx
@@ -799,7 +799,7 @@ static void window_park_entrance_toolupdate()
__asm mov w, esi
if (widgetIndex == WIDX_BUY_LAND_RIGHTS) {
RCT2_CALLPROC_X(0x0068AAE1, x, y, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x0068AAE1, x, y, 0, 0, (int)w, 0, 0);
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, uint16) &= 0xFFFE;
screen_pos_to_map_pos(&x, &y);
if (x != SPRITE_LOCATION_NULL) {
@@ -809,7 +809,7 @@ static void window_park_entrance_toolupdate()
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_X, uint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_A_Y, uint16) = y;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_B_Y, uint16) = y;
RCT2_CALLPROC_X(0x0068AAE1, x, y, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x0068AAE1, x, y, 0, 0, (int)w, 0, 0);
}
}
}
@@ -821,14 +821,14 @@ static void window_park_entrance_toolupdate()
static void window_park_entrance_tooldown()
{
short x, y, widgetIndex;
rct_window *w, *mainWindow;
rct_window *w;
__asm mov x, ax
__asm mov y, bx
__asm mov widgetIndex, dx
__asm mov w, esi
RCT2_CALLPROC_X(0x006681E6, x, y, 0, widgetIndex, w, 0, 0);
RCT2_CALLPROC_X(0x006681E6, x, y, 0, widgetIndex, (int)w, 0, 0);
}
/**
@@ -838,14 +838,14 @@ static void window_park_entrance_tooldown()
static void window_park_entrance_tooldrag()
{
short x, y, widgetIndex;
rct_window *w, *mainWindow;
rct_window *w;
__asm mov x, ax
__asm mov y, bx
__asm mov widgetIndex, dx
__asm mov w, esi
RCT2_CALLPROC_X(0x006681FB, x, y, 0, widgetIndex, w, 0, 0);
RCT2_CALLPROC_X(0x006681FB, x, y, 0, widgetIndex, (int)w, 0, 0);
}
/**
@@ -855,7 +855,7 @@ static void window_park_entrance_tooldrag()
static void window_park_entrance_toolabort()
{
short widgetIndex;
rct_window *w, *mainWindow;
rct_window *w;
__asm mov widgetIndex, dx
__asm mov w, esi
@@ -952,7 +952,6 @@ static void window_park_entrance_invalidate()
*/
static void window_park_entrance_paint()
{
int i, x, y;
rct_window *w;
rct_drawpixelinfo *dpi;
rct_widget *labelWidget;
@@ -977,7 +976,7 @@ static void window_park_entrance_paint()
gfx_draw_string_centred_clipped(
dpi,
1191,
0x013CE952,
(void*)0x013CE952,
0,
w->x + (labelWidget->left + labelWidget->right) / 2,
w->y + labelWidget->top,
@@ -1025,7 +1024,7 @@ static void window_park_init_viewport(rct_window *w)
}
// Call invalidate event
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
w->var_482 = x;
w->var_484 = y;
@@ -1083,6 +1082,35 @@ static void window_park_scroll_to_viewport(rct_window *w)
#pragma region Rating page
/**
*
* rct2: 0x00667CA4
*/
void window_park_rating_open()
{
rct_window* window;
window = window_bring_to_front_by_id(WC_PARK_INFORMATION, 0);
if (window == NULL) {
window = window_park_open();
window->var_482 = -1;
window->var_484 = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
window->viewport = NULL;
window->page = WINDOW_PARK_PAGE_RATING;
window_invalidate(window);
window->widgets = window_park_rating_widgets;
window->enabled_widgets = window_park_page_enabled_widgets[WINDOW_PARK_PAGE_RATING];
window->var_020 = 0;
window->event_handlers = (uint32*)window_park_rating_events;
window_init_scroll_widgets(window);
}
/**
*
* rct2: 0x00668A06
@@ -1134,9 +1162,8 @@ static void window_park_rating_update()
*/
static void window_park_rating_invalidate()
{
int i;
rct_window *w;
rct_widget **widgets;
rct_widget *widgets;
__asm mov w, esi
@@ -1178,7 +1205,7 @@ static void window_park_rating_paint()
widget = &window_park_rating_widgets[WIDX_PAGE_BACKGROUND];
// Current value
gfx_draw_string_left(dpi, STR_PARK_RATING_LABEL, RCT2_ADDRESS_CURRENT_PARK_RATING, 0, x + widget->left + 3, y + widget->top + 2);
gfx_draw_string_left(dpi, STR_PARK_RATING_LABEL, (void*)RCT2_ADDRESS_CURRENT_PARK_RATING, 0, x + widget->left + 3, y + widget->top + 2);
// Graph border
gfx_fill_rect_inset(dpi, x + widget->left + 4, y + widget->top + 15, x + widget->right - 4, y + widget->bottom - 4, w->colours[1], 0x30);
@@ -1197,6 +1224,35 @@ static void window_park_rating_paint()
#pragma region Guests page
/**
*
* rct2: 0x00667D35
*/
void window_park_guests_open()
{
rct_window* window;
window = window_bring_to_front_by_id(WC_PARK_INFORMATION, 0);
if (window == NULL) {
window = window_park_open();
window->var_482 = -1;
window->var_484 = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
window->viewport = NULL;
window->page = WINDOW_PARK_PAGE_GUESTS;
window_invalidate(window);
window->widgets = window_park_guests_widgets;
window->enabled_widgets = window_park_page_enabled_widgets[WINDOW_PARK_PAGE_GUESTS];
window->var_020 = 0;
window->event_handlers = (uint32*)window_park_guests_events;
window_init_scroll_widgets(window);
}
/**
*
* rct2: 0x00668DEB
@@ -1249,9 +1305,8 @@ static void window_park_guests_update()
*/
static void window_park_guests_invalidate()
{
int i;
rct_window *w;
rct_widget **widgets;
rct_widget *widgets;
__asm mov w, esi
@@ -1293,7 +1348,7 @@ static void window_park_guests_paint()
widget = &window_park_guests_widgets[WIDX_PAGE_BACKGROUND];
// Current value
gfx_draw_string_left(dpi, STR_GUESTS_IN_PARK_LABEL, RCT2_ADDRESS_GUESTS_IN_PARK, 0, x + widget->left + 3, y + widget->top + 2);
gfx_draw_string_left(dpi, STR_GUESTS_IN_PARK_LABEL, (void*)RCT2_ADDRESS_GUESTS_IN_PARK, 0, x + widget->left + 3, y + widget->top + 2);
// Graph border
gfx_fill_rect_inset(dpi, x + widget->left + 4, y + widget->top + 15, x + widget->right - 4, y + widget->bottom - 4, w->colours[1], 0x30);
@@ -1400,9 +1455,8 @@ static void window_park_price_update()
*/
static void window_park_price_invalidate()
{
int i;
rct_window *w;
rct_widget **widgets;
rct_widget *widgets;
__asm mov w, esi
@@ -1453,9 +1507,9 @@ static void window_park_price_paint()
x = w->x + window_park_price_widgets[WIDX_PAGE_BACKGROUND].left + 4;
y = w->y + window_park_price_widgets[WIDX_PAGE_BACKGROUND].top + 30;
gfx_draw_string_left(dpi, STR_TOTAL_ADMISSIONS, RCT2_ADDRESS_TOTAL_ADMISSIONS, 0, x, y);
gfx_draw_string_left(dpi, STR_TOTAL_ADMISSIONS, (void*)RCT2_ADDRESS_TOTAL_ADMISSIONS, 0, x, y);
y += 10;
gfx_draw_string_left(dpi, STR_INCOME_FROM_ADMISSIONS, RCT2_ADDRESS_INCOME_FROM_ADMISSIONS, 0, x, y);
gfx_draw_string_left(dpi, STR_INCOME_FROM_ADMISSIONS, (void*)RCT2_ADDRESS_INCOME_FROM_ADMISSIONS, 0, x, y);
}
#pragma endregion
@@ -1528,9 +1582,8 @@ static void window_park_stats_update()
*/
static void window_park_stats_invalidate()
{
int i;
rct_window *w;
rct_widget **widgets;
rct_widget *widgets;
__asm mov w, esi
@@ -1558,7 +1611,6 @@ static void window_park_stats_paint()
int x, y, parkSize, stringIndex;
rct_window *w;
rct_drawpixelinfo *dpi;
rct_award *award;
__asm mov w, esi
__asm mov dpi, edi
@@ -1570,32 +1622,32 @@ static void window_park_stats_paint()
y = w->y + window_park_awards_widgets[WIDX_PAGE_BACKGROUND].top + 4;
// Draw park size
parkSize = RCT2_GLOBAL(0x013580EA, sint16) * 10;
parkSize = RCT2_GLOBAL(RCT2_ADDRESS_PARK_SIZE, sint16) * 10;
stringIndex = STR_PARK_SIZE_METRIC_LABEL;
if (!RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_METRIC, uint8)) {
stringIndex = STR_PARK_SIZE_IMPERIAL_LABEL;
parkSize = squaredmetres_to_squaredfeet(parkSize);
}
RCT2_GLOBAL(0x013CE952, uint32) = parkSize;
gfx_draw_string_left(dpi, stringIndex, 0x013CE952, 0, x, y);
gfx_draw_string_left(dpi, stringIndex, (void*)0x013CE952, 0, x, y);
y += 10;
// Draw number of rides / attractions
if (w->var_490 != -1) {
RCT2_GLOBAL(0x013CE952, uint32) = w->var_490;
gfx_draw_string_left(dpi, STR_NUMBER_OF_RIDES_LABEL, 0x013CE952, 0, x, y);
gfx_draw_string_left(dpi, STR_NUMBER_OF_RIDES_LABEL, (void*)0x013CE952, 0, x, y);
}
y += 10;
// Draw number of staff
if (w->var_48C != -1) {
RCT2_GLOBAL(0x013CE952, uint32) = w->var_48C;
gfx_draw_string_left(dpi, STR_STAFF_LABEL, 0x013CE952, 0, x, y);
gfx_draw_string_left(dpi, STR_STAFF_LABEL, (void*)0x013CE952, 0, x, y);
}
y += 10;
// Draw number of guests in park
gfx_draw_string_left(dpi, STR_GUESTS_IN_PARK_LABEL, RCT2_ADDRESS_GUESTS_IN_PARK, 0, x, y);
gfx_draw_string_left(dpi, STR_GUESTS_IN_PARK_LABEL, (void*)RCT2_ADDRESS_GUESTS_IN_PARK, 0, x, y);
}
#pragma endregion
@@ -1619,7 +1671,7 @@ void window_park_objective_open()
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
RCT2_CALLPROC_EBPSAFE(0x006EE281);
tool_cancel();
window->viewport = NULL;
window->page = WINDOW_PARK_PAGE_OBJECTIVE;
@@ -1627,7 +1679,7 @@ void window_park_objective_open()
window->widgets = window_park_objective_widgets;
window->enabled_widgets = window_park_page_enabled_widgets[WINDOW_PARK_PAGE_OBJECTIVE];
window->var_020 = 0;
window->event_handlers = window_park_objective_events;
window->event_handlers = (uint32*)window_park_objective_events;
window_init_scroll_widgets(window);
window->x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) / 2 - 115;
window->y = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2 - 87;
@@ -1640,7 +1692,6 @@ void window_park_objective_open()
*/
static void window_park_objective_mouseup()
{
int tabIndex;
short widgetIndex;
rct_window *w;
@@ -1699,7 +1750,6 @@ static void window_park_objective_update()
*/
static void window_park_objective_invalidate()
{
int i;
rct_window *w;
__asm mov w, esi
@@ -1707,8 +1757,8 @@ static void window_park_objective_invalidate()
window_park_set_pressed_tab(w);
// Set window title arguments
*((short*)0x013CE952) = RCT2_GLOBAL(0x013573D4, uint16);
*((short*)0x013CE954) = RCT2_GLOBAL(0x013573D8, uint32);
*((uint16*)0x013CE952) = RCT2_GLOBAL(0x013573D4, uint16);
*((uint32*)0x013CE954) = RCT2_GLOBAL(0x013573D8, uint32);
//
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x02)
@@ -1726,7 +1776,7 @@ static void window_park_objective_invalidate()
*/
static void window_park_objective_paint()
{
int i, x, y;
int x, y;
rct_window *w;
rct_drawpixelinfo *dpi;
@@ -1773,6 +1823,35 @@ static void window_park_objective_paint()
#pragma region Awards page
/**
*
* rct2: 0x00667DC6
*/
void window_park_awards_open()
{
rct_window* window;
window = window_bring_to_front_by_id(WC_PARK_INFORMATION, 0);
if (window == NULL) {
window = window_park_open();
window->var_482 = -1;
window->var_484 = -1;
}
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (window->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && window->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
tool_cancel();
window->viewport = NULL;
window->page = WINDOW_PARK_PAGE_AWARDS;
window_invalidate(window);
window->widgets = window_park_awards_widgets;
window->enabled_widgets = window_park_page_enabled_widgets[WINDOW_PARK_PAGE_AWARDS];
window->var_020 = 0;
window->event_handlers = (uint32*)window_park_awards_events;
window_init_scroll_widgets(window);
}
/**
*
* rct2: 0x00669851
@@ -1824,9 +1903,8 @@ static void window_park_awards_update()
*/
static void window_park_awards_invalidate()
{
int i;
rct_window *w;
rct_widget **widgets;
rct_widget *widgets;
__asm mov w, esi
@@ -1872,7 +1950,7 @@ static void window_park_awards_paint()
continue;
gfx_draw_sprite(dpi, SPR_AWARD_MOST_UNTIDY + award->type, x, y);
gfx_draw_string_left_wrapped(dpi, STR_AWARD_MOST_UNTIDY, x + 34, y + 6, 180, 0, 0);
gfx_draw_string_left_wrapped(dpi, (void*)STR_AWARD_MOST_UNTIDY, x + 34, y + 6, 180, 0, 0);
y += 32;
count++;
@@ -1896,7 +1974,7 @@ static void window_park_set_page(rct_window *w, int page)
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 3))
if (w->classification == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) && w->number == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber))
RCT2_CALLPROC_EBPSAFE(0x006EE281);
tool_cancel();
// Set listen only to viewport
listen = 0;
@@ -1915,11 +1993,11 @@ static void window_park_set_page(rct_window *w, int page)
w->var_020 = RCT2_GLOBAL(0x0097BAE0 + (page * 4), uint32);
w->event_handlers = window_park_page_events[page];
w->widgets = window_park_page_widgets[page];
RCT2_CALLPROC_X(0x00667F8B, 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(0x00667F8B, 0, 0, 0, 0, (int)w, 0, 0);
window_invalidate(w);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
if (listen != 0 && w->viewport != NULL)
w->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
}
@@ -1942,7 +2020,7 @@ static void window_park_align_tabs(rct_window *w)
x = w->widgets[WIDX_TAB_1].left;
tab_width = w->widgets[WIDX_TAB_1].right - w->widgets[WIDX_TAB_1].left;
for (i = 0; i < 7; i++) {
if (w->disabled_widgets & (1 << (WIDX_TAB_1 + i)))
if (w->disabled_widgets & (1LL << (WIDX_TAB_1 + i)))
continue;
w->widgets[WIDX_TAB_1 + i].left = x;
w->widgets[WIDX_TAB_1 + i].right = x + tab_width;
@@ -1955,7 +2033,7 @@ static void window_park_set_pressed_tab(rct_window *w)
int i;
for (i = 0; i < 7; i++)
w->pressed_widgets &= ~(1 << (WIDX_TAB_1 + i));
w->pressed_widgets |= 1 << (WIDX_TAB_1 + w->page);
w->pressed_widgets |= 1LL << (WIDX_TAB_1 + w->page);
}
static void window_park_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w)
@@ -2038,7 +2116,7 @@ static void window_park_graph_draw_months(rct_drawpixelinfo *dpi, uint8 *history
if (history[i] != 0 && history[i] != 255 && yearOver32 % 4 == 0) {
// Draw month text
RCT2_GLOBAL(0x013CE952, uint32) = ((yearOver32 / 4) + 8) % 8 + STR_MONTH_SHORT_MAR;
gfx_draw_string_centred(dpi, 2222, x, y - 10, 0, 0x013CE952);
gfx_draw_string_centred(dpi, 2222, x, y - 10, 0, (void*)0x013CE952);
// Draw month mark
gfx_fill_rect(dpi, x, y, x, y + 3, 10);
@@ -2052,7 +2130,6 @@ static void window_park_graph_draw_months(rct_drawpixelinfo *dpi, uint8 *history
static void window_park_graph_draw_line_a(rct_drawpixelinfo *dpi, uint8 *history, int baseX, int baseY)
{
int i, x, y, lastX, lastY;
lastX = -1;
x = baseX;
for (i = 31; i >= 0; i--) {

View File

@@ -79,7 +79,7 @@ static void window_ride_list_invalidate();
static void window_ride_list_paint();
static void window_ride_list_scrollpaint();
static uint32 window_ride_list_events[] = {
static void* window_ride_list_events[] = {
window_ride_list_emptysub,
window_ride_list_mouseup,
window_ride_list_resize,
@@ -140,7 +140,7 @@ void window_ride_list_open()
// Check if window is already open
window = window_bring_to_front_by_id(WC_RIDE_LIST, 0);
if (window == NULL) {
window = window_create_auto_pos(340, 240, window_ride_list_events, WC_RIDE_LIST, 0x0400);
window = window_create_auto_pos(340, 240, (uint32*)window_ride_list_events, WC_RIDE_LIST, 0x0400);
window->widgets = window_ride_list_widgets;
window->enabled_widgets =
(1 << WIDX_CLOSE) |
@@ -175,7 +175,6 @@ void window_ride_list_open()
*/
static void window_ride_list_mouseup()
{
int i;
short widgetIndex;
rct_window *w;
@@ -273,10 +272,8 @@ static void window_ride_list_mousedown()
*/
static void window_ride_list_dropdown()
{
int i;
short dropdownIndex, widgetIndex;
rct_window *w;
rct_ride *ride;
__asm mov dropdownIndex, ax
__asm mov widgetIndex, dx
@@ -291,7 +288,7 @@ static void window_ride_list_dropdown()
if (dropdownIndex == -1)
return;
_window_ride_list_information_type = gDropdownItemsArgs[dropdownIndex] - STR_STATUS;
_window_ride_list_information_type = *((uint32*)&gDropdownItemsArgs[dropdownIndex]) - STR_STATUS;
window_invalidate(w);
}
}
@@ -398,7 +395,7 @@ static void window_ride_list_tooltip()
*/
static void window_ride_list_invalidate()
{
int i, x, y;
int i;
rct_window *w;
__asm mov w, esi
@@ -408,7 +405,7 @@ static void window_ride_list_invalidate()
// Set correct active tab
for (i = 0; i < 3; i++)
w->pressed_widgets &= ~(1 << (WIDX_TAB_1 + i));
w->pressed_widgets |= 1 << (WIDX_TAB_1 + w->page);
w->pressed_widgets |= 1LL << (WIDX_TAB_1 + w->page);
window_ride_list_widgets[WIDX_TITLE].image = STR_RIDES + w->page;
@@ -554,7 +551,7 @@ static void window_ride_list_scrollpaint()
format = 1192;
RCT2_GLOBAL(0x013CE952, uint16) = formatSecondary;
gfx_draw_string_left_clipped(dpi, format, 0x013CE952, 0, 160, y - 1, 157);
gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 160, y - 1, 157);
y += 10;
}
}
@@ -593,7 +590,7 @@ static void window_ride_list_draw_tab_images(rct_drawpixelinfo *dpi, rct_window
static void window_ride_list_refresh_list(rct_window *w)
{
int i, j, k, countA, countB;
sint16 swapper;
uint8 swapper;
rct_ride *ride, *otherRide;
countA = countB = 0;
@@ -636,7 +633,7 @@ static void window_ride_list_refresh_list(rct_window *w)
otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]);
RCT2_GLOBAL(0x013CE952, uint32) = otherRide->var_04C;
RCT2_CALLPROC_X(0x006C2538, otherRide->var_04A, 0, 0x013CE952, 0, 0, 0x0141EF68, 0);
if (strcmp(0x0141ED68, 0x0141EF68) >= 0)
if (strcmp((char*)0x0141ED68, (char*)0x0141EF68) >= 0)
break;
swapper = w->var_076[k];

View File

@@ -54,7 +54,7 @@ static void window_save_prompt_close();
static void window_save_prompt_mouseup();
static void window_save_prompt_paint();
static uint32 window_save_prompt_events[] = {
static void* window_save_prompt_events[] = {
window_save_prompt_close,
window_save_prompt_mouseup,
window_save_prompt_emptysub,
@@ -102,7 +102,7 @@ void window_save_prompt_open()
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - 25),
260,
50,
window_save_prompt_events,
(uint32*)window_save_prompt_events,
WC_SAVE_PROMPT,
0
);

View File

@@ -1,5 +1,5 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John, Peter Hill
* Copyright (c) 2014 Maciek Baron
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
@@ -18,16 +18,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef _SETTINGS_H_
#define _SETTINGS_H_
#include <string.h>
#include "addresses.h"
#include "game.h"
#include "window.h"
#include <windows.h>
#include <stdio.h>
#include "rct2.h"
enum {
WINDOW_STAFF_LIST_TAB_HANDYMEN,
WINDOW_STAFF_LIST_TAB_MECHANICS,
WINDOW_STAFF_LIST_TAB_SECURITY,
WINDOW_STAFF_LIST_TAB_ENTERTAINERS
} WINDOW_STAFF_LIST_TAB;
#endif
/*
* rct2: 0x006BD39C
**/
void window_staff_init_vars() {
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_STAFF_LIST_SELECTED_TAB, uint8) = WINDOW_STAFF_LIST_TAB_HANDYMEN;
}

View File

@@ -34,7 +34,7 @@ static void window_title_exit_emptysub() {}
static void window_title_exit_paint();
static void window_title_exit_mouseup();
static uint32 window_title_exit_events[] = {
static void* window_title_exit_events[] = {
window_title_exit_emptysub,
window_title_exit_mouseup,
window_title_exit_emptysub,
@@ -76,7 +76,7 @@ void window_title_exit_open()
window = window_create(
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 40, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 64,
40, 64,
window_title_exit_events,
(uint32*)window_title_exit_events,
WC_TITLE_EXIT,
WF_STICK_TO_FRONT
);

View File

@@ -32,7 +32,7 @@ static rct_widget window_title_logo_widgets[] = {
static void window_title_logo_emptysub() {}
static void window_title_logo_paint();
static uint32 window_title_logo_events[] = {
static void* window_title_logo_events[] = {
window_title_logo_emptysub,
window_title_logo_emptysub,
window_title_logo_emptysub,
@@ -79,8 +79,8 @@ void window_title_logo_open()
packs++;
// Create the window
window = window_create(0, 0, 200, 106 + (10 * packs), window_title_logo_events, WC_TITLE_LOGO, WF_STICK_TO_FRONT);
window->widgets = 0x009A9658; // mouse move bug in original game, keep this address and no crash happens
window = window_create(0, 0, 200, 106 + (10 * packs), (uint32*)window_title_logo_events, WC_TITLE_LOGO, WF_STICK_TO_FRONT);
window->widgets = (rct_widget*)0x009A9658; // mouse move bug in original game, keep this address and no crash happens
window_init_scroll_widgets(window);
window->flags |= 16;
window->colours[0] = 129;

View File

@@ -50,7 +50,7 @@ static void window_title_menu_dropdown();
static void window_title_menu_unknown17();
static void window_title_menu_paint();
static uint32 window_title_menu_events[] = {
static void* window_title_menu_events[] = {
window_title_menu_emptysub,
window_title_menu_mouseup,
window_title_menu_emptysub,
@@ -92,7 +92,7 @@ void window_title_menu_open()
window = window_create(
(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 328) / 2, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) - 142,
328, 82,
window_title_menu_events,
(uint32*)window_title_menu_events,
WC_TITLE_MENU,
WF_STICK_TO_FRONT
);

View File

@@ -66,7 +66,7 @@ static void window_scenarioselect_invalidate();
static void window_scenarioselect_paint();
static void window_scenarioselect_scrollpaint();
static uint32 window_scenarioselect_events[] = {
static void* window_scenarioselect_events[] = {
window_scenarioselect_emptysub,
window_scenarioselect_mouseup,
window_scenarioselect_emptysub,
@@ -116,7 +116,7 @@ void window_scenarioselect_open()
max(28, (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) / 2) - 167),
610,
334,
window_scenarioselect_events,
(uint32*)window_scenarioselect_events,
WC_SCENARIO_SELECT,
WF_STICK_TO_FRONT | WF_10
);
@@ -128,7 +128,7 @@ void window_scenarioselect_open()
window->colours[1] = 26;
window->colours[2] = 26;
window->var_480 = -1;
window->var_494 = NULL;
window->var_494 = 0;
window_scenarioselect_init_tabs();
@@ -189,10 +189,10 @@ static void window_scenarioselect_mousedown()
if (widgetIndex >= WIDX_TAB1 && widgetIndex <= WIDX_TAB5) {
w->var_4AC = widgetIndex - 4;
w->var_494 = NULL;
w->var_494 = 0;
window_invalidate(w);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);
RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0);
window_init_scroll_widgets(w);
window_invalidate(w);
}
@@ -273,8 +273,8 @@ static void window_scenarioselect_scrollmouseover()
selected = scenario;
break;
}
if (w->var_494 != selected) {
w->var_494 = selected;
if (w->var_494 != (uint32)selected) {
w->var_494 = (uint32)selected;
window_invalidate(w);
}
}
@@ -286,7 +286,7 @@ static void window_scenarioselect_invalidate()
__asm mov w, esi
w->pressed_widgets &= ~(0x10 | 0x20 | 0x40 | 0x80 | 0x100);
w->pressed_widgets |= 1 << (w->var_4AC + 4);
w->pressed_widgets |= 1LL << (w->var_4AC + 4);
}
static void window_scenarioselect_paint()
@@ -326,13 +326,13 @@ static void window_scenarioselect_paint()
// Scenario name
x = w->x + window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4;
y = w->y + window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5;
strcpy(0x009BC677, scenario->name);
strcpy((char*)0x009BC677, scenario->name);
*((short*)(0x0013CE952 + 0)) = 3165;
gfx_draw_string_centred_clipped(dpi, 1193, (void*)0x013CE952, 0, x + 85, y, 170);
y += 15;
// Scenario details
strcpy(0x009BC677, scenario->details);
strcpy((char*)0x009BC677, scenario->details);
*((short*)(0x0013CE952 + 0)) = 3165;
y += gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 170, 1191, 0) + 5;
@@ -345,7 +345,7 @@ static void window_scenarioselect_paint()
// Scenario score
if (scenario->flags & SCENARIO_FLAGS_COMPLETED) {
strcpy(0x009BC677, scenario->completed_by);
strcpy((char*)0x009BC677, scenario->completed_by);
*((short*)(0x0013CE952 + 0)) = 3165;
*((int*)(0x0013CE952 + 2)) = scenario->company_value;
y += gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, 0);

View File

@@ -38,7 +38,7 @@ static void window_tooltip_onclose();
static void window_tooltip_update();
static void window_tooltip_paint();
static uint32 window_tooltip_events[] = {
static void* window_tooltip_events[] = {
window_tooltip_onclose,
window_tooltip_emptysub,
window_tooltip_emptysub,
@@ -93,7 +93,7 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
return;
widget = &widgetWindow->widgets[widgetIndex];
RCT2_CALLPROC_X(widgetWindow->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, widgetWindow, 0, 0);
RCT2_CALLPROC_X(widgetWindow->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)widgetWindow, 0, 0);
if (widget->tooltip == 0xFFFF)
return;
@@ -103,7 +103,7 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
int eax, ebx, ecx, edx, esi, edi, ebp;
eax = widgetIndex;
esi = widgetWindow;
esi = (int)widgetWindow;
RCT2_CALLFUNC_X(widgetWindow->event_handlers[WE_TOOLTIP], &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
if ((eax & 0xFFFF) == 0xFFFF)
return;
@@ -114,7 +114,7 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
RCT2_GLOBAL(0x0142006C, sint32) = -1;
format_string(0x0141ED68, widget->tooltip, 0x013CE952);
format_string((char*)0x0141ED68, widget->tooltip, (void*)0x013CE952);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
esi = 0x0141ED68;
@@ -136,12 +136,12 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
window_tooltip_widgets[WIDX_BACKGROUND].right = width;
window_tooltip_widgets[WIDX_BACKGROUND].bottom = height;
memcpy(0x0141FE44, 0x0141ED68, 512);
memcpy((void*)0x0141FE44, (void*)0x0141ED68, 512);
x = clamp(0, x - (width / 2), RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - width);
y = clamp(22, y + 26, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height - 40);
w = window_create(x, y, width, height, window_tooltip_events, WC_TOOLTIP, WF_TRANSPARENT | WF_STICK_TO_FRONT);
w = window_create(x, y, width, height, (uint32*)window_tooltip_events, WC_TOOLTIP, WF_TRANSPARENT | WF_STICK_TO_FRONT);
w->widgets = window_tooltip_widgets;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, uint16) = 0;
@@ -213,5 +213,5 @@ static void window_tooltip_paint()
gfx_draw_pixel(dpi, right - 1, bottom - 1, 0x0200002F);
// Text
RCT2_CALLPROC_X(0x006C1DB7, 0, 0, w->x + ((w->width + 1) / 2) - 1, w->y + 1, 0x0141FE44, dpi, RCT2_GLOBAL(0x01420044, uint16));
RCT2_CALLPROC_X(0x006C1DB7, 0, 0, w->x + ((w->width + 1) / 2) - 1, w->y + 1, 0x0141FE44, (int)dpi, RCT2_GLOBAL(0x01420044, uint16));
}

View File

@@ -53,7 +53,7 @@ static void window_water_update();
static void window_water_invalidate();
static void window_water_paint();
static uint32 window_water_events[] = {
static void* window_water_events[] = {
window_water_close,
window_water_mouseup,
window_water_emptysub,
@@ -96,7 +96,7 @@ void window_water_open()
if (window_find_by_id(WC_WATER, 0) != NULL)
return;
window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 76, 29, 76, 77, window_water_events, WC_WATER, 0);
window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) - 76, 29, 76, 77, (uint32*)window_water_events, WC_WATER, 0);
window->widgets = window_water_widgets;
window->enabled_widgets = 0x04 | 0x10 | 0x20;
window_init_scroll_widgets(window);