diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index ed42c0ab67..488ba30c0e 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -27,7 +27,6 @@ struct rct_drawpixelinfo; struct rct_window; union rct_window_event; struct track_design_file_ref; -struct TitleSequence; struct TextInputSession; struct scenario_index_entry; diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 0249cf33b8..4b3cbcb56f 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -497,6 +497,16 @@ + + + + + + + + + + @@ -941,6 +951,16 @@ + + + + + + + + + + @@ -975,4 +995,4 @@ - + \ No newline at end of file diff --git a/src/openrct2/title/Command/End.cpp b/src/openrct2/title/Command/End.cpp new file mode 100644 index 0000000000..2249a42b1d --- /dev/null +++ b/src/openrct2/title/Command/End.cpp @@ -0,0 +1,18 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "End.h" + +namespace OpenRCT2::Title +{ + int16_t EndCommand::operator()(int16_t timer) + { + return 0; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/End.h b/src/openrct2/title/Command/End.h new file mode 100644 index 0000000000..f6bda4a516 --- /dev/null +++ b/src/openrct2/title/Command/End.h @@ -0,0 +1,22 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2::Title +{ + struct EndCommand + { + static constexpr const char* Name = "End Command"; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/FollowEntity.cpp b/src/openrct2/title/Command/FollowEntity.cpp new file mode 100644 index 0000000000..5db67999a9 --- /dev/null +++ b/src/openrct2/title/Command/FollowEntity.cpp @@ -0,0 +1,20 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "FollowEntity.h" + +namespace OpenRCT2::Title +{ + int16_t FollowEntityCommand::operator()(int16_t timer) + { + // TODO: Set entity to follow + + return 0; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/FollowEntity.h b/src/openrct2/title/Command/FollowEntity.h new file mode 100644 index 0000000000..9224eb3a90 --- /dev/null +++ b/src/openrct2/title/Command/FollowEntity.h @@ -0,0 +1,32 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "../../Identifiers.h" +#include "../../core/String.hpp" +#include "../../localisation/Localisation.h" + +#include + +namespace OpenRCT2::Title +{ + struct FollowEntityCommand + { + static constexpr const char* Name = "Follow Entity Command"; + + struct + { + EntityId SpriteIndex; + utf8 SpriteName[USER_STRING_MAX_LENGTH]; + } Follow; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/LoadPark.cpp b/src/openrct2/title/Command/LoadPark.cpp new file mode 100644 index 0000000000..27366fe160 --- /dev/null +++ b/src/openrct2/title/Command/LoadPark.cpp @@ -0,0 +1,20 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "LoadPark.h" + +namespace OpenRCT2::Title +{ + int16_t LoadParkCommand::operator()(int16_t timer) + { + // TODO: Load park + + return 0; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/LoadPark.h b/src/openrct2/title/Command/LoadPark.h new file mode 100644 index 0000000000..e2569a0c2b --- /dev/null +++ b/src/openrct2/title/Command/LoadPark.h @@ -0,0 +1,24 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2::Title +{ + struct LoadParkCommand + { + static constexpr const char* Name = "Load Park Command"; + + uint8_t SaveIndex; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/LoadScenario.cpp b/src/openrct2/title/Command/LoadScenario.cpp new file mode 100644 index 0000000000..cfa1d300b8 --- /dev/null +++ b/src/openrct2/title/Command/LoadScenario.cpp @@ -0,0 +1,20 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "LoadScenario.h" + +namespace OpenRCT2::Title +{ + int16_t LoadScenarioCommand::operator()(int16_t timer) + { + // TODO: Load scenario + + return 0; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/LoadScenario.h b/src/openrct2/title/Command/LoadScenario.h new file mode 100644 index 0000000000..b27bbbafe5 --- /dev/null +++ b/src/openrct2/title/Command/LoadScenario.h @@ -0,0 +1,28 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "../../core/String.hpp" + +#include + +#define TITLE_COMMAND_SCENARIO_LENGTH 64 + +namespace OpenRCT2::Title +{ + struct LoadScenarioCommand + { + static constexpr const char* Name = "Load Scenario Command"; + + utf8 Scenario[TITLE_COMMAND_SCENARIO_LENGTH]; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/Restart.cpp b/src/openrct2/title/Command/Restart.cpp new file mode 100644 index 0000000000..07dd2b7204 --- /dev/null +++ b/src/openrct2/title/Command/Restart.cpp @@ -0,0 +1,18 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "Restart.h" + +namespace OpenRCT2::Title +{ + int16_t RestartCommand::operator()(int16_t timer) + { + return 0; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/Restart.h b/src/openrct2/title/Command/Restart.h new file mode 100644 index 0000000000..95e2494c6d --- /dev/null +++ b/src/openrct2/title/Command/Restart.h @@ -0,0 +1,22 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2::Title +{ + struct RestartCommand + { + static constexpr const char* Name = "Restart Command"; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/RotateView.cpp b/src/openrct2/title/Command/RotateView.cpp new file mode 100644 index 0000000000..3c19914c11 --- /dev/null +++ b/src/openrct2/title/Command/RotateView.cpp @@ -0,0 +1,20 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "RotateView.h" + +namespace OpenRCT2::Title +{ + int16_t RotateViewCommand::operator()(int16_t timer) + { + // TODO: Rotate the view X times + + return 0; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/RotateView.h b/src/openrct2/title/Command/RotateView.h new file mode 100644 index 0000000000..91c52f46e2 --- /dev/null +++ b/src/openrct2/title/Command/RotateView.h @@ -0,0 +1,24 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2::Title +{ + struct RotateViewCommand + { + static constexpr const char* Name = "Rotate View Command"; + + uint8_t Rotations; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/SetLocation.cpp b/src/openrct2/title/Command/SetLocation.cpp new file mode 100644 index 0000000000..fa2700dcf7 --- /dev/null +++ b/src/openrct2/title/Command/SetLocation.cpp @@ -0,0 +1,20 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "SetLocation.h" + +namespace OpenRCT2::Title +{ + int16_t SetLocationCommand::operator()(int16_t timer) + { + // TODO: Update view location + + return 0; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/SetLocation.h b/src/openrct2/title/Command/SetLocation.h new file mode 100644 index 0000000000..fef8b52db2 --- /dev/null +++ b/src/openrct2/title/Command/SetLocation.h @@ -0,0 +1,29 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2::Title +{ + struct SetLocationCommand + { + static constexpr const char* Name = "Set Location Command"; + + // TODO: Use TileCoordsXY instead + struct + { + uint8_t X; + uint8_t Y; + } Location; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/SetSpeed.cpp b/src/openrct2/title/Command/SetSpeed.cpp new file mode 100644 index 0000000000..095eaadd04 --- /dev/null +++ b/src/openrct2/title/Command/SetSpeed.cpp @@ -0,0 +1,20 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "SetSpeed.h" + +namespace OpenRCT2::Title +{ + int16_t SetSpeedCommand::operator()(int16_t timer) + { + // TODO: Update current zoom level + + return 0; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/SetSpeed.h b/src/openrct2/title/Command/SetSpeed.h new file mode 100644 index 0000000000..96c97a32b1 --- /dev/null +++ b/src/openrct2/title/Command/SetSpeed.h @@ -0,0 +1,24 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2::Title +{ + struct SetSpeedCommand + { + static constexpr const char* Name = "Set Speed Command"; + + uint8_t Speed; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/SetZoom.cpp b/src/openrct2/title/Command/SetZoom.cpp new file mode 100644 index 0000000000..21f41d2710 --- /dev/null +++ b/src/openrct2/title/Command/SetZoom.cpp @@ -0,0 +1,20 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "SetZoom.h" + +namespace OpenRCT2::Title +{ + int16_t SetZoomCommand::operator()(int16_t timer) + { + // TODO: Update current zoom level + + return 0; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/SetZoom.h b/src/openrct2/title/Command/SetZoom.h new file mode 100644 index 0000000000..8c78f3fdde --- /dev/null +++ b/src/openrct2/title/Command/SetZoom.h @@ -0,0 +1,25 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2::Title +{ + struct SetZoomCommand + { + static constexpr const char* Name = "Set Zoom Command"; + + // TODO: Use ZoomLevel instead + uint8_t Zoom; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/Wait.cpp b/src/openrct2/title/Command/Wait.cpp new file mode 100644 index 0000000000..76d7448bd4 --- /dev/null +++ b/src/openrct2/title/Command/Wait.cpp @@ -0,0 +1,18 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#include "Wait.h" + +namespace OpenRCT2::Title +{ + int16_t WaitCommand::operator()(int16_t timer) + { + return Milliseconds; + } +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/Command/Wait.h b/src/openrct2/title/Command/Wait.h new file mode 100644 index 0000000000..c14317c9d3 --- /dev/null +++ b/src/openrct2/title/Command/Wait.h @@ -0,0 +1,24 @@ +/***************************************************************************** + * Copyright (c) 2014-2022 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include + +namespace OpenRCT2::Title +{ + struct WaitCommand + { + static constexpr const char* Name = "Wait Command"; + + uint16_t Milliseconds; + + int16_t operator()(int16_t timer); + }; +} // namespace OpenRCT2::Title diff --git a/src/openrct2/title/TitleSequence.cpp b/src/openrct2/title/TitleSequence.cpp index 16739a1a3f..93ca63fdde 100644 --- a/src/openrct2/title/TitleSequence.cpp +++ b/src/openrct2/title/TitleSequence.cpp @@ -35,6 +35,8 @@ #include #include +using namespace OpenRCT2::Title; + static std::vector GetSaves(const std::string& path); static std::vector GetSaves(IZipArchive* zip); static std::vector LegacyScriptRead(const std::vector& script, std::vector saves); @@ -91,7 +93,7 @@ std::unique_ptr LoadTitleSequence(const std::string& path) auto commands = LegacyScriptRead(script, saves); - auto seq = CreateTitleSequence(); + auto seq = OpenRCT2::Title::CreateTitleSequence(); seq->Name = Path::GetFileNameWithoutExtension(path); seq->Path = path; seq->Saves = saves; diff --git a/src/openrct2/title/TitleSequence.h b/src/openrct2/title/TitleSequence.h index d1771548b8..af5c08fc6f 100644 --- a/src/openrct2/title/TitleSequence.h +++ b/src/openrct2/title/TitleSequence.h @@ -10,98 +10,56 @@ #pragma once #include "../common.h" -#include "../localisation/Localisation.h" #include "../openrct2/core/IStream.hpp" +#include "Command/End.h" +#include "Command/FollowEntity.h" +#include "Command/LoadPark.h" +#include "Command/LoadScenario.h" +#include "Command/Restart.h" +#include "Command/RotateView.h" +#include "Command/SetLocation.h" +#include "Command/SetSpeed.h" +#include "Command/SetZoom.h" +#include "Command/Wait.h" #include +#include #include -#define TITLE_COMMAND_SCENARIO_LENGTH 64 +namespace OpenRCT2::Title +{ + using TitleCommand = std::variant< + WaitCommand, SetLocationCommand, RotateViewCommand, SetZoomCommand, FollowEntityCommand, RestartCommand, + LoadParkCommand, EndCommand, SetSpeedCommand, LoadScenarioCommand>; -struct WaitCommand -{ - uint16_t Milliseconds; -}; -struct SetLocationCommand -{ - struct + struct TitleSequence { - uint8_t X; - uint8_t Y; - } Location; -}; -struct RotateViewCommand -{ - uint8_t Rotations; -}; -struct SetZoomCommand -{ - uint8_t Zoom; -}; -struct FollowEntityCommand -{ - struct + std::string Name; + std::string Path; + + std::vector Commands; + std::vector Saves; + + bool IsZip = false; + }; + + struct TitleSequenceParkHandle { - EntityId SpriteIndex; - utf8 SpriteName[USER_STRING_MAX_LENGTH]; - } Follow; -}; -struct RestartCommand -{ -}; -struct LoadParkCommand -{ - uint8_t SaveIndex; -}; -struct EndCommand -{ -}; -struct SetSpeedCommand -{ - uint8_t Speed; -}; -struct LoopCommand -{ -}; -struct EndLoopCommand -{ -}; -struct LoadScenarioCommand -{ - utf8 Scenario[TITLE_COMMAND_SCENARIO_LENGTH]; -}; + std::string HintPath; + std::unique_ptr Stream; + }; -using TitleCommand = std::variant< - WaitCommand, SetLocationCommand, RotateViewCommand, SetZoomCommand, FollowEntityCommand, RestartCommand, LoadParkCommand, - EndCommand, SetSpeedCommand, LoopCommand, EndLoopCommand, LoadScenarioCommand>; + constexpr const utf8* TITLE_SEQUENCE_EXTENSION = ".parkseq"; + constexpr uint8_t SAVE_INDEX_INVALID = UINT8_MAX; -struct TitleSequence -{ - std::string Name; - std::string Path; + [[nodiscard]] std::unique_ptr CreateTitleSequence(); + [[nodiscard]] std::unique_ptr LoadTitleSequence(const std::string& path); + [[nodiscard]] std::unique_ptr TitleSequenceGetParkHandle(const TitleSequence& seq, size_t index); - std::vector Commands; - std::vector Saves; + bool TitleSequenceSave(const TitleSequence& seq); + bool TitleSequenceAddPark(TitleSequence& seq, const utf8* path, const utf8* name); + bool TitleSequenceRenamePark(TitleSequence& seq, size_t index, const utf8* name); + bool TitleSequenceRemovePark(TitleSequence& seq, size_t index); - bool IsZip = false; -}; - -struct TitleSequenceParkHandle -{ - std::string HintPath; - std::unique_ptr Stream; -}; - -constexpr const utf8* TITLE_SEQUENCE_EXTENSION = ".parkseq"; -constexpr uint8_t SAVE_INDEX_INVALID = UINT8_MAX; - -[[nodiscard]] std::unique_ptr CreateTitleSequence(); -[[nodiscard]] std::unique_ptr LoadTitleSequence(const std::string& path); -[[nodiscard]] std::unique_ptr TitleSequenceGetParkHandle(const TitleSequence& seq, size_t index); - -bool TitleSequenceSave(const TitleSequence& seq); -bool TitleSequenceAddPark(TitleSequence& seq, const utf8* path, const utf8* name); -bool TitleSequenceRenamePark(TitleSequence& seq, size_t index, const utf8* name); -bool TitleSequenceRemovePark(TitleSequence& seq, size_t index); - -bool TitleSequenceIsLoadCommand(const TitleCommand& command); + bool TitleSequenceIsLoadCommand(const TitleCommand& command); +} // namespace OpenRCT2::Title