# HG changeset patch # User unc0rr # Date 1252586521 0 # Node ID f3e7a066c2b8e2b61eaeed1b65c2e3ccd248925c # Parent a20b6e26044ba2696e027c67e0b6832dd1942f88 Implement smooth zoom diff -r a20b6e26044b -r f3e7a066c2b8 hedgewars/CCHandlers.inc --- a/hedgewars/CCHandlers.inc Thu Sep 10 12:23:31 2009 +0000 +++ b/hedgewars/CCHandlers.inc Thu Sep 10 12:42:01 2009 +0000 @@ -682,12 +682,12 @@ procedure chZoomIn(var s: shortstring); begin -if zoom < 4.0 then zoom:= zoom + 0.25; +if ZoomValue < 3.0 then ZoomValue:= ZoomValue + 0.25; end; procedure chZoomOut(var s: shortstring); begin -if zoom > 0.25 then zoom:= zoom - 0.25; +if ZoomValue > 0.5 then ZoomValue:= ZoomValue - 0.25; end; procedure chChat(var s: shortstring); diff -r a20b6e26044b -r f3e7a066c2b8 hedgewars/uMisc.pas --- a/hedgewars/uMisc.pas Thu Sep 10 12:23:31 2009 +0000 +++ b/hedgewars/uMisc.pas Thu Sep 10 12:42:01 2009 +0000 @@ -60,6 +60,7 @@ cBitsStr : string[2] = '32'; cTagsMask : byte = 7; zoom : GLfloat = 2.0; + ZoomValue : GLfloat = 2.0; cWaterLine : LongInt = LAND_HEIGHT; cVisibleWater : LongInt = 128; diff -r a20b6e26044b -r f3e7a066c2b8 hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Sep 10 12:23:31 2009 +0000 +++ b/hedgewars/uWorld.pas Thu Sep 10 12:42:01 2009 +0000 @@ -296,6 +296,17 @@ end; begin +if ZoomValue < zoom then + begin + zoom:= zoom - 0.001 * Lag; + if zoom < ZoomValue then zoom:= ZoomValue + end else +if ZoomValue > zoom then + begin + zoom:= zoom + 0.001 * Lag; + if zoom > ZoomValue then zoom:= ZoomValue + end; + // Sky glClear(GL_COLOR_BUFFER_BIT); glEnable(GL_BLEND);