Fix cursor teleporting to center after leaving game with video recording 0.9.24
authorWuzzy <Wuzzy2@mail.ru>
Tue, 17 Jul 2018 12:55:07 +0200
branch0.9.24
changeset 13591 9f05872969dc
parent 13590 62a5eea4ae7a
child 13592 1c45ce3ff296
Fix cursor teleporting to center after leaving game with video recording
ChangeLog.txt
hedgewars/uCursor.pas
--- a/ChangeLog.txt	Tue Jul 17 12:50:55 2018 +0200
+++ b/ChangeLog.txt	Tue Jul 17 12:55:07 2018 +0200
@@ -4,6 +4,7 @@
  * Restore joystick/controller functionality
  * Fix crash when starting game with 2 controllers or more
  * Fix video recorder not recording if sound was disabled
+ * Fix cursor teleporting to center after leaving game with a video recording
  * Fix insane amount of droplets appearing when shooting minigun into ocean world edge
  * Limit number of droplets to 50 (temporary bugfix)
  * Prevent creation of schemes with same name as an existing scheme
--- a/hedgewars/uCursor.pas	Tue Jul 17 12:50:55 2018 +0200
+++ b/hedgewars/uCursor.pas	Tue Jul 17 12:55:07 2018 +0200
@@ -9,7 +9,7 @@
 
 implementation
 
-uses SDLh, uVariables;
+uses SDLh, uVariables, uTypes;
 
 procedure init;
 begin
@@ -18,6 +18,8 @@
 
 procedure resetPosition;
 begin
+    if GameType = gmtRecord then
+        exit;
     // Move curser by 1px in case it's already centered.
     // The game camera in the Alpha for 0.9.23 screwed up if
     // the game started with the mouse already being centered.
@@ -31,13 +33,14 @@
 procedure updatePosition;
 var x, y: LongInt;
 begin
-    SDL_GetMouseState(@x, @y);
+    if GameType <> gmtRecord then
+        SDL_GetMouseState(@x, @y);
 
     if(x <> cScreenWidth div 2) or (y <> cScreenHeight div 2) then
     begin
         handlePositionUpdate(x - cScreenWidth div 2, y - cScreenHeight div 2);
 
-        if cHasFocus then
+        if cHasFocus and (GameType <> gmtRecord) then
             SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
     end
 end;