mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 06:41:41 +00:00
Allow custom status bars to override notifications, centered prints and chat prompt.
This commit is contained in:
parent
f317f69776
commit
14dc288f22
4 changed files with 75 additions and 11 deletions
|
@ -773,6 +773,19 @@ void FNotifyBuffer::AddString(int printlevel, FString source)
|
|||
con_notifylines == 0)
|
||||
return;
|
||||
|
||||
// [MK] allow the status bar to take over notify printing
|
||||
if (StatusBar != nullptr)
|
||||
{
|
||||
IFVIRTUALPTR(StatusBar, DBaseStatusBar, ProcessNotify)
|
||||
{
|
||||
VMValue params[] = { (DObject*)StatusBar, printlevel, &source };
|
||||
int rv;
|
||||
VMReturn ret(&rv);
|
||||
VMCall(func, params, countof(params), &ret, 1);
|
||||
if (!!rv) return;
|
||||
}
|
||||
}
|
||||
|
||||
width = DisplayWidth / active_con_scaletext(generic_ui);
|
||||
|
||||
FFont *font = generic_ui ? NewSmallFont : AlternativeSmallFont;
|
||||
|
@ -960,6 +973,12 @@ int DPrintf (int level, const char *format, ...)
|
|||
void C_FlushDisplay ()
|
||||
{
|
||||
NotifyStrings.Clear();
|
||||
if (StatusBar == nullptr) return;
|
||||
IFVIRTUALPTR(StatusBar, DBaseStatusBar, FlushNotify)
|
||||
{
|
||||
VMValue params[] = { (DObject*)StatusBar };
|
||||
VMCall(func, params, countof(params), nullptr, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void C_AdjustBottom ()
|
||||
|
@ -1740,6 +1759,17 @@ void C_MidPrint (FFont *font, const char *msg, bool bold)
|
|||
if (StatusBar == nullptr || screen == nullptr)
|
||||
return;
|
||||
|
||||
// [MK] allow the status bar to take over MidPrint
|
||||
IFVIRTUALPTR(StatusBar, DBaseStatusBar, ProcessMidPrint)
|
||||
{
|
||||
FString msgstr = msg;
|
||||
VMValue params[] = { (DObject*)StatusBar, font, &msg, bold };
|
||||
int rv;
|
||||
VMReturn ret(&rv);
|
||||
VMCall(func, params, countof(params), &ret, 1);
|
||||
if (!!rv) return;
|
||||
}
|
||||
|
||||
if (msg != nullptr)
|
||||
{
|
||||
auto color = (EColorRange)PrintColors[bold? PRINTLEVELS+1 : PRINTLEVELS];
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "v_video.h"
|
||||
#include "utf8.h"
|
||||
#include "gstrings.h"
|
||||
#include "vm.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -233,8 +234,30 @@ void CT_PasteChat(const char *clip)
|
|||
void CT_Drawer (void)
|
||||
{
|
||||
FFont *displayfont = NewConsoleFont;
|
||||
|
||||
if (players[consoleplayer].camera != NULL &&
|
||||
(Button_ShowScores.bDown ||
|
||||
players[consoleplayer].camera->health <= 0 ||
|
||||
SB_ForceActive) &&
|
||||
// Don't draw during intermission, since it has its own scoreboard in wi_stuff.cpp.
|
||||
gamestate != GS_INTERMISSION)
|
||||
{
|
||||
HU_DrawScores (&players[consoleplayer]);
|
||||
}
|
||||
if (chatmodeon)
|
||||
{
|
||||
// [MK] allow the status bar to take over chat prompt drawing
|
||||
bool skip = false;
|
||||
IFVIRTUALPTR(StatusBar, DBaseStatusBar, DrawChat)
|
||||
{
|
||||
FString txt = ChatQueue;
|
||||
VMValue params[] = { (DObject*)StatusBar, &txt };
|
||||
int rv;
|
||||
VMReturn ret(&rv);
|
||||
VMCall(func, params, countof(params), &ret, 1);
|
||||
if (!!rv) return;
|
||||
}
|
||||
|
||||
FStringf prompt("%s ", GStrings("TXT_SAY"));
|
||||
int x, scalex, y, promptwidth;
|
||||
|
||||
|
@ -268,16 +291,6 @@ void CT_Drawer (void)
|
|||
screen->DrawText (displayfont, CR_GREY, promptwidth, y, printstr,
|
||||
DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE);
|
||||
}
|
||||
|
||||
if (players[consoleplayer].camera != NULL &&
|
||||
(Button_ShowScores.bDown ||
|
||||
players[consoleplayer].camera->health <= 0 ||
|
||||
SB_ForceActive) &&
|
||||
// Don't draw during intermission, since it has its own scoreboard in wi_stuff.cpp.
|
||||
gamestate != GS_INTERMISSION)
|
||||
{
|
||||
HU_DrawScores (&players[consoleplayer]);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -1352,3 +1352,17 @@ enum EMonospacing
|
|||
Mono_CellCenter = 2,
|
||||
Mono_CellRight = 3
|
||||
};
|
||||
|
||||
enum EPrintLevel
|
||||
{
|
||||
PRINT_LOW, // pickup messages
|
||||
PRINT_MEDIUM, // death messages
|
||||
PRINT_HIGH, // critical messages
|
||||
PRINT_CHAT, // chat messages
|
||||
PRINT_TEAMCHAT, // chat messages from a teammate
|
||||
PRINT_LOG, // only to logfile
|
||||
PRINT_BOLD = 200, // What Printf_Bold used
|
||||
PRINT_TYPES = 1023, // Bitmask.
|
||||
PRINT_NONOTIFY = 1024, // Flag - do not add to notify buffer
|
||||
PRINT_NOLOG = 2048, // Flag - do not print to log file
|
||||
};
|
||||
|
|
|
@ -334,7 +334,14 @@ class BaseStatusBar native ui
|
|||
virtual void NewGame () { if (CPlayer != null) AttachToPlayer(CPlayer); }
|
||||
virtual void ShowPop (int popnum) { ShowLog = (popnum == POP_Log && !ShowLog); }
|
||||
virtual bool MustDrawLog(int state) { return true; }
|
||||
|
||||
|
||||
// [MK] let the HUD handle notifications and centered print messages
|
||||
virtual bool ProcessNotify(EPrintLevel printlevel, String outline) { return false; }
|
||||
virtual void FlushNotify() {}
|
||||
virtual bool ProcessMidPrint(Font fnt, String msg, bool bold) { return false; }
|
||||
// [MK] let the HUD handle drawing the chat prompt
|
||||
virtual bool DrawChat(String txt) { return false; }
|
||||
|
||||
native TextureID GetMugshot(int accuracy, int stateflags=MugShot.STANDARD, String default_face = "STF");
|
||||
|
||||
// These functions are kept native solely for performance reasons. They get called repeatedly and can drag down performance easily if they get too slow.
|
||||
|
|
Loading…
Reference in a new issue