From 44519f3972e584f45ad6eb279809a1917978da40 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 22 Apr 2012 07:58:04 +0000 Subject: [PATCH] - added Gez's fixed palette flashes for Hexen. SVN r3585 (trunk) --- src/g_hexen/a_clericholy.cpp | 16 +++++++++++++++- src/g_hexen/a_hexenglobal.h | 7 +++++++ src/g_hexen/a_magestaff.cpp | 16 +++++++++++++++- src/g_shared/shared_sbar.cpp | 28 ++++++++++++++++++++++++---- 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index 8c8891155..5d813b9df 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -38,7 +38,21 @@ public: } PalEntry GetBlend () { - return PalEntry (CHolyCount * 128 / 3, 131, 131, 131); + if (paletteflash & PF_HEXENWEAPONS) + { + if (CHolyCount == 3) + return PalEntry(128, 70, 70, 70); + else if (CHolyCount == 2) + return PalEntry(128, 100, 100, 100); + else if (CHolyCount == 1) + return PalEntry(128, 130, 130, 130); + else + return PalEntry(0, 0, 0, 0); + } + else + { + return PalEntry (CHolyCount * 128 / 3, 131, 131, 131); + } } BYTE CHolyCount; }; diff --git a/src/g_hexen/a_hexenglobal.h b/src/g_hexen/a_hexenglobal.h index 44ffc6d57..b736aac48 100644 --- a/src/g_hexen/a_hexenglobal.h +++ b/src/g_hexen/a_hexenglobal.h @@ -3,6 +3,13 @@ #include "d_player.h" +EXTERN_CVAR (Int, paletteflash) +enum PaletteFlashFlags +{ + PF_HEXENWEAPONS = 1, + PF_SPECIALDAMAGE = 2, +}; + class AHolySpirit : public AActor { DECLARE_CLASS (AHolySpirit, AActor) diff --git a/src/g_hexen/a_magestaff.cpp b/src/g_hexen/a_magestaff.cpp index 8673e09d1..97a658a15 100644 --- a/src/g_hexen/a_magestaff.cpp +++ b/src/g_hexen/a_magestaff.cpp @@ -36,7 +36,21 @@ public: } PalEntry GetBlend () { - return PalEntry (MStaffCount * 128 / 3, 151, 110, 0); + if (paletteflash & PF_HEXENWEAPONS) + { + if (MStaffCount == 3) + return PalEntry(128, 100, 73, 0); + else if (MStaffCount == 2) + return PalEntry(128, 125, 92, 0); + else if (MStaffCount == 1) + return PalEntry(128, 150, 110, 0); + else + return PalEntry(0, 0, 0, 0); + } + else + { + return PalEntry (MStaffCount * 128 / 3, 151, 110, 0); + } } BYTE MStaffCount; }; diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 6f5baab38..83e5be77b 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -52,6 +52,7 @@ #include "v_palette.h" #include "d_player.h" #include "farchive.h" +#include "a_hexenglobal.h" #include "../version.h" @@ -86,6 +87,8 @@ static int CrosshairNum; int BaseBlendR, BaseBlendG, BaseBlendB; float BaseBlendA; +CVAR (Int, paletteflash, 0, CVAR_ARCHIVE) + // Stretch status bar to full screen width? CUSTOM_CVAR (Bool, st_scale, true, CVAR_ARCHIVE) { @@ -1530,7 +1533,7 @@ void DBaseStatusBar::BlendView (float blend[4]) AddBlend (BaseBlendR / 255.f, BaseBlendG / 255.f, BaseBlendB / 255.f, BaseBlendA, blend); - // [RH] All powerups can effect the screen blending now + // [RH] All powerups can affect the screen blending now for (AInventory *item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory) { PalEntry color = item->GetBlend (); @@ -1566,7 +1569,7 @@ void DBaseStatusBar::BlendView (float blend[4]) if (cnt > 228) cnt = 228; - AddBlend (painFlash.r / 255.f, painFlash.g / 255.f, painFlash.b / 255.f, cnt / 255.f, blend); + AddBlend (painFlash.r / 255.f, painFlash.g / 255.f, painFlash.b / 255.f, cnt / 255.f, blend); } } @@ -1574,11 +1577,21 @@ void DBaseStatusBar::BlendView (float blend[4]) // exact numbers to use here, so I've had to guess by looking at how they // affect the white color in Hexen's palette and picking an alpha value // that seems reasonable. + // [Gez] The exact values could be obtained by looking how they affect + // each color channel in Hexen's palette. if (CPlayer->poisoncount) { cnt = MIN (CPlayer->poisoncount, 64); - AddBlend (0.04f, 0.2571f, 0.f, cnt/93.2571428571f, blend); + if (paletteflash & PF_SPECIALDAMAGE) + { + AddBlend(44/255.f, 92/255.f, 36/255.f, ((cnt + 7) >> 3) * 0.1f, blend); + } + else + { + AddBlend (0.04f, 0.2571f, 0.f, cnt/93.2571428571f, blend); + } + } if (CPlayer->hazardcount > 16*TICRATE || (CPlayer->hazardcount & 8)) { @@ -1586,7 +1599,14 @@ void DBaseStatusBar::BlendView (float blend[4]) } if (CPlayer->mo->DamageType == NAME_Ice) { - AddBlend (0.25f, 0.25f, 0.853f, 0.4f, blend); + if (paletteflash & PF_SPECIALDAMAGE) + { + AddBlend(0.f, 0.f, 224/255.f, 0.5f, blend); + } + else + { + AddBlend (0.25f, 0.25f, 0.853f, 0.4f, blend); + } } if (screen->Accel2D || (CPlayer->camera != NULL && menuactive == MENU_Off && ConsoleState == c_up))