hedgewars/uWorld.pas
changeset 1825 c929f9111141
parent 1812 3d4692e825e7
child 1826 85ba91b803ea
equal deleted inserted replaced
1824:fbe1fa777d68 1825:c929f9111141
    50 type TCaptionStr = record
    50 type TCaptionStr = record
    51                    Tex: PTexture;
    51                    Tex: PTexture;
    52                    EndTime: LongWord;
    52                    EndTime: LongWord;
    53                    end;
    53                    end;
    54 
    54 
    55 var cWaterSprCount: LongInt;
    55 var cWaterSprCount, cWaveWidth, cWaveHeight: LongInt;
    56 	Captions: array[TCapGroup] of TCaptionStr;
    56 	Captions: array[TCapGroup] of TCaptionStr;
    57 	AMxShift, SlotsNum: LongInt;
    57 	AMxShift, SlotsNum: LongInt;
    58 	tmpSurface: PSDL_Surface;
    58 	tmpSurface: PSDL_Surface;
    59 	fpsTexture: PTexture = nil;
    59 	fpsTexture: PTexture = nil;
    60 
    60 
    61 procedure InitWorld;
    61 procedure InitWorld;
    62 begin
    62 begin
    63 cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width);
    63 cWaveWidth:= SpritesData[sprWater].Width;
       
    64 cWaveHeight:= SpritesData[sprWater].Height;
       
    65 cWaterSprCount:= 1 + cScreenWidth div cWaveWidth;
    64 cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50);
    66 cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50);
    65 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
    67 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
    66 prevPoint.X:= cScreenWidth div 2;
    68 prevPoint.X:= cScreenWidth div 2;
    67 prevPoint.Y:= cScreenHeight div 2;
    69 prevPoint.Y:= cScreenHeight div 2;
    68 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
    70 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   174 var i, t: LongInt;
   176 var i, t: LongInt;
   175     r: TSDL_Rect;
   177     r: TSDL_Rect;
   176     tdx, tdy: Double;
   178     tdx, tdy: Double;
   177     grp: TCapGroup;
   179     grp: TCapGroup;
   178     s: string[15];
   180     s: string[15];
       
   181     cWaveWidth, cWaveHeight: LongWord;
   179 
   182 
   180     procedure DrawRepeated(spr: TSprite; Shift: LongInt);
   183     procedure DrawRepeated(spr: TSprite; Shift: LongInt);
   181     var i, w: LongInt;
   184     var i, w: LongInt;
   182     begin
   185     begin
   183     w:= SpritesData[spr].Width;
   186     w:= SpritesData[spr].Width;
   207 
   210 
   208     DrawVisualGears(0);
   211     DrawVisualGears(0);
   209 
   212 
   210     // Waves
   213     // Waves
   211     {$WARNINGS OFF}
   214     {$WARNINGS OFF}
   212     for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * 125  + ((WorldDx + (RealTicks shr 6)      ) mod 125), cWaterLine + WorldDy - 64, 0);
   215     for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * cWaveWidth  + ((WorldDx + (RealTicks shr 6)      ) mod cWaveWidth), cWaterLine + WorldDy - (cWaveHeight*2), 0);
   213     for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * 125  + ((WorldDx - (RealTicks shr 6) + 100) mod 125), cWaterLine + WorldDy - 48, 0);
   216     for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * cWaveWidth + ((WorldDx - (RealTicks shr 6) + 100) mod cWaveWidth), cWaterLine + WorldDy - (cWaveHeight + cWaveHeight div 2), 0);
   214     {$WARNINGS ON}
   217     {$WARNINGS ON}
   215     end;
   218     end;
   216 
   219 
   217 
   220 
   218 DrawLand(WorldDx, WorldDy);
   221 DrawLand(WorldDx, WorldDy);
   261 
   264 
   262 if not cReducedQuality then DrawVisualGears(1);
   265 if not cReducedQuality then DrawVisualGears(1);
   263 
   266 
   264 // Waves
   267 // Waves
   265 {$WARNINGS OFF}
   268 {$WARNINGS OFF}
   266 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * 125  + ((WorldDx + (RealTicks shr 6) +  25) mod 125), cWaterLine + WorldDy - 32, 0);
   269 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * cWaveWidth  + ((WorldDx + (RealTicks shr 6) +  25) mod cWaveWidth), cWaterLine + WorldDy - cWaveHeight, 0);
   267 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * 125  + ((WorldDx - (RealTicks shr 6) +  50) mod 125), cWaterLine + WorldDy - 16, 0);
   270 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * cWaveWidth  + ((WorldDx - (RealTicks shr 6) +  50) mod cWaveWidth), cWaterLine + WorldDy - (cWaveHeight div 2), 0);
   268 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * 125  + ((WorldDx + (RealTicks shr 6) +  75) mod 125), cWaterLine + WorldDy     , 0);
   271 for i:= -1 to cWaterSprCount do DrawSprite(sprWater,  i * cWaveWidth  + ((WorldDx + (RealTicks shr 6) +  75) mod cWaveWidth), cWaterLine + WorldDy     , 0);
   269 {$WARNINGS ON}
   272 {$WARNINGS ON}
   270 // Turn time
   273 // Turn time
   271 if TurnTimeLeft <> 0 then
   274 if TurnTimeLeft <> 0 then
   272    begin
   275    begin
   273    i:= Succ(Pred(TurnTimeLeft) div 1000);
   276    i:= Succ(Pred(TurnTimeLeft) div 1000);