hedgewars/uGearsRender.pas
changeset 14579 42f3d6860971
parent 14572 34e810295d08
child 14598 62dea281e4d5
equal deleted inserted replaced
14578:50f511588635 14579:42f3d6860971
   271         exit;
   271         exit;
   272     if (Gear^.State and gstHHGone) <> 0 then
   272     if (Gear^.State and gstHHGone) <> 0 then
   273         exit;
   273         exit;
   274 
   274 
   275     // render crosshair
   275     // render crosshair
   276     if (Gear = CrosshairGear) then
   276     if (CrosshairGear <> nil) and (Gear = CrosshairGear) then
   277         begin
   277         begin
   278         sign:= hwSign(Gear^.dX);
   278         sign:= hwSign(Gear^.dX);
   279         m:= 1;
   279         m:= 1;
   280         if ((Gear^.State and gstHHHJump) <> 0) and (HH^.Effects[heArtillery] = 0) then
   280         if ((Gear^.State and gstHHHJump) <> 0) and (HH^.Effects[heArtillery] = 0) then
   281             m:= -1;
   281             m:= -1;
   326     iceOffset:Longint;
   326     iceOffset:Longint;
   327     r:TSDL_Rect;
   327     r:TSDL_Rect;
   328     curhat: PTexture;
   328     curhat: PTexture;
   329 begin
   329 begin
   330     HH:= Gear^.Hedgehog;
   330     HH:= Gear^.Hedgehog;
       
   331     CrosshairGear:= nil;
   331     if HH^.Unplaced then
   332     if HH^.Unplaced then
   332         exit;
   333         exit;
   333     if (HH^.CurAmmoType = amKnife) and (HH = CurrentHedgehog) then
   334     if (HH^.CurAmmoType = amKnife) and (HH = CurrentHedgehog) then
   334          curhat:= ChefHatTexture
   335          curhat:= ChefHatTexture
   335     else curhat:= HH^.HatTex;
   336     else curhat:= HH^.HatTex;
   508                         end;
   509                         end;
   509                     end;
   510                     end;
   510 
   511 
   511                 DrawLineWrapped(hx, hy, tx, ty, 1.0, (sign*m) < 0, wraps, $FF, $00, $00, $C0);
   512                 DrawLineWrapped(hx, hy, tx, ty, 1.0, (sign*m) < 0, wraps, $FF, $00, $00, $C0);
   512                 end;
   513                 end;
       
   514 
   513             // calculate crosshair position
   515             // calculate crosshair position
   514             CrosshairX := Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle));
   516             CrosshairX := Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle));
   515             CrosshairY := Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle));
   517             CrosshairY := Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle));
   516             // crosshair will be rendered in RenderHHGuiExtras
   518             // crosshair will be rendered in RenderHHGuiExtras
   517             CrosshairGear := Gear;
   519             CrosshairGear := Gear;
   914             defaultPos:= false
   916             defaultPos:= false
   915         end;
   917         end;
   916 
   918 
   917     end else // not gstHHDriven
   919     end else // not gstHHDriven
   918         begin
   920         begin
   919         CrosshairGear:= nil;
       
   920         // check if hedgehog is sliding/rolling
   921         // check if hedgehog is sliding/rolling
   921         if (Gear^.Damage > 0) and (HH^.Effects[heFrozen] = 0)
   922         if (Gear^.Damage > 0) and (HH^.Effects[heFrozen] = 0)
   922         and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
   923         and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
   923             begin
   924             begin
   924             defaultPos:= false;
   925             defaultPos:= false;