hedgewars/GearDrawing.inc
changeset 3483 54ff8cbabaa6
parent 3482 106d1f983b48
child 3485 ab91c56a9050
equal deleted inserted replaced
3482:106d1f983b48 3483:54ff8cbabaa6
     1 procedure DrawHH(Gear: PGear);
     1 procedure DrawHH(Gear: PGear);
     2 var i, t: LongInt;
     2 var i, t: LongInt;
     3     amt: TAmmoType;
     3     amt: TAmmoType;
     4     hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
     4     hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
     5     lx, ly, dx, dy, ax, ay, aAngle, dAngle, hAngle: real;  // laser, change
     5     dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real;  // laser, change
     6     defaultPos, HatVisible: boolean;
     6     defaultPos, HatVisible: boolean;
     7     VertexBuffer: array [0..1] of TVertex2f;
     7     VertexBuffer: array [0..1] of TVertex2f;
     8     HH: PHedgehog;
     8     HH: PHedgehog;
     9 begin
     9 begin
    10 HH:= PHedgehog(Gear^.Hedgehog);
    10 HH:= PHedgehog(Gear^.Hedgehog);
    75    2: I need to start the beam outside the hedgie for attractiveness.
    75    2: I need to start the beam outside the hedgie for attractiveness.
    76    3: I need to extend the beam beyond land.
    76    3: I need to extend the beam beyond land.
    77    This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function.
    77    This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function.
    78 *)
    78 *)
    79         dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle);
    79         dx:= hwSign(Gear^.dX) * m * Sin(Gear^.Angle * pi / cMaxAngle);
    80         dy:= - Cos(Gear^.Angle * pi / cMaxAngle);
    80         dy:= -Cos(Gear^.Angle * pi / cMaxAngle);
    81         if cLaserSighting then
    81         if cLaserSighting then
    82             begin
    82             begin
    83             lx:= hwRound(Gear^.X);
    83             lx:= hwRound(Gear^.X) + GetLaunchX(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, hwSign(Gear^.dX), Gear^.Angle);
    84             ly:= hwRound(Gear^.Y);
    84             ly:= hwRound(Gear^.Y) + GetLaunchY(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, Gear^.Angle);
    85             lx:= lx + dx * 16;
       
    86             ly:= ly + dy * 16;
       
    87 
    85 
    88             ax:= dx * 4;
    86             ax:= dx * 4;
    89             ay:= dy * 4;
    87             ay:= dy * 4;
    90 
    88 
    91             tx:= round(lx);
    89             tx:= round(lx);
   128                 glEnable(GL_TEXTURE_2D);
   126                 glEnable(GL_TEXTURE_2D);
   129                 glDisable(GL_LINE_SMOOTH);
   127                 glDisable(GL_LINE_SMOOTH);
   130                 end;
   128                 end;
   131             end;
   129             end;
   132         // draw crosshair
   130         // draw crosshair
   133         cx:= Round(hwRound(Gear^.X) + dx * 80);
   131         cx:= Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, hwSign(Gear^.dX), Gear^.Angle));
   134         cy:= Round(hwRound(Gear^.Y) + dy * 80);
   132         cy:= Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.Ammo^[HH^.CurSlot, HH^.CurAmmo].AmmoType, Gear^.Angle));
   135         DrawRotatedTex(HH^.Team^.CrosshairTex,
   133         DrawRotatedTex(HH^.Team^.CrosshairTex,
   136                 12, 12, cx + WorldDx, cy + WorldDy, 0,
   134                 12, 12, cx + WorldDx, cy + WorldDy, 0,
   137                 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle);
   135                 hwSign(Gear^.dX) * (Gear^.Angle * 180.0) / cMaxAngle);
   138         end;
   136         end;
   139     hx:= hwRound(Gear^.X) + 1 + 8 * hwSign(Gear^.dX) + WorldDx;
   137     hx:= hwRound(Gear^.X) + 8 * hwSign(Gear^.dX) + WorldDx;
   140     hy:= hwRound(Gear^.Y) - 2 + WorldDy;
   138     hy:= hwRound(Gear^.Y) - 2 + WorldDy;
   141     aangle:= Gear^.Angle * 180 / cMaxAngle - 90;
   139     aangle:= Gear^.Angle * 180 / cMaxAngle - 90;
   142 
   140 
   143     if CurAmmoGear <> nil then
   141     if CurAmmoGear <> nil then
   144     begin
   142     begin