hedgewars/GSHandlers.inc
changeset 4655 b75bb4307b0f
parent 4642 d9e7d173e6a7
child 4691 d07fa8480491
equal deleted inserted replaced
4653:913460abf897 4655:b75bb4307b0f
   592         if yy > cWaterLine then move:= true
   592         if yy > cWaterLine then move:= true
   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             if (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtRope) then
       
   598                 begin
   597 ////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
   599 ////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
   598             if cWindSpeed * 1600 + dX < _0 then i:= -1
   600                 if cWindSpeed * 1600 + dX < _0 then i:= -1
   599             else i:= 1;
   601                 else i:= 1;
   600             if (yy > 0) and ((Land[yy-1, xx] and $FF00) = 0) then dec(yy)
   602                 if (yy > 0) and ((Land[yy-1, xx] and $FF00) = 0) then dec(yy)
   601             else dec(xx, i);
   603                 else dec(xx, i);
   602             dec(yy,2);
   604                 dec(yy,2);
   603             dec(xx,i);
   605                 dec(xx,i);
   604             s:= SpritesData[sprSnow].Surface;
   606                 s:= SpritesData[sprSnow].Surface;
   605             p:= s^.pixels;
   607                 p:= s^.pixels;
   606             allpx:= true;
   608                 allpx:= true;
   607             for py:= 0 to Pred(s^.h) do
   609                 for py:= 0 to Pred(s^.h) do
   608                 begin
   610                     begin
   609                 for px:= 0 to Pred(s^.w) do
   611                     for px:= 0 to Pred(s^.w) do
   610                     if ((yy + py and LAND_HEIGHT_MASK) = 0) and ((xx + px and LAND_WIDTH_MASK) = 0) and 
   612                         if (((yy + py) and LAND_HEIGHT_MASK) = 0) and (((xx + px) and LAND_WIDTH_MASK) = 0) and 
   611                        ((Land[yy + py, xx + px] and $FF00) = 0) then
   613                            ((Land[yy + py, xx + px] and $FF00) = 0) then
   612                         begin
   614                             begin
   613                         if (cReducedQuality and rqBlurryLand) = 0 then
   615                             if (cReducedQuality and rqBlurryLand) = 0 then
   614                             LandPixels[yy + py, xx + px]:= p^[px]
   616                                 LandPixels[yy + py, xx + px]:= p^[px]
   615                         else
   617                             else
   616                             LandPixels[(yy + py) div 2, (xx + px) div 2]:= p^[px]
   618                                 LandPixels[(yy + py) div 2, (xx + px) div 2]:= p^[px]
   617                         end
   619                             end
   618                     else allpx:= false;
   620                         else allpx:= false;
   619                 p:= @(p^[s^.pitch shr 2])
   621                     p:= @(p^[s^.pitch shr 2])
   620                 end;
   622                     end;
   621             if allpx then UpdateLandTexture(xx, 4, yy, 4)
   623                 if allpx then UpdateLandTexture(xx, 4, yy, 4)
   622             else UpdateLandTexture(xx, 1, yy, 1);
   624                 else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) then UpdateLandTexture(xx, 1, yy, 1);
   623             inc(yy,2);
   625                 inc(yy,2);
   624             inc(xx,i);
   626                 inc(xx,i);
   625             if ((xx and LAND_WIDTH_MASK) = 0) and ((yy and LAND_HEIGHT_MASK) = 0) then Land[yy, xx]:= Land[yy, xx] or lfObject;
   627                 if ((xx and LAND_WIDTH_MASK) = 0) and ((yy and LAND_HEIGHT_MASK) = 0) then Land[yy, xx]:= Land[yy, xx] or lfObject;
   626             if yy > 0 then
   628                 if yy > 0 then
   627                 begin 
   629                     begin 
   628                 Land[yy-1, xx]:= Land[yy-1, xx] or lfObject;
   630                     Land[yy-1, xx]:= Land[yy-1, xx] or lfObject;
   629                 if ((xx-i and LAND_WIDTH_MASK) = 0) then Land[yy-1, xx-i]:= Land[yy-1, xx-i] or lfObject;
   631                     if ((xx-i and LAND_WIDTH_MASK) = 0) then Land[yy-1, xx-i]:= Land[yy-1, xx-i] or lfObject;
   630                 end;
   632                     end;
   631             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 lfObject
   633                 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 lfObject
   632 ////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
   634 ////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
       
   635                 end
   633             end;
   636             end;
   634         if move then
   637         if move then
   635             begin
   638             begin
   636             X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512);
   639             X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)-512);
   637             Y:= int2hwFloat(750+(GetRandom(50)-25))
   640             Y:= int2hwFloat(750+(GetRandom(50)-25))