mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add SCROLL_FLAGS enum (and fix an hidden bug in widget_scroll_get_part)
This commit is contained in:
parent
65b17cbd5d
commit
8960792073
12
src/game.c
12
src/game.c
|
@ -950,7 +950,7 @@ static void input_hscrollbar_rightbutton(rct_window* w)
|
||||||
left += 3;
|
left += 3;
|
||||||
|
|
||||||
widgetWidth = widget->right - widget->left - 1;
|
widgetWidth = widget->right - widget->left - 1;
|
||||||
if (scroll->flags & 0x0010)
|
if (scroll->flags & SCROLL_FLAG_VERTICAL)
|
||||||
widgetWidth -= 11;
|
widgetWidth -= 11;
|
||||||
widgetWidth *= -1;
|
widgetWidth *= -1;
|
||||||
widgetWidth += scroll->h_right;
|
widgetWidth += scroll->h_right;
|
||||||
|
@ -999,7 +999,7 @@ static void input_hscrollbar_left_trough(rct_window* w)
|
||||||
left = scroll->h_left;
|
left = scroll->h_left;
|
||||||
|
|
||||||
widgetWidth = widget->right - widget->left - 1;
|
widgetWidth = widget->right - widget->left - 1;
|
||||||
if (scroll->flags & 0x0010)
|
if (scroll->flags & SCROLL_FLAG_VERTICAL)
|
||||||
widgetWidth -= 11;
|
widgetWidth -= 11;
|
||||||
left -= widgetWidth;
|
left -= widgetWidth;
|
||||||
if (left < 0)
|
if (left < 0)
|
||||||
|
@ -1044,7 +1044,7 @@ static void input_hscrollbar_right_trough(rct_window* w)
|
||||||
left = scroll->h_left;
|
left = scroll->h_left;
|
||||||
|
|
||||||
widgetWidth = widget->right - widget->left - 1;
|
widgetWidth = widget->right - widget->left - 1;
|
||||||
if (scroll->flags & 0x0010)
|
if (scroll->flags & SCROLL_FLAG_VERTICAL)
|
||||||
widgetWidth -= 11;
|
widgetWidth -= 11;
|
||||||
left += widgetWidth;
|
left += widgetWidth;
|
||||||
widgetWidth *= -1;
|
widgetWidth *= -1;
|
||||||
|
@ -1136,7 +1136,7 @@ static void input_vscrollbar_bottombutton(rct_window* w)
|
||||||
top += 3;
|
top += 3;
|
||||||
|
|
||||||
widgetHeight = widget->bottom - widget->top - 1;
|
widgetHeight = widget->bottom - widget->top - 1;
|
||||||
if (scroll->flags & 0x0001)
|
if (scroll->flags & SCROLL_FLAG_HORIZONTAL)
|
||||||
widgetHeight -= 11;
|
widgetHeight -= 11;
|
||||||
widgetHeight *= -1;
|
widgetHeight *= -1;
|
||||||
widgetHeight += scroll->v_bottom;
|
widgetHeight += scroll->v_bottom;
|
||||||
|
@ -1185,7 +1185,7 @@ static void input_vscrollbar_top_trough(rct_window* w)
|
||||||
top = scroll->v_top;
|
top = scroll->v_top;
|
||||||
|
|
||||||
widgetHeight = widget->bottom - widget->top - 1;
|
widgetHeight = widget->bottom - widget->top - 1;
|
||||||
if (scroll->flags & 0x0001)
|
if (scroll->flags & SCROLL_FLAG_HORIZONTAL)
|
||||||
widgetHeight -= 11;
|
widgetHeight -= 11;
|
||||||
top -= widgetHeight;
|
top -= widgetHeight;
|
||||||
if (top < 0)
|
if (top < 0)
|
||||||
|
@ -1230,7 +1230,7 @@ static void input_vscrollbar_bottom_trough(rct_window* w)
|
||||||
top = scroll->v_top;
|
top = scroll->v_top;
|
||||||
|
|
||||||
widgetHeight = widget->bottom - widget->top - 1;
|
widgetHeight = widget->bottom - widget->top - 1;
|
||||||
if (scroll->flags & 0x0001)
|
if (scroll->flags & SCROLL_FLAG_HORIZONTAL)
|
||||||
widgetHeight -= 11;
|
widgetHeight -= 11;
|
||||||
top += widgetHeight;
|
top += widgetHeight;
|
||||||
widgetHeight *= -1;
|
widgetHeight *= -1;
|
||||||
|
|
|
@ -1022,13 +1022,13 @@ void widget_scroll_get_part(rct_window *w, rct_widget* widget, int x, int y, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((w->scrolls[*scroll_id].flags & 0x01) && y >= (w->y + widget->bottom - 11))
|
if ((w->scrolls[*scroll_id].flags & SCROLL_FLAG_HORIZONTAL) && y >= (w->y + widget->bottom - 11))
|
||||||
{
|
{
|
||||||
//horizon scrollbar
|
//horizon scrollbar
|
||||||
int rightOffset = 0;
|
int rightOffset = 0;
|
||||||
int iteratorLeft = widget->left + w->x;
|
int iteratorLeft = widget->left + w->x;
|
||||||
int iteratorRight = widget->right + w->x;
|
int iteratorRight = widget->right + w->x;
|
||||||
if (w->scrolls[*scroll_id].flags & 0x01)
|
if (w->scrolls[*scroll_id].flags & SCROLL_FLAG_VERTICAL)
|
||||||
{
|
{
|
||||||
rightOffset = 11;
|
rightOffset = 11;
|
||||||
}
|
}
|
||||||
|
@ -1057,13 +1057,13 @@ void widget_scroll_get_part(rct_window *w, rct_widget* widget, int x, int y, int
|
||||||
*output_scroll_area = SCROLL_PART_HSCROLLBAR_THUMB;
|
*output_scroll_area = SCROLL_PART_HSCROLLBAR_THUMB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((w->scrolls[*scroll_id].flags & 10) || (x >= w->x + widget->right - 11))
|
else if ((w->scrolls[*scroll_id].flags & SCROLL_FLAG_VERTICAL) && (x >= w->x + widget->right - 11))
|
||||||
{
|
{
|
||||||
//vertical scrollbar
|
//vertical scrollbar
|
||||||
int bottomOffset = 0;
|
int bottomOffset = 0;
|
||||||
int iteratorTop = widget->top + w->y;
|
int iteratorTop = widget->top + w->y;
|
||||||
int iteratorBottom = widget->bottom + w->y;
|
int iteratorBottom = widget->bottom + w->y;
|
||||||
if (w->scrolls[*scroll_id].flags & 0x01)
|
if (w->scrolls[*scroll_id].flags & SCROLL_FLAG_HORIZONTAL)
|
||||||
{
|
{
|
||||||
bottomOffset = 11;
|
bottomOffset = 11;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ typedef struct {
|
||||||
* size: 0x12
|
* size: 0x12
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16 flags; // 0x00 (0x10 == vertical scrollbar, 0x01 == horizontal scrollbar)
|
uint16 flags; // 0x00
|
||||||
sint16 h_left; // 0x02
|
sint16 h_left; // 0x02
|
||||||
sint16 h_right; // 0x04
|
sint16 h_right; // 0x04
|
||||||
sint16 h_thumb_left; // 0x06
|
sint16 h_thumb_left; // 0x06
|
||||||
|
@ -93,6 +93,11 @@ typedef struct {
|
||||||
sint16 v_thumb_bottom; // 0x10
|
sint16 v_thumb_bottom; // 0x10
|
||||||
} rct_scroll;
|
} rct_scroll;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SCROLL_FLAG_HORIZONTAL = (1 << 0),
|
||||||
|
SCROLL_FLAG_VERTICAL = (1 << 4),
|
||||||
|
} SCROLL_FLAGS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Window structure
|
* Window structure
|
||||||
* size: 0x4C0
|
* size: 0x4C0
|
||||||
|
|
Loading…
Reference in New Issue