2016-11-21 01:16:47 +01:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2016-11-21 01:16:47 +01:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2016-11-21 01:16:47 +01:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-11-21 01:16:47 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
#include "TitleScreen.h"
|
|
|
|
|
2017-03-26 22:42:07 +02:00
|
|
|
#include "../Context.h"
|
2018-06-22 23:15:14 +02:00
|
|
|
#include "../Game.h"
|
2017-07-23 01:19:09 +02:00
|
|
|
#include "../GameState.h"
|
2018-06-22 23:15:14 +02:00
|
|
|
#include "../Input.h"
|
2016-12-16 00:16:02 +01:00
|
|
|
#include "../OpenRCT2.h"
|
2018-11-19 23:10:54 +01:00
|
|
|
#include "../Version.h"
|
2017-09-18 17:05:28 +02:00
|
|
|
#include "../audio/audio.h"
|
2018-06-22 23:15:14 +02:00
|
|
|
#include "../config/Config.h"
|
|
|
|
#include "../core/Console.hpp"
|
2018-01-05 22:17:33 +01:00
|
|
|
#include "../drawing/Drawing.h"
|
2018-06-22 23:15:14 +02:00
|
|
|
#include "../interface/Screenshot.h"
|
2018-01-06 00:45:53 +01:00
|
|
|
#include "../interface/Viewport.h"
|
2018-01-06 01:05:16 +01:00
|
|
|
#include "../interface/Window.h"
|
2018-01-06 18:32:25 +01:00
|
|
|
#include "../localisation/Localisation.h"
|
2021-08-17 05:33:50 +02:00
|
|
|
#include "../network/NetworkBase.h"
|
2018-06-22 23:15:14 +02:00
|
|
|
#include "../network/network.h"
|
|
|
|
#include "../scenario/Scenario.h"
|
|
|
|
#include "../scenario/ScenarioRepository.h"
|
2018-06-02 13:33:20 +02:00
|
|
|
#include "../ui/UiContext.h"
|
2019-12-19 20:55:04 +01:00
|
|
|
#include "../util/Util.h"
|
2018-06-22 23:15:14 +02:00
|
|
|
#include "TitleSequence.h"
|
|
|
|
#include "TitleSequenceManager.h"
|
|
|
|
#include "TitleSequencePlayer.h"
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2017-07-23 01:19:09 +02:00
|
|
|
using namespace OpenRCT2;
|
|
|
|
|
2017-07-23 00:42:14 +02:00
|
|
|
// TODO Remove when no longer required.
|
2018-06-02 13:33:20 +02:00
|
|
|
bool gPreviewingTitleSequenceInGame;
|
2018-06-22 23:15:14 +02:00
|
|
|
static TitleScreen* _singleton = nullptr;
|
2017-07-23 00:42:14 +02:00
|
|
|
|
2018-05-31 13:49:09 +02:00
|
|
|
TitleScreen::TitleScreen(GameState& gameState)
|
2017-07-23 01:19:09 +02:00
|
|
|
: _gameState(gameState)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
|
|
|
_singleton = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
TitleScreen::~TitleScreen()
|
|
|
|
{
|
|
|
|
_singleton = nullptr;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
ITitleSequencePlayer* TitleScreen::GetSequencePlayer()
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
|
|
|
return _sequencePlayer;
|
|
|
|
}
|
|
|
|
|
2017-10-31 02:16:36 +01:00
|
|
|
size_t TitleScreen::GetCurrentSequence()
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
|
|
|
return _currentSequence;
|
|
|
|
}
|
|
|
|
|
2017-11-02 18:36:37 +01:00
|
|
|
bool TitleScreen::PreviewSequence(size_t value)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
|
|
|
_currentSequence = value;
|
2017-11-02 18:36:37 +01:00
|
|
|
_previewingSequence = TryLoadSequence(true);
|
|
|
|
if (_previewingSequence)
|
2017-10-30 12:07:01 +01:00
|
|
|
{
|
2017-11-02 18:36:37 +01:00
|
|
|
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
|
|
|
{
|
|
|
|
gPreviewingTitleSequenceInGame = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_currentSequence = title_get_config_sequence();
|
|
|
|
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
|
|
|
{
|
|
|
|
TryLoadSequence();
|
|
|
|
}
|
2017-10-30 12:07:01 +01:00
|
|
|
}
|
2017-11-02 18:36:37 +01:00
|
|
|
return _previewingSequence;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleScreen::StopPreviewingSequence()
|
|
|
|
{
|
|
|
|
if (_previewingSequence)
|
|
|
|
{
|
2018-06-22 23:15:14 +02:00
|
|
|
rct_window* mainWindow = window_get_main();
|
2017-11-03 17:02:12 +01:00
|
|
|
if (mainWindow != nullptr)
|
|
|
|
{
|
|
|
|
window_unfollow_sprite(mainWindow);
|
|
|
|
}
|
2017-11-02 18:36:37 +01:00
|
|
|
_previewingSequence = false;
|
|
|
|
_currentSequence = title_get_config_sequence();
|
|
|
|
gPreviewingTitleSequenceInGame = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TitleScreen::IsPreviewingSequence()
|
|
|
|
{
|
|
|
|
return _previewingSequence;
|
2017-07-23 00:42:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool TitleScreen::ShouldHideVersionInfo()
|
|
|
|
{
|
|
|
|
return _hideVersionInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleScreen::SetHideVersionInfo(bool value)
|
|
|
|
{
|
|
|
|
_hideVersionInfo = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleScreen::Load()
|
|
|
|
{
|
|
|
|
log_verbose("TitleScreen::Load()");
|
|
|
|
|
|
|
|
if (game_is_paused())
|
|
|
|
{
|
|
|
|
pause_toggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
gScreenFlags = SCREEN_FLAGS_TITLE_DEMO;
|
|
|
|
gScreenAge = 0;
|
2018-12-15 19:39:00 +01:00
|
|
|
gCurrentLoadedPath = "";
|
2017-07-23 00:42:14 +02:00
|
|
|
|
2021-08-17 09:36:18 +02:00
|
|
|
#ifndef DISABLE_NETWORK
|
2021-08-17 05:33:50 +02:00
|
|
|
GetContext()->GetNetwork().Close();
|
2021-08-17 09:36:18 +02:00
|
|
|
#endif
|
2020-10-06 23:34:42 +02:00
|
|
|
OpenRCT2::Audio::StopAll();
|
2018-05-27 17:11:54 +02:00
|
|
|
GetContext()->GetGameState()->InitAll(150);
|
2017-07-23 00:42:14 +02:00
|
|
|
viewport_init_all();
|
2017-08-12 23:06:12 +02:00
|
|
|
context_open_window(WC_MAIN_WINDOW);
|
2017-07-23 00:42:14 +02:00
|
|
|
CreateWindows();
|
|
|
|
TitleInitialise();
|
2020-10-06 23:34:42 +02:00
|
|
|
OpenRCT2::Audio::PlayTitleMusic();
|
2017-07-23 00:42:14 +02:00
|
|
|
|
|
|
|
if (gOpenRCT2ShowChangelog)
|
|
|
|
{
|
|
|
|
gOpenRCT2ShowChangelog = false;
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_CHANGELOG);
|
2017-07-23 00:42:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_sequencePlayer != nullptr)
|
|
|
|
{
|
2017-10-30 12:07:01 +01:00
|
|
|
_sequencePlayer->Begin(_currentSequence);
|
2017-07-23 00:42:14 +02:00
|
|
|
|
|
|
|
// Force the title sequence to load / update so we
|
|
|
|
// don't see a blank screen for a split second.
|
|
|
|
TryLoadSequence();
|
|
|
|
_sequencePlayer->Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
log_verbose("TitleScreen::Load() finished");
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleScreen::Update()
|
2016-11-21 01:16:47 +01:00
|
|
|
{
|
2017-07-23 00:42:14 +02:00
|
|
|
gInUpdateCode = true;
|
|
|
|
|
|
|
|
screenshot_check();
|
|
|
|
title_handle_keyboard_input();
|
|
|
|
|
|
|
|
if (game_is_not_paused())
|
|
|
|
{
|
|
|
|
TryLoadSequence();
|
|
|
|
_sequencePlayer->Update();
|
|
|
|
|
2018-06-20 17:28:51 +02:00
|
|
|
int32_t numUpdates = 1;
|
2018-06-22 23:15:14 +02:00
|
|
|
if (gGameSpeed > 1)
|
|
|
|
{
|
2017-07-23 00:42:14 +02:00
|
|
|
numUpdates = 1 << (gGameSpeed - 1);
|
|
|
|
}
|
2018-06-20 17:28:51 +02:00
|
|
|
for (int32_t i = 0; i < numUpdates; i++)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
2018-05-31 13:49:09 +02:00
|
|
|
_gameState.UpdateLogic();
|
2017-07-23 00:42:14 +02:00
|
|
|
}
|
|
|
|
update_palette_effects();
|
2020-09-14 21:36:30 +02:00
|
|
|
// update_weather_animation();
|
2017-07-23 00:42:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
input_set_flag(INPUT_FLAG_VIEWPORT_SCROLLING, false);
|
|
|
|
|
2017-10-21 17:57:37 +02:00
|
|
|
context_update_map_tooltip();
|
2017-07-23 00:42:14 +02:00
|
|
|
window_dispatch_update_all();
|
|
|
|
|
|
|
|
gSavedAge++;
|
|
|
|
|
2017-12-07 22:16:20 +01:00
|
|
|
context_handle_input();
|
2017-07-23 00:42:14 +02:00
|
|
|
|
|
|
|
gInUpdateCode = false;
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|
|
|
|
|
2017-11-02 18:36:37 +01:00
|
|
|
void TitleScreen::ChangePresetSequence(size_t preset)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
2017-11-02 18:36:37 +01:00
|
|
|
size_t count = TitleSequenceManager::GetCount();
|
2017-10-31 17:57:16 +01:00
|
|
|
if (preset >= count)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
const utf8* configId = title_sequence_manager_get_config_id(preset);
|
2017-07-23 00:42:14 +02:00
|
|
|
SafeFree(gConfigInterface.current_title_sequence_preset);
|
|
|
|
gConfigInterface.current_title_sequence_preset = _strdup(configId);
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2017-11-02 18:36:37 +01:00
|
|
|
if (!_previewingSequence)
|
|
|
|
_currentSequence = preset;
|
2017-07-23 00:42:14 +02:00
|
|
|
window_invalidate_all();
|
|
|
|
}
|
2016-11-21 01:16:47 +01:00
|
|
|
|
|
|
|
/**
|
2017-07-23 00:42:14 +02:00
|
|
|
* Creates the windows shown on the title screen; New game, load game,
|
|
|
|
* tutorial, toolbox and exit.
|
2016-11-21 01:16:47 +01:00
|
|
|
*/
|
2017-07-23 00:42:14 +02:00
|
|
|
void TitleScreen::CreateWindows()
|
|
|
|
{
|
2017-08-06 05:22:00 +02:00
|
|
|
context_open_window(WC_TITLE_MENU);
|
|
|
|
context_open_window(WC_TITLE_EXIT);
|
|
|
|
context_open_window(WC_TITLE_OPTIONS);
|
|
|
|
context_open_window(WC_TITLE_LOGO);
|
2017-07-23 00:42:14 +02:00
|
|
|
window_resize_gui(context_get_width(), context_get_height());
|
|
|
|
_hideVersionInfo = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleScreen::TitleInitialise()
|
2016-11-21 01:16:47 +01:00
|
|
|
{
|
|
|
|
if (_sequencePlayer == nullptr)
|
|
|
|
{
|
2018-06-02 13:33:20 +02:00
|
|
|
_sequencePlayer = GetContext()->GetUiContext()->GetTitleSequencePlayer();
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|
2019-12-19 20:55:04 +01:00
|
|
|
if (gConfigInterface.random_title_sequence)
|
|
|
|
{
|
|
|
|
bool RCT1Installed = false, RCT1AAInstalled = false, RCT1LLInstalled = false;
|
|
|
|
int RCT1Count = 0;
|
|
|
|
size_t scenarioCount = scenario_repository_get_count();
|
2020-01-20 22:35:51 +01:00
|
|
|
|
|
|
|
for (size_t s = 0; s < scenarioCount; s++)
|
|
|
|
{
|
2020-08-08 14:38:43 +02:00
|
|
|
if (scenario_repository_get_by_index(s)->source_game == ScenarioSource::RCT1)
|
2020-01-20 22:35:51 +01:00
|
|
|
{
|
2019-12-19 20:55:04 +01:00
|
|
|
RCT1Count++;
|
|
|
|
}
|
2020-08-08 14:38:43 +02:00
|
|
|
if (scenario_repository_get_by_index(s)->source_game == ScenarioSource::RCT1_AA)
|
2020-01-20 22:35:51 +01:00
|
|
|
{
|
2019-12-19 20:55:04 +01:00
|
|
|
RCT1AAInstalled = true;
|
|
|
|
}
|
2020-08-08 14:38:43 +02:00
|
|
|
if (scenario_repository_get_by_index(s)->source_game == ScenarioSource::RCT1_LL)
|
2020-01-20 22:35:51 +01:00
|
|
|
{
|
2019-12-19 20:55:04 +01:00
|
|
|
RCT1LLInstalled = true;
|
|
|
|
}
|
|
|
|
}
|
2020-01-20 22:35:51 +01:00
|
|
|
|
|
|
|
// Mega Park can show up in the scenario list even if RCT1 has been uninstalled, so it must be greater than 1
|
|
|
|
if (RCT1Count > 1)
|
|
|
|
{
|
2019-12-19 20:55:04 +01:00
|
|
|
RCT1Installed = true;
|
|
|
|
}
|
2020-01-20 22:35:51 +01:00
|
|
|
|
2019-12-19 20:55:04 +01:00
|
|
|
int32_t random = 0;
|
|
|
|
bool safeSequence = false;
|
2020-09-30 23:42:04 +02:00
|
|
|
std::string RCT1String = format_string(STR_TITLE_SEQUENCE_RCT1, nullptr);
|
|
|
|
std::string RCT1AAString = format_string(STR_TITLE_SEQUENCE_RCT1_AA, nullptr);
|
|
|
|
std::string RCT1LLString = format_string(STR_TITLE_SEQUENCE_RCT1_AA_LL, nullptr);
|
2020-01-20 22:35:51 +01:00
|
|
|
|
|
|
|
// Ensure the random sequence chosen isn't from RCT1 or expansion if the player doesn't have it installed
|
|
|
|
while (!safeSequence)
|
|
|
|
{
|
2019-12-19 20:55:04 +01:00
|
|
|
size_t total = TitleSequenceManager::GetCount();
|
2020-04-17 19:45:19 +02:00
|
|
|
random = util_rand() % static_cast<int32_t>(total);
|
2019-12-19 20:55:04 +01:00
|
|
|
const utf8* scName = title_sequence_manager_get_name(random);
|
|
|
|
safeSequence = true;
|
2020-01-20 22:35:51 +01:00
|
|
|
if (scName == RCT1String)
|
|
|
|
{
|
2019-12-19 20:55:04 +01:00
|
|
|
safeSequence = RCT1Installed;
|
2020-01-20 22:35:51 +01:00
|
|
|
}
|
|
|
|
if (scName == RCT1AAString)
|
|
|
|
{
|
2019-12-19 20:55:04 +01:00
|
|
|
safeSequence = RCT1AAInstalled;
|
2020-01-20 22:35:51 +01:00
|
|
|
}
|
|
|
|
if (scName == RCT1LLString)
|
|
|
|
{
|
2019-12-19 20:55:04 +01:00
|
|
|
safeSequence = RCT1LLInstalled;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ChangePresetSequence(random);
|
|
|
|
}
|
2017-10-30 12:07:01 +01:00
|
|
|
size_t seqId = title_get_config_sequence();
|
2016-11-21 01:16:47 +01:00
|
|
|
if (seqId == SIZE_MAX)
|
|
|
|
{
|
|
|
|
seqId = title_sequence_manager_get_index_for_config_id("*OPENRCT2");
|
|
|
|
if (seqId == SIZE_MAX)
|
|
|
|
{
|
|
|
|
seqId = 0;
|
|
|
|
}
|
|
|
|
}
|
2020-04-17 19:45:19 +02:00
|
|
|
ChangePresetSequence(static_cast<int32_t>(seqId));
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|
|
|
|
|
2017-11-02 18:36:37 +01:00
|
|
|
bool TitleScreen::TryLoadSequence(bool loadPreview)
|
2016-11-21 01:16:47 +01:00
|
|
|
{
|
2017-11-02 18:36:37 +01:00
|
|
|
if (_loadedTitleSequenceId != _currentSequence || loadPreview)
|
2016-11-21 01:16:47 +01:00
|
|
|
{
|
2021-01-28 01:50:30 +01:00
|
|
|
if (_sequencePlayer == nullptr)
|
|
|
|
{
|
|
|
|
_sequencePlayer = GetContext()->GetUiContext()->GetTitleSequencePlayer();
|
|
|
|
}
|
|
|
|
|
2017-10-31 02:16:36 +01:00
|
|
|
size_t numSequences = TitleSequenceManager::GetCount();
|
2016-12-24 01:53:33 +01:00
|
|
|
if (numSequences > 0)
|
2016-11-21 01:16:47 +01:00
|
|
|
{
|
2017-10-31 02:16:36 +01:00
|
|
|
size_t targetSequence = _currentSequence;
|
2016-12-24 01:53:33 +01:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (_sequencePlayer->Begin(targetSequence) && _sequencePlayer->Update())
|
|
|
|
{
|
|
|
|
_loadedTitleSequenceId = targetSequence;
|
2017-11-02 18:36:37 +01:00
|
|
|
if (targetSequence != _currentSequence && !loadPreview)
|
|
|
|
{
|
|
|
|
// Forcefully change the preset to a preset that works.
|
2018-06-22 23:15:14 +02:00
|
|
|
const utf8* configId = title_sequence_manager_get_config_id(targetSequence);
|
2017-11-02 18:36:37 +01:00
|
|
|
SafeFree(gConfigInterface.current_title_sequence_preset);
|
|
|
|
gConfigInterface.current_title_sequence_preset = _strdup(configId);
|
|
|
|
}
|
2017-07-23 00:42:14 +02:00
|
|
|
_currentSequence = targetSequence;
|
2016-12-24 01:53:33 +01:00
|
|
|
gfx_invalidate_screen();
|
2017-11-02 18:36:37 +01:00
|
|
|
return true;
|
2016-12-24 01:53:33 +01:00
|
|
|
}
|
|
|
|
targetSequence = (targetSequence + 1) % numSequences;
|
2018-06-22 23:15:14 +02:00
|
|
|
} while (targetSequence != _currentSequence && !loadPreview);
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|
2016-12-24 01:53:33 +01:00
|
|
|
Console::Error::WriteLine("Unable to play any title sequences.");
|
|
|
|
_sequencePlayer->Eject();
|
2017-10-31 02:16:36 +01:00
|
|
|
_currentSequence = SIZE_MAX;
|
|
|
|
_loadedTitleSequenceId = SIZE_MAX;
|
2017-11-02 18:36:37 +01:00
|
|
|
if (!loadPreview)
|
|
|
|
{
|
2018-05-27 17:11:54 +02:00
|
|
|
GetContext()->GetGameState()->InitAll(150);
|
2017-11-02 18:36:37 +01:00
|
|
|
}
|
|
|
|
return false;
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|
2017-11-02 18:36:37 +01:00
|
|
|
return true;
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
void title_load()
|
2016-11-21 01:16:47 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
if (_singleton != nullptr)
|
2016-11-21 01:16:47 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
_singleton->Load();
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
void title_create_windows()
|
|
|
|
{
|
|
|
|
if (_singleton != nullptr)
|
2016-11-21 01:16:47 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
_singleton->CreateWindows();
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
void* title_get_sequence_player()
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2018-06-22 23:15:14 +02:00
|
|
|
void* result = nullptr;
|
2018-02-01 18:49:14 +01:00
|
|
|
if (_singleton != nullptr)
|
2016-11-21 01:16:47 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
result = _singleton->GetSequencePlayer();
|
2017-07-23 00:42:14 +02:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
return result;
|
|
|
|
}
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
void title_sequence_change_preset(size_t preset)
|
|
|
|
{
|
|
|
|
if (_singleton != nullptr)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
_singleton->ChangePresetSequence(preset);
|
2017-07-23 00:42:14 +02:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
bool title_should_hide_version_info()
|
|
|
|
{
|
|
|
|
bool result = false;
|
|
|
|
if (_singleton != nullptr)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
result = _singleton->ShouldHideVersionInfo();
|
2017-07-23 00:42:14 +02:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
return result;
|
|
|
|
}
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
void title_set_hide_version_info(bool value)
|
|
|
|
{
|
|
|
|
if (_singleton != nullptr)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
_singleton->SetHideVersionInfo(value);
|
2017-07-23 00:42:14 +02:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
size_t title_get_config_sequence()
|
|
|
|
{
|
|
|
|
return title_sequence_manager_get_index_for_config_id(gConfigInterface.current_title_sequence_preset);
|
|
|
|
}
|
2017-10-30 12:07:01 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
size_t title_get_current_sequence()
|
|
|
|
{
|
|
|
|
size_t result = 0;
|
|
|
|
if (_singleton != nullptr)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
result = _singleton->GetCurrentSequence();
|
2017-07-23 00:42:14 +02:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
return result;
|
|
|
|
}
|
2017-06-19 17:41:28 +02:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
bool title_preview_sequence(size_t value)
|
|
|
|
{
|
|
|
|
if (_singleton != nullptr)
|
2017-11-02 18:36:37 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return _singleton->PreviewSequence(value);
|
2017-11-02 18:36:37 +01:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
return false;
|
|
|
|
}
|
2017-11-02 18:36:37 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
void title_stop_previewing_sequence()
|
|
|
|
{
|
|
|
|
if (_singleton != nullptr)
|
2017-11-02 18:36:37 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
_singleton->StopPreviewingSequence();
|
2017-11-02 18:36:37 +01:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
2017-11-02 18:36:37 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
bool title_is_previewing_sequence()
|
|
|
|
{
|
|
|
|
if (_singleton != nullptr)
|
2017-07-23 00:42:14 +02:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return _singleton->IsPreviewingSequence();
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
return false;
|
|
|
|
}
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2020-06-21 21:30:58 +02:00
|
|
|
void DrawOpenRCT2(rct_drawpixelinfo* dpi, const ScreenCoordsXY& screenCoords)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
2020-10-16 01:13:52 +02:00
|
|
|
thread_local std::string buffer;
|
|
|
|
buffer.clear();
|
2021-03-27 14:40:17 +01:00
|
|
|
buffer.assign("{OUTLINE}{WHITE}");
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
// Write name and version information
|
2020-10-16 01:13:52 +02:00
|
|
|
buffer += gVersionInfoFull;
|
2021-02-27 18:35:32 +01:00
|
|
|
gfx_draw_string(dpi, screenCoords + ScreenCoordsXY(5, 5 - 13), buffer.c_str(), { COLOUR_BLACK });
|
2016-11-21 01:16:47 +01:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
// Invalidate screen area
|
2021-02-27 18:15:44 +01:00
|
|
|
int16_t width = static_cast<int16_t>(gfx_get_string_width(buffer, FontSpriteBase::MEDIUM));
|
2020-06-21 21:30:58 +02:00
|
|
|
gfx_set_dirty_blocks(
|
2020-07-08 18:16:24 +02:00
|
|
|
{ screenCoords, screenCoords + ScreenCoordsXY{ width, 30 } }); // 30 is an arbitrary height to catch both strings
|
2017-07-18 00:47:21 +02:00
|
|
|
|
2018-02-01 18:49:14 +01:00
|
|
|
// Write platform information
|
2021-03-27 14:40:17 +01:00
|
|
|
buffer.assign("{OUTLINE}{WHITE}");
|
2020-11-22 01:56:04 +01:00
|
|
|
buffer.append(OPENRCT2_PLATFORM);
|
2020-10-16 01:13:52 +02:00
|
|
|
buffer.append(" (");
|
|
|
|
buffer.append(OPENRCT2_ARCHITECTURE);
|
|
|
|
buffer.append(")");
|
2021-02-27 18:35:32 +01:00
|
|
|
gfx_draw_string(dpi, screenCoords + ScreenCoordsXY(5, 5), buffer.c_str(), { COLOUR_BLACK });
|
2016-11-21 01:16:47 +01:00
|
|
|
}
|