Fixed incorrectly assuming peep was underground if on water

This commit is contained in:
Duncan Frost 2014-09-18 17:18:39 +01:00
parent b40ebfe7a2
commit f25b6e2ba2
2 changed files with 3 additions and 2 deletions

View File

@ -154,9 +154,10 @@ void map_update_tile_pointers()
/**
* Return the absolute height of an element, given its (x,y) coordinates
*
* ax: x
* cx: y
* dx: return
* dx: return remember to & with 0xFFFF if you don't want water affecting results
* rct2: 0x00662783
*/
int map_element_height(int x, int y)

View File

@ -281,7 +281,7 @@ void viewport_update_position(rct_window *window)
if (window->viewport_target_sprite != -1){
rct_sprite* sprite = &g_sprite_list[window->viewport_target_sprite];
int height = map_element_height(0xFFFF & sprite->unknown.x, 0xFFFF & sprite->unknown.y) - 16;
int height = map_element_height(0xFFFF & sprite->unknown.x, 0xFFFF & sprite->unknown.y) & 0xFFFF - 16;
int underground = sprite->unknown.z < height;
RCT2_CALLPROC_X(0x6E7A15, sprite->unknown.x, sprite->unknown.y, sprite->unknown.z, underground, (int)window, (int)viewport, 0);