On victory, center camera on a winning hedgehog
authorWuzzy <Wuzzy2@mail.ru>
Wed, 26 Sep 2018 20:45:55 +0200
changeset 13808 5c6052351991
parent 13807 1f15b0ee8e34
child 13809 3b94a2c707c6
On victory, center camera on a winning hedgehog
hedgewars/uTeams.pas
--- a/hedgewars/uTeams.pas	Mon Sep 24 11:18:48 2018 -0400
+++ b/hedgewars/uTeams.pas	Wed Sep 26 20:45:55 2018 +0200
@@ -58,7 +58,7 @@
     s, cap: ansistring;
     ts: array[0..(cMaxTeams - 1)] of ansistring;
     t, AliveCount, i, j: LongInt;
-    allWin: boolean;
+    allWin, winCamera: boolean;
 begin
 CheckForWin:= false;
 AliveCount:= 0;
@@ -137,12 +137,21 @@
                 // TODO (maybe): Show victory animation/captions per-team instead of all winners at once?
                 end;
 
+            // Enable winner state for winning hogs and move camera to a winning hedgehog
+            winCamera:= false;
             for j:= 0 to Pred(TeamsNumber) do
                 with Teams[j]^ do
                     for i:= 0 to cMaxHHIndex do
                         with Hedgehogs[i] do
                             if (Gear <> nil) then
+                                begin
+                                if (not winCamera) then
+                                    begin
+                                    FollowGear:= Gear;
+                                    winCamera:= true;
+                                    end;
                                 Gear^.State:= gstWinner;
+                                end;
             if Flawless then
                 AddVoice(sndFlawless, Teams[0]^.voicepack)
             else