hedgewars/uWorld.pas
changeset 3537 8f5b3108f29c
parent 3523 6592fbb969da
child 3551 d4de36b3801a
equal deleted inserted replaced
3536:7d99655130ff 3537:8f5b3108f29c
   484         cWaterLine + WorldDy + dY,
   484         cWaterLine + WorldDy + dY,
   485         0)}
   485         0)}
   486 end;
   486 end;
   487 
   487 
   488 procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt);
   488 procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt);
   489 var i, w, sw: LongInt;
   489 var i, w, h, lw, lh, rw, rh, sw: LongInt;
   490 begin
   490 begin
   491     sw:= round(cScreenWidth / cScaleFactor);
   491     sw:= round(cScreenWidth / cScaleFactor);
   492     if (SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil) then
   492     if (SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil) then
   493     begin
   493     begin
   494         w:= SpritesData[spr].Width;
   494         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
       
   495         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
   495         i:= Shift mod w;
   496         i:= Shift mod w;
   496         if i > 0 then dec(i, w);
   497         if i > 0 then dec(i, w);
   497         dec(i, w * (sw div w + 1));
   498         dec(i, w * (sw div w + 1));
   498         repeat
   499         repeat
   499             DrawSprite(spr, i, WorldDy + LAND_HEIGHT + OffsetY - SpritesData[spr].Height, 0);
   500             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
   500             inc(i, w)
   501             inc(i, w)
   501         until i > sw
   502         until i > sw
   502     end
   503     end
   503     else
   504     else
   504     begin
   505     begin
   505         w:= SpritesData[spr].Width;
   506         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
       
   507         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
       
   508         lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale;
       
   509         lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale;
       
   510         rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale;
       
   511         rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale;
   506         dec(Shift, w div 2);
   512         dec(Shift, w div 2);
   507         DrawSprite(spr, Shift, WorldDy + LAND_HEIGHT + OffsetY - SpritesData[spr].Height, 0);
   513         DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
   508     
   514     
   509         i:= Shift - SpritesData[sprL].Width;
   515         i:= Shift - lw;
   510         while i >= -sw - SpritesData[sprL].Width do
   516         while i >= -sw - lw do
   511         begin
   517         begin
   512             DrawSprite(sprL, i, WorldDy + LAND_HEIGHT + OffsetY - SpritesData[sprL].Height, 0);
   518             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale);
   513             dec(i, SpritesData[sprL].Width);
   519             dec(i, lw);
   514         end;
   520         end;
   515         
   521         
   516         i:= Shift + w;
   522         i:= Shift + w;
   517         while i <= sw do
   523         while i <= sw do
   518         begin
   524         begin
   519             DrawSprite(sprR, i, WorldDy + LAND_HEIGHT + OffsetY - SpritesData[sprR].Height, 0);
   525             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale);
   520             inc(i, SpritesData[sprR].Width)
   526             inc(i, rw)
   521         end
   527         end
   522     end
   528     end
   523 end;
   529 end;
   524 
   530 
   525 
   531