1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00

add map initialisation

This commit is contained in:
IntelOrca
2014-04-09 03:09:30 +01:00
parent f5917e71f5
commit 535e62f3aa
7 changed files with 135 additions and 2 deletions

View File

@@ -21,6 +21,7 @@
<ClInclude Include="..\src\game.h" />
<ClInclude Include="..\src\gfx.h" />
<ClInclude Include="..\src\intro.h" />
<ClInclude Include="..\src\map.h" />
<ClInclude Include="..\src\news_item.h" />
<ClInclude Include="..\src\osinterface.h" />
<ClInclude Include="..\src\park.h" />
@@ -43,6 +44,7 @@
<ClCompile Include="..\src\game.c" />
<ClCompile Include="..\src\gfx.c" />
<ClCompile Include="..\src\intro.c" />
<ClCompile Include="..\src\map.c" />
<ClCompile Include="..\src\news_item.c" />
<ClCompile Include="..\src\osinterface.c" />
<ClCompile Include="..\src\park.c" />

View File

@@ -81,6 +81,9 @@
<ClInclude Include="..\src\park.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\map.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\game.c">
@@ -149,6 +152,9 @@
<ClCompile Include="..\src\ride.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\map.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\openrct2.exe">

View File

@@ -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

62
src/map.c Normal file
View File

@@ -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 <http://www.gnu.org/licenses/>.
*****************************************************************************/
#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
}

57
src/map.h Normal file
View File

@@ -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 <http://www.gnu.org/licenses/>.
*****************************************************************************/
#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

View File

@@ -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

View File

@@ -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);