# HG changeset patch # User nemo # Date 1315750929 14400 # Node ID 74c621e12baa44fe9505303ff23062946a546405 # Parent 2f52e422ce9edc5973696ac6f87d98a5f1ad6ac5 I do believe the only thing that was *ever* wrong with camera shake was someone decided to use getRandom on something that had always been a visual effect anyway. Pretty sure WorldDx is in fact safe to modify. diff -r 2f52e422ce9e -r 74c621e12baa hedgewars/VGSHandlers.inc --- a/hedgewars/VGSHandlers.inc Sun Sep 11 16:18:49 2011 +0200 +++ b/hedgewars/VGSHandlers.inc Sun Sep 11 10:22:09 2011 -0400 @@ -587,23 +587,15 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepBigExplosionWork(Gear: PVisualGear; Steps: Longword); -//var maxMovement: LongInt; +var maxMovement: LongInt; begin inc(Gear^.Timer, Steps); -(* -FIXME - This block desyncs due to the way WorldDx is important for various things network related. -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 -// ... seems to still desync, and I tried banning when targetting too - 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; @@ -613,9 +605,9 @@ gX,gY: LongInt; vg: PVisualGear; begin -ScreenFade:= sfFromWhite; -ScreenFadeValue:= round(60 * zoom * zoom); -ScreenFadeSpeed:= 5; +//ScreenFade:= sfFromWhite; +//ScreenFadeValue:= round(60 * zoom * zoom); +//ScreenFadeSpeed:= 5; gX:= round(Gear^.X); gY:= round(Gear^.Y); AddVisualGear(gX, gY, vgtSmokeRing); diff -r 2f52e422ce9e -r 74c621e12baa hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Sun Sep 11 16:18:49 2011 +0200 +++ b/hedgewars/uVisualGears.pas Sun Sep 11 10:22:09 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; diff -r 2f52e422ce9e -r 74c621e12baa hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Sun Sep 11 16:18:49 2011 +0200 +++ b/hedgewars/uWorld.pas Sun Sep 11 10:22:09 2011 -0400 @@ -1315,11 +1315,11 @@ 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)); - CursorPoint.X:= CursorPoint.X - amount + LongInt(getRandom(1 + amount * 2)); - CursorPoint.Y:= CursorPoint.Y - amount + LongInt(getRandom(1 + amount * 2)) + amount:= Max(1, round(amount*zoom/2)); + WorldDx:= WorldDx - amount + LongInt(random(1 + amount * 2)); + WorldDy:= WorldDy - amount + LongInt(random(1 + amount * 2)); + //CursorPoint.X:= CursorPoint.X - amount + LongInt(random(1 + amount * 2)); + //CursorPoint.Y:= CursorPoint.Y - amount + LongInt(random(1 + amount * 2)) end;