2019-06-15 17:01:41 +02:00
|
|
|
#include "Window_internal.h"
|
|
|
|
|
|
2019-06-15 17:12:14 +02:00
|
|
|
#include "../world/Sprite.h"
|
|
|
|
|
|
2019-06-15 17:01:41 +02:00
|
|
|
void rct_window::SetLocation(int32_t newX, int32_t newY, int32_t newZ)
|
|
|
|
|
{
|
|
|
|
|
window_scroll_to_location(this, newX, newY, newZ);
|
|
|
|
|
flags &= ~WF_SCROLLING_TO_LOCATION;
|
|
|
|
|
}
|
2019-06-15 17:12:14 +02:00
|
|
|
|
|
|
|
|
void rct_window::ScrollToViewport()
|
|
|
|
|
{
|
|
|
|
|
int32_t newX, newY, newZ;
|
|
|
|
|
rct_window* mainWindow;
|
|
|
|
|
|
|
|
|
|
// In original checked to make sure x and y were not -1 as well.
|
|
|
|
|
if (viewport == nullptr || viewport_focus_coordinates.y == -1)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (viewport_focus_sprite.type & VIEWPORT_FOCUS_TYPE_SPRITE)
|
|
|
|
|
{
|
2020-06-06 11:32:37 +01:00
|
|
|
auto* sprite = GetEntity(viewport_focus_sprite.sprite_id);
|
|
|
|
|
newX = sprite->x;
|
|
|
|
|
newY = sprite->y;
|
|
|
|
|
newZ = sprite->z;
|
2019-06-15 17:12:14 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
newX = viewport_focus_coordinates.x;
|
|
|
|
|
newY = viewport_focus_coordinates.y & VIEWPORT_FOCUS_Y_MASK;
|
|
|
|
|
newZ = viewport_focus_coordinates.z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mainWindow = window_get_main();
|
|
|
|
|
if (mainWindow != nullptr)
|
|
|
|
|
window_scroll_to_location(mainWindow, newX, newY, newZ);
|
|
|
|
|
}
|
2019-06-15 17:20:16 +02:00
|
|
|
|
|
|
|
|
void rct_window::Invalidate()
|
|
|
|
|
{
|
2020-03-01 16:32:35 -03:00
|
|
|
gfx_set_dirty_blocks(windowPos.x, windowPos.y, windowPos.x + width, windowPos.y + height);
|
2019-06-15 17:20:16 +02:00
|
|
|
}
|