From cbe154f63bd350a367879ed48eb2e992d96a2793 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Sun, 2 Jul 2017 03:53:31 -0700 Subject: [PATCH 01/24] I hope this isn't a joke of a commit I have no idea. --- src/openrct2/core/Math.hpp | 7 +++++++ src/openrct2/title/TitleSequencePlayer.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/openrct2/core/Math.hpp b/src/openrct2/core/Math.hpp index 713cf3f1a8..283ded1f75 100644 --- a/src/openrct2/core/Math.hpp +++ b/src/openrct2/core/Math.hpp @@ -48,4 +48,11 @@ namespace Math if (x > 0) return 1; return 0; } + + template + static T Ceil(T a) + { + return (std::ceil)(a); + } + } diff --git a/src/openrct2/title/TitleSequencePlayer.cpp b/src/openrct2/title/TitleSequencePlayer.cpp index 378718ff25..75af771a0f 100644 --- a/src/openrct2/title/TitleSequencePlayer.cpp +++ b/src/openrct2/title/TitleSequencePlayer.cpp @@ -247,7 +247,7 @@ private: _waitCounter = 1; break; case TITLE_SCRIPT_WAIT: - _waitCounter = command->Seconds * UPDATE_FPS; + _waitCounter = Math::Min(1, Math::Ceil(command->Seconds / UPDATE_TIME_MS)); break; case TITLE_SCRIPT_LOADMM: { From ec0f35fe7b01b153ee93a763396f6ff0fe918e53 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Sun, 2 Jul 2017 03:55:56 -0700 Subject: [PATCH 02/24] added comment --- src/openrct2/title/TitleSequencePlayer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openrct2/title/TitleSequencePlayer.cpp b/src/openrct2/title/TitleSequencePlayer.cpp index 75af771a0f..de31c59151 100644 --- a/src/openrct2/title/TitleSequencePlayer.cpp +++ b/src/openrct2/title/TitleSequencePlayer.cpp @@ -247,6 +247,8 @@ private: _waitCounter = 1; break; case TITLE_SCRIPT_WAIT: + + // 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::Min(1, Math::Ceil(command->Seconds / UPDATE_TIME_MS)); break; case TITLE_SCRIPT_LOADMM: From b460401ab669f54af914c81e4993bcc8084f7648 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Sun, 2 Jul 2017 04:08:44 -0700 Subject: [PATCH 03/24] Removed redundant Ceil --- src/openrct2/core/Math.hpp | 6 ------ src/openrct2/title/TitleSequencePlayer.cpp | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/openrct2/core/Math.hpp b/src/openrct2/core/Math.hpp index 283ded1f75..c46a1ba94a 100644 --- a/src/openrct2/core/Math.hpp +++ b/src/openrct2/core/Math.hpp @@ -48,11 +48,5 @@ namespace Math if (x > 0) return 1; return 0; } - - template - static T Ceil(T a) - { - return (std::ceil)(a); - } } diff --git a/src/openrct2/title/TitleSequencePlayer.cpp b/src/openrct2/title/TitleSequencePlayer.cpp index de31c59151..2abf9a8180 100644 --- a/src/openrct2/title/TitleSequencePlayer.cpp +++ b/src/openrct2/title/TitleSequencePlayer.cpp @@ -249,7 +249,7 @@ private: case TITLE_SCRIPT_WAIT: // 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::Min(1, Math::Ceil(command->Seconds / UPDATE_TIME_MS)); + _waitCounter = Math::Min(1, command->Seconds / UPDATE_TIME_MS); break; case TITLE_SCRIPT_LOADMM: { From bb8160fa3ba77cf68adc5c90b717b5a823f45e41 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Tue, 4 Jul 2017 13:45:29 -0700 Subject: [PATCH 04/24] Remove extra newline in math.hpp --- src/openrct2/core/Math.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openrct2/core/Math.hpp b/src/openrct2/core/Math.hpp index c46a1ba94a..713cf3f1a8 100644 --- a/src/openrct2/core/Math.hpp +++ b/src/openrct2/core/Math.hpp @@ -48,5 +48,4 @@ namespace Math if (x > 0) return 1; return 0; } - } From f5bc1b598c5c5b50251995070912343319c058b3 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Tue, 4 Jul 2017 13:46:36 -0700 Subject: [PATCH 05/24] removed extra newline, changed tabs to spaces --- src/openrct2/title/TitleSequencePlayer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/openrct2/title/TitleSequencePlayer.cpp b/src/openrct2/title/TitleSequencePlayer.cpp index 2abf9a8180..8804999957 100644 --- a/src/openrct2/title/TitleSequencePlayer.cpp +++ b/src/openrct2/title/TitleSequencePlayer.cpp @@ -247,8 +247,7 @@ private: _waitCounter = 1; break; case TITLE_SCRIPT_WAIT: - - // The waitCounter is measured in 25-ms game ticks. Previously it was seconds * 40 ticks/second, now it is ms / 25 ms/tick + // 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::Min(1, command->Seconds / UPDATE_TIME_MS); break; case TITLE_SCRIPT_LOADMM: From c815a427c029033d17d5487d7f20049d6b7d33fa Mon Sep 17 00:00:00 2001 From: spacek531 Date: Tue, 4 Jul 2017 19:11:28 -0700 Subject: [PATCH 06/24] Change Seconds (internal) to Milliseconds, en-GB too --- data/language/en-GB.txt | 4 ++-- src/openrct2/title/TitleSequence.cpp | 4 ++-- src/openrct2/title/TitleSequence.h | 2 +- src/openrct2/title/TitleSequencePlayer.cpp | 2 +- src/openrct2/windows/title_command_editor.c | 5 +++-- src/openrct2/windows/title_editor.c | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 2126236283..8a3c8f1e1a 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -1,4 +1,4 @@ -# STR_XXXX part is read and XXXX becomes the string id number. +# STR_XXXX part is read and XXXX becomes the string id number. # Everything after the colon and before the new line will be saved as the string. # Use # at the beginning of a line to leave a comment. STR_0000 : @@ -3768,7 +3768,7 @@ 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/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 8804999957..146c7c6dca 100644 --- a/src/openrct2/title/TitleSequencePlayer.cpp +++ b/src/openrct2/title/TitleSequencePlayer.cpp @@ -248,7 +248,7 @@ private: break; case TITLE_SCRIPT_WAIT: // 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::Min(1, command->Seconds / UPDATE_TIME_MS); + _waitCounter = Math::Min(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..f0e2a03d34 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -42,6 +42,7 @@ TITLE_COMMAND_ORDER window_title_command_editor_orders[] = { { TITLE_SCRIPT_ZOOM, STR_TITLE_EDITOR_COMMAND_TYPE_ZOOM, STR_TITLE_EDITOR_ARGUMENT_ZOOM_LEVEL }, { TITLE_SCRIPT_SPEED, STR_TITLE_EDITOR_COMMAND_TYPE_SPEED, STR_TITLE_EDITOR_ARGUMENT_SPEED }, { TITLE_SCRIPT_WAIT, STR_TITLE_EDITOR_COMMAND_TYPE_WAIT, STR_TITLE_EDITOR_ARGUMENT_WAIT_SECONDS }, + { TITLE_SCRIPT_WAIT, STR_TITLE_EDITOR_COMMAND_TYPE_WAIT, STR_TITLE_EDITOR_ARGUMENT_WAIT_SECONDS }, { TITLE_SCRIPT_RESTART, STR_TITLE_EDITOR_RESTART, STR_NONE }, { TITLE_SCRIPT_END, STR_TITLE_EDITOR_END, STR_NONE }, }; @@ -402,8 +403,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; 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; From d5610ece542585632c65e7f3211879f717654024 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Tue, 4 Jul 2017 19:19:31 -0700 Subject: [PATCH 07/24] Remove duplicate line --- src/openrct2/windows/title_command_editor.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index f0e2a03d34..6d7c3881fe 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -42,7 +42,6 @@ TITLE_COMMAND_ORDER window_title_command_editor_orders[] = { { TITLE_SCRIPT_ZOOM, STR_TITLE_EDITOR_COMMAND_TYPE_ZOOM, STR_TITLE_EDITOR_ARGUMENT_ZOOM_LEVEL }, { TITLE_SCRIPT_SPEED, STR_TITLE_EDITOR_COMMAND_TYPE_SPEED, STR_TITLE_EDITOR_ARGUMENT_SPEED }, { TITLE_SCRIPT_WAIT, STR_TITLE_EDITOR_COMMAND_TYPE_WAIT, STR_TITLE_EDITOR_ARGUMENT_WAIT_SECONDS }, - { TITLE_SCRIPT_WAIT, STR_TITLE_EDITOR_COMMAND_TYPE_WAIT, STR_TITLE_EDITOR_ARGUMENT_WAIT_SECONDS }, { TITLE_SCRIPT_RESTART, STR_TITLE_EDITOR_RESTART, STR_NONE }, { TITLE_SCRIPT_END, STR_TITLE_EDITOR_END, STR_NONE }, }; From ef38a66cc2caace4a5a4892aa9891ca961b4df28 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 12:34:02 -0700 Subject: [PATCH 08/24] begin update editor for ms values [ci skip] --- src/openrct2/windows/title_command_editor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index 6d7c3881fe..99f0b7bb04 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -438,7 +438,7 @@ 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; + if (value > 255 && command.Type != TITLE_SCRIPT_WAIT) value = 255; switch (widgetIndex) { case WIDX_TEXTBOX_FULL: if (text == NULL) { @@ -447,7 +447,7 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde if (value > 3) value = 3; } else if (command.Type == TITLE_SCRIPT_WAIT) { - if (value < 1) value = 1; + if (value < 1) value = 100; } command.Rotations = (uint8)value; } From 51c34ff800c073453310ccc64e671c96e8bfc47c Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 02:10:47 -0700 Subject: [PATCH 09/24] removed BOM from en-GB [ci skip] --- data/language/en-GB.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 8a3c8f1e1a..63d2a49025 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -1,4 +1,4 @@ -# STR_XXXX part is read and XXXX becomes the string id number. +# STR_XXXX part is read and XXXX becomes the string id number. # Everything after the colon and before the new line will be saved as the string. # Use # at the beginning of a line to leave a comment. STR_0000 : From bd4e8cbd081de0e2a467ac869c77f749ac07e09c Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 10:36:37 -0700 Subject: [PATCH 10/24] change Min to Max --- src/openrct2/title/TitleSequencePlayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/title/TitleSequencePlayer.cpp b/src/openrct2/title/TitleSequencePlayer.cpp index 146c7c6dca..19b3453dc4 100644 --- a/src/openrct2/title/TitleSequencePlayer.cpp +++ b/src/openrct2/title/TitleSequencePlayer.cpp @@ -248,7 +248,7 @@ private: break; case TITLE_SCRIPT_WAIT: // 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::Min(1, command->Milliseconds / UPDATE_TIME_MS); + _waitCounter = Math::Max(1, command->Milliseconds / UPDATE_TIME_MS); break; case TITLE_SCRIPT_LOADMM: { From fc71361a9e3ecc48466cee325e8b7650cadb1871 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 12:59:06 -0700 Subject: [PATCH 11/24] increase digits for wait, decrease digits for rotate, zoom --- src/openrct2/windows/title_command_editor.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index 99f0b7bb04..1765527af1 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -256,7 +256,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); + if (command.Type == TITLE_SCRIPT_WAIT) { + window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 5); + } + else { + // Currently the only other commands that use this textbox are Rotate and Zoom which have a maximum of 3. + window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 2); + } break; case WIDX_TEXTBOX_X: window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 4); @@ -447,7 +453,8 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde if (value > 3) value = 3; } else if (command.Type == TITLE_SCRIPT_WAIT) { - if (value < 1) value = 100; + if (value < 100) value = 100; + if (value > 65000) value = 65000; } command.Rotations = (uint8)value; } From c302bec47ab2c9ac1a620a7edc16e3b0a471d7aa Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 12:59:59 -0700 Subject: [PATCH 12/24] fix rotate being able to be set to 0 --- src/openrct2/windows/title_command_editor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index 1765527af1..05ba40daec 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -449,7 +449,11 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde 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_ROTATE) { + if (value > 3) value = 3; + } + else if (command.Type == TITLE_SCRIPT_ZOOM) { + if (value < 1) value = 1; if (value > 3) value = 3; } else if (command.Type == TITLE_SCRIPT_WAIT) { From c1ac65491612f568ef59c1cc25dfe53a8ba1e11c Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 13:01:54 -0700 Subject: [PATCH 13/24] fix order of rotate, zoom in clamping --- src/openrct2/windows/title_command_editor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index 05ba40daec..5ff84e4bba 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -449,10 +449,10 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde case WIDX_TEXTBOX_FULL: if (text == NULL) { if (*end == '\0') { - if (command.Type == TITLE_SCRIPT_ROTATE) { + if (command.Type == TITLE_SCRIPT_ZOOM) { if (value > 3) value = 3; } - else if (command.Type == TITLE_SCRIPT_ZOOM) { + else if (command.Type == TITLE_SCRIPT_ROTATE) { if (value < 1) value = 1; if (value > 3) value = 3; } From a3acfb43127b55d8647f36a1dde6a98f5eccfff1 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 13:50:48 -0700 Subject: [PATCH 14/24] Increase digits from 4 to 5 I'm not used to string lengths that are one shorter --- src/openrct2/windows/title_command_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index 5ff84e4bba..36f74317ca 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -257,7 +257,7 @@ static void window_title_command_editor_mouseup(rct_window *w, rct_widgetindex w break; case WIDX_TEXTBOX_FULL: if (command.Type == TITLE_SCRIPT_WAIT) { - window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 5); + window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 6); } else { // Currently the only other commands that use this textbox are Rotate and Zoom which have a maximum of 3. From 78e25e381c69c7afe4afeb0638e0884b67b9018c Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 17:58:40 -0700 Subject: [PATCH 15/24] modify saving, add comments [ci skip] --- src/openrct2/windows/title_command_editor.c | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index 36f74317ca..ec50a7986a 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -260,7 +260,7 @@ static void window_title_command_editor_mouseup(rct_window *w, rct_widgetindex w window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 6); } else { - // Currently the only other commands that use this textbox are Rotate and Zoom which have a maximum of 3. + // Currently the only other commands that use this textbox are Rotate and Zoom which have a maximum allowed value of 3. window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 2); } break; @@ -444,23 +444,23 @@ 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; + // The Wait command is the only one with an order of magnitude 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_ZOOM) { - if (value > 3) value = 3; - } - else if (command.Type == TITLE_SCRIPT_ROTATE) { - if (value < 1) value = 1; - if (value > 3) value = 3; - } - else if (command.Type == TITLE_SCRIPT_WAIT) { + if (*end == '\0') + if (command.Type == TITLE_SCRIPT_WAIT) { if (value < 100) value = 100; if (value > 65000) value = 65000; + command.Rotations = (uint16)value; + } + 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; } - command.Rotations = (uint8)value; } snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Rotations); window_invalidate(w); From 16167d84f0cff624dbb5e602e0c2375c7578db75 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 18:31:39 -0700 Subject: [PATCH 16/24] clarified comments, changed TITLE_COMMAND_ORDER command to uint16 --- src/openrct2/windows/title_command_editor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index ec50a7986a..53d018db80 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; @@ -256,11 +257,11 @@ static void window_title_command_editor_mouseup(rct_window *w, rct_widgetindex w window_close(w); break; case WIDX_TEXTBOX_FULL: + // 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 { - // Currently the only other commands that use this textbox are Rotate and Zoom which have a maximum allowed value of 3. window_start_textbox(w, widgetIndex, STR_STRING, textbox1Buffer, 2); } break; @@ -444,7 +445,7 @@ 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; - // The Wait command is the only one with an order of magnitude greater than 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: From 97bf67e6057a13da96753c34cc1456f70e2f3983 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Thu, 6 Jul 2017 19:46:35 -0700 Subject: [PATCH 17/24] add missing curly bracket --- src/openrct2/windows/title_command_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index 53d018db80..1cee16278e 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -450,7 +450,7 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde switch (widgetIndex) { case WIDX_TEXTBOX_FULL: if (text == NULL) { - if (*end == '\0') + if (*end == '\0') { if (command.Type == TITLE_SCRIPT_WAIT) { if (value < 100) value = 100; if (value > 65000) value = 65000; From bec8b73506b4708ad8569d27ca9ed3ecc073b6ae Mon Sep 17 00:00:00 2001 From: spacek531 Date: Fri, 7 Jul 2017 00:03:41 -0700 Subject: [PATCH 18/24] fix saving of milliseconds, loading still beyond knowledge [ci skip] --- src/openrct2/windows/title_command_editor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index 1cee16278e..c5a3230aec 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -244,7 +244,7 @@ void window_title_command_editor_open(TitleSequence * sequence, sint32 index, bo case TITLE_SCRIPT_ROTATE: case TITLE_SCRIPT_ZOOM: case TITLE_SCRIPT_WAIT: - snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Rotations); + snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Milliseconds); break; } } @@ -454,16 +454,17 @@ static void window_title_command_editor_textinput(rct_window * w, rct_widgetinde if (command.Type == TITLE_SCRIPT_WAIT) { if (value < 100) value = 100; if (value > 65000) value = 65000; - command.Rotations = (uint16)value; + 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); } } - snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Rotations); window_invalidate(w); } else { safe_strcpy(textbox1Buffer, text, sizeof(textbox1Buffer)); From 78ab94b12ab8184dd6e2cefddc0dd61c0a7b2b97 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Fri, 7 Jul 2017 01:44:24 -0700 Subject: [PATCH 19/24] upgrade save format from uint16 to uint32 --- src/openrct2/windows/title_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/windows/title_editor.c b/src/openrct2/windows/title_editor.c index 7c349606ee..3b8b077fee 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->Milliseconds); + set_format_arg(0, uint32, command->Milliseconds); break; case TITLE_SCRIPT_RESTART: commandName = STR_TITLE_EDITOR_RESTART; From 668366bf6b9d2d5d026ea4116110615fdc8e4a23 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Fri, 7 Jul 2017 01:56:15 -0700 Subject: [PATCH 20/24] Revert "upgrade save format from uint16 to uint32" This reverts commit 85757d9fefbacf8b7d07cec9cd9714e2f70f2faa. --- src/openrct2/windows/title_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/windows/title_editor.c b/src/openrct2/windows/title_editor.c index 3b8b077fee..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, uint32, command->Milliseconds); + set_format_arg(0, uint16, command->Milliseconds); break; case TITLE_SCRIPT_RESTART: commandName = STR_TITLE_EDITOR_RESTART; From 7ecf049e874fa06500fec8f6b2a6e71f8574d609 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Fri, 7 Jul 2017 02:19:58 -0700 Subject: [PATCH 21/24] add janisozar suggestion [ci skip] --- src/openrct2/windows/title_command_editor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index c5a3230aec..bcd2c5e4f1 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -242,6 +242,8 @@ void window_title_command_editor_open(TitleSequence * sequence, sint32 index, bo snprintf(textbox2Buffer, BUF_SIZE, "%d", command.Y); break; case TITLE_SCRIPT_ROTATE: + snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Rotations); + break; case TITLE_SCRIPT_ZOOM: case TITLE_SCRIPT_WAIT: snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Milliseconds); From e47e71e949dd373f7e664e857d20b3c7d0518cbc Mon Sep 17 00:00:00 2001 From: spacek531 Date: Fri, 7 Jul 2017 04:25:50 -0700 Subject: [PATCH 22/24] change format to uint8 to stop overflow [ci-skip] --- data/language/en-GB.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 63d2a49025..2b06df3f77 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3762,7 +3762,7 @@ 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: From c73e17f02b498adaf5f7c90651fce0a06e8d0dd4 Mon Sep 17 00:00:00 2001 From: spacek531 Date: Fri, 7 Jul 2017 08:06:58 -0700 Subject: [PATCH 23/24] move the zoom case up to handle it as it was --- src/openrct2/windows/title_command_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/windows/title_command_editor.c b/src/openrct2/windows/title_command_editor.c index bcd2c5e4f1..46be1acd0b 100644 --- a/src/openrct2/windows/title_command_editor.c +++ b/src/openrct2/windows/title_command_editor.c @@ -242,9 +242,9 @@ void window_title_command_editor_open(TitleSequence * sequence, sint32 index, bo snprintf(textbox2Buffer, BUF_SIZE, "%d", command.Y); break; case TITLE_SCRIPT_ROTATE: + case TITLE_SCRIPT_ZOOM: snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Rotations); break; - case TITLE_SCRIPT_ZOOM: case TITLE_SCRIPT_WAIT: snprintf(textbox1Buffer, BUF_SIZE, "%d", command.Milliseconds); break; From 3545d2d635d55932465ea7d4398bc4f230f50352 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 7 Jul 2017 17:34:48 +0100 Subject: [PATCH 24/24] Update to 0.1.0 title sequence --- CMakeLists.txt | 4 ++-- OpenRCT2.xcodeproj/project.pbxproj | 2 +- openrct2.proj | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 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/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