2016-05-04 19:24:41 +02:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-05-04 19:24:41 +02:00
|
|
|
*****************************************************************************/
|
2014-11-23 17:28:23 +01:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
#include "../interface/Theme.h"
|
2017-08-02 00:20:32 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2-ui/interface/Widget.h>
|
|
|
|
#include <openrct2-ui/windows/Window.h>
|
2017-11-15 02:29:34 +01:00
|
|
|
#include <openrct2/Context.h>
|
|
|
|
#include <openrct2/Editor.h>
|
2020-04-24 17:19:06 +02:00
|
|
|
#include <openrct2/EditorObjectSelectionSession.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/Game.h>
|
2017-12-12 14:52:57 +01:00
|
|
|
#include <openrct2/Input.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/OpenRCT2.h>
|
|
|
|
#include <openrct2/audio/audio.h>
|
2018-01-06 18:32:25 +01:00
|
|
|
#include <openrct2/localisation/Localisation.h>
|
2018-03-19 23:28:40 +01:00
|
|
|
#include <openrct2/management/Research.h>
|
|
|
|
#include <openrct2/scenario/Scenario.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/sprites.h>
|
|
|
|
#include <openrct2/windows/Intent.h>
|
2018-03-19 23:28:40 +01:00
|
|
|
#include <openrct2/world/Park.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/world/Scenery.h>
|
|
|
|
#include <string>
|
2014-11-23 17:28:23 +01:00
|
|
|
|
2018-05-16 20:41:29 +02:00
|
|
|
// clang-format off
|
2015-02-09 19:32:58 +01:00
|
|
|
enum {
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_PREVIOUS_IMAGE, // 1
|
|
|
|
WIDX_PREVIOUS_STEP_BUTTON, // 2
|
|
|
|
WIDX_NEXT_IMAGE, // 4
|
|
|
|
WIDX_NEXT_STEP_BUTTON, // 8
|
2014-11-23 17:28:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static rct_widget window_editor_bottom_toolbar_widgets[] = {
|
2020-11-27 04:14:20 +01:00
|
|
|
MakeWidget({ 0, 0}, {200, 34}, WindowWidgetType::ImgBtn, WindowColour::Primary),
|
|
|
|
MakeWidget({ 2, 2}, {196, 30}, WindowWidgetType::FlatBtn, WindowColour::Primary),
|
|
|
|
MakeWidget({440, 0}, {200, 34}, WindowWidgetType::ImgBtn, WindowColour::Primary),
|
|
|
|
MakeWidget({442, 2}, {196, 30}, WindowWidgetType::FlatBtn, WindowColour::Primary),
|
2021-09-26 11:11:42 +02:00
|
|
|
WIDGETS_END,
|
2014-11-23 17:28:23 +01:00
|
|
|
};
|
|
|
|
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_editor_bottom_toolbar_mouseup(rct_window *w, rct_widgetindex widgetIndex);
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_editor_bottom_toolbar_invalidate(rct_window *w);
|
|
|
|
static void window_editor_bottom_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
2014-11-23 17:28:23 +01:00
|
|
|
|
|
|
|
static void window_editor_bottom_toolbar_jump_back_to_object_selection();
|
|
|
|
static void window_editor_bottom_toolbar_jump_back_to_landscape_editor();
|
|
|
|
static void window_editor_bottom_toolbar_jump_back_to_invention_list_set_up();
|
|
|
|
static void window_editor_bottom_toolbar_jump_back_to_options_selection();
|
|
|
|
|
|
|
|
static void window_editor_bottom_toolbar_jump_forward_from_object_selection();
|
|
|
|
static void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up();
|
|
|
|
static void window_editor_bottom_toolbar_jump_forward_to_options_selection();
|
|
|
|
static void window_editor_bottom_toolbar_jump_forward_to_objective_selection();
|
|
|
|
static void window_editor_bottom_toolbar_jump_forward_to_save_scenario();
|
|
|
|
|
2020-09-28 20:36:15 +02:00
|
|
|
static rct_window_event_list window_editor_bottom_toolbar_events([](auto& events)
|
|
|
|
{
|
|
|
|
events.mouse_up = &window_editor_bottom_toolbar_mouseup;
|
|
|
|
events.invalidate = &window_editor_bottom_toolbar_invalidate;
|
|
|
|
events.paint = &window_editor_bottom_toolbar_paint;
|
|
|
|
});
|
2014-11-23 17:28:23 +01:00
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static EMPTY_ARGS_VOID_POINTER *previous_button_mouseup_events[] = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_editor_bottom_toolbar_jump_back_to_object_selection,
|
|
|
|
window_editor_bottom_toolbar_jump_back_to_landscape_editor,
|
|
|
|
window_editor_bottom_toolbar_jump_back_to_invention_list_set_up,
|
|
|
|
window_editor_bottom_toolbar_jump_back_to_options_selection,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_editor_bottom_toolbar_jump_back_to_object_selection,
|
2021-10-17 15:31:56 +02:00
|
|
|
nullptr,
|
2014-11-23 17:28:23 +01:00
|
|
|
};
|
|
|
|
|
2015-07-10 02:39:16 +02:00
|
|
|
static EMPTY_ARGS_VOID_POINTER *next_button_mouseup_events[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
window_editor_bottom_toolbar_jump_forward_from_object_selection,
|
|
|
|
window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up,
|
|
|
|
window_editor_bottom_toolbar_jump_forward_to_options_selection,
|
|
|
|
window_editor_bottom_toolbar_jump_forward_to_objective_selection,
|
|
|
|
window_editor_bottom_toolbar_jump_forward_to_save_scenario,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2021-10-17 15:31:56 +02:00
|
|
|
nullptr,
|
2014-11-23 17:28:23 +01:00
|
|
|
};
|
|
|
|
|
2018-01-11 14:50:31 +01:00
|
|
|
static constexpr const rct_string_id EditorStepNames[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
STR_EDITOR_STEP_OBJECT_SELECTION,
|
|
|
|
STR_EDITOR_STEP_LANDSCAPE_EDITOR,
|
|
|
|
STR_EDITOR_STEP_INVENTIONS_LIST_SET_UP,
|
|
|
|
STR_EDITOR_STEP_OPTIONS_SELECTION,
|
|
|
|
STR_EDITOR_STEP_OBJECTIVE_SELECTION,
|
|
|
|
STR_EDITOR_STEP_SAVE_SCENARIO,
|
|
|
|
STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER,
|
|
|
|
STR_EDITOR_STEP_TRACK_DESIGNS_MANAGER,
|
2016-07-14 14:07:49 +02:00
|
|
|
};
|
2018-05-16 20:41:29 +02:00
|
|
|
// clang-format on
|
2016-07-14 14:07:49 +02:00
|
|
|
|
2014-11-23 17:28:23 +01:00
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
* Creates the main editor top toolbar window.
|
|
|
|
* rct2: 0x0066F052 (part of 0x0066EF38)
|
|
|
|
*/
|
|
|
|
rct_window* window_editor_bottom_toolbar_open()
|
2014-11-23 17:28:23 +01:00
|
|
|
{
|
2020-11-04 05:52:23 +01:00
|
|
|
rct_window* window = WindowCreate(
|
2019-10-19 13:07:03 +02:00
|
|
|
ScreenCoordsXY(0, context_get_height() - 32), context_get_width(), 32, &window_editor_bottom_toolbar_events,
|
|
|
|
WC_BOTTOM_TOOLBAR, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
2017-06-06 23:24:18 +02:00
|
|
|
window->widgets = window_editor_bottom_toolbar_widgets;
|
|
|
|
|
2021-06-26 14:23:15 +02:00
|
|
|
window->enabled_widgets |= (1ULL << WIDX_PREVIOUS_STEP_BUTTON) | (1ULL << WIDX_NEXT_STEP_BUTTON)
|
|
|
|
| (1ULL << WIDX_PREVIOUS_IMAGE) | (1ULL << WIDX_NEXT_IMAGE);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2020-11-04 05:52:23 +01:00
|
|
|
WindowInitScrollWidgets(window);
|
2018-01-02 20:31:48 +01:00
|
|
|
set_all_scenery_items_invented();
|
2017-11-15 02:29:34 +01:00
|
|
|
|
|
|
|
return window;
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066F619
|
|
|
|
*/
|
|
|
|
void window_editor_bottom_toolbar_jump_back_to_object_selection()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_close_all();
|
2021-04-05 19:01:43 +02:00
|
|
|
gEditorStep = EditorStep::ObjectSelection;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_invalidate_screen();
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066F62C
|
|
|
|
*/
|
|
|
|
void window_editor_bottom_toolbar_jump_back_to_landscape_editor()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_close_all();
|
2018-01-02 20:31:48 +01:00
|
|
|
set_all_scenery_items_invented();
|
2017-06-06 23:24:18 +02:00
|
|
|
scenery_set_default_placement_configuration();
|
2021-04-05 19:01:43 +02:00
|
|
|
gEditorStep = EditorStep::LandscapeEditor;
|
2017-10-06 23:03:48 +02:00
|
|
|
context_open_window(WC_MAP);
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_invalidate_screen();
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066F64E
|
|
|
|
*/
|
|
|
|
static void window_editor_bottom_toolbar_jump_back_to_invention_list_set_up()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_close_all();
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_EDITOR_INVENTION_LIST);
|
2021-04-05 19:01:43 +02:00
|
|
|
gEditorStep = EditorStep::InventionsListSetUp;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_invalidate_screen();
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066F666
|
|
|
|
*/
|
|
|
|
void window_editor_bottom_toolbar_jump_back_to_options_selection()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_close_all();
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_EDITOR_SCENARIO_OPTIONS);
|
2021-04-05 19:01:43 +02:00
|
|
|
gEditorStep = EditorStep::OptionsSelection;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_invalidate_screen();
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-03-11 13:57:59 +01:00
|
|
|
*
|
|
|
|
* rct2: 0x006AB1CE
|
|
|
|
*/
|
2016-07-13 00:46:51 +02:00
|
|
|
static bool window_editor_bottom_toolbar_check_object_selection()
|
2015-07-05 17:47:22 +02:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
rct_window* w;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-06-09 14:05:00 +02:00
|
|
|
auto [missingObjectType, errorString] = Editor::CheckObjectSelection();
|
2020-11-09 11:53:29 +01:00
|
|
|
if (missingObjectType == ObjectType::None)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_close_by_class(WC_EDITOR_OBJECT_SELECTION);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-06-09 14:05:00 +02:00
|
|
|
context_show_error(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {});
|
2017-06-06 23:24:18 +02:00
|
|
|
w = window_find_by_class(WC_EDITOR_OBJECT_SELECTION);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (w != nullptr)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
// Click tab with missing object
|
2020-11-10 09:00:15 +01:00
|
|
|
window_event_mouse_up_call(w, WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 + EnumValue(missingObjectType));
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
return false;
|
2015-07-05 17:47:22 +02:00
|
|
|
}
|
|
|
|
|
2015-03-11 13:57:59 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066F6B0
|
|
|
|
*/
|
|
|
|
void window_editor_bottom_toolbar_jump_forward_from_object_selection()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
if (!window_editor_bottom_toolbar_check_object_selection())
|
|
|
|
return;
|
|
|
|
|
2020-04-24 17:19:06 +02:00
|
|
|
finish_object_selection();
|
2018-06-22 23:21:44 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
|
|
|
{
|
2017-10-07 01:28:00 +02:00
|
|
|
context_open_window(WC_CONSTRUCT_RIDE);
|
2018-06-22 23:21:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-10-06 23:03:48 +02:00
|
|
|
context_open_window(WC_MAP);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066F758
|
|
|
|
*/
|
2017-09-22 07:56:24 +02:00
|
|
|
void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up()
|
|
|
|
{
|
2021-06-09 14:05:00 +02:00
|
|
|
auto [checksPassed, errorString] = Editor::CheckPark();
|
|
|
|
if (checksPassed)
|
2017-09-22 07:56:24 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_close_all();
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_EDITOR_INVENTION_LIST);
|
2021-04-05 19:01:43 +02:00
|
|
|
gEditorStep = EditorStep::InventionsListSetUp;
|
2017-09-22 07:56:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-06-09 14:05:00 +02:00
|
|
|
context_show_error(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, errorString, {});
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
gfx_invalidate_screen();
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066f790
|
|
|
|
*/
|
2017-09-22 07:56:24 +02:00
|
|
|
void window_editor_bottom_toolbar_jump_forward_to_options_selection()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_close_all();
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_EDITOR_SCENARIO_OPTIONS);
|
2021-04-05 19:01:43 +02:00
|
|
|
gEditorStep = EditorStep::OptionsSelection;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_invalidate_screen();
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066f7a8
|
|
|
|
*/
|
|
|
|
void window_editor_bottom_toolbar_jump_forward_to_objective_selection()
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_close_all();
|
2020-10-11 18:42:17 +02:00
|
|
|
context_open_window(WC_EDITOR_OBJECTIVE_OPTIONS);
|
2021-04-05 19:01:43 +02:00
|
|
|
gEditorStep = EditorStep::ObjectiveSelection;
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_invalidate_screen();
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
2014-11-25 03:05:48 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x0066F7C0
|
|
|
|
*/
|
|
|
|
void window_editor_bottom_toolbar_jump_forward_to_save_scenario()
|
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (!scenario_prepare_for_save())
|
|
|
|
{
|
2020-08-27 00:01:15 +02:00
|
|
|
context_show_error(STR_UNABLE_TO_SAVE_SCENARIO_FILE, gGameCommandErrorText, {});
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_invalidate_screen();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
window_close_all();
|
2017-09-12 00:04:03 +02:00
|
|
|
auto intent = Intent(WC_LOADSAVE);
|
2017-09-12 21:21:39 +02:00
|
|
|
intent.putExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO);
|
2021-04-05 19:01:43 +02:00
|
|
|
intent.putExtra(INTENT_EXTRA_PATH, gScenarioName);
|
2017-09-12 00:04:03 +02:00
|
|
|
context_open_intent(&intent);
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066F5AE
|
|
|
|
*/
|
|
|
|
static void window_editor_bottom_toolbar_mouseup([[maybe_unused]] rct_window* w, rct_widgetindex widgetIndex)
|
2014-11-23 17:28:23 +01:00
|
|
|
{
|
2018-06-22 23:21:44 +02:00
|
|
|
if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON)
|
|
|
|
{
|
|
|
|
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
2021-02-24 23:34:34 +01:00
|
|
|
|| (GetNumFreeEntities() == MAX_ENTITIES && !(gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)))
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2021-04-05 19:01:43 +02:00
|
|
|
previous_button_mouseup_events[EnumValue(gEditorStep)]();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
}
|
|
|
|
else if (widgetIndex == WIDX_NEXT_STEP_BUTTON)
|
|
|
|
{
|
2021-04-05 19:01:43 +02:00
|
|
|
next_button_mouseup_events[EnumValue(gEditorStep)]();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
static void hide_previous_step_button()
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_STEP_BUTTON].type = WindowWidgetType::Empty;
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].type = WindowWidgetType::Empty;
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
static void hide_next_step_button()
|
|
|
|
{
|
2020-11-27 04:14:20 +01:00
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_NEXT_STEP_BUTTON].type = WindowWidgetType::Empty;
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].type = WindowWidgetType::Empty;
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066F1C9
|
|
|
|
*/
|
|
|
|
void window_editor_bottom_toolbar_invalidate(rct_window* w)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2020-11-03 11:59:00 +01:00
|
|
|
ColourSchemeUpdateByClass(
|
2018-06-22 23:21:44 +02:00
|
|
|
w, (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR : WC_EDITOR_TRACK_BOTTOM_TOOLBAR);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
uint16_t screenWidth = context_get_width();
|
2017-06-06 23:24:18 +02:00
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left = screenWidth - 200;
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right = screenWidth - 1;
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_NEXT_STEP_BUTTON].left = screenWidth - 198;
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_NEXT_STEP_BUTTON].right = screenWidth - 3;
|
|
|
|
|
2020-11-27 04:14:20 +01:00
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_STEP_BUTTON].type = WindowWidgetType::FlatBtn;
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_NEXT_STEP_BUTTON].type = WindowWidgetType::FlatBtn;
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].type = WindowWidgetType::ImgBtn;
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].type = WindowWidgetType::ImgBtn;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
hide_previous_step_button();
|
|
|
|
hide_next_step_button();
|
2018-06-22 23:21:44 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-04-05 19:01:43 +02:00
|
|
|
if (gEditorStep == EditorStep::ObjectSelection)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
hide_previous_step_button();
|
2018-06-22 23:21:44 +02:00
|
|
|
}
|
2021-04-05 19:01:43 +02:00
|
|
|
else if (gEditorStep == EditorStep::RollercoasterDesigner)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
hide_next_step_button();
|
2018-06-22 23:21:44 +02:00
|
|
|
}
|
|
|
|
else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER))
|
|
|
|
{
|
2021-02-24 23:34:34 +01:00
|
|
|
if (GetNumFreeEntities() != MAX_ENTITIES || gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
hide_previous_step_button();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-11-23 17:28:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-06-22 23:21:44 +02:00
|
|
|
*
|
|
|
|
* rct2: 0x0066F25C
|
|
|
|
*/
|
|
|
|
void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
bool drawPreviousButton = false;
|
|
|
|
bool drawNextButton = false;
|
|
|
|
|
2021-04-05 19:01:43 +02:00
|
|
|
if (gEditorStep == EditorStep::ObjectSelection)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
drawNextButton = true;
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
drawPreviousButton = true;
|
|
|
|
}
|
2021-02-24 23:34:34 +01:00
|
|
|
else if (GetNumFreeEntities() != MAX_ENTITIES)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
drawNextButton = true;
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else if (gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
drawNextButton = true;
|
|
|
|
}
|
2018-06-22 23:21:44 +02:00
|
|
|
else
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
drawPreviousButton = true;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
|
|
|
|
{
|
2021-10-21 00:43:32 +02:00
|
|
|
auto previousWidget = window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE];
|
|
|
|
auto nextWidget = window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE];
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (drawPreviousButton)
|
|
|
|
{
|
2021-10-21 00:43:32 +02:00
|
|
|
auto leftTop = w->windowPos + ScreenCoordsXY{ previousWidget.left, previousWidget.top };
|
|
|
|
auto rightBottom = w->windowPos + ScreenCoordsXY{ previousWidget.right, previousWidget.bottom };
|
|
|
|
gfx_filter_rect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2021-04-05 19:01:43 +02:00
|
|
|
if ((drawPreviousButton || drawNextButton) && gEditorStep != EditorStep::RollercoasterDesigner)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2021-10-21 00:43:32 +02:00
|
|
|
auto leftTop = w->windowPos + ScreenCoordsXY{ nextWidget.left, nextWidget.top };
|
|
|
|
auto rightBottom = w->windowPos + ScreenCoordsXY{ nextWidget.right, nextWidget.bottom };
|
|
|
|
gfx_filter_rect(dpi, { leftTop, rightBottom }, FilterPaletteID::Palette51);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-04 05:52:23 +01:00
|
|
|
WindowDrawWidgets(w, dpi);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
|
|
|
|
{
|
2021-03-27 04:50:19 +01:00
|
|
|
const auto topLeft = w->windowPos
|
|
|
|
+ ScreenCoordsXY{ window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 1,
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 1 };
|
|
|
|
const auto bottomRight = w->windowPos
|
|
|
|
+ ScreenCoordsXY{ window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right - 1,
|
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 };
|
2018-06-22 23:21:44 +02:00
|
|
|
if (drawPreviousButton)
|
|
|
|
{
|
2021-03-27 04:50:19 +01:00
|
|
|
gfx_fill_rect_inset(dpi, { topLeft, bottomRight }, w->colours[1], INSET_RECT_F_30);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2021-04-05 19:01:43 +02:00
|
|
|
if ((drawPreviousButton || drawNextButton) && gEditorStep != EditorStep::RollercoasterDesigner)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2021-03-27 04:50:19 +01:00
|
|
|
gfx_fill_rect_inset(dpi, { topLeft, bottomRight }, w->colours[1], INSET_RECT_F_30);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
int16_t stateX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right
|
|
|
|
+ window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left)
|
|
|
|
/ 2
|
2020-03-01 20:32:35 +01:00
|
|
|
+ w->windowPos.x;
|
|
|
|
int16_t stateY = w->height - 0x0C + w->windowPos.y;
|
2021-02-27 15:23:50 +01:00
|
|
|
DrawTextBasic(
|
2021-04-05 19:01:43 +02:00
|
|
|
dpi, { stateX, stateY }, EditorStepNames[EnumValue(gEditorStep)], {},
|
2021-02-27 15:23:50 +01:00
|
|
|
{ static_cast<colour_t>(NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE), TextAlignment::CENTRE });
|
2018-06-22 23:21:44 +02:00
|
|
|
|
|
|
|
if (drawPreviousButton)
|
|
|
|
{
|
|
|
|
gfx_draw_sprite(
|
2021-03-23 11:58:09 +01:00
|
|
|
dpi, ImageId(SPR_PREVIOUS),
|
2020-06-23 23:32:34 +02:00
|
|
|
w->windowPos
|
|
|
|
+ ScreenCoordsXY{ window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 6,
|
2021-03-23 11:58:09 +01:00
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-02-27 15:23:50 +01:00
|
|
|
colour_t textColour = NOT_TRANSLUCENT(w->colours[1]);
|
2018-06-22 23:21:44 +02:00
|
|
|
if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR
|
|
|
|
&& gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
textColour = COLOUR_WHITE;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
int16_t textX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 30
|
|
|
|
+ window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right)
|
|
|
|
/ 2
|
2020-03-01 20:32:35 +01:00
|
|
|
+ w->windowPos.x;
|
|
|
|
int16_t textY = window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->windowPos.y;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-05 19:01:43 +02:00
|
|
|
rct_string_id stringId = EditorStepNames[EnumValue(gEditorStep) - 1];
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
|
|
|
stringId = STR_EDITOR_STEP_OBJECT_SELECTION;
|
|
|
|
|
2021-02-27 15:23:50 +01:00
|
|
|
DrawTextBasic(dpi, { textX, textY }, STR_BACK_TO_PREVIOUS_STEP, {}, { textColour, TextAlignment::CENTRE });
|
|
|
|
DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2021-04-05 19:01:43 +02:00
|
|
|
if ((drawPreviousButton || drawNextButton) && gEditorStep != EditorStep::RollercoasterDesigner)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
|
|
|
gfx_draw_sprite(
|
2021-03-23 11:58:09 +01:00
|
|
|
dpi, ImageId(SPR_NEXT),
|
2020-06-23 23:32:34 +02:00
|
|
|
w->windowPos
|
|
|
|
+ ScreenCoordsXY{ window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 29,
|
2021-03-23 11:58:09 +01:00
|
|
|
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 });
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-02-27 15:23:50 +01:00
|
|
|
colour_t textColour = NOT_TRANSLUCENT(w->colours[1]);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
textColour = COLOUR_WHITE;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
int16_t textX = (window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left
|
|
|
|
+ window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 30)
|
|
|
|
/ 2
|
2020-03-01 20:32:35 +01:00
|
|
|
+ w->windowPos.x;
|
|
|
|
int16_t textY = window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 + w->windowPos.y;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-05 19:01:43 +02:00
|
|
|
rct_string_id stringId = EditorStepNames[EnumValue(gEditorStep) + 1];
|
2017-06-06 23:24:18 +02:00
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
|
|
|
stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER;
|
|
|
|
|
2021-02-27 15:23:50 +01:00
|
|
|
DrawTextBasic(dpi, { textX, textY }, STR_FORWARD_TO_NEXT_STEP, {}, { textColour, TextAlignment::CENTRE });
|
|
|
|
DrawTextBasic(dpi, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::CENTRE });
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
2015-09-07 00:46:54 +02:00
|
|
|
}
|