hedgewars/GSHandlers.inc
changeset 4613 f58ff1827763
parent 4611 445d382cd401
child 4617 42aad2cd981e
equal deleted inserted replaced
4611:445d382cd401 4613:f58ff1827763
   557         if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480)
   557         if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480)
   558         end
   558         end
   559 end;
   559 end;
   560 
   560 
   561 procedure doStepSnowflake(Gear: PGear);
   561 procedure doStepSnowflake(Gear: PGear);
   562 var xx, yy, px, py: LongInt;
   562 var xx, yy, px, py, i: LongInt;
   563     move: Boolean;
   563     move: Boolean;
   564     s: PSDL_Surface;
   564     s: PSDL_Surface;
   565     p: PLongwordArray;
   565     p: PLongwordArray;
   566 begin
   566 begin
   567 if GameTicks and $7 = 0 then
   567 if GameTicks and $7 = 0 then
   593         else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] > 255) then
   593         else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] > 255) then
   594             begin
   594             begin
   595             // we've collided with land. draw some stuff and get back into the clouds
   595             // we've collided with land. draw some stuff and get back into the clouds
   596             move:= true;
   596             move:= true;
   597 ////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
   597 ////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
   598             Land[yy, xx]:= Land[yy, xx] or lfBasic;
   598             if cWindSpeed * 1600 + dX < _0 then i:= -1
   599             if yy > 1 then
   599             else i:= 1;
       
   600             if (yy > 0) and ((Land[yy-1, xx] and $FF00) = 0) then dec(yy)
       
   601             else dec(xx, i);
       
   602             if ((xx and LAND_WIDTH_MASK) = 0) and ((yy and LAND_HEIGHT_MASK) = 0) then Land[yy, xx]:= Land[yy, xx] or lfBasic;
       
   603             if yy > 0 then
   600                 begin 
   604                 begin 
   601                 Land[yy-1, xx]:= Land[yy-1, xx] or lfBasic;
   605                 Land[yy-1, xx]:= Land[yy-1, xx] or lfBasic;
   602                 if (cWindSpeed * 1600 + dX < _0) and (xx > 1) then
   606                 if ((xx-i and LAND_WIDTH_MASK) = 0) then Land[yy-1, xx-i]:= Land[yy-1, xx-i] or lfBasic;
   603                     begin
       
   604                     Land[yy-1, xx-1]:= Land[yy-1, xx-1] or lfBasic;
       
   605                     Land[yy, xx-1]:= Land[yy, xx-1] or lfBasic
       
   606                     end
       
   607                 else if xx < LAND_WIDTH then
       
   608                     begin
       
   609                     Land[yy-1, xx+1]:= Land[yy-1, xx+1] or lfBasic;
       
   610                     Land[yy, xx+1]:= Land[yy, xx+1] or lfBasic
       
   611                     end
       
   612                 end;
   607                 end;
       
   608             if ((xx-i and LAND_WIDTH_MASK) = 0) and ((yy and LAND_HEIGHT_MASK) = 0) then Land[yy, xx-i]:= Land[yy, xx-i] or lfBasic;
   613             dec(yy,4);
   609             dec(yy,4);
   614             dec(xx,2);
   610             dec(xx,i);
   615             if (((cReducedQuality and rqBlurryLand) = 0) and 
   611             if (((cReducedQuality and rqBlurryLand) = 0) and 
   616                     (xx >= 0) and (xx < LAND_WIDTH-2) and (yy >= 0) and (yy < LAND_HEIGHT)) or
   612                     (xx >= 0) and (xx < LAND_WIDTH-4) and (yy >= 0) and (yy < LAND_HEIGHT)) or
   617                (((cReducedQuality and rqBlurryLand) <> 0) and
   613                (((cReducedQuality and rqBlurryLand) <> 0) and
   618                     (xx >= 0) and (xx < (LAND_WIDTH div 2)-2) and (yy >= 0) and (yy < LAND_HEIGHT div 2)) then
   614                     (xx >= 0) and (xx < (LAND_WIDTH div 2)-4) and (yy >= 0) and (yy < LAND_HEIGHT div 2)) then
   619                 begin
   615                 begin
   620                 s:= SpritesData[sprSnow].Surface;
   616                 s:= SpritesData[sprSnow].Surface;
   621                 p:= s^.pixels;
   617                 p:= s^.pixels;
   622 
   618 
   623                 for py:= 0 to Pred(s^.h) do
   619                 for py:= 0 to Pred(s^.h) do