From f6cd86d77e1e67468936548297a9f63f1a6cc5c0 Mon Sep 17 00:00:00 2001 From: nukeykt Date: Fri, 13 Sep 2019 19:15:16 +0900 Subject: [PATCH] Simplify map title rendering code and enable alpha for classic renderer --- source/blood/src/view.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index c4f9a6610..a23964ccc 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -1242,15 +1242,11 @@ void viewDrawMapTitle(void) if (!gShowMapTitle || gGameMenuMgr.m_bActive) return; - int seconds = (gLevelTime / kTicsPerSec); - int millisecs = (gLevelTime % kTicsPerSec) * 33; - if (seconds > 3) + int const fadeStartTic = int(1.f*kTicsPerSec); + int const fadeEndTic = int(1.25f*kTicsPerSec); + if (gLevelTime > fadeEndTic) return; - - const int noAlphaForSecs = 1; - uint8_t alpha = videoGetRenderMode() != REND_CLASSIC || numalphatabs >= 15 ? - seconds < noAlphaForSecs ? 0 : clamp(((seconds-noAlphaForSecs)*1000+millisecs)/4, 0, 255) - : 0; + uint8_t const alpha = clamp((gLevelTime-fadeStartTic)*255/(fadeEndTic-fadeStartTic), 0, 255); if (alpha != 255) {