hedgewars/uWorld.pas
branchhedgeroid
changeset 5329 abfc41832374
parent 5326 e73f1c043c85
child 5341 479b4108789a
equal deleted inserted replaced
5326:e73f1c043c85 5329:abfc41832374
   526 
   526 
   527 procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt);
   527 procedure DrawRepeated(spr, sprL, sprR: TSprite; Shift, OffsetY: LongInt);
   528 var i, w, h, lw, lh, rw, rh, sw: LongInt;
   528 var i, w, h, lw, lh, rw, rh, sw: LongInt;
   529 begin
   529 begin
   530     sw:= round(cScreenWidth / cScaleFactor);
   530     sw:= round(cScreenWidth / cScaleFactor);
   531     if (SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil) then
   531     if ((SpritesData[sprL].Texture = nil) or (SpritesData[sprR].Texture = nil)) and (SpritesData[spr].Texture <> nil) then
   532     begin
   532         begin
   533         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
   533         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
   534         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
   534         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
   535         i:= Shift mod w;
   535         i:= Shift mod w;
   536         if i > 0 then dec(i, w);
   536         if i > 0 then dec(i, w);
   537         dec(i, w * (sw div w + 1));
   537         dec(i, w * (sw div w + 1));
   538         repeat
   538         repeat
   539             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
   539             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
   540             inc(i, w)
   540             inc(i, w)
   541         until i > sw
   541         until i > sw
   542     end
   542         end
   543     else
   543     else if SpritesData[spr].Texture <> nil then
   544     begin
   544         begin
   545         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
   545         w:= SpritesData[spr].Width * SpritesData[spr].Texture^.Scale;
   546         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
   546         h:= SpritesData[spr].Height * SpritesData[spr].Texture^.Scale;
   547         lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale;
   547         lw:= SpritesData[sprL].Width * SpritesData[spr].Texture^.Scale;
   548         lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale;
   548         lh:= SpritesData[sprL].Height * SpritesData[spr].Texture^.Scale;
   549         rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale;
   549         rw:= SpritesData[sprR].Width * SpritesData[spr].Texture^.Scale;
   551         dec(Shift, w div 2);
   551         dec(Shift, w div 2);
   552         DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
   552         DrawTexture(Shift, WorldDy + LAND_HEIGHT + OffsetY - h, SpritesData[spr].Texture, SpritesData[spr].Texture^.Scale);
   553 
   553 
   554         i:= Shift - lw;
   554         i:= Shift - lw;
   555         while i >= -sw - lw do
   555         while i >= -sw - lw do
   556         begin
   556             begin
   557             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale);
   557             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - lh, SpritesData[sprL].Texture, SpritesData[sprL].Texture^.Scale);
   558             dec(i, lw);
   558             dec(i, lw);
   559         end;
   559             end;
   560 
   560 
   561         i:= Shift + w;
   561         i:= Shift + w;
   562         while i <= sw do
   562         while i <= sw do
   563         begin
   563             begin
   564             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale);
   564             DrawTexture(i, WorldDy + LAND_HEIGHT + OffsetY - rh, SpritesData[sprR].Texture, SpritesData[sprR].Texture^.Scale);
   565             inc(i, rw)
   565             inc(i, rw)
       
   566             end
   566         end
   567         end
   567     end
       
   568 end;
   568 end;
   569 
   569 
   570 
   570 
   571 procedure DrawWorld(Lag: LongInt);
   571 procedure DrawWorld(Lag: LongInt);
   572 begin
   572 begin
  1157 
  1157 
  1158 procedure MoveCamera;
  1158 procedure MoveCamera;
  1159 var EdgesDist, wdy, shs: LongInt;
  1159 var EdgesDist, wdy, shs: LongInt;
  1160     PrevSentPointTime: LongWord = 0;
  1160     PrevSentPointTime: LongWord = 0;
  1161 begin
  1161 begin
  1162 {$IFNDEF IPHONE}
  1162 {$IFNDEF IPHONEOS}
  1163 if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus then
  1163 if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus then
  1164     uCursor.updatePosition();
  1164     uCursor.updatePosition();
  1165 {$ENDIF}
  1165 {$ENDIF}
  1166 
  1166 
  1167 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then
  1167 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then
  1182 
  1182 
  1183 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit;
  1183 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit;
  1184 
  1184 
  1185 if AMxShift < AMWidth then
  1185 if AMxShift < AMWidth then
  1186 begin
  1186 begin
  1187 {$IFDEF IPHONE}
  1187 {$IFDEF IPHONEOS}
  1188     if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth;
  1188     if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth;
  1189     if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset;
  1189     if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset;
  1190     if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize;
  1190     if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize;
  1191     if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset;
  1191     if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset;
  1192 {$ELSE}
  1192 {$ELSE}