Fix broken sprites on animated water edges
authorKoBeWi <kobewi4e@gmail.com>
Tue, 18 Apr 2017 22:19:19 +0200
changeset 12286 6bf23d89dc43
parent 12285 ebd4f8a24d6a
child 12287 c0ace4bf45fa
Fix broken sprites on animated water edges
hedgewars/uRender.pas
--- a/hedgewars/uRender.pas	Tue Apr 18 22:07:16 2017 +0200
+++ b/hedgewars/uRender.pas	Tue Apr 18 22:19:19 2017 +0200
@@ -1878,9 +1878,9 @@
 TextureBuffer[5].X:= TextureBuffer[3].X + nWaves;
 TextureBuffer[5].Y:= frame * realHeight;
 TextureBuffer[4].X:= TextureBuffer[5].X;
-TextureBuffer[4].Y:= SpritesData[sprite].Texture^.ry / waterFrames + frame * realHeight;
+TextureBuffer[4].Y:= (frame+1) * realHeight;
 TextureBuffer[2].X:= TextureBuffer[3].X;
-TextureBuffer[2].Y:= SpritesData[sprite].Texture^.ry / waterFrames + frame * realHeight;
+TextureBuffer[2].Y:= (frame+1) * realHeight;
 
 if (WorldEdge = weSea) then
     begin
@@ -1888,15 +1888,15 @@
 
     // left side
     TextureBuffer[1].X:= TextureBuffer[3].X - nWaves;
-    TextureBuffer[1].Y:= 0;
+    TextureBuffer[1].Y:= frame * realHeight;
     TextureBuffer[0].X:= TextureBuffer[1].X;
-    TextureBuffer[0].Y:= SpritesData[sprite].Texture^.ry;
+    TextureBuffer[0].Y:= (frame+1) * realHeight;
 
     // right side
     TextureBuffer[7].X:= TextureBuffer[5].X + nWaves;
-    TextureBuffer[7].Y:= 0;
+    TextureBuffer[7].Y:= frame * realHeight;
     TextureBuffer[6].X:= TextureBuffer[7].X;
-    TextureBuffer[6].Y:= SpritesData[sprite].Texture^.ry;
+    TextureBuffer[6].Y:= (frame+1) * realHeight;
     end;
 
 glBindTexture(GL_TEXTURE_2D, SpritesData[sprite].Texture^.id);