diff --git a/CMakeLists.txt b/CMakeLists.txt index df993037a2..afe3e13980 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,8 +11,8 @@ include(CheckCXXCompilerFlag) set(ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}") set(CMAKE_MACOSX_RPATH 1) -set(TITLE_SEQUENCE_URL "https://github.com/OpenRCT2/title-sequences/releases/download/v0.0.5/title-sequence-v0.0.5.zip") -set(TITLE_SEQUENCE_SHA1 "79ffb2585d12abcbfce205d7696e3472a504b005") +set(TITLE_SEQUENCE_URL "https://github.com/OpenRCT2/title-sequences/releases/download/v0.1.0/title-sequence-v0.1.0.zip") +set(TITLE_SEQUENCE_SHA1 "b587d83de508d0b104d14c599b76f8565900fce0") option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.") option(WITH_TESTS "Build tests") diff --git a/OpenRCT2.xcodeproj/project.pbxproj b/OpenRCT2.xcodeproj/project.pbxproj index dfc7179f70..8738988adc 100644 --- a/OpenRCT2.xcodeproj/project.pbxproj +++ b/OpenRCT2.xcodeproj/project.pbxproj @@ -2871,7 +2871,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "version=\"0.0.5\"\nzipname=\"title-sequence-v$version.zip\"\nliburl=\"https://github.com/OpenRCT2/title-sequences/releases/download/v$version/$zipname\"\n\n[[ ! -d \"${SRCROOT}/data/title\" || ! -e \"${SRCROOT}/sequencesversion\" || $(head -n 1 \"${SRCROOT}/sequencesversion\") != $version ]]\noutdated=$?\n\nif [[ $outdated -eq 0 ]]; then\nif [[ -d \"${SRCROOT}/data/title\" ]]; then rm -r \"${SRCROOT}/data/title\"; fi\nmkdir -p \"${SRCROOT}/data/title\"\n\ncurl -L -o \"${SRCROOT}/data/title/$zipname\" \"$liburl\"\nunzip -uaq -d \"${SRCROOT}/data/title\" \"${SRCROOT}/data/title/$zipname\"\nrm \"${SRCROOT}/data/title/$zipname\"\n\necho $version > \"${SRCROOT}/sequencesversion\"\nfi"; + shellScript = "version=\"0.1.0\"\nzipname=\"title-sequence-v$version.zip\"\nliburl=\"https://github.com/OpenRCT2/title-sequences/releases/download/v$version/$zipname\"\n\n[[ ! -d \"${SRCROOT}/data/title\" || ! -e \"${SRCROOT}/sequencesversion\" || $(head -n 1 \"${SRCROOT}/sequencesversion\") != $version ]]\noutdated=$?\n\nif [[ $outdated -eq 0 ]]; then\nif [[ -d \"${SRCROOT}/data/title\" ]]; then rm -r \"${SRCROOT}/data/title\"; fi\nmkdir -p \"${SRCROOT}/data/title\"\n\ncurl -L -o \"${SRCROOT}/data/title/$zipname\" \"$liburl\"\nunzip -uaq -d \"${SRCROOT}/data/title\" \"${SRCROOT}/data/title/$zipname\"\nrm \"${SRCROOT}/data/title/$zipname\"\n\necho $version > \"${SRCROOT}/sequencesversion\"\nfi"; }; D4EC012A1C25532B00DAFE69 /* Setup AppIcon */ = { isa = PBXShellScriptBuildPhase; diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 2126236283..2b06df3f77 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3762,13 +3762,13 @@ STR_5420 :Rotate{MOVE_X}{87}{COMMA16} STR_5421 :Zoom STR_5422 :Zoom{MOVE_X}{87}{COMMA16} STR_5423 :Wait -STR_5424 :Wait{MOVE_X}{87}{COMMA16} +STR_5424 :Wait{MOVE_X}{87}{UINT16} STR_5425 :Restart STR_5426 :End STR_5427 :Coordinates: STR_5428 :Anticlockwise rotations: STR_5429 :Zoom level: -STR_5430 :Seconds to wait: +STR_5430 :Milliseconds to wait: STR_5431 :Save to load: STR_5432 :Command: STR_5433 :Title Sequences diff --git a/openrct2.proj b/openrct2.proj index 21f0b7c118..6679c39ac1 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -68,8 +68,8 @@ 1.8.0 https://github.com/google/googletest/archive/release-1.8.0.zip 667f873ab7a4d246062565fad32fb6d8e203ee73 - https://github.com/OpenRCT2/title-sequences/releases/download/v0.0.5/title-sequence-v0.0.5.zip - 79ffb2585d12abcbfce205d7696e3472a504b005 + https://github.com/OpenRCT2/title-sequences/releases/download/v0.1.0/title-sequence-v0.1.0.zip + b587d83de508d0b104d14c599b76f8565900fce0 diff --git a/src/openrct2/title/TitleSequence.cpp b/src/openrct2/title/TitleSequence.cpp index 30fb2e4136..191ca573a5 100644 --- a/src/openrct2/title/TitleSequence.cpp +++ b/src/openrct2/title/TitleSequence.cpp @@ -446,7 +446,7 @@ static std::vector LegacyScriptRead(utf8 * script, size_t scriptLe else if (_stricmp(token, "WAIT") == 0) { command.Type = TITLE_SCRIPT_WAIT; - command.Seconds = atoi(part1) & 0xFF; + command.Milliseconds = atoi(part1) & 0xFFFF; } else if (_stricmp(token, "RESTART") == 0) { @@ -595,7 +595,7 @@ static utf8 * LegacyScriptWrite(TitleSequence * seq) sb.Append(buffer); break; case TITLE_SCRIPT_WAIT: - String::Format(buffer, sizeof(buffer), "WAIT %u", command->Seconds); + String::Format(buffer, sizeof(buffer), "WAIT %u", command->Milliseconds); sb.Append(buffer); break; case TITLE_SCRIPT_RESTART: diff --git a/src/openrct2/title/TitleSequence.h b/src/openrct2/title/TitleSequence.h index b9c111ad8d..0772908afb 100644 --- a/src/openrct2/title/TitleSequence.h +++ b/src/openrct2/title/TitleSequence.h @@ -31,7 +31,7 @@ typedef struct TitleCommand uint8 Rotations; // ROTATE (counter-clockwise) uint8 Zoom; // ZOOM uint8 Speed; // SPEED - uint8 Seconds; // WAIT + uint16 Milliseconds; // WAIT }; } TitleCommand; diff --git a/src/openrct2/title/TitleSequencePlayer.cpp b/src/openrct2/title/TitleSequencePlayer.cpp index 378718ff25..19b3453dc4 100644 --- a/src/openrct2/title/TitleSequencePlayer.cpp +++ b/src/openrct2/title/TitleSequencePlayer.cpp @@ -247,7 +247,8 @@ private: _waitCounter = 1; break; case TITLE_SCRIPT_WAIT: - _waitCounter = command->Seconds * UPDATE_FPS; + // The waitCounter is measured in 25-ms game ticks. Previously it was seconds * 40 ticks/second, now it is ms / 25 ms/tick + _waitCounter = Math::Max(1, command->Milliseconds / UPDATE_TIME_MS); break; case TITLE_SCRIPT_LOADMM: { diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index 3f1b9b392b..46be1acd0b 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -30,7 +30,8 @@ #include "dropdown.h" typedef struct TITLE_COMMAND_ORDER { - uint8 command; + // originally a uint8, but the new millisecond wait times require a uint16. + uint16 command; rct_string_id nameStringId; rct_string_id descStringId; } TITLE_COMMAND_ORDER; @@ -242,9 +243,11 @@ void window_title_command_editor_open(TitleSequence * sequence, sint32 index, bo break; case TITLE_SCRIPT_ROTATE: case TITLE_SCRIPT_ZOOM: - case TITLE_SCRIPT_WAIT: snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Rotations); break; + case TITLE_SCRIPT_WAIT: + snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Milliseconds); + break; } } @@ -256,7 +259,13 @@ static void window_title_command_editor_mouseup(rct_window *w, rct_widgetindex w window_close(w); break; case WIDX_TEXTBOX_FULL: - window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 4); + // The only commands that use TEXTBOX_FULL currently are Wait, Rotate, and Zoom. Rotate and Zoom have single-digit maximum values, while Wait has 5-digit maximum values. + if (command.Type == TITLE_SCRIPT_WAIT) { + window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 6); + } + else { + window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 2); + } break; case WIDX_TEXTBOX_X: window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 4); @@ -402,8 +411,8 @@ static void window_title_command_editor_dropdown(rct_window *w, rct_widgetindex command.Speed = 1; break; case TITLE_SCRIPT_WAIT: - command.Seconds = 10; - snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Seconds); + command.Milliseconds = 10000; + snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Milliseconds); break; case TITLE_SCRIPT_LOAD: command.SaveIndex = 0; @@ -438,20 +447,26 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde char * end; sint32 value = strtol(widgetIndex != WIDX_TEXTBOX_Y ? textbox1Buffer : textbox2Buffer, &end, 10); if (value < 0) value = 0; - if (value > 255) value = 255; + // The Wait command is the only one with acceptable values greater than 255. + if (value > 255 && command.Type != TITLE_SCRIPT_WAIT) value = 255; switch (widgetIndex) { case WIDX_TEXTBOX_FULL: if (text == NULL) { if (*end == '\0') { - if (command.Type == TITLE_SCRIPT_ROTATE || command.Type == TITLE_SCRIPT_ZOOM) { + if (command.Type == TITLE_SCRIPT_WAIT) { + if (value < 100) value = 100; + if (value > 65000) value = 65000; + command.Milliseconds = (uint16)value; + snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Milliseconds); + } + else { + // Both Rotate and Zoom have a maximum value of 3, but Rotate has a min value of 1 not 0. if (value > 3) value = 3; + if (value < 1 && command.Type == TITLE_SCRIPT_ROTATE) value = 1; + command.Rotations = (uint8)value; + snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Rotations); } - else if (command.Type == TITLE_SCRIPT_WAIT) { - if (value < 1) value = 1; - } - command.Rotations = (uint8)value; } - snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Rotations); window_invalidate(w); } else { safe_strcpy(textbox1Buffer, text, sizeof(textbox1Buffer)); diff --git a/src/openrct2/windows/title_editor.c b/src/openrct2/windows/title_editor.c index 9431a6b4f9..7c349606ee 100644 --- a/src/openrct2/windows/title_editor.c +++ b/src/openrct2/windows/title_editor.c @@ -891,7 +891,7 @@ static void window_title_editor_scrollpaint_commands(rct_window *w, rct_drawpixe break; case TITLE_SCRIPT_WAIT: commandName = STR_TITLE_EDITOR_COMMAND_WAIT; - set_format_arg(0, uint16, command->Seconds); + set_format_arg(0, uint16, command->Milliseconds); break; case TITLE_SCRIPT_RESTART: commandName = STR_TITLE_EDITOR_RESTART;