mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 06:44:38 +01:00
Remove old title sequence code
This commit is contained in:
@@ -151,7 +151,6 @@
|
||||
<ClCompile Include="src\interface\graph.c" />
|
||||
<ClCompile Include="src\interface\keyboard_shortcut.c" />
|
||||
<ClCompile Include="src\interface\screenshot.c" />
|
||||
<ClCompile Include="src\interface\title_sequences.c" />
|
||||
<ClCompile Include="src\interface\viewport.c" />
|
||||
<ClCompile Include="src\interface\viewport_interaction.c" />
|
||||
<ClCompile Include="src\interface\widget.c" />
|
||||
@@ -488,7 +487,6 @@
|
||||
<ClInclude Include="src\interface\graph.h" />
|
||||
<ClInclude Include="src\interface\keyboard_shortcut.h" />
|
||||
<ClInclude Include="src\interface\screenshot.h" />
|
||||
<ClInclude Include="src\interface\title_sequences.h" />
|
||||
<ClInclude Include="src\interface\viewport.h" />
|
||||
<ClInclude Include="src\interface\widget.h" />
|
||||
<ClInclude Include="src\interface\window.h" />
|
||||
|
||||
@@ -1,377 +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 "../localisation/string_ids.h"
|
||||
#include "../rct2.h"
|
||||
#include "../title/TitleScreen.h"
|
||||
#include "../title/TitleSequence.h"
|
||||
#include "../title/TitleSequenceManager.h"
|
||||
#include "../util/util.h"
|
||||
#include "title_sequences.h"
|
||||
#include "window.h"
|
||||
|
||||
|
||||
uint16 gCurrentTitleSequence;
|
||||
uint16 gCurrentPreviewTitleSequence;
|
||||
|
||||
TitleCommand TitleScriptMakeCommand(int command, int parameter1, int parameter2)
|
||||
{
|
||||
// TitleCommand titleCommand = { (uint8)command, (uint8)parameter1, (uint8)parameter2 };
|
||||
TitleCommand titleCommand = { 0 };
|
||||
return titleCommand;
|
||||
}
|
||||
|
||||
bool title_sequence_name_exists(const char *name)
|
||||
{
|
||||
size_t count = title_sequence_manager_get_count();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
if (_stricmp(title_sequence_manager_get_name(i), name) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool title_sequence_save_exists(int preset, const char *name)
|
||||
{
|
||||
return false;
|
||||
#if 0
|
||||
utf8 newName[MAX_PATH];
|
||||
const char *extension = path_get_extension(name);
|
||||
safe_strcpy(newName, name, MAX_PATH);
|
||||
if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
|
||||
path_append_extension(newName, ".sv6", MAX_PATH);
|
||||
for (int i = 0; i < gConfigTitleSequences.presets[preset].num_saves; i++) {
|
||||
if (_stricmp(gConfigTitleSequences.presets[preset].saves[i], newName) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void title_sequence_change_preset(int preset)
|
||||
{
|
||||
int count = (int)title_sequence_manager_get_count();
|
||||
if (preset < 0 || preset >= count) {
|
||||
return;
|
||||
}
|
||||
|
||||
const utf8 * configId = title_sequence_manager_get_config_id(preset);
|
||||
SafeFree(gConfigInterface.current_title_sequence_preset);
|
||||
gConfigInterface.current_title_sequence_preset = _strdup(configId);
|
||||
|
||||
gCurrentPreviewTitleSequence = preset;
|
||||
window_invalidate_all();
|
||||
}
|
||||
|
||||
void title_sequence_create_preset(const char *name)
|
||||
{
|
||||
#if 0
|
||||
if (filename_valid_characters(name) && !title_sequence_name_exists(name)) {
|
||||
int preset = gConfigTitleSequences.num_presets;
|
||||
gConfigTitleSequences.num_presets++;
|
||||
gConfigTitleSequences.presets = realloc(gConfigTitleSequences.presets, sizeof(title_sequence) * (size_t)gConfigTitleSequences.num_presets);
|
||||
safe_strcpy(gConfigTitleSequences.presets[preset].name, name, TITLE_SEQUENCE_NAME_SIZE);
|
||||
gConfigTitleSequences.presets[preset].path[0] = 0;
|
||||
|
||||
gConfigTitleSequences.presets[preset].saves = NULL;
|
||||
gConfigTitleSequences.presets[preset].commands = NULL;
|
||||
gConfigTitleSequences.presets[preset].num_saves = 0;
|
||||
gConfigTitleSequences.presets[preset].num_commands = 0;
|
||||
|
||||
// Create the folder
|
||||
utf8 path[MAX_PATH];
|
||||
platform_get_user_directory(path, "title sequences", sizeof(path));
|
||||
safe_strcat_path(path, gConfigTitleSequences.presets[preset].name, MAX_PATH);
|
||||
platform_file_delete(path);
|
||||
platform_ensure_directory_exists(path);
|
||||
|
||||
title_sequence_save_preset_script(preset);
|
||||
gCurrentTitleSequence = preset;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void title_sequence_duplicate_preset(int duplicate, const char *name)
|
||||
{
|
||||
#if 0
|
||||
if (duplicate >= 0 && duplicate < gConfigTitleSequences.num_presets && filename_valid_characters(name) && !title_sequence_name_exists(name)) {
|
||||
int preset = gConfigTitleSequences.num_presets;
|
||||
gConfigTitleSequences.num_presets++;
|
||||
gConfigTitleSequences.presets = realloc(gConfigTitleSequences.presets, sizeof(title_sequence) * (size_t)gConfigTitleSequences.num_presets);
|
||||
safe_strcpy(gConfigTitleSequences.presets[preset].name, name, TITLE_SEQUENCE_NAME_SIZE);
|
||||
gConfigTitleSequences.presets[preset].path[0] = 0;
|
||||
|
||||
size_t savesSize = sizeof(char[TITLE_SEQUENCE_MAX_SAVE_LENGTH]) * gConfigTitleSequences.presets[duplicate].num_saves;
|
||||
size_t commandsSize = sizeof(TitleCommand) * gConfigTitleSequences.presets[duplicate].num_commands;
|
||||
gConfigTitleSequences.presets[preset].saves = malloc(savesSize);
|
||||
gConfigTitleSequences.presets[preset].commands = malloc(commandsSize);
|
||||
memcpy(gConfigTitleSequences.presets[preset].saves, gConfigTitleSequences.presets[duplicate].saves, savesSize);
|
||||
memcpy(gConfigTitleSequences.presets[preset].commands, gConfigTitleSequences.presets[duplicate].commands, commandsSize);
|
||||
gConfigTitleSequences.presets[preset].num_saves = gConfigTitleSequences.presets[duplicate].num_saves;
|
||||
gConfigTitleSequences.presets[preset].num_commands = gConfigTitleSequences.presets[duplicate].num_commands;
|
||||
|
||||
bool loadmm = false;
|
||||
for (int i = 0; i < gConfigTitleSequences.presets[preset].num_commands; i++) {
|
||||
if (gConfigTitleSequences.presets[preset].commands[i].command == TITLE_SCRIPT_LOADMM) {
|
||||
loadmm = true;
|
||||
gConfigTitleSequences.presets[preset].commands[i].command = TITLE_SCRIPT_LOAD;
|
||||
gConfigTitleSequences.presets[preset].commands[i].saveIndex = gConfigTitleSequences.presets[duplicate].num_saves;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the folder
|
||||
utf8 path[MAX_PATH], srcPath[MAX_PATH];
|
||||
platform_get_user_directory(path, "title sequences", sizeof(path));
|
||||
safe_strcat_path(path, gConfigTitleSequences.presets[preset].name, MAX_PATH);
|
||||
platform_file_delete(path);
|
||||
platform_ensure_directory_exists(path);
|
||||
|
||||
// Copy the saves
|
||||
for (int i = 0; i < gConfigTitleSequences.presets[preset].num_saves; i++) {
|
||||
if (gConfigTitleSequences.presets[duplicate].path[0]) {
|
||||
safe_strcpy(srcPath, gConfigTitleSequences.presets[duplicate].path, MAX_PATH);
|
||||
safe_strcat_path(srcPath, gConfigTitleSequences.presets[duplicate].saves[i], MAX_PATH);
|
||||
}
|
||||
else {
|
||||
platform_get_user_directory(srcPath, "title sequences", sizeof(srcPath));
|
||||
safe_strcat_path(srcPath, gConfigTitleSequences.presets[duplicate].name, MAX_PATH);
|
||||
safe_strcat_path(srcPath, gConfigTitleSequences.presets[duplicate].saves[i], MAX_PATH);
|
||||
}
|
||||
platform_get_user_directory(path, "title sequences", sizeof(path));
|
||||
safe_strcat_path(path, gConfigTitleSequences.presets[preset].name, MAX_PATH);
|
||||
safe_strcat_path(path, gConfigTitleSequences.presets[preset].saves[i], MAX_PATH);
|
||||
|
||||
platform_file_copy(srcPath, path, false);
|
||||
}
|
||||
|
||||
if (loadmm) {
|
||||
title_sequence_add_save(preset, get_file_path(PATH_ID_SIXFLAGS_MAGICMOUNTAIN), "Six Flags Magic Mountain.SC6");
|
||||
}
|
||||
|
||||
title_sequence_save_preset_script(preset);
|
||||
gCurrentTitleSequence = preset;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void title_sequence_delete_preset(int preset)
|
||||
{
|
||||
#if 0
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets) {
|
||||
// Delete the folder
|
||||
utf8 path[MAX_PATH];
|
||||
platform_get_user_directory(path, "title sequences", sizeof(path));
|
||||
safe_strcat_path(path, gConfigTitleSequences.presets[preset].name, MAX_PATH);
|
||||
if (!platform_directory_delete(path)) {
|
||||
log_error("Failed to delete directory: \"%s\"", path);
|
||||
}
|
||||
|
||||
free(gConfigTitleSequences.presets[preset].saves);
|
||||
free(gConfigTitleSequences.presets[preset].commands);
|
||||
|
||||
for (int i = preset; i < gConfigTitleSequences.num_presets - 1; i++) {
|
||||
gConfigTitleSequences.presets[i] = gConfigTitleSequences.presets[i + 1];
|
||||
}
|
||||
gConfigTitleSequences.num_presets--;
|
||||
gConfigTitleSequences.presets = realloc(gConfigTitleSequences.presets, sizeof(title_sequence) * (size_t)gConfigTitleSequences.num_presets);
|
||||
|
||||
gCurrentTitleSequence--;
|
||||
if (gCurrentPreviewTitleSequence > preset)
|
||||
title_sequence_change_preset(gCurrentPreviewTitleSequence - 1);
|
||||
else if (gCurrentPreviewTitleSequence == preset)
|
||||
title_sequence_change_preset(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void title_sequence_rename_preset(int preset, const char *newName)
|
||||
{
|
||||
#if 0
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && filename_valid_characters(newName) && !title_sequence_name_exists(newName)) {
|
||||
// Rename the folder
|
||||
utf8 src[MAX_PATH], dest[MAX_PATH];
|
||||
platform_get_user_directory(src, "title sequences", sizeof(src));
|
||||
platform_get_user_directory(dest, "title sequences", sizeof(dest));
|
||||
safe_strcat_path(src, gConfigTitleSequences.presets[preset].name, sizeof(src));
|
||||
safe_strcat_path(dest, newName, sizeof(dest));
|
||||
platform_file_move(src, dest);
|
||||
|
||||
safe_strcpy(gConfigTitleSequences.presets[preset].name, newName, TITLE_SEQUENCE_NAME_SIZE);
|
||||
|
||||
// Rename the config preset name if needed
|
||||
if (preset == gCurrentPreviewTitleSequence) {
|
||||
gConfigInterface.current_title_sequence_preset = gConfigTitleSequences.presets[preset].name;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void title_sequence_add_save(int preset, const char *path, const char *newName)
|
||||
{
|
||||
#if 0
|
||||
utf8 newPath[MAX_PATH];
|
||||
const char *extension = path_get_extension(newName);
|
||||
safe_strcpy(newPath, newName, MAX_PATH);
|
||||
if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
|
||||
path_append_extension(newPath, ".sv6", MAX_PATH);
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && filename_valid_characters(newPath) && !title_sequence_save_exists(preset, newPath) && platform_file_exists(path)) {
|
||||
// Copy the save file
|
||||
platform_get_user_directory(newPath, "title sequences", sizeof(newPath));
|
||||
safe_strcat_path(newPath, gConfigTitleSequences.presets[preset].name, sizeof(newPath));
|
||||
safe_strcat_path(newPath, newName, sizeof(newPath));
|
||||
// Add the appropriate extension if needed
|
||||
if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
|
||||
path_append_extension(newPath, ".sv6", sizeof(newPath));
|
||||
platform_file_copy(path, newPath, false);
|
||||
|
||||
gConfigTitleSequences.presets[preset].num_saves++;
|
||||
gConfigTitleSequences.presets[preset].saves = realloc(gConfigTitleSequences.presets[preset].saves, sizeof(char[TITLE_SEQUENCE_MAX_SAVE_LENGTH]) * (size_t)gConfigTitleSequences.presets[preset].num_saves);
|
||||
|
||||
safe_strcpy(gConfigTitleSequences.presets[preset].saves[gConfigTitleSequences.presets[preset].num_saves - 1], newName, TITLE_SEQUENCE_MAX_SAVE_LENGTH);
|
||||
// Add the appropriate extension if needed
|
||||
if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
|
||||
path_append_extension(gConfigTitleSequences.presets[preset].saves[gConfigTitleSequences.presets[preset].num_saves - 1], ".sv6", TITLE_SEQUENCE_MAX_SAVE_LENGTH);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void title_sequence_remove_save(int preset, int index)
|
||||
{
|
||||
#if 0
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && index >= 0 && index < gConfigTitleSequences.presets[preset].num_saves) {
|
||||
// Delete the save file
|
||||
utf8 path[MAX_PATH];
|
||||
platform_get_user_directory(path, "title sequences", sizeof(path));
|
||||
safe_strcat_path(path, gConfigTitleSequences.presets[preset].name, sizeof(path));
|
||||
safe_strcat_path(path, gConfigTitleSequences.presets[preset].saves[index], sizeof(path));
|
||||
platform_file_delete(path);
|
||||
|
||||
// Remove all references to this save in the commands and decrement save indices
|
||||
for (int i = 0; i < gConfigTitleSequences.presets[preset].num_commands; i++) {
|
||||
if (gConfigTitleSequences.presets[preset].commands[i].command == TITLE_SCRIPT_LOAD) {
|
||||
if (gConfigTitleSequences.presets[preset].commands[i].saveIndex == index)
|
||||
gConfigTitleSequences.presets[preset].commands[i].saveIndex = 0xFF;
|
||||
else if (gConfigTitleSequences.presets[preset].commands[i].saveIndex > index && gConfigTitleSequences.presets[preset].commands[i].saveIndex != 0xFF)
|
||||
gConfigTitleSequences.presets[preset].commands[i].saveIndex--;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = index; i < gConfigTitleSequences.presets[preset].num_saves - 1; i++) {
|
||||
safe_strcpy(gConfigTitleSequences.presets[preset].saves[i], gConfigTitleSequences.presets[preset].saves[i + 1], TITLE_SEQUENCE_MAX_SAVE_LENGTH);
|
||||
}
|
||||
gConfigTitleSequences.presets[preset].num_saves--;
|
||||
gConfigTitleSequences.presets[preset].saves = realloc(gConfigTitleSequences.presets[preset].saves, sizeof(char[TITLE_SEQUENCE_MAX_SAVE_LENGTH]) * (size_t)gConfigTitleSequences.presets[preset].num_saves);
|
||||
title_sequence_save_preset_script(preset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void title_sequence_rename_save(int preset, int index, const char *newName)
|
||||
{
|
||||
#if 0
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && index >= 0 && index < gConfigTitleSequences.presets[preset].num_saves &&
|
||||
filename_valid_characters(newName) && !title_sequence_save_exists(preset, newName)) {
|
||||
|
||||
// Rename the save file
|
||||
utf8 src[MAX_PATH], dest[MAX_PATH];
|
||||
platform_get_user_directory(src, "title sequences", sizeof(src));
|
||||
platform_get_user_directory(dest, "title sequences", sizeof(dest));
|
||||
safe_strcat_path(src, gConfigTitleSequences.presets[preset].name, sizeof(src));
|
||||
safe_strcat_path(dest, gConfigTitleSequences.presets[preset].name, sizeof(dest));
|
||||
safe_strcat_path(src, gConfigTitleSequences.presets[preset].saves[index], sizeof(src));
|
||||
safe_strcat_path(dest, newName, sizeof(dest));
|
||||
// Add the appropriate extension if needed
|
||||
const char *extension = path_get_extension(newName);
|
||||
if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
|
||||
path_append_extension(dest, ".sv6", sizeof(dest));
|
||||
platform_file_move(src, dest);
|
||||
|
||||
safe_strcpy(gConfigTitleSequences.presets[preset].saves[index], newName, TITLE_SEQUENCE_MAX_SAVE_LENGTH);
|
||||
// Add the appropriate extension if needed
|
||||
if (_stricmp(extension, ".sv6") != 0 && _stricmp(extension, ".sc6") != 0)
|
||||
path_append_extension(gConfigTitleSequences.presets[preset].saves[index], ".sv6", TITLE_SEQUENCE_MAX_SAVE_LENGTH);
|
||||
title_sequence_save_preset_script(preset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void title_sequence_add_command(int preset, TitleCommand command)
|
||||
{
|
||||
#if 0
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets) {
|
||||
gConfigTitleSequences.presets[preset].commands = realloc(gConfigTitleSequences.presets[preset].commands, sizeof(TitleCommand) * (size_t)(gConfigTitleSequences.presets[preset].num_commands + 1));
|
||||
gConfigTitleSequences.presets[preset].commands[gConfigTitleSequences.presets[preset].num_commands] = command;
|
||||
gConfigTitleSequences.presets[preset].num_commands++;
|
||||
title_sequence_save_preset_script(preset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void title_sequence_insert_command(int preset, int index, TitleCommand command)
|
||||
{
|
||||
#if 0
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && index >= 0 && index <= gConfigTitleSequences.presets[preset].num_commands) {
|
||||
gConfigTitleSequences.presets[preset].commands = realloc(gConfigTitleSequences.presets[preset].commands, sizeof(TitleCommand) * (size_t)(gConfigTitleSequences.presets[preset].num_commands + 1));
|
||||
for (int i = gConfigTitleSequences.presets[preset].num_commands; i > index; i--) {
|
||||
gConfigTitleSequences.presets[preset].commands[i] = gConfigTitleSequences.presets[preset].commands[i - 1];
|
||||
}
|
||||
gConfigTitleSequences.presets[preset].commands[index] = command;
|
||||
gConfigTitleSequences.presets[preset].num_commands++;
|
||||
title_sequence_save_preset_script(preset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void title_sequence_delete_command(int preset, int index)
|
||||
{
|
||||
#if 0
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && index >= 0 && index < gConfigTitleSequences.presets[preset].num_commands) {
|
||||
for (int i = index; i < gConfigTitleSequences.presets[preset].num_commands - 1; i++) {
|
||||
gConfigTitleSequences.presets[preset].commands[i] = gConfigTitleSequences.presets[preset].commands[i + 1];
|
||||
}
|
||||
gConfigTitleSequences.presets[preset].num_commands--;
|
||||
gConfigTitleSequences.presets[preset].commands = realloc(gConfigTitleSequences.presets[preset].commands, sizeof(TitleCommand) * (size_t)gConfigTitleSequences.presets[preset].num_commands);
|
||||
title_sequence_save_preset_script(preset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void title_sequence_move_down_command(int preset, int index)
|
||||
{
|
||||
#if 0
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && index >= 0 && index + 1 < gConfigTitleSequences.presets[preset].num_commands) {
|
||||
TitleCommand command = gConfigTitleSequences.presets[preset].commands[index];
|
||||
gConfigTitleSequences.presets[preset].commands[index] = gConfigTitleSequences.presets[preset].commands[index + 1];
|
||||
gConfigTitleSequences.presets[preset].commands[index + 1] = command;
|
||||
title_sequence_save_preset_script(preset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void title_sequence_move_up_command(int preset, int index)
|
||||
{
|
||||
#if 0
|
||||
if (preset >= TITLE_SEQUENCE_DEFAULT_PRESETS && preset < gConfigTitleSequences.num_presets && index > 0 && index < gConfigTitleSequences.presets[preset].num_commands) {
|
||||
TitleCommand command = gConfigTitleSequences.presets[preset].commands[index];
|
||||
gConfigTitleSequences.presets[preset].commands[index] = gConfigTitleSequences.presets[preset].commands[index - 1];
|
||||
gConfigTitleSequences.presets[preset].commands[index - 1] = command;
|
||||
title_sequence_save_preset_script(preset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1,65 +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
|
||||
|
||||
#ifndef _TITLE_SEQUENCES_H_
|
||||
#define _TITLE_SEQUENCES_H_
|
||||
|
||||
#include "../common.h"
|
||||
#include "../config.h"
|
||||
#include "../title/TitleScreen.h"
|
||||
#include "../title/TitleSequence.h"
|
||||
#include "window.h"
|
||||
|
||||
#define TITLE_SEQUENCE_DEFAULT_PRESETS 2
|
||||
|
||||
TitleCommand TitleScriptMakeCommand(int command, int parameter1, int parameter2);
|
||||
|
||||
#define TITLE_WAIT(t) TitleScriptMakeCommand(TITLE_SCRIPT_WAIT, t, 0)
|
||||
#define TITLE_LOADMM() TitleScriptMakeCommand(TITLE_SCRIPT_LOADMM, 0, 0)
|
||||
#define TITLE_LOCATION(x, y) TitleScriptMakeCommand(TITLE_SCRIPT_LOCATION, x, y)
|
||||
#define TITLE_ROTATE(n) TitleScriptMakeCommand(TITLE_SCRIPT_ROTATE, n, 0)
|
||||
#define TITLE_ZOOM(d) TitleScriptMakeCommand(TITLE_SCRIPT_ZOOM, d, 0)
|
||||
#define TITLE_RESTART() TitleScriptMakeCommand(TITLE_SCRIPT_RESTART, 0, 0)
|
||||
#define TITLE_LOAD(i) TitleScriptMakeCommand(TITLE_SCRIPT_LOAD, i, 0)
|
||||
|
||||
// The index of the current title sequence being edited
|
||||
extern uint16 gCurrentTitleSequence;
|
||||
// The index of the current title sequence being shown
|
||||
extern uint16 gCurrentPreviewTitleSequence;
|
||||
|
||||
bool title_sequence_name_exists(const char *name);
|
||||
bool title_sequence_save_exists(int preset, const char *name);
|
||||
|
||||
// Presets
|
||||
void title_sequence_change_preset(int preset);
|
||||
void title_sequence_create_preset(const char *name);
|
||||
void title_sequence_duplicate_preset(int duplicate, const char *name);
|
||||
void title_sequence_delete_preset(int preset);
|
||||
void title_sequence_rename_preset(int preset, const char *newName);
|
||||
|
||||
// Saves
|
||||
void title_sequence_add_save(int preset, const char *path, const char *newName);
|
||||
void title_sequence_remove_save(int preset, int index);
|
||||
void title_sequence_rename_save(int preset, int index, const char *newName);
|
||||
|
||||
// Commands
|
||||
void title_sequence_add_command(int preset, TitleCommand command);
|
||||
void title_sequence_insert_command(int preset, int index, TitleCommand command);
|
||||
void title_sequence_delete_command(int preset, int index);
|
||||
void title_sequence_move_down_command(int preset, int index);
|
||||
void title_sequence_move_up_command(int preset, int index);
|
||||
|
||||
#endif
|
||||
@@ -24,11 +24,11 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "../audio/audio.h"
|
||||
#include "../config.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/screenshot.h"
|
||||
#include "../interface/title_sequences.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
@@ -40,6 +40,7 @@ extern "C"
|
||||
extern "C"
|
||||
{
|
||||
bool gTitleHideVersionInfo = false;
|
||||
uint16 gTitleCurrentSequence;
|
||||
}
|
||||
|
||||
static sint32 _sequenceAttemptId;
|
||||
@@ -75,11 +76,11 @@ static void TitleInitialise()
|
||||
|
||||
static void TryLoadSequence()
|
||||
{
|
||||
if (_loadedTitleSequenceId != gCurrentPreviewTitleSequence)
|
||||
if (_loadedTitleSequenceId != gTitleCurrentSequence)
|
||||
{
|
||||
if (_sequencePlayer->Begin(gCurrentPreviewTitleSequence))
|
||||
if (_sequencePlayer->Begin(gTitleCurrentSequence))
|
||||
{
|
||||
_loadedTitleSequenceId = gCurrentPreviewTitleSequence;
|
||||
_loadedTitleSequenceId = gTitleCurrentSequence;
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
}
|
||||
@@ -87,7 +88,7 @@ static void TryLoadSequence()
|
||||
|
||||
static void TryNextSequence()
|
||||
{
|
||||
gCurrentPreviewTitleSequence = _sequenceAttemptId++;
|
||||
gTitleCurrentSequence = _sequenceAttemptId++;
|
||||
if (_sequenceAttemptId >= (sint32)TitleSequenceManager::GetCount())
|
||||
{
|
||||
_sequenceAttemptId = 0;
|
||||
@@ -225,4 +226,19 @@ extern "C"
|
||||
{
|
||||
return _sequencePlayer;
|
||||
}
|
||||
|
||||
void title_sequence_change_preset(int preset)
|
||||
{
|
||||
int count = (int)title_sequence_manager_get_count();
|
||||
if (preset < 0 || preset >= count) {
|
||||
return;
|
||||
}
|
||||
|
||||
const utf8 * configId = title_sequence_manager_get_config_id(preset);
|
||||
SafeFree(gConfigInterface.current_title_sequence_preset);
|
||||
gConfigInterface.current_title_sequence_preset = _strdup(configId);
|
||||
|
||||
gTitleCurrentSequence = preset;
|
||||
window_invalidate_all();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
extern bool gTitleHideVersionInfo;
|
||||
extern uint16 gTitleCurrentSequence;
|
||||
|
||||
void title_load();
|
||||
void title_create_windows();
|
||||
@@ -30,6 +31,7 @@ extern "C"
|
||||
void DrawOpenRCT2(rct_drawpixelinfo *dpi, int x, int y);
|
||||
|
||||
void * title_get_sequence_player();
|
||||
void title_sequence_change_preset(int preset);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
#include "../editor.h"
|
||||
#include "../game.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/title_sequences.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../network/network.h"
|
||||
#include "../scenario.h"
|
||||
#include "../title/TitleScreen.h"
|
||||
#include "../util/util.h"
|
||||
#include "../windows/error.h"
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "../config.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/title_sequences.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../interface/window.h"
|
||||
@@ -37,11 +36,12 @@
|
||||
#include "../platform/platform.h"
|
||||
#include "../rct2.h"
|
||||
#include "../sprites.h"
|
||||
#include "../title/TitleScreen.h"
|
||||
#include "../title/TitleSequence.h"
|
||||
#include "../title/TitleSequenceManager.h"
|
||||
#include "../util/util.h"
|
||||
#include "dropdown.h"
|
||||
#include "error.h"
|
||||
#include "../util/util.h"
|
||||
|
||||
enum WINDOW_OPTIONS_PAGE {
|
||||
WINDOW_OPTIONS_PAGE_DISPLAY,
|
||||
@@ -1139,7 +1139,7 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
|
||||
num_items
|
||||
);
|
||||
|
||||
dropdown_set_checked(gCurrentPreviewTitleSequence, true);
|
||||
dropdown_set_checked(gTitleCurrentSequence, true);
|
||||
break;
|
||||
case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN:
|
||||
for (i = 0; i < 7; i++) {
|
||||
@@ -1381,7 +1381,7 @@ static void window_options_dropdown(rct_window *w, int widgetIndex, int dropdown
|
||||
}
|
||||
break;
|
||||
case WIDX_TITLE_SEQUENCE_DROPDOWN:
|
||||
if (dropdownIndex != gCurrentPreviewTitleSequence) {
|
||||
if (dropdownIndex != gTitleCurrentSequence) {
|
||||
title_sequence_change_preset(dropdownIndex);
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
@@ -1841,7 +1841,7 @@ static void window_options_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
w->y + window_options_misc_widgets[WIDX_AUTOSAVE].top
|
||||
);
|
||||
|
||||
const utf8 * name = title_sequence_manager_get_name(gCurrentPreviewTitleSequence);
|
||||
const utf8 * name = title_sequence_manager_get_name(gTitleCurrentSequence);
|
||||
set_format_arg(0, uintptr_t, (uintptr_t)name);
|
||||
gfx_draw_string_left(dpi, STR_TITLE_SEQUENCE, w, w->colours[1], w->x + 10, w->y + window_options_misc_widgets[WIDX_TITLE_SEQUENCE].top + 1);
|
||||
gfx_draw_string_left_clipped(
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/title_sequences.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../interface/window.h"
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/themes.h"
|
||||
#include "../interface/title_sequences.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../interface/widget.h"
|
||||
#include "../interface/window.h"
|
||||
@@ -449,13 +448,13 @@ static void window_title_editor_mouseup(rct_window *w, int widgetIndex)
|
||||
break;
|
||||
case WIDX_TITLE_EDITOR_STOP:
|
||||
if (_isSequencePlaying) {
|
||||
gCurrentPreviewTitleSequence = 0;
|
||||
gTitleCurrentSequence = 0;
|
||||
_isSequencePlaying = false;
|
||||
}
|
||||
break;
|
||||
case WIDX_TITLE_EDITOR_PLAY:
|
||||
if (!_isSequencePlaying && (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) {
|
||||
gCurrentPreviewTitleSequence = (int)_selectedTitleSequence;
|
||||
gTitleCurrentSequence = (int)_selectedTitleSequence;
|
||||
_isSequencePlaying = true;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user