hedgewars/HHHandlers.inc
changeset 5954 2aead3f940b0
parent 5851 e6151aca2d7c
child 5965 e529b28d10e9
equal deleted inserted replaced
5952:ba168fa3451a 5954:2aead3f940b0
  1014         end
  1014         end
  1015 end;
  1015 end;
  1016 
  1016 
  1017 ////////////////////////////////////////////////////////////////////////////////
  1017 ////////////////////////////////////////////////////////////////////////////////
  1018 procedure doStepHedgehogFree(Gear: PGear);
  1018 procedure doStepHedgehogFree(Gear: PGear);
  1019 var prevState: Longword;
  1019 var prevState, i: Longword;
  1020 begin
  1020 begin
  1021 prevState:= Gear^.State;
  1021 prevState:= Gear^.State;
  1022 
  1022 
  1023 doStepHedgehogMoving(Gear);
  1023 doStepHedgehogMoving(Gear);
  1024 
  1024 
  1036         Gear^.Timer:= 0;
  1036         Gear^.Timer:= 0;
  1037         FollowGear:= Gear;
  1037         FollowGear:= Gear;
  1038         PrvInactive:= false;
  1038         PrvInactive:= false;
  1039         AllInactive:= false;
  1039         AllInactive:= false;
  1040 
  1040 
  1041         if (Gear^.State and gstHHGone) = 0 then
  1041         if not Gear^.Hedgehog^.Team^.hasGone then
  1042             begin
  1042             begin
  1043             Gear^.Hedgehog^.Effects[hePoisoned] := false;
  1043             Gear^.Hedgehog^.Effects[hePoisoned] := false;
  1044             if Gear^.Hedgehog^.Effects[heResurrectable] then begin
  1044             if Gear^.Hedgehog^.Effects[heResurrectable] then begin
  1045                 ResurrectHedgehog(Gear);
  1045                 ResurrectHedgehog(Gear);
  1046             end else begin
  1046             end else begin
  1050                 AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
  1050                 AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
  1051             end;
  1051             end;
  1052             end
  1052             end
  1053         else
  1053         else
  1054             begin
  1054             begin
       
  1055             Gear^.State:= Gear^.State or gstHHGone;
  1055             Gear^.doStep:= @doStepHedgehogGone;
  1056             Gear^.doStep:= @doStepHedgehogGone;
       
  1057 
       
  1058             with Gear^.Hedgehog^.Team^ do
       
  1059                 for i:= 0 to cMaxHHIndex do
       
  1060                     if Hedgehogs[i].GearHidden <> nil then
       
  1061                         begin
       
  1062                         RestoreHog(@Hedgehogs[i]);
       
  1063                         if Hedgehogs[i].Gear <> nil then 
       
  1064                             begin
       
  1065                             Hedgehogs[i].Gear^.State:= Gear^.State or gstHHGone;
       
  1066                             Hedgehogs[i].Gear^.doStep:= @doStepHedgehogGone
       
  1067                             end
       
  1068                         end;
  1056 
  1069 
  1057             // Gone message
  1070             // Gone message
  1058             AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
  1071             AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
  1059             end
  1072             end
  1060         end;
  1073         end;
  1092 if (Gear^.State and gstHHDriven) = 0 then
  1105 if (Gear^.State and gstHHDriven) = 0 then
  1093     doStepHedgehogFree(Gear)
  1106     doStepHedgehogFree(Gear)
  1094 else
  1107 else
  1095     begin
  1108     begin
  1096     with Gear^.Hedgehog^ do
  1109     with Gear^.Hedgehog^ do
  1097         if Team^.hasGone then 
  1110         if Team^.hasGone then TeamGoneEffect(Team^);
  1098             TeamGoneEffect(Team^)
  1111     doStepHedgehogDriven(Gear)
  1099         else
       
  1100             doStepHedgehogDriven(Gear)
       
  1101     end;
  1112     end;
  1102 end;
  1113 end;