Move top toolbar to UI module

This commit is contained in:
Marijn van der Werf 2017-11-11 02:57:45 +01:00
parent c247bbcb82
commit bd0bd9e038
9 changed files with 85 additions and 79 deletions

View File

@ -138,6 +138,7 @@
C606CD261DB5120C00FE4015 /* TestPaint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C606CD231DB5120900FE4015 /* TestPaint.cpp */; };
C612A8991D64825300B634CA /* vehicle_data.c in Sources */ = {isa = PBXBuildFile; fileRef = C612A8971D64825300B634CA /* vehicle_data.c */; };
C6136C551E21893500F3ED2B /* view_clipping.c in Sources */ = {isa = PBXBuildFile; fileRef = C6136C541E21893500F3ED2B /* view_clipping.c */; };
C61ADB1F1FB6A0A70024F2EF /* TopToolbar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C61ADB1E1FB6A0A60024F2EF /* TopToolbar.cpp */; };
C61FB2721FA3E25D0095FB9D /* ObjectLoadError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C61FB2701FA3E25C0095FB9D /* ObjectLoadError.cpp */; };
C61FB2731FA3E25D0095FB9D /* TextInput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C61FB2711FA3E25C0095FB9D /* TextInput.cpp */; };
C61FB7241CF86356004CE991 /* NetworkUser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C61FB7221CF86356004CE991 /* NetworkUser.cpp */; };
@ -211,7 +212,6 @@
C666EE3C1F33E3800061AA04 /* Scenery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EDA91F33E3520061AA04 /* Scenery.cpp */; };
C666EE451F33E3800061AA04 /* TileInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EDB21F33E3520061AA04 /* TileInspector.cpp */; };
C666EE4D1F33E3800061AA04 /* Tooltip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EDBA1F33E3520061AA04 /* Tooltip.cpp */; };
C666EE4E1F33E3800061AA04 /* TopToolbar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EDBB1F33E3520061AA04 /* TopToolbar.cpp */; };
C666EE6B1F37ACB10061AA04 /* About.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EE551F37ACB10061AA04 /* About.cpp */; };
C666EE6C1F37ACB10061AA04 /* Changelog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EE561F37ACB10061AA04 /* Changelog.cpp */; };
C666EE6D1F37ACB10061AA04 /* Cheats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C666EE571F37ACB10061AA04 /* Cheats.cpp */; };
@ -761,6 +761,7 @@
C606CD241DB5120900FE4015 /* TestPaint.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TestPaint.hpp; sourceTree = "<group>"; };
C612A8971D64825300B634CA /* vehicle_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vehicle_data.c; sourceTree = "<group>"; };
C6136C541E21893500F3ED2B /* view_clipping.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = view_clipping.c; sourceTree = "<group>"; };
C61ADB1E1FB6A0A60024F2EF /* TopToolbar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TopToolbar.cpp; sourceTree = "<group>"; };
C61FB2701FA3E25C0095FB9D /* ObjectLoadError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectLoadError.cpp; sourceTree = "<group>"; };
C61FB2711FA3E25C0095FB9D /* TextInput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextInput.cpp; sourceTree = "<group>"; };
C61FB7221CF86356004CE991 /* NetworkUser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkUser.cpp; sourceTree = "<group>"; usesTabs = 0; };
@ -824,7 +825,6 @@
C666EDA91F33E3520061AA04 /* Scenery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Scenery.cpp; sourceTree = "<group>"; };
C666EDB21F33E3520061AA04 /* TileInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TileInspector.cpp; sourceTree = "<group>"; };
C666EDBA1F33E3520061AA04 /* Tooltip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tooltip.cpp; sourceTree = "<group>"; };
C666EDBB1F33E3520061AA04 /* TopToolbar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TopToolbar.cpp; sourceTree = "<group>"; };
C666EE551F37ACB10061AA04 /* About.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = About.cpp; sourceTree = "<group>"; };
C666EE561F37ACB10061AA04 /* Changelog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Changelog.cpp; sourceTree = "<group>"; };
C666EE571F37ACB10061AA04 /* Cheats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cheats.cpp; sourceTree = "<group>"; };
@ -2530,7 +2530,6 @@
C666EDB21F33E3520061AA04 /* TileInspector.cpp */,
C666EDBA1F33E3520061AA04 /* Tooltip.cpp */,
F76C85531EC4E7CD00FA49E2 /* tooltip.h */,
C666EDBB1F33E3520061AA04 /* TopToolbar.cpp */,
);
path = windows;
sourceTree = "<group>";
@ -2736,6 +2735,7 @@
C666EE671F37ACB10061AA04 /* TitleMenu.cpp */,
C666EE681F37ACB10061AA04 /* TitleOptions.cpp */,
C654DF2A1F69C0430040F43D /* TitleScenarioSelect.cpp */,
C61ADB1E1FB6A0A60024F2EF /* TopToolbar.cpp */,
C654DF2B1F69C0430040F43D /* TrackDesignManage.cpp */,
C654DF2C1F69C0430040F43D /* TrackDesignPlace.cpp */,
C6D2BEE31F9BAACC008B557C /* TrackList.cpp */,
@ -3165,6 +3165,7 @@
4C93F1BA1F8E185600A9330D /* Award.cpp in Sources */,
F76C887A1EC5324E00FA49E2 /* AudioMixer.cpp in Sources */,
4CFE4E811F90A3F1005243C2 /* PeepData.cpp in Sources */,
C61ADB1F1FB6A0A70024F2EF /* TopToolbar.cpp in Sources */,
4C93F1431F8B744400A9330D /* InvertedImpulseCoaster.cpp in Sources */,
4C93F1481F8B744400A9330D /* LoopingRollerCoaster.cpp in Sources */,
4C93F1551F8B744400A9330D /* VerticalDropRollerCoaster.cpp in Sources */,
@ -3472,7 +3473,6 @@
F76C86C11EC4E88400FA49E2 /* interop.c in Sources */,
F76C86C31EC4E88400FA49E2 /* S6Exporter.cpp in Sources */,
F76C86C51EC4E88400FA49E2 /* S6Importer.cpp in Sources */,
C666EE4E1F33E3800061AA04 /* TopToolbar.cpp in Sources */,
C666EE3C1F33E3800061AA04 /* Scenery.cpp in Sources */,
C6352B921F477032006CCEE3 /* GameActionCompat.cpp in Sources */,
F76C86FC1EC4E88400FA49E2 /* ride.c in Sources */,

View File

@ -111,6 +111,8 @@ public:
return window_title_menu_open();
case WC_TITLE_OPTIONS:
return window_title_options_open();
case WC_TOP_TOOLBAR:
return window_top_toolbar_open();
case WC_VIEW_CLIPPING:
return window_view_clipping_open();
case WC_VIEWPORT:

View File

@ -258,12 +258,12 @@ static void shortcut_remove_top_bottom_toolbar_toggle()
{
if (gScreenFlags == 0)
{
window_top_toolbar_open();
context_open_window(WC_TOP_TOOLBAR);
window_game_bottom_toolbar_open();
}
else
{
window_top_toolbar_open();
context_open_window(WC_TOP_TOOLBAR);
window_editor_bottom_toolbar_open();
}
}

View File

@ -14,32 +14,33 @@
*****************************************************************************/
#pragma endregion
#include <openrct2-ui/windows/Window.h>
#include <string>
#include "../config/Config.h"
#include "../Context.h"
#include "../OpenRCT2.h"
#include "../ParkImporter.h"
#include "../network/network.h"
#include "../core/Util.hpp"
#include "../core/Math.hpp"
#include "../interface/Screenshot.h"
#include "../audio/audio.h"
#include "../cheats.h"
#include "../Editor.h"
#include "../input.h"
#include "../interface/console.h"
#include "../interface/land_tool.h"
#include "../interface/viewport.h"
#include "../interface/widget.h"
#include "../network/twitch.h"
#include "../peep/Staff.h"
#include "../util/util.h"
#include "../windows/Intent.h"
#include "../world/footpath.h"
#include "../world/scenery.h"
#include "dropdown.h"
#include <openrct2/audio/audio.h>
#include <openrct2/cheats.h>
#include <openrct2/config/Config.h>
#include <openrct2/Context.h>
#include <openrct2/core/Math.hpp>
#include <openrct2/core/Util.hpp>
#include <openrct2/Editor.h>
#include <openrct2/input.h>
#include <openrct2/interface/console.h>
#include <openrct2/interface/land_tool.h>
#include <openrct2/interface/Screenshot.h>
#include <openrct2/interface/viewport.h>
#include <openrct2/interface/widget.h>
#include <openrct2/network/network.h>
#include <openrct2/network/twitch.h>
#include <openrct2/OpenRCT2.h>
#include <openrct2/ParkImporter.h>
#include <openrct2/peep/Staff.h>
#include <openrct2/util/util.h>
#include <openrct2/windows/dropdown.h>
#include <openrct2/windows/Intent.h>
#include <openrct2/world/footpath.h>
#include <openrct2/world/scenery.h>
enum {
WIDX_PAUSE,
@ -279,8 +280,8 @@ static void toggle_land_window(rct_window *topToolbar, rct_widgetindex widgetInd
static void toggle_clear_scenery_window(rct_window *topToolbar, rct_widgetindex widgetIndex);
static void toggle_water_window(rct_window *topToolbar, rct_widgetindex widgetIndex);
money32 selection_lower_land(uint8 flags);
money32 selection_raise_land(uint8 flags);
static money32 selection_lower_land(uint8 flags);
static money32 selection_raise_land(uint8 flags);
static bool _menuDropdownIncludesTwitch;
static uint8 _unkF64F0E;
@ -291,7 +292,7 @@ static uint16 _unkF64F15;
* Creates the main game top toolbar window.
* rct2: 0x0066B485 (part of 0x0066B3E8)
*/
void window_top_toolbar_open()
rct_window * window_top_toolbar_open()
{
rct_window * window = window_create(
0, 0,
@ -303,6 +304,8 @@ void window_top_toolbar_open()
window->widgets = window_top_toolbar_widgets;
window_init_scroll_widgets(window);
return window;
}
/**
@ -1519,15 +1522,6 @@ static void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid
}
}
void game_command_callback_place_banner(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
{
if (ebx != MONEY32_UNDEFINED) {
sint32 bannerId = edi;
audio_play_sound_at_location(SOUND_PLACE_ITEM, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z);
context_open_detail_window(WD_BANNER, bannerId);
}
}
/**
*
* rct2: 0x006E2CC6
@ -2695,7 +2689,7 @@ static void window_top_toolbar_tool_down(rct_window* w, rct_widgetindex widgetIn
*
* rct2: 0x006644DD
*/
money32 selection_raise_land(uint8 flags)
static money32 selection_raise_land(uint8 flags)
{
sint32 centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2;
sint32 centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2;
@ -2717,7 +2711,7 @@ money32 selection_raise_land(uint8 flags)
*
* rct2: 0x006645B3
*/
money32 selection_lower_land(uint8 flags)
static money32 selection_lower_land(uint8 flags)
{
sint32 centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2;
sint32 centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2;
@ -2941,7 +2935,7 @@ static void window_top_toolbar_tool_abort(rct_window *w, rct_widgetindex widgetI
}
}
void top_toolbar_init_fastforward_menu(rct_window* w, rct_widget* widget) {
static void top_toolbar_init_fastforward_menu(rct_window* w, rct_widget* widget) {
sint32 num_items = 4;
gDropdownItemsFormat[0] = STR_TOGGLE_OPTION;
gDropdownItemsFormat[1] = STR_TOGGLE_OPTION;
@ -2987,7 +2981,7 @@ void top_toolbar_init_fastforward_menu(rct_window* w, rct_widget* widget) {
}
}
void top_toolbar_fastforward_menu_dropdown(sint16 dropdownIndex)
static void top_toolbar_fastforward_menu_dropdown(sint16 dropdownIndex)
{
rct_window* w = window_get_main();
if (w) {
@ -3000,7 +2994,7 @@ void top_toolbar_fastforward_menu_dropdown(sint16 dropdownIndex)
}
}
void top_toolbar_init_rotate_menu(rct_window* w, rct_widget* widget)
static void top_toolbar_init_rotate_menu(rct_window* w, rct_widget* widget)
{
gDropdownItemsFormat[0] = STR_ROTATE_CLOCKWISE;
gDropdownItemsFormat[1] = STR_ROTATE_ANTI_CLOCKWISE;
@ -3017,7 +3011,7 @@ void top_toolbar_init_rotate_menu(rct_window* w, rct_widget* widget)
gDropdownDefaultIndex = DDIDX_ROTATE_CLOCKWISE;
}
void top_toolbar_rotate_menu_dropdown(sint16 dropdownIndex)
static void top_toolbar_rotate_menu_dropdown(sint16 dropdownIndex)
{
rct_window* w = window_get_main();
if (w) {
@ -3032,7 +3026,7 @@ void top_toolbar_rotate_menu_dropdown(sint16 dropdownIndex)
}
}
void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget)
static void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget)
{
gDropdownItemsFormat[DDIDX_CONSOLE] = STR_TOGGLE_OPTION;
gDropdownItemsArgs[DDIDX_CONSOLE] = STR_DEBUG_DROPDOWN_CONSOLE;
@ -3066,7 +3060,7 @@ void top_toolbar_init_debug_menu(rct_window* w, rct_widget* widget)
gDropdownDefaultIndex = DDIDX_CONSOLE;
}
void top_toolbar_init_network_menu(rct_window* w, rct_widget* widget)
static void top_toolbar_init_network_menu(rct_window* w, rct_widget* widget)
{
gDropdownItemsFormat[0] = STR_MULTIPLAYER;
@ -3082,7 +3076,7 @@ void top_toolbar_init_network_menu(rct_window* w, rct_widget* widget)
gDropdownDefaultIndex = DDIDX_MULTIPLAYER;
}
void top_toolbar_debug_menu_dropdown(sint16 dropdownIndex)
static void top_toolbar_debug_menu_dropdown(sint16 dropdownIndex)
{
rct_window* w = window_get_main();
if (w) {
@ -3114,7 +3108,7 @@ void top_toolbar_debug_menu_dropdown(sint16 dropdownIndex)
}
}
void top_toolbar_network_menu_dropdown(sint16 dropdownIndex)
static void top_toolbar_network_menu_dropdown(sint16 dropdownIndex)
{
rct_window* w = window_get_main();
if (w) {
@ -3130,7 +3124,7 @@ void top_toolbar_network_menu_dropdown(sint16 dropdownIndex)
*
* rct2: 0x0066CDE4
*/
void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) {
static void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) {
gDropdownItemsFormat[0] = STR_TOGGLE_OPTION;
gDropdownItemsFormat[1] = STR_TOGGLE_OPTION;
gDropdownItemsFormat[2] = STR_TOGGLE_OPTION;
@ -3203,7 +3197,7 @@ void top_toolbar_init_view_menu(rct_window* w, rct_widget* widget) {
*
* rct2: 0x0066CF8A
*/
void top_toolbar_view_menu_dropdown(sint16 dropdownIndex)
static void top_toolbar_view_menu_dropdown(sint16 dropdownIndex)
{
rct_window* w = window_get_main();
if (w) {
@ -3260,7 +3254,7 @@ void top_toolbar_view_menu_dropdown(sint16 dropdownIndex)
*
* rct2: 0x0066CCE7
*/
void toggle_footpath_window()
static void toggle_footpath_window()
{
if (window_find_by_class(WC_FOOTPATH) == nullptr) {
context_open_window(WC_FOOTPATH);
@ -3274,7 +3268,7 @@ void toggle_footpath_window()
*
* rct2: 0x0066CD54
*/
void toggle_land_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
static void toggle_land_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
{
if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_TOP_TOOLBAR && gCurrentToolWidget.widget_index == WIDX_LAND) {
tool_cancel();
@ -3290,7 +3284,7 @@ void toggle_land_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
*
* rct2: 0x0066CD0C
*/
void toggle_clear_scenery_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
static void toggle_clear_scenery_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
{
if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE) && gCurrentToolWidget.window_classification == WC_TOP_TOOLBAR && gCurrentToolWidget.widget_index == WIDX_CLEAR_SCENERY)) {
tool_cancel();
@ -3306,7 +3300,7 @@ void toggle_clear_scenery_window(rct_window *topToolbar, rct_widgetindex widgetI
*
* rct2: 0x0066CD9C
*/
void toggle_water_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
static void toggle_water_window(rct_window *topToolbar, rct_widgetindex widgetIndex)
{
if ((input_test_flag(INPUT_FLAG_TOOL_ACTIVE)) && gCurrentToolWidget.window_classification == WC_TOP_TOOLBAR && gCurrentToolWidget.widget_index == WIDX_WATER) {
tool_cancel();
@ -3348,21 +3342,6 @@ bool clear_scenery_tool_is_active()
return true;
}
/**
*
* rct2: 0x0066DB3D
*/
bool scenery_tool_is_active()
{
sint32 toolWindowClassification = gCurrentToolWidget.window_classification;
rct_widgetindex toolWidgetIndex = gCurrentToolWidget.widget_index;
if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
if (toolWindowClassification == WC_TOP_TOOLBAR && toolWidgetIndex == WIDX_SCENERY)
return true;
return false;
}
/**
*
* rct2: 0x0066D125

View File

@ -136,3 +136,7 @@ rct_window * window_ride_construction_open();
void window_ride_construction_update_active_elements_impl();
void window_ride_construction_update_enabled_track_pieces();
rct_window * window_top_toolbar_open();
bool land_tool_is_active();
bool clear_scenery_tool_is_active();
bool water_tool_is_active();

View File

@ -145,7 +145,7 @@ void game_reduce_game_speed()
void game_create_windows()
{
context_open_window(WC_MAIN_WINDOW);
window_top_toolbar_open();
context_open_window(WC_TOP_TOOLBAR);
window_game_bottom_toolbar_open();
window_resize_gui(context_get_width(), context_get_height());
}

View File

@ -713,7 +713,6 @@ void window_update_viewport_ride_music();
void window_relocate_windows(sint32 width, sint32 height);
void window_resize_gui(sint32 width, sint32 height);
void window_resize_gui_scenario_editor(sint32 width, sint32 height);
void window_top_toolbar_open();
void window_game_bottom_toolbar_open();
void window_game_bottom_toolbar_invalidate_news_item();
void window_ride_construct(rct_window *w);
@ -780,9 +779,6 @@ void window_update_textbox();
bool window_is_visible(rct_window* w);
bool land_tool_is_active();
bool water_tool_is_active();
bool clear_scenery_tool_is_active();
bool scenery_tool_is_active();
//Cheat: in-game land ownership editor

View File

@ -80,7 +80,7 @@ rct_window * window_editor_main_open()
gShowConstuctionRightsRefCount = 0;
gFootpathSelectedType = 0;
window_top_toolbar_open();
context_open_window(WC_TOP_TOOLBAR);
window_editor_bottom_toolbar_open();
return window_get_main();

View File

@ -565,3 +565,28 @@ void window_ride_construction_update_active_elements()
context_broadcast_intent(intent);
intent_release(intent);
}
void game_command_callback_place_banner(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
{
if (ebx != MONEY32_UNDEFINED) {
sint32 bannerId = edi;
audio_play_sound_at_location(SOUND_PLACE_ITEM, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z);
context_open_detail_window(WD_BANNER, bannerId);
}
}
/**
*
* rct2: 0x0066DB3D
*/
bool scenery_tool_is_active()
{
sint32 toolWindowClassification = gCurrentToolWidget.window_classification;
rct_widgetindex toolWidgetIndex = gCurrentToolWidget.widget_index;
if (input_test_flag(INPUT_FLAG_TOOL_ACTIVE))
if (toolWindowClassification == WC_TOP_TOOLBAR && toolWidgetIndex == WC_TOP_TOOLBAR__WIDX_SCENERY)
return true;
return false;
}