1182 end; |
1182 end; |
1183 isFirstFrame:= false |
1183 isFirstFrame:= false |
1184 end; |
1184 end; |
1185 |
1185 |
1186 procedure MoveCamera; |
1186 procedure MoveCamera; |
1187 var EdgesDist, wdy, shs: LongInt; |
1187 var EdgesDist, wdy, shs,z: LongInt; |
1188 PrevSentPointTime: LongWord = 0; |
1188 PrevSentPointTime: LongWord = 0; |
1189 begin |
1189 begin |
1190 {$IFNDEF MOBILE} |
1190 {$IFNDEF MOBILE} |
1191 if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus and (GameState <> gsConfirm) then |
1191 if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus and (GameState <> gsConfirm) then |
1192 uCursor.updatePosition(); |
1192 uCursor.updatePosition(); |
1193 {$ENDIF} |
1193 {$ENDIF} |
1194 |
1194 z:= round(200/zoom); |
1195 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then |
1195 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then |
1196 if (not autoCameraOn) or (abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y) > 4) then |
1196 if (not autoCameraOn) or ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then |
1197 begin |
1197 begin |
1198 FollowGear:= nil; |
1198 FollowGear:= nil; |
1199 prevPoint:= CursorPoint; |
1199 prevPoint:= CursorPoint; |
1200 exit |
1200 exit |
1201 end |
1201 end |
1202 else |
1202 else |
1203 begin |
1203 begin |
1204 CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * 100 + WorldDx) div 8; |
1204 CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8; |
1205 CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8; |
1205 CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y)+ hwSign(FollowGear^.dY) * z + WorldDy)) div 8; |
1206 end; |
1206 end; |
1207 |
1207 |
1208 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1208 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater; |
1209 if WorldDy < wdy then WorldDy:= wdy; |
1209 if WorldDy < wdy then WorldDy:= wdy; |
1210 |
1210 |
1319 end; |
1319 end; |
1320 |
1320 |
1321 procedure ShakeCamera(amount: LongWord); |
1321 procedure ShakeCamera(amount: LongWord); |
1322 begin |
1322 begin |
1323 if isCursorVisible then exit; |
1323 if isCursorVisible then exit; |
1324 amount:= Max(1, amount); |
1324 amount:= Max(1, round(amount*zoom/2)); |
1325 //WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2)); |
1325 WorldDx:= WorldDx - amount + LongInt(random(1 + amount * 2)); |
1326 //WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2)); |
1326 WorldDy:= WorldDy - amount + LongInt(random(1 + amount * 2)); |
1327 CursorPoint.X:= CursorPoint.X - amount + LongInt(getRandom(1 + amount * 2)); |
1327 //CursorPoint.X:= CursorPoint.X - amount + LongInt(random(1 + amount * 2)); |
1328 CursorPoint.Y:= CursorPoint.Y - amount + LongInt(getRandom(1 + amount * 2)) |
1328 //CursorPoint.Y:= CursorPoint.Y - amount + LongInt(random(1 + amount * 2)) |
1329 end; |
1329 end; |
1330 |
1330 |
1331 |
1331 |
1332 procedure onFocusStateChanged; |
1332 procedure onFocusStateChanged; |
1333 begin |
1333 begin |