hedgewars/GSHandlers.inc
changeset 3161 cb5f04cc9d76
parent 3151 3f23113d9df4
child 3169 c8c6ac44f51b
equal deleted inserted replaced
3160:f2a3d861b23a 3161:cb5f04cc9d76
  2794 end;
  2794 end;
  2795 
  2795 
  2796 ////////////////////////////////////////////////////////////////////////////////
  2796 ////////////////////////////////////////////////////////////////////////////////
  2797 procedure doStepBirdyFly(Gear: PGear);
  2797 procedure doStepBirdyFly(Gear: PGear);
  2798 var HHGear: PGear;
  2798 var HHGear: PGear;
  2799     fuel: LongInt;
  2799     fuel, i: LongInt;
  2800     move: hwFloat;
  2800     move: hwFloat;
  2801 begin
  2801 begin
  2802 HHGear:= CurrentHedgehog^.Gear;
  2802 HHGear:= CurrentHedgehog^.Gear;
  2803 
  2803 
  2804 move:= _0_1;
  2804 move:= _0_1;
  2829     dec(Gear^.Health, fuel div 5);
  2829     dec(Gear^.Health, fuel div 5);
  2830     Gear^.MsgParam:= Gear^.MsgParam or (HHGear^.Message and (gm_Left or gm_Right));
  2830     Gear^.MsgParam:= Gear^.MsgParam or (HHGear^.Message and (gm_Left or gm_Right));
  2831     end;
  2831     end;
  2832 
  2832 
  2833 if Gear^.Health < 0 then Gear^.Health:= 0;
  2833 if Gear^.Health < 0 then Gear^.Health:= 0;
  2834 if (GameTicks and $3F) = 0 then
  2834 if (GameTicks and $7F) = 0 then
  2835        begin
  2835        begin
  2836        if Gear^.Health < 500 then
  2836        if Gear^.Health < 1000 then
  2837          AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFeather);
  2837             for i:= ((1000-Gear^.Health) div 250) downto 0 do
       
  2838                 AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFeather);
  2838        if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
  2839        if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
  2839        Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
  2840        Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
  2840        end;
  2841        end;
  2841 
  2842 
  2842 if (HHGear^.Message and gm_Attack <> 0) then begin
  2843 if (HHGear^.Message and gm_Attack <> 0) then begin
  2871         begin
  2872         begin
  2872         Message:= 0;
  2873         Message:= 0;
  2873         Active:= true;
  2874         Active:= true;
  2874         State:= State or gstMoving
  2875         State:= State or gstMoving
  2875         end;
  2876         end;
  2876     if Gear^.Tag = -1 then
       
  2877         begin
       
  2878         Gear^.dX:= Gear^.X + int2hwFloat(LAND_WIDTH + 1024);
       
  2879         Gear^.dY:= int2hwFloat(256);
       
  2880         Gear^.X:= int2hwFloat(-LAND_WIDTH -1024);
       
  2881         Gear^.Y:= Gear^.Y + int2hwFloat(-256);
       
  2882         end
       
  2883     else
       
  2884         begin
       
  2885         Gear^.dX:= Gear^.X - int2hwFloat(LAND_WIDTH + 1024);
       
  2886         Gear^.dY:= int2hwFloat(256);
       
  2887         Gear^.X:= int2hwFloat(+LAND_WIDTH +1024);
       
  2888         Gear^.Y:= Gear^.Y + int2hwFloat(-256);
       
  2889         end;
       
  2890     Gear^.State:= Gear^.State or gstAnimation or gstTmpFlag;
  2877     Gear^.State:= Gear^.State or gstAnimation or gstTmpFlag;
       
  2878     if HHGear^.dY < _0 then
       
  2879         begin
       
  2880         Gear^.dX:= HHGear^.dX;
       
  2881         Gear^.dY:= HHGear^.dY;
       
  2882         end;
  2891     Gear^.Timer:= 0;
  2883     Gear^.Timer:= 0;
  2892     Gear^.doStep:= @doStepBirdyDisappear;
  2884     Gear^.doStep:= @doStepBirdyDisappear;
  2893     CurAmmoGear:= nil;
  2885     CurAmmoGear:= nil;
  2894     isCursorVisible:= false;
  2886     isCursorVisible:= false;
  2895     AfterAttack;
  2887     AfterAttack;