Merge pull request #234 from adrian17/master

Small work on flags defines, added SCROLL_FLAGS enum
This commit is contained in:
Ted John 2014-07-25 21:42:10 +01:00
commit ba2e15052b
7 changed files with 41 additions and 36 deletions

View File

@ -139,7 +139,7 @@ static int award_is_deserved_best_rollercoasters(int awardType, int activeAwardT
if (RCT2_GLOBAL(object + 0x1BE, uint8) != RIDE_GROUP_ROLLERCOASTER && RCT2_GLOBAL(object + 0x1BF, uint8) != RIDE_GROUP_ROLLERCOASTER)
continue;
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400))
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
continue;
rollerCoasters++;
@ -438,7 +438,7 @@ static int award_is_deserved_best_water_rides(int awardType, int activeAwardType
if (RCT2_GLOBAL(object + 0x1BE, uint8) != RIDE_GROUP_WATER && RCT2_GLOBAL(object + 0x1BF, uint8) != RIDE_GROUP_WATER)
continue;
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400))
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
continue;
waterRides++;
@ -464,7 +464,7 @@ static int award_is_deserved_best_custom_designed_rides(int awardType, int activ
continue;
if (ride->excitement < RIDE_RATING(5, 50))
continue;
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400))
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
continue;
customDesignedRides++;
@ -530,7 +530,7 @@ static int award_is_deserved_best_gentle_rides(int awardType, int activeAwardTyp
if (RCT2_GLOBAL(object + 0x1BE, uint8) != RIDE_GROUP_GENTLE && RCT2_GLOBAL(object + 0x1BF, uint8) != RIDE_GROUP_GENTLE)
continue;
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & 0x400))
if (ride->status != RIDE_STATUS_OPEN || (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
continue;
gentleRides++;

View File

@ -950,7 +950,7 @@ static void input_hscrollbar_rightbutton(rct_window* w)
left += 3;
widgetWidth = widget->right - widget->left - 1;
if (scroll->flags & 0x0010)
if (scroll->flags & SCROLL_FLAG_VERTICAL)
widgetWidth -= 11;
widgetWidth *= -1;
widgetWidth += scroll->h_right;
@ -999,7 +999,7 @@ static void input_hscrollbar_left_trough(rct_window* w)
left = scroll->h_left;
widgetWidth = widget->right - widget->left - 1;
if (scroll->flags & 0x0010)
if (scroll->flags & SCROLL_FLAG_VERTICAL)
widgetWidth -= 11;
left -= widgetWidth;
if (left < 0)
@ -1044,7 +1044,7 @@ static void input_hscrollbar_right_trough(rct_window* w)
left = scroll->h_left;
widgetWidth = widget->right - widget->left - 1;
if (scroll->flags & 0x0010)
if (scroll->flags & SCROLL_FLAG_VERTICAL)
widgetWidth -= 11;
left += widgetWidth;
widgetWidth *= -1;
@ -1136,7 +1136,7 @@ static void input_vscrollbar_bottombutton(rct_window* w)
top += 3;
widgetHeight = widget->bottom - widget->top - 1;
if (scroll->flags & 0x0001)
if (scroll->flags & SCROLL_FLAG_HORIZONTAL)
widgetHeight -= 11;
widgetHeight *= -1;
widgetHeight += scroll->v_bottom;
@ -1185,7 +1185,7 @@ static void input_vscrollbar_top_trough(rct_window* w)
top = scroll->v_top;
widgetHeight = widget->bottom - widget->top - 1;
if (scroll->flags & 0x0001)
if (scroll->flags & SCROLL_FLAG_HORIZONTAL)
widgetHeight -= 11;
top -= widgetHeight;
if (top < 0)
@ -1230,7 +1230,7 @@ static void input_vscrollbar_bottom_trough(rct_window* w)
top = scroll->v_top;
widgetHeight = widget->bottom - widget->top - 1;
if (scroll->flags & 0x0001)
if (scroll->flags & SCROLL_FLAG_HORIZONTAL)
widgetHeight -= 11;
top += widgetHeight;
widgetHeight *= -1;

View File

@ -364,9 +364,9 @@ static int park_calculate_guest_generation_probability()
FOR_ALL_RIDES(i, ride) {
if (ride->status != RIDE_STATUS_OPEN)
continue;
if (ride->lifecycle_flags & 0x80)
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
continue;
if (ride->lifecycle_flags & 0x400)
if (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)
continue;
// Add guest score for ride type
@ -384,16 +384,16 @@ static int park_calculate_guest_generation_probability()
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_DIFFICULT_GUEST_GENERATION) {
suggestedMaxGuests = min(suggestedMaxGuests, 1000);
FOR_ALL_RIDES(i, ride) {
if (ride->lifecycle_flags & 0x80)
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
continue;
if (ride->lifecycle_flags & 0x400)
if (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)
continue;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10000000))
continue;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x200))
continue;
if (!(ride->lifecycle_flags & 0x02))
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
continue;
if (ride->var_0E4 < 0x2580000)
continue;

View File

@ -642,7 +642,7 @@ static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widge
//
press = 0x70;
if (w->flags & 0x0400)
if (w->flags & WF_10)
press |= 0x80;
gfx_fill_rect_inset(dpi, l, t, r, b, colour, press);
@ -650,7 +650,7 @@ static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widge
} else {
//
press = 0x60;
if (w->flags & 0x0400)
if (w->flags & WF_10)
press |= 0x80;
gfx_fill_rect_inset(dpi, l, t, r, b, colour, press);
@ -694,7 +694,7 @@ static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
// Check if the button is pressed down
press = 0;
if (w->flags & 0x400)
if (w->flags & WF_10)
press |= 0x80;
if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex))
press |= 0x20;
@ -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
int rightOffset = 0;
int iteratorLeft = widget->left + 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;
}
@ -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;
}
}
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
int bottomOffset = 0;
int iteratorTop = widget->top + 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;
}

View File

@ -553,16 +553,16 @@ void window_close_top()
* rct2: 0x006EE927
*/
void window_close_all() {
rct_window* w;
rct_window* w;
window_close_by_id(WC_DROPDOWN, 0);
window_close_by_id(WC_DROPDOWN, 0);
for (w = g_window_list; w < RCT2_LAST_WINDOW; w++){
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) {
window_close(w);
w = g_window_list;
}
}
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) {
window_close(w);
w = g_window_list;
}
}
}
/**
@ -796,11 +796,11 @@ rct_window *window_bring_to_front(rct_window *w)
int i;
rct_window* v, t;
if (w->flags & 0x03)
if (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))
return w;
for (v = RCT2_LAST_WINDOW; v >= g_window_list; v--)
if (!(v->flags & 2))
if (!(v->flags & WF_STICK_TO_FRONT))
break;
if (v >= g_window_list && w != v) {
@ -840,7 +840,7 @@ void window_push_others_below(rct_window *w1)
continue;
// ?
if (w2->flags & 3)
if (w2->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))
continue;
// Check if w2 intersects with w1
@ -1082,7 +1082,7 @@ void window_draw_widgets(rct_window *w, rct_drawpixelinfo *dpi)
// RCT2_CALLPROC_X(0x006EB15C, 0, 0, 0, 0, w, dpi, 0);
// return;
if ((w->flags & WF_TRANSPARENT) && !(w->flags & 0x20))
if ((w->flags & WF_TRANSPARENT) && !(w->flags & WF_5))
gfx_fill_rect(dpi, w->x, w->y, w->x + w->width - 1, w->y + w->height - 1, 0x2000000 | 51);
widgetIndex = 0;
@ -1291,4 +1291,4 @@ void window_bubble_list_item(rct_window* w, int item_position){
char swap = w->list_item_positions[item_position];
w->list_item_positions[item_position] = w->list_item_positions[item_position + 1];
w->list_item_positions[item_position + 1] = swap;
}
}

View File

@ -82,7 +82,7 @@ typedef struct {
* size: 0x12
*/
typedef struct {
uint16 flags; // 0x00 (0x10 == vertical scrollbar, 0x01 == horizontal scrollbar)
uint16 flags; // 0x00
sint16 h_left; // 0x02
sint16 h_right; // 0x04
sint16 h_thumb_left; // 0x06
@ -93,6 +93,11 @@ typedef struct {
sint16 v_thumb_bottom; // 0x10
} rct_scroll;
typedef enum {
SCROLL_FLAG_HORIZONTAL = (1 << 0),
SCROLL_FLAG_VERTICAL = (1 << 4),
} SCROLL_FLAGS;
/**
* Window structure
* size: 0x4C0

View File

@ -899,7 +899,7 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
*argument_2 = ride.var_04C;
}
else{
*argument_1 = peep->flags & 1 ? STR_LEAVING_PARK : STR_WALKING;
*argument_1 = peep->flags & PEEP_FLAGS_LEAVING_PARK ? STR_LEAVING_PARK : STR_WALKING;
*argument_2 = 0;
}
break;