hedgewars/uWorld.pas
changeset 2374 d584bb4b836e
parent 2373 e3989519731b
child 2375 99f05a01a6a3
equal deleted inserted replaced
2373:e3989519731b 2374:d584bb4b836e
   228 	end
   228 	end
   229 end;
   229 end;
   230 
   230 
   231 procedure DrawWaves(Dir, dX, dY: LongInt);
   231 procedure DrawWaves(Dir, dX, dY: LongInt);
   232 var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
   232 var VertexBuffer, TextureBuffer: array [0..3] of TVertex2f;
   233 	lw, waves: GLfloat;
   233 	lw, waves, shift: GLfloat;
   234 begin
   234 begin
   235 lw:= cScreenWidth / cScaleFactor;
   235 lw:= cScreenWidth / cScaleFactor;
   236 waves:= lw * 2 / cWaveWidth;
   236 waves:= lw * 2 / cWaveWidth;
   237 
   237 
   238 glBindTexture(GL_TEXTURE_2D, SpritesData[sprWater].Texture^.id);
   238 glBindTexture(GL_TEXTURE_2D, SpritesData[sprWater].Texture^.id);
   244 VertexBuffer[2].X:= lw;
   244 VertexBuffer[2].X:= lw;
   245 VertexBuffer[2].Y:= VertexBuffer[0].Y + SpritesData[sprWater].Height;
   245 VertexBuffer[2].Y:= VertexBuffer[0].Y + SpritesData[sprWater].Height;
   246 VertexBuffer[3].X:= -lw;
   246 VertexBuffer[3].X:= -lw;
   247 VertexBuffer[3].Y:= VertexBuffer[2].Y;
   247 VertexBuffer[3].Y:= VertexBuffer[2].Y;
   248 
   248 
   249 TextureBuffer[0].X:= (( - WorldDx + (RealTicks shr 6) * Dir + dX) mod cWaveWidth) / (cWaveWidth - 1);
   249 shift:= - lw / cWaveWidth;
       
   250 TextureBuffer[0].X:= shift + (( - WorldDx + (RealTicks shr 6) * Dir + dX) mod cWaveWidth) / (cWaveWidth - 1);
   250 TextureBuffer[0].Y:= 0;
   251 TextureBuffer[0].Y:= 0;
   251 TextureBuffer[1].X:= TextureBuffer[0].X + waves;
   252 TextureBuffer[1].X:= TextureBuffer[0].X + waves;
   252 TextureBuffer[1].Y:= 0;
   253 TextureBuffer[1].Y:= 0;
   253 TextureBuffer[2].X:= TextureBuffer[0].X + waves;
   254 TextureBuffer[2].X:= TextureBuffer[0].X + waves;
   254 TextureBuffer[2].Y:= 1;
   255 TextureBuffer[2].Y:= 1;
   296 
   297 
   297 begin
   298 begin
   298 if ZoomValue < zoom then
   299 if ZoomValue < zoom then
   299 	begin
   300 	begin
   300 	zoom:= zoom - 0.001 * Lag;
   301 	zoom:= zoom - 0.001 * Lag;
   301 	if zoom < ZoomValue then zoom:= ZoomValue
   302 	if ZoomValue > zoom then zoom:= ZoomValue
   302 	end else
   303 	end else
   303 if ZoomValue > zoom then
   304 if ZoomValue > zoom then
   304 	begin
   305 	begin
   305 	zoom:= zoom + 0.001 * Lag;
   306 	zoom:= zoom + 0.001 * Lag;
   306 	if zoom > ZoomValue then zoom:= ZoomValue
   307 	if ZoomValue < zoom then zoom:= ZoomValue
   307 	end;
   308 	end;
   308 	
   309 	
   309 // Sky
   310 // Sky
   310 glClear(GL_COLOR_BUFFER_BIT);
   311 glClear(GL_COLOR_BUFFER_BIT);
   311 glEnable(GL_BLEND);
   312 glEnable(GL_BLEND);