NEEDS TESTING. Try reenabling camera shake based on unc0rr's comment.
authornemo
Wed, 07 Sep 2011 20:12:20 -0400
changeset 5800 3a04c30e5ac7
parent 5799 55c08df2bdfd
child 5802 f0f0943e1f8e
NEEDS TESTING. Try reenabling camera shake based on unc0rr's comment.
hedgewars/VGSHandlers.inc
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
--- a/hedgewars/VGSHandlers.inc	Wed Sep 07 15:06:42 2011 -0400
+++ b/hedgewars/VGSHandlers.inc	Wed Sep 07 20:12:20 2011 -0400
@@ -587,7 +587,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepBigExplosionWork(Gear: PVisualGear; Steps: Longword);
-//var maxMovement: LongInt;
+var maxMovement: LongInt;
 begin
 
 inc(Gear^.Timer, Steps);
@@ -596,13 +596,13 @@
 One possible solution is, instead of using WorldDx, to use straight gl/SDL calls to jitter the screen a bit.
 
 // a comment by unC0Rr: instead of changing WorldDx shake cursor coordinates, that should be safe
+*)
 
 if (Gear^.Timer and 5) = 0 then
     begin
     maxMovement := max(1, 13 - ((Gear^.Timer * 15) div 250));
     ShakeCamera(maxMovement);
     end;
-*)
 if Gear^.Timer > 250 then DeleteVisualGear(Gear);
 end;
 
--- a/hedgewars/uVisualGears.pas	Wed Sep 07 15:06:42 2011 -0400
+++ b/hedgewars/uVisualGears.pas	Wed Sep 07 20:12:20 2011 -0400
@@ -29,7 +29,7 @@
  * E.g.: background flakes, visual effects: explosion, smoke trails, etc.
  *)
 interface
-uses uConsts, uFloat, GLunit, uTypes;
+uses uConsts, uFloat, GLunit, uTypes, uWorld;
 
 procedure initModule;
 procedure freeModule;
--- a/hedgewars/uWorld.pas	Wed Sep 07 15:06:42 2011 -0400
+++ b/hedgewars/uWorld.pas	Wed Sep 07 20:12:20 2011 -0400
@@ -1314,9 +1314,12 @@
 
 procedure ShakeCamera(amount: LongWord);
 begin
+    if isCursorVisible then exit;
     amount:= Max(1, amount);
-    WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2));
-    WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2));
+    //WorldDx:= WorldDx - amount + LongInt(getRandom(1 + amount * 2));
+    //WorldDy:= WorldDy - amount + LongInt(getRandom(1 + amount * 2));
+    CursorPoint.X:= CursorPoint.X - amount + LongInt(getRandom(1 + amount * 2));
+    CursorPoint.Y:= CursorPoint.Y - amount + LongInt(getRandom(1 + amount * 2))
 end;