Add critical messages and obituaries to message log.

This commit is contained in:
Mari the Deer 2023-03-07 08:11:15 +01:00
commit 91e21acd8f
4 changed files with 26 additions and 9 deletions

View file

@ -1,3 +1,3 @@
[default]
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r761 \cu(Tue 7 Mar 08:15:52 CET 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r761 \cu(2023-03-07 08:15:52)\c-";
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r762 \cu(Tue 7 Mar 08:16:02 CET 2023)\c-";
SWWM_SHORTVER="\cw1.3pre r762 \cu(2023-03-07 08:16:02)\c-";

View file

@ -221,8 +221,8 @@ extend Class SWWMStatusBar
if ( (rprintlevel < PRINT_LOW) || (rprintlevel > PRINT_TEAMCHAT) ) rprintlevel = PRINT_HIGH;
// strip trailing newline (all Printf type messages have this)
outline.DeleteLastCharacter();
// append chat messages to full history
if ( (rprintlevel == PRINT_CHAT) || (rprintlevel == PRINT_TEAMCHAT) )
// append main queue messages to full history
if ( rprintlevel != PRINT_LOW )
EventHandler.SendNetworkEvent("swwmstoremessage."..outline,level.totaltime,rprintlevel,consoleplayer);
let m = new("MsgLine");
m.str = outline;

View file

@ -175,12 +175,14 @@ Class DemolitionistChatTab : DemolitionistMenuTab
Class DemolitionistMenuChatItem : DemolitionistMenuListItem
{
BrokenLines l;
int msgtype;
int margin;
String tstamp;
DemolitionistMenuChatItem Init( DemolitionistMenu master, MsgLine m )
{
Super.Init(master,"");
msgtype = m.type;
if ( m.type == -1 )
{
// map change marker
@ -194,7 +196,9 @@ Class DemolitionistMenuChatItem : DemolitionistMenuListItem
int tsec = rtime%60;
tstamp = String.Format("\cm[\c-%02d\cm:\c-%02d\cm:\c-%02d\cm]\c- ",thour,tmin,tsec);
margin = master.mSmallFont.StringWidth(tstamp);
l = master.mSmallFont.BreakLines(m.str,int(master.ws.x-14)-margin);
String nstr = m.str;
if ( m.rep > 1 ) nstr.AppendFormat(" (x%d)",m.rep);
l = master.mSmallFont.BreakLines(nstr,int(master.ws.x-14)-margin);
return self;
}
@ -217,15 +221,19 @@ Class DemolitionistMenuChatItem : DemolitionistMenuListItem
override void Drawer( Vector2 pos, bool selected )
{
if ( !l )
if ( msgtype == -1 )
{
// we'll assume this is a level change label
// level change label
double xx = int((master.ws.x-14)-master.mSmallFont.StringWidth(label))/2;
Screen.DrawText(master.mSmallFont,Font.CR_GOLD,master.origin.x+pos.x+xx,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
return;
}
Screen.DrawText(master.mSmallFont,Font.CR_DARKGRAY,master.origin.x+pos.x,master.origin.y+pos.y,tstamp,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
int col = msg2color;
if ( msgtype == PRINT_MEDIUM ) col = msg1color;
else if ( msgtype == PRINT_CHAT ) col = msg3color;
else if ( msgtype == PRINT_TEAMCHAT ) col = msg4color;
for ( int i=0; i<l.Count(); i++ )
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+pos.x+margin,master.origin.y+pos.y+i*14,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
Screen.DrawText(master.mSmallFont,col,master.origin.x+pos.x+margin,master.origin.y+pos.y+i*14,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
}
}

View file

@ -34,14 +34,23 @@ Class SWWMFullHistory : SWWMStaticThinker
// push a map change label
m = new("MsgLine");
m.str = level.levelname;
m.type = -1;
m.type = -1; // hopefully this won't be used by actual messages
fh.lastmap = level.mapname;
fh.msg.Push(m);
}
// if the last added line is identical to this one, update it with a repetition marker
int last = fh.msg.Size()-1;
if ( (fh.msg[last].str == str) && (fh.msg[last].type == type) )
{
fh.msg[last].tic = tic;
fh.msg[last].rep++;
return;
}
m = new("MsgLine");
m.str = str;
m.tic = tic;
m.type = type;
m.rep = 1;
fh.msg.Push(m);
}
}