hedgewars/uWorld.pas
changeset 10325 7315870716f2
parent 10322 6f1f8515181c
child 10330 3ec09243cb55
equal deleted inserted replaced
10324:5d90d8ca9657 10325:7315870716f2
   788    if (AMShiftX = 0) and (AMShiftY = 0) then
   788    if (AMShiftX = 0) and (AMShiftY = 0) then
   789         DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8);
   789         DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8);
   790 {$ENDIF}
   790 {$ENDIF}
   791 end;
   791 end;
   792 
   792 
   793 procedure DrawWater(Alpha: byte; OffsetY, OffsetX: LongInt);
       
   794 var VertexBuffer : array [0..3] of TVertex2f;
       
   795     topy, lx, rx: LongInt;
       
   796 begin
       
   797 
       
   798     // Water
       
   799 topy:= OffsetY + WorldDy + cWaterLine;
       
   800 
       
   801 if SuddenDeathDmg then
       
   802     begin
       
   803     SDWaterColorArray[0].a := Alpha;
       
   804     SDWaterColorArray[1].a := Alpha;
       
   805     SDWaterColorArray[2].a := Alpha;
       
   806     SDWaterColorArray[3].a := Alpha
       
   807     end
       
   808 else
       
   809     begin
       
   810     WaterColorArray[0].a := Alpha;
       
   811     WaterColorArray[1].a := Alpha;
       
   812     WaterColorArray[2].a := Alpha;
       
   813     WaterColorArray[3].a := Alpha
       
   814     end;
       
   815 
       
   816 if topy < 0 then
       
   817     topy:= 0;
       
   818 
       
   819 // glDisable(GL_TEXTURE_2D);
       
   820 
       
   821 if (topy < ViewBottomY) and (WorldEdge <> weSea) then
       
   822     begin
       
   823     VertexBuffer[0].X:= ViewLeftX;
       
   824     VertexBuffer[0].Y:= topy;
       
   825     VertexBuffer[1].X:= ViewRightX;
       
   826     VertexBuffer[1].Y:= topy;
       
   827     VertexBuffer[2].X:= ViewRightX;
       
   828     VertexBuffer[2].Y:= ViewBottomY;
       
   829     VertexBuffer[3].X:= ViewLeftX;
       
   830     VertexBuffer[3].Y:= ViewBottomY;
       
   831     DrawWaterBody(@VertexBuffer[0]);
       
   832     end;
       
   833 
       
   834 // water world edges? draw water body on the sides too
       
   835 if WorldEdge = weSea then
       
   836     begin
       
   837 
       
   838     lx:= LeftX  + WorldDx - OffsetX;
       
   839     rx:= RightX + WorldDx + OffsetX;
       
   840 
       
   841     if topy < ViewBottomY then
       
   842         begin
       
   843         VertexBuffer[0].X:= lx;
       
   844         VertexBuffer[0].Y:= topy;
       
   845         VertexBuffer[1].X:= rx;
       
   846         VertexBuffer[1].Y:= topy;
       
   847         VertexBuffer[2].X:= ViewRightX;
       
   848         VertexBuffer[2].Y:= ViewBottomY;
       
   849         VertexBuffer[3].X:= ViewLeftX;
       
   850         VertexBuffer[3].Y:= ViewBottomY;
       
   851         DrawWaterBody(@VertexBuffer[0]);
       
   852         end;
       
   853 
       
   854     if lx > ViewLeftX then
       
   855         begin
       
   856         VertexBuffer[0].X:= lx;
       
   857         VertexBuffer[0].Y:= ViewTopY;
       
   858         VertexBuffer[1].X:= lx;
       
   859         VertexBuffer[1].Y:= topy;
       
   860         VertexBuffer[2].X:= ViewLeftX;
       
   861         VertexBuffer[2].Y:= ViewBottomY;
       
   862         VertexBuffer[3].X:= ViewLeftX;
       
   863         VertexBuffer[3].Y:= ViewTopY;
       
   864         DrawWaterBody(@VertexBuffer[0]);
       
   865         end;
       
   866 
       
   867 
       
   868     if rx < ViewRightX then
       
   869         begin
       
   870         VertexBuffer[0].X:= rx;
       
   871         VertexBuffer[0].Y:= topy;
       
   872         VertexBuffer[1].X:= rx;
       
   873         VertexBuffer[1].Y:= ViewTopY;
       
   874         VertexBuffer[2].X:= ViewRightX;
       
   875         VertexBuffer[2].Y:= ViewTopY;
       
   876         VertexBuffer[3].X:= ViewRightX;
       
   877         VertexBuffer[3].Y:= ViewBottomY;
       
   878         DrawWaterBody(@VertexBuffer[0]);
       
   879         end;
       
   880     end;
       
   881 
       
   882 {$IFNDEF GL2}
       
   883 // must not be Tint() as color array seems to stay active and color reset is required
       
   884 glColor4ub($FF, $FF, $FF, $FF);
       
   885 {$ENDIF}
       
   886 //glEnable(GL_TEXTURE_2D);}
       
   887 end;
       
   888 
       
   889 procedure DrawWaves(Dir, dX, dY, oX: LongInt; tnt: Byte);
   793 procedure DrawWaves(Dir, dX, dY, oX: LongInt; tnt: Byte);
   890 var VertexBuffer, TextureBuffer: array [0..7] of TVertex2f;
   794 var VertexBuffer, TextureBuffer: array [0..7] of TVertex2f;
   891     lw, waves, shift: GLfloat;
   795     lw, waves, shift: GLfloat;
   892     sprite: TSprite;
   796     sprite: TSprite;
   893     topy: LongInt;
   797     topy: LongInt;