From e41a39ebc5b71cc676fec0ccf8f05789f74db27e Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 20 Jan 2019 00:04:25 +0100 Subject: [PATCH] Fix menu animations --- Source/gmenu.cpp | 5 +++-- Stub/sdlrender.cpp | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index f591cdf90..c93773dad 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -490,8 +490,9 @@ void __fastcall gmenu_draw_menu_item(TMenuItem *pItem, int a2) int MyPcxDelay = 60; int MyPcxFRAME = (SDL_GetTicks() / MyPcxDelay) % 15; - if (++MyPcxFRAME == 15) { - MyPcxFRAME = 1; + MyPcxFRAME++; + if (MyPcxFRAME == 15) { + MyPcxFRAME = 0; } DrawArtWithMask(320 - (gdwLogoWidth / 2), -50, gdwLogoWidth, gdwLogoHeight, MyPcxFRAME, 250, pPcxLogoImage); diff --git a/Stub/sdlrender.cpp b/Stub/sdlrender.cpp index 295755cb7..c19b88283 100644 --- a/Stub/sdlrender.cpp +++ b/Stub/sdlrender.cpp @@ -796,8 +796,8 @@ void RenderDiabloLogo() int MyPcxDelay = 60; int MyPcxFRAME = (SDL_GetTicks() / MyPcxDelay) % 15; // This is not how this should be done... MyPcxFRAME++; - if (MyPcxFRAME >= 15) { - MyPcxFRAME = 1; + if (MyPcxFRAME == 15) { + MyPcxFRAME = 0; } DrawArtWithMask(GetCenter(gdwLogoWidth), 0, gdwLogoWidth, gdwLogoHeight, MyPcxFRAME, 250, pPcxLogoImage); @@ -847,8 +847,9 @@ void SDL_RenderDiabloMainPage() int PentdelayPerFrame = 60; int Pentframe = (SDL_GetTicks() / PentdelayPerFrame) % totalPentFrames; - if (++Pentframe == 8) { - Pentframe = 1; + Pentframe++; + if (Pentframe == 8) { + Pentframe = 0; } int PentPositionX = GetCenter(42);