hedgewars/uGearsRender.pas
branchtransitional_engine
changeset 15900 128ace913837
parent 15899 73cdc306888f
equal deleted inserted replaced
15899:73cdc306888f 15900:128ace913837
    54                                 end;
    54                                 end;
    55                 rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f;
    55                 rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f;
    56                 end;
    56                 end;
    57 
    57 
    58 implementation
    58 implementation
    59 uses uRender, uRenderUtils, uGearsUtils, uUtils, uVariables, uAmmos, Math, uVisualGearsList;
    59 uses uRender, uRenderUtils, uGearsUtils, uUtils, uVariables, uAmmos, Math, uVisualGearsList, uLandUtils;
    60 
    60 
    61 procedure DrawRopeLinesRQ(Gear: PGear);
    61 procedure DrawRopeLinesRQ(Gear: PGear);
    62 var n: LongInt;
    62 var n: LongInt;
    63 begin
    63 begin
    64 with RopePoints do
    64 with RopePoints do
    70     end;
    70     end;
    71 
    71 
    72 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then
    72 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then
    73     begin
    73     begin
    74     EnableTexture(false);
    74     EnableTexture(false);
    75     
    75 
    76     Tint(Gear^.Tint shr 24 div 3, Gear^.Tint shr 16 and $FF div 3, Gear^.Tint shr 8 and $FF div 3, Gear^.Tint and $FF);
    76     Tint(Gear^.Tint shr 24 div 3, Gear^.Tint shr 16 and $FF div 3, Gear^.Tint shr 8 and $FF div 3, Gear^.Tint and $FF);
    77 
    77 
    78     n:= RopePoints.Count + 2;
    78     n:= RopePoints.Count + 2;
    79 
    79 
    80     SetVertexPointer(@RopePoints.rounded[0], n);
    80     SetVertexPointer(@RopePoints.rounded[0], n);
   539                 ty:= round(ly);
   539                 ty:= round(ly);
   540                 hx:= tx;
   540                 hx:= tx;
   541                 hy:= ty;
   541                 hy:= ty;
   542                 wraps:= 0;
   542                 wraps:= 0;
   543                 inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0;
   543                 inWorldBounds := ((ty and LAND_HEIGHT_MASK) or (tx and LAND_WIDTH_MASK)) = 0;
   544                 while (inWorldBounds and ((Land[ty, tx] and lfAll) = 0)) or (not inWorldBounds) do
   544                 while (inWorldBounds and ((LandGet(ty, tx) and lfAll) = 0)) or (not inWorldBounds) do
   545                     begin
   545                     begin
   546                     if wraps > cMaxLaserSightWraps then
   546                     if wraps > cMaxLaserSightWraps then
   547                         break;
   547                         break;
   548                     lx:= lx + ax;
   548                     lx:= lx + ax;
   549                     ly:= ly + ay;
   549                     ly:= ly + ay;
  1047                 else
  1047                 else
  1048                     tx := hwRound(Gear^.X) - cHHRadius;
  1048                     tx := hwRound(Gear^.X) - cHHRadius;
  1049                 ty:= hwRound(Gear^.Y) + cHHRadius + 2;
  1049                 ty:= hwRound(Gear^.Y) + cHHRadius + 2;
  1050                 if ((tx and LAND_WIDTH_MASK) = 0) and
  1050                 if ((tx and LAND_WIDTH_MASK) = 0) and
  1051                     ((ty and LAND_HEIGHT_MASK) = 0) and
  1051                     ((ty and LAND_HEIGHT_MASK) = 0) and
  1052                         (Land[ty, tx] <> 0) then
  1052                         (LandGet(ty, tx) <> 0) then
  1053                             AddVisualGear(tx - 2 + Random(4), ty - 8, vgtDust);
  1053                             AddVisualGear(tx - 2 + Random(4), ty - 8, vgtDust);
  1054                 end;
  1054                 end;
  1055 
  1055 
  1056             // draw april's fool hat
  1056             // draw april's fool hat
  1057             if AprilOne and (curhat <> nil) then
  1057             if AprilOne and (curhat <> nil) then
  1415                            DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
  1415                            DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
  1416                     else if Gear^.Health <> 0 then
  1416                     else if Gear^.Health <> 0 then
  1417                        DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
  1417                        DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
  1418                     else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
  1418                     else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
  1419                     end;
  1419                     end;
  1420          gtAirMine: 
  1420          gtAirMine:
  1421                     // render air mine based on its state:
  1421                     // render air mine based on its state:
  1422                     // frozen
  1422                     // frozen
  1423                     if (Gear^.State and gstFrozen <> 0) then
  1423                     if (Gear^.State and gstFrozen <> 0) then
  1424                         // frozen air mine sprite
  1424                         // frozen air mine sprite
  1425                         DrawSprite(sprFrozenAirMine, x-16, y-16, 0)
  1425                         DrawSprite(sprFrozenAirMine, x-16, y-16, 0)