Small visual tweaks to stat screen:
- Show "N/A" for 0/0 cases. - Always show times in at least mm:ss format. - Account for potential trailing whitespace in map names (can becaused by DEHACKED string replacements).
This commit is contained in:
parent
70514799bd
commit
25eb154656
3 changed files with 25 additions and 24 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r766 \cu(Fri 10 Mar 19:41:25 CET 2023)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r766 \cu(2023-03-10 19:41:25)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r767 \cu(Fri 10 Mar 19:41:35 CET 2023)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r767 \cu(2023-03-10 19:41:35)\c-";
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ Class SWWMStatScreen : StatusScreen abstract
|
|||
authortexts[i] = lnametexts[i].Mid(iof+3);
|
||||
lnametexts[i].Truncate(iof);
|
||||
}
|
||||
// level name may contain trailing whitespace due to DEHACKED fuckery, so strip it
|
||||
lnametexts[i].StripRight();
|
||||
}
|
||||
}
|
||||
override void StartMusic()
|
||||
|
|
@ -289,9 +291,8 @@ Class SWWMStatScreen : StatusScreen abstract
|
|||
int h = secs/3600;
|
||||
int m = (secs/60)%60;
|
||||
int s = secs%60;
|
||||
if ( h ) return String.Format("%d\cu:\c-%02d\cu:\c-%02d",h,m,s);
|
||||
if ( m ) return String.Format("%d\cu:\c-%02d",m,s);
|
||||
return String.Format("%d",s);
|
||||
if ( h ) return String.Format("%02d\cu:\c-%02d\cu:\c-%02d",h,m,s);
|
||||
return String.Format("%02d\cu:\c-%02d",m,s);
|
||||
}
|
||||
protected int GetPct( int a, int b, bool inv = false )
|
||||
{
|
||||
|
|
@ -305,7 +306,7 @@ Class SWWMStatScreen : StatusScreen abstract
|
|||
if ( evt.type == InputEvent.Type_KeyDown )
|
||||
{
|
||||
String cmd = Bindings.GetBinding(evt.KeyScan);
|
||||
if ( (cmd ~== "+attack") || (cmd ~== "+use") || (evt.KeyScan == InputEvent.KEY_ENTER) )
|
||||
if ( (cmd ~== "+attack") || (cmd ~== "+use") || (evt.KeyScan == InputEvent.KEY_ENTER) ) // KEY_ENTER needed as fallback for Delta Touch compatibility
|
||||
{
|
||||
accelerateStage = 1;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -149,25 +149,25 @@ Class SWWMStatScreen_SP : SWWMStatScreen
|
|||
// right strings
|
||||
if ( wi_percents )
|
||||
{
|
||||
str = String.Format("%d%%",GetPct(Plrs[me].skills,wbs.maxkills));
|
||||
str = (!wbs.maxkills)?"N/A":String.Format("%d%%",GetPct(Plrs[me].skills,wbs.maxkills));
|
||||
len = mSmallFont.StringWidth(str);
|
||||
maxlenr = len;
|
||||
str = String.Format("%d%%",GetPct(Plrs[me].sitems,wbs.maxitems));
|
||||
str = (!wbs.maxitems)?"N/A":String.Format("%d%%",GetPct(Plrs[me].sitems,wbs.maxitems));
|
||||
len = mSmallFont.StringWidth(str);
|
||||
if ( len > maxlenr ) maxlenr = len;
|
||||
str = String.Format("%d%%",GetPct(Plrs[me].ssecret,wbs.maxsecret));
|
||||
str = (!wbs.maxsecret)?"N/A":String.Format("%d%%",GetPct(Plrs[me].ssecret,wbs.maxsecret));
|
||||
len = mSmallFont.StringWidth(str);
|
||||
if ( len > maxlenr ) maxlenr = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
str = String.Format("%d / %d",Plrs[me].skills,wbs.maxkills);
|
||||
str = (!wbs.maxkills)?"N/A":String.Format("%d / %d",Plrs[me].skills,wbs.maxkills);
|
||||
len = mSmallFont.StringWidth(str);
|
||||
maxlenr = len;
|
||||
str = String.Format("%d / %d",Plrs[me].sitems,wbs.maxitems);
|
||||
str = (!wbs.maxitems)?"N/A":String.Format("%d / %d",Plrs[me].sitems,wbs.maxitems);
|
||||
len = mSmallFont.StringWidth(str);
|
||||
if ( len > maxlenr ) maxlenr = len;
|
||||
str = String.Format("%d / %d",Plrs[me].ssecret,wbs.maxsecret);
|
||||
str = (!wbs.maxsecret)?"N/A":String.Format("%d / %d",Plrs[me].ssecret,wbs.maxsecret);
|
||||
len = mSmallFont.StringWidth(str);
|
||||
if ( len > maxlenr ) maxlenr = len;
|
||||
}
|
||||
|
|
@ -219,23 +219,23 @@ Class SWWMStatScreen_SP : SWWMStatScreen
|
|||
{
|
||||
if ( cnt_kills[0] >= 0 )
|
||||
{
|
||||
str = String.Format("%d\cu%%\c-",GetPct(cnt_kills[0],wbs.maxkills));
|
||||
str = (!wbs.maxkills)?"\cuN/A\c-":String.Format("%d\cu%%\c-",GetPct(cnt_kills[0],wbs.maxkills));
|
||||
len = mSmallFont.StringWidth(str);
|
||||
Screen.DrawText(mSmallFont,(!wbs.maxkills||(cnt_kills[0]>=wbs.maxkills))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(mSmallFont,(cnt_kills[0]>=wbs.maxkills)?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
}
|
||||
yy += step;
|
||||
if ( cnt_items[0] >= 0 )
|
||||
{
|
||||
str = String.Format("%d\cu%%\c-",GetPct(cnt_items[0],wbs.maxitems));
|
||||
str = (!wbs.maxitems)?"\cuN/A\c-":String.Format("%d\cu%%\c-",GetPct(cnt_items[0],wbs.maxitems));
|
||||
len = mSmallFont.StringWidth(str);
|
||||
Screen.DrawText(mSmallFont,(!wbs.maxitems||(cnt_items[0]>=wbs.maxitems))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(mSmallFont,(cnt_items[0]>=wbs.maxitems)?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
}
|
||||
yy += step;
|
||||
if ( cnt_secret[0] >= 0 )
|
||||
{
|
||||
str = String.Format("%d\cu%%\c-",GetPct(cnt_secret[0],wbs.maxsecret));
|
||||
str = (!wbs.maxsecret)?"\cuN/A\c-":String.Format("%d\cu%%\c-",GetPct(cnt_secret[0],wbs.maxsecret));
|
||||
len = mSmallFont.StringWidth(str);
|
||||
Screen.DrawText(mSmallFont,(!wbs.maxsecret||(cnt_secret[0]>=wbs.maxsecret))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(mSmallFont,(cnt_secret[0]>=wbs.maxsecret)?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
}
|
||||
yy += step;
|
||||
}
|
||||
|
|
@ -243,23 +243,23 @@ Class SWWMStatScreen_SP : SWWMStatScreen
|
|||
{
|
||||
if ( cnt_kills[0] >= 0 )
|
||||
{
|
||||
str = String.Format("%d \cu/\c- \cj%d\c-",max(cnt_kills[0],0),wbs.maxkills);
|
||||
str = (!wbs.maxkills)?"\cuN/A\c-":String.Format("%d \cu/\c- \cj%d\c-",max(cnt_kills[0],0),wbs.maxkills);
|
||||
len = mSmallFont.StringWidth(str);
|
||||
Screen.DrawText(mSmallFont,(wbs.maxkills&&(cnt_kills[0]>=wbs.maxkills))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(mSmallFont,(cnt_kills[0]>=wbs.maxkills)?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
}
|
||||
yy += step;
|
||||
if ( cnt_items[0] >= 0 )
|
||||
{
|
||||
str = String.Format("%d \cu/\c- \cj%d\c-",max(cnt_items[0],0),wbs.maxitems);
|
||||
str = (!wbs.maxitems)?"\cuN/A\c-":String.Format("%d \cu/\c- \cj%d\c-",max(cnt_items[0],0),wbs.maxitems);
|
||||
len = mSmallFont.StringWidth(str);
|
||||
Screen.DrawText(mSmallFont,(wbs.maxitems&&(cnt_items[0]>=wbs.maxitems))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(mSmallFont,(cnt_items[0]>=wbs.maxitems)?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
}
|
||||
yy += step;
|
||||
if ( cnt_secret[0] >= 0 )
|
||||
{
|
||||
str = String.Format("%d \cu/\c- \cj%d\c-",max(cnt_secret[0],0),wbs.maxsecret);
|
||||
str = (!wbs.maxsecret)?"\cuN/A\c-":String.Format("%d \cu/\c- \cj%d\c-",max(cnt_secret[0],0),wbs.maxsecret);
|
||||
len = mSmallFont.StringWidth(str);
|
||||
Screen.DrawText(mSmallFont,(wbs.maxsecret&&(cnt_secret[0]>=wbs.maxsecret))?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(mSmallFont,(cnt_secret[0]>=wbs.maxsecret)?Font.CR_GOLD:Font.CR_WHITE,xx-len,yy,str,DTA_VirtualWidthF,ss2.x,DTA_VirtualHeightF,ss2.y,DTA_KeepRatio,true);
|
||||
}
|
||||
yy += step;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue