From 201e17082cc425b8036a3315dd3ebf5737ac297b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 9 May 2006 00:28:01 +0000 Subject: [PATCH] - Blends created with the ACS fade commands now degrade to transparent overlays when the menu is visible, so they can no longer obscure the menu. SVN r87 (trunk) --- docs/rh-log.txt | 4 ++++ src/g_shared/sbar.h | 4 ++-- src/g_shared/shared_sbar.cpp | 2 +- src/m_menu.cpp | 15 +++++++++++++-- src/v_video.cpp | 15 +++++++++++++-- src/v_video.h | 2 +- 6 files changed, 34 insertions(+), 8 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f6a77c315..932d635a9 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,7 @@ +May 8, 2006 +- Blends created with the ACS fade commands now degrade to transparent overlays + when the menu is visible, so they can no longer obscure the menu. + May 7, 2006 (Changes by Graf Zahl) - Added a misc/secret sound definition for Heretic. - Fixed: Powered up weapons were not properly deselected when the level ended diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index 78fadd5b2..ff5b7ab87 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -175,6 +175,8 @@ public: fixed_t GetDisplacement () { return Displacement; } int GetPlayer (); + static void AddBlend (float r, float g, float b, float a, float v_blend[4]); + virtual void Serialize (FArchive &arc); virtual void Tick (); @@ -213,8 +215,6 @@ protected: void GetCurrentAmmo (AAmmo *&ammo1, AAmmo *&ammo2, int &ammocount1, int &ammocount2) const; - static void AddBlend (float r, float g, float b, float a, float v_blend[4]); - public: AInventory *ValidateInvFirst (int numVisible) const; void DrawCrosshair (); diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 781ba3b87..6210fbecb 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -1370,7 +1370,7 @@ void FBaseStatusBar::BlendView (float blend[4]) AddBlend (0.25f, 0.25f, 0.853f, 0.4f, blend); } - if (CPlayer->camera != NULL) + if (CPlayer->camera != NULL && menuactive == MENU_Off) { player_t *player = (CPlayer->camera->player != NULL) ? CPlayer->camera->player : CPlayer; AddBlend (player->BlendR, player->BlendG, player->BlendB, player->BlendA, blend); diff --git a/src/m_menu.cpp b/src/m_menu.cpp index dd60b3885..bec485bf1 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -2851,11 +2851,22 @@ void M_StartControlPanel (bool makeSound) void M_Drawer () { int i, x, y, max; + PalEntry fade = 0; + + const player_t *player = &players[consoleplayer]; + if (player->camera != NULL) + { + if (player->camera->player != NULL) + { + player = player->camera->player; + } + fade = PalEntry (BYTE(player->BlendA*255), BYTE(player->BlendR*255), BYTE(player->BlendG*255), BYTE(player->BlendB*255)); + } // Horiz. & Vertically center string and print it. if (messageToPrint) { - screen->Dim (); + screen->Dim (fade); BorderNeedRefresh = screen->GetPageCount (); SB_state = screen->GetPageCount (); @@ -2878,7 +2889,7 @@ void M_Drawer () { if (InfoType == 0 && !OptionsActive) { - screen->Dim (); + screen->Dim (fade); } // For Heretic shareware message: if (showSharewareMessage) diff --git a/src/v_video.cpp b/src/v_video.cpp index bdbb7293e..68791a2b1 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -57,6 +57,7 @@ #include "cmdlib.h" #include "gi.h" #include "templates.h" +#include "sbar.h" IMPLEMENT_ABSTRACT_CLASS (DCanvas) IMPLEMENT_ABSTRACT_CLASS (DFrameBuffer) @@ -196,8 +197,9 @@ void DCanvas::Clear (int left, int top, int right, int bottom, int color) const } } -void DCanvas::Dim () const +void DCanvas::Dim (PalEntry color) const { + PalEntry dimmer; float amount = dimamount; if (gameinfo.gametype == GAME_Hexen && gamestate == GS_DEMOSCREEN) @@ -205,7 +207,16 @@ void DCanvas::Dim () const // enough to make the menus readable. amount = MIN (1.f, amount*2.f); } - Dim (PalEntry(dimcolor), amount, 0, 0, Width, Height); + dimmer = PalEntry(dimcolor); + // Add the cvar's dimming on top of the color passed to the function + if (color.a != 0) + { + float dim[4] = { color.r/255.f, color.g/255.f, color.b/255.f, color.a/255.f }; + FBaseStatusBar::AddBlend (dimmer.r/255.f, dimmer.g/255.f, dimmer.b/255.f, amount, dim); + dimmer = PalEntry (BYTE(dim[0]*255), BYTE(dim[1]*255), BYTE(dim[2]*255)); + amount = dim[3]; + } + Dim (dimmer, amount, 0, 0, Width, Height); } void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h) const diff --git a/src/v_video.h b/src/v_video.h index 9528d3f6f..b16aa7c1e 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -149,7 +149,7 @@ public: virtual void GetBlock (int x, int y, int width, int height, byte *dest) const; // Dim the entire canvas for the menus - virtual void Dim () const; + virtual void Dim (PalEntry color = 0) const; // Dim part of the canvas virtual void Dim (PalEntry color, float amount, int x1, int y1, int w, int h) const;