mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 12:03:07 +01:00
Merge pull request #462 from duncanspumpkin/fix_pickup
Fixed dropdown location after pickup.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1179,7 +1179,7 @@ void window_peep_overview_tool_update(){
|
||||
}
|
||||
|
||||
/* rct2: 0x664F72 */
|
||||
int sub_664F72(int x, int y, int edx){
|
||||
int sub_664F72(int x, int y, int z){
|
||||
if (x > 0x1FFF || y > 0x1FFF){
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1;
|
||||
return 1;
|
||||
@@ -1192,10 +1192,10 @@ int sub_664F72(int x, int y, int edx){
|
||||
return 1;
|
||||
}
|
||||
|
||||
edx >>= 3;
|
||||
if ((edx & 0xFF) < map_element->base_height)return 0;
|
||||
edx = (edx & 0xFF) - 2;
|
||||
if (edx > map_element->base_height)return 0;
|
||||
z >>= 3;
|
||||
if ((z & 0xFF) < map_element->base_height)return 0;
|
||||
z = (z & 0xFF) - 2;
|
||||
if (z > map_element->base_height)return 0;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = 0x6C1;
|
||||
return 1;
|
||||
@@ -1211,25 +1211,32 @@ void window_peep_overview_tool_down(){
|
||||
|
||||
if (widgetIndex != WIDX_PICKUP) return;
|
||||
|
||||
int eax = x, ebx = y, ecx = 0, edx = widgetIndex, edi = 0, esi = (int)w, ebp = 0;
|
||||
ebx += 16;
|
||||
RCT2_CALLFUNC_X(0x689726, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
int dest_x = x, dest_y = y, ecx = 0, edx = widgetIndex, edi = 0, esi = (int)w, ebp = 0;
|
||||
dest_y += 16;
|
||||
RCT2_CALLFUNC_X(0x689726, &dest_x, &dest_y, &ecx, &edx, &esi, &edi, &ebp);
|
||||
|
||||
if (eax == 0x8000)return;
|
||||
if (dest_x == 0x8000)return;
|
||||
|
||||
eax += 16;
|
||||
ecx = ebx + 16;
|
||||
edx = ((uint8*)edx)[2] * 8 + 16;
|
||||
int _eax = eax & 0xFFE0, _ebx = ebx & 0xFFE0;
|
||||
if (sub_664F72(eax & 0xFFE0, ebx & 0xFFE0, edx)){
|
||||
// Set the coordinate of destination to be exactly
|
||||
// in the middle of a tile.
|
||||
dest_x += 16;
|
||||
dest_y += 16;
|
||||
// Set the tile coordinate to top left of tile
|
||||
int tile_y = dest_y & 0xFFE0;
|
||||
int tile_x = dest_x & 0xFFE0;
|
||||
|
||||
int dest_z = ((uint8*)edx)[2] * 8 + 16;
|
||||
|
||||
if (sub_664F72(tile_x, tile_y, dest_z)){
|
||||
window_error_open(0x785,-1);
|
||||
return;
|
||||
}
|
||||
int _edx = edx>>3;
|
||||
|
||||
int _edx = dest_z >> 3;
|
||||
_edx &= 0xFFFF00FF;
|
||||
_edx |= edx << 8;
|
||||
_edx |= dest_z << 8;
|
||||
_edx += 0x100;
|
||||
int flags = RCT2_CALLPROC_X(0x68B93A, eax & 0xFFE0, 0xF, ebx & 0xFFE0, _edx, (int)w, 0, 0);
|
||||
int flags = RCT2_CALLPROC_X(0x68B93A, tile_x, 0xF, tile_y, _edx, (int)w, 0, 0);
|
||||
|
||||
if (flags & 0x100){
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) != 0x3A5 ){
|
||||
@@ -1241,7 +1248,7 @@ void window_peep_overview_tool_down(){
|
||||
}
|
||||
|
||||
rct_peep* peep = GET_PEEP(w->number);
|
||||
RCT2_CALLPROC_X(0x0069E9D3, eax, 0, ebx, edx, (int)peep, 0, 0);
|
||||
RCT2_CALLPROC_X(0x0069E9D3, dest_x, 0, dest_y, dest_z, (int)peep, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006EC473, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
RCT2_CALLPROC_X(0x0069A409, 0, 0, 0, 0, (int)peep, 0, 0);
|
||||
peep->state = 0;
|
||||
|
||||
Reference in New Issue
Block a user