Engine:
authorsmxx
Tue, 06 Apr 2010 10:51:09 +0000
changeset 3310 e6e9b811d32f
parent 3309 a68632232d1a
child 3311 18436bb84bfe
Engine: * Teams leaving a net game will now teleport out of the map instead of commiting suicide
hedgewars/HHHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uLocale.pas
share/hedgewars/Data/Locale/de.txt
share/hedgewars/Data/Locale/en.txt
--- a/hedgewars/HHHandlers.inc	Tue Apr 06 09:58:43 2010 +0000
+++ b/hedgewars/HHHandlers.inc	Tue Apr 06 10:51:09 2010 +0000
@@ -308,6 +308,35 @@
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
+procedure doStepHedgehogGone(Gear: PGear);
+const frametime = 65;
+      timertime = frametime * 11;
+begin
+if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit;
+if Gear^.Timer > 1 then
+    begin
+    AllInactive:= false;
+    dec(Gear^.Timer);
+    if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos)
+    end else
+if Gear^.Timer = 1 then
+    begin
+    DeleteGear(Gear);
+    SetAllToActive
+    end else // Gear^.Timer = 0
+    begin
+    AllInactive:= false;
+    Gear^.Z:= cCurrHHZ;
+    RemoveGearFromList(Gear);
+    InsertGearToList(Gear);
+    PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+    PlaySound(sndWarp);
+    Gear^.Pos:= 0;
+    Gear^.Timer:= timertime
+    end
+end;
+
+////////////////////////////////////////////////////////////////////////////////
 procedure PickUp(HH, Gear: PGear);
 var s: shortstring;
     a: TAmmoType;
@@ -755,14 +784,24 @@
     if PrvInactive then
         begin
         Gear^.Timer:= 0;
-        Gear^.State:= Gear^.State or gstHHDeath;
-        Gear^.doStep:= @doStepHedgehogDead;
         FollowGear:= Gear;
         PrvInactive:= false;
         AllInactive:= false;
 
-        // Death message
-        AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
+        if not PHedgehog(Gear^.Hedgehog)^.Team^.hasGone then
+            begin
+            Gear^.State:= Gear^.State or gstHHDeath;
+            Gear^.doStep:= @doStepHedgehogDead;
+            // Death message
+            AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
+            end
+        else
+            begin
+            Gear^.State:= Gear^.State or gstHHGone;
+            Gear^.doStep:= @doStepHedgehogGone;
+            // Gone message
+            AddCaption(Format(GetEventString(eidGone), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage);
+            end
         end;
     exit
     end;
--- a/hedgewars/uConsts.pas	Tue Apr 06 09:58:43 2010 +0000
+++ b/hedgewars/uConsts.pas	Tue Apr 06 10:51:09 2010 +0000
@@ -345,6 +345,7 @@
     gstWait           = $00020000;
     gstNotKickable    = $00040000;
     gstLoser          = $00080000;
+    gstHHGone         = $00100000;
 
     gm_Left   = $00000001;
     gm_Right  = $00000002;
--- a/hedgewars/uGears.pas	Tue Apr 06 09:58:43 2010 +0000
+++ b/hedgewars/uGears.pas	Tue Apr 06 10:51:09 2010 +0000
@@ -925,6 +925,11 @@
     begin
     DrawSprite(sprHHDeath, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 26 + WorldDy, Gear^.Pos);
     exit
+    end
+else if (Gear^.State and gstHHGone) <> 0 then
+    begin
+    DrawRotatedF(sprTeleport, hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy, Gear^.Pos, hwSign(Gear^.dX), 0);
+    exit
     end;
 
 defaultPos:= true;
--- a/hedgewars/uLocale.pas	Tue Apr 06 09:58:43 2010 +0000
+++ b/hedgewars/uLocale.pas	Tue Apr 06 10:51:09 2010 +0000
@@ -36,7 +36,7 @@
 
     TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw,
             eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped, eidHurtSelf,
-            eidHomerun, eidFrozen);
+            eidHomerun, eidGone);
 
     TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable,
             gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery,
--- a/share/hedgewars/Data/Locale/de.txt	Tue Apr 06 09:58:43 2010 +0000
+++ b/share/hedgewars/Data/Locale/de.txt	Tue Apr 06 10:51:09 2010 +0000
@@ -1,4 +1,4 @@
-; German locale
+; German locale
 
 00:00=Granate
 00:01=Splittergranate
@@ -160,6 +160,12 @@
 02:10=Ein Vogel, ein Flugzeug, ...
 02:10=Der verleiht Flügel!
 
+; Hog (%1) has to leave (team is gone)
+02:11=%1 muss ins Bett!
+02:11=%1 scheint zu beschäftigt zu sein
+02:11=Beam ihn hoch, Scotty!
+02:11=%1 muss weg
+
 ; Weapon Categories
 03:00=Zeitzünder-Granate
 03:01=Zeitzünder-Granate
--- a/share/hedgewars/Data/Locale/en.txt	Tue Apr 06 09:58:43 2010 +0000
+++ b/share/hedgewars/Data/Locale/en.txt	Tue Apr 06 10:51:09 2010 +0000
@@ -362,6 +362,12 @@
 02:10=A bird, a plane, ...
 02:10=That one is out!
 
+; Hog (%1) has to leave (team is gone)
+02:11=%1 has to go to bed!
+02:11=%1 seems too busy to play
+02:11=Beam him up, Scotty!
+02:11=%1 has to go
+
 ; Weapon Categories
 03:00=Timed Grenade
 03:01=Timed Grenade