1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 12:33:17 +01:00

Feature: Preview title sequences in-game

Title sequences can now be played back in-game, allowing for much easier
editing.

Improved title sequence playback in general. Clicking play while on a
different title sequence will play the new one. Clicking stop will make
the title screen go back to the config title sequence. And the closing
the title sequence window will also make the game go back to the config
title sequence, and reload the sequence if it was modified.

Changes made to title sequences in-game are now correctly loaded in the
title screen.

Starting a title sequence within the editor will now always reset it
even if it's the current playing sequence. (Not for playing in the
editor though).

Get Location in title sequence command editor now has 100% accuracy
compared to before
where it would usually get some offset value.

Added `get_map_coordinates_from_pos_window` which will allow getting the
viewport coordinates of a specific window even if the input coordinates
are under another window. This has use with getting 2D positions from
the main window without the other windows getting in the way.

Options window will now always specify the config title sequence in the
dropdown and not the current title sequence.

Made a global variable `gLoadKeepWindowsOpen`, in game.h to keep windows
open when loading a park. When loading a title sequence park in-game.
The sequence player will force-close all park-specific windows ahead of
time.

Skipping while testing title sequences no longer needs to reload the
park if the current playback position is already before the target
position and ahead of the load position.

Added changelog entry.
This commit is contained in:
Robert Jordan
2017-10-30 07:07:01 -04:00
committed by Michael Steenbeek
parent dd4f5ff93b
commit a3c64bb146
15 changed files with 226 additions and 103 deletions

View File

@@ -377,12 +377,87 @@ namespace OpenRCT2
return true;
}
bool LoadParkFromFile(const std::string &path, bool loadTitleScreenOnFail = false) final override
bool LoadParkFromFile(const std::string &path, bool loadTitleScreenOnFail) final override
{
auto fs = FileStream(path, FILE_MODE_OPEN);
return LoadParkFromStream(&fs, path, loadTitleScreenOnFail);
}
bool LoadParkFromStream(IStream * stream, const std::string &path, bool loadTitleScreenFirstOnFail) final override
{
ClassifiedFileInfo info;
if (TryClassifyFile(stream, &info))
{
if (info.Type == FILE_TYPE::SAVED_GAME ||
info.Type == FILE_TYPE::SCENARIO)
{
std::unique_ptr<IParkImporter> parkImporter;
if (info.Version <= FILE_TYPE_S4_CUTOFF)
{
// Save is an S4 (RCT1 format)
parkImporter.reset(ParkImporter::CreateS4());
}
else
{
// Save is an S6 (RCT2 format)
parkImporter.reset(ParkImporter::CreateS6(_objectRepository, _objectManager));
}
auto result = parkImporter->LoadFromStream(stream, info.Type == FILE_TYPE::SCENARIO, false, path.c_str());
if (result.Error == PARK_LOAD_ERROR_OK)
{
parkImporter->Import();
game_fix_save_vars();
sprite_position_tween_reset();
gScreenAge = 0;
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
if (info.Type == FILE_TYPE::SAVED_GAME)
{
if (network_get_mode() == NETWORK_MODE_CLIENT)
{
network_close();
}
game_load_init();
if (network_get_mode() == NETWORK_MODE_SERVER)
{
network_send_map();
}
}
else
{
scenario_begin();
if (network_get_mode() == NETWORK_MODE_SERVER)
{
network_send_map();
}
if (network_get_mode() == NETWORK_MODE_CLIENT)
{
network_close();
}
}
// This ensures that the newly loaded save reflects the user's
// 'show real names of guests' option, now that it's a global setting
peep_update_names(gConfigGeneral.show_real_names_of_guests);
return true;
}
else
{
handle_park_load_failure_with_title_opt(&result, path.c_str(), loadTitleScreenFirstOnFail);
}
}
else
{
Console::Error::WriteLine("Invalid file type.");
}
}
else
{
Console::Error::WriteLine("Unable to detect file type.");
}
return false;
}
private:
std::string GetOrPromptRCT2Path()
{
@@ -701,81 +776,6 @@ namespace OpenRCT2
console_update();
}
bool LoadParkFromStream(IStream * stream, const std::string &path, bool loadTitleScreenFirstOnFail)
{
ClassifiedFileInfo info;
if (TryClassifyFile(stream, &info))
{
if (info.Type == FILE_TYPE::SAVED_GAME ||
info.Type == FILE_TYPE::SCENARIO)
{
std::unique_ptr<IParkImporter> parkImporter;
if (info.Version <= FILE_TYPE_S4_CUTOFF)
{
// Save is an S4 (RCT1 format)
parkImporter.reset(ParkImporter::CreateS4());
}
else
{
// Save is an S6 (RCT2 format)
parkImporter.reset(ParkImporter::CreateS6(_objectRepository, _objectManager));
}
auto result = parkImporter->LoadFromStream(stream, info.Type == FILE_TYPE::SCENARIO, false, path.c_str());
if (result.Error == PARK_LOAD_ERROR_OK)
{
parkImporter->Import();
game_fix_save_vars();
sprite_position_tween_reset();
gScreenAge = 0;
gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
if (info.Type == FILE_TYPE::SAVED_GAME)
{
if (network_get_mode() == NETWORK_MODE_CLIENT)
{
network_close();
}
game_load_init();
if (network_get_mode() == NETWORK_MODE_SERVER)
{
network_send_map();
}
}
else
{
scenario_begin();
if (network_get_mode() == NETWORK_MODE_SERVER)
{
network_send_map();
}
if (network_get_mode() == NETWORK_MODE_CLIENT)
{
network_close();
}
}
// This ensures that the newly loaded save reflects the user's
// 'show real names of guests' option, now that it's a global setting
peep_update_names(gConfigGeneral.show_real_names_of_guests);
return true;
}
else
{
handle_park_load_failure_with_title_opt(&result, path.c_str(), loadTitleScreenFirstOnFail);
}
}
else
{
Console::Error::WriteLine("Invalid file type.");
}
}
else
{
Console::Error::WriteLine("Unable to detect file type.");
}
return false;
}
/**
* Copy saved games and landscapes to user directory
*/
@@ -880,6 +880,11 @@ extern "C"
return GetContext()->LoadParkFromFile(path);
}
bool context_load_park_from_stream(void * stream)
{
return GetContext()->LoadParkFromStream((IStream*)stream, "");
}
void openrct2_write_full_version_info(utf8 * buffer, size_t bufferSize)
{
String::Set(buffer, bufferSize, gVersionInfoFull);