hedgewars/HHHandlers.inc
changeset 3310 e6e9b811d32f
parent 3302 0973c5af5141
child 3350 5cd02aafc612
equal deleted inserted replaced
3309:a68632232d1a 3310:e6e9b811d32f
   306     Gear^.Timer:= timertime
   306     Gear^.Timer:= timertime
   307     end
   307     end
   308 end;
   308 end;
   309 
   309 
   310 ////////////////////////////////////////////////////////////////////////////////
   310 ////////////////////////////////////////////////////////////////////////////////
       
   311 procedure doStepHedgehogGone(Gear: PGear);
       
   312 const frametime = 65;
       
   313       timertime = frametime * 11;
       
   314 begin
       
   315 if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit;
       
   316 if Gear^.Timer > 1 then
       
   317     begin
       
   318     AllInactive:= false;
       
   319     dec(Gear^.Timer);
       
   320     if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos)
       
   321     end else
       
   322 if Gear^.Timer = 1 then
       
   323     begin
       
   324     DeleteGear(Gear);
       
   325     SetAllToActive
       
   326     end else // Gear^.Timer = 0
       
   327     begin
       
   328     AllInactive:= false;
       
   329     Gear^.Z:= cCurrHHZ;
       
   330     RemoveGearFromList(Gear);
       
   331     InsertGearToList(Gear);
       
   332     PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
       
   333     PlaySound(sndWarp);
       
   334     Gear^.Pos:= 0;
       
   335     Gear^.Timer:= timertime
       
   336     end
       
   337 end;
       
   338 
       
   339 ////////////////////////////////////////////////////////////////////////////////
   311 procedure PickUp(HH, Gear: PGear);
   340 procedure PickUp(HH, Gear: PGear);
   312 var s: shortstring;
   341 var s: shortstring;
   313     a: TAmmoType;
   342     a: TAmmoType;
   314     i: LongInt;
   343     i: LongInt;
   315     vga: PVisualGear;
   344     vga: PVisualGear;
   753 if (Gear^.Health = 0) then
   782 if (Gear^.Health = 0) then
   754     begin
   783     begin
   755     if PrvInactive then
   784     if PrvInactive then
   756         begin
   785         begin
   757         Gear^.Timer:= 0;
   786         Gear^.Timer:= 0;
   758         Gear^.State:= Gear^.State or gstHHDeath;
       
   759         Gear^.doStep:= @doStepHedgehogDead;
       
   760         FollowGear:= Gear;
   787         FollowGear:= Gear;
   761         PrvInactive:= false;
   788         PrvInactive:= false;
   762         AllInactive:= false;
   789         AllInactive:= false;
   763 
   790 
   764         // Death message
   791         if not PHedgehog(Gear^.Hedgehog)^.Team^.hasGone then
   765         AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
   792             begin
       
   793             Gear^.State:= Gear^.State or gstHHDeath;
       
   794             Gear^.doStep:= @doStepHedgehogDead;
       
   795             // Death message
       
   796             AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
       
   797             end
       
   798         else
       
   799             begin
       
   800             Gear^.State:= Gear^.State or gstHHGone;
       
   801             Gear^.doStep:= @doStepHedgehogGone;
       
   802             // Gone message
       
   803             AddCaption(Format(GetEventString(eidGone), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
       
   804             end
   766         end;
   805         end;
   767     exit
   806     exit
   768     end;
   807     end;
   769 
   808 
   770 if ((Gear^.State and gstWait) = 0) and
   809 if ((Gear^.State and gstWait) = 0) and