add unknown map element function

This commit is contained in:
IntelOrca 2014-05-04 18:51:36 +01:00
parent 160c388739
commit da7563c7c9
3 changed files with 52 additions and 1 deletions

View File

@ -140,7 +140,7 @@ void game_logic_update()
if (RCT2_GLOBAL(0x009DEA66, sint16) == 0)
RCT2_GLOBAL(0x009DEA66, sint16)--;
RCT2_CALLPROC_EBPSAFE(0x0068B089);
sub_68B089();
scenario_update();
climate_update();
RCT2_CALLPROC_EBPSAFE(0x006646E1);

View File

@ -280,3 +280,53 @@ int map_element_height(int x, int y)
return height;
}
/**
*
* rct2: 0x0068B089
*/
void sub_68B089()
{
int i;
rct_map_element *mapElementFirst, *mapElement;
if (RCT2_GLOBAL(0x009DEA6F, uint8) & 1)
return;
i = RCT2_GLOBAL(0x0010E63B8, uint32);
do {
i++;
if (i >= MAX_TILE_MAP_ELEMENT_POINTERS)
i = 0;
} while (TILE_MAP_ELEMENT_POINTER(i) == 0xFFFFFFFF);
RCT2_GLOBAL(0x0010E63B8, uint32) = i;
mapElementFirst = mapElement = TILE_MAP_ELEMENT_POINTER(i);
do {
mapElement--;
if (mapElement < RCT2_ADDRESS_MAP_ELEMENTS)
break;
} while (mapElement->base_height == 255);
mapElement++;
if (mapElement == mapElementFirst)
return;
//
TILE_MAP_ELEMENT_POINTER(i) = mapElement;
do {
*mapElement = *mapElementFirst;
mapElementFirst->base_height = 255;
mapElement++;
mapElementFirst++;
} while (!((mapElement - 1)->flags & MAP_ELEMENT_FLAG_LAST_TILE));
// Update next free element?
mapElement = RCT2_GLOBAL(0x0140E9A4, rct_map_element*);
do {
mapElement--;
} while (mapElement->base_height == 255);
mapElement++;
RCT2_GLOBAL(0x0140E9A4, rct_map_element*) = mapElement;
}

View File

@ -185,5 +185,6 @@ enum {
void map_init();
void map_update_tile_pointers();
int map_element_height(int x, int y);
void sub_68B089();
#endif