hedgewars/uWorld.pas
branchwebgl
changeset 8099 a7f02b902b6f
parent 8026 4a4f21070479
child 8330 aaefa587e277
equal deleted inserted replaced
8096:453917e94e55 8099:a7f02b902b6f
   719                 bSelected:= false;
   719                 bSelected:= false;
   720                 FreeWeaponTooltip;
   720                 FreeWeaponTooltip;
   721 {$IFDEF USE_TOUCH_INTERFACE}//show the aiming buttons + animation
   721 {$IFDEF USE_TOUCH_INTERFACE}//show the aiming buttons + animation
   722                 if (Ammo^[Slot, Pos].Propz and ammoprop_NeedUpDown) <> 0 then
   722                 if (Ammo^[Slot, Pos].Propz and ammoprop_NeedUpDown) <> 0 then
   723                     begin
   723                     begin
   724                     if not(arrowUp.show) then
   724                     if (not arrowUp.show) then
   725                         begin
   725                         begin
   726                         animateWidget(@arrowUp, true, true);
   726                         animateWidget(@arrowUp, true, true);
   727                         animateWidget(@arrowDown, true, true);
   727                         animateWidget(@arrowDown, true, true);
   728                         end;
   728                         end;
   729                     end
   729                     end
   742     else
   742     else
   743         FreeWeaponTooltip;
   743         FreeWeaponTooltip;
   744 
   744 
   745     if (WeaponTooltipTex <> nil) and (AMShiftX = 0) and (AMShiftY = 0) then
   745     if (WeaponTooltipTex <> nil) and (AMShiftX = 0) and (AMShiftY = 0) then
   746 {$IFDEF USE_LANDSCAPE_AMMOMENU}
   746 {$IFDEF USE_LANDSCAPE_AMMOMENU}
   747         if not isPhone() then
   747         if (not isPhone()) then
   748             ShowWeaponTooltip(-WeaponTooltipTex^.w div 2, AmmoRect.y - WeaponTooltipTex^.h - AMSlotSize);
   748             ShowWeaponTooltip(-WeaponTooltipTex^.w div 2, AmmoRect.y - WeaponTooltipTex^.h - AMSlotSize);
   749 {$ELSE}
   749 {$ELSE}
   750         ShowWeaponTooltip(AmmoRect.x - WeaponTooltipTex^.w - 3, Min(AmmoRect.y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   750         ShowWeaponTooltip(AmmoRect.x - WeaponTooltipTex^.w - 3, Min(AmmoRect.y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   751 {$ENDIF}
   751 {$ENDIF}
   752 
   752 
   992         DrawWorldStereo(Lag, rmDefault)
   992         DrawWorldStereo(Lag, rmDefault)
   993         end
   993         end
   994 {$IFNDEF S3D_DISABLED}
   994 {$IFNDEF S3D_DISABLED}
   995     else if (cStereoMode = smAFR) then
   995     else if (cStereoMode = smAFR) then
   996         begin
   996         begin
   997         AFRToggle:= not AFRToggle;
   997         AFRToggle:= (not AFRToggle);
   998         glClear(GL_COLOR_BUFFER_BIT);
   998         glClear(GL_COLOR_BUFFER_BIT);
   999         if AFRToggle then
   999         if AFRToggle then
  1000             DrawWorldStereo(Lag, rmLeftEye)
  1000             DrawWorldStereo(Lag, rmLeftEye)
  1001         else
  1001         else
  1002             DrawWorldStereo(Lag, rmRightEye)
  1002             DrawWorldStereo(Lag, rmRightEye)
  1368         // draw health bars right border
  1368         // draw health bars right border
  1369         inc(r.x, cTeamHealthWidth + 2);
  1369         inc(r.x, cTeamHealthWidth + 2);
  1370         r.w:= 3;
  1370         r.w:= 3;
  1371         DrawTextureFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
  1371         DrawTextureFromRect(TeamHealthBarWidth + 16, cScreenHeight + DrawHealthY + smallScreenOffset, @r, HealthTex);
  1372 
  1372 
  1373         if not highlight and (not hasGone) then
  1373         if (not highlight) and (not hasGone) then
  1374             for i:= 0 to cMaxHHIndex do
  1374             for i:= 0 to cMaxHHIndex do
  1375                 if Hedgehogs[i].Gear <> nil then
  1375                 if Hedgehogs[i].Gear <> nil then
  1376                     begin
  1376                     begin
  1377                     inc(h,Hedgehogs[i].Gear^.Health);
  1377                     inc(h,Hedgehogs[i].Gear^.Health);
  1378                     if h < TeamHealth then DrawTexture(15 + h*TeamHealthBarWidth div TeamHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture);
  1378                     if h < TeamHealth then DrawTexture(15 + h*TeamHealthBarWidth div TeamHealth, cScreenHeight + DrawHealthY + smallScreenOffset + 1, SpritesData[sprSlider].Texture);
  1404             DrawTextureFromRect(-12, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, FlagTex);
  1404             DrawTextureFromRect(-12, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, FlagTex);
  1405             // draw health bar
  1405             // draw health bar
  1406             r.w:= TeamHealthBarWidth + 1;
  1406             r.w:= TeamHealthBarWidth + 1;
  1407             r.h:= HealthTex^.h - 4;
  1407             r.h:= HealthTex^.h - 4;
  1408             DrawTextureFromRect(16, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, HealthTex);
  1408             DrawTextureFromRect(16, cScreenHeight + DrawHealthY + smallScreenOffset + 2, @r, HealthTex);
  1409             if not hasGone and (TeamHealth > 1) then
  1409             if (not hasGone) and (TeamHealth > 1) then
  1410                 begin
  1410                 begin
  1411                 Tint(Clan^.Color shl 8 or $FF);
  1411                 Tint(Clan^.Color shl 8 or $FF);
  1412                 for i:= 0 to cMaxHHIndex do
  1412                 for i:= 0 to cMaxHHIndex do
  1413                     if Hedgehogs[i].Gear <> nil then
  1413                     if Hedgehogs[i].Gear <> nil then
  1414                         begin
  1414                         begin
  1470         AMAnimStartTime:= RealTicks
  1470         AMAnimStartTime:= RealTicks
  1471     else
  1471     else
  1472         AMAnimStartTime:= RealTicks - (AMAnimDuration - (RealTicks - AMAnimStartTime));
  1472         AMAnimStartTime:= RealTicks - (AMAnimDuration - (RealTicks - AMAnimStartTime));
  1473     AMState:= AMShowingUp;
  1473     AMState:= AMShowingUp;
  1474     end;
  1474     end;
  1475 if not(bShowAmmoMenu) and ((AMstate = AMShowing) or (AMState = AMShowingUp)) then
  1475 if (not bShowAmmoMenu) and ((AMstate = AMShowing) or (AMState = AMShowingUp)) then
  1476     begin
  1476     begin
  1477     if (AMState = AMShowing) then
  1477     if (AMState = AMShowing) then
  1478         AMAnimStartTime:= RealTicks
  1478         AMAnimStartTime:= RealTicks
  1479     else
  1479     else
  1480         AMAnimStartTime:= RealTicks - (AMAnimDuration - (RealTicks - AMAnimStartTime));
  1480         AMAnimStartTime:= RealTicks - (AMAnimDuration - (RealTicks - AMAnimStartTime));
  1582 if GameState = gsConfirm then
  1582 if GameState = gsConfirm then
  1583     DrawTextureCentered(0, (cScreenHeight shr 1), ConfirmTexture);
  1583     DrawTextureCentered(0, (cScreenHeight shr 1), ConfirmTexture);
  1584 
  1584 
  1585 if ScreenFade <> sfNone then
  1585 if ScreenFade <> sfNone then
  1586     begin
  1586     begin
  1587     if not isFirstFrame then
  1587     if (not isFirstFrame) then
  1588         case ScreenFade of
  1588         case ScreenFade of
  1589             sfToBlack, sfToWhite:     if ScreenFadeValue + Lag * ScreenFadeSpeed < sfMax then
  1589             sfToBlack, sfToWhite:     if ScreenFadeValue + Lag * ScreenFadeSpeed < sfMax then
  1590                                           inc(ScreenFadeValue, Lag * ScreenFadeSpeed)
  1590                                           inc(ScreenFadeValue, Lag * ScreenFadeSpeed)
  1591                                       else
  1591                                       else
  1592                                           ScreenFadeValue:= sfMax;
  1592                                           ScreenFadeValue:= sfMax;
  1676 
  1676 
  1677 
  1677 
  1678 // Cursor
  1678 // Cursor
  1679 if isCursorVisible then
  1679 if isCursorVisible then
  1680     begin
  1680     begin
  1681     if not bShowAmmoMenu then
  1681     if (not bShowAmmoMenu) then
  1682         begin
  1682         begin
  1683         with CurrentHedgehog^ do
  1683         with CurrentHedgehog^ do
  1684             if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then
  1684             if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then
  1685                 begin
  1685                 begin
  1686             if (CurAmmoType = amNapalm) or (CurAmmoType = amMineStrike) then
  1686             if (CurAmmoType = amNapalm) or (CurAmmoType = amMineStrike) then
  1705 {$IFNDEF MOBILE}
  1705 {$IFNDEF MOBILE}
  1706 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu))) and cHasFocus and (GameState <> gsConfirm) then
  1706 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu))) and cHasFocus and (GameState <> gsConfirm) then
  1707     uCursor.updatePosition();
  1707     uCursor.updatePosition();
  1708 {$ENDIF}
  1708 {$ENDIF}
  1709 z:= round(200/zoom);
  1709 z:= round(200/zoom);
  1710 if not PlacingHogs and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and autoCameraOn then
  1710 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and autoCameraOn then
  1711     if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then
  1711     if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then
  1712         begin
  1712         begin
  1713         FollowGear:= nil;
  1713         FollowGear:= nil;
  1714         prevPoint:= CursorPoint;
  1714         prevPoint:= CursorPoint;
  1715         exit
  1715         exit
  1874 exit;
  1874 exit;
  1875 {$ENDIF}
  1875 {$ENDIF}
  1876 
  1876 
  1877 {$IFDEF USE_VIDEO_RECORDING}
  1877 {$IFDEF USE_VIDEO_RECORDING}
  1878 // do not change volume during prerecording as it will affect sound in video file
  1878 // do not change volume during prerecording as it will affect sound in video file
  1879 if not flagPrerecording then
  1879 if (not flagPrerecording) then
  1880 {$ENDIF}
  1880 {$ENDIF}
  1881     begin
  1881     begin
  1882     if not cHasFocus then DampenAudio()
  1882     if (not cHasFocus) then DampenAudio()
  1883     else UndampenAudio();
  1883     else UndampenAudio();
  1884     end;
  1884     end;
  1885 end;
  1885 end;
  1886 
  1886 
  1887 procedure SetUtilityWidgetState(ammoType: TAmmoType);
  1887 procedure SetUtilityWidgetState(ammoType: TAmmoType);