# HG changeset patch # User unc0rr # Date 1252587310 0 # Node ID d584bb4b836e2ecf869544577f75596caf743d2a # Parent e3989519731b996676b9222fe817bdd795c7bcaf Fix water position when zooming diff -r e3989519731b -r d584bb4b836e hedgewars/uWorld.pas --- a/hedgewars/uWorld.pas Thu Sep 10 12:46:56 2009 +0000 +++ b/hedgewars/uWorld.pas Thu Sep 10 12:55:10 2009 +0000 @@ -230,7 +230,7 @@ procedure DrawWaves(Dir, dX, dY: LongInt); var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f; - lw, waves: GLfloat; + lw, waves, shift: GLfloat; begin lw:= cScreenWidth / cScaleFactor; waves:= lw * 2 / cWaveWidth; @@ -246,7 +246,8 @@ VertexBuffer[3].X:= -lw; VertexBuffer[3].Y:= VertexBuffer[2].Y; -TextureBuffer[0].X:= (( - WorldDx + (RealTicks shr 6) * Dir + dX) mod cWaveWidth) / (cWaveWidth - 1); +shift:= - lw / cWaveWidth; +TextureBuffer[0].X:= shift + (( - WorldDx + (RealTicks shr 6) * Dir + dX) mod cWaveWidth) / (cWaveWidth - 1); TextureBuffer[0].Y:= 0; TextureBuffer[1].X:= TextureBuffer[0].X + waves; TextureBuffer[1].Y:= 0; @@ -298,12 +299,12 @@ if ZoomValue < zoom then begin zoom:= zoom - 0.001 * Lag; - if zoom < ZoomValue then zoom:= ZoomValue + if ZoomValue > zoom then zoom:= ZoomValue end else if ZoomValue > zoom then begin zoom:= zoom + 0.001 * Lag; - if zoom > ZoomValue then zoom:= ZoomValue + if ZoomValue < zoom then zoom:= ZoomValue end; // Sky