mirror of https://github.com/OpenRCT2/OpenRCT2.git
Move map window
This commit is contained in:
parent
f98a240c5a
commit
8569a7fe2f
|
@ -64,6 +64,8 @@ public:
|
|||
return window_land_rights_open();
|
||||
case WC_MAIN_WINDOW:
|
||||
return window_main_open();
|
||||
case WC_MAP:
|
||||
return window_map_open();
|
||||
case WC_MAPGEN:
|
||||
return window_mapgen_open();
|
||||
case WC_MULTIPLAYER:
|
||||
|
@ -187,6 +189,15 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void BroadcastIntent(Intent * intent) override
|
||||
{
|
||||
switch (intent->GetWindowClass()) {
|
||||
case INTENT_ACTION_MAP:
|
||||
window_map_reset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleKeyboard(bool isTitle) override
|
||||
{
|
||||
input_handle_keyboard(isTitle);
|
||||
|
|
|
@ -457,7 +457,7 @@ static void shortcut_show_map()
|
|||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gS6Info.editor_step == EDITOR_STEP_LANDSCAPE_EDITOR)
|
||||
if (!(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)))
|
||||
window_map_open();
|
||||
context_open_window(WC_MAP);
|
||||
}
|
||||
|
||||
static void shortcut_screenshot()
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <openrct2/localisation/localisation.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/windows/dropdown.h>
|
||||
#include <openrct2/Context.h>
|
||||
|
||||
enum {
|
||||
PAGE_INDIVIDUAL,
|
||||
|
@ -298,7 +299,7 @@ static void window_guest_list_mouseup(rct_window *w, rct_widgetindex widgetIndex
|
|||
window_close(w);
|
||||
break;
|
||||
case WIDX_MAP:
|
||||
window_map_open();
|
||||
context_open_window(WC_MAP);
|
||||
break;
|
||||
case WIDX_TRACKING:
|
||||
_window_guest_list_tracking_only = !_window_guest_list_tracking_only;
|
||||
|
|
|
@ -14,23 +14,24 @@
|
|||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../core/Math.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
#include "../core/Memory.hpp"
|
||||
#include "../Context.h"
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/core/Math.hpp>
|
||||
#include <openrct2/core/Util.hpp>
|
||||
#include <openrct2/core/Memory.hpp>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/audio/audio.h>
|
||||
#include <openrct2/cheats.h>
|
||||
#include <openrct2/game.h>
|
||||
#include <openrct2/input.h>
|
||||
#include <openrct2/interface/land_tool.h>
|
||||
#include <openrct2/interface/viewport.h>
|
||||
#include <openrct2/interface/widget.h>
|
||||
#include <openrct2/localisation/localisation.h>
|
||||
#include <openrct2/world/entrance.h>
|
||||
#include <openrct2/world/footpath.h>
|
||||
#include <openrct2/world/scenery.h>
|
||||
|
||||
#include "../audio/audio.h"
|
||||
#include "../cheats.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/land_tool.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../world/entrance.h"
|
||||
#include "../world/footpath.h"
|
||||
#include "../world/scenery.h"
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
|
||||
#define MAP_COLOUR_2(colourA, colourB) ((colourA << 8) | colourB)
|
||||
#define MAP_COLOUR(colour) MAP_COLOUR_2(colour, colour)
|
||||
|
@ -203,7 +204,7 @@ static void map_window_screen_to_map(sint32 screenX, sint32 screenY, sint32 *map
|
|||
*
|
||||
* rct2: 0x0068C88A
|
||||
*/
|
||||
void window_map_open()
|
||||
rct_window * window_map_open()
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
|
@ -212,12 +213,12 @@ void window_map_open()
|
|||
if (w != nullptr) {
|
||||
w->selected_tab = 0;
|
||||
w->list_information_type = 0;
|
||||
return;
|
||||
return w;
|
||||
}
|
||||
|
||||
_mapImageData = Memory::Allocate<uint8[MAP_WINDOW_MAP_SIZE][MAP_WINDOW_MAP_SIZE]>();
|
||||
if (_mapImageData == nullptr) {
|
||||
return;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
w = window_create_auto_pos(245, 259, &window_map_events, WC_MAP, WF_10);
|
||||
|
@ -258,6 +259,8 @@ void window_map_open()
|
|||
|
||||
// Reset land tool size
|
||||
gLandToolSize = 1;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
void window_map_reset()
|
|
@ -229,7 +229,7 @@ static void window_staff_list_mouseup(rct_window *w, rct_widgetindex widgetIndex
|
|||
}
|
||||
break;
|
||||
case WIDX_STAFF_LIST_MAP:
|
||||
window_map_open();
|
||||
context_open_window(WC_MAP);
|
||||
break;
|
||||
case WIDX_STAFF_LIST_QUICK_FIRE:
|
||||
_quick_fire_mode ^= 1;
|
||||
|
|
|
@ -90,3 +90,6 @@ rct_window * window_loadsave_open(sint32 type, const char *defaultName);
|
|||
void window_loadsave_set_loadsave_callback(loadsave_callback cb);
|
||||
rct_window * window_track_place_open(const struct track_design_file_ref *tdFileRef);
|
||||
rct_window * window_track_manage_open(struct track_design_file_ref *tdFileRef);
|
||||
|
||||
rct_window * window_map_open();
|
||||
void window_map_reset();
|
||||
|
|
|
@ -1016,6 +1016,12 @@ extern "C"
|
|||
return windowManager->OpenIntent(intent);
|
||||
}
|
||||
|
||||
void context_broadcast_intent(Intent * intent)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
windowManager->BroadcastIntent(intent);
|
||||
}
|
||||
|
||||
rct_window * context_show_error(rct_string_id title, rct_string_id message)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
|
|
|
@ -206,6 +206,7 @@ extern "C"
|
|||
rct_window * context_open_window_view(uint8 view);
|
||||
rct_window * context_show_error(rct_string_id title, rct_string_id message);
|
||||
rct_window * context_open_intent(Intent * intent);
|
||||
void context_broadcast_intent(Intent * intent);
|
||||
void context_input_handle_keyboard(bool isTitle);
|
||||
bool context_read_bmp(void * * outPixels, uint32 * outWidth, uint32 * outHeight, const utf8 * path);
|
||||
void context_quit();
|
||||
|
|
|
@ -708,7 +708,6 @@ void window_top_toolbar_open();
|
|||
void window_game_bottom_toolbar_open();
|
||||
void window_game_bottom_toolbar_invalidate_news_item();
|
||||
void window_track_list_open(ride_list_item item);
|
||||
void window_map_open();
|
||||
void window_guest_open(rct_peep* peep);
|
||||
rct_window *window_staff_open(rct_peep* peep);
|
||||
rct_window *window_ride_main_open(sint32 rideIndex);
|
||||
|
@ -755,7 +754,6 @@ void window_align_tabs( rct_window *w, rct_widgetindex start_tab_id, rct_widgeti
|
|||
void window_new_ride_init_vars();
|
||||
void window_new_ride_focus(ride_list_item rideItem);
|
||||
|
||||
void window_map_reset();
|
||||
void window_map_tooltip_update_visibility();
|
||||
|
||||
void window_staff_list_init_vars();
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace OpenRCT2 { namespace Ui
|
|||
rct_window * OpenDetails(uint8 type, sint32 id) override { return nullptr; }
|
||||
rct_window * ShowError(rct_string_id title, rct_string_id message) override { return nullptr; }
|
||||
rct_window * OpenIntent(Intent * intent) override { return nullptr; };
|
||||
void BroadcastIntent(Intent * intent) override { }
|
||||
void HandleKeyboard(bool isTitle) override { }
|
||||
std::string GetKeyboardShortcutString(sint32 shortcut) override { return std::string(); }
|
||||
};
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace OpenRCT2
|
|||
virtual rct_window * OpenView(uint8 view) abstract;
|
||||
virtual rct_window * OpenDetails(uint8 type, sint32 id) abstract;
|
||||
virtual rct_window * OpenIntent(Intent * intent) abstract;
|
||||
virtual void BroadcastIntent(Intent * intent) abstract;
|
||||
virtual rct_window * ShowError(rct_string_id title, rct_string_id message) abstract;
|
||||
|
||||
virtual void HandleKeyboard(bool isTitle) abstract;
|
||||
|
|
|
@ -162,7 +162,7 @@ void window_editor_bottom_toolbar_jump_back_to_landscape_editor() {
|
|||
reset_researched_scenery_items();
|
||||
scenery_set_default_placement_configuration();
|
||||
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
|
||||
window_map_open();
|
||||
context_open_window(WC_MAP);
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ void window_editor_bottom_toolbar_jump_forward_from_object_selection()
|
|||
reset_researched_scenery_items();
|
||||
scenery_set_default_placement_configuration();
|
||||
gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR;
|
||||
window_map_open();
|
||||
context_open_window(WC_MAP);
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,10 @@ extern "C" {
|
|||
INTENT_EXTRA_TRACK_DESIGN,
|
||||
};
|
||||
|
||||
enum {
|
||||
INTENT_ACTION_MAP,
|
||||
};
|
||||
|
||||
Intent *intent_create(rct_windowclass clss);
|
||||
void intent_release(Intent * intent);
|
||||
void intent_set_string(Intent *, uint32 key, utf8string value);
|
||||
|
|
|
@ -617,7 +617,7 @@ static void window_top_toolbar_dropdown(rct_window *w, rct_widgetindex widgetInd
|
|||
case WIDX_MAP:
|
||||
switch (dropdownIndex) {
|
||||
case 0:
|
||||
window_map_open();
|
||||
context_open_window(WC_MAP);
|
||||
break;
|
||||
case 1:
|
||||
context_open_window(WC_VIEWPORT);
|
||||
|
|
|
@ -420,7 +420,10 @@ void map_init(sint32 size)
|
|||
map_update_tile_pointers();
|
||||
map_remove_out_of_range_elements();
|
||||
|
||||
window_map_reset();
|
||||
|
||||
Intent * intent = intent_create(INTENT_ACTION_MAP);
|
||||
context_broadcast_intent(intent);
|
||||
intent_release(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue