hedgewars/GSHandlers.inc
changeset 3149 08c4d9670b54
parent 3146 53ba22975536
child 3150 d212e612c08e
equal deleted inserted replaced
3148:3e28a12be5ac 3149:08c4d9670b54
  2779         end
  2779         end
  2780     end
  2780     end
  2781 end;
  2781 end;
  2782 
  2782 
  2783 ////////////////////////////////////////////////////////////////////////////////
  2783 ////////////////////////////////////////////////////////////////////////////////
  2784 procedure doStepBirdyVanish(Gear: PGear);
  2784 procedure doStepBirdyDisappear(Gear: PGear);
  2785 begin
  2785 begin
       
  2786 AllInactive:= false;
  2786 Gear^.Pos:= 0;
  2787 Gear^.Pos:= 0;
  2787 if Gear^.Timer < 500 then
  2788 if Gear^.Timer < 2000 then
  2788     inc(Gear^.Timer, 1)
  2789     inc(Gear^.Timer, 1)
  2789 else
  2790 else
  2790     begin
  2791     begin
  2791     DeleteGear(Gear);
  2792     DeleteGear(Gear);
  2792     AfterAttack
  2793     AfterAttack;
  2793     end
  2794     end;
  2794 end;
  2795 end;
  2795 
  2796 
  2796 ////////////////////////////////////////////////////////////////////////////////
  2797 ////////////////////////////////////////////////////////////////////////////////
  2797 procedure doStepBirdyFly(Gear: PGear);
  2798 procedure doStepBirdyFly(Gear: PGear);
  2798 var HHGear: PGear;
  2799 var HHGear: PGear;
  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     Gear^.doStep:= @doStepBirdyVanish;
  2877     if Gear^.Tag = -1 then
       
  2878         begin
       
  2879         Gear^.dX:= Gear^.X + int2hwFloat(LAND_WIDTH + 1024);
       
  2880         Gear^.dY:= int2hwFloat(256);
       
  2881         Gear^.X:= int2hwFloat(-LAND_WIDTH -1024);
       
  2882         Gear^.Y:= Gear^.Y + int2hwFloat(-256);
       
  2883         end
       
  2884     else
       
  2885         begin
       
  2886         Gear^.dX:= Gear^.X - int2hwFloat(LAND_WIDTH + 1024);
       
  2887         Gear^.dY:= int2hwFloat(256);
       
  2888         Gear^.X:= int2hwFloat(+LAND_WIDTH +1024);
       
  2889         Gear^.Y:= Gear^.Y + int2hwFloat(-256);
       
  2890         end;
       
  2891     Gear^.State:= Gear^.State or gstAnimation or gstTmpFlag;
       
  2892     Gear^.Timer:= 0;
       
  2893     Gear^.doStep:= @doStepBirdyDisappear;
  2877     isCursorVisible:= false;
  2894     isCursorVisible:= false;
  2878     end
  2895     end
  2879 end;
  2896 end;
  2880 
  2897 
  2881 ////////////////////////////////////////////////////////////////////////////////
  2898 ////////////////////////////////////////////////////////////////////////////////
  2885 AllInactive:= false;
  2902 AllInactive:= false;
  2886 if Gear^.Timer > 0 then
  2903 if Gear^.Timer > 0 then
  2887     dec(Gear^.Timer, 1)
  2904     dec(Gear^.Timer, 1)
  2888 else if CurrentHedgehog = nil then
  2905 else if CurrentHedgehog = nil then
  2889     begin
  2906     begin
  2890     Gear^.doStep:= @doStepBirdyVanish;
  2907     DeleteGear(Gear);
  2891     exit
  2908     exit
  2892     end;
  2909     end;
  2893 HHGear:= CurrentHedgehog^.Gear;
  2910 HHGear:= CurrentHedgehog^.Gear;
  2894 HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right);
  2911 HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right);
  2895 if abs(hwRound(HHGear^.Y - Gear^.Y)) > 32 then
  2912 if abs(hwRound(HHGear^.Y - Gear^.Y)) > 32 then
  2902     Gear^.doStep:= @doStepBirdyFly;
  2919     Gear^.doStep:= @doStepBirdyFly;
  2903     HHGear^.dY:= -_0_2
  2920     HHGear^.dY:= -_0_2
  2904     end
  2921     end
  2905 end;
  2922 end;
  2906 
  2923 
       
  2924 procedure doStepBirdyAppear(Gear: PGear);
       
  2925 begin
       
  2926 Gear^.Pos:= 0;
       
  2927 if Gear^.Timer < 2000 then
       
  2928     inc(Gear^.Timer, 1)
       
  2929 else
       
  2930     begin
       
  2931     Gear^.Timer:= 500;
       
  2932     Gear^.dX:= _0;
       
  2933     Gear^.dY:= _0;
       
  2934     Gear^.State:=  Gear^.State and not gstAnimation;
       
  2935     Gear^.doStep:= @doStepBirdyDescend;
       
  2936     end
       
  2937 end;
       
  2938 
  2907 ////////////////////////////////////////////////////////////////////////////////
  2939 ////////////////////////////////////////////////////////////////////////////////
  2908 procedure doStepBirdy(Gear: PGear);
  2940 procedure doStepBirdy(Gear: PGear);
  2909 var HHGear: PGear;
  2941 var HHGear: PGear;
  2910 begin
  2942 begin
  2911 Gear^.doStep:= @doStepBirdyDescend;
  2943 gear^.State:=  gear^.State or gstAnimation and not gstTmpFlag;
       
  2944 Gear^.doStep:= @doStepBirdyAppear;
  2912 if CurrentHedgehog = nil then
  2945 if CurrentHedgehog = nil then
  2913     begin
  2946     begin
  2914     DeleteGear(Gear);
  2947     DeleteGear(Gear);
  2915     exit
  2948     exit
  2916     end;
  2949     end;