Title Sequence Editor Improvements

This commit is contained in:
Robert Jordan 2015-06-25 10:41:40 -04:00
parent 2086703d23
commit 937b887a91
5 changed files with 34 additions and 37 deletions

View File

@ -3587,8 +3587,8 @@ STR_5250 :Title Exit Button
STR_5251 :Title Options Button
STR_5252 :Title Scenario Selection
STR_5253 :Park Information
STR_5254 :<not used anymore>
STR_5255 :<not used anymore>
STR_5254 :Create
STR_5255 :{SMALLFONT}{BLACK}Create a new title sequence from scratch
STR_5256 :Create a new theme to make changes to
STR_5257 :{SMALLFONT}{BLACK}Create a new theme based on the current one
STR_5258 :{SMALLFONT}{BLACK}Delete the current theme
@ -3772,6 +3772,6 @@ STR_5435 :Rename save
STR_5436 :Edit Title Sequences...
STR_5437 :No save selected
STR_5438 :Can't make changes while command editor is open
STR_5439 :A restart is used without a wait command
STR_5439 :A wait with at least 4 seconds is required with a restart
STR_5440 :Minimize fullscreen on focus loss
STR_5441 :{SMALLFONT}{BLACK}Identifies rides by track type,{NEWLINE}so vehicles can be changed{NEWLINE}afterwards, like in RCT1. Only{NEWLINE}toggleable in the title screen.

View File

@ -102,7 +102,7 @@ void title_sequence_create_preset(const char *name)
platform_ensure_directory_exists(path);
title_sequence_save_preset_script(preset);
title_sequence_change_preset(preset);
gCurrentTitleSequence = preset;
}
}
@ -166,7 +166,6 @@ void title_sequence_duplicate_preset(int duplicate, const char *name)
}
title_sequence_save_preset_script(preset);
//title_sequence_change_preset(preset);
gCurrentTitleSequence = preset;
}
}

View File

@ -160,26 +160,7 @@ static void title_create_windows()
*/
static void title_init_showcase()
{
/*_scriptNoLoadsSinceRestart = 1;
SafeFree(_loadedScript);
_currentScript = _magicMountainScript;
switch (gConfigGeneral.title_sequence) {
case TITLE_SEQUENCE_OPENRCT2:
_loadedScript = title_script_load();
if (_loadedScript != NULL)
_currentScript = _loadedScript;
break;
case TITLE_SEQUENCE_RANDOM:
_loadedScript = generate_random_script();
_currentScript = _loadedScript;
break;
}
_scriptWaitCounter = 0;*/
title_refresh_sequence();
title_update_showcase();
}
static int title_load_park(const char *path)
@ -227,6 +208,7 @@ static int title_load_park(const char *path)
gfx_invalidate_screen();
RCT2_GLOBAL(0x009DEA66, sint16) = 0;
RCT2_GLOBAL(0x009DEA5C, sint16) = 0x0D6D8;
gGameSpeed = 1;
return 1;
}
@ -267,7 +249,7 @@ static void title_do_next_script_opcode()
uint8 script_opcode, script_operand;
rct_window* w;
gTitleScriptCommand++;
if (*(_currentScript - 1) != TITLE_SCRIPT_END)
if (gTitleScriptCommand <= 1 || *(_currentScript - 1) != TITLE_SCRIPT_END)
script_opcode = *_currentScript++;
else
script_opcode = *_currentScript;
@ -648,7 +630,7 @@ bool title_refresh_sequence()
else if (title->commands[i].command == TITLE_SCRIPT_LOADMM) {
hasLoad = true;
}
else if (title->commands[i].command == TITLE_SCRIPT_WAIT) {
else if (title->commands[i].command == TITLE_SCRIPT_WAIT && title->commands[i].seconds >= 4) {
hasWait = true;
}
else if (title->commands[i].command == TITLE_SCRIPT_RESTART) {
@ -707,12 +689,13 @@ bool title_refresh_sequence()
return true;
}
log_error("Failed to load title sequence, hasLoad: %i, hasWait: %i, hasRestart: %i, hasInvalidSave: %i", hasLoad, hasWait, hasRestart, hasInvalidSave);
log_error("Failed to load title sequence, hasLoad: %i, hasWait4seconds: %i, hasRestart: %i, hasInvalidSave: %i", hasLoad, hasWait, hasRestart, hasInvalidSave);
window_error_open(5402, (!hasWait && hasRestart) ? 5439 : STR_NONE);
_scriptNoLoadsSinceRestart = 1;
if (_loadedScript != _magicMountainScript)
SafeFree(_loadedScript);
_scriptCurrentPreset = 0;
_loadedScript = _magicMountainScript;
_currentScript = _magicMountainScript;
_scriptWaitCounter = 0;
gTitleScriptCommand = -1;

View File

@ -394,11 +394,11 @@ static void window_title_command_editor_textinput()
case WIDX_TEXTBOX_FULL:
if (!result) {
if (*end == '\0') {
if (command.command == TITLE_SCRIPT_ROTATE) {
if (command.command == TITLE_SCRIPT_ROTATE || command.command == TITLE_SCRIPT_ZOOM) {
if (value > 3) value = 3;
}
else if (command.command == TITLE_SCRIPT_ZOOM) {
if (value > 3) value = 3;
else if (command.command == TITLE_SCRIPT_WAIT) {
if (value < 1) value = 1;
}
command.rotations = (uint8)value;
}

View File

@ -107,6 +107,7 @@ enum WINDOW_TITLE_EDITOR_WIDGET_IDX {
// Presets Tab
WIDX_TITLE_EDITOR_PRESETS,
WIDX_TITLE_EDITOR_PRESETS_DROPDOWN,
WIDX_TITLE_EDITOR_NEW_BUTTON,
WIDX_TITLE_EDITOR_DUPLICATE_BUTTON,
WIDX_TITLE_EDITOR_DELETE_BUTTON,
WIDX_TITLE_EDITOR_RENAME_BUTTON,
@ -144,12 +145,13 @@ enum WINDOW_TITLE_EDITOR_WIDGET_IDX {
#define BS 18
#define ROW_HEIGHT 11
#define SCROLL_WIDTH 350
#define WH2 127
static rct_widget window_title_editor_widgets[] = {
{ WWT_FRAME, 0, 0, WW-1, 0, 106, 0x0FFFFFFFF, STR_NONE }, // panel / background
{ WWT_FRAME, 0, 0, WW-1, 0, WH2-1, 0x0FFFFFFFF, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, WW-2, 1, 14, 5433, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, WW-13, WW-3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close button
{ WWT_RESIZE, 1, 0, WW-1, 43, 106, 0x0FFFFFFFF, STR_NONE }, // tab content panel
{ WWT_RESIZE, 1, 0, WW-1, 43, WH2-1, 0x0FFFFFFFF, STR_NONE }, // tab content panel
{ WWT_TAB, 1, 3, 33, 17, 43, 0x02000144E, 5235 }, // presets tab
{ WWT_TAB, 1, 34, 64, 17, 43, 0x02000144E, 5377 }, // saves tab
{ WWT_TAB, 1, 65, 95, 17, 43, 0x02000144E, 5378 }, // script tab
@ -158,7 +160,8 @@ static rct_widget window_title_editor_widgets[] = {
// Presets Tab
{ WWT_DROPDOWN, 1, 125, 299, 60, 71, STR_NONE, STR_NONE }, // Preset title sequences
{ WWT_DROPDOWN_BUTTON, 1, 288, 298, 61, 70, 876, STR_NONE },
{ WWT_DROPDOWN_BUTTON, 1, 10, 100, 82, 93, 5239, 5383 }, // Duplicate button
{ WWT_DROPDOWN_BUTTON, 1, 10, 100, 82, 93, 5254, 5255 }, // New button
{ WWT_DROPDOWN_BUTTON, 1, 10, 100, 82+20, 93+20, 5239, 5383 }, // Duplicate button
{ WWT_DROPDOWN_BUTTON, 1, 110, 200, 82, 93, 3349, 5384 }, // Delete button
{ WWT_DROPDOWN_BUTTON, 1, 210, 300, 82, 93, 3348, 5385 }, // Rename button
@ -233,7 +236,7 @@ void window_title_editor_open(int tab)
if (window != NULL)
return;
window = window_create_auto_pos(WW, 107, (uint32*)window_title_editor_events, WC_TITLE_EDITOR, WF_10 | WF_RESIZABLE);
window = window_create_auto_pos(WW, WH2, (uint32*)window_title_editor_events, WC_TITLE_EDITOR, WF_10 | WF_RESIZABLE);
window->widgets = window_title_editor_widgets;
window->enabled_widgets =
(1 << WIDX_TITLE_EDITOR_CLOSE) |
@ -243,6 +246,7 @@ void window_title_editor_open(int tab)
(1 << WIDX_TITLE_EDITOR_PRESETS) |
(1 << WIDX_TITLE_EDITOR_PRESETS_DROPDOWN) |
(1 << WIDX_TITLE_EDITOR_NEW_BUTTON) |
(1 << WIDX_TITLE_EDITOR_DUPLICATE_BUTTON) |
(1 << WIDX_TITLE_EDITOR_DELETE_BUTTON) |
(1 << WIDX_TITLE_EDITOR_RENAME_BUTTON) |
@ -312,6 +316,11 @@ static void window_title_editor_mouseup()
case WIDX_TITLE_EDITOR_CLOSE:
window_close(w);
break;
case WIDX_TITLE_EDITOR_NEW_BUTTON:
commandEditorOpen *= 2;
if (!commandEditorOpen)
window_text_input_open(w, widgetIndex, 5239, 5406, STR_NONE, NULL, 64);
break;
case WIDX_TITLE_EDITOR_DUPLICATE_BUTTON:
commandEditorOpen *= 2;
if (!commandEditorOpen)
@ -498,9 +507,9 @@ static void window_title_editor_resize()
if (w->selected_tab == WINDOW_TITLE_EDITOR_TAB_PRESETS) {
w->min_width = WW;
w->min_height = 107;
w->min_height = WH2;
w->max_width = WW;
w->max_height = 107;
w->max_height = WH2;
if (w->width < w->min_width) {
w->width = w->min_width;
@ -717,11 +726,15 @@ static void window_title_editor_textinput()
return;
switch (widgetIndex) {
case WIDX_TITLE_EDITOR_NEW_BUTTON:
case WIDX_TITLE_EDITOR_DUPLICATE_BUTTON:
case WIDX_TITLE_EDITOR_RENAME_BUTTON:
if (filename_valid_characters(text)) {
if (!title_sequence_name_exists(text)) {
if (widgetIndex == WIDX_TITLE_EDITOR_DUPLICATE_BUTTON) {
if (widgetIndex == WIDX_TITLE_EDITOR_NEW_BUTTON) {
title_sequence_create_preset(text);
}
else if (widgetIndex == WIDX_TITLE_EDITOR_DUPLICATE_BUTTON) {
title_sequence_duplicate_preset(gCurrentTitleSequence, text);
}
else {
@ -777,6 +790,7 @@ void window_title_editor_invalidate()
window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS].type = WWT_EMPTY;
window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS_DROPDOWN].type = WWT_EMPTY;
window_title_editor_widgets[WIDX_TITLE_EDITOR_NEW_BUTTON].type = WWT_EMPTY;
window_title_editor_widgets[WIDX_TITLE_EDITOR_DUPLICATE_BUTTON].type = WWT_EMPTY;
window_title_editor_widgets[WIDX_TITLE_EDITOR_DELETE_BUTTON].type = WWT_EMPTY;
window_title_editor_widgets[WIDX_TITLE_EDITOR_RENAME_BUTTON].type = WWT_EMPTY;
@ -802,6 +816,7 @@ void window_title_editor_invalidate()
case WINDOW_TITLE_EDITOR_TAB_PRESETS:
window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS].type = WWT_DROPDOWN;
window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
window_title_editor_widgets[WIDX_TITLE_EDITOR_NEW_BUTTON].type = WWT_DROPDOWN_BUTTON;
window_title_editor_widgets[WIDX_TITLE_EDITOR_DUPLICATE_BUTTON].type = WWT_DROPDOWN_BUTTON;
window_title_editor_widgets[WIDX_TITLE_EDITOR_DELETE_BUTTON].type = WWT_DROPDOWN_BUTTON;
window_title_editor_widgets[WIDX_TITLE_EDITOR_RENAME_BUTTON].type = WWT_DROPDOWN_BUTTON;