hedgewars/uWorld.pas
changeset 6135 2172330ad52a
parent 6131 4e8816cf9459
child 6224 42b256eca362
child 6249 cacab1db8af8
equal deleted inserted replaced
6134:bd7925eba0b8 6135:2172330ad52a
   534 
   534 
   535 procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt);
   535 procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt);
   536 var i, w, h, lw, lh, rw, rh, sw: LongInt;
   536 var i, w, h, lw, lh, rw, rh, sw: LongInt;
   537 begin
   537 begin
   538     sw:= round(cScreenWidth / cScaleFactor);
   538     sw:= round(cScreenWidth / cScaleFactor);
   539     if ((SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil)) and (SpritesData[spr].Texture <> nil) then
   539     if (SpritesData[sprL].Texture = nil) and (SpritesData[spr].Texture <> nil) then
   540         begin
   540         begin
   541         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
   541         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
   542         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
   542         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
   543         i:= Shift mod w;
   543         i:= Shift mod w;
   544         if i > 0 then dec(i, w);
   544         if i > 0 then dec(i, w);
   552         begin
   552         begin
   553         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
   553         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
   554         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
   554         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
   555         lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale;
   555         lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale;
   556         lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale;
   556         lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale;
   557         rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale;
   557         if SpritesData[sprR].Texture <> nil then
   558         rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale;
   558             begin
       
   559             rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale;
       
   560             rh:= SpritesData[sprR].Height * SpritesData[spr].Texture^.Scale
       
   561             end;
   559         dec(Shift, w div 2);
   562         dec(Shift, w div 2);
   560         DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
   563         DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
   561 
   564 
   562         i:= Shift - lw;
   565         i:= Shift - lw;
   563         while i >= -sw - lw do
   566         while i >= -sw - lw do
   565             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale);
   568             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale);
   566             dec(i, lw);
   569             dec(i, lw);
   567             end;
   570             end;
   568 
   571 
   569         i:= Shift + w;
   572         i:= Shift + w;
   570         while i <= sw do
   573         if SpritesData[sprR].Texture <> nil then
   571             begin
   574             while i <= sw do
   572             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale);
   575                 begin
   573             inc(i, rw)
   576                 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale);
   574             end
   577                 inc(i, rw)
       
   578                 end
       
   579         else
       
   580             while i <= sw do
       
   581                 begin
       
   582                 DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale);
       
   583                 inc(i, lw)
       
   584                 end
   575         end
   585         end
   576 end;
   586 end;
   577 
   587 
   578 
   588 
   579 procedure DrawWorld(Lag: LongInt);
   589 procedure DrawWorld(Lag: LongInt);