diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj index ee13c69b3f..56ab9fdb86 100644 --- a/projects/openrct2.vcxproj +++ b/projects/openrct2.vcxproj @@ -21,6 +21,7 @@ + @@ -43,6 +44,7 @@ + diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters index c1c42a020c..eee61d36e7 100644 --- a/projects/openrct2.vcxproj.filters +++ b/projects/openrct2.vcxproj.filters @@ -81,6 +81,9 @@ Header Files + + Header Files + @@ -149,6 +152,9 @@ Source Files + + Source Files + diff --git a/src/addresses.h b/src/addresses.h index d25b9c1c10..a2f3791117 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -83,6 +83,8 @@ #define RCT2_ADDRESS_G1_ELEMENTS 0x009EBD28 +#define RCT2_ADDRESS_MAP_ELEMENTS 0x00F663B8 + #define RCT2_ADDRESS_SPRITE_LIST 0x010E63BC #define RCT2_ADDRESS_SPRITES_NEXT_INDEX 0x013573BC #define RCT2_ADDRESS_SPRITES_START_VEHICLE 0x013573BE @@ -95,6 +97,8 @@ #define RCT2_ADDRESS_CURRENT_PARK_VALUE 0x0135853C #define RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED 0x013587F8 +#define RCT2_ADDRESS_MAP_SIZE 0x01358834 + #define RCT2_ADDRESS_RIDE_LIST 0x013628F8 #define RCT2_ADDRESS_RIDE_MEASUREMENTS 0x0138B60C diff --git a/src/map.c b/src/map.c new file mode 100644 index 0000000000..4eb36b1da8 --- /dev/null +++ b/src/map.c @@ -0,0 +1,62 @@ +/***************************************************************************** + * 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 "map.h" + +#define GET_MAP_ELEMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element)[x])) + +/** + * + * rct2: 0x0068AB4C + */ +void map_init() +{ + int i; + rct_map_element *map_element; + + RCT2_CALLPROC_EBPSAFE(0x006C4494); // date_init(); + RCT2_GLOBAL(0x0138B580, sint16) = 0; + RCT2_GLOBAL(0x010E63B8, sint32) = 0; + + for (i = 0; i < MAX_MAP_ELEMENTS; i++) { + map_element = GET_MAP_ELEMENT(i); + map_element->var_0 = 0; + map_element->var_1 = 128; + map_element->var_2 = 14; + map_element->var_3 = 14; + map_element->var_4 = 0; + map_element->var_5 = 0; + map_element->var_6 = 1; + map_element->var_7 = 0; + } + + RCT2_GLOBAL(0x013B0E70, sint16) = 0; + RCT2_GLOBAL(0x013CE774, sint16) = 0; + RCT2_GLOBAL(0x013CE776, sint16) = 0; + RCT2_GLOBAL(0x01358830, sint16) = 4768; + RCT2_GLOBAL(0x01358832, sint16) = 5054; + RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, sint16) = 150; + RCT2_GLOBAL(0x01358836, sint16) = 4767; + RCT2_GLOBAL(0x01359208, sint16) = 7; + RCT2_CALLPROC_EBPSAFE(0x0068AFFD); + RCT2_CALLPROC_EBPSAFE(0x0068ADBC); + RCT2_CALLPROC_X(0x006C45ED, 1, 0, 0, 0, 0, 0, 0); // init_climate_and_date +} \ No newline at end of file diff --git a/src/map.h b/src/map.h new file mode 100644 index 0000000000..1ff28b1147 --- /dev/null +++ b/src/map.h @@ -0,0 +1,57 @@ +/***************************************************************************** + * 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 . + *****************************************************************************/ + +#ifndef _MAP_H_ +#define _MAP_H_ + +#include "rct2.h" + +/** + * Map element structure + * size: 0x08 + */ +typedef struct { + sint8 var_0; + sint8 var_1; + sint8 var_2; + sint8 var_3; + sint8 var_4; + sint8 var_5; + sint8 var_6; + sint8 var_7; +} rct_map_element; + +enum { + MAP_ELEMENT_TYPE_UNKNOWN = (0 << 2), + MAP_ELEMENT_TYPE_PATH = (1 << 2), + MAP_ELEMENT_TYPE_TRACK = (2 << 2), + MAP_ELEMENT_TYPE_SCENERY = (3 << 2), + MAP_ELEMENT_TYPE_ENTRANCE = (4 << 2), + MAP_ELEMENT_TYPE_FENCE = (5 << 2), + MAP_ELEMENT_TYPE_SCENERY_M = (6 << 2), + MAP_ELEMENT_TYPE_BANNER = (7 << 2) +}; + +#define MAP_ELEMENT_TYPE_MASK 0x3C +#define MAX_MAP_ELEMENTS 65536 + +void map_init(); + +#endif \ No newline at end of file diff --git a/src/rct2.c b/src/rct2.c index d5ff5b9191..c5fe265296 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -29,6 +29,7 @@ #include "game.h" #include "gfx.h" #include "intro.h" +#include "map.h" #include "news_item.h" #include "osinterface.h" #include "rct2.h" @@ -118,7 +119,7 @@ void rct2_init() ride_init_all(); RCT2_CALLPROC_EBPSAFE(0x0068F083); // window guest list init vars a RCT2_CALLPROC_EBPSAFE(0x006BD3A4); - RCT2_CALLPROC_EBPSAFE(0x0068AB4C); // init_map(); + map_init(); RCT2_CALLPROC_EBPSAFE(0x00667132); // init_park(); RCT2_CALLPROC_EBPSAFE(0x0066B5C0); // 0x0066B5C0 (part of 0x0066B3E8) screen_game_create_windows() RCT2_CALLPROC_EBPSAFE(0x006C4494); // init_date diff --git a/src/title.c b/src/title.c index ef8f98dd3c..71bae058c7 100644 --- a/src/title.c +++ b/src/title.c @@ -21,6 +21,7 @@ #include "addresses.h" #include "game.h" #include "gfx.h" +#include "map.h" #include "news_item.h" #include "rct2.h" #include "ride.h" @@ -52,7 +53,7 @@ void title_load() ride_init_all(); RCT2_CALLPROC_EBPSAFE(0x0068F083); RCT2_CALLPROC_EBPSAFE(0x006BD3A4); - RCT2_CALLPROC_EBPSAFE(0x0068AB4C); + map_init(); RCT2_CALLPROC_EBPSAFE(0x00667132); RCT2_CALLPROC_EBPSAFE(0x006C4494); RCT2_CALLPROC_X(0x006C45ED, 0, 0, 0, 0, 0, 0, 0);