hedgewars/GSHandlers.inc
changeset 5693 24a93bbdb81a
parent 5692 753ae5d0776c
child 5695 f1015857deb8
equal deleted inserted replaced
5692:753ae5d0776c 5693:24a93bbdb81a
   582 procedure doStepSnowflake(Gear: PGear);
   582 procedure doStepSnowflake(Gear: PGear);
   583 var xx, yy, px, py: LongInt;
   583 var xx, yy, px, py: LongInt;
   584     move, draw, allpx, gun: Boolean;
   584     move, draw, allpx, gun: Boolean;
   585     s: PSDL_Surface;
   585     s: PSDL_Surface;
   586     p: PLongwordArray;
   586     p: PLongwordArray;
       
   587     lf: LongWord;
   587 begin
   588 begin
   588 gun:= (Gear^.State and gstTmpFlag) <> 0;
   589 gun:= (Gear^.State and gstTmpFlag) <> 0;
   589 move:= false;
   590 move:= false;
   590 draw:= false;
   591 draw:= false;
   591 if gun then
   592 if gun then
   624         if yy > cWaterLine then move:= true
   625         if yy > cWaterLine then move:= true
   625         else if ((yy and LAND_HEIGHT_MASK) <> 0) or (xx > LAND_WIDTH + 512) or (xx < -512) then move:=true
   626         else if ((yy and LAND_HEIGHT_MASK) <> 0) or (xx > LAND_WIDTH + 512) or (xx < -512) then move:=true
   626         // Solid pixel encountered
   627         // Solid pixel encountered
   627         else if ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then
   628         else if ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then
   628             begin
   629             begin
       
   630             lf:= Land[yy, xx] and (lfObject or lfBasic);
   629             // If there's room below keep falling
   631             // If there's room below keep falling
   630             if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then
   632             if (((yy-1) and LAND_HEIGHT_MASK) = 0) and (Land[yy-1, xx] = 0) then
   631                 begin
   633                 begin
   632                 X:= X - cWindSpeed * 1600 - dX;
   634                 X:= X - cWindSpeed * 1600 - dX;
   633                 end
   635                 end
   682                         begin
   684                         begin
   683                         if gun then
   685                         if gun then
   684                             begin
   686                             begin
   685                             // try to avoid speckles. might need disabling
   687                             // try to avoid speckles. might need disabling
   686                             LandDirty[yy div 32, xx div 32]:= 1;
   688                             LandDirty[yy div 32, xx div 32]:= 1;
   687                             Land[yy + py, xx + px]:= Land[yy + py, xx + px] or lfDamaged;
   689                             Land[yy + py, xx + px]:= (Land[yy + py, xx + px] or lfDamaged or lfObject) and not lfBasic;
   688                             end;
   690                             end
   689                         Land[yy + py, xx + px]:= Land[yy + py, xx + px] or lfObject;
   691                         else if Land[yy + py, xx + px] and $FF00 = 0 then Land[yy + py, xx + px]:= lf;
   690                         if (cReducedQuality and rqBlurryLand) = 0 then
   692                         if (cReducedQuality and rqBlurryLand) = 0 then
   691                             begin
   693                             begin
   692                             if gun then
   694                             if gun then
   693                                 LandPixels[yy + py, xx + px]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
   695                                 LandPixels[yy + py, xx + px]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
   694                             else LandPixels[yy + py, xx + px]:= addBgColor(LandPixels[yy + py, xx + px], p^[px]);
   696                             else LandPixels[yy + py, xx + px]:= addBgColor(LandPixels[yy + py, xx + px], p^[px]);