From 5c69ae7d11ab9bd6570311852786c3c438076335 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 9 Apr 2015 07:51:48 +0000 Subject: [PATCH] Allow alpha fade-out for quotes and the menu mouse cursor in 8-bit when the supplied PALETTE.DAT has enough alpha tables to fully display each effect. git-svn-id: https://svn.eduke32.com/eduke32@5124 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 4 ++++ polymer/eduke32/build/src/engine.c | 5 ----- polymer/eduke32/source/game.c | 5 +++-- polymer/eduke32/source/menus.h | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index d57119ba7..f4c55e28b 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -703,6 +703,10 @@ EXTERN char showinvisibility; EXTERN int32_t g_visibility, parallaxvisibility; EXTERN int32_t g_rotatespriteNoWidescreen; +// blendtable[1] to blendtable[numalphatabs] are considered to be +// alpha-blending tables: +EXTERN uint8_t numalphatabs; + EXTERN int32_t windowx1, windowy1, windowx2, windowy2; EXTERN int16_t *startumost, *startdmost; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index a7c5ebd3b..09ddc2298 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -2432,11 +2432,6 @@ char palfadedelta = 0; // // Internal Engine Functions // - -// blendtable[1] to blendtable[numalphatabs] are considered to be -// alpha-blending tables: -static uint8_t numalphatabs; - static char *blendtable[MAXBLENDTABS]; #define getblendtab(blend) (blendtable[blend]) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index daead5f19..11a487eaf 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -158,8 +158,9 @@ static void G_DoOrderScreen(void); #define FTAOPAQUETIME 30 +// alpha increments of 8 --> 256 / 8 = 32 --> round up to power of 2 --> 32 --> divide by 2 --> 16 alphatabs required #define ftapulseshade \ - ((hud_glowingquotes && (getrendermode() == REND_CLASSIC || ps->fta >= FTAOPAQUETIME)) ? \ + ((hud_glowingquotes && ((getrendermode() == REND_CLASSIC && numalphatabs < 16) || ps->fta >= FTAOPAQUETIME)) ? \ (sintable[((uint32_t)ps->fta << 7) & 2047] >> 11) : \ (sintable[((uint32_t)FTAOPAQUETIME << 7) & 2047] >> 11)) @@ -2606,7 +2607,7 @@ static inline int32_t texto(int32_t t) static inline int32_t texta(int32_t t) { - if (getrendermode() == REND_CLASSIC) + if (getrendermode() == REND_CLASSIC && numalphatabs < 16) { if (t > 4) return 0; if (t > 2) return 85; diff --git a/polymer/eduke32/source/menus.h b/polymer/eduke32/source/menus.h index 8433d2ae7..0e4d22496 100644 --- a/polymer/eduke32/source/menus.h +++ b/polymer/eduke32/source/menus.h @@ -435,7 +435,8 @@ extern int32_t m_mouselastactivity; # define MOUSEWATCHPOINTCONDITIONAL(condition) (condition) #else extern int32_t m_mousewake_watchpoint, m_menuchange_watchpoint; -# define MOUSEALPHA (getrendermode() == REND_CLASSIC ? 0 : clamp((totalclock - m_mouselastactivity - 90)*3, 0, 255)) +// alpha increments of 3 --> 255 / 3 = 85 --> round up to power of 2 --> 128 --> divide by 2 --> 64 alphatabs required +# define MOUSEALPHA ((getrendermode() == REND_CLASSIC && numalphatabs < 64) ? 0 : clamp((totalclock - m_mouselastactivity - 90)*3, 0, 255)) # define MOUSEACTIVECONDITION (totalclock - m_mouselastactivity < M_MOUSETIMEOUT) # define MOUSEACTIVECONDITIONAL(condition) (MOUSEACTIVECONDITION && (condition)) # define MOUSEINACTIVECONDITIONAL(condition) (!MOUSEACTIVECONDITION && (condition))