# HG changeset patch # User nemo # Date 1361807613 18000 # Node ID cbd25e677446adc77d59c1f857a1264bc31e2f45 # Parent a282ee7936abb8910b662c6646bb52a9f93c6a69 quick and dirty and inefficient example of Tiy's suggested terrain sampling. Still needs moving to uLandGraphics diff -r a282ee7936ab -r cbd25e677446 hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Mon Feb 25 09:50:56 2013 +0100 +++ b/hedgewars/GSHandlers.inc Mon Feb 25 10:53:33 2013 -0500 @@ -5129,12 +5129,23 @@ iceSurface: PSDL_Surface; icePixels: PLongwordArray; pictureX, pictureY: LongInt; + w, c: LongWord; begin + c:= $aedbe2ff; + // FIXME should be a global value, not set every single pixel. Just for test purposes + c:= ($44 shl RShift) or ($97 shl GShift) or ($A9 shl BShift) or ($A0 shl AShift); iceSurface:= SpritesData[sprIceTexture].Surface; pictureX := x mod iceSurface^.w; pictureY := y mod iceSurface^.h; icePixels := iceSurface^.pixels; - LandPixels[y, x]:= addBgColor(LandPixels[y, x], icePixels^[pictureX + pictureY * iceSurface^.w]); + w:= LandPixels[y, x]; + w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED + + (w shr BShift and $FF) * RGB_LUMINANCE_GREEN + + (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)) * 2; + if w > 255 then w:= 255; + w:= (w shl RShift) or (w shl BShift) or (w shl GShift) or (LandPixels[y,x] and AMask); + //LandPixels[y, x]:= w; + LandPixels[y, x]:= addBgColor(w, c); Land[y, x] := land[y, x] or lfIce; end; @@ -5153,9 +5164,9 @@ begin weight := getPixelWeight(i, j); if isLanscape(weight) then - begin - drawIcePixel(i, j); - end else + begin + if Land[j,i] and lfIce = 0 then drawIcePixel(i, j); + end else begin if isLanscapeEdge(weight) then begin