예제 #1
0
static void window_title_editor_update(rct_window *w)
{
	w->frame_no++;
	if (w->frame_no >= window_title_editor_tab_animation_loops[w->selected_tab]) {
		w->frame_no = 0;
	}

	if (!widget_is_highlighted(w, WIDX_TITLE_EDITOR_LIST)) {
		_window_title_editor_highlighted_index = -1;
		widget_invalidate(w, WIDX_TITLE_EDITOR_LIST);
	}

	widget_invalidate(w, WIDX_TITLE_EDITOR_PRESETS_TAB + w->selected_tab);
}
예제 #2
0
파일: window.c 프로젝트: GertS/OpenRCT2
/**
 * 
 *  rct2: 0x006E78E3
 */
static void window_scroll_wheel_input(rct_window *w, int scrollIndex, int wheel)
{
	int widgetIndex, size;
	rct_scroll *scroll;
	rct_widget *widget;
	
	scroll = &w->scrolls[scrollIndex];
	widget = window_get_scroll_widget(w, scrollIndex);
	widgetIndex = window_get_widget_index(w, widget);

	if (scroll->flags & VSCROLLBAR_VISIBLE) {
		size = widget->bottom - widget->top - 1;
		if (scroll->flags & HSCROLLBAR_VISIBLE)
			size -= 11;
		size = max(0, scroll->v_bottom - size);
		scroll->v_top = min(max(0, scroll->v_top + wheel), size);
	} else {
		size = widget->right - widget->left - 1;
		if (scroll->flags & VSCROLLBAR_VISIBLE)
			size -= 11;
		size = max(0, scroll->h_right - size);
		scroll->h_left = min(max(0, scroll->h_left + wheel), size);
	}

	widget_scroll_update_thumbs(w, widgetIndex);
	widget_invalidate(w->classification, w->number, widgetIndex);
}
예제 #3
0
/**
 *
 *  rct2: 0x006CD623
 */
static void window_maze_construction_resize(rct_window *w)
{
    uint64 disabledWidgets = 0;
    if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_PLACE) {
        disabledWidgets |= (
            (1ULL << WIDX_MAZE_BUILD_MODE) |
            (1ULL << WIDX_MAZE_MOVE_MODE) |
            (1ULL << WIDX_MAZE_FILL_MODE) |
            (1ULL << WIDX_MAZE_DIRECTION_NW) |
            (1ULL << WIDX_MAZE_DIRECTION_NE) |
            (1ULL << WIDX_MAZE_DIRECTION_SW) |
            (1ULL << WIDX_MAZE_DIRECTION_SE)
        );
    }

    // Set and invalidate the changed widgets
    uint64 currentDisabledWidgets = w->disabled_widgets;
    if (currentDisabledWidgets == disabledWidgets)
        return;

    for (rct_widgetindex i = 0; i < 64; i++) {
        if ((disabledWidgets & (1ULL << i)) != (currentDisabledWidgets & (1ULL << i))) {
            widget_invalidate(w, i);
        }
    }
    w->disabled_widgets = disabledWidgets;
}
예제 #4
0
파일: calib.c 프로젝트: CalcMan/model-t
static void
calib_touch_up(calib_screen_t* s, point_t p)
{
  (void)p;

  if (s->sample_count[s->ref_pt_idx] < NUM_SAMPLES_PER_POINT)
    return;

  if (++s->ref_pt_idx < NUM_CALIB_POINTS) {
    s->sample_idx = 0;
    widget_invalidate(s->widget);
  }
  else {
    int i,j;
    s->calib_complete = 1;
    point_t avg_sample[NUM_CALIB_POINTS];
    for (i = 0; i < NUM_CALIB_POINTS; ++i) {
      avg_sample[i].x = 0;
      avg_sample[i].y = 0;
      for (j = 0; j < (int)s->sample_count[i]; ++j) {
        avg_sample[i].x += s->sampled_pts[i][j].x;
        avg_sample[i].y += s->sampled_pts[i][j].y;
      }
      avg_sample[i].x /= s->sample_count[i];
      avg_sample[i].y /= s->sample_count[i];
    }
    touch_set_calib(ref_pts, avg_sample);

    widget_hide(s->lbl_instructions);
    widget_show(s->recal_button);
    widget_show(s->complete_button);
  }
}
예제 #5
0
파일: new_ride.c 프로젝트: YJSoft/OpenRCT2
/**
 *
 *  rct2: 0x006B6CE7
 */
static void window_new_ride_update(rct_window *w)
{
	w->frame_no++;
	if (w->frame_no >= window_new_ride_tab_animation_loops[_windowNewRideCurrentTab])
		w->frame_no = 0;

	widget_invalidate(w, WIDX_TAB_1 + _windowNewRideCurrentTab);

	if (w->new_ride.selected_ride_id != -1 && w->new_ride.selected_ride_countdown-- == 0)
		window_new_ride_select(w);

	if (_trackSelectionByType != gConfigInterface.select_by_track_type) {
		window_new_ride_populate_list();
		widget_invalidate(w, WIDX_RIDE_LIST);
	}
}
예제 #6
0
파일: mapgen.c 프로젝트: Aitchwing/OpenRCT2
static void window_mapgen_simplex_update(rct_window *w)
{
	// Tab animation
	if (++w->frame_no >= window_mapgen_tab_animation_loops[w->page])
		w->frame_no = 0;
	widget_invalidate(w, WIDX_TAB_3);
}
예제 #7
0
파일: research.c 프로젝트: itsexe/OpenRCT2
/**
 *
 *  rct2: 0x0069CBA6
 */
static void window_research_development_update(rct_window *w)
{
    // Tab animation
    if (++w->frame_no >= window_research_tab_animation_loops[w->page])
        w->frame_no = 0;
    widget_invalidate(w, WIDX_TAB_1);
}
예제 #8
0
void window_themes_update(rct_window* w)
{
    w->frame_no++;
    if (w->frame_no >= window_themes_tab_animation_loops[_selected_tab])
        w->frame_no = 0;

    widget_invalidate(w, WIDX_THEMES_SETTINGS_TAB + _selected_tab);
}
예제 #9
0
파일: widget.c 프로젝트: CalcMan/model-t
void
widget_set_rect(widget_t* w, rect_t rect)
{
  if (memcmp(&rect, &w->rect, sizeof(rect_t)) != 0) {
    w->rect = rect;
    widget_invalidate(w->parent);
  }
}
예제 #10
0
void window_player_statistics_update(rct_window* w)
{
	w->frame_no++;
	widget_invalidate(w, WIDX_TAB_1 + w->page);

	if (network_get_player_index((uint8)w->number) == -1) {
		window_close(w);
	}
}
예제 #11
0
파일: icon.c 프로젝트: JasonDuran/model-t
void
icon_set_image(widget_t* w, const Image_t* image)
{
  icon_t* i = widget_get_instance_data(w);
  if (i->image != image) {
    i->image = image;
    widget_invalidate(w);
  }
}
예제 #12
0
파일: icon.c 프로젝트: JasonDuran/model-t
void
icon_set_color(widget_t* w, color_t icon_color)
{
  icon_t* i = widget_get_instance_data(w);
  if (i->icon_color != icon_color) {
    i->icon_color = icon_color;
    widget_invalidate(w);
  }
}
예제 #13
0
/**
 *
 *  rct2: 0x00699E54
 */
static void window_guest_list_update(rct_window *w)
{
	if (RCT2_GLOBAL(0x00F1AF20, uint16) != 0)
		RCT2_GLOBAL(0x00F1AF20, uint16)--;
	w->list_information_type++;
	if (w->list_information_type >= (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 24 : 32))
		w->list_information_type = 0;
	widget_invalidate(w, WIDX_TAB_1 + _window_guest_list_selected_tab);
}
예제 #14
0
static void window_cheats_update()
{
	rct_window *w;

	__asm mov w, esi

	w->var_48E++;
	widget_invalidate(w->classification, w->number, WIDX_TAB_1+w->page);
}
예제 #15
0
static void window_title_editor_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
{
	sint32 index = y / ROW_HEIGHT;
	w->selected_list_item = -1;
	switch (w->selected_tab) {
	case WINDOW_TITLE_EDITOR_TAB_SAVES:
		if (index < (sint32)_editingTitleSequence->NumSaves) {
			w->selected_list_item = index;
			widget_invalidate(w, WIDX_TITLE_EDITOR_LIST);
		}
		break;
	case WINDOW_TITLE_EDITOR_TAB_SCRIPT:
		if (index < (sint32)_editingTitleSequence->NumCommands) {
			w->selected_list_item = index;
			widget_invalidate(w, WIDX_TITLE_EDITOR_LIST);
		}
		break;
	}
}
예제 #16
0
파일: game.c 프로젝트: GokuMizuno/OpenRCT2
static void input_mouseover_widget_flatbutton_invalidate()
{
	rct_window *w = window_find_by_id(RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass), RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber));
	if (w == NULL)
		return;

	RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, w, 0, 0);
	if (w->widgets[RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, rct_windownumber)].type == WWT_FLATBTN)
		widget_invalidate(RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWCLASS, rct_windowclass), RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WINDOWNUMBER, rct_windownumber), RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_OVER_WIDGETINDEX, rct_windownumber));
}
예제 #17
0
/**
 *
 *  rct2: 0x00699E54
 */
static void window_guest_list_update(rct_window *w)
{
    if (_window_guest_list_last_find_groups_wait != 0) {
        _window_guest_list_last_find_groups_wait--;
    }
    w->list_information_type++;
    if (w->list_information_type >= (_window_guest_list_selected_tab == PAGE_INDIVIDUAL ? 24 : 32))
        w->list_information_type = 0;
    widget_invalidate(w, WIDX_TAB_1 + _window_guest_list_selected_tab);
}
예제 #18
0
파일: calib.c 프로젝트: CalcMan/model-t
static void
calib_widget_touch(touch_event_t* event)
{
  calib_screen_t* s = widget_get_instance_data(event->widget);

  if (s->calib_complete) {
    s->last_touch_pos = event->pos;
    widget_invalidate(event->widget);
  }
}
예제 #19
0
/**
 *
 *  rct2: 0x006CFF2D
 */
static void window_track_place_toolupdate(rct_window* w, rct_widgetindex widgetIndex, sint32 x, sint32 y)
{
    sint16 mapX, mapY, mapZ;

    map_invalidate_map_selection_tiles();
    gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE;
    gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
    gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;

    // Get the tool map position
    sub_68A15E(x, y, &mapX, &mapY, nullptr, nullptr);
    if (mapX == LOCATION_NULL) {
        window_track_place_clear_provisional();
        return;
    }

    // Check if tool map position has changed since last update
    if (mapX == _window_track_place_last_x && mapY == _window_track_place_last_y) {
        place_virtual_track(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, true, 0, mapX, mapY, 0);
        return;
    }

    money32 cost = MONEY32_UNDEFINED;

    // Get base Z position
    mapZ = window_track_place_get_base_z(mapX, mapY);
    if (game_is_not_paused() || gCheatsBuildInPauseMode) {
        window_track_place_clear_provisional();

        // Try increasing Z until a feasible placement is found
        for (sint32 i = 0; i < 7; i++) {
            uint8 rideIndex;
            window_track_place_attempt_placement(_trackDesign, mapX, mapY, mapZ, 105, &cost, &rideIndex);
            if (cost != MONEY32_UNDEFINED) {
                _window_track_place_ride_index = rideIndex;
                _window_track_place_last_valid_x = mapX;
                _window_track_place_last_valid_y = mapY;
                _window_track_place_last_valid_z = mapZ;
                _window_track_place_last_was_valid = true;
                break;
            }
            mapZ += 8;
        }
    }

    _window_track_place_last_x = mapX;
    _window_track_place_last_y = mapY;
    if (cost != _window_track_place_last_cost) {
        _window_track_place_last_cost = cost;
        widget_invalidate(w, WIDX_PRICE);
    }

    place_virtual_track(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, true, 0, mapX, mapY, mapZ);
}
예제 #20
0
파일: calib.c 프로젝트: CalcMan/model-t
static void
calib_touch_down(calib_screen_t* s, point_t p)
{
  s->sampled_pts[s->ref_pt_idx][s->sample_idx % NUM_SAMPLES_PER_POINT] = p;
  if (s->sample_count[s->ref_pt_idx] < NUM_SAMPLES_PER_POINT)
    s->sample_count[s->ref_pt_idx] += 1;
  s->sample_idx++;

  if ((s->sample_idx == 1) ||
      (s->sample_idx == NUM_SAMPLES_PER_POINT))
    widget_invalidate(s->widget);
}
예제 #21
0
파일: listbox.c 프로젝트: CalcMan/model-t
static void
down_button_event(button_event_t* event)
{
  widget_t* lb = widget_get_parent(event->widget);
  listbox_t* l = widget_get_instance_data(lb);

  if (event->id == EVT_BUTTON_CLICK ||
      event->id == EVT_BUTTON_REPEAT) {
    if (l->pos < widget_num_children(l->item_container) - num_visible_items(lb)) {
      l->pos++;
      widget_invalidate(l->item_container);
    }
  }
}
예제 #22
0
파일: listbox.c 프로젝트: CalcMan/model-t
static void
up_button_event(button_event_t* event)
{
  widget_t* parent = widget_get_parent(event->widget);
  listbox_t* l = widget_get_instance_data(parent);

  if (event->id == EVT_BUTTON_CLICK ||
      event->id == EVT_BUTTON_REPEAT) {
    if (l->pos > 0) {
      l->pos--;
      widget_invalidate(l->item_container);
    }
  }
}
예제 #23
0
파일: listbox.c 프로젝트: CalcMan/model-t
void
listbox_add_item(widget_t* lb, widget_t* item)
{
  listbox_t* l = widget_get_instance_data(lb);
  widget_add_child(l->item_container, item);

  rect_t container_rect = widget_get_rect(l->item_container);
  rect_t rect = widget_get_rect(item);
  rect.x = 0;
  rect.y = 0;
  rect.width = MIN(rect.width, container_rect.width);
  rect.height = MIN(rect.height, l->item_height);
  widget_set_rect(item, rect);
  widget_invalidate(lb);
}
예제 #24
0
/**
 *
 *  rct2: 0x00685392
 */
static void window_editor_inventions_list_update(rct_window* w)
{
    w->frame_no++;
    window_event_invalidate_call(w);
    widget_invalidate(w, WIDX_TAB_1);

    if (_editorInventionsListDraggedItem == nullptr)
        return;

    if (window_find_by_class(WC_EDITOR_INVENTION_LIST_DRAG) != nullptr)
        return;

    _editorInventionsListDraggedItem = nullptr;
    window_invalidate(w);
}
예제 #25
0
static void window_title_editor_scrollmouseover(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
{
	sint32 index = y / ROW_HEIGHT;
	switch (w->selected_tab) {
	case WINDOW_TITLE_EDITOR_TAB_SAVES:
		if (index < (sint32)_editingTitleSequence->NumSaves)
			_window_title_editor_highlighted_index = (sint16)index;
		break;
	case WINDOW_TITLE_EDITOR_TAB_SCRIPT:
		if (index < (sint32)_editingTitleSequence->NumCommands)
			_window_title_editor_highlighted_index = (sint16)index;
		break;
	}
	widget_invalidate(w, WIDX_TITLE_EDITOR_LIST);
}
예제 #26
0
파일: calib.c 프로젝트: CalcMan/model-t
static void
restart_calib(button_event_t* event)
{
  if (event->id == EVT_BUTTON_CLICK) {
    widget_t* screen_widget = widget_get_parent(event->widget);
    calib_screen_t* s = widget_get_instance_data(screen_widget);
    s->calib_complete = false;
    s->sample_idx = 0;
    s->ref_pt_idx = 0;
    memset(s->sample_count, 0, sizeof(s->sample_count));

    widget_show(s->lbl_instructions);
    widget_hide(s->recal_button);
    widget_hide(s->complete_button);
    widget_invalidate(screen_widget);
  }
}
예제 #27
0
void window_themes_scrollmousedown(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
{
    if (y / _row_height < get_colour_scheme_tab_count()) {
        sint32 y2 = y % _row_height;
        _colour_index_1 = y / _row_height;
        _colour_index_2 = ((x - _button_offset_x) / 12);

        rct_windowclass wc = get_window_class_tab_index(_colour_index_1);
        sint32 numColours = theme_desc_get_num_colours(wc);
        if (_colour_index_2 < numColours) {
            if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 && y2 >= _button_offset_y && y2 < _button_offset_y + 11) {
                if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) {
                    window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME);
                } else {
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].type = WWT_COLOURBTN;
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].left = _button_offset_x + _colour_index_2 * 12 + window_themes_widgets[WIDX_THEMES_LIST].left;
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].top = _colour_index_1 * _row_height + _button_offset_y - w->scrolls[0].v_top + window_themes_widgets[WIDX_THEMES_LIST].top;
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].right = window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].left + 12;
                    window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].bottom = window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK].top + 12;

                    uint8 colour = theme_get_colour(wc, _colour_index_2);
                    window_dropdown_show_colour(w, &(window_themes_widgets[WIDX_THEMES_COLOURBTN_MASK]), w->colours[1], colour);
                    widget_invalidate(w, WIDX_THEMES_LIST);
                }
            }
            else if (x >= _button_offset_x && x < _button_offset_x + 12 * 6 - 1 && y2 >= _check_offset_y && y2 < _check_offset_y + 11) {
                if (theme_get_flags() & UITHEME_FLAG_PREDEFINED) {
                    window_error_open(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME);
                } else {
                    uint8 colour = theme_get_colour(wc, _colour_index_2);
                    if (colour & COLOUR_FLAG_TRANSLUCENT) {
                        colour &= ~COLOUR_FLAG_TRANSLUCENT;
                    } else {
                        colour |= COLOUR_FLAG_TRANSLUCENT;
                    }
                    theme_set_colour(wc, _colour_index_2, colour);
                    colour_scheme_update_all();
                    window_invalidate_all();
                }
            }
        }
    }
}
예제 #28
0
파일: Player.cpp 프로젝트: Wirlie/OpenRCT2
void window_player_overview_update(rct_window* w)
{
    w->frame_no++;
    widget_invalidate(w, WIDX_TAB_1 + w->page);

    if (network_get_player_index((uint8)w->number) == -1) {
        window_close(w);
        return;
    }

    // Update viewport
    bool scroll = true;

    // Use this spare window field for rotation check
    if (w->var_4AE != get_current_rotation()) {
        w->var_4AE = get_current_rotation();
        scroll = false;
    }
    window_player_update_viewport(w, scroll);
}
예제 #29
0
static void window_player_update_viewport(rct_window *w, bool scroll)
{
	int playerIndex = network_get_player_index((uint8)w->number);
	if (playerIndex == -1) {
		return;
	}

	rct_viewport *viewport = w->viewport;
	if (viewport != NULL) {
		rct_xyz16 coord = network_get_player_last_action_coord(playerIndex);
		if (coord.x != 0 || coord.y != 0 || coord.z != 0) {
			int viewX, viewY;
			center_2d_coordinates(coord.x, coord.y, coord.z, &viewX, &viewY, viewport);

			// Don't scroll if the view was originally undefined
			if (w->var_492 == -1) {
				scroll = false;
			}

			if (!scroll || w->saved_view_x != viewX || w->saved_view_y != viewY) {
				w->flags |= WF_SCROLLING_TO_LOCATION;
				w->saved_view_x = viewX;
				w->saved_view_y = viewY;
				if (!scroll) {
					w->viewport->view_x = viewX;
					w->viewport->view_y = viewY;
				}
				widget_invalidate(w, WIDX_VIEWPORT);
			}
			
			// Draw the viewport
			w->var_492 = 0;
		} else {
			// Don't draw the viewport
			w->var_492 = -1;
		}
	}
}
예제 #30
0
static void window_news_options_mouseup(rct_window *w, rct_widgetindex widgetIndex)
{
    switch (widgetIndex) {
    case WIDX_CLOSE:
        window_close(w);
        break;
    case WIDX_TAB_PARK:
    case WIDX_TAB_RIDE:
    case WIDX_TAB_GUEST:
        window_news_options_set_page(w, widgetIndex - WIDX_TAB_PARK);
        break;
    default:
    {
        sint32 checkBoxIndex = widgetIndex - WIDX_CHECKBOX_0;
        if (checkBoxIndex >= 0) {
            sint32 matchIndex = 0;
            for (size_t i = 0; i < Util::CountOf(NewsItemOptionDefinitions); i++) {
                const notification_def *ndef = &NewsItemOptionDefinitions[i];
                if (ndef->category != w->page) continue;

                if (matchIndex == checkBoxIndex) {
                    // Toggle value
                    bool *configValue = get_notification_value_ptr(ndef);
                    *configValue = !(*configValue);

                    config_save_default();

                    widget_invalidate(w, widgetIndex);
                    break;
                }
                matchIndex++;
            }
        }
        break;
    }
    }
}