diff --git a/src/audio/mixer.cpp b/src/audio/mixer.cpp index fa692f1787..d8c4bcfb19 100644 --- a/src/audio/mixer.cpp +++ b/src/audio/mixer.cpp @@ -26,6 +26,7 @@ extern "C" { #include "audio.h" } #include "mixer.h" +#include Mixer gMixer; @@ -393,7 +394,7 @@ void Channel::SetPan(float pan) if (pan < 0) { Channel::pan = 0; } - double decibels = (abs(Channel::pan - 0.5) * 2.0) * 100.0; + double decibels = (std::abs(Channel::pan - 0.5) * 2.0) * 100.0; double attenuation = pow(10, decibels / 20.0); if (Channel::pan <= 0.5) { volume_l = 1.0; 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);