2014-04-09 04:09:30 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* 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"
|
2014-04-09 12:16:35 +02:00
|
|
|
#include "climate.h"
|
|
|
|
#include "date.h"
|
2014-04-09 04:09:30 +02:00
|
|
|
#include "map.h"
|
|
|
|
|
|
|
|
#define GET_MAP_ELEMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element)[x]))
|
2014-04-09 18:06:47 +02:00
|
|
|
#define TILE_MAP_ELEMENT_POINTER(x) (RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*)[x])
|
|
|
|
|
|
|
|
static void tiles_init();
|
2014-04-09 04:09:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0068AB4C
|
|
|
|
*/
|
|
|
|
void map_init()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
rct_map_element *map_element;
|
|
|
|
|
2014-04-09 12:16:35 +02:00
|
|
|
date_reset();
|
2014-04-09 04:09:30 +02:00
|
|
|
RCT2_GLOBAL(0x0138B580, sint16) = 0;
|
|
|
|
RCT2_GLOBAL(0x010E63B8, sint32) = 0;
|
|
|
|
|
2014-04-09 18:06:47 +02:00
|
|
|
for (i = 0; i < MAX_TILE_MAP_ELEMENT_POINTERS; i++) {
|
2014-04-09 04:09:30 +02:00
|
|
|
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;
|
2014-04-09 18:06:47 +02:00
|
|
|
tiles_init();
|
2014-04-09 04:09:30 +02:00
|
|
|
RCT2_CALLPROC_EBPSAFE(0x0068ADBC);
|
2014-04-09 12:16:35 +02:00
|
|
|
|
|
|
|
climate_reset(CLIMATE_WARM);
|
2014-04-09 18:06:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0068AFFD
|
|
|
|
*/
|
|
|
|
static void tiles_init()
|
|
|
|
{
|
|
|
|
int i, x, y, lastTile;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_TILE_MAP_ELEMENT_POINTERS; i++)
|
|
|
|
TILE_MAP_ELEMENT_POINTER(i) = TILE_UNDEFINED_MAP_ELEMENT;
|
|
|
|
|
|
|
|
rct_map_element *mapElement = RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element);
|
|
|
|
rct_map_element **tile = RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*);
|
|
|
|
for (y = 0; y < 256; y++) {
|
|
|
|
for (x = 0; x < 256; x++) {
|
|
|
|
*tile++ = mapElement;
|
|
|
|
do {
|
|
|
|
lastTile = (mapElement->var_1 & 128);
|
|
|
|
mapElement++;
|
|
|
|
} while (!lastTile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Possible next free map element
|
|
|
|
RCT2_GLOBAL(0x0140E9A4, rct_map_element*) = mapElement;
|
2014-04-09 04:09:30 +02:00
|
|
|
}
|