From 74cc03ac06e0d0ff576d7a1b6f6bdf76714bd02c Mon Sep 17 00:00:00 2001 From: Alexander Overvoorde Date: Wed, 11 Nov 2015 15:17:43 +0100 Subject: [PATCH] Fix title sequence script interpreter treating parameters as commands (fixes #2284) --- src/title.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/title.c b/src/title.c index 56bb9e1265..1b8abc325a 100644 --- a/src/title.c +++ b/src/title.c @@ -80,6 +80,7 @@ static const uint8 _magicMountainScript[] = { static uint8* _loadedScript; static const uint8* _currentScript; +static uint8 _lastOpcode; static int _scriptNoLoadsSinceRestart; static int _scriptWaitCounter; static int _scriptCurrentPreset; @@ -264,6 +265,8 @@ static void title_skip_opcode() script_opcode = *_currentScript++; gTitleScriptCommand++; + _lastOpcode = script_opcode; + switch (script_opcode) { case TITLE_SCRIPT_WAIT: _currentScript++; @@ -314,6 +317,9 @@ static void title_do_next_script_opcode() return; } } + + _lastOpcode = script_opcode; + switch (script_opcode) { case TITLE_SCRIPT_END: _scriptWaitCounter = 1; @@ -439,7 +445,7 @@ static void title_update_showcase() if (gTitleScriptSkipTo != -1 && gTitleScriptSkipLoad != -1) _scriptWaitCounter = 0; - else if (*(_currentScript - 1) != TITLE_SCRIPT_END) + else if (_lastOpcode != TITLE_SCRIPT_END) _scriptWaitCounter--; } while (gTitleScriptSkipTo != -1 && gTitleScriptSkipLoad != -1);