diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj
index 75fc4d2765..1f0de53737 100644
--- a/projects/openrct2.vcxproj
+++ b/projects/openrct2.vcxproj
@@ -74,7 +74,6 @@
-
@@ -160,6 +159,7 @@
Disabled
true
1Byte
+ _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
true
@@ -172,13 +172,15 @@
Disabled
true
true
- true
+
+
MultiThreaded
1Byte
4013
false
+ _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
true
diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters
index 7350319a76..559453fe4d 100644
--- a/projects/openrct2.vcxproj.filters
+++ b/projects/openrct2.vcxproj.filters
@@ -269,9 +269,6 @@
Windows
-
- Source Files
-
Windows
diff --git a/src/config.c b/src/config.c
index f1b2ddd385..97263fb994 100644
--- a/src/config.c
+++ b/src/config.c
@@ -137,10 +137,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);
}
}
@@ -252,7 +252,7 @@ static void config_create_default(char *path)
*/
static void config_parse_settings(FILE *fp)
{
- int c = NULL, pos = 0;
+ int pos = 0;
char *setting;
char *value;
char *section;
@@ -389,36 +389,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;
}
/**
diff --git a/src/game.c b/src/game.c
index ad0852b179..18f6c14414 100644
--- a/src/game.c
+++ b/src/game.c
@@ -195,7 +195,7 @@ 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
@@ -228,7 +228,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 +288,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 +345,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 +368,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 +380,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 +458,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 +480,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 +496,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 +525,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 +535,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 +583,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 +593,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 +608,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 +672,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 +694,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 +704,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 +753,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;
}
}
@@ -877,7 +873,7 @@ void handle_shortcut_command(int shortcutIndex)
case SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2))
window_close_all();
- else if (RCT2_ADDRESS(0x0141F570, uint8) == 1)
+ else if (RCT2_GLOBAL(0x0141F570, uint8) == 1)
window_close_top();
break;
case SHORTCUT_CANCEL_CONSTRUCTION_MODE:
@@ -897,7 +893,7 @@ void handle_shortcut_command(int shortcutIndex)
}
break;
case SHORTCUT_ZOOM_VIEW_OUT:
- if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
+ 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) {
@@ -908,7 +904,7 @@ void handle_shortcut_command(int shortcutIndex)
}
break;
case SHORTCUT_ZOOM_VIEW_IN:
- if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
+ 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) {
@@ -919,7 +915,7 @@ void handle_shortcut_command(int shortcutIndex)
}
break;
case SHORTCUT_ROTATE_VIEW:
- if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
+ 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) {
@@ -963,7 +959,7 @@ void handle_shortcut_command(int shortcutIndex)
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_ADDRESS(0x0141F570, uint8) == 1) {
+ 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) {
@@ -974,7 +970,7 @@ void handle_shortcut_command(int shortcutIndex)
}
break;
case SHORTCUT_ADJUST_WATER:
- if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
+ 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) {
@@ -985,7 +981,7 @@ void handle_shortcut_command(int shortcutIndex)
}
break;
case SHORTCUT_BUILD_SCENERY:
- if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
+ 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) {
@@ -996,7 +992,7 @@ void handle_shortcut_command(int shortcutIndex)
}
break;
case SHORTCUT_BUILD_PATHS:
- if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
+ 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) {
@@ -1007,7 +1003,7 @@ void handle_shortcut_command(int shortcutIndex)
}
break;
case SHORTCUT_BUILD_NEW_RIDE:
- if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
+ 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) {
@@ -1072,7 +1068,7 @@ void handle_shortcut_command(int shortcutIndex)
window_news_open();
break;
case SHORTCUT_SHOW_MAP:
- if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) || RCT2_ADDRESS(0x0141F570, uint8) == 1) {
+ 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) {
@@ -1133,7 +1129,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)
@@ -1182,7 +1178,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)++;
}
}
@@ -1190,7 +1186,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)++;
}
}
@@ -1311,9 +1307,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
@@ -1335,7 +1329,6 @@ static void game_pause_toggle()
*/
static void game_load_or_quit()
{
- rct_window *w;
char input_bl, input_dl;
short input_di;
@@ -1368,11 +1361,11 @@ 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);
+ 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);
+ osinterface_open_common_file_dialog(1, (char*)0x0141ED68, (char*)0x0141EF68, "*.SV6;*.SV4;*.SC6", (char*)0x0141EE68);
unpause_sounds();
// window_proc
}
@@ -1384,11 +1377,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;
@@ -1404,7 +1397,7 @@ static void load_landscape()
gfx_invalidate_screen();
} else {
// Set default filename
- char *esi = 0x0141EF67;
+ char *esi = (char*)0x0141EF67;
while (1) {
esi++;
if (*esi == '.')
@@ -1414,7 +1407,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) {
@@ -1456,11 +1449,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) {
@@ -1475,14 +1468,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);
@@ -1540,7 +1533,7 @@ static void load_game()
gfx_invalidate_screen();
} else {
// Set default filename
- char *esi = 0x0141EF67;
+ char *esi = (char*)0x0141EF67;
while (1) {
esi++;
if (*esi == '.')
@@ -1550,7 +1543,7 @@ static void load_game()
strcpy(esi, ".SV6");
break;
}
- strcpy(0x009ABB37, 0x0141EF68);
+ strcpy((char*)0x009ABB37, (char*)0x0141EF68);
if (game_load_save()) {
gfx_invalidate_screen();
@@ -1602,10 +1595,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,
diff --git a/src/gfx.c b/src/gfx.c
index b2ba5158aa..b0f8a59487 100644
--- a/src/gfx.c
+++ b/src/gfx.c
@@ -241,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);
}
/**
@@ -257,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);
}
/**
@@ -269,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);
}
/**
@@ -312,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);
}
/**
@@ -369,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++) {
@@ -462,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;
@@ -482,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;
@@ -507,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;
@@ -568,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);
@@ -595,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);
@@ -639,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);
diff --git a/src/map.c b/src/map.c
index 581eabdf30..935f059ee0 100644
--- a/src/map.c
+++ b/src/map.c
@@ -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++;
diff --git a/src/map.h b/src/map.h
index 88e76d7e11..108e339a82 100644
--- a/src/map.h
+++ b/src/map.h
@@ -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();
diff --git a/src/news_item.c b/src/news_item.c
index 70c0f1f01e..4b5fa14e7c 100644
--- a/src/news_item.c
+++ b/src/news_item.c
@@ -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.
@@ -295,8 +295,8 @@ void news_item_open_subject(int type, int subject) {
break;
case NEWS_ITEM_PEEP_ON_RIDE:
case NEWS_ITEM_PEEP:
- peep = &(RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_sprite)[subject]);
- RCT2_CALLPROC_X(0x006989E9, 0, 0, 0, peep, 0, 0, 0);
+ 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
diff --git a/src/news_item.h b/src/news_item.h
index f7e5333af1..a82aa29b0f 100644
--- a/src/news_item.h
+++ b/src/news_item.h
@@ -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
diff --git a/src/object.c b/src/object.c
index ba642157c2..1a98a2a482 100644
--- a/src/object.c
+++ b/src/object.c
@@ -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);
diff --git a/src/object.h b/src/object.h
index 54c5f76220..3549548bab 100644
--- a/src/object.h
+++ b/src/object.h
@@ -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
diff --git a/src/osinterface.c b/src/osinterface.c
index 760f73bf63..1c7afe06d6 100644
--- a/src/osinterface.c
+++ b/src/osinterface.c
@@ -33,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();
@@ -325,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);
diff --git a/src/osinterface.h b/src/osinterface.h
index a42da3c6d3..8360d3f1c4 100644
--- a/src/osinterface.h
+++ b/src/osinterface.h
@@ -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();
diff --git a/src/park.c b/src/park.c
index 911d10997e..bc39ff3d46 100644
--- a/src/park.c
+++ b/src/park.c
@@ -89,7 +89,7 @@ void park_init()
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 = 0x0141F570;
+ rct_s6_info *info = (rct_s6_info*)0x0141F570;
info->name[0] = '\0';
format_string(info->details, STR_NO_DETAILS_YET, NULL);
}
diff --git a/src/peep.c b/src/peep.c
index 194c255704..8a04b3e95d 100644
--- a/src/peep.c
+++ b/src/peep.c
@@ -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++;
diff --git a/src/rct2.c b/src/rct2.c
index d4cc2fe042..a53a31bf22 100644
--- a/src/rct2.c
+++ b/src/rct2.c
@@ -17,8 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*****************************************************************************/
-
-#define _CRT_SECURE_NO_WARNINGS
+
+#pragma warning(disable : 4996) // GetVersionExA deprecated
#include
#include
@@ -43,7 +43,6 @@
#include "title.h"
#include "track.h"
#include "viewport.h"
-#include "settings.h"
void rct2_init_directories();
@@ -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);
diff --git a/src/sawyercoding.c b/src/sawyercoding.c
index c5393e02d4..7e7a59928b 100644
--- a/src/sawyercoding.c
+++ b/src/sawyercoding.c
@@ -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);
diff --git a/src/sawyercoding.h b/src/sawyercoding.h
index 7b30566703..02b63b6209 100644
--- a/src/sawyercoding.h
+++ b/src/sawyercoding.h
@@ -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
diff --git a/src/scenario.c b/src/scenario.c
index 81f97bbd08..a766c87c36 100644
--- a/src/scenario.c
+++ b/src/scenario.c
@@ -18,8 +18,6 @@
* along with this program. If not, see .
*****************************************************************************/
-#define _CRT_SECURE_NO_WARNINGS
-
#include
#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();
@@ -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;
@@ -519,7 +516,7 @@ void scenario_load_and_play(rct_scenario_basic *scenario)
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)){
diff --git a/src/screenshot.c b/src/screenshot.c
index af65bf976b..25595520b8 100644
--- a/src/screenshot.c
+++ b/src/screenshot.c
@@ -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;
diff --git a/src/settings.c b/src/settings.c
deleted file mode 100644
index 6e281aa97a..0000000000
--- a/src/settings.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/*****************************************************************************
-* Copyright (c) 2014 Ted John
-* 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 .
-*****************************************************************************/
-
-#include
-#include
-#include
-#include
-#include
-#include "settings.h"
-#include "screenshot.h"
-
diff --git a/src/settings.h b/src/settings.h
deleted file mode 100644
index d5e2452ac0..0000000000
--- a/src/settings.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
-* Copyright (c) 2014 Ted John, Peter Hill
-* 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 .
-*****************************************************************************/
-
-#ifndef _SETTINGS_H_
-#define _SETTINGS_H_
-
-#include
-#include
-#include "rct2.h"
-
-
-
-
-
-
-#endif
\ No newline at end of file
diff --git a/src/strings.c b/src/strings.c
index 540e644252..fc50c8f1b6 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -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()
diff --git a/src/title.c b/src/title.c
index ec26fb9133..1664250b60 100644
--- a/src/title.c
+++ b/src/title.c
@@ -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 {
@@ -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;
diff --git a/src/viewport.c b/src/viewport.c
index a22af3cf24..b005bafad2 100644
--- a/src/viewport.c
+++ b/src/viewport.c
@@ -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);
}
/**
diff --git a/src/widget.c b/src/widget.c
index 3aa909e355..f286139c41 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -248,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
@@ -331,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)) {
@@ -375,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
@@ -405,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
@@ -433,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,
@@ -445,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,
@@ -461,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
@@ -481,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);
}
/**
@@ -491,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
@@ -568,7 +566,7 @@ static void widget_groupbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
colour = w->colours[widget->colour] & 0x7F;
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;
}
@@ -764,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;
@@ -826,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)
@@ -914,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) {
// ?
diff --git a/src/window.c b/src/window.c
index f41a874ff6..11a43c5567 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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);
@@ -498,22 +498,22 @@ rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number)
*
* rct2: 0x006E403C
*/
-void window_close_top() {
- rct_window* w;
+void window_close_top()
+{
+ rct_window* w;
- window_close_by_id(WC_DROPDOWN, 0);
+ window_close_by_id(WC_DROPDOWN, 0);
- if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) {
- if (RCT2_ADDRESS(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;
- }
- }
+ 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;
+ }
+ }
}
/**
@@ -540,7 +540,7 @@ void window_close_all() {
*/
rct_window *window_find_from_point(int x, int y)
{
- rct_window *w, *w2;
+ rct_window *w;
rct_widget *widget;
int widget_index;
@@ -576,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;
@@ -709,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)
@@ -717,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;
@@ -858,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);
}
/**
@@ -867,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);
}
/**
@@ -876,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);
}
/**
@@ -885,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);
}
/**
@@ -894,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);
}
/**
@@ -911,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;
@@ -989,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);
}
}
@@ -1115,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++) {
@@ -1217,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);
}
}
}
@@ -1226,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;
@@ -1237,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;
@@ -1249,8 +1246,7 @@ void window_guest_list_init_vars_b() {
/**
* 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, w, 0, 0);
-
+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);
}
diff --git a/src/window_news.c b/src/window_news.c
index 1e849ce080..5d097d4770 100644
--- a/src/window_news.c
+++ b/src/window_news.c
@@ -318,7 +318,7 @@ 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);
+ RCT2_GLOBAL(0x013CE952 + 2, uint16) = STR_MONTH_MARCH + (newsItem->month_year % 8);
gfx_draw_string_left(dpi, 2235, 0x013CE952, 2, 4, y);
// Item text