hedgewars/uWorld.pas
changeset 6648 025473a2c420
parent 6647 26e523c8fe88
child 6650 56a0b7bf6c15
equal deleted inserted replaced
6647:26e523c8fe88 6648:025473a2c420
    63 var cWaveWidth, cWaveHeight: LongInt;
    63 var cWaveWidth, cWaveHeight: LongInt;
    64     AMShiftTargetX, AMShiftTargetY, AMShiftX, AMShiftY, SlotsNum: LongInt;
    64     AMShiftTargetX, AMShiftTargetY, AMShiftX, AMShiftY, SlotsNum: LongInt;
    65     tmpSurface: PSDL_Surface;
    65     tmpSurface: PSDL_Surface;
    66     fpsTexture: PTexture;
    66     fpsTexture: PTexture;
    67     timeTexture: PTexture;
    67     timeTexture: PTexture;
    68     AmmoRect: TSDL_Rect;
       
    69     MenuSpeedX, MenuSpeedY: LongInt;
    68     MenuSpeedX, MenuSpeedY: LongInt;
    70     FPS: Longword;
    69     FPS: Longword;
    71     CountTicks: Longword;
    70     CountTicks: Longword;
    72     SoundTimerTicks: Longword;
    71     SoundTimerTicks: Longword;
    73     prevPoint: TPoint;
    72     prevPoint: TPoint;
   358 procedure ShowAmmoMenu;
   357 procedure ShowAmmoMenu;
   359 const BORDERSIZE = 2;
   358 const BORDERSIZE = 2;
   360       MENUSPEED = 15;
   359       MENUSPEED = 15;
   361 var Slot, Pos: LongInt;
   360 var Slot, Pos: LongInt;
   362     Ammo: PHHAmmo;
   361     Ammo: PHHAmmo;
   363     c,i,g,t,CursorXtmp, CursorYtmp,STurns: LongInt;
   362     c,i,g,t,STurns: LongInt;
   364 begin
   363 begin
   365 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil)
   364 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil)
   366 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then
   365 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then
   367 bShowAmmoMenu:= false;
   366 bShowAmmoMenu:= false;
   368 
   367 
   421 end;
   420 end;
   422 
   421 
   423 if bShowAmmoMenu then // show ammo menu
   422 if bShowAmmoMenu then // show ammo menu
   424     begin
   423     begin
   425     FollowGear:= nil;
   424     FollowGear:= nil;
   426     if (AMShiftX = 0) and (AMShiftY = 0) then
       
   427 {$IFDEF MOBILE}
       
   428         prevPoint.Y:= 0;
       
   429 {$ELSE}
       
   430         prevPoint.X:= 0;
       
   431 {$ENDIF}
       
   432     if (cReducedQuality and rqSlowMenu) <> 0 then
   425     if (cReducedQuality and rqSlowMenu) <> 0 then
   433         begin
   426         begin
   434         AMShiftX:= 0;
   427         AMShiftX:= 0;
   435         AMShiftY:= 0;
   428         AMShiftY:= 0;
   436         end
   429         end
   439             begin
   432             begin
   440             dec(AMShiftX, MenuSpeedX);
   433             dec(AMShiftX, MenuSpeedX);
   441             if AMShiftX < 0 then AMShiftX:= 0;
   434             if AMShiftX < 0 then AMShiftX:= 0;
   442             dec(AMShiftY, MenuSpeedY);
   435             dec(AMShiftY, MenuSpeedY);
   443             if AMShiftY < 0 then AMShiftY:= 0;
   436             if AMShiftY < 0 then AMShiftY:= 0;
       
   437             if (AMShiftX = 0) and (AMShiftY = 0) then
       
   438                 begin
       
   439                 CursorPoint.X:= AmmoRect.x + AmmoRect.w;
       
   440                 CursorPoint.Y:= AmmoRect.y;
       
   441                 end;
   444             end
   442             end
   445     end
   443     end
   446 else  // hide ammo menu
   444 else  // hide ammo menu
   447     begin
   445     begin
   448     if (AMShiftX = AMShiftTargetX) and (AMShiftY = AMShiftTargetY) then
   446     if (AMShiftX = AMShiftTargetX) and (AMShiftY = AMShiftTargetY) then
   559 {$ELSE}
   557 {$ELSE}
   560         ShowWeaponTooltip(AmmoRect.x - WeaponTooltipTex^.w - 3, Min(AmmoRect.y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   558         ShowWeaponTooltip(AmmoRect.x - WeaponTooltipTex^.w - 3, Min(AmmoRect.y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   561 {$ENDIF}
   559 {$ENDIF}
   562 
   560 
   563     bSelected:= false;
   561     bSelected:= false;
   564     if (AMShiftX = 0) and (AMShiftY = 0) then
   562 {$IFNDEF MOBILE}
       
   563    if (AMShiftX = 0) and (AMShiftY = 0) then
   565         DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8);
   564         DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8);
       
   565 {$ENDIF}
   566 end;
   566 end;
   567 
   567 
   568 procedure DrawWater(Alpha: byte; OffsetY: LongInt);
   568 procedure DrawWater(Alpha: byte; OffsetY: LongInt);
   569 var VertexBuffer: array [0..3] of TVertex2f;
   569 var VertexBuffer: array [0..3] of TVertex2f;
   570     r: TSDL_Rect;
   570     r: TSDL_Rect;
   925     tdx, tdy: Double;
   925     tdx, tdy: Double;
   926     s: string[15];
   926     s: string[15];
   927     highlight: Boolean;
   927     highlight: Boolean;
   928     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
   928     smallScreenOffset, offsetX, offsetY, screenBottom: LongInt;
   929     VertexBuffer: array [0..3] of TVertex2f;
   929     VertexBuffer: array [0..3] of TVertex2f;
   930     scale: GLFloat;
       
   931 begin
   930 begin
   932 if (cReducedQuality and rqNoBackground) = 0 then
   931 if (cReducedQuality and rqNoBackground) = 0 then
   933     begin
   932     begin
   934         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
   933         // Offsets relative to camera - spare them to wimpier cpus, no bg or flakes for them anyway
   935         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);
   934         ScreenBottom:= (WorldDy - trunc(cScreenHeight/cScaleFactor) - (cScreenHeight div 2) + cWaterLine);