Use SetClipRect to avoid DTA_Clip* spam in many places.
This commit is contained in:
parent
48db16e7aa
commit
bcc397c9f3
12 changed files with 102 additions and 118 deletions
|
|
@ -34,21 +34,23 @@ Class DemolitionistMenuList ui
|
|||
for ( int i=0; i<items.Size(); i++ )
|
||||
items[i].Ticker();
|
||||
}
|
||||
// draw all items with a specific offset and clip region
|
||||
void Drawer( Vector2 offset, int cliptop, int clipbottom, int clipleft, int clipright )
|
||||
// draw all items with a specific offset
|
||||
void Drawer( Vector2 offset )
|
||||
{
|
||||
Vector2 pos, rpos, rsiz;
|
||||
int cx, cy, cw, ch;
|
||||
[cx, cy, cw, ch] = Screen.GetClipRect();
|
||||
for ( int i=0; i<items.Size(); i++ )
|
||||
{
|
||||
pos = (items[i].xpos,items[i].ypos)+offset;
|
||||
rpos = (master.origin+pos)*master.hs;
|
||||
rsiz = items[i].GetDrawBounds()*master.hs;
|
||||
// skip draw if out of bounds
|
||||
if ( rpos.y+rsiz.y < cliptop ) continue;
|
||||
if ( rpos.y > clipbottom ) continue;
|
||||
if ( rpos.x+rsiz.x < clipleft ) continue;
|
||||
if ( rpos.x > clipright ) continue;
|
||||
items[i].Drawer(pos,(i==selected),cliptop,clipbottom,clipleft,clipright);
|
||||
if ( rpos.y+rsiz.y < cy ) continue;
|
||||
if ( rpos.y > cy+ch ) continue;
|
||||
if ( rpos.x+rsiz.x < cx ) continue;
|
||||
if ( rpos.x > cx+cw ) continue;
|
||||
items[i].Drawer(pos,(i==selected));
|
||||
}
|
||||
// scrollbar drawing is handled by the tab, as the list itself is entirely unaware of its frame dimensions
|
||||
}
|
||||
|
|
@ -100,8 +102,8 @@ Class DemolitionistMenuListItem ui
|
|||
// nothing in the base class
|
||||
}
|
||||
|
||||
virtual void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright )
|
||||
virtual void Drawer( Vector2 pos, bool selected )
|
||||
{
|
||||
Screen.DrawText(master.mSmallFont,selected?Font.CR_FIRE:Font.CR_WHITE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mSmallFont,selected?Font.CR_FIRE:Font.CR_WHITE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,22 +97,23 @@ Class DemolitionistMenuTextBox ui
|
|||
{
|
||||
double xx = x+6;
|
||||
double yy = 17-smofs;
|
||||
int miny = int((master.origin.y+17)*master.hs);
|
||||
int maxy = int((master.origin.y+(master.ws.y-17))*master.hs);
|
||||
Screen.SetClipRect(int((master.origin.x+xx)*master.hs),int((master.origin.y+17)*master.hs),int(w*master.hs),int((master.ws.y-34)*master.hs));
|
||||
// draw image if defined and visible
|
||||
if ( img.IsValid() )
|
||||
{
|
||||
Vector2 imgsz = TexMan.GetScaledSize(img);
|
||||
if ( (yy+imgsz.y >= 17) && (yy < master.ws.y) )
|
||||
Screen.DrawTexture(img,false,master.origin.x+xx,master.origin.y+yy,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,miny,DTA_ClipBottom,maxy);
|
||||
Vector2 imgofs = TexMan.GetScaledOffset(img);
|
||||
if ( (yy+imgsz.y-imgofs.y >= 17) && (yy-imgofs.y < master.ws.y) )
|
||||
Screen.DrawTexture(img,false,master.origin.x+xx,master.origin.y+yy,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
}
|
||||
for ( int i=0; i<l.Count(); i++, yy+=13 )
|
||||
{
|
||||
// to save time, we skip lines that aren't visible
|
||||
if ( yy < 4 ) continue;
|
||||
if ( yy >= master.ws.y-19 ) continue;
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,dark?Color(96,0,0,0):Color(0,0,0,0),DTA_ClipTop,miny,DTA_ClipBottom,maxy);
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,dark?Color(96,0,0,0):Color(0,0,0,0));
|
||||
}
|
||||
Screen.ClearClipRect();
|
||||
if ( !scrollbar ) return;
|
||||
xx = x+(w-8);
|
||||
master.DrawVSeparator(xx,14,master.ws.y-28);
|
||||
|
|
|
|||
|
|
@ -154,11 +154,9 @@ Class DemolitionistChatTab : DemolitionistMenuTab
|
|||
}
|
||||
double xx = 3;
|
||||
double yy = 23;
|
||||
int cliptop = int((master.origin.y+23)*master.hs);
|
||||
int clipbottom = int((master.origin.y+master.ws.y-23)*master.hs);
|
||||
int clipleft = int((master.origin.x+3)*master.hs);
|
||||
int clipright = int((master.origin.x+master.ws.x-9)*master.hs);
|
||||
msglist.Drawer((xx,yy-smofs),cliptop,clipbottom,clipleft,clipright);
|
||||
Screen.SetClipRect(int((master.origin.x+3)*master.hs),int((master.origin.y+23)*master.hs),int((master.ws.x-12)*master.hs),int((master.ws.y-46)*master.hs));
|
||||
msglist.Drawer((xx,yy-smofs));
|
||||
Screen.ClearClipRect();
|
||||
if ( maxofs <= 0 ) return;
|
||||
xx = master.ws.x-8;
|
||||
master.DrawVSeparator(xx,14,master.ws.y-28);
|
||||
|
|
@ -212,17 +210,17 @@ Class DemolitionistMenuChatItem : DemolitionistMenuListItem
|
|||
return 14;
|
||||
}
|
||||
|
||||
override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright )
|
||||
override void Drawer( Vector2 pos, bool selected )
|
||||
{
|
||||
if ( !l )
|
||||
{
|
||||
// we'll assume this is a 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,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
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,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
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);
|
||||
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,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,9 @@ Class DemolitionistGameTab : DemolitionistMenuTab
|
|||
xx = int(master.ws.x-res.x)/2;
|
||||
Screen.Dim("Black",1.,int((master.origin.x+xx-4)*master.hs),int((master.origin.y+yy-4)*master.hs),int((res.x+8)*master.hs),int((res.y+8)*master.hs));
|
||||
master.DrawFrame(xx-4,yy-4,res.x+8,res.y+8);
|
||||
Screen.SetClipRect(int((master.origin.x+xx)*master.hs),int((master.origin.y+yy)*master.hs),int(res.x*master.hs),int(res.y*master.hs));
|
||||
game.Draw((master.origin.x+xx,master.origin.y+yy)*master.hs,scl);
|
||||
Screen.ClearClipRect();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -461,11 +461,9 @@ Class DemolitionistInventoryTab : DemolitionistMenuTab
|
|||
}
|
||||
double xx = 9;
|
||||
double yy = 23;
|
||||
int cliptop = int((master.origin.y+23)*master.hs);
|
||||
int clipbottom = int((master.origin.y+master.ws.y-23)*master.hs);
|
||||
int clipleft = int((master.origin.x+9)*master.hs);
|
||||
int clipright = int((master.origin.x+master.ws.x-9)*master.hs);
|
||||
invlist.Drawer((xx-smofs,yy),cliptop,clipbottom,clipleft,clipright);
|
||||
Screen.SetClipRect(int((master.origin.x+9)*master.hs),int((master.origin.y+23)*master.hs),int((master.ws.x-18)*master.hs),int((master.ws.y-46)*master.hs));
|
||||
invlist.Drawer((xx-smofs,yy));
|
||||
Screen.ClearClipRect();
|
||||
if ( maxofs <= 0 ) return;
|
||||
yy = master.ws.y-21;
|
||||
master.DrawHSeparator(0,yy,master.ws.x);
|
||||
|
|
@ -518,10 +516,10 @@ Class DemolitionistMenuInvItem : DemolitionistMenuListItem
|
|||
UpdateLabel();
|
||||
}
|
||||
|
||||
override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright )
|
||||
override void Drawer( Vector2 pos, bool selected )
|
||||
{
|
||||
// the simplest drawer
|
||||
Screen.DrawText(master.mSmallFont,col,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright,DTA_ColorOverlay,selected?Color(0,0,0,0):Color(96,0,0,0));
|
||||
Screen.DrawText(master.mSmallFont,col,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,selected?Color(0,0,0,0):Color(96,0,0,0));
|
||||
}
|
||||
|
||||
void UseItem()
|
||||
|
|
|
|||
|
|
@ -304,11 +304,9 @@ Class DemolitionistKeychainTab : DemolitionistMenuTab
|
|||
}
|
||||
double xx = 9;
|
||||
double yy = 23;
|
||||
int cliptop = int((master.origin.y+23)*master.hs);
|
||||
int clipbottom = int((master.origin.y+master.ws.y-23)*master.hs);
|
||||
int clipleft = int((master.origin.x+9)*master.hs);
|
||||
int clipright = int((master.origin.x+master.ws.x-9)*master.hs);
|
||||
invlist.Drawer((xx-smofs,yy),cliptop,clipbottom,clipleft,clipright);
|
||||
Screen.SetClipRect(int((master.origin.x+9)*master.hs),int((master.origin.y+23)*master.hs),int((master.ws.x-18)*master.hs),int((master.ws.y-46)*master.hs));
|
||||
invlist.Drawer((xx-smofs,yy));
|
||||
Screen.ClearClipRect();
|
||||
if ( maxofs <= 0 ) return;
|
||||
yy = master.ws.y-21;
|
||||
master.DrawHSeparator(0,yy,master.ws.x);
|
||||
|
|
|
|||
|
|
@ -398,11 +398,9 @@ Class DemolitionistLibraryTab : DemolitionistMenuTab
|
|||
Screen.DrawText(master.mSmallFont,Font.CR_GOLD,master.origin.x+lwidth-15,master.origin.y+yy,"‼",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
xx = 3;
|
||||
yy = 32;
|
||||
int cliptop = int((master.origin.y+32)*master.hs);
|
||||
int clipbottom = int((master.origin.y+master.ws.y-18)*master.hs);
|
||||
int clipleft = int((master.origin.x+3)*master.hs);
|
||||
int clipright = int((master.origin.x+lwidth-3)*master.hs);
|
||||
lists[section].Drawer((xx,yy-smofs[section]),cliptop,clipbottom,clipleft,clipright);
|
||||
Screen.SetClipRect(int((master.origin.x+3)*master.hs),int((master.origin.y+32)*master.hs),int((lwidth-6)*master.hs),int((master.ws.y-50)*master.hs));
|
||||
lists[section].Drawer((xx,yy-smofs[section]));
|
||||
Screen.ClearClipRect();
|
||||
if ( maxofs[section] > 0 )
|
||||
{
|
||||
xx = lwidth;
|
||||
|
|
@ -450,10 +448,10 @@ Class DemolitionistMenuLoreItem : DemolitionistMenuListItem
|
|||
EventHandler.SendNetworkEvent(String.Format("swwmmarkloreread.%s",ent.tag),consoleplayer);
|
||||
}
|
||||
|
||||
override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright )
|
||||
override void Drawer( Vector2 pos, bool selected )
|
||||
{
|
||||
String str = label;
|
||||
if ( !ent.read ) str = "\cf‼\c-"..label;
|
||||
Screen.DrawText(master.mSmallFont,bActive?Font.CR_FIRE:Font.CR_WHITE,master.origin.x+pos.x,master.origin.y+pos.y,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright,DTA_ColorOverlay,selected?Color(0,0,0,0):Color(96,0,0,0));
|
||||
Screen.DrawText(master.mSmallFont,bActive?Font.CR_FIRE:Font.CR_WHITE,master.origin.x+pos.x,master.origin.y+pos.y,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,selected?Color(0,0,0,0):Color(96,0,0,0));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,19 +126,19 @@ Class DemolitionistSecretTab : DemolitionistMenuTab
|
|||
double yy;
|
||||
if ( maxofs <= 0 ) yy = master.ws.y/2-160;
|
||||
else yy = 20-smofs;
|
||||
int miny = int((master.origin.y+20)*master.hs);
|
||||
int maxy = int((master.origin.y+(master.ws.y-20))*master.hs);
|
||||
Screen.DrawTexture(img,false,master.origin.x+xx,master.origin.y+yy,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,miny,DTA_ClipBottom,maxy);
|
||||
Screen.SetClipRect(int((master.origin.x+20)*master.hs),int((master.origin.y+20)*master.hs),int((master.ws.x-40)*master.hs),int((master.ws.y-40)*master.hs));
|
||||
Screen.DrawTexture(img,false,master.origin.x+xx,master.origin.y+yy,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
int mxlen = 0;
|
||||
if ( l ) for ( int i=0; i<l.Count(); i++ )
|
||||
{
|
||||
if ( l.StringWidth(i) > mxlen ) mxlen = l.StringWidth(i);
|
||||
xx = (i<l.Count()-1)?350:(350+mxlen-l.StringWidth(i));
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_GOLD,master.origin.x+xx,master.origin.y+yy+4+i*14,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,miny,DTA_ClipBottom,maxy);
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_GOLD,master.origin.x+xx,master.origin.y+yy+4+i*14,l.StringAt(i),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
}
|
||||
yy += 306;
|
||||
xx = int(master.ws.x-master.mSmallFont.StringWidth(sub))/2;
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,sub,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,miny,DTA_ClipBottom,maxy);
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,sub,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
Screen.ClearClipRect();
|
||||
if ( maxofs <= 0 ) return;
|
||||
xx = master.ws.x-8;
|
||||
master.DrawVSeparator(xx,14,master.ws.y-28);
|
||||
|
|
|
|||
|
|
@ -557,22 +557,17 @@ Class DemolitionistStatsTab : DemolitionistMenuTab
|
|||
// achievement drawer has different margins
|
||||
xx = lwidth+12;
|
||||
yy = 26;
|
||||
int cliptop = int((master.origin.y+26)*master.hs);
|
||||
int clipbottom = int((master.origin.y+master.ws.y-26)*master.hs);
|
||||
int clipleft = int((master.origin.x+lwidth+12)*master.hs);
|
||||
int clipright = int((master.origin.x+master.ws.x-12)*master.hs);
|
||||
lists[section].Drawer((xx,yy-smofs[section]),cliptop,clipbottom,clipleft,clipright);
|
||||
Screen.SetClipRect(int((master.origin.x+lwidth+12)*master.hs),int((master.origin.y+26)*master.hs),int((master.ws.x-(lwidth+24))*master.hs),int((master.ws.y-52)*master.hs));
|
||||
lists[section].Drawer((xx,yy-smofs[section]));
|
||||
}
|
||||
else
|
||||
{
|
||||
xx = lwidth+9;
|
||||
yy = 23;
|
||||
int cliptop = int((master.origin.y+23)*master.hs);
|
||||
int clipbottom = int((master.origin.y+master.ws.y-23)*master.hs);
|
||||
int clipleft = int((master.origin.x+lwidth+9)*master.hs);
|
||||
int clipright = int((master.origin.x+master.ws.x-9)*master.hs);
|
||||
lists[section].Drawer((xx,yy-smofs[section]),cliptop,clipbottom,clipleft,clipright);
|
||||
Screen.SetClipRect(int((master.origin.x+lwidth+9)*master.hs),int((master.origin.y+23)*master.hs),int((master.ws.x-(lwidth+18))*master.hs),int((master.ws.y-46)*master.hs));
|
||||
lists[section].Drawer((xx,yy-smofs[section]));
|
||||
}
|
||||
Screen.ClearClipRect();
|
||||
if ( maxofs[section] > 0 )
|
||||
{
|
||||
xx = master.ws.x-8;
|
||||
|
|
@ -610,11 +605,11 @@ Class DemolitionistMenuKillItem : DemolitionistMenuListItem
|
|||
return width;
|
||||
}
|
||||
|
||||
override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright )
|
||||
override void Drawer( Vector2 pos, bool selected )
|
||||
{
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
String str = String.Format("%d",s.kills);
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+pos.x+width-master.mSmallFont.StringWidth(str),master.origin.y+pos.y,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+pos.x+width-master.mSmallFont.StringWidth(str),master.origin.y+pos.y,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -639,38 +634,38 @@ Class DemolitionistMenuMapStatItem : DemolitionistMenuListItem
|
|||
return width;
|
||||
}
|
||||
|
||||
override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright )
|
||||
override void Drawer( Vector2 pos, bool selected )
|
||||
{
|
||||
String str = label;
|
||||
if ( selected ) str = "\cd▸\c- "..str;
|
||||
bool smallname = master.mSmallFont.StringWidth(str)>(width-(maxlen[3]+maxlen[2]+maxlen[1]+maxlen[0]+24));
|
||||
Screen.DrawText(smallname?master.mTinyFont:master.mSmallFont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y+smallname*2,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(smallname?master.mTinyFont:master.mSmallFont,Font.CR_FIRE,master.origin.x+pos.x,master.origin.y+pos.y+smallname*2,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
double xx = pos.x+width;
|
||||
double yy = pos.y+2;
|
||||
int sec = Thinker.Tics2Seconds(s.time);
|
||||
str = String.Format("%02d\cu:\c-%02d\cu:\c-%02d",sec/3600,(sec%3600)/60,sec%60);
|
||||
Screen.DrawText(master.mTinyFont,((s.suck>0)&&(sec>=(s.suck*3600)))?Font.CR_RED:(sec<=s.par)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.mTinyFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,Font.CR_FIRE,master.origin.x+xx-maxlen[0],master.origin.y+yy,"T",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,((s.suck>0)&&(sec>=(s.suck*3600)))?Font.CR_RED:(sec<=s.par)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.mTinyFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(master.mTinyFont,Font.CR_FIRE,master.origin.x+xx-maxlen[0],master.origin.y+yy,"T",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
if ( maxlen[0] > 0 ) xx -= maxlen[0]+8;
|
||||
if ( s.stotal > 0 )
|
||||
{
|
||||
str = String.Format("%d\cu/\c-%d",s.scount,s.stotal);
|
||||
Screen.DrawText(master.mTinyFont,(s.scount>=s.stotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.mTinyFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,Font.CR_FIRE,master.origin.x+xx-maxlen[1],master.origin.y+yy,"S",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,(s.scount>=s.stotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.mTinyFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(master.mTinyFont,Font.CR_FIRE,master.origin.x+xx-maxlen[1],master.origin.y+yy,"S",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
}
|
||||
if ( maxlen[1] > 0 ) xx -= maxlen[1]+8;
|
||||
if ( s.itotal > 0 )
|
||||
{
|
||||
str = String.Format("%d\cu/\c-%d",s.icount,s.itotal);
|
||||
Screen.DrawText(master.mTinyFont,(s.icount>=s.itotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.mTinyFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,Font.CR_FIRE,master.origin.x+xx-maxlen[2],master.origin.y+yy,"I",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,(s.icount>=s.itotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.mTinyFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(master.mTinyFont,Font.CR_FIRE,master.origin.x+xx-maxlen[2],master.origin.y+yy,"I",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
}
|
||||
if ( maxlen[2] > 0 ) xx -= maxlen[2]+8;
|
||||
if ( s.ktotal > 0 )
|
||||
{
|
||||
str = String.Format("%d\cu/\c-%d",s.kcount,s.ktotal);
|
||||
Screen.DrawText(master.mTinyFont,(s.kcount>=s.ktotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.mTinyFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,Font.CR_FIRE,master.origin.x+xx-maxlen[3],master.origin.y+yy,"K",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,(s.kcount>=s.ktotal)?Font.CR_GOLD:Font.CR_WHITE,master.origin.x+xx-master.mTinyFont.StringWidth(str),master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
Screen.DrawText(master.mTinyFont,Font.CR_FIRE,master.origin.x+xx-maxlen[3],master.origin.y+yy,"K",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -724,28 +719,28 @@ Class DemolitionistMenuAchievementItem : DemolitionistMenuListItem
|
|||
return 50; // hardcoded
|
||||
}
|
||||
|
||||
override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright )
|
||||
override void Drawer( Vector2 pos, bool selected )
|
||||
{
|
||||
if ( bHidden ) return;
|
||||
bool completed = !!a.state;
|
||||
bool hasprogress = (a.maxval && a.val);
|
||||
double xx = master.origin.x+pos.x;
|
||||
double yy = master.origin.y+pos.y;
|
||||
Screen.DrawTexture(BaseBox,false,xx+1,yy+1,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright,DTA_FillColor,(!completed&&!hasprogress&&ShouldObscure)?Color(8,8,8):Color(16,16,16));
|
||||
Screen.DrawTexture((!completed&&!hasprogress&&ShouldObscure)?AchievementUnknown:a.icon,false,xx,yy,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright,DTA_Desaturate,(!completed)*255,DTA_ColorOverlay,completed?Color(0,0,0,0):(hasprogress||!ShouldObscure)?Color(96,0,0,0):Color(192,0,0,0));
|
||||
Screen.DrawTexture(BarTex[0],false,xx+1,yy+36,DTA_DestWidthF,width,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright,DTA_FillColor,Color(0,0,0));
|
||||
Screen.DrawTexture(BaseBox,false,xx+1,yy+1,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_FillColor,(!completed&&!hasprogress&&ShouldObscure)?Color(8,8,8):Color(16,16,16));
|
||||
Screen.DrawTexture((!completed&&!hasprogress&&ShouldObscure)?AchievementUnknown:a.icon,false,xx,yy,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_Desaturate,(!completed)*255,DTA_ColorOverlay,completed?Color(0,0,0,0):(hasprogress||!ShouldObscure)?Color(96,0,0,0):Color(192,0,0,0));
|
||||
Screen.DrawTexture(BarTex[0],false,xx+1,yy+36,DTA_DestWidthF,width,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_FillColor,Color(0,0,0));
|
||||
String str;
|
||||
if ( a.maxval && (!ShouldObscure || hasprogress) )
|
||||
{
|
||||
int val = clamp(a.val,0,a.maxval);
|
||||
if ( val < a.maxval ) Screen.DrawTexture(BarTex[0],false,xx,yy+35,DTA_DestWidthF,width,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawTexture(BarTex[completed?2:1],false,xx,yy+35,DTA_DestWidthF,width*(val/double(a.maxval)),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
if ( val < a.maxval ) Screen.DrawTexture(BarTex[0],false,xx,yy+35,DTA_DestWidthF,width,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
Screen.DrawTexture(BarTex[completed?2:1],false,xx,yy+35,DTA_DestWidthF,width*(val/double(a.maxval)),DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
if ( completed ) str = String.Format("%s / %s",SWWMUtility.ThousandsNum(a.maxval),SWWMUtility.ThousandsNum(a.maxval));
|
||||
else str = String.Format("%s / %s",SWWMUtility.ThousandsNum(val),SWWMUtility.ThousandsNum(a.maxval));
|
||||
int ox = (width-master.mTinyFont.StringWidth(str))/2;
|
||||
Screen.DrawText(master.mTinyFont,completed?Font.CR_GREEN:Font.CR_WHITE,xx+ox,yy+37,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,completed?Font.CR_GREEN:Font.CR_WHITE,xx+ox,yy+37,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
}
|
||||
else Screen.DrawTexture(BarTex[completed?2:0],false,xx,yy+35,DTA_DestWidthF,width,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
else Screen.DrawTexture(BarTex[completed?2:0],false,xx,yy+35,DTA_DestWidthF,width,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
str = a.hasformat?String.Format(StringTable.Localize("$SWWM_ACHIEVEMENT_"..a.basename.."_TXT"),a.maxval):StringTable.Localize("$SWWM_ACHIEVEMENT_"..a.basename.."_TXT");
|
||||
if ( str != oldstr )
|
||||
{
|
||||
|
|
@ -756,12 +751,12 @@ Class DemolitionistMenuAchievementItem : DemolitionistMenuListItem
|
|||
str = StringTable.Localize("$SWWM_ACHIEVEMENT_"..a.basename.."_TAG");
|
||||
if ( !completed && !hasprogress && ShouldObscure ) SWWMUtility.ObscureText(str,(gametic/3)+ypos*2+1);
|
||||
int oy = (32-(14+(9*l.Count())))/2;
|
||||
Screen.DrawText(master.mSmallFont,completed?Font.CR_GREEN:Font.CR_DARKGRAY,xx+36,yy+oy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mSmallFont,completed?Font.CR_GREEN:Font.CR_DARKGRAY,xx+36,yy+oy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
for ( int i=0; i<l.Count(); i++ )
|
||||
{
|
||||
str = l.StringAt(i);
|
||||
if ( !completed && !hasprogress && ShouldObscure ) SWWMUtility.ObscureText(str,(gametic/3)+ypos*2+2+i);
|
||||
Screen.DrawText(master.mTinyFont,completed?Font.CR_WHITE:Font.CR_BLACK,xx+40,yy+oy+14+i*9,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
|
||||
Screen.DrawText(master.mTinyFont,completed?Font.CR_WHITE:Font.CR_BLACK,xx+40,yy+oy+14+i*9,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -386,11 +386,9 @@ Class DemolitionistStoreTab : DemolitionistMenuTab
|
|||
}
|
||||
double xx = 9;
|
||||
double yy = 23;
|
||||
int cliptop = int((master.origin.y+23)*master.hs);
|
||||
int clipbottom = int((master.origin.y+master.ws.y-23)*master.hs);
|
||||
int clipleft = int((master.origin.x+9)*master.hs);
|
||||
int clipright = int((master.origin.x+master.ws.x-9)*master.hs);
|
||||
invlist[bSell].Drawer((xx-smofs,yy),cliptop,clipbottom,clipleft,clipright);
|
||||
Screen.SetClipRect(int((master.origin.x+9)*master.hs),int((master.origin.y+23)*master.hs),int((master.ws.x-18)*master.hs),int((master.ws.y-46)*master.hs));
|
||||
invlist[bSell].Drawer((xx-smofs,yy));
|
||||
Screen.ClearClipRect();
|
||||
if ( maxofs <= 0 ) return;
|
||||
yy = master.ws.y-21;
|
||||
master.DrawHSeparator(0,yy,master.ws.x);
|
||||
|
|
@ -567,10 +565,10 @@ Class DemolitionistMenuStoreItem : DemolitionistMenuListItem
|
|||
UpdateLabel();
|
||||
}
|
||||
|
||||
override void Drawer( Vector2 pos, bool selected, int cliptop, int clipbottom, int clipleft, int clipright )
|
||||
override void Drawer( Vector2 pos, bool selected )
|
||||
{
|
||||
Screen.DrawText(master.mSmallFont,col,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright,DTA_ColorOverlay,selected?Color(0,0,0,0):Color(96,0,0,0));
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_UNTRANSLATED,master.origin.x+pos.x+(width-16)-master.mSmallFont.StringWidth(pricelabel),master.origin.y+pos.y,pricelabel,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright,DTA_ColorOverlay,selected?Color(0,0,0,0):Color(96,0,0,0));
|
||||
Screen.DrawText(master.mSmallFont,col,master.origin.x+pos.x,master.origin.y+pos.y,label,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,selected?Color(0,0,0,0):Color(96,0,0,0));
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_UNTRANSLATED,master.origin.x+pos.x+(width-16)-master.mSmallFont.StringWidth(pricelabel),master.origin.y+pos.y,pricelabel,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true,DTA_ColorOverlay,selected?Color(0,0,0,0):Color(96,0,0,0));
|
||||
}
|
||||
|
||||
void BuySellItem()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue