5088 *) |
5088 *) |
5089 end; |
5089 end; |
5090 end; |
5090 end; |
5091 |
5091 |
5092 |
5092 |
5093 function isLanscapeEdge(weight:Longint):boolean; |
5093 function isLandscapeEdge(weight:Longint):boolean; |
5094 begin |
5094 begin |
5095 result := (weight < 8) and (weight >= 2); |
5095 result := (weight < 8) and (weight >= 2); |
5096 end; |
5096 end; |
5097 |
5097 |
5098 function isLanscape(weight:Longint):boolean; |
5098 function isLandscape(weight:Longint):boolean; |
5099 begin |
5099 begin |
5100 result := weight < 2; |
5100 result := weight < 2; |
5101 end; |
5101 end; |
5102 |
5102 |
5103 function isEmptySpace(weight:Longint):boolean; |
5103 function isEmptySpace(weight:Longint):boolean; |
5104 begin |
5104 begin |
5105 result := not isLanscape(weight) and not isLanscapeEdge(weight); |
5105 result := not isLandscape(weight) and not isLandscapeEdge(weight); |
5106 end; |
5106 end; |
5107 |
5107 |
5108 |
5108 |
5109 function getPixelWeight(x, y:Longint): Longint; |
5109 function getPixelWeight(x, y:Longint): Longint; |
5110 var |
5110 var |
5140 pictureY := y mod iceSurface^.h; |
5140 pictureY := y mod iceSurface^.h; |
5141 icePixels := iceSurface^.pixels; |
5141 icePixels := iceSurface^.pixels; |
5142 w:= LandPixels[y, x]; |
5142 w:= LandPixels[y, x]; |
5143 w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED + |
5143 w:= round(((w shr RShift and $FF) * RGB_LUMINANCE_RED + |
5144 (w shr BShift and $FF) * RGB_LUMINANCE_GREEN + |
5144 (w shr BShift and $FF) * RGB_LUMINANCE_GREEN + |
5145 (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)) * 4; |
5145 (w shr GShift and $FF) * RGB_LUMINANCE_BLUE)); |
|
5146 if w < 128 then w:= w+128; |
5146 if w > 255 then w:= 255; |
5147 if w > 255 then w:= 255; |
5147 w:= (w shl RShift) or (w shl BShift) or (w shl GShift) or (LandPixels[y,x] and AMask); |
5148 w:= (w shl RShift) or (w shl BShift) or (w shl GShift) or (LandPixels[y,x] and AMask); |
5148 //LandPixels[y, x]:= w; |
5149 //LandPixels[y, x]:= w; |
5149 LandPixels[y, x]:= addBgColor(w, c); |
5150 LandPixels[y, x]:= addBgColor(w, c); |
5150 |
5151 |
5158 i, j: Longint; |
5159 i, j: Longint; |
5159 weight: Longint; |
5160 weight: Longint; |
5160 begin |
5161 begin |
5161 |
5162 |
5162 for i := max(x - iceHalfSize, 0) to min(x + iceHalfSize, LAND_WIDTH-1) do |
5163 for i := max(x - iceHalfSize, 0) to min(x + iceHalfSize, LAND_WIDTH-1) do |
5163 begin |
5164 begin |
5164 for j := max(y - iceHalfSize, 0) to min(y + iceHalfSize, LAND_HEIGHT-1) do |
5165 for j := max(y - iceHalfSize, 0) to min(y + iceHalfSize, LAND_HEIGHT-1) do |
5165 begin |
5166 begin |
5166 weight := getPixelWeight(i, j); |
5167 weight := getPixelWeight(i, j); |
5167 if isLanscape(weight) then |
5168 if isLandscape(weight) then |
5168 begin |
5169 begin |
5169 if Land[j,i] and lfIce = 0 then drawIcePixel(i, j); |
5170 if Land[j,i] and lfIce = 0 then drawIcePixel(i, j); |
5170 end else |
5171 end |
5171 begin |
5172 else |
5172 if isLanscapeEdge(weight) then |
|
5173 begin |
5173 begin |
|
5174 if isLandscapeEdge(weight) then |
|
5175 begin |
5174 LandPixels[j, i] := $FFB2AF8A; |
5176 LandPixels[j, i] := $FFB2AF8A; |
5175 if Land[j, i] > 255 then Land[j, i] := Land[j, i] or lfIce; |
5177 if Land[j, i] > 255 then Land[j, i] := Land[j, i] or lfIce; |
5176 end; |
5178 end; |
5177 end; |
5179 end; |
5178 end; |
5180 end; |
5179 end; |
5181 end; |
|
5182 SetAllHHToActive; |
5180 UpdateLandTexture(x - iceHalfSize, iceSize, y - iceHalfSize, iceSize, true); |
5183 UpdateLandTexture(x - iceHalfSize, iceSize, y - iceHalfSize, iceSize, true); |
5181 end; |
5184 end; |
5182 |
5185 |
5183 |
5186 |
5184 procedure doStepIceGun(Gear: PGear); |
5187 procedure doStepIceGun(Gear: PGear); |