hedgewars/uWorld.pas
changeset 75 d2b737858ff7
parent 74 42257fee61ae
child 79 29b477319854
equal deleted inserted replaced
74:42257fee61ae 75:d2b737858ff7
    67 var cWaterSprCount: integer;
    67 var cWaterSprCount: integer;
    68     Captions: array[0..Pred(cMaxCaptions)] of TCaptionStr;
    68     Captions: array[0..Pred(cMaxCaptions)] of TCaptionStr;
    69 
    69 
    70 procedure InitWorld;
    70 procedure InitWorld;
    71 begin
    71 begin
    72 cLandYShift:= cWaterLine + 64;
       
    73 cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width);
    72 cWaterSprCount:= 1 + cScreenWidth div (SpritesData[sprWater].Width);
    74 cScreenEdgesDist:= Min(cScreenWidth div 4, cScreenHeight div 4);
    73 cScreenEdgesDist:= Min(cScreenWidth div 4, cScreenHeight div 4);
    75 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
    74 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
    76 prevPoint.X:= cScreenWidth div 2;
    75 prevPoint.X:= cScreenWidth div 2;
    77 prevPoint.Y:= cScreenHeight div 2;
    76 prevPoint.Y:= cScreenHeight div 2;
   188         2: with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
   187         2: with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
   189                 begin
   188                 begin
   190                 tdx:= Sign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle);
   189                 tdx:= Sign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle);
   191                 tdy:= - Cos(Gear.Angle*pi/cMaxAngle);
   190                 tdy:= - Cos(Gear.Angle*pi/cMaxAngle);
   192                 for i:= (Gear.Power * 24) div cPowerDivisor downto 0 do
   191                 for i:= (Gear.Power * 24) div cPowerDivisor downto 0 do
   193                     DrawSprite(sprPower, round(Gear.X + WorldDx + tdx * (32 + i * 2)) - 16,
   192                     DrawSprite(sprPower, round(Gear.X + WorldDx + tdx * (24 + i * 2)) - 16,
   194                                          round(Gear.Y + WorldDy + tdy * (32 + i * 2)) - 12,
   193                                          round(Gear.Y + WorldDy + tdy * (24 + i * 2)) - 12,
   195                                          i, Surface)
   194                                          i, Surface)
   196                 end
   195                 end
   197         end;
   196         end;
   198 
   197 
   199 // Target
   198 // Target
   381       CursorPoint.X:= (cScreenWidth  shr 1);
   380       CursorPoint.X:= (cScreenWidth  shr 1);
   382       CursorPoint.Y:= (cScreenHeight shr 1);
   381       CursorPoint.Y:= (cScreenHeight shr 1);
   383    end;
   382    end;
   384 SDL_WarpMouse(CursorPoint.X, CursorPoint.Y);
   383 SDL_WarpMouse(CursorPoint.X, CursorPoint.Y);
   385 prevPoint:= CursorPoint;
   384 prevPoint:= CursorPoint;
   386 if WorldDy < cScreenHeight - cLandYShift - cVisibleWater then WorldDy:= cScreenHeight - cLandYShift - cVisibleWater;
   385 if WorldDy < cScreenHeight - cWaterLine - cVisibleWater then WorldDy:= cScreenHeight - cWaterLine - cVisibleWater;
   387 if WorldDy >  2048 then WorldDy:=  2048;
   386 if WorldDy >  2048 then WorldDy:=  2048;
   388 if WorldDx < -2048 then WorldDx:= -2048;
   387 if WorldDx < -2048 then WorldDx:= -2048;
   389 if WorldDx > cScreenWidth then WorldDx:=  cScreenWidth;
   388 if WorldDx > cScreenWidth then WorldDx:=  cScreenWidth;
   390 end;
   389 end;
   391 
   390