Use SetClipRect to avoid DTA_Clip* spam in many places.

This commit is contained in:
Mari the Deer 2022-04-22 12:40:00 +02:00
commit bcc397c9f3
12 changed files with 102 additions and 118 deletions

View file

@ -1258,8 +1258,7 @@ Class SWWMStatusBar : BaseStatusBar
// don't draw when dead or with automap open
if ( (CPlayer.health <= 0) || automapactive ) return;
SWWMUtility.PrepareProjData(projdata,ViewPos,ViewRot.x,ViewRot.y,ViewRot.z,players[consoleplayer].fov);
int cliptop = projdata.viewy, clipbottom = projdata.viewy+projdata.viewh,
clipleft = projdata.viewx, clipright = projdata.viewx+projdata.vieww;
Screen.SetClipRect(projdata.viewx,projdata.viewy,projdata.vieww,projdata.viewh);
// points of interest
String tag;
if ( level.allmap )
@ -1304,9 +1303,9 @@ Class SWWMStatusBar : BaseStatusBar
else tag = String.Format("\cy%s\c-",StringTable.Localize("$SWWM_NEXIT"));
}
}
Screen.DrawText(mTinyFont,Font.CR_WHITE,(vpos.x-hsi*mTinyFont.StringWidth(tag)/2.)/hsi,(vpos.y-hsi*mTinyFont.GetHeight()/2.)/hsi,tag,DTA_VirtualWidthF,ssi.x,DTA_VirtualHeightF,ssi.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawText(mTinyFont,Font.CR_WHITE,(vpos.x-hsi*mTinyFont.StringWidth(tag)/2.)/hsi,(vpos.y-hsi*mTinyFont.GetHeight()/2.)/hsi,tag,DTA_VirtualWidthF,ssi.x,DTA_VirtualHeightF,ssi.y,DTA_KeepRatio,true);
tag = String.Format("\cu(%s\cu)\c-",FormatDist(tdir.length()));
Screen.DrawText(mTinyFont,Font.CR_WHITE,(vpos.x-hsi*mTinyFont.StringWidth(tag)/2.)/hsi,(vpos.y+hsi*mTinyFont.GetHeight()/2.)/hsi,tag,DTA_VirtualWidthF,ssi.x,DTA_VirtualHeightF,ssi.y,DTA_KeepRatio,true,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawText(mTinyFont,Font.CR_WHITE,(vpos.x-hsi*mTinyFont.StringWidth(tag)/2.)/hsi,(vpos.y+hsi*mTinyFont.GetHeight()/2.)/hsi,tag,DTA_VirtualWidthF,ssi.x,DTA_VirtualHeightF,ssi.y,DTA_KeepRatio,true);
}
}
// sensed items
@ -1325,13 +1324,13 @@ Class SWWMStatusBar : BaseStatusBar
double alph = clamp(((s.updated+mtime)-(level.maptime+fractic))/35.,0.,1.);
alph *= clamp(1.5-1.5*(tdir.length()/(level.allmap?1200.:800.)),0.,1.);
tag = s.tag;
Screen.DrawText(mTinyFont,s.vipitem?Font.CR_PURPLE:s.scoreitem?Font.CR_GOLD:Font.CR_GREEN,(vpos.x-hsd*mTinyFont.StringWidth(tag)/2.)/hsd,(vpos.y-hsd*mTinyFont.GetHeight()/2.)/hsd,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawText(mTinyFont,s.vipitem?Font.CR_PURPLE:s.scoreitem?Font.CR_GOLD:Font.CR_GREEN,(vpos.x-hsd*mTinyFont.StringWidth(tag)/2.)/hsd,(vpos.y-hsd*mTinyFont.GetHeight()/2.)/hsd,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph);
tag = String.Format("\cu(%s\cu)\c-",FormatDist(tdir.length()));
Screen.DrawText(mTinyFont,Font.CR_WHITE,(vpos.x-hsd*mTinyFont.StringWidth(tag)/2.)/hsd,(vpos.y+hsd*mTinyFont.GetHeight()/2.)/hsd,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawText(mTinyFont,Font.CR_WHITE,(vpos.x-hsd*mTinyFont.StringWidth(tag)/2.)/hsd,(vpos.y+hsd*mTinyFont.GetHeight()/2.)/hsd,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph);
if ( s.item is 'SWWMRespawnTimer' )
{
tag = String.Format(StringTable.Localize("$SWWM_TRESPAWN"),s.item.special2/GameTicRate);
Screen.DrawText(mTinyFont,Font.CR_WHITE,(vpos.x-hsd*mTinyFont.StringWidth(tag)/2.)/hsd,(vpos.y+hsd*mTinyFont.GetHeight()*2)/hsd,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawText(mTinyFont,Font.CR_WHITE,(vpos.x-hsd*mTinyFont.StringWidth(tag)/2.)/hsd,(vpos.y+hsd*mTinyFont.GetHeight()*2)/hsd,tag,DTA_VirtualWidthF,ssd.x,DTA_VirtualHeightF,ssd.y,DTA_KeepRatio,true,DTA_Alpha,alph);
}
}
}
@ -1375,37 +1374,37 @@ Class SWWMStatusBar : BaseStatusBar
if ( col == -1 ) col = Font.CR_WHITE;
}
if ( swwm_targettags || targ.myplayer && (tag != "") )
Screen.DrawText(fnt,col,(barpos.x+barsiz.x/2.-(fnt.StringWidth(tag)*hsb)/2.)/hsb,(barpos.y-fnt.GetHeight()*hsb)/hsb,tag,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawTexture(EnemyBTex,false,barpos.x/hsb,barpos.y/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawText(fnt,col,(barpos.x+barsiz.x/2.-(fnt.StringWidth(tag)*hsb)/2.)/hsb,(barpos.y-fnt.GetHeight()*hsb)/hsb,tag,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph);
Screen.DrawTexture(EnemyBTex,false,barpos.x/hsb,barpos.y/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph);
double ht = clamp(targ.intp.GetValue(),0,targ.maxhealth*100);
double hw = (min(ht,targ.maxhealth)*50.)/targ.maxhealth;
if ( targ.mytarget && (targ.mytarget.bInvulnerable || (targ.myplayer && (targ.myplayer.cheats&(CF_GODMODE|CF_GODMODE2))) || targ.mytarget.FindInventory("InvinciballPower")) )
{
Screen.DrawTexture(EnemyHTex[4],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawTexture(EnemyHTex[4],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw);
}
else
{
Screen.DrawTexture(EnemyHTex[0],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawTexture(EnemyHTex[0],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw);
if ( ht > targ.maxhealth )
{
hw = (min(ht-targ.maxhealth,targ.maxhealth)*50.)/targ.maxhealth;
Screen.DrawTexture(EnemyHTex[1],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawTexture(EnemyHTex[1],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw);
}
if ( ht > targ.maxhealth*2 )
{
hw = (min(ht-targ.maxhealth*2,targ.maxhealth*3)*50.)/(targ.maxhealth*3);
Screen.DrawTexture(EnemyHTex[2],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawTexture(EnemyHTex[2],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw);
}
if ( ht > targ.maxhealth*5 )
{
hw = (min(ht-targ.maxhealth*5,targ.maxhealth*5)*50.)/(targ.maxhealth*5);
Screen.DrawTexture(EnemyHTex[3],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawTexture(EnemyHTex[3],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_WindowRightF,hw);
}
}
if ( targ.mytarget && targ.mytarget.FindInventory("DivineSpriteEffect") )
{
double falph = clamp((ht-targ.maxhealth*10)/(targ.maxhealth*60.),0.,1.);
Screen.DrawTexture(EnemyHTex[5],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph*falph,DTA_LegacyRenderStyle,STYLE_Add,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawTexture(EnemyHTex[5],false,(barpos.x+2*hsb)/hsb,(barpos.y+2*hsb)/hsb,DTA_VirtualWidthF,ssb.x,DTA_VirtualHeightF,ssb.y,DTA_KeepRatio,true,DTA_Alpha,alph*falph,DTA_LegacyRenderStyle,STYLE_Add);
}
}
// floating kill scores and others
@ -1447,7 +1446,7 @@ Class SWWMStatusBar : BaseStatusBar
}
double hs0 = isscore?hss:hsn;
Vector2 ss0 = isscore?sss:ssn;
Screen.DrawText(mTinyFont,snum.tcolor,(vpos.x-hs0*(fo.x+mTinyFont.StringWidth(tag)/2.))/hs0,(vpos.y-hs0*(fo.y+(mTinyFont.GetHeight()/2.)))/hs0,tag,DTA_VirtualWidthF,ss0.x,DTA_VirtualHeightF,ss0.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawText(mTinyFont,snum.tcolor,(vpos.x-hs0*(fo.x+mTinyFont.StringWidth(tag)/2.))/hs0,(vpos.y-hs0*(fo.y+(mTinyFont.GetHeight()/2.)))/hs0,tag,DTA_VirtualWidthF,ss0.x,DTA_VirtualHeightF,ss0.y,DTA_KeepRatio,true,DTA_Alpha,alph);
// extra strings (if available)
if ( !swwm_scorebonus ) continue;
fo.y += mTinyFont.GetHeight();
@ -1456,10 +1455,11 @@ Class SWWMStatusBar : BaseStatusBar
tag = snum.xstr[i];
if ( snum.xscore[i] == int.max ) tag.AppendFormat(" MAX");
else if ( snum.xscore[i] > 0 ) tag.AppendFormat(" x%d",snum.xscore[i]);
Screen.DrawText(mTinyFont,snum.xtcolor[i],(vpos.x-hss*(fo.x+mTinyFont.StringWidth(tag)/2.))/hss,(vpos.y-hss*(fo.y+(mTinyFont.GetHeight()/2.)))/hss,tag,DTA_VirtualWidthF,sss.x,DTA_VirtualHeightF,sss.y,DTA_KeepRatio,true,DTA_Alpha,alph,DTA_ClipTop,cliptop,DTA_ClipBottom,clipbottom,DTA_ClipLeft,clipleft,DTA_ClipRight,clipright);
Screen.DrawText(mTinyFont,snum.xtcolor[i],(vpos.x-hss*(fo.x+mTinyFont.StringWidth(tag)/2.))/hss,(vpos.y-hss*(fo.y+(mTinyFont.GetHeight()/2.)))/hss,tag,DTA_VirtualWidthF,sss.x,DTA_VirtualHeightF,sss.y,DTA_KeepRatio,true,DTA_Alpha,alph);
fo.y += mTinyFont.GetHeight();
}
}
Screen.ClearClipRect();
}
override void DrawMyPos()
@ -2013,11 +2013,7 @@ Class SWWMStatusBar : BaseStatusBar
// offset to minimap center
rv += basepos;
// draw
int clipleft = int((basepos.x-HALFMAPSIZE)*hs);
int cliptop = int((basepos.y-HALFMAPSIZE)*hs);
int clipright = int(clipleft+HALFMAPSIZE*2*hs);
int clipbottom = int(cliptop+HALFMAPSIZE*2*hs);
Screen.DrawTexture(tx,false,rv.x,rv.y,DTA_ColorOverlay,isportal?Color(128,mm_portalcolor.r,mm_portalcolor.g,mm_portalcolor.b):Color(0,0,0,0),DTA_ScaleX,hs*scl.x,DTA_ScaleY,hs*scl.y,DTA_LegacyRenderStyle,m.GetRenderStyle(),DTA_Alpha,m.Alpha,DTA_FillColor,m.FillColor,DTA_TranslationIndex,m.Translation,DTA_ClipLeft,clipleft,DTA_ClipTop,cliptop,DTA_ClipRight,clipright,DTA_ClipBottom,clipbottom);
Screen.DrawTexture(tx,false,rv.x,rv.y,DTA_ColorOverlay,isportal?Color(128,mm_portalcolor.r,mm_portalcolor.g,mm_portalcolor.b):Color(0,0,0,0),DTA_ScaleX,hs*scl.x,DTA_ScaleY,hs*scl.y,DTA_LegacyRenderStyle,m.GetRenderStyle(),DTA_Alpha,m.Alpha,DTA_FillColor,m.FillColor,DTA_TranslationIndex,m.Translation);
}
ai.Destroy();
continue;
@ -2045,11 +2041,7 @@ Class SWWMStatusBar : BaseStatusBar
// offset to minimap center
rv += basepos;
// draw
int clipleft = int(basepos.x-HALFMAPSIZE*hs);
int cliptop = int(basepos.y-HALFMAPSIZE*hs);
int clipright = int(clipleft+HALFMAPSIZE*2*hs);
int clipbottom = int(cliptop+HALFMAPSIZE*2*hs);
Screen.DrawTexture(tx,false,rv.x,rv.y,DTA_ColorOverlay,isportal?Color(128,mm_portalcolor.r,mm_portalcolor.g,mm_portalcolor.b):Color(0,0,0,0),DTA_ScaleX,hs*scl.x,DTA_ScaleY,hs*scl.y,DTA_LegacyRenderStyle,m.GetRenderStyle(),DTA_Alpha,m.Alpha,DTA_FillColor,m.FillColor,DTA_TranslationIndex,m.Translation,DTA_ClipLeft,clipleft,DTA_ClipTop,cliptop,DTA_ClipRight,clipright,DTA_ClipBottom,clipbottom);
Screen.DrawTexture(tx,false,rv.x,rv.y,DTA_ColorOverlay,isportal?Color(128,mm_portalcolor.r,mm_portalcolor.g,mm_portalcolor.b):Color(0,0,0,0),DTA_ScaleX,hs*scl.x,DTA_ScaleY,hs*scl.y,DTA_LegacyRenderStyle,m.GetRenderStyle(),DTA_Alpha,m.Alpha,DTA_FillColor,m.FillColor,DTA_TranslationIndex,m.Translation);
}
}
private void DrawMapThings( Vector2 basepos )
@ -2209,7 +2201,8 @@ Class SWWMStatusBar : BaseStatusBar
Screen.DrawTexture(MiniBox,false,xx,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Vector2 basemappos = (xx+HALFMAPSIZE+2,yy+HALFMAPSIZE+2);
Screen.Dim(mm_backcolor,1.,int((basemappos.x-HALFMAPSIZE)*hs),int((basemappos.y-HALFMAPSIZE)*hs),int(HALFMAPSIZE*2*hs),int(HALFMAPSIZE*2*hs));
if ( mm_drawautopage ) Screen.DrawTexture(AutoPage,false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ClipRight,int((xx+2+HALFMAPSIZE*2)*hs),DTA_ClipBottom,int((yy+2+HALFMAPSIZE*2)*hs));
Screen.SetClipRect(int((basemappos.x-HALFMAPSIZE)*hs),int((basemappos.y-HALFMAPSIZE)*hs),int(HALFMAPSIZE*2*hs),int(HALFMAPSIZE*2*hs));
if ( mm_drawautopage ) Screen.DrawTexture(AutoPage,false,xx+2,yy+2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
// draw dat stuff
if ( swwm_mm_grid ) DrawMapGrid(basemappos*hs);
DrawMapLines(basemappos*hs);
@ -2223,6 +2216,7 @@ Class SWWMStatusBar : BaseStatusBar
if ( !swwm_mm_rotate ) for ( int i=0; i<3; i++ ) tv[i] = Actor.RotateVector(tv[i],90-ViewRot.x);
for ( int i=0; i<3; i++ ) tv[i] = (tv[i]+basemappos)*hs;
for ( int i=0; i<3; i++ ) Screen.DrawThickLine(int(tv[i].x),int(tv[i].y),int(tv[(i+1)%3].x),int(tv[(i+1)%3].y),max(1.,hs*.5),mm_yourcolor);
Screen.ClearClipRect();
yy += ((HALFMAPSIZE+2)*2)+3;
}
// draw stats and timer when automap is open

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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
{

View file

@ -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()

View file

@ -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);

View file

@ -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));
}
}

View file

@ -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);

View file

@ -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);
}
}
}

View file

@ -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()