hedgewars/uGears.pas
changeset 292 0ca921ca7557
parent 283 28d105f378f1
child 293 00a532e8808e
equal deleted inserted replaced
291:afa378f1e961 292:0ca921ca7557
   394 while t<>nil do
   394 while t<>nil do
   395       begin
   395       begin
   396       if t.Kind = gtHedgehog then t.Active:= true;
   396       if t.Kind = gtHedgehog then t.Active:= true;
   397       t:= t.NextGear
   397       t:= t.NextGear
   398       end
   398       end
       
   399 end;
       
   400 
       
   401 procedure DrawHH(Gear: PGear; Surface: PSDL_Surface);
       
   402 var t: integer;
       
   403 begin
       
   404 DrawHedgehog(Round(Gear.X) - 14 + WorldDx, Round(Gear.Y) - 18 + WorldDy,
       
   405              hwSign(Gear.dX), 0,
       
   406              PHedgehog(Gear.Hedgehog).visStepPos div 2,
       
   407              Surface);
       
   408 
       
   409 with PHedgehog(Gear.Hedgehog)^ do
       
   410      if Gear.State = 0 then
       
   411         begin
       
   412         t:= round(Gear.Y) - cHHRadius - 10 + WorldDy;
       
   413         dec(t, HealthTag.h + 2);
       
   414         DrawCentered(round(Gear.X) + WorldDx, t, HealthTag, Surface);
       
   415         dec(t, NameTag.h + 2);
       
   416         DrawCentered(round(Gear.X) + WorldDx, t, NameTag, Surface);
       
   417         dec(t, Team.NameTag.h + 2);
       
   418         DrawCentered(round(Gear.X) + WorldDx, t, Team.NameTag, Surface)
       
   419         end else // Current hedgehog
       
   420         begin
       
   421         if bShowFinger and ((Gear.State and gstHHDriven) <> 0) then
       
   422            DrawSprite(sprFinger, round(Gear.X) - 16 + WorldDx, round(Gear.Y) - 64 + WorldDy,
       
   423                       GameTicks div 32 mod 16, Surface);
       
   424         if (Gear.State and (gstMoving or gstDrowning or gstFalling)) = 0 then
       
   425            if (Gear.State and gstHHThinking) <> 0 then
       
   426               DrawGear(sQuestion, Round(Gear.X) - 10 + WorldDx, Round(Gear.Y) - cHHRadius - 34 + WorldDy, Surface)
       
   427               else
       
   428               if ShowCrosshair and ((Gear.State and gstAttacked) = 0) then
       
   429                  DrawSurfSprite(Round(Gear.X + hwSign(Gear.dX) * Sin(Gear.Angle*pi/cMaxAngle)*60) + WorldDx - 11,
       
   430                            Round(Gear.Y - Cos(Gear.Angle*pi/cMaxAngle)*60) + WorldDy - 12,
       
   431                            24, (18 + hwSign(Gear.dX) * integer(((Gear.Angle * 72 div cMaxAngle) + 1) div 2) mod 18) mod 18,
       
   432                            Team.CrosshairSurf, Surface);
       
   433         end;
   399 end;
   434 end;
   400 
   435 
   401 procedure DrawGears(Surface: PSDL_Surface);
   436 procedure DrawGears(Surface: PSDL_Surface);
   402 var Gear: PGear;
   437 var Gear: PGear;
   403     i: Longword;
   438     i: Longword;
   479 while Gear<>nil do
   514 while Gear<>nil do
   480       begin
   515       begin
   481       case Gear.Kind of
   516       case Gear.Kind of
   482            gtCloud: DrawSprite(sprCloud   , Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface);
   517            gtCloud: DrawSprite(sprCloud   , Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface);
   483        gtAmmo_Bomb: DrawSprite(sprBomb , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface);
   518        gtAmmo_Bomb: DrawSprite(sprBomb , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface);
   484         gtHedgehog: DrawHedgehog(Round(Gear.X) - 14 + WorldDx, Round(Gear.Y) - 18 + WorldDy, hwSign(Gear.dX),
   519         gtHedgehog: DrawHH(Gear, Surface);
   485                                  0, PHedgehog(Gear.Hedgehog).visStepPos div 2,
       
   486                                  Surface);
       
   487     gtAmmo_Grenade: DrawSprite(sprGrenade , Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface);
   520     gtAmmo_Grenade: DrawSprite(sprGrenade , Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface);
   488        gtHealthTag: if Gear.Surf <> nil then DrawCentered(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.Surf, Surface);
   521        gtHealthTag: if Gear.Surf <> nil then DrawCentered(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.Surf, Surface);
   489            gtGrave: DrawSpriteFromRect(PHedgehog(Gear.Hedgehog).Team.GraveRect, Round(Gear.X) + WorldDx - 16, Round(Gear.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface);
   522            gtGrave: DrawSpriteFromRect(PHedgehog(Gear.Hedgehog).Team.GraveRect, Round(Gear.X) + WorldDx - 16, Round(Gear.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface);
   490              gtUFO: DrawSprite(sprUFO, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface);
   523              gtUFO: DrawSprite(sprUFO, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface);
   491       gtSmokeTrace: if Gear.State < 8 then DrawSprite(sprSmokeTrace, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface);
   524       gtSmokeTrace: if Gear.State < 8 then DrawSprite(sprSmokeTrace, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface);