hedgewars/GSHandlers.inc
branchicegun
changeset 8572 4bd0098aaea7
parent 8570 cbd25e677446
child 8574 684169401a2f
equal deleted inserted replaced
8570:cbd25e677446 8572:4bd0098aaea7
  5129     iceSurface: PSDL_Surface;
  5129     iceSurface: PSDL_Surface;
  5130     icePixels: PLongwordArray;
  5130     icePixels: PLongwordArray;
  5131     pictureX, pictureY: LongInt;
  5131     pictureX, pictureY: LongInt;
  5132     w, c: LongWord;
  5132     w, c: LongWord;
  5133 begin
  5133 begin
  5134     c:= $aedbe2ff;
  5134 // So. 3 parameters here. Ice colour, Ice opacity, and a bias on the greyscaled pixel towards lightness
       
  5135     c:= $7dc1ccff;
  5135     // FIXME should be a global value, not set every single pixel.  Just for test purposes
  5136     // FIXME should be a global value, not set every single pixel.  Just for test purposes
  5136     c:= ($44 shl RShift) or ($97 shl GShift) or ($A9 shl BShift) or ($A0 shl AShift);
  5137     c:= ($44 shl RShift) or ($97 shl GShift) or ($A9 shl BShift) or ($A0 shl AShift);
  5137     iceSurface:= SpritesData[sprIceTexture].Surface;
  5138     iceSurface:= SpritesData[sprIceTexture].Surface;
  5138     pictureX := x mod iceSurface^.w;
  5139     pictureX := x mod iceSurface^.w;
  5139     pictureY := y mod iceSurface^.h;
  5140     pictureY := y mod iceSurface^.h;
  5140     icePixels := iceSurface^.pixels;
  5141     icePixels := iceSurface^.pixels;
  5141     w:= LandPixels[y, x];
  5142     w:= LandPixels[y, x];
  5142     w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED +
  5143     w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED +
  5143           (w shr BShift and $FF) * RGB_LUMINANCE_GREEN +
  5144           (w shr BShift and $FF) * RGB_LUMINANCE_GREEN +
  5144           (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)) * 2;
  5145           (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)) * 4;
  5145     if w > 255 then w:= 255;
  5146     if w > 255 then w:= 255;
  5146     w:= (w shl RShift) or (w shl BShift) or (w shl GShift) or (LandPixels[y,x] and AMask);
  5147     w:= (w shl RShift) or (w shl BShift) or (w shl GShift) or (LandPixels[y,x] and AMask);
  5147     //LandPixels[y, x]:= w;
  5148     //LandPixels[y, x]:= w;
  5148     LandPixels[y, x]:= addBgColor(w, c);
  5149     LandPixels[y, x]:= addBgColor(w, c);
  5149 
  5150 
  5150     Land[y, x] := land[y, x] or lfIce;
  5151     Land[y, x] := land[y, x] or lfIce;
  5151 end;
  5152 end;
  5152 
  5153 
  5153 procedure DrawIce(Gear: PGear; x, y: Longint); 
  5154 procedure DrawIce(Gear: PGear; x, y: Longint); 
  5154     const iceSize :Longint = 35;
  5155     const iceSize :Longint = 255;
  5155     const iceHalfSize :Longint = 17;
  5156     const iceHalfSize :Longint = 127;
  5156 var
  5157 var
  5157     i, j: Longint;
  5158     i, j: Longint;
  5158     weight: Longint;
  5159     weight: Longint;
  5159 begin    
  5160 begin    
  5160 
  5161