73 fpsTexture: PTexture; |
73 fpsTexture: PTexture; |
74 timeTexture: PTexture; |
74 timeTexture: PTexture; |
75 FPS: Longword; |
75 FPS: Longword; |
76 CountTicks: Longword; |
76 CountTicks: Longword; |
77 SoundTimerTicks: Longword; |
77 SoundTimerTicks: Longword; |
78 prevPoint: TPoint; |
78 prevPoint, prevTargetPoint: TPoint; |
79 amSel: TAmmoType = amNothing; |
79 amSel: TAmmoType = amNothing; |
80 missionTex: PTexture; |
80 missionTex: PTexture; |
81 missionTimer: LongInt; |
81 missionTimer: LongInt; |
82 stereoDepth: GLfloat; |
82 stereoDepth: GLfloat; |
83 isFirstFrame: boolean; |
83 isFirstFrame: boolean; |
221 |
221 |
222 InitCameraBorders(); |
222 InitCameraBorders(); |
223 uCursor.init(); |
223 uCursor.init(); |
224 prevPoint.X:= 0; |
224 prevPoint.X:= 0; |
225 prevPoint.Y:= cScreenHeight div 2; |
225 prevPoint.Y:= cScreenHeight div 2; |
|
226 prevTargetPoint.X:= 0; |
|
227 prevTargetPoint.Y:= 0; |
226 WorldDx:= -(LAND_WIDTH div 2) + cScreenWidth div 2; |
228 WorldDx:= -(LAND_WIDTH div 2) + cScreenWidth div 2; |
227 WorldDy:= -(LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2); |
229 WorldDy:= -(LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2); |
228 |
230 |
229 //aligns it to the bottom of the screen, minus the border |
231 //aligns it to the bottom of the screen, minus the border |
230 SkyOffset:= 0; |
232 SkyOffset:= 0; |
640 else |
642 else |
641 begin |
643 begin |
642 AMShiftX:= AMShiftTargetX; |
644 AMShiftX:= AMShiftTargetX; |
643 AMShiftY:= AMShiftTargetY; |
645 AMShiftY:= AMShiftTargetY; |
644 prevPoint:= CursorPoint; |
646 prevPoint:= CursorPoint; |
|
647 prevTargetPoint:= TargetCursorPoint; |
645 AMState:= AMHidden; |
648 AMState:= AMHidden; |
646 end; |
649 end; |
647 end; |
650 end; |
648 |
651 |
649 DrawTexture(AmmoRect.x + AMShiftX, AmmoRect.y + AMShiftY, AmmoMenuTex); |
652 DrawTexture(AmmoRect.x + AMShiftX, AmmoRect.y + AMShiftY, AmmoMenuTex); |
1628 // Cursor |
1631 // Cursor |
1629 if isCursorVisible then |
1632 if isCursorVisible then |
1630 begin |
1633 begin |
1631 if not bShowAmmoMenu then |
1634 if not bShowAmmoMenu then |
1632 begin |
1635 begin |
|
1636 if not CurrentTeam^.ExtDriven then TargetCursorPoint:= CursorPoint; |
1633 with CurrentHedgehog^ do |
1637 with CurrentHedgehog^ do |
1634 if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then |
1638 if (Gear <> nil) and ((Gear^.State and gstHHChooseTarget) <> 0) then |
1635 begin |
1639 begin |
1636 if (CurAmmoType = amNapalm) or (CurAmmoType = amMineStrike) then |
1640 if (CurAmmoType = amNapalm) or (CurAmmoType = amMineStrike) then |
1637 DrawLine(-3000, topY-300, 7000, topY-300, 3.0, (Team^.Clan^.Color shr 16), (Team^.Clan^.Color shr 8) and $FF, Team^.Clan^.Color and $FF, $FF); |
1641 DrawLine(-3000, topY-300, 7000, topY-300, 3.0, (Team^.Clan^.Color shr 16), (Team^.Clan^.Color shr 8) and $FF, Team^.Clan^.Color and $FF, $FF); |
1638 i:= GetCurAmmoEntry(CurrentHedgehog^)^.Pos; |
1642 i:= GetCurAmmoEntry(CurrentHedgehog^)^.Pos; |
1639 with Ammoz[CurAmmoType] do |
1643 with Ammoz[CurAmmoType] do |
1640 if PosCount > 1 then |
1644 if PosCount > 1 then |
1641 DrawSprite(PosSprite, CursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - CursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1645 DrawSprite(PosSprite, TargetCursorPoint.X - (SpritesData[PosSprite].Width shr 1), cScreenHeight - TargetCursorPoint.Y - (SpritesData[PosSprite].Height shr 1),i); |
1642 end; |
1646 end; |
1643 DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8) |
1647 DrawSprite(sprArrow, TargetCursorPoint.X, cScreenHeight - TargetCursorPoint.Y, (RealTicks shr 6) mod 8) |
1644 end |
1648 end |
1645 end; |
1649 end; |
1646 isFirstFrame:= false |
1650 isFirstFrame:= false |
1647 end; |
1651 end; |
1648 |
1652 |
1650 |
1654 |
1651 procedure MoveCamera; |
1655 procedure MoveCamera; |
1652 var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY: LongInt; |
1656 var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY: LongInt; |
1653 begin |
1657 begin |
1654 {$IFNDEF MOBILE} |
1658 {$IFNDEF MOBILE} |
1655 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu))) and cHasFocus and (GameState <> gsConfirm) then |
1659 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu) and autoCameraOn)) and cHasFocus and (GameState <> gsConfirm) then |
1656 uCursor.updatePosition(); |
1660 uCursor.updatePosition(); |
1657 {$ENDIF} |
1661 {$ENDIF} |
1658 z:= round(200/zoom); |
1662 z:= round(200/zoom); |
1659 if not PlacingHogs and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and autoCameraOn then |
1663 if not PlacingHogs and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) and autoCameraOn then |
1660 if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then |
1664 if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then |
1721 end |
1725 end |
1722 else |
1726 else |
1723 EdgesDist:= cGearScrEdgesDist; |
1727 EdgesDist:= cGearScrEdgesDist; |
1724 |
1728 |
1725 // this generates the border around the screen that moves the camera when cursor is near it |
1729 // this generates the border around the screen that moves the camera when cursor is near it |
1726 if isCursorVisible or ((FollowGear <> nil) and autoCameraOn) then |
1730 if (CurrentTeam^.ExtDriven and isCursorVisible and autoCameraOn) or |
|
1731 (not CurrentTeam^.ExtDriven and isCursorVisible) or ((FollowGear <> nil) and autoCameraOn) then |
1727 begin |
1732 begin |
1728 if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then |
1733 if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then |
1729 begin |
1734 begin |
1730 WorldDx:= WorldDx - CursorPoint.X - cScreenWidth div 2 + EdgesDist; |
1735 WorldDx:= WorldDx - CursorPoint.X - cScreenWidth div 2 + EdgesDist; |
1731 CursorPoint.X:= - cScreenWidth div 2 + EdgesDist |
1736 CursorPoint.X:= - cScreenWidth div 2 + EdgesDist |