5127 procedure drawIcePixel(x, y:Longint); |
5127 procedure drawIcePixel(x, y:Longint); |
5128 var |
5128 var |
5129 iceSurface: PSDL_Surface; |
5129 iceSurface: PSDL_Surface; |
5130 icePixels: PLongwordArray; |
5130 icePixels: PLongwordArray; |
5131 pictureX, pictureY: LongInt; |
5131 pictureX, pictureY: LongInt; |
5132 begin |
5132 w, c: LongWord; |
|
5133 begin |
|
5134 c:= $aedbe2ff; |
|
5135 // 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); |
5133 iceSurface:= SpritesData[sprIceTexture].Surface; |
5137 iceSurface:= SpritesData[sprIceTexture].Surface; |
5134 pictureX := x mod iceSurface^.w; |
5138 pictureX := x mod iceSurface^.w; |
5135 pictureY := y mod iceSurface^.h; |
5139 pictureY := y mod iceSurface^.h; |
5136 icePixels := iceSurface^.pixels; |
5140 icePixels := iceSurface^.pixels; |
5137 LandPixels[y, x]:= addBgColor(LandPixels[y, x], icePixels^[pictureX + pictureY * iceSurface^.w]); |
5141 w:= LandPixels[y, x]; |
|
5142 w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED + |
|
5143 (w shr BShift and $FF) * RGB_LUMINANCE_GREEN + |
|
5144 (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)) * 2; |
|
5145 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 //LandPixels[y, x]:= w; |
|
5148 LandPixels[y, x]:= addBgColor(w, c); |
5138 |
5149 |
5139 Land[y, x] := land[y, x] or lfIce; |
5150 Land[y, x] := land[y, x] or lfIce; |
5140 end; |
5151 end; |
5141 |
5152 |
5142 procedure DrawIce(Gear: PGear; x, y: Longint); |
5153 procedure DrawIce(Gear: PGear; x, y: Longint); |
5151 begin |
5162 begin |
5152 for j := max(y - iceHalfSize, 0) to min(y + iceHalfSize, LAND_HEIGHT-1) do |
5163 for j := max(y - iceHalfSize, 0) to min(y + iceHalfSize, LAND_HEIGHT-1) do |
5153 begin |
5164 begin |
5154 weight := getPixelWeight(i, j); |
5165 weight := getPixelWeight(i, j); |
5155 if isLanscape(weight) then |
5166 if isLanscape(weight) then |
5156 begin |
5167 begin |
5157 drawIcePixel(i, j); |
5168 if Land[j,i] and lfIce = 0 then drawIcePixel(i, j); |
5158 end else |
5169 end else |
5159 begin |
5170 begin |
5160 if isLanscapeEdge(weight) then |
5171 if isLanscapeEdge(weight) then |
5161 begin |
5172 begin |
5162 LandPixels[j, i] := $FFB2AF8A; |
5173 LandPixels[j, i] := $FFB2AF8A; |
5163 if Land[j, i] > 255 then Land[j, i] := Land[j, i] or lfIce; |
5174 if Land[j, i] > 255 then Land[j, i] := Land[j, i] or lfIce; |