hedgewars/uWorld.pas
branchhedgeroid
changeset 6224 42b256eca362
parent 6023 a28be05b20bc
parent 6135 2172330ad52a
child 6328 d14adf1c7721
equal deleted inserted replaced
6055:88cfcd9161d3 6224:42b256eca362
   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);
  1199         exit
  1209         exit
  1200     end
  1210     end
  1201     else
  1211     else
  1202     begin
  1212     begin
  1203         CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8;
  1213         CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8;
  1204         if isPhone() then
  1214         if isPhone() or (cScreenHeight < 600) or ((hwSign(FollowGear^.dY) * z) < 10)  then
  1205             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8
  1215             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8
  1206         else
  1216         else
  1207             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
  1217             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
  1208     end;
  1218     end;
  1209 
  1219