diff --git a/openrct2.vcxproj b/openrct2.vcxproj
index e30728329d..2dbd7bb69f 100644
--- a/openrct2.vcxproj
+++ b/openrct2.vcxproj
@@ -323,8 +323,8 @@
-
-
+
+
@@ -568,10 +568,10 @@
-
-
-
-
+
+
+
+
diff --git a/src/OpenRCT2.cpp b/src/OpenRCT2.cpp
index 4bbd748251..d9e194cc98 100644
--- a/src/OpenRCT2.cpp
+++ b/src/OpenRCT2.cpp
@@ -23,7 +23,7 @@
#include "platform/crash.h"
#include "PlatformEnvironment.h"
#include "ride/TrackDesignRepository.h"
-#include "ScenarioRepository.h"
+#include "scenario/ScenarioRepository.h"
#include "title/TitleScreen.h"
#include "title/TitleSequenceManager.h"
diff --git a/src/editor.c b/src/editor.c
index 0d4a3c0e52..a4d148fd96 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -31,7 +31,7 @@
#include "platform/platform.h"
#include "rct1.h"
#include "ride/ride.h"
-#include "scenario.h"
+#include "scenario/scenario.h"
#include "util/sawyercoding.h"
#include "util/util.h"
#include "world/banner.h"
diff --git a/src/game.c b/src/game.c
index 84562a1b4f..bf959d5dad 100644
--- a/src/game.c
+++ b/src/game.c
@@ -41,7 +41,7 @@
#include "ride/track.h"
#include "ride/track_design.h"
#include "ride/vehicle.h"
-#include "scenario.h"
+#include "scenario/scenario.h"
#include "title/TitleScreen.h"
#include "util/sawyercoding.h"
#include "util/util.h"
diff --git a/src/game.h b/src/game.h
index ab414155a3..d9da7e5fd3 100644
--- a/src/game.h
+++ b/src/game.h
@@ -20,7 +20,7 @@
#include "addresses.h"
#include "common.h"
#include "platform/platform.h"
-#include "scenario.h"
+#include "scenario/scenario.h"
enum GAME_COMMAND {
GAME_COMMAND_SET_RIDE_APPEARANCE,
diff --git a/src/input.c b/src/input.c
index bfcc0d5807..4546abe69b 100644
--- a/src/input.c
+++ b/src/input.c
@@ -29,7 +29,7 @@
#include "localisation/localisation.h"
#include "platform/platform.h"
#include "ride/ride_data.h"
-#include "scenario.h"
+#include "scenario/scenario.h"
#include "windows/tooltip.h"
#include "windows/dropdown.h"
#include "world/banner.h"
diff --git a/src/interface/viewport_interaction.c b/src/interface/viewport_interaction.c
index 6f8f8a857e..9666045293 100644
--- a/src/interface/viewport_interaction.c
+++ b/src/interface/viewport_interaction.c
@@ -22,7 +22,7 @@
#include "../ride/ride.h"
#include "../ride/ride_data.h"
#include "../ride/track.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../world/banner.h"
#include "../world/footpath.h"
#include "../world/map.h"
diff --git a/src/interface/window.h b/src/interface/window.h
index a8e2498dd8..af7532f70d 100644
--- a/src/interface/window.h
+++ b/src/interface/window.h
@@ -24,8 +24,8 @@
#include "../ride/ride.h"
#include "../ride/track_design.h"
#include "../ride/vehicle.h"
-#include "../scenario.h"
-#include "../ScenarioRepository.h"
+#include "../scenario/scenario.h"
+#include "../scenario/ScenarioRepository.h"
#include "../world/park.h"
#include "colour.h"
diff --git a/src/management/award.c b/src/management/award.c
index 5087bd2b86..b657e90a21 100644
--- a/src/management/award.c
+++ b/src/management/award.c
@@ -19,7 +19,7 @@
#include "../localisation/localisation.h"
#include "../peep/peep.h"
#include "../ride/ride.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../world/sprite.h"
#include "award.h"
#include "news_item.h"
diff --git a/src/management/research.c b/src/management/research.c
index c9c26d43a9..3e1e0eb1d0 100644
--- a/src/management/research.c
+++ b/src/management/research.c
@@ -21,7 +21,7 @@
#include "../localisation/localisation.h"
#include "../localisation/string_ids.h"
#include "../management/finance.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../rct1.h"
#include "../ride/ride.h"
#include "../ride/ride_data.h"
diff --git a/src/network/network.cpp b/src/network/network.cpp
index cd429b6f57..62a6f1a028 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -66,7 +66,7 @@ extern "C" {
#include "../localisation/localisation.h"
#include "../management/finance.h"
#include "../network/http.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../windows/error.h"
#include "../util/util.h"
#include "../cheats.h"
diff --git a/src/object/ObjectRepository.cpp b/src/object/ObjectRepository.cpp
index da02d6ab62..1e37cebc89 100644
--- a/src/object/ObjectRepository.cpp
+++ b/src/object/ObjectRepository.cpp
@@ -31,7 +31,7 @@
#include "../core/Stopwatch.hpp"
#include "../core/String.hpp"
#include "../PlatformEnvironment.h"
-#include "../ScenarioRepository.h"
+#include "../scenario/ScenarioRepository.h"
#include "Object.h"
#include "ObjectFactory.h"
#include "ObjectManager.h"
diff --git a/src/object/StexObject.h b/src/object/StexObject.h
index b4865d06c3..4fae232558 100644
--- a/src/object/StexObject.h
+++ b/src/object/StexObject.h
@@ -20,7 +20,7 @@
extern "C"
{
- #include "../scenario.h"
+ #include "../scenario/scenario.h"
}
class StexObject final : public Object
diff --git a/src/peep/peep.c b/src/peep/peep.c
index c748143882..0ff1759a68 100644
--- a/src/peep/peep.c
+++ b/src/peep/peep.c
@@ -31,7 +31,7 @@
#include "../ride/ride.h"
#include "../ride/ride_data.h"
#include "../ride/track.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../sprites.h"
#include "../util/util.h"
#include "../world/climate.h"
diff --git a/src/peep/staff.c b/src/peep/staff.c
index d8eac92e62..488ecfec58 100644
--- a/src/peep/staff.c
+++ b/src/peep/staff.c
@@ -16,7 +16,7 @@
#include "../config.h"
#include "../game.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../interface/viewport.h"
#include "../localisation/date.h"
#include "../localisation/string_ids.h"
diff --git a/src/platform/crash.cpp b/src/platform/crash.cpp
index fefa9d3dd2..54dba095ca 100644
--- a/src/platform/crash.cpp
+++ b/src/platform/crash.cpp
@@ -30,7 +30,7 @@
extern "C" {
#include "../localisation/language.h"
- #include "../scenario.h"
+ #include "../scenario/scenario.h"
#include "platform.h"
}
diff --git a/src/rct1/S4Importer.cpp b/src/rct1/S4Importer.cpp
index e417018b79..8dc9e65cd4 100644
--- a/src/rct1/S4Importer.cpp
+++ b/src/rct1/S4Importer.cpp
@@ -23,7 +23,7 @@
#include "../core/Path.hpp"
#include "../core/String.hpp"
#include "../core/Util.hpp"
-#include "../ScenarioSources.h"
+#include "../scenario/ScenarioSources.h"
#include "../object/ObjectManager.h"
#include "S4Importer.h"
#include "Tables.h"
diff --git a/src/rct2.c b/src/rct2.c
index 7cbc612bd0..9cf87346a4 100644
--- a/src/rct2.c
+++ b/src/rct2.c
@@ -43,7 +43,7 @@
#include "ride/track.h"
#include "ride/track_design.h"
#include "ride/TrackDesignRepository.h"
-#include "ScenarioRepository.h"
+#include "scenario/ScenarioRepository.h"
#include "title/TitleScreen.h"
#include "util/util.h"
#include "world/climate.h"
diff --git a/src/rct2/S6Exporter.cpp b/src/rct2/S6Exporter.cpp
index 4f0b39c343..becf3f70e7 100644
--- a/src/rct2/S6Exporter.cpp
+++ b/src/rct2/S6Exporter.cpp
@@ -39,7 +39,7 @@ extern "C"
#include "../rct2.h"
#include "../ride/ride.h"
#include "../ride/ride_ratings.h"
- #include "../scenario.h"
+ #include "../scenario/scenario.h"
#include "../util/sawyercoding.h"
#include "../util/util.h"
#include "../world/climate.h"
diff --git a/src/rct2/S6Exporter.h b/src/rct2/S6Exporter.h
index 96cba63b6e..f6807cfb75 100644
--- a/src/rct2/S6Exporter.h
+++ b/src/rct2/S6Exporter.h
@@ -23,7 +23,7 @@
extern "C"
{
- #include "../scenario.h"
+ #include "../scenario/scenario.h"
#include "../object_list.h"
}
diff --git a/src/rct2/S6Importer.cpp b/src/rct2/S6Importer.cpp
index 4e1f25e271..ff94a36652 100644
--- a/src/rct2/S6Importer.cpp
+++ b/src/rct2/S6Importer.cpp
@@ -35,7 +35,7 @@ extern "C"
#include "../rct2.h"
#include "../ride/ride.h"
#include "../ride/ride_ratings.h"
- #include "../scenario.h"
+ #include "../scenario/scenario.h"
#include "../util/sawyercoding.h"
#include "../world/climate.h"
#include "../world/map_animation.h"
diff --git a/src/rct2/S6Importer.h b/src/rct2/S6Importer.h
index d23ad1e0dd..65760b1a6c 100644
--- a/src/rct2/S6Importer.h
+++ b/src/rct2/S6Importer.h
@@ -20,7 +20,7 @@
extern "C"
{
- #include "../scenario.h"
+ #include "../scenario/scenario.h"
}
/**
diff --git a/src/ride/ride.c b/src/ride/ride.c
index af29509ab2..5c1d87ab90 100644
--- a/src/ride/ride.c
+++ b/src/ride/ride.c
@@ -34,7 +34,7 @@
#include "../peep/peep.h"
#include "../peep/staff.h"
#include "../rct1.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../util/util.h"
#include "../windows/error.h"
#include "../world/banner.h"
diff --git a/src/ride/station.c b/src/ride/station.c
index 96a1da1d46..2ca6ee084a 100644
--- a/src/ride/station.c
+++ b/src/ride/station.c
@@ -15,7 +15,7 @@
#pragma endregion
#include "../game.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../world/sprite.h"
#include "station.h"
diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c
index 97e71c94a9..ab5c4e1843 100644
--- a/src/ride/vehicle.c
+++ b/src/ride/vehicle.c
@@ -23,7 +23,7 @@
#include "../interface/viewport.h"
#include "../localisation/localisation.h"
#include "../OpenRCT2.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../world/map_animation.h"
#include "../world/sprite.h"
#include "../world/scenery.h"
diff --git a/src/ScenarioRepository.cpp b/src/scenario/ScenarioRepository.cpp
similarity index 98%
rename from src/ScenarioRepository.cpp
rename to src/scenario/ScenarioRepository.cpp
index 43403f2c20..8c909de624 100644
--- a/src/ScenarioRepository.cpp
+++ b/src/scenario/ScenarioRepository.cpp
@@ -17,22 +17,22 @@
#include
#include
#include
-#include "core/Console.hpp"
-#include "core/FileScanner.h"
-#include "core/FileStream.hpp"
-#include "core/Math.hpp"
-#include "core/Path.hpp"
-#include "core/String.hpp"
-#include "PlatformEnvironment.h"
+#include "../core/Console.hpp"
+#include "../core/FileScanner.h"
+#include "../core/FileStream.hpp"
+#include "../core/Math.hpp"
+#include "../core/Path.hpp"
+#include "../core/String.hpp"
+#include "../PlatformEnvironment.h"
#include "ScenarioRepository.h"
#include "ScenarioSources.h"
extern "C"
{
- #include "config.h"
- #include "localisation/localisation.h"
+ #include "../config.h"
+ #include "../localisation/localisation.h"
+ #include "../rct2.h"
#include "scenario.h"
- #include "rct2.h"
}
static int ScenarioCategoryCompare(int categoryA, int categoryB)
diff --git a/src/ScenarioRepository.h b/src/scenario/ScenarioRepository.h
similarity index 99%
rename from src/ScenarioRepository.h
rename to src/scenario/ScenarioRepository.h
index 166d05e886..cd41539350 100644
--- a/src/ScenarioRepository.h
+++ b/src/scenario/ScenarioRepository.h
@@ -16,7 +16,7 @@
#pragma once
-#include "common.h"
+#include "../common.h"
#ifndef MAX_PATH
#define MAX_PATH 260
diff --git a/src/ScenarioSources.cpp b/src/scenario/ScenarioSources.cpp
similarity index 99%
rename from src/ScenarioSources.cpp
rename to src/scenario/ScenarioSources.cpp
index bda3447f75..7e2088fe76 100644
--- a/src/ScenarioSources.cpp
+++ b/src/scenario/ScenarioSources.cpp
@@ -14,15 +14,14 @@
*****************************************************************************/
#pragma endregion
-#include "core/Guard.hpp"
-#include "core/String.hpp"
-#include "core/Util.hpp"
+#include "../core/Guard.hpp"
+#include "../core/String.hpp"
+#include "../core/Util.hpp"
#include "ScenarioSources.h"
extern "C"
{
#include "scenario.h"
- #include "util/util.h"
}
namespace ScenarioSources
diff --git a/src/ScenarioSources.h b/src/scenario/ScenarioSources.h
similarity index 99%
rename from src/ScenarioSources.h
rename to src/scenario/ScenarioSources.h
index 99aaea0ea1..73b17df777 100644
--- a/src/ScenarioSources.h
+++ b/src/scenario/ScenarioSources.h
@@ -16,7 +16,7 @@
#pragma once
-#include "common.h"
+#include "../common.h"
typedef struct source_desc
{
diff --git a/src/scenario.c b/src/scenario/scenario.c
similarity index 97%
rename from src/scenario.c
rename to src/scenario/scenario.c
index 1292693cb8..62c5f3b140 100644
--- a/src/scenario.c
+++ b/src/scenario/scenario.c
@@ -14,37 +14,37 @@
*****************************************************************************/
#pragma endregion
-#include "audio/audio.h"
-#include "cheats.h"
-#include "config.h"
-#include "game.h"
-#include "interface/viewport.h"
-#include "localisation/date.h"
-#include "localisation/localisation.h"
-#include "management/award.h"
-#include "management/finance.h"
-#include "management/marketing.h"
-#include "management/news_item.h"
-#include "management/research.h"
-#include "network/network.h"
-#include "object.h"
-#include "object_list.h"
-#include "OpenRCT2.h"
-#include "peep/staff.h"
-#include "platform/platform.h"
-#include "ride/ride.h"
+#include "../audio/audio.h"
+#include "../cheats.h"
+#include "../config.h"
+#include "../game.h"
+#include "../interface/viewport.h"
+#include "../localisation/date.h"
+#include "../localisation/localisation.h"
+#include "../management/award.h"
+#include "../management/finance.h"
+#include "../management/marketing.h"
+#include "../management/news_item.h"
+#include "../management/research.h"
+#include "../network/network.h"
+#include "../object.h"
+#include "../object_list.h"
+#include "../OpenRCT2.h"
+#include "../peep/staff.h"
+#include "../platform/platform.h"
+#include "../rct1.h"
+#include "../ride/ride.h"
+#include "../util/sawyercoding.h"
+#include "../util/util.h"
+#include "../world/climate.h"
+#include "../world/map.h"
+#include "../world/park.h"
+#include "../world/scenery.h"
+#include "../world/sprite.h"
+#include "../world/water.h"
#include "scenario.h"
#include "ScenarioRepository.h"
#include "ScenarioSources.h"
-#include "util/sawyercoding.h"
-#include "util/util.h"
-#include "world/climate.h"
-#include "world/map.h"
-#include "world/park.h"
-#include "world/scenery.h"
-#include "world/sprite.h"
-#include "world/water.h"
-#include "rct1.h"
const rct_string_id ScenarioCategoryStringIds[SCENARIO_CATEGORY_COUNT] = {
STR_BEGINNER_PARKS,
diff --git a/src/scenario.h b/src/scenario/scenario.h
similarity index 96%
rename from src/scenario.h
rename to src/scenario/scenario.h
index 014446b104..47adf01016 100644
--- a/src/scenario.h
+++ b/src/scenario/scenario.h
@@ -17,20 +17,20 @@
#ifndef _SCENARIO_H_
#define _SCENARIO_H_
-#include "addresses.h"
-#include "common.h"
-#include "management/award.h"
-#include "management/finance.h"
-#include "management/news_item.h"
-#include "management/research.h"
-#include "ride/ride.h"
-#include "ride/ride_ratings.h"
-#include "object.h"
-#include "platform/platform.h"
-#include "world/banner.h"
-#include "world/map.h"
-#include "world/map_animation.h"
-#include "world/sprite.h"
+#include "../addresses.h"
+#include "../common.h"
+#include "../management/award.h"
+#include "../management/finance.h"
+#include "../management/news_item.h"
+#include "../management/research.h"
+#include "../ride/ride.h"
+#include "../ride/ride_ratings.h"
+#include "../object.h"
+#include "../platform/platform.h"
+#include "../world/banner.h"
+#include "../world/map.h"
+#include "../world/map_animation.h"
+#include "../world/sprite.h"
#pragma pack(push, 1)
/**
diff --git a/src/title.c b/src/title.c
deleted file mode 100644
index 9d823e0e38..0000000000
--- a/src/title.c
+++ /dev/null
@@ -1,498 +0,0 @@
-#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
-/*****************************************************************************
- * OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
- *
- * OpenRCT2 is the work of many authors, a full list can be found in contributors.md
- * For more information, visit https://github.com/OpenRCT2/OpenRCT2
- *
- * OpenRCT2 is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * A full copy of the GNU General Public License can be found in licence.txt
- *****************************************************************************/
-#pragma endregion
-
-#include
-#include "audio/audio.h"
-#include "config.h"
-#include "drawing/drawing.h"
-#include "editor.h"
-#include "game.h"
-#include "input.h"
-#include "localisation/date.h"
-#include "localisation/localisation.h"
-#include "interface/screenshot.h"
-#include "interface/title_sequences.h"
-#include "interface/viewport.h"
-#include "intro.h"
-#include "management/news_item.h"
-#include "management/research.h"
-#include "network/network.h"
-#include "OpenRCT2.h"
-#include "peep/staff.h"
-#include "ride/ride.h"
-#include "scenario.h"
-#include "ScenarioRepository.h"
-#include "ScenarioSources.h"
-#include "title.h"
-#include "title/TitleSequence.h"
-#include "title/TitleSequenceManager.h"
-#include "util/util.h"
-#include "world/climate.h"
-#include "world/map.h"
-#include "world/park.h"
-#include "world/scenery.h"
-#include "world/sprite.h"
-#include "windows/error.h"
-
-
-bool gTitleHideVersionInfo = false;
-
-sint32 gTitleScriptCommand = -1;
-uint8 gTitleScriptSave = 0xFF;
-sint32 gTitleScriptSkipTo = -1;
-sint32 gTitleScriptSkipLoad = -1;
-
-static rct_xy16 _titleScriptCurrentCentralPosition = { -1, -1 };
-static int _scriptWaitCounter;
-static int _loadedTitleSequenceId = -1;
-static TitleSequence * _loadedTitleSequence = NULL;
-static int _sequenceAttemptId = 0;
-
-static void title_init_showcase();
-static void title_update_showcase();
-static bool title_load_park(SDL_RWops * rw, bool isScenario);
-
-/**
- *
- * rct2: 0x0068E8DA
- */
-void title_load()
-{
- log_verbose("loading title");
-
- if (gGamePaused & GAME_PAUSED_NORMAL)
- pause_toggle();
-
- gScreenFlags = SCREEN_FLAGS_TITLE_DEMO;
-
-#ifndef DISABLE_NETWORK
- network_close();
-#endif
- reset_park_entrances();
- user_string_clear_all();
- reset_sprite_list();
- ride_init_all();
- window_guest_list_init_vars_a();
- staff_reset_modes();
- map_init(150);
- park_init();
- date_reset();
- climate_reset(CLIMATE_COOL_AND_WET);
- scenery_set_default_placement_configuration();
- window_new_ride_init_vars();
- window_guest_list_init_vars_b();
- window_staff_list_init_vars();
- map_update_tile_pointers();
- reset_sprite_spatial_index();
- audio_stop_all_music_and_sounds();
- viewport_init_all();
- news_item_init_queue();
- window_main_open();
- title_create_windows();
- title_init_showcase();
- gfx_invalidate_screen();
- audio_start_title_music();
- gScreenAge = 0;
-
- if (gOpenRCT2ShowChangelog) {
- gOpenRCT2ShowChangelog = false;
- window_changelog_open();
- }
-
- log_verbose("loading title finished");
-}
-
-/**
- * Creates the windows shown on the title screen; New game, load game,
- * tutorial, toolbox and exit.
- * rct2: 0x0066B5C0 (part of 0x0066B3E8)
- */
-void title_create_windows()
-{
- window_title_menu_open();
- window_title_exit_open();
- window_title_options_open();
- window_title_logo_open();
- window_resize_gui(gScreenWidth, gScreenHeight);
- gTitleHideVersionInfo = false;
-}
-
-/**
- *
- * rct2: 0x00678680
- */
-static void title_init_showcase()
-{
- size_t seqId = title_sequence_manager_get_index_for_config_id(gConfigInterface.current_title_sequence_preset);
- if (seqId == SIZE_MAX) {
- seqId = title_sequence_manager_get_index_for_config_id("*OPENRCT2");
- if (seqId == SIZE_MAX) {
- seqId = 0;
- }
- }
- title_sequence_change_preset((int)seqId);
- title_refresh_sequence();
- title_update_showcase();
-}
-
-static bool title_load_park_from_file(const char * path)
-{
- bool success = false;
- bool isScenario = _strcmpi(path_get_extension(path), ".sv6");
- SDL_RWops * rw = SDL_RWFromFile(path, "rb");
- if (rw != NULL) {
- success = title_load_park(rw, isScenario);
- SDL_RWclose(rw);
- }
- return success;
-}
-
-static bool title_load_park(SDL_RWops * rw, bool isScenario)
-{
- rct_window* w;
- int successfulLoad = 0;
-
- if (isScenario) {
- successfulLoad = scenario_load_rw(rw);
- } else {
- successfulLoad = game_load_sv6(rw);
- }
- if (!successfulLoad)
- return false;
-
- w = window_get_main();
- w->viewport_target_sprite = -1;
- w->saved_view_x = gSavedViewX;
- w->saved_view_y = gSavedViewY;
-
- {
- char zoomDifference = gSavedViewZoom - w->viewport->zoom;
- w->viewport->zoom = gSavedViewZoom;
- gCurrentRotation = gSavedViewRotation;
- if (zoomDifference != 0) {
- if (zoomDifference < 0) {
- zoomDifference = -zoomDifference;
- w->viewport->view_width >>= zoomDifference;
- w->viewport->view_height >>= zoomDifference;
- } else {
- w->viewport->view_width <<= zoomDifference;
- w->viewport->view_height <<= zoomDifference;
- }
- }
- w->saved_view_x -= w->viewport->view_width >> 1;
- w->saved_view_y -= w->viewport->view_height >> 1;
- }
-
- window_invalidate(w);
- reset_sprite_spatial_index();
- reset_all_sprite_quadrant_placements();
- window_new_ride_init_vars();
- if (!isScenario) {
- sub_684AC3();
- }
- scenery_set_default_placement_configuration();
- news_item_init_queue();
- load_palette();
- gfx_invalidate_screen();
- window_tile_inspector_clear_clipboard();
- gScreenAge = 0;
- gGameSpeed = 1;
- return true;
-}
-
-/**
- * Sets the map location to the given tile coordinates. Z is automatic.
- * @param x X position in map tiles.
- * @param y Y position in map tiles.
- */
-static void title_set_location(int x, int y)
-{
- int z = map_element_height(x, y);
-
- // Update viewport
- rct_window* w = window_get_main();
- if (w != NULL) {
- window_scroll_to_location(w, x, y, z);
- w->flags &= ~WF_SCROLLING_TO_LOCATION;
- viewport_update_position(w);
- }
-
- // Save known tile position in case of window resize
- _titleScriptCurrentCentralPosition.x = (sint16)x;
- _titleScriptCurrentCentralPosition.y = (sint16)y;
-}
-
-/**
- * Re-centres the map location to the last scripted tile position.
- */
-void title_fix_location()
-{
- if (gScreenFlags == SCREEN_FLAGS_TITLE_DEMO) {
- rct_xy16 position = _titleScriptCurrentCentralPosition;
- if (position.x != -1) {
- title_set_location(position.x, position.y);
- }
- }
-}
-
-static bool title_do_sequence_command(const TitleCommand * command)
-{
- switch (command->Type) {
- case TITLE_SCRIPT_END:
- _scriptWaitCounter = 1;
- break;
- case TITLE_SCRIPT_WAIT:
- _scriptWaitCounter = command->Seconds * 32;
- break;
- case TITLE_SCRIPT_LOADMM:
- if (!title_load_park_from_file(get_file_path(PATH_ID_SIXFLAGS_MAGICMOUNTAIN))) {
- log_fatal("OpenRCT2 can not currently cope when unable to load title screen scenario.");
- exit(-1);
- }
- gTitleScriptSave = 0xFF;
- break;
- case TITLE_SCRIPT_LOCATION:
- {
- int x = command->X * 32 + 16;
- int y = command->Y * 32 + 16;
- title_set_location(x, y);
- break;
- }
- case TITLE_SCRIPT_ROTATE:
- {
- rct_window * w = window_get_main();
- if (w != NULL) {
- for (int i = 0; i < command->Rotations; i++) {
- window_rotate_camera(w, 1);
- }
- }
- break;
- }
- case TITLE_SCRIPT_ZOOM:
- {
- rct_window * w = window_get_main();
- if (w != NULL && w->viewport != NULL) {
- window_zoom_set(w, command->Zoom);
- }
- break;
- }
- case TITLE_SCRIPT_SPEED:
- gGameSpeed = max(1, min(4, command->Speed));
- break;
- case TITLE_SCRIPT_RESTART:
- gTitleScriptCommand = -1;
- gTitleScriptSave = 0xFF;
- break;
- case TITLE_SCRIPT_LOAD:
- {
- if (gTitleScriptSkipTo != -1) {
- break;
- }
-
- bool loadSuccess = false;
- uint8 saveIndex = command->SaveIndex;
- TitleSequenceParkHandle * parkHandle = TitleSequenceGetParkHandle(_loadedTitleSequence, saveIndex);
- if (parkHandle != NULL) {
- loadSuccess = title_load_park(parkHandle->RWOps, parkHandle->IsScenario);
- TitleSequenceCloseParkHandle(parkHandle);
- }
-
- if (loadSuccess) {
- gTitleScriptSave = saveIndex;
- } else {
- if (_loadedTitleSequence->NumSaves > saveIndex) {
- log_error("Failed to load: \"%s\" for the title sequence.", _loadedTitleSequence->Saves[saveIndex]);
- }
- return false;
- }
- break;
- }
- case TITLE_SCRIPT_LOADRCT1:
- {
- if (gTitleScriptSkipTo != -1) {
- break;
- }
-
- source_desc sourceDesc;
- if (!scenario_get_source_desc_by_id(command->SaveIndex, &sourceDesc) || sourceDesc.index == -1) {
- log_error("Invalid scenario id.");
- return false;
- }
-
- const utf8 *path = NULL;
- size_t numScenarios = scenario_repository_get_count();
- for (size_t i = 0; i < numScenarios; i++) {
- const scenario_index_entry * scenario = scenario_repository_get_by_index(i);
- if (scenario->source_index == sourceDesc.index) {
- path = scenario->path;
- break;
- }
- }
-
- if (path == NULL || !title_load_park_from_file(path)) {
- return false;
- }
- gTitleScriptSave = 0xFF;
- break;
- }
- }
- window_invalidate_by_class(WC_TITLE_EDITOR);
- return true;
-}
-
-static void title_move_to_next_command()
-{
- gTitleScriptCommand++;
- if (gTitleScriptCommand >= _loadedTitleSequence->NumCommands) {
- gTitleScriptCommand = 0;
- }
-}
-
-static void title_try_next_sequence()
-{
- gCurrentPreviewTitleSequence = _sequenceAttemptId++;
- if (_sequenceAttemptId >= (int)title_sequence_manager_get_count()) {
- _sequenceAttemptId = 0;
- }
- title_refresh_sequence();
-}
-
-/**
- *
- * rct2: 0x00678761
- */
-static void title_update_showcase()
-{
- if (_loadedTitleSequence == NULL) {
- title_try_next_sequence();
- return;
- }
-
- sint32 entryCommand = gTitleScriptCommand;
- if (_scriptWaitCounter <= 0) {
- do {
- if (gTitleScriptCommand > _loadedTitleSequence->NumCommands) {
- gTitleScriptCommand = 0;
- title_try_next_sequence();
- return;
- }
-
- const TitleCommand * command = &_loadedTitleSequence->Commands[gTitleScriptCommand];
- bool successful = title_do_sequence_command(command);
- title_move_to_next_command();
- if (!successful) {
- bool isLoadCommand = false;
- do {
- const TitleCommand * command = &_loadedTitleSequence->Commands[gTitleScriptCommand];
- switch (command->Type) {
- case TITLE_SCRIPT_LOADMM:
- case TITLE_SCRIPT_LOAD:
- case TITLE_SCRIPT_LOADRCT1:
- isLoadCommand = true;
- break;
- default:
- title_move_to_next_command();
- if (gTitleScriptCommand == entryCommand) {
- // We have got back to where we started so we can't load any of these parks
- title_try_next_sequence();
- return;
- }
- break;
- }
- } while (!isLoadCommand);
- }
- } while (_scriptWaitCounter == 0);
- }
- _scriptWaitCounter--;
- if (gTitleScriptSkipTo != -1) {
- _scriptWaitCounter = 0;
- }
- _sequenceAttemptId = 0;
-}
-
-void title_update()
-{
- screenshot_check();
- title_handle_keyboard_input();
-
- if (game_is_not_paused()) {
- if (gTitleScriptCommand == gTitleScriptSkipTo) {
- gTitleScriptSkipTo = -1;
- _scriptWaitCounter = 0;
- }
- do {
- title_update_showcase();
- } while (gTitleScriptCommand < gTitleScriptSkipTo);
- gTitleScriptSkipTo = -1;
-
- int numUpdates = 1;
- if (gGameSpeed > 1) {
- numUpdates = 1 << (gGameSpeed - 1);
- }
- for (int i = 0; i < numUpdates; i++) {
- game_logic_update();
- }
- update_palette_effects();
- // update_rain_animation();
- }
-
- gInputFlags &= ~INPUT_FLAG_VIEWPORT_SCROLLING;
-
- window_map_tooltip_update_visibility();
- window_dispatch_update_all();
-
- gSavedAge++;
-
- game_handle_input();
-}
-
-void title_refresh_sequence()
-{
- if (_loadedTitleSequenceId != gCurrentPreviewTitleSequence) {
- FreeTitleSequence(_loadedTitleSequence);
-
- size_t numSequences = title_sequence_manager_get_count();
- if (gCurrentPreviewTitleSequence < numSequences) {
- const utf8 * path = title_sequence_manager_get_path(gCurrentPreviewTitleSequence);
- _loadedTitleSequence = LoadTitleSequence(path);
- _loadedTitleSequenceId = gCurrentPreviewTitleSequence;
- }
- }
-
- _scriptWaitCounter = 0;
- gTitleScriptCommand = 0;
- gTitleScriptSave = 0xFF;
- gfx_invalidate_screen();
-}
-
-void DrawOpenRCT2(rct_drawpixelinfo *dpi, int x, int y)
-{
- utf8 buffer[256];
-
- // Write format codes
- utf8 *ch = buffer;
- ch = utf8_write_codepoint(ch, FORMAT_MEDIUMFONT);
- ch = utf8_write_codepoint(ch, FORMAT_OUTLINE);
- ch = utf8_write_codepoint(ch, FORMAT_WHITE);
-
- // Write name and version information
- openrct2_write_full_version_info(ch, sizeof(buffer) - (ch - buffer));
- gfx_draw_string(dpi, buffer, COLOUR_BLACK, x + 5, y + 5 - 13);
-
- // Write platform information
- snprintf(ch, 256 - (ch - buffer), "%s (%s)", OPENRCT2_PLATFORM, OPENRCT2_ARCHITECTURE);
- gfx_draw_string(dpi, buffer, COLOUR_BLACK, x + 5, y + 5);
-}
diff --git a/src/title/TitleSequencePlayer.cpp b/src/title/TitleSequencePlayer.cpp
index cf030c6f2a..49334bf8e5 100644
--- a/src/title/TitleSequencePlayer.cpp
+++ b/src/title/TitleSequencePlayer.cpp
@@ -21,8 +21,8 @@
#include "../core/Math.hpp"
#include "../core/Path.hpp"
#include "../core/String.hpp"
-#include "../ScenarioRepository.h"
-#include "../ScenarioSources.h"
+#include "../scenario/ScenarioRepository.h"
+#include "../scenario/ScenarioSources.h"
#include "TitleSequence.h"
#include "TitleSequenceManager.h"
#include "TitleSequencePlayer.h"
diff --git a/src/util/sawyercoding.c b/src/util/sawyercoding.c
index d3c4b263dc..ddad0076c0 100644
--- a/src/util/sawyercoding.c
+++ b/src/util/sawyercoding.c
@@ -16,7 +16,7 @@
#include "../platform/platform.h"
#include "sawyercoding.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "util.h"
static size_t decode_chunk_rle(const uint8* src_buffer, uint8* dst_buffer, size_t length);
diff --git a/src/windows/cheats.c b/src/windows/cheats.c
index ae5631f687..3228d4cd16 100644
--- a/src/windows/cheats.c
+++ b/src/windows/cheats.c
@@ -22,7 +22,7 @@
#include "../world/park.h"
#include "../peep/peep.h"
#include "../ride/ride.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../sprites.h"
#include "../world/climate.h"
#include "../world/park.h"
diff --git a/src/windows/dropdown.c b/src/windows/dropdown.c
index ab5ff0ea05..f7eca90b2d 100644
--- a/src/windows/dropdown.c
+++ b/src/windows/dropdown.c
@@ -19,7 +19,7 @@
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../rct2.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../sprites.h"
#include "dropdown.h"
diff --git a/src/windows/editor_bottom_toolbar.c b/src/windows/editor_bottom_toolbar.c
index 2c7fdba5f8..b2dfcd0544 100644
--- a/src/windows/editor_bottom_toolbar.c
+++ b/src/windows/editor_bottom_toolbar.c
@@ -19,7 +19,7 @@
#include "../game.h"
#include "../editor.h"
#include "../input.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../sprites.h"
#include "../localisation/localisation.h"
#include "../interface/themes.h"
diff --git a/src/windows/editor_object_selection.c b/src/windows/editor_object_selection.c
index 30a309f155..03e17c6273 100644
--- a/src/windows/editor_object_selection.c
+++ b/src/windows/editor_object_selection.c
@@ -33,7 +33,7 @@
#include "../ride/track.h"
#include "../ride/track_data.h"
#include "../ride/track_design.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../util/util.h"
#include "../world/footpath.h"
#include "dropdown.h"
diff --git a/src/windows/editor_objective_options.c b/src/windows/editor_objective_options.c
index 84151bebb1..f3380130ae 100644
--- a/src/windows/editor_objective_options.c
+++ b/src/windows/editor_objective_options.c
@@ -21,7 +21,7 @@
#include "../localisation/date.h"
#include "../localisation/localisation.h"
#include "../rct2.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../sprites.h"
#include "../util/util.h"
#include "../world/climate.h"
diff --git a/src/windows/finances.c b/src/windows/finances.c
index a0b276d161..fc3079acbd 100644
--- a/src/windows/finances.c
+++ b/src/windows/finances.c
@@ -26,7 +26,7 @@
#include "../management/research.h"
#include "../ride/ride.h"
#include "../ride/ride_data.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../sprites.h"
#include "dropdown.h"
#include "../interface/themes.h"
diff --git a/src/windows/guest.c b/src/windows/guest.c
index 46e58469c9..908f69a829 100644
--- a/src/windows/guest.c
+++ b/src/windows/guest.c
@@ -23,7 +23,7 @@
#include "../peep/staff.h"
#include "../ride/ride.h"
#include "../ride/ride_data.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../interface/themes.h"
diff --git a/src/windows/loadsave.c b/src/windows/loadsave.c
index 588e5dd99e..f6eca272d9 100644
--- a/src/windows/loadsave.c
+++ b/src/windows/loadsave.c
@@ -23,7 +23,7 @@
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../network/network.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../title/TitleScreen.h"
#include "../util/util.h"
#include "../windows/error.h"
diff --git a/src/windows/park.c b/src/windows/park.c
index 6c1552f924..4aba3fa29b 100644
--- a/src/windows/park.c
+++ b/src/windows/park.c
@@ -27,7 +27,7 @@
#include "../peep/peep.h"
#include "../rct2.h"
#include "../ride/ride.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../sprites.h"
#include "../util/util.h"
#include "../world/park.h"
diff --git a/src/windows/player.c b/src/windows/player.c
index 378880e0dd..fedaf08069 100644
--- a/src/windows/player.c
+++ b/src/windows/player.c
@@ -23,7 +23,7 @@
#include "../peep/staff.h"
#include "../ride/ride.h"
#include "../ride/ride_data.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../interface/themes.h"
diff --git a/src/windows/title_editor.c b/src/windows/title_editor.c
index b97deb04cb..74ec11bb95 100644
--- a/src/windows/title_editor.c
+++ b/src/windows/title_editor.c
@@ -25,8 +25,8 @@
#include "../localisation/localisation.h"
#include "../peep/peep.h"
#include "../peep/staff.h"
-#include "../scenario.h"
-#include "../ScenarioSources.h"
+#include "../scenario/scenario.h"
+#include "../scenario/ScenarioSources.h"
#include "../sprites.h"
#include "../title/TitleScreen.h"
#include "../title/TitleSequence.h"
diff --git a/src/windows/title_scenarioselect.c b/src/windows/title_scenarioselect.c
index ff72a3070c..3f15d7835a 100644
--- a/src/windows/title_scenarioselect.c
+++ b/src/windows/title_scenarioselect.c
@@ -18,8 +18,8 @@
#include "../audio/audio.h"
#include "../localisation/date.h"
#include "../localisation/localisation.h"
-#include "../ScenarioRepository.h"
-#include "../ScenarioSources.h"
+#include "../scenario/ScenarioRepository.h"
+#include "../scenario/ScenarioSources.h"
#include "../sprites.h"
#include "../interface/widget.h"
#include "../interface/window.h"
diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c
index f0f0491ebd..7ef1115bb1 100644
--- a/src/windows/top_toolbar.c
+++ b/src/windows/top_toolbar.c
@@ -30,7 +30,7 @@
#include "../network/network.h"
#include "../network/twitch.h"
#include "../peep/staff.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../sprites.h"
#include "../title/TitleScreen.h"
#include "../util/util.h"
diff --git a/src/world/balloon.c b/src/world/balloon.c
index e8ac4d92f3..111eaee842 100644
--- a/src/world/balloon.c
+++ b/src/world/balloon.c
@@ -16,7 +16,7 @@
#include "../audio/audio.h"
#include "../network/network.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../util/util.h"
#include "sprite.h"
diff --git a/src/world/climate.c b/src/world/climate.c
index 3c904da65a..907334a469 100644
--- a/src/world/climate.c
+++ b/src/world/climate.c
@@ -23,7 +23,7 @@
#include "../interface/window.h"
#include "../localisation/date.h"
#include "../rct2.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../sprites.h"
#include "../util/util.h"
#include "climate.h"
diff --git a/src/world/duck.c b/src/world/duck.c
index c1b467b3ed..0e6fda99fe 100644
--- a/src/world/duck.c
+++ b/src/world/duck.c
@@ -17,7 +17,7 @@
#include "../audio/audio.h"
#include "../game.h"
#include "../localisation/date.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "sprite.h"
enum {
diff --git a/src/world/fountain.c b/src/world/fountain.c
index 385121ead1..5cd2b9bcd5 100644
--- a/src/world/fountain.c
+++ b/src/world/fountain.c
@@ -15,7 +15,7 @@
#pragma endregion
#include "../game.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "fountain.h"
#include "map.h"
#include "scenery.h"
diff --git a/src/world/map.c b/src/world/map.c
index 4c342e8c02..4ff7a54e28 100644
--- a/src/world/map.c
+++ b/src/world/map.c
@@ -30,7 +30,7 @@
#include "../ride/ride_data.h"
#include "../ride/track.h"
#include "../ride/track_data.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../util/util.h"
#include "banner.h"
#include "climate.h"
diff --git a/src/world/park.c b/src/world/park.c
index 8e2fd71933..d48e85da1b 100644
--- a/src/world/park.c
+++ b/src/world/park.c
@@ -30,7 +30,7 @@
#include "../rct2.h"
#include "../ride/ride.h"
#include "../ride/ride_data.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../world/map.h"
#include "park.h"
#include "sprite.h"
diff --git a/src/world/particle.c b/src/world/particle.c
index 5866f871c4..61b10e9cee 100644
--- a/src/world/particle.c
+++ b/src/world/particle.c
@@ -16,7 +16,7 @@
#include "../audio/audio.h"
#include "../util/util.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "sprite.h"
/**
diff --git a/src/world/scenery.c b/src/world/scenery.c
index e77690b9d4..acfb87d39e 100644
--- a/src/world/scenery.c
+++ b/src/world/scenery.c
@@ -17,7 +17,7 @@
#include "../game.h"
#include "../common.h"
#include "../localisation/localisation.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "../cheats.h"
#include "../object_list.h"
#include "climate.h"
diff --git a/src/world/sprite.c b/src/world/sprite.c
index e73e34cf6e..570c95d021 100644
--- a/src/world/sprite.c
+++ b/src/world/sprite.c
@@ -22,7 +22,7 @@
#include "../localisation/date.h"
#include "../localisation/localisation.h"
#include "../OpenRCT2.h"
-#include "../scenario.h"
+#include "../scenario/scenario.h"
#include "fountain.h"
#include "sprite.h"