1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 15:24:30 +01:00

Move new ride and research windows

This commit is contained in:
Marijn van der Werf
2017-10-07 01:28:00 +02:00
committed by Michał Janiszewski
parent eef3bd9af5
commit d02976695d
16 changed files with 116 additions and 63 deletions

View File

@@ -17,6 +17,7 @@
#include <openrct2/ui/WindowManager.h>
#include <openrct2-ui/windows/Window.h>
#include <openrct2/core/Console.hpp>
#include <openrct2/config/Config.h>
#include "input/input.h"
#include "input/KeyboardShortcuts.h"
#include "WindowManager.h"
@@ -29,11 +30,13 @@ public:
void Init() override
{
window_guest_list_init_vars();
window_new_ride_init_vars();
}
rct_window * OpenWindow(rct_windowclass wc) override
{
switch (wc) {
switch (wc)
{
case WC_ABOUT:
return window_about_open();
case WC_CHANGELOG:
@@ -72,10 +75,14 @@ public:
return window_multiplayer_open();
case WC_MUSIC_CREDITS:
return window_music_credits_open();
case WC_CONSTRUCT_RIDE:
return window_new_ride_open();
case WC_PARK_INFORMATION:
return window_park_entrance_open();
case WC_RECENT_NEWS:
return window_news_open();
case WC_RESEARCH:
return window_research_open();
case WC_NOTIFICATION_OPTIONS:
return window_news_options_open();
case WC_OPTIONS:
@@ -114,7 +121,8 @@ public:
rct_window * OpenView(uint8 view) override
{
switch (view) {
switch (view)
{
case WV_PARK_AWARDS:
return window_park_awards_open();
case WV_PARK_RATING:
@@ -125,6 +133,15 @@ public:
return window_park_guests_open();
case WV_FINANCES_RESEARCH:
return window_finances_research_open();
case WV_RIDE_RESEARCH:
if (gConfigInterface.toolbar_show_research)
{
return this->OpenWindow(WC_RESEARCH);
}
else
{
return window_new_ride_open_research();
}
default:
return nullptr;
}
@@ -160,7 +177,8 @@ public:
rct_window * OpenIntent(Intent * intent) override
{
switch(intent->GetWindowClass()) {
switch (intent->GetWindowClass())
{
case WC_PEEP:
return window_guest_open((rct_peep*)intent->GetPointerExtra(INTENT_EXTRA_PEEP));
case WC_FIRE_PROMPT:
@@ -185,6 +203,20 @@ public:
return window_track_place_open((track_design_file_ref *) intent->GetPointerExtra(INTENT_EXTRA_TRACK_DESIGN));
case WC_SCENARIO_SELECT:
return window_scenarioselect_open((scenarioselect_callback) intent->GetPointerExtra(INTENT_EXTRA_CALLBACK));
case INTENT_ACTION_NEW_RIDE_OF_TYPE:
{
// Open ride list window
auto w = window_new_ride_open();
// Switch to right tab and scroll to ride location
ride_list_item rideItem;
rideItem.type = intent->GetUIntExtra(INTENT_EXTRA_RIDE_TYPE);
rideItem.entry_index = intent->GetUIntExtra(INTENT_EXTRA_RIDE_ENTRY_INDEX);
window_new_ride_focus(rideItem);
return w;
}
break;
default:
Console::Error::WriteLine("Unhandled window class for intent (%d)", intent->GetWindowClass());
return nullptr;
@@ -193,10 +225,15 @@ public:
void BroadcastIntent(Intent * intent) override
{
switch (intent->GetWindowClass()) {
switch (intent->GetWindowClass())
{
case INTENT_ACTION_MAP:
window_map_reset();
break;
case INTENT_ACTION_REFRESH_NEW_RIDES:
window_new_ride_init_vars();
break;
}
}

View File

@@ -373,7 +373,7 @@ static void shortcut_build_new_ride()
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)) {
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
window_new_ride_open();
context_open_window(WC_CONSTRUCT_RIDE);
}
}
}
@@ -394,10 +394,7 @@ static void shortcut_show_research_information()
return;
if (!(gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))) {
if (gConfigInterface.toolbar_show_research)
window_research_open();
else
window_new_ride_open_research();
context_open_window_view(WV_RIDE_RESEARCH);
}
}

View File

@@ -14,25 +14,26 @@
*****************************************************************************/
#pragma endregion
#include "../config/Config.h"
#include "../network/network.h"
#include "../OpenRCT2.h"
#include "../ride/RideGroupManager.h"
#include "../ride/TrackDesignRepository.h"
#include "../core/Util.hpp"
#include "../core/Math.hpp"
#include "../Context.h"
#include <openrct2-ui/windows/Window.h>
#include "../audio/audio.h"
#include "../game.h"
#include "../interface/widget.h"
#include "../localisation/localisation.h"
#include "../management/news_item.h"
#include "../rct1.h"
#include "../ride/ride_data.h"
#include "../ride/track_data.h"
#include "../sprites.h"
#include "../util/util.h"
#include <openrct2/config/Config.h>
#include <openrct2/network/network.h>
#include <openrct2/OpenRCT2.h>
#include <openrct2/ride/RideGroupManager.h>
#include <openrct2/ride/TrackDesignRepository.h>
#include <openrct2/core/Util.hpp>
#include <openrct2/core/Math.hpp>
#include <openrct2/Context.h>
#include <openrct2/audio/audio.h>
#include <openrct2/game.h>
#include <openrct2/interface/widget.h>
#include <openrct2/localisation/localisation.h>
#include <openrct2/management/news_item.h>
#include <openrct2/rct1.h>
#include <openrct2/ride/ride_data.h>
#include <openrct2/ride/track_data.h>
#include <openrct2/sprites.h>
#include <openrct2/util/util.h>
static uint8 _windowNewRideCurrentTab;
static ride_list_item _windowNewRideHighlightedItem[6];

View File

@@ -14,13 +14,15 @@
*****************************************************************************/
#pragma endregion
#include "../game.h"
#include "../localisation/localisation.h"
#include "../interface/widget.h"
#include "../management/news_item.h"
#include "../sprites.h"
#include "../world/scenery.h"
#include "dropdown.h"
#include <openrct2-ui/windows/Window.h>
#include <openrct2/game.h>
#include <openrct2/localisation/localisation.h>
#include <openrct2/interface/widget.h>
#include <openrct2/management/news_item.h>
#include <openrct2/sprites.h>
#include <openrct2/world/scenery.h>
#include <openrct2/windows/dropdown.h>
enum {
WINDOW_RESEARCH_PAGE_DEVELOPMENT,
@@ -228,7 +230,7 @@ static void window_research_set_page(rct_window *w, sint32 page);
static void window_research_set_pressed_tab(rct_window *w);
static void window_research_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w);
void window_research_open()
rct_window * window_research_open()
{
rct_window *w;
@@ -257,6 +259,8 @@ void window_research_open()
w->pressed_widgets = 0;
w->disabled_widgets = 0;
window_init_scroll_widgets(w);
return w;
}
#pragma region Development page

View File

@@ -95,3 +95,12 @@ rct_window * window_track_manage_open(struct track_design_file_ref *tdFileRef);
rct_window * window_map_open();
void window_map_reset();
rct_window * window_research_open();
void window_research_development_page_paint(rct_window * w, rct_drawpixelinfo * dpi, rct_widgetindex baseWidgetIndex);
void window_research_funding_page_paint(rct_window * w, rct_drawpixelinfo * dpi, rct_widgetindex baseWidgetIndex);
rct_window * window_new_ride_open();
rct_window * window_new_ride_open_research();
void window_new_ride_init_vars();
void window_new_ride_focus(ride_list_item rideItem);

View File

@@ -469,7 +469,10 @@ namespace Editor
window_invalidate(w);
reset_all_sprite_quadrant_placements();
scenery_set_default_placement_configuration();
window_new_ride_init_vars();
auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES);
context_broadcast_intent(&intent);
gWindowUpdateTicks = 0;
load_palette();
window_tile_inspector_clear_clipboard();

View File

@@ -1191,7 +1191,11 @@ void game_load_init()
}
reset_all_sprite_quadrant_placements();
scenery_set_default_placement_configuration();
window_new_ride_init_vars();
Intent * intent = intent_create(INTENT_ACTION_REFRESH_NEW_RIDES);
context_broadcast_intent(intent);
intent_release(intent);
gWindowUpdateTicks = 0;
load_palette();
@@ -1477,7 +1481,6 @@ void game_init_all(sint32 mapSize)
gNextGuestNumber = 1;
context_init();
window_new_ride_init_vars();
scenery_set_default_placement_configuration();
window_tile_inspector_clear_clipboard();
load_palette();

View File

@@ -1148,7 +1148,10 @@ static sint32 cc_load_object(const utf8 **argv, sint32 argc) {
gSilentResearch = false;
}
scenery_set_default_placement_configuration();
window_new_ride_init_vars();
Intent * intent = intent_create(INTENT_ACTION_REFRESH_NEW_RIDES);
context_broadcast_intent(intent);
intent_release(intent);
gWindowUpdateTicks = 0;
gfx_invalidate_screen();

View File

@@ -499,7 +499,8 @@ enum {
WV_PARK_RATING,
WV_PARK_OBJECTIVE,
WV_PARK_GUESTS,
WV_FINANCES_RESEARCH
WV_FINANCES_RESEARCH,
WV_RIDE_RESEARCH,
};
@@ -725,16 +726,10 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY);
void window_maze_construction_update_pressed_widgets();
rct_window *window_new_ride_open();
rct_window *window_new_ride_open_research();
void window_network_status_open(const char* text, close_callback onClose);
void window_network_status_close();
void window_network_status_open_password();
void window_research_open();
void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dpi, rct_widgetindex baseWidgetIndex);
void window_research_funding_page_paint(rct_window *w, rct_drawpixelinfo *dpi, rct_widgetindex baseWidgetIndex);
void window_scenery_open();
void window_tile_inspector_open();
void window_tile_inspector_clear_clipboard();
@@ -751,9 +746,6 @@ void window_bubble_list_item(rct_window* w, sint32 item_position);
void window_align_tabs( rct_window *w, rct_widgetindex start_tab_id, rct_widgetindex end_tab_id );
void window_new_ride_init_vars();
void window_new_ride_focus(ride_list_item rideItem);
void window_map_tooltip_update_visibility();
void window_staff_list_init_vars();

View File

@@ -345,14 +345,11 @@ void news_item_open_subject(sint32 type, sint32 subject)
break;
case NEWS_ITEM_RESEARCH:
if (subject >= RESEARCH_ENTRY_RIDE_MASK) {
// Open ride list window
window_new_ride_open();
// Switch to right tab and scroll to ride location
ride_list_item rideItem;
rideItem.type = subject >> 8;
rideItem.entry_index = subject & 0xFF;
window_new_ride_focus(rideItem);
Intent * intent = intent_create(INTENT_ACTION_NEW_RIDE_OF_TYPE);
intent_set_sint(intent, INTENT_EXTRA_RIDE_TYPE, subject >> 8);
intent_set_sint(intent, INTENT_EXTRA_RIDE_ENTRY_INDEX, subject & 0xFF);
context_open_intent(intent);
intent_release(intent);
break;
}

View File

@@ -430,7 +430,8 @@ private:
window_invalidate(w);
reset_sprite_spatial_index();
reset_all_sprite_quadrant_placements();
window_new_ride_init_vars();
auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES);
context_broadcast_intent(&intent);
scenery_set_default_placement_configuration();
news_item_init_queue();
load_palette();

View File

@@ -222,7 +222,7 @@ void window_editor_bottom_toolbar_jump_forward_from_object_selection()
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) {
reset_researched_ride_types_and_entries();
window_new_ride_open();
context_open_window(WC_CONSTRUCT_RIDE);
gS6Info.editor_step = EDITOR_STEP_ROLLERCOASTER_DESIGNER;
gfx_invalidate_screen();
} else {

View File

@@ -729,7 +729,9 @@ static void window_editor_object_selection_close(rct_window *w)
gSilentResearch = false;
}
research_remove_non_separate_vehicle_types();
window_new_ride_init_vars();
auto intent = Intent(INTENT_ACTION_REFRESH_NEW_RIDES);
context_broadcast_intent(&intent);
visible_list_dispose();
}

View File

@@ -58,10 +58,14 @@ extern "C" {
INTENT_EXTRA_LOADSAVE_TYPE,
INTENT_EXTRA_CALLBACK,
INTENT_EXTRA_TRACK_DESIGN,
INTENT_EXTRA_RIDE_TYPE,
INTENT_EXTRA_RIDE_ENTRY_INDEX,
};
enum {
INTENT_ACTION_MAP,
INTENT_ACTION_NEW_RIDE_OF_TYPE,
INTENT_ACTION_REFRESH_NEW_RIDES,
};
Intent *intent_create(rct_windowclass clss);

View File

@@ -343,7 +343,7 @@ static void window_top_toolbar_mouseup(rct_window *w, rct_widgetindex widgetInde
toggle_footpath_window();
break;
case WIDX_CONSTRUCT_RIDE:
window_new_ride_open();
context_open_window(WC_CONSTRUCT_RIDE);
break;
case WIDX_RIDES:
window_ride_list_open();
@@ -361,7 +361,7 @@ static void window_top_toolbar_mouseup(rct_window *w, rct_widgetindex widgetInde
context_open_window(WC_FINANCES);
break;
case WIDX_RESEARCH:
window_research_open();
context_open_window(WC_RESEARCH);
break;
case WIDX_NEWS:
context_open_window(WC_RECENT_NEWS);

View File

@@ -268,7 +268,7 @@ static void window_track_list_mouseup(rct_window *w, rct_widgetindex widgetIndex
case WIDX_BACK:
window_close(w);
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) {
window_new_ride_open();
context_open_window(WC_CONSTRUCT_RIDE);
}
break;
}