# HG changeset patch # User unc0rr # Date 1394798436 -14400 # Node ID c57798251b554203f9d72aa7864031928737c834 # Parent 514e338f2eaff2aaeb6b4a2c7a7552874c91b486 Some optimizations diff -r 514e338f2eaf -r c57798251b55 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Fri Mar 14 13:59:39 2014 +0400 +++ b/hedgewars/uLand.pas Fri Mar 14 16:00:36 2014 +0400 @@ -198,7 +198,7 @@ procedure ColorizeLand(Surface: PSDL_Surface); var tmpsurf: PSDL_Surface; r: TSDL_Rect; - y: LongWord; // stupid SDL 1.2 uses stupid SmallInt for y which limits us to 32767. But is even worse if LandTex is large, can overflow on 32767 map. + y: LongInt; // stupid SDL 1.2 uses stupid SmallInt for y which limits us to 32767. But is even worse if LandTex is large, can overflow on 32767 map. begin tmpsurf:= LoadDataImage(ptCurrTheme, 'LandTex', ifCritical or ifIgnoreCaps); r.y:= 0; @@ -306,6 +306,7 @@ {$HINTS OFF} SetPoints(Template, pa, @fps); {$HINTS ON} + for i:= 1 to Template.BezierizeCount do begin BezierizeEdge(pa, _0_5); diff -r 514e338f2eaf -r c57798251b55 hedgewars/uLandOutline.pas --- a/hedgewars/uLandOutline.pas Fri Mar 14 13:59:39 2014 +0400 +++ b/hedgewars/uLandOutline.pas Fri Mar 14 16:00:36 2014 +0400 @@ -113,17 +113,8 @@ Vx:= int2hwFloat(p1.X - p3.X); Vy:= int2hwFloat(p1.Y - p3.Y); - d:= DistanceI(p2.X - p1.X, p2.Y - p1.Y); - d1:= DistanceI(p2.X - p3.X, p2.Y - p3.Y); d2:= Distance(Vx, Vy); - if d1 < d then - d:= d1; - if d2 < d then - d:= d2; - - d:= d * _1div3; - if d2.QWordValue = 0 then begin Vx:= _0; @@ -131,12 +122,18 @@ end else begin - d2:= _1 / d2; + d:= DistanceI(p2.X - p1.X, p2.Y - p1.Y); + d1:= DistanceI(p2.X - p3.X, p2.Y - p3.Y); + + if d1 < d then + d:= d1; + if d2 < d then + d:= d2; + + d2:= d * _1div3 / d2; + Vx:= Vx * d2; - Vy:= Vy * d2; - - Vx:= Vx * d; - Vy:= Vy * d + Vy:= Vy * d2 end end;