diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index 95aba80932..ee13c69b3f 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -48,6 +48,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index 26e50f6db9..c1c42a020c 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -146,6 +146,9 @@ Source Files + + Source Files + diff --git a/src/addresses.h b/src/addresses.h index df031c8785..d25b9c1c10 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -96,6 +96,7 @@ #define RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED 0x013587F8 #define RCT2_ADDRESS_RIDE_LIST 0x013628F8 +#define RCT2_ADDRESS_RIDE_MEASUREMENTS 0x0138B60C #define RCT2_ADDRESS_NEWS_ITEM_LIST 0x013CA754 diff --git a/src/rct2.c b/src/rct2.c index 552ae9312e..d5ff5b9191 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -32,6 +32,7 @@ #include "news_item.h" #include "osinterface.h" #include "rct2.h" +#include "ride.h" #include "scenario.h" #include "title.h" #include "viewport.h" @@ -114,7 +115,7 @@ void rct2_init() RCT2_CALLPROC_EBPSAFE(0x00667104); RCT2_CALLPROC_EBPSAFE(0x006C4209); RCT2_CALLPROC_EBPSAFE(0x0069EB13); - RCT2_CALLPROC_EBPSAFE(0x006ACA89); // init_rides + ride_init_all(); RCT2_CALLPROC_EBPSAFE(0x0068F083); // window guest list init vars a RCT2_CALLPROC_EBPSAFE(0x006BD3A4); RCT2_CALLPROC_EBPSAFE(0x0068AB4C); // init_map(); diff --git a/src/ride.c b/src/ride.c new file mode 100644 index 0000000000..7fc47eb73c --- /dev/null +++ b/src/ride.c @@ -0,0 +1,49 @@ +/***************************************************************************** + * 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 "addresses.h" +#include "ride.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])) + +/** + * + * rct2: 0x006ACA89 + */ +void ride_init_all() +{ + int i; + rct_ride *ride; + rct_ride_measurement *ride_measurement; + + for (i = 0; i < MAX_RIDES; i++) { + ride = GET_RIDE(i); + ride->type = RIDE_TYPE_NULL; + } + + RCT2_GLOBAL(0x0138B590, sint8) = 0; + RCT2_GLOBAL(0x0138B591, sint8) = 0; + + for (i = 0; i < MAX_RIDE_MEASUREMENTS; i++) { + ride_measurement = GET_RIDE_MEASUREMENT(i); + ride_measurement->var_00 = 0xFF; + } +} \ No newline at end of file diff --git a/src/ride.h b/src/ride.h index d7a1d0c20e..d73552dea6 100644 --- a/src/ride.h +++ b/src/ride.h @@ -54,8 +54,22 @@ typedef struct { uint8 pad_19A[0xC6]; } rct_ride; +/** + * Ride measurement structure. + * size: 0x04B0C + */ +typedef struct { + uint8 var_00; + uint8 pad_01[0x4B0B]; +} rct_ride_measurement; + enum { RIDE_TYPE_NULL = (uint8)-1 }; +#define MAX_RIDES 256 +#define MAX_RIDE_MEASUREMENTS 8 + +void ride_init_all(); + #endif \ No newline at end of file diff --git a/src/title.c b/src/title.c index 364640e155..ef8f98dd3c 100644 --- a/src/title.c +++ b/src/title.c @@ -23,6 +23,7 @@ #include "gfx.h" #include "news_item.h" #include "rct2.h" +#include "ride.h" #include "intro.h" #include "viewport.h" @@ -48,7 +49,7 @@ void title_load() RCT2_CALLPROC_EBPSAFE(0x00667104); RCT2_CALLPROC_EBPSAFE(0x006C4209); RCT2_CALLPROC_EBPSAFE(0x0069EB13); - RCT2_CALLPROC_EBPSAFE(0x006ACA89); + ride_init_all(); RCT2_CALLPROC_EBPSAFE(0x0068F083); RCT2_CALLPROC_EBPSAFE(0x006BD3A4); RCT2_CALLPROC_EBPSAFE(0x0068AB4C); diff --git a/src/window.c b/src/window.c index d563f463e1..a34dd82f0f 100644 --- a/src/window.c +++ b/src/window.c @@ -42,9 +42,8 @@ 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--) { + 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_EBPSAFE(0x006EE411); } @@ -282,7 +281,7 @@ void window_invalidate_by_id(uint16 cls, rct_windownumber number) } /** - * Invalidates the specified window. + * Initialises scroll widgets to their virtual size. * rct2: 0x006EAEB8 * * @param window The window (esi).