Make PAUSED text cycle colors when bouncing.

This commit is contained in:
Mari the Deer 2023-08-21 14:21:19 +02:00
commit e3ada32386
2 changed files with 21 additions and 4 deletions

View file

@ -108,7 +108,7 @@ Class SWWMStatusBar : BaseStatusBar
double FrameTime;
double PrevFrame;
int chatopen;
int pausetime;
int pausetime, pausecol;
Vector2 pausepos, pausedir;
// constants
@ -453,6 +453,10 @@ Class SWWMStatusBar : BaseStatusBar
override bool DrawPaused( int player )
{
static const int pausepal[] =
{
MCR_RED, MCR_ORANGE, MCR_YELLOW, MCR_GRASS, MCR_GREEN, MCR_MINT, MCR_CYAN, MCR_AQUA, MCR_BLUE, MCR_PURPLE, MCR_MAGENTA, MCR_PINK
};
let fnt = mSmallFontOutline?mSmallFontOutline:NewSmallFont;
let fnt2 = mSmallFont?mSmallFont:NewConsoleFont;
if ( swwm_fuzz )
@ -469,19 +473,32 @@ Class SWWMStatusBar : BaseStatusBar
pausepos.x = Screen.GetWidth()/2;
pausepos.y = Screen.GetHeight()/2;
pausedir = (1,1);
pausecol = 8;
}
else
{
pausepos.x += pausedir.x*CleanXFac;
pausepos.y += pausedir.y*CleanYFac;
if ( pausepos.x >= Screen.GetWidth()-((fnt.StringWidth(str)*3+8)*CleanXFac/2) )
{
pausedir.x = -1;
pausecol = (pausecol+1)%12;
}
if ( pausepos.x < ((fnt.StringWidth(str)*3+8)*CleanXFac/2) )
{
pausedir.x = 1;
pausecol = (pausecol+1)%12;
}
if ( pausepos.y >= Screen.GetHeight()-((fnt.GetHeight()*3+8)*CleanYFac/2) )
{
pausedir.y = -1;
pausecol = (pausecol+1)%12;
}
if ( pausepos.y < ((fnt.GetHeight()*3+8)*CleanYFac/2) )
{
pausedir.y = 1;
pausecol = (pausecol+1)%12;
}
}
double xx = pausepos.x-(fnt.StringWidth(str)*3*CleanXFac)/2;
double yy = pausepos.y-(fnt.GetHeight()*3*CleanYFac)/2;
@ -490,7 +507,7 @@ Class SWWMStatusBar : BaseStatusBar
{
int ch;
[ch, pos] = str.GetNextCodePoint(pos);
Screen.DrawChar(fnt,Font.CR_BLUE,xx,yy+4*sin(32*i+8*gametic)*CleanYFac,ch,DTA_ScaleX,CleanXFac*3,DTA_ScaleY,CleanYFac*3);
Screen.DrawChar(fnt,mhudfontcol[pausepal[pausecol]],xx,yy+4*sin(32*i+8*gametic)*CleanYFac,ch,DTA_ScaleX,CleanXFac*3,DTA_ScaleY,CleanYFac*3);
xx += (fnt.GetCharWidth(ch)+fnt.GetDefaultKerning())*3*CleanXFac;
}
yy += fnt.GetHeight()*3*CleanYFac;