diff --git a/CMakeLists.txt b/CMakeLists.txt index a8763803..077b7da6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,7 @@ set(Impacto_Src src/inputsystem.cpp src/minilua_impl.c src/voicetable.cpp + src/animation.cpp src/renderer/renderer.cpp diff --git a/src/animation.cpp b/src/animation.cpp new file mode 100644 index 00000000..5221f20e --- /dev/null +++ b/src/animation.cpp @@ -0,0 +1,47 @@ +#include "animation.h" + +namespace Impacto { + +void Animation::AddDelta(float dt) { + float duration = + Direction == +AnimationDirection::In ? DurationIn : DurationOut; + + switch (LoopMode) { + case AnimationLoopMode::Stop: { + float endProgress = Direction == +AnimationDirection::In ? 1.0f : 0.0f; + + Progress = std::clamp(Progress + Direction * dt / duration, 0.0f, 1.0f); + if (Progress == endProgress) State = AnimationState::Stopped; + return; + } + case AnimationLoopMode::Loop: { + // E.g. Progress = 1.04 => Progress = 0.04 + Progress += Direction * dt / duration; + Progress -= std::floor(Progress); + return; + } + case AnimationLoopMode::ReverseDirection: { + // E.g. Progress = 1.04 => Progress = 0.96 + float cycleDuration = DurationIn + DurationOut; + + float time = Progress * duration; + if (Direction == +AnimationDirection::Out) { + time = cycleDuration - time; + } + + time = std::fmod(time + dt, cycleDuration); + + if (time < DurationIn) { + Progress = time / DurationIn; + Direction = AnimationDirection::In; + } else { + Progress = 1.0f - (time - DurationIn) / DurationOut; + Direction = AnimationDirection::Out; + } + + return; + } + } +} + +} // namespace Impacto \ No newline at end of file diff --git a/src/animation.h b/src/animation.h index 0115ba02..36739e0f 100644 --- a/src/animation.h +++ b/src/animation.h @@ -2,109 +2,73 @@ #include "mem.h" #include "profile/scriptvars.h" +#include "enum.h" namespace Impacto { -enum AnimationState { AS_Stopped, AS_Playing }; -enum AnimationLoopMode { ALM_Stop, ALM_ReverseDirection, ALM_Loop }; +BETTER_ENUM(AnimationState, int, Stopped, Playing) +BETTER_ENUM(AnimationLoopMode, int, Stop, ReverseDirection, Loop) +BETTER_ENUM(AnimationDirection, int, In = 1, Out = -1) class Animation { public: float DurationIn = 0; float DurationOut = 0; // 1 = in, -1 = out - float Direction = 1; + AnimationDirection Direction = AnimationDirection::In; // 0 = fully out, 1 = fully in float Progress = 0; - AnimationState State = AS_Stopped; - AnimationLoopMode LoopMode = ALM_Stop; + AnimationState State = AnimationState::Stopped; + AnimationLoopMode LoopMode = AnimationLoopMode::Stop; // Animation skips to the end when skip mode is enabled bool SkipOnSkipMode = true; + void SetDuration(float duration) { + DurationIn = duration; + DurationOut = duration; + } + + void Stop() { State = AnimationState::Stopped; } + void StartIn(bool reset = false) { if (reset) Progress = 0; - Direction = 1; - State = AS_Playing; + Direction = AnimationDirection::In; + State = AnimationState::Playing; StartInImpl(reset); } + void StartOut(bool reset = false) { if (reset) Progress = 1; - Direction = -1; - State = AS_Playing; + Direction = AnimationDirection::Out; + State = AnimationState::Playing; StartOutImpl(reset); } + void Update(float dt) { - if (State == AS_Stopped) return; + if (State == +AnimationState::Stopped) return; UpdateImpl(dt); } virtual void Render() {} - bool IsOut() const { return Progress == 0 && State == AS_Stopped; } - bool IsIn() const { return Progress == 1 && State == AS_Stopped; } + bool IsOut() const { + return Progress == 0 && State == +AnimationState::Stopped; + } + bool IsIn() const { + return Progress == 1 && State == +AnimationState::Stopped; + } protected: + void AddDelta(float dt); virtual void StartInImpl(bool reset = false) {} virtual void StartOutImpl(bool reset = false) {} virtual void UpdateImpl(float dt) { if (SkipOnSkipMode && GetFlag(Profile::ScriptVars::SF_MESALLSKIP) && - State != AS_Stopped) { - Progress = Direction == 1 ? 1.0f : 0.0f; + State != +AnimationState::Stopped) { + Progress = Direction == +AnimationDirection::In ? 1.0f : 0.0f; } AddDelta(dt); } - - void AddDelta(float dt) { - if (Direction == 1) { - Progress += dt / DurationIn; - if (Progress >= 1) { - switch (LoopMode) { - case ALM_Stop: { - Progress = 1; - State = AS_Stopped; - break; - } - case ALM_ReverseDirection: { - // E.g. Progress = 1.04 => Progress = 0.96 - Progress = 1 - (Progress - 1); - Direction = -1; - StartOutImpl(); - break; - } - case ALM_Loop: { - // E.g. Progress = 1.04 => Progress = 0.04 - Progress = (Progress - 1); - StartInImpl(); - break; - } - } - } - } else { - Progress -= dt / DurationOut; - if (Progress <= 0) { - switch (LoopMode) { - case ALM_Stop: { - Progress = 0; - State = AS_Stopped; - break; - } - case ALM_ReverseDirection: { - // e.g. Progress = -0.04 => Progress = 0.04 - Progress = 0 - Progress; - Direction = 1; - StartInImpl(); - break; - } - case ALM_Loop: { - // e.g. Progress = -0.04 => Progress = 0.96 - Progress = 1 + Progress; - StartOutImpl(); - break; - } - } - } - } - } }; } // namespace Impacto \ No newline at end of file diff --git a/src/games/cc/dialoguebox.cpp b/src/games/cc/dialoguebox.cpp index f01efb60..ada4931a 100644 --- a/src/games/cc/dialoguebox.cpp +++ b/src/games/cc/dialoguebox.cpp @@ -17,9 +17,9 @@ using namespace Impacto::Profile::CC::DialogueBox; void DialogueBox::Init() { Impacto::DialogueBox::Init(); } void DialogueBox::Update(float dt) { - if (TextBoxEffect.State != AS_Playing) { + if (TextBoxEffect.State != +AnimationState::Playing) { TextBoxEffect.DurationIn = ADVBoxEffectDuration; - TextBoxEffect.LoopMode = ALM_Loop; + TextBoxEffect.LoopMode = AnimationLoopMode::Loop; TextBoxEffect.StartIn(); } diff --git a/src/games/cc/sysmesbox.cpp b/src/games/cc/sysmesbox.cpp index dde0331e..fedc97d5 100644 --- a/src/games/cc/sysmesbox.cpp +++ b/src/games/cc/sysmesbox.cpp @@ -221,8 +221,8 @@ void SysMesBox::Init() { FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; } void SysMesBox::AddMessage(uint8_t* str) { diff --git a/src/games/cc/titlemenu.cpp b/src/games/cc/titlemenu.cpp index dd99857f..d7e9035c 100644 --- a/src/games/cc/titlemenu.cpp +++ b/src/games/cc/titlemenu.cpp @@ -165,7 +165,7 @@ void TitleMenu::Show() { IsFocused = true; UI::FocusedMenu = this; AllowsScriptInput = true; - if (PressToStartAnimation.State == AS_Stopped) { + if (PressToStartAnimation.State == +AnimationState::Stopped) { PressToStartAnimation.StartIn(); SmokeAnimation.StartIn(); } diff --git a/src/games/cclcc/clearlistmenu.cpp b/src/games/cclcc/clearlistmenu.cpp index d6071412..ca344aaf 100644 --- a/src/games/cclcc/clearlistmenu.cpp +++ b/src/games/cclcc/clearlistmenu.cpp @@ -24,8 +24,8 @@ using namespace Impacto::Vm::Interface; using namespace Impacto::UI::Widgets; ClearListMenu::ClearListMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; } diff --git a/src/games/cclcc/librarymenu.cpp b/src/games/cclcc/librarymenu.cpp index f90eaae3..5e355b9c 100644 --- a/src/games/cclcc/librarymenu.cpp +++ b/src/games/cclcc/librarymenu.cpp @@ -34,8 +34,8 @@ LibraryMenu::LibraryMenu() { LibraryMenuButtonOnClick(target); }; - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; } diff --git a/src/games/cclcc/mapsystem.cpp b/src/games/cclcc/mapsystem.cpp index 19327514..9838ad38 100644 --- a/src/games/cclcc/mapsystem.cpp +++ b/src/games/cclcc/mapsystem.cpp @@ -208,7 +208,8 @@ int MapSystemCCLCC::MapLoad(uint8_t* data) { : (MapPartsDisp[i].state == Showing || MapPartsDisp[i].state == Shown) ? 1 - progress / conversionFactor : 0; - MapPartsDisp[i].fadeAnim.Direction = inOrOut; + MapPartsDisp[i].fadeAnim.Direction = + inOrOut ? AnimationDirection::In : AnimationDirection::Out; MapPartsDisp[i].delay = data[dataSize]; dataSize += 4; MapPartsDisp[i].angle = data[dataSize]; @@ -242,7 +243,8 @@ int MapSystemCCLCC::MapLoad(uint8_t* data) { : (MapPoolDisp[i].state == Showing || MapPoolDisp[i].state == Hidden) ? 1 - progress / conversionFactor : 0; - MapPoolDisp[i].fadeAnim.Direction = inOrOut; + MapPoolDisp[i].fadeAnim.Direction = + inOrOut ? AnimationDirection::In : AnimationDirection::Out; MapPoolDisp[i].delay = data[dataSize]; dataSize += 4; MapPoolDisp[i].angle = data[dataSize]; @@ -1898,7 +1900,7 @@ void MapSystemCCLCC::MapFadeMain(float dt) { if (partsDispElem.state == Showing) { if (partsDispElem.fadeAnim.IsIn()) { partsDispElem.state = Shown; - } else if (partsDispElem.fadeAnim.State == AS_Stopped) { + } else if (partsDispElem.fadeAnim.State == +AnimationState::Stopped) { if (partsDispElem.type == 0 || (partsDispElem.type >= 8 && partsDispElem.type <= 11)) { Audio::Channels[Audio::AC_SSE]->Play("sysse", 7, false, 0.0f); @@ -1908,7 +1910,7 @@ void MapSystemCCLCC::MapFadeMain(float dt) { } else if (partsDispElem.state == Hiding) { if (partsDispElem.fadeAnim.IsOut()) { partsDispElem.state = Hidden; - } else if (partsDispElem.fadeAnim.State == AS_Stopped) { + } else if (partsDispElem.fadeAnim.State == +AnimationState::Stopped) { if (partsDispElem.type == 0 || (partsDispElem.type >= 8 && partsDispElem.type <= 11)) { Audio::Channels[Audio::AC_SSE]->Play("sysse", 9, false, 0.0f); @@ -1940,7 +1942,7 @@ void MapSystemCCLCC::MapFadeMain(float dt) { if (poolDispElem.state == Showing) { if (poolDispElem.fadeAnim.IsIn()) { poolDispElem.state = Shown; - } else if (poolDispElem.fadeAnim.State == AS_Stopped) { + } else if (poolDispElem.fadeAnim.State == +AnimationState::Stopped) { if (i % 2 == 1) { Audio::Channels[Audio::AC_SSE]->Play("sysse", 7, false, 0.0f); } @@ -1950,7 +1952,7 @@ void MapSystemCCLCC::MapFadeMain(float dt) { } else if (poolDispElem.state == Hiding) { if (poolDispElem.fadeAnim.IsOut()) { poolDispElem.state = Hidden; - } else if (poolDispElem.fadeAnim.State == AS_Stopped) { + } else if (poolDispElem.fadeAnim.State == +AnimationState::Stopped) { if (i % 2 == 1) { Audio::Channels[Audio::AC_SSE]->Play("sysse", 9, false, 0.0f); } diff --git a/src/games/cclcc/optionsmenu.cpp b/src/games/cclcc/optionsmenu.cpp index 057af5c6..67184740 100644 --- a/src/games/cclcc/optionsmenu.cpp +++ b/src/games/cclcc/optionsmenu.cpp @@ -21,8 +21,8 @@ using namespace Impacto::Profile::ScriptVars; using namespace Impacto::Vm::Interface; OptionsMenu::OptionsMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; } diff --git a/src/games/cclcc/savemenu.cpp b/src/games/cclcc/savemenu.cpp index 75cf4a98..da552f42 100644 --- a/src/games/cclcc/savemenu.cpp +++ b/src/games/cclcc/savemenu.cpp @@ -41,8 +41,8 @@ void SaveMenu::MenuButtonOnClick(Widgets::Button* target) { } SaveMenu::SaveMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; } diff --git a/src/games/cclcc/systemmenu.cpp b/src/games/cclcc/systemmenu.cpp index 96d9a9a2..0d2f32e1 100644 --- a/src/games/cclcc/systemmenu.cpp +++ b/src/games/cclcc/systemmenu.cpp @@ -27,18 +27,18 @@ void SystemMenu::MenuButtonOnClick(Widgets::Button* target) { } SystemMenu::SystemMenu() { - MenuTransition.Direction = 1; - MenuTransition.LoopMode = ALM_Stop; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; MenuTransition.DurationIn = MoveInDuration; MenuTransition.DurationOut = MoveOutDuration; - MenuFade.Direction = 1.0f; - MenuFade.LoopMode = ALM_Stop; + MenuFade.Direction = AnimationDirection::In; + MenuFade.LoopMode = AnimationLoopMode::Stop; MenuFade.DurationIn = FadeInDuration; MenuFade.DurationOut = FadeOutDuration; - ItemsFade.Direction = 1.0f; - ItemsFade.LoopMode = ALM_Stop; + ItemsFade.Direction = AnimationDirection::In; + ItemsFade.LoopMode = AnimationLoopMode::Stop; ItemsFade.DurationIn = ItemsFadeInDuration; ItemsFade.DurationOut = ItemsFadeOutDuration; diff --git a/src/games/cclcc/tipsmenu.cpp b/src/games/cclcc/tipsmenu.cpp index d63cb409..9e3824e4 100644 --- a/src/games/cclcc/tipsmenu.cpp +++ b/src/games/cclcc/tipsmenu.cpp @@ -89,8 +89,8 @@ struct SortByTipName { }; TipsMenu::TipsMenu() : TipViewItems(this) { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; TransitionAnimation.DurationIn = TransitionInDuration; @@ -306,7 +306,7 @@ void TipsMenu::Update(float dt) { } }; - if (TransitionAnimation.State == AS_Playing) { + if (TransitionAnimation.State == +AnimationState::Playing) { float move = glm::mix(0.0f, Profile::DesignHeight / 2, TransitionAnimation.Progress) - LastYPos; diff --git a/src/games/cclcc/tipsnotification.cpp b/src/games/cclcc/tipsnotification.cpp index 9bb626c7..cc17e6a6 100644 --- a/src/games/cclcc/tipsnotification.cpp +++ b/src/games/cclcc/tipsnotification.cpp @@ -22,7 +22,7 @@ TipsNotification::TipsNotification() { FadeAnimation.DurationOut = FadeOutDuration; Timer.DurationIn = TimerDuration; - Timer.LoopMode = ALM_Stop; + Timer.LoopMode = AnimationLoopMode::Stop; auto textBefore = Vm::ScriptGetTextTableStrAddress( TextTableId, NotificationTextPart1MessageId); diff --git a/src/games/cclcc/titlemenu.cpp b/src/games/cclcc/titlemenu.cpp index 82000ce4..d34c4bcf 100644 --- a/src/games/cclcc/titlemenu.cpp +++ b/src/games/cclcc/titlemenu.cpp @@ -206,7 +206,7 @@ void TitleMenu::Show() { IsFocused = true; UI::FocusedMenu = this; AllowsScriptInput = true; - if (PressToStartAnimation.State == AS_Stopped) { + if (PressToStartAnimation.State == +AnimationState::Stopped) { PressToStartAnimation.StartIn(); SmokeAnimation.StartIn(); } diff --git a/src/games/chlcc/albummenu.cpp b/src/games/chlcc/albummenu.cpp index 68e944c7..88cdc0d6 100644 --- a/src/games/chlcc/albummenu.cpp +++ b/src/games/chlcc/albummenu.cpp @@ -38,13 +38,12 @@ void AlbumMenu::CgOnClick(Widgets::Button* target) { AlbumMenu::AlbumMenu() { CurrentPage = 0; - MenuTransition.Direction = 1.0f; - MenuTransition.LoopMode = ALM_Stop; - MenuTransition.DurationIn = MenuTransitionDuration; - MenuTransition.DurationOut = MenuTransitionDuration; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; + MenuTransition.SetDuration(MenuTransitionDuration); - TitleFade.Direction = 1.0f; - TitleFade.LoopMode = ALM_Stop; + TitleFade.Direction = AnimationDirection::In; + TitleFade.LoopMode = AnimationLoopMode::Stop; TitleFade.DurationIn = TitleFadeInDuration; TitleFade.DurationOut = TitleFadeOutDuration; diff --git a/src/games/chlcc/clearlistmenu.cpp b/src/games/chlcc/clearlistmenu.cpp index 8d8da8da..ee08b2f8 100644 --- a/src/games/chlcc/clearlistmenu.cpp +++ b/src/games/chlcc/clearlistmenu.cpp @@ -20,13 +20,13 @@ using namespace Impacto::TipsSystem; using namespace Impacto::Profile; ClearListMenu::ClearListMenu() { - MenuTransition.Direction = 1.0f; - MenuTransition.LoopMode = ALM_Stop; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; MenuTransition.DurationIn = MenuTransitionDuration; MenuTransition.DurationOut = MenuTransitionDuration; - TitleFade.Direction = 1.0f; - TitleFade.LoopMode = ALM_Stop; + TitleFade.Direction = AnimationDirection::In; + TitleFade.LoopMode = AnimationLoopMode::Stop; TitleFade.DurationIn = TitleFadeInDuration; TitleFade.DurationOut = TitleFadeOutDuration; diff --git a/src/games/chlcc/moviemenu.cpp b/src/games/chlcc/moviemenu.cpp index 10f6c065..78ef9db4 100644 --- a/src/games/chlcc/moviemenu.cpp +++ b/src/games/chlcc/moviemenu.cpp @@ -38,18 +38,17 @@ void MovieMenu::MovieButtonOnClick(Widgets::Button* target) { } MovieMenu::MovieMenu() { - MenuTransition.Direction = 1.0f; - MenuTransition.LoopMode = ALM_Stop; - MenuTransition.DurationIn = MenuTransitionDuration; - MenuTransition.DurationOut = MenuTransitionDuration; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; + MenuTransition.SetDuration(MenuTransitionDuration); - TitleFade.Direction = 1.0f; - TitleFade.LoopMode = ALM_Stop; + TitleFade.Direction = AnimationDirection::In; + TitleFade.LoopMode = AnimationLoopMode::Stop; TitleFade.DurationIn = TitleFadeInDuration; TitleFade.DurationOut = TitleFadeOutDuration; - SelectMovieTextFade.Direction = 1; - SelectMovieTextFade.LoopMode = ALM_Loop; + SelectMovieTextFade.Direction = AnimationDirection::In; + SelectMovieTextFade.LoopMode = AnimationLoopMode::Loop; SelectMovieTextFade.DurationIn = SelectMovieFadeDuration; RedBarSprite = InitialRedBarSprite; diff --git a/src/games/chlcc/musicmenu.cpp b/src/games/chlcc/musicmenu.cpp index 67d9700e..a3552580 100644 --- a/src/games/chlcc/musicmenu.cpp +++ b/src/games/chlcc/musicmenu.cpp @@ -28,20 +28,18 @@ void MusicMenu::MusicButtonOnClick(Button* target) { } MusicMenu::MusicMenu() { - MenuTransition.Direction = 1.0f; - MenuTransition.LoopMode = ALM_Stop; - MenuTransition.DurationIn = MenuTransitionDuration; - MenuTransition.DurationOut = MenuTransitionDuration; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; + MenuTransition.SetDuration(MenuTransitionDuration); - TitleFade.Direction = 1.0f; - TitleFade.LoopMode = ALM_Stop; + TitleFade.Direction = AnimationDirection::In; + TitleFade.LoopMode = AnimationLoopMode::Stop; TitleFade.DurationIn = TitleFadeInDuration; TitleFade.DurationOut = TitleFadeOutDuration; - NowPlayingAnimation.Direction = 1.0f; - NowPlayingAnimation.LoopMode = ALM_Stop; - NowPlayingAnimation.DurationIn = NowPlayingAnimationDuration; - NowPlayingAnimation.DurationOut = NowPlayingAnimationDuration; + NowPlayingAnimation.Direction = AnimationDirection::In; + NowPlayingAnimation.LoopMode = AnimationLoopMode::Stop; + NowPlayingAnimation.SetDuration(NowPlayingAnimationDuration); RedBarSprite = InitialRedBarSprite; RedBarPosition = InitialRedBarPosition; diff --git a/src/games/chlcc/optionsmenu.cpp b/src/games/chlcc/optionsmenu.cpp index 2e5802d3..f5fe40a8 100644 --- a/src/games/chlcc/optionsmenu.cpp +++ b/src/games/chlcc/optionsmenu.cpp @@ -26,13 +26,12 @@ using namespace Impacto::Vm::Interface; using namespace Impacto::UI::Widgets; OptionsMenu::OptionsMenu() { - MenuTransition.Direction = 1.0f; - MenuTransition.LoopMode = ALM_Stop; - MenuTransition.DurationIn = MenuTransitionDuration; - MenuTransition.DurationOut = MenuTransitionDuration; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; + MenuTransition.SetDuration(MenuTransitionDuration); - TitleFade.Direction = 1.0f; - TitleFade.LoopMode = ALM_Stop; + TitleFade.Direction = AnimationDirection::In; + TitleFade.LoopMode = AnimationLoopMode::Stop; TitleFade.DurationIn = TitleFadeInDuration; TitleFade.DurationOut = TitleFadeOutDuration; diff --git a/src/games/chlcc/savemenu.cpp b/src/games/chlcc/savemenu.cpp index f6ccc3a2..9de81b67 100644 --- a/src/games/chlcc/savemenu.cpp +++ b/src/games/chlcc/savemenu.cpp @@ -36,18 +36,18 @@ void SaveMenu::MenuButtonOnClick(Widgets::Button* target) { } SaveMenu::SaveMenu() { - MenuTransition.Direction = 1; - MenuTransition.LoopMode = ALM_Stop; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; MenuTransition.DurationIn = FadeInDuration; MenuTransition.DurationOut = FadeOutDuration; - TitleFade.Direction = 1.0f; - TitleFade.LoopMode = ALM_Stop; + TitleFade.Direction = AnimationDirection::In; + TitleFade.LoopMode = AnimationLoopMode::Stop; TitleFade.DurationIn = TitleFadeInDuration; TitleFade.DurationOut = TitleFadeOutDuration; - SelectDataTextFade.Direction = 1; - SelectDataTextFade.LoopMode = ALM_Loop; + SelectDataTextFade.Direction = AnimationDirection::In; + SelectDataTextFade.LoopMode = AnimationLoopMode::Loop; SelectDataTextFade.DurationIn = SelectDataFadeDuration; RedBarSprite = InitialRedBarSprite; diff --git a/src/games/chlcc/sysmesbox.cpp b/src/games/chlcc/sysmesbox.cpp index 92e9bbdc..90e51ee9 100644 --- a/src/games/chlcc/sysmesbox.cpp +++ b/src/games/chlcc/sysmesbox.cpp @@ -153,8 +153,8 @@ void SysMesBox::Init() { FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; } void SysMesBox::AddMessage(uint8_t* str) { diff --git a/src/games/chlcc/systemmenu.cpp b/src/games/chlcc/systemmenu.cpp index 88945646..5bf9cfa5 100644 --- a/src/games/chlcc/systemmenu.cpp +++ b/src/games/chlcc/systemmenu.cpp @@ -25,13 +25,13 @@ void SystemMenu::MenuButtonOnClick(Widgets::Button* target) { } SystemMenu::SystemMenu() { - MenuTransition.Direction = 1; - MenuTransition.LoopMode = ALM_Stop; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; MenuTransition.DurationIn = FadeInDuration; MenuTransition.DurationOut = FadeOutDuration; - TitleFade.Direction = 1.0f; - TitleFade.LoopMode = ALM_Stop; + TitleFade.Direction = AnimationDirection::In; + TitleFade.LoopMode = AnimationLoopMode::Stop; TitleFade.DurationIn = TitleFadeInDuration; TitleFade.DurationOut = TitleFadeOutDuration; diff --git a/src/games/chlcc/tipsmenu.cpp b/src/games/chlcc/tipsmenu.cpp index 8fe88370..317d8709 100644 --- a/src/games/chlcc/tipsmenu.cpp +++ b/src/games/chlcc/tipsmenu.cpp @@ -26,13 +26,12 @@ using namespace Impacto::Vm::Interface; using namespace Impacto::UI::Widgets; TipsMenu::TipsMenu() { - MenuTransition.Direction = 1.0f; - MenuTransition.LoopMode = ALM_Stop; - MenuTransition.DurationIn = MenuTransitionDuration; - MenuTransition.DurationOut = MenuTransitionDuration; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; + MenuTransition.SetDuration(MenuTransitionDuration); - TitleFade.Direction = 1.0f; - TitleFade.LoopMode = ALM_Stop; + TitleFade.Direction = AnimationDirection::In; + TitleFade.LoopMode = AnimationLoopMode::Stop; TitleFade.DurationIn = TitleFadeInDuration; TitleFade.DurationOut = TitleFadeOutDuration; diff --git a/src/games/chlcc/titlemenu.cpp b/src/games/chlcc/titlemenu.cpp index 9911ebd2..609196ef 100644 --- a/src/games/chlcc/titlemenu.cpp +++ b/src/games/chlcc/titlemenu.cpp @@ -236,7 +236,7 @@ void TitleMenu::Show() { } IsFocused = true; UI::FocusedMenu = this; - if (PressToStartAnimation.State == AS_Stopped) { + if (PressToStartAnimation.State == +AnimationState::Stopped) { PressToStartAnimation.StartIn(); SpinningCircleAnimation.StartIn(); } @@ -364,7 +364,7 @@ void TitleMenu::Update(float dt) { } } break; } - if (PressToStartAnimation.State == AS_Stopped && + if (PressToStartAnimation.State == +AnimationState::Stopped && ScrWork[SW_TITLEDISPCT] == 1) { PressToStartAnimation.StartIn(); SpinningCircleAnimation.StartIn(); @@ -391,9 +391,9 @@ void TitleMenu::Render() { } break; case 3: { // MenuItems Fade In if (ItemsFadeInAnimation.IsOut() && - ItemsFadeInAnimation.State != AS_Playing) + ItemsFadeInAnimation.State != +AnimationState::Playing) ItemsFadeInAnimation.StartIn(); - else if (ItemsFadeInAnimation.State != AS_Playing) + else if (ItemsFadeInAnimation.State != +AnimationState::Playing) ItemsFadeInAnimation.StartOut(); DrawTitleMenuBackGraphics(); MainItems->Render(); @@ -404,9 +404,10 @@ void TitleMenu::Render() { } break; case 7: { // Secondary menu LOAD Fade In if (SecondaryItemsFadeInAnimation.IsOut() && - SecondaryItemsFadeInAnimation.State != AS_Playing) + SecondaryItemsFadeInAnimation.State != +AnimationState::Playing) SecondaryItemsFadeInAnimation.StartIn(); - else if (SecondaryItemsFadeInAnimation.State != AS_Playing) + else if (SecondaryItemsFadeInAnimation.State != + +AnimationState::Playing) SecondaryItemsFadeInAnimation.StartOut(); } break; case 8: { // Secondary menu LOAD diff --git a/src/games/chlcc/trophymenu.cpp b/src/games/chlcc/trophymenu.cpp index 29b80489..77340c97 100644 --- a/src/games/chlcc/trophymenu.cpp +++ b/src/games/chlcc/trophymenu.cpp @@ -29,13 +29,12 @@ using namespace Impacto::UI::Widgets; using namespace Impacto::UI::Widgets::CHLCC; TrophyMenu::TrophyMenu() { - MenuTransition.Direction = 1.0f; - MenuTransition.LoopMode = ALM_Stop; - MenuTransition.DurationIn = MenuTransitionDuration; - MenuTransition.DurationOut = MenuTransitionDuration; + MenuTransition.Direction = AnimationDirection::In; + MenuTransition.LoopMode = AnimationLoopMode::Stop; + MenuTransition.SetDuration(MenuTransitionDuration); - TitleFade.Direction = 1.0f; - TitleFade.LoopMode = ALM_Stop; + TitleFade.Direction = AnimationDirection::In; + TitleFade.LoopMode = AnimationLoopMode::Stop; TitleFade.DurationIn = TitleFadeInDuration; TitleFade.DurationOut = TitleFadeOutDuration; diff --git a/src/games/darling/sysmesbox.cpp b/src/games/darling/sysmesbox.cpp index c78a70e8..b92a52eb 100644 --- a/src/games/darling/sysmesbox.cpp +++ b/src/games/darling/sysmesbox.cpp @@ -162,8 +162,8 @@ void SysMesBox::Init() { FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; } void SysMesBox::AddMessage(uint8_t* str) { diff --git a/src/games/dash/titlemenu.cpp b/src/games/dash/titlemenu.cpp index f0b03c77..170a444a 100644 --- a/src/games/dash/titlemenu.cpp +++ b/src/games/dash/titlemenu.cpp @@ -32,7 +32,7 @@ void TitleMenu::Show() { } IsFocused = true; UI::FocusedMenu = this; - if (PressToStartAnimation.State == AS_Stopped) { + if (PressToStartAnimation.State == +AnimationState::Stopped) { PressToStartAnimation.StartIn(); } } diff --git a/src/games/mo6tw/actorsvoicemenu.cpp b/src/games/mo6tw/actorsvoicemenu.cpp index 957cb0a8..209088b9 100644 --- a/src/games/mo6tw/actorsvoicemenu.cpp +++ b/src/games/mo6tw/actorsvoicemenu.cpp @@ -24,8 +24,8 @@ void ActorsVoiceMenu::VoiceButtonOnClick(Button* target) { } ActorsVoiceMenu::ActorsVoiceMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; diff --git a/src/games/mo6tw/albummenu.cpp b/src/games/mo6tw/albummenu.cpp index 1ab73da7..196d81f2 100644 --- a/src/games/mo6tw/albummenu.cpp +++ b/src/games/mo6tw/albummenu.cpp @@ -43,15 +43,14 @@ void AlbumMenu::OnCgVariationEnd(Widgets::CgViewer* target) { } AlbumMenu::AlbumMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; - ArrowsAnimation.Direction = 1; - ArrowsAnimation.LoopMode = ALM_ReverseDirection; - ArrowsAnimation.DurationIn = ArrowsAnimationDuration; - ArrowsAnimation.DurationOut = ArrowsAnimationDuration; + ArrowsAnimation.Direction = AnimationDirection::In; + ArrowsAnimation.LoopMode = AnimationLoopMode::ReverseDirection; + ArrowsAnimation.SetDuration(ArrowsAnimationDuration); ArrowsAnimation.StartIn(); CgViewerWidget = new CgViewer(); diff --git a/src/games/mo6tw/clearlistmenu.cpp b/src/games/mo6tw/clearlistmenu.cpp index 407829c7..d66e5fdd 100644 --- a/src/games/mo6tw/clearlistmenu.cpp +++ b/src/games/mo6tw/clearlistmenu.cpp @@ -28,15 +28,14 @@ void ClearListMenu::ArrowLeftOnClick(Button* target) { MainItems->Previous(); } void ClearListMenu::ArrowRightOnClick(Button* target) { MainItems->Next(); } ClearListMenu::ClearListMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; - ArrowsAnimation.Direction = 1; - ArrowsAnimation.LoopMode = ALM_ReverseDirection; - ArrowsAnimation.DurationIn = ArrowsAnimationDuration; - ArrowsAnimation.DurationOut = ArrowsAnimationDuration; + ArrowsAnimation.Direction = AnimationDirection::In; + ArrowsAnimation.LoopMode = AnimationLoopMode::ReverseDirection; + ArrowsAnimation.SetDuration(ArrowsAnimationDuration); ArrowsAnimation.StartIn(); MainItems = diff --git a/src/games/mo6tw/moviemenu.cpp b/src/games/mo6tw/moviemenu.cpp index 1c03b96b..a2cbafdd 100644 --- a/src/games/mo6tw/moviemenu.cpp +++ b/src/games/mo6tw/moviemenu.cpp @@ -23,8 +23,8 @@ void MovieMenu::MovieButtonOnClick(Button* target) { } MovieMenu::MovieMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; diff --git a/src/games/mo6tw/musicmenu.cpp b/src/games/mo6tw/musicmenu.cpp index e1500128..9e8730af 100644 --- a/src/games/mo6tw/musicmenu.cpp +++ b/src/games/mo6tw/musicmenu.cpp @@ -28,8 +28,8 @@ void MusicMenu::MusicButtonOnClick(Button* target) { } MusicMenu::MusicMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; diff --git a/src/games/mo6tw/optionsmenu.cpp b/src/games/mo6tw/optionsmenu.cpp index c65ae7ff..2b854b10 100644 --- a/src/games/mo6tw/optionsmenu.cpp +++ b/src/games/mo6tw/optionsmenu.cpp @@ -81,8 +81,8 @@ void OptionsMenu::TipsNotificationsOnClick(Widgets::Toggle* target) { } OptionsMenu::OptionsMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; diff --git a/src/games/mo6tw/savemenu.cpp b/src/games/mo6tw/savemenu.cpp index e84e6f92..5880146e 100644 --- a/src/games/mo6tw/savemenu.cpp +++ b/src/games/mo6tw/savemenu.cpp @@ -33,8 +33,8 @@ void SaveMenu::MenuButtonOnClick(Widgets::Button* target) { } SaveMenu::SaveMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; } diff --git a/src/games/mo6tw/sysmesbox.cpp b/src/games/mo6tw/sysmesbox.cpp index 1f06f641..5fc44a3b 100644 --- a/src/games/mo6tw/sysmesbox.cpp +++ b/src/games/mo6tw/sysmesbox.cpp @@ -165,8 +165,8 @@ void SysMesBox::Init() { FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; } void SysMesBox::AddMessage(uint8_t* str) { diff --git a/src/games/mo6tw/systemmenu.cpp b/src/games/mo6tw/systemmenu.cpp index bdf1178c..36f098cc 100644 --- a/src/games/mo6tw/systemmenu.cpp +++ b/src/games/mo6tw/systemmenu.cpp @@ -40,8 +40,8 @@ SystemMenu::SystemMenu() { MainItems->Add(menuButton, FDIR_DOWN); } - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; } diff --git a/src/games/mo6tw/tipsmenu.cpp b/src/games/mo6tw/tipsmenu.cpp index ae76c447..6d37073c 100644 --- a/src/games/mo6tw/tipsmenu.cpp +++ b/src/games/mo6tw/tipsmenu.cpp @@ -31,8 +31,8 @@ void TipsMenu::TipOnClick(Button *target) { } TipsMenu::TipsMenu() : ItemsList(CDIR_HORIZONTAL), TipViewItems(this) { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; diff --git a/src/games/mo6tw/tipsnotification.cpp b/src/games/mo6tw/tipsnotification.cpp index 2e68b895..d8d338be 100644 --- a/src/games/mo6tw/tipsnotification.cpp +++ b/src/games/mo6tw/tipsnotification.cpp @@ -22,7 +22,7 @@ TipsNotification::TipsNotification() { FadeAnimation.DurationOut = FadeOutDuration; Timer.DurationIn = TimerDuration; - Timer.LoopMode = ALM_Stop; + Timer.LoopMode = AnimationLoopMode::Stop; AlertTitle = new Group(NULL); AlertTitle->FocusLock = true; @@ -97,7 +97,8 @@ void TipsNotification::Render() { float smoothedFade = glm::smoothstep(0.0f, 1.0f, FadeAnimation.Progress); AlertTitle->Tint.a = smoothedFade; AlertTitle->Render(); - if (Timer.State == AS_Playing || FadeAnimation.Direction == -1) { + if (Timer.State == +AnimationState::Playing || + FadeAnimation.Direction == -1) { Notification->Tint.a = smoothedFade; Notification->Render(); } diff --git a/src/games/mo6tw/titlemenu.cpp b/src/games/mo6tw/titlemenu.cpp index c142d487..5ca89bea 100644 --- a/src/games/mo6tw/titlemenu.cpp +++ b/src/games/mo6tw/titlemenu.cpp @@ -200,7 +200,7 @@ void TitleMenu::Show() { } IsFocused = true; UI::FocusedMenu = this; - if (PressToStartAnimation.State == AS_Stopped) + if (PressToStartAnimation.State == +AnimationState::Stopped) PressToStartAnimation.StartIn(); } } diff --git a/src/games/mo8/optionsmenu.cpp b/src/games/mo8/optionsmenu.cpp index e6d28d5f..0cd5cb65 100644 --- a/src/games/mo8/optionsmenu.cpp +++ b/src/games/mo8/optionsmenu.cpp @@ -55,12 +55,12 @@ void OptionsMenu::SkipModeOnClick(Widgets::Toggle* target) { } OptionsMenu::OptionsMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; - PageFadeAnimation.Direction = 1; - PageFadeAnimation.LoopMode = ALM_Stop; + PageFadeAnimation.Direction = AnimationDirection::In; + PageFadeAnimation.LoopMode = AnimationLoopMode::Stop; PageFadeAnimation.DurationIn = FadeInDuration; PageFadeAnimation.DurationOut = FadeOutDuration; @@ -320,7 +320,7 @@ void OptionsMenu::Update(float dt) { GoToNextPage(); } - if (PageFadeAnimation.State == AS_Playing) { + if (PageFadeAnimation.State == +AnimationState::Playing) { (*PreviousPage)->Update(dt); (*CurrentPage)->Update(dt); } else { @@ -344,7 +344,7 @@ void OptionsMenu::Render() { glm::smoothstep(0.0f, 1.0f, FadeAnimation.Progress)); Renderer->DrawSprite(BackgroundSprite, glm::vec2(0.0f, 0.0f), col); - if (PageFadeAnimation.State == AS_Playing) { + if (PageFadeAnimation.State == +AnimationState::Playing) { (*CurrentPage)->Tint = col; (*PreviousPage)->Tint = col; (*CurrentPage)->Tint.a *= diff --git a/src/games/mo8/savemenu.cpp b/src/games/mo8/savemenu.cpp index a2be8bb8..1b5ac8bc 100644 --- a/src/games/mo8/savemenu.cpp +++ b/src/games/mo8/savemenu.cpp @@ -33,8 +33,8 @@ void SaveMenu::MenuButtonOnClick(Widgets::Button* target) { } SaveMenu::SaveMenu() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; diff --git a/src/games/mo8/systemmenu.cpp b/src/games/mo8/systemmenu.cpp index b21413a5..c0886384 100644 --- a/src/games/mo8/systemmenu.cpp +++ b/src/games/mo8/systemmenu.cpp @@ -49,8 +49,8 @@ SystemMenu::SystemMenu() { MainItems->Add(menuButton, FDIR_DOWN); } - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; } diff --git a/src/games/mo8/titlemenu.cpp b/src/games/mo8/titlemenu.cpp index 4d5950b5..b8b451a0 100644 --- a/src/games/mo8/titlemenu.cpp +++ b/src/games/mo8/titlemenu.cpp @@ -195,7 +195,8 @@ void TitleMenu::Show() { } IsFocused = true; UI::FocusedMenu = this; - if (PressToStartAnimated && PressToStartAnimation.State == AS_Stopped) { + if (PressToStartAnimated && + PressToStartAnimation.State == +AnimationState::Stopped) { PressToStartAnimation.StartIn(); } } @@ -240,7 +241,7 @@ void TitleMenu::Update(float dt) { switch (ScrWork[SW_TITLEMODE]) { case 0: case 2: { - if (PrimaryFadeAnimation.State == AS_Stopped && + if (PrimaryFadeAnimation.State == +AnimationState::Stopped && ScrWork[SW_TITLEDISPCT] == 0) PrimaryFadeAnimation.StartOut(true); } break; @@ -256,7 +257,7 @@ void TitleMenu::Update(float dt) { } } break; case 6: { - if (PrimaryFadeAnimation.State == AS_Stopped && + if (PrimaryFadeAnimation.State == +AnimationState::Stopped && ScrWork[SW_TITLEDISPCT] == 0) PrimaryFadeAnimation.StartIn(true); } break; diff --git a/src/games/rne/sysmesbox.cpp b/src/games/rne/sysmesbox.cpp index 8382e88a..95a0875b 100644 --- a/src/games/rne/sysmesbox.cpp +++ b/src/games/rne/sysmesbox.cpp @@ -279,8 +279,8 @@ void SysMesBox::Init() { FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; } void SysMesBox::AddMessage(uint8_t* str) { diff --git a/src/games/rne/titlemenu.cpp b/src/games/rne/titlemenu.cpp index 215b75a9..493e5225 100644 --- a/src/games/rne/titlemenu.cpp +++ b/src/games/rne/titlemenu.cpp @@ -61,7 +61,7 @@ void TitleMenu::Update(float dt) { if (BackgroundAnimation->IsIn()) { if (PreTitleItemsAnimation.IsOut()) PreTitleItemsAnimation.StartIn(); if (PreTitleItemsAnimation.IsIn() && - PressToStartAnimation.State == AS_Stopped) + PressToStartAnimation.State == +AnimationState::Stopped) PressToStartAnimation.StartIn(); } if (PreTitleItemsAnimation.IsIn()) State = Shown; diff --git a/src/hud/autoicondisplay.cpp b/src/hud/autoicondisplay.cpp index 5839075e..a0dfa6fd 100644 --- a/src/hud/autoicondisplay.cpp +++ b/src/hud/autoicondisplay.cpp @@ -16,14 +16,14 @@ void Init() { switch (AutoIconCurrentType) { case AutoIconType::SpriteAnim: SpriteAnim = AutoIconSpriteAnim.Instantiate(); - SpriteAnim.LoopMode = ALM_Stop; + SpriteAnim.LoopMode = AnimationLoopMode::Stop; SpriteAnim.SkipOnSkipMode = false; SpriteAnim.StartIn(); break; case AutoIconType::SpriteAnimFixed: SpriteAnim = AutoIconSpriteAnim.Instantiate(); - SpriteAnim.LoopMode = ALM_Stop; + SpriteAnim.LoopMode = AnimationLoopMode::Stop; SpriteAnim.SkipOnSkipMode = false; FixedSpriteAnim = static_cast(SpriteAnim); FixedSpriteAnim.Def->FixSpriteId = AutoIconFixedSpriteId; diff --git a/src/hud/loadingdisplay.cpp b/src/hud/loadingdisplay.cpp index 51996d91..ed960cbe 100644 --- a/src/hud/loadingdisplay.cpp +++ b/src/hud/loadingdisplay.cpp @@ -27,13 +27,13 @@ void Init() { FadeAnimation.DurationOut = Profile::LoadingDisplay::FadeOutDuration; SaveLoadBg = Profile::LoadingDisplay::SaveLoadBgAnim.Instantiate(); - SaveLoadBg.LoopMode = ALM_Loop; + SaveLoadBg.LoopMode = AnimationLoopMode::Loop; ResourceLoadBg = Profile::LoadingDisplay::ResourceLoadBgAnim.Instantiate(); - ResourceLoadBg.LoopMode = ALM_Loop; + ResourceLoadBg.LoopMode = AnimationLoopMode::Loop; LoadingIcon = Profile::LoadingDisplay::LoadingIconAnim.Instantiate(); - LoadingIcon.LoopMode = ALM_Loop; + LoadingIcon.LoopMode = AnimationLoopMode::Loop; LoadingText = Profile::LoadingDisplay::LoadingTextAnim.Instantiate(); - LoadingText.LoopMode = ALM_Loop; + LoadingText.LoopMode = AnimationLoopMode::Loop; } void Update(float dt) { diff --git a/src/hud/saveicondisplay.cpp b/src/hud/saveicondisplay.cpp index 243fe731..ae40c758 100644 --- a/src/hud/saveicondisplay.cpp +++ b/src/hud/saveicondisplay.cpp @@ -23,7 +23,7 @@ void Init() { FadeAnimation.DurationIn = Profile::SaveIcon::FadeInDuration; FadeAnimation.DurationOut = Profile::SaveIcon::FadeOutDuration; SaveIconForeground = Profile::SaveIcon::ForegroundAnimation.Instantiate(); - SaveIconForeground.LoopMode = ALM_Loop; + SaveIconForeground.LoopMode = AnimationLoopMode::Loop; } void Hide() { @@ -40,7 +40,7 @@ void ShowAt(glm::vec2 pos) { FadeAnimation.StartIn(); } void ShowFor(float seconds) { - Timer.LoopMode = ALM_Stop; + Timer.LoopMode = AnimationLoopMode::Stop; Timer.DurationIn = seconds; Timer.DurationOut = seconds; IsTimed = true; diff --git a/src/hud/skipicondisplay.cpp b/src/hud/skipicondisplay.cpp index cd900f48..7992bf27 100644 --- a/src/hud/skipicondisplay.cpp +++ b/src/hud/skipicondisplay.cpp @@ -16,14 +16,14 @@ void Init() { switch (SkipIconCurrentType) { case SkipIconType::SpriteAnim: SpriteAnim = SkipIconSpriteAnim.Instantiate(); - SpriteAnim.LoopMode = ALM_Stop; + SpriteAnim.LoopMode = AnimationLoopMode::Stop; SpriteAnim.SkipOnSkipMode = false; SpriteAnim.StartIn(); break; case SkipIconType::SpriteAnimFixed: SpriteAnim = SkipIconSpriteAnim.Instantiate(); - SpriteAnim.LoopMode = ALM_Stop; + SpriteAnim.LoopMode = AnimationLoopMode::Stop; SpriteAnim.SkipOnSkipMode = false; FixedSpriteAnim = static_cast(SpriteAnim); FixedSpriteAnim.Def->FixSpriteId = SkipIconFixedSpriteId; diff --git a/src/hud/waiticondisplay.cpp b/src/hud/waiticondisplay.cpp index da9875ac..a47388c1 100644 --- a/src/hud/waiticondisplay.cpp +++ b/src/hud/waiticondisplay.cpp @@ -23,18 +23,18 @@ void Init() { switch (WaitIconCurrentType) { case WaitIconType::SpriteAnim: SpriteAnim = WaitIconSpriteAnim.Instantiate(); - SpriteAnim.LoopMode = ALM_Loop; + SpriteAnim.LoopMode = AnimationLoopMode::Loop; SpriteAnim.StartIn(); break; case WaitIconType::SpriteAnimFixed: SpriteAnim = WaitIconSpriteAnim.Instantiate(); - SpriteAnim.LoopMode = ALM_Stop; + SpriteAnim.LoopMode = AnimationLoopMode::Stop; FixedSpriteAnim = static_cast(SpriteAnim); FixedSpriteAnim.Def->FixSpriteId = WaitIconFixedSpriteId; break; default: SimpleAnim.DurationIn = WaitIconAnimationDuration; - SimpleAnim.LoopMode = ALM_Loop; + SimpleAnim.LoopMode = AnimationLoopMode::Loop; SimpleAnim.StartIn(); break; } diff --git a/src/profile/games/cc/titlemenu.cpp b/src/profile/games/cc/titlemenu.cpp index aab36cac..ebaf2e61 100644 --- a/src/profile/games/cc/titlemenu.cpp +++ b/src/profile/games/cc/titlemenu.cpp @@ -90,9 +90,9 @@ void Configure() { Profile::TitleMenu::PressToStartAnimDurationIn; menu->PressToStartAnimation.DurationOut = Profile::TitleMenu::PressToStartAnimDurationOut; - menu->PressToStartAnimation.LoopMode = ALM_ReverseDirection; + menu->PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; - menu->SmokeAnimation.LoopMode = ALM_Loop; + menu->SmokeAnimation.LoopMode = AnimationLoopMode::Loop; menu->SmokeAnimation.DurationIn = SmokeAnimationDurationIn; menu->SmokeAnimation.DurationOut = SmokeAnimationDurationOut; menu->MoveLeftAnimation.DurationIn = MoveLeftAnimationDurationIn; diff --git a/src/profile/games/cclcc/titlemenu.cpp b/src/profile/games/cclcc/titlemenu.cpp index 99580f87..63f638e5 100644 --- a/src/profile/games/cclcc/titlemenu.cpp +++ b/src/profile/games/cclcc/titlemenu.cpp @@ -89,14 +89,14 @@ void Configure() { Profile::TitleMenu::PressToStartAnimDurationIn; menu->PressToStartAnimation.DurationOut = Profile::TitleMenu::PressToStartAnimDurationOut; - menu->PressToStartAnimation.LoopMode = ALM_ReverseDirection; + menu->PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; menu->PrimaryFadeAnimation.DurationIn = PrimaryFadeInDuration; menu->PrimaryFadeAnimation.DurationOut = PrimaryFadeOutDuration; menu->SecondaryFadeAnimation.DurationIn = SecondaryFadeInDuration; menu->SecondaryFadeAnimation.DurationOut = SecondaryFadeOutDuration; - menu->SmokeAnimation.LoopMode = ALM_Loop; + menu->SmokeAnimation.LoopMode = AnimationLoopMode::Loop; menu->SmokeAnimation.DurationIn = SmokeAnimationDurationIn; menu->SmokeAnimation.DurationOut = SmokeAnimationDurationOut; diff --git a/src/profile/games/chlcc/titlemenu.cpp b/src/profile/games/chlcc/titlemenu.cpp index 757716a2..3b1b1168 100644 --- a/src/profile/games/chlcc/titlemenu.cpp +++ b/src/profile/games/chlcc/titlemenu.cpp @@ -1,6 +1,6 @@ #include "titlemenu.h" #include "../../../log.h" -//#include "../../../window.h" +// #include "../../../window.h" #include "../../../renderer/renderer.h" #include "../../profile_internal.h" @@ -116,7 +116,7 @@ void Configure() { Profile::TitleMenu::PressToStartAnimDurationIn; menu->PressToStartAnimation.DurationOut = Profile::TitleMenu::PressToStartAnimDurationOut; - menu->PressToStartAnimation.LoopMode = ALM_ReverseDirection; + menu->PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; menu->ItemsFadeInAnimation.DurationIn = ItemFadeInDuration; menu->ItemsFadeInAnimation.DurationOut = ItemFadeOutDuration; @@ -125,7 +125,7 @@ void Configure() { menu->SecondaryItemsFadeInAnimation.DurationOut = SecondaryItemFadeOutDuration; - menu->SpinningCircleAnimation.LoopMode = ALM_Loop; + menu->SpinningCircleAnimation.LoopMode = AnimationLoopMode::Loop; menu->SpinningCircleAnimation.DurationIn = SpinningCircleAnimationDuration; menu->SpinningCircleAnimation.DurationOut = SpinningCircleAnimationDuration; diff --git a/src/profile/games/dash/titlemenu.cpp b/src/profile/games/dash/titlemenu.cpp index 8325d7cb..491fb27b 100644 --- a/src/profile/games/dash/titlemenu.cpp +++ b/src/profile/games/dash/titlemenu.cpp @@ -17,7 +17,7 @@ void Configure() { Profile::TitleMenu::PressToStartAnimDurationIn; PressToStartAnimation.DurationOut = Profile::TitleMenu::PressToStartAnimDurationOut; - PressToStartAnimation.LoopMode = ALM_ReverseDirection; + PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; auto drawType = Game::DrawComponentType::_from_integral_unchecked( EnsureGetMemberInt("DrawType")); diff --git a/src/profile/games/mo6tw/titlemenu.cpp b/src/profile/games/mo6tw/titlemenu.cpp index c38d7371..96074c85 100644 --- a/src/profile/games/mo6tw/titlemenu.cpp +++ b/src/profile/games/mo6tw/titlemenu.cpp @@ -42,7 +42,7 @@ void Configure() { Profile::TitleMenu::PressToStartAnimDurationIn; menu->PressToStartAnimation.DurationOut = Profile::TitleMenu::PressToStartAnimDurationOut; - menu->PressToStartAnimation.LoopMode = ALM_ReverseDirection; + menu->PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; menu->PrimaryFadeAnimation.DurationIn = PrimaryFadeAnimDuration; menu->PrimaryFadeAnimation.DurationOut = PrimaryFadeAnimDuration; menu->SecondaryFadeAnimation.DurationIn = SecondaryMenuAnimDuration; diff --git a/src/profile/games/mo8/titlemenu.cpp b/src/profile/games/mo8/titlemenu.cpp index 00185716..4c18970d 100644 --- a/src/profile/games/mo8/titlemenu.cpp +++ b/src/profile/games/mo8/titlemenu.cpp @@ -38,7 +38,7 @@ void Configure() { Profile::TitleMenu::PressToStartAnimDurationIn; PressToStartAnimation.DurationOut = Profile::TitleMenu::PressToStartAnimDurationOut; - PressToStartAnimation.LoopMode = ALM_ReverseDirection; + PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; PrimaryFadeAnimDuration = EnsureGetMemberFloat("PrimaryFadeAnimDuration"); ItemFadeAnimDuration = EnsureGetMemberFloat("ItemFadeAnimDuration"); diff --git a/src/profile/games/rne/titlemenu.cpp b/src/profile/games/rne/titlemenu.cpp index 8b3e26d5..1515e357 100644 --- a/src/profile/games/rne/titlemenu.cpp +++ b/src/profile/games/rne/titlemenu.cpp @@ -42,7 +42,7 @@ void Configure() { Profile::TitleMenu::PressToStartAnimDurationIn; PressToStartAnimation.DurationOut = Profile::TitleMenu::PressToStartAnimDurationOut; - PressToStartAnimation.LoopMode = ALM_ReverseDirection; + PressToStartAnimation.LoopMode = AnimationLoopMode::ReverseDirection; PreTitleItemsAnimation.DurationIn = PreTitleAnimDurationIn; PreTitleItemsAnimation.DurationOut = PreTitleAnimDurationOut; diff --git a/src/profile/ui/titlemenu.cpp b/src/profile/ui/titlemenu.cpp index a65d74b3..85b4d787 100644 --- a/src/profile/ui/titlemenu.cpp +++ b/src/profile/ui/titlemenu.cpp @@ -61,7 +61,7 @@ void Configure() { // PressToStartAnimDurationIn; // Implementation->PressToStartAnimation.DurationOut = // PressToStartAnimDurationOut; - // Implementation->PressToStartAnimation.LoopMode = ALM_ReverseDirection; + // Implementation->PressToStartAnimation.LoopMode = ReverseDirection; //} Pop(); diff --git a/src/spriteanimation.cpp b/src/spriteanimation.cpp index 796e408c..8072e8a2 100644 --- a/src/spriteanimation.cpp +++ b/src/spriteanimation.cpp @@ -25,7 +25,7 @@ void FixedSpriteAnimation::StartOutImpl(bool reset) { void FixedSpriteAnimation::UpdateImpl(float dt) { float fixedSpriteProgress = GetFixedSpriteProgress(); - int animationRequest = Direction; + AnimationDirection animationRequest = Direction; if (Progress == 1.0f && Direction == -1 || Progress == 0.0f && Direction == 1) { @@ -36,8 +36,10 @@ void FixedSpriteAnimation::UpdateImpl(float dt) { // (At the start of the function "Direction" only signifies the // whether the in or out animation should be played; not the actual // direction of the animation) - if (Progress != fixedSpriteProgress) - Direction = Progress > fixedSpriteProgress ? 1 : -1; + if (Progress != fixedSpriteProgress) { + Direction = Progress > fixedSpriteProgress ? AnimationDirection::In + : AnimationDirection::Out; + } // Coordinate transformation and normalization for AddDelta if (Direction == 1) { @@ -61,7 +63,7 @@ void FixedSpriteAnimation::UpdateImpl(float dt) { bool progressAtExtremum = (Progress == 0.0f || Progress == 1.0f); if (animationRequest != Direction && progressAtExtremum) { Direction = animationRequest; - State = AS_Playing; + State = AnimationState::Playing; } } @@ -98,9 +100,10 @@ SpriteAnimation SpriteAnimationDef::Instantiate() { result.DurationIn = this->Duration; result.DurationOut = this->Duration; - if (this->FixSpriteId != 0) + if (this->FixSpriteId != 0) { result.Progress = static_cast(result).GetFixedSpriteProgress(); + } return result; } diff --git a/src/text.cpp b/src/text.cpp index 423dcba0..2eaa010f 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -170,7 +170,7 @@ void TypewriterEffect::Start(int firstGlyph, int glyphCount, float duration) { } void TypewriterEffect::Update(float dt) { - if (State == AS_Stopped) return; + if (State == +AnimationState::Stopped) return; if (CancelRequested) { CancelRequested = false; IsCancelled = true; diff --git a/src/ui/backlogmenu.cpp b/src/ui/backlogmenu.cpp index ea34e4d9..3e73ea56 100644 --- a/src/ui/backlogmenu.cpp +++ b/src/ui/backlogmenu.cpp @@ -44,8 +44,8 @@ BacklogMenu::BacklogMenu() { MainScrollbar->Enabled = false; CurrentEntryPos = EntriesStart; - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; FadeAnimation.DurationIn = FadeInDuration; FadeAnimation.DurationOut = FadeOutDuration; } diff --git a/src/ui/selectionmenu.cpp b/src/ui/selectionmenu.cpp index b14c01b3..162f767d 100644 --- a/src/ui/selectionmenu.cpp +++ b/src/ui/selectionmenu.cpp @@ -26,8 +26,8 @@ void SelectionMenu::Init(bool isPlain) { FadeAnimation.DurationIn = FadeAnimationDurationInOut; FadeAnimation.DurationOut = FadeAnimationDurationInOut; - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; } void SelectionMenu::AddChoice(uint8_t* str) { diff --git a/src/ui/widget.cpp b/src/ui/widget.cpp index fbbbeb34..1f400fbd 100644 --- a/src/ui/widget.cpp +++ b/src/ui/widget.cpp @@ -6,7 +6,7 @@ namespace UI { Widget::~Widget() {} void Widget::Update(float dt) { - if (MoveAnimation.State == AS_Playing) { + if (MoveAnimation.State == +AnimationState::Playing) { MoveAnimation.Update(dt); auto move = glm::mix(MoveOrigin, MoveTarget, MoveAnimation.Progress); MoveTo(move); @@ -25,9 +25,8 @@ void Widget::Move(glm::vec2 relativePosition, float duration) { MoveOrigin = glm::vec2(Bounds.X, Bounds.Y); MoveTarget = MoveOrigin + relativePosition; MoveAnimation.Progress = 0.0f; - MoveAnimation.Direction = 1; - MoveAnimation.DurationIn = duration; - MoveAnimation.DurationOut = duration; + MoveAnimation.Direction = AnimationDirection::In; + MoveAnimation.SetDuration(duration); MoveAnimation.StartIn(); } @@ -40,9 +39,8 @@ void Widget::MoveTo(glm::vec2 pos, float duration) { MoveOrigin = glm::vec2(Bounds.X, Bounds.Y); MoveTarget = pos; MoveAnimation.Progress = 0.0f; - MoveAnimation.Direction = 1; - MoveAnimation.DurationIn = duration; - MoveAnimation.DurationOut = duration; + MoveAnimation.Direction = AnimationDirection::In; + MoveAnimation.SetDuration(duration); MoveAnimation.StartIn(); } diff --git a/src/ui/widgets/cclcc/saveentrybutton.cpp b/src/ui/widgets/cclcc/saveentrybutton.cpp index 568c9eca..44d3fca1 100644 --- a/src/ui/widgets/cclcc/saveentrybutton.cpp +++ b/src/ui/widgets/cclcc/saveentrybutton.cpp @@ -110,17 +110,16 @@ void SaveEntryButton::Move(glm::vec2 relativePosition) { } void SaveEntryButton::FocusedAlphaFadeStart() { - if (FocusedAlphaFade.State == AS_Stopped) { - FocusedAlphaFade.Direction = 1; - FocusedAlphaFade.DurationIn = 0.5f; - FocusedAlphaFade.DurationOut = 0.5f; - FocusedAlphaFade.LoopMode = ALM_ReverseDirection; + if (FocusedAlphaFade.State == +AnimationState::Stopped) { + FocusedAlphaFade.Direction = AnimationDirection::In; + FocusedAlphaFade.SetDuration(0.5f); + FocusedAlphaFade.LoopMode = AnimationLoopMode::ReverseDirection; FocusedAlphaFade.StartIn(); } } void SaveEntryButton::FocusedAlphaFadeReset() { - FocusedAlphaFade.State = AS_Stopped; + FocusedAlphaFade.State = AnimationState::Stopped; FocusedAlphaFade.Progress = 0.0f; } diff --git a/src/ui/widgets/cclcc/titlebutton.cpp b/src/ui/widgets/cclcc/titlebutton.cpp index e12c5a85..8d2f2b27 100644 --- a/src/ui/widgets/cclcc/titlebutton.cpp +++ b/src/ui/widgets/cclcc/titlebutton.cpp @@ -21,7 +21,7 @@ TitleButton::TitleButton(int id, Sprite const& norm, Sprite const& focused, void TitleButton::UpdateInput() { if (!DisableInput && - (IsSubButton || HighlightAnimation.State == AS_Stopped) && + (IsSubButton || HighlightAnimation.State == +AnimationState::Stopped) && ChoiceBlinkAnimation.IsOut()) { Button::UpdateInput(); } @@ -54,15 +54,16 @@ void TitleButton::Render() { float blinkProgress = ChoiceBlinkAnimation.Progress * 4.0f; float blinkAlpha = 0.5f * (1.0f + cos(blinkProgress * glm::two_pi())); glm::vec4 BlinkTint = glm::vec4(1.0f, 1.0f, 1.0f, Tint.a); - if (ChoiceBlinkAnimation.State == AS_Playing) { + if (ChoiceBlinkAnimation.State == +AnimationState::Playing) { BlinkTint.a = blinkAlpha; } - if (HasFocus || !IsSubButton && HighlightAnimation.State == AS_Playing || - ChoiceBlinkAnimation.State == AS_Playing) { + if (HasFocus || + !IsSubButton && HighlightAnimation.State == +AnimationState::Playing || + ChoiceBlinkAnimation.State == +AnimationState::Playing) { if (!IsSubButton) { // Main buttons Sprite newHighlightSprite = HighlightSprite; float smoothProgress = - HighlightAnimation.State == AS_Playing + HighlightAnimation.State == +AnimationState::Playing ? glm::smoothstep(0.0f, 1.0f, HighlightAnimation.Progress) : 1.0f; diff --git a/src/ui/widgets/cgviewer.cpp b/src/ui/widgets/cgviewer.cpp index 48ed35d8..e1a5d71d 100644 --- a/src/ui/widgets/cgviewer.cpp +++ b/src/ui/widgets/cgviewer.cpp @@ -17,10 +17,9 @@ float const ScaleStep = 0.01f; float const MouseAdvanceTime = 0.2f; CgViewer::CgViewer() { - FadeAnimation.Direction = 1; - FadeAnimation.LoopMode = ALM_Stop; - FadeAnimation.DurationIn = 0.5f; - FadeAnimation.DurationOut = 0.5f; + FadeAnimation.Direction = AnimationDirection::In; + FadeAnimation.LoopMode = AnimationLoopMode::Stop; + FadeAnimation.SetDuration(0.5f); } void CgViewer::Show() { diff --git a/src/ui/widgets/chlcc/albumthumbnailbutton.cpp b/src/ui/widgets/chlcc/albumthumbnailbutton.cpp index 80dbbbd6..9465ed0e 100644 --- a/src/ui/widgets/chlcc/albumthumbnailbutton.cpp +++ b/src/ui/widgets/chlcc/albumthumbnailbutton.cpp @@ -31,17 +31,16 @@ void AlbumThumbnailButton::Render() { } void AlbumThumbnailButton::FocusedAlphaFadeStart() { - if (FocusedAlphaFade.State == AS_Stopped) { - FocusedAlphaFade.Direction = 1; - FocusedAlphaFade.DurationIn = 0.5f; - FocusedAlphaFade.DurationOut = 0.5f; - FocusedAlphaFade.LoopMode = ALM_ReverseDirection; + if (FocusedAlphaFade.State == +AnimationState::Stopped) { + FocusedAlphaFade.Direction = AnimationDirection::In; + FocusedAlphaFade.SetDuration(0.5f); + FocusedAlphaFade.LoopMode = AnimationLoopMode::ReverseDirection; FocusedAlphaFade.StartIn(); } } void AlbumThumbnailButton::FocusedAlphaFadeReset() { - FocusedAlphaFade.State = AS_Stopped; + FocusedAlphaFade.State = AnimationState::Stopped; FocusedAlphaFade.Progress = 0.0f; } diff --git a/src/ui/widgets/chlcc/moviemenuentrybutton.cpp b/src/ui/widgets/chlcc/moviemenuentrybutton.cpp index fc408cd4..f21a144e 100644 --- a/src/ui/widgets/chlcc/moviemenuentrybutton.cpp +++ b/src/ui/widgets/chlcc/moviemenuentrybutton.cpp @@ -24,8 +24,8 @@ MovieMenuEntryButton::MovieMenuEntryButton(int id, Sprite const& movieThumbnail, MovieBox.ScaledHeight()); MovieBoxAnim = SelectedMovieAnimation.Instantiate(); - MovieBoxAnim.Direction = 1; - MovieBoxAnim.LoopMode = ALM_Loop; + MovieBoxAnim.Direction = AnimationDirection::In; + MovieBoxAnim.LoopMode = AnimationLoopMode::Loop; MovieBoxAnim.StartIn(); } diff --git a/src/ui/widgets/chlcc/saveentrybutton.cpp b/src/ui/widgets/chlcc/saveentrybutton.cpp index 469b3112..ebdf5d1a 100644 --- a/src/ui/widgets/chlcc/saveentrybutton.cpp +++ b/src/ui/widgets/chlcc/saveentrybutton.cpp @@ -130,17 +130,16 @@ void SaveEntryButton::Move(glm::vec2 relativePosition) { } void SaveEntryButton::FocusedAlphaFadeStart() { - if (FocusedAlphaFade.State == AS_Stopped) { - FocusedAlphaFade.Direction = 1; - FocusedAlphaFade.DurationIn = 0.5f; - FocusedAlphaFade.DurationOut = 0.5f; - FocusedAlphaFade.LoopMode = ALM_ReverseDirection; + if (FocusedAlphaFade.State == +AnimationState::Stopped) { + FocusedAlphaFade.Direction = AnimationDirection::In; + FocusedAlphaFade.SetDuration(0.5f); + FocusedAlphaFade.LoopMode = AnimationLoopMode::ReverseDirection; FocusedAlphaFade.StartIn(); } } void SaveEntryButton::FocusedAlphaFadeReset() { - FocusedAlphaFade.State = AS_Stopped; + FocusedAlphaFade.State = AnimationState::Stopped; FocusedAlphaFade.Progress = 0.0f; } diff --git a/src/ui/widgets/mo6tw/albumcharacterbutton.cpp b/src/ui/widgets/mo6tw/albumcharacterbutton.cpp index 165f909f..62905526 100644 --- a/src/ui/widgets/mo6tw/albumcharacterbutton.cpp +++ b/src/ui/widgets/mo6tw/albumcharacterbutton.cpp @@ -22,10 +22,9 @@ AlbumCharacterButton::AlbumCharacterButton(int id, Sprite const& norm, Bounds = RectF(pos.x, pos.y, NormalSprite.ScaledWidth(), NormalSprite.ScaledHeight()); - HighlightAnimation.Direction = 1; - HighlightAnimation.LoopMode = ALM_ReverseDirection; - HighlightAnimation.DurationIn = highlightAnimationDuration; - HighlightAnimation.DurationOut = highlightAnimationDuration; + HighlightAnimation.Direction = AnimationDirection::In; + HighlightAnimation.LoopMode = AnimationLoopMode::ReverseDirection; + HighlightAnimation.SetDuration(highlightAnimationDuration); HighlightAnimation.StartIn(); } diff --git a/src/ui/widgets/mo6tw/imagethumbnailbutton.cpp b/src/ui/widgets/mo6tw/imagethumbnailbutton.cpp index fc53791d..4c3c5bfb 100644 --- a/src/ui/widgets/mo6tw/imagethumbnailbutton.cpp +++ b/src/ui/widgets/mo6tw/imagethumbnailbutton.cpp @@ -28,10 +28,9 @@ ImageThumbnailButton::ImageThumbnailButton(int id, Sprite const& norm, Bounds = RectF(pos.x, pos.y, NormalSprite.ScaledWidth(), NormalSprite.ScaledHeight()); - HighlightAnimation.Direction = 1; - HighlightAnimation.LoopMode = ALM_Loop; - HighlightAnimation.DurationIn = HighlightAnimationDuration; - HighlightAnimation.DurationOut = HighlightAnimationDuration; + HighlightAnimation.Direction = AnimationDirection::In; + HighlightAnimation.LoopMode = AnimationLoopMode::Loop; + HighlightAnimation.SetDuration(HighlightAnimationDuration); HighlightAnimation.StartIn(); } diff --git a/src/vm/inst_dialogue.cpp b/src/vm/inst_dialogue.cpp index ec8c5e1a..d52bef20 100644 --- a/src/vm/inst_dialogue.cpp +++ b/src/vm/inst_dialogue.cpp @@ -277,13 +277,13 @@ VmInstruction(InstMessWindow) { } break; case 2: // AwaitShowCurrent - if (currentPage->FadeAnimation.State == AS_Playing) { + if (currentPage->FadeAnimation.State == +AnimationState::Playing) { ResetInstruction; BlockThread; } break; case 3: // AwaitHideCurrent - if (currentPage->FadeAnimation.State == AS_Playing) { + if (currentPage->FadeAnimation.State == +AnimationState::Playing) { ResetInstruction; BlockThread; } else if (currentPage->FadeAnimation.IsOut()) {