hedgewars/GSHandlers.inc
changeset 6419 6a464d0a5c13
parent 6389 9acbf54e9379
child 6450 14224c9b4594
equal deleted inserted replaced
6418:f1a3c3aab5b4 6419:6a464d0a5c13
   653         end
   653         end
   654 end;
   654 end;
   655 
   655 
   656 ////////////////////////////////////////////////////////////////////////////////
   656 ////////////////////////////////////////////////////////////////////////////////
   657 procedure doStepSnowflake(Gear: PGear);
   657 procedure doStepSnowflake(Gear: PGear);
   658 var xx, yy, px, py: LongInt;
   658 var xx, yy, px, py, rx, ry, lx, ly: LongInt;
   659     move, draw, allpx, gun: Boolean;
   659     move, draw, allpx, gun: Boolean;
   660     s: PSDL_Surface;
   660     s: PSDL_Surface;
   661     p: PLongwordArray;
   661     p: PLongwordArray;
   662     lf: LongWord;
   662     lf: LongWord;
   663 begin
   663 begin
   754             p:= s^.pixels;
   754             p:= s^.pixels;
   755             allpx:= true;
   755             allpx:= true;
   756             for py:= 0 to Pred(s^.h) do
   756             for py:= 0 to Pred(s^.h) do
   757                 begin
   757                 begin
   758                 for px:= 0 to Pred(s^.w) do
   758                 for px:= 0 to Pred(s^.w) do
   759                     if ((((yy + py) and LAND_HEIGHT_MASK) = 0) and (((xx + px) and LAND_WIDTH_MASK) = 0)) and ((Land[yy + py, xx + px] and $FF) = 0) then
   759                     begin
       
   760                     lx:=xx + px; ly:=yy + py;
       
   761                     if (ly and LAND_HEIGHT_MASK = 0) and (lx and LAND_WIDTH_MASK = 0) and (Land[ly, lx] and $FF = 0) then
   760                         begin
   762                         begin
       
   763                         rx:= lx;
       
   764                         ry:= ly;
       
   765                         if cReducedQuality and rqBlurryLand <> 0 then
       
   766                             begin
       
   767                             rx:= rx div 2;ry:= ry div 2;
       
   768                             end;
       
   769                         if Land[yy + py, xx + px] and $FF00 = 0 then
       
   770                             if gun then
       
   771                                 begin
       
   772                                 LandDirty[yy div 32, xx div 32]:= 1;
       
   773                                 if LandPixels[ry, rx] = 0 then Land[ly, lx]:=  lfDamaged or lfObject
       
   774                                 else Land[ly, lx]:=  lfDamaged or lfBasic
       
   775                                 end
       
   776                             else Land[ly, lx]:= lf;
   761                         if gun then
   777                         if gun then
   762                             begin
   778                             LandPixels[ry, rx]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
   763                             // try to avoid speckles. might need disabling
   779                         else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]);
   764                             LandDirty[yy div 32, xx div 32]:= 1;
       
   765                             Land[yy + py, xx + px]:= (Land[yy + py, xx + px] or lfDamaged or lfObject) and not lfBasic;
       
   766                             end
       
   767                         else if Land[yy + py, xx + px] and $FF00 = 0 then Land[yy + py, xx + px]:= lf;
       
   768                         if (cReducedQuality and rqBlurryLand) = 0 then
       
   769                             begin
       
   770                             if gun then
       
   771                                 LandPixels[yy + py, xx + px]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
       
   772                             else LandPixels[yy + py, xx + px]:= addBgColor(LandPixels[yy + py, xx + px], p^[px]);
       
   773                             end
       
   774                         else
       
   775                             begin
       
   776                             if gun then
       
   777                                 LandPixels[(yy + py) div 2, (xx + px) div 2]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
       
   778                             else LandPixels[(yy + py) div 2, (xx + px) div 2]:= addBgColor(LandPixels[(yy + py) div 2, (xx + px) div 2], p^[px]);
       
   779                             end;
       
   780                         end
   780                         end
   781                     else allpx:= false;
   781                     else allpx:= false
       
   782                     end;
   782                 p:= @(p^[s^.pitch shr 2])
   783                 p:= @(p^[s^.pitch shr 2])
   783                 end;
   784                 end;
   784             
   785             
   785             
   786             // Why is this here.  For one thing, there's no test on +1 being safe. 
   786             Land[py, px+1]:= lfBasic;
   787             //Land[py, px+1]:= lfBasic;
   787             
   788             
   788             if allpx then UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w))
   789             if allpx then UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w))
   789             else
   790             else
   790                 begin
   791                 begin
   791                 UpdateLandTexture(
   792                 UpdateLandTexture(