Merge sheepluva's changes
authorWuzzy <almikes@aol.com>
Sat, 30 Sep 2017 14:15:59 +0200
changeset 12619 806b6088863a
parent 12618 34685d3326a7 (diff)
parent 12617 2ffdee246adc (current diff)
child 12620 fbd0001ba2e7
Merge sheepluva's changes
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua	Sat Sep 30 14:00:02 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua	Sat Sep 30 14:15:59 2017 +0200
@@ -96,6 +96,7 @@
 
 startAnim = {}
 midAnim = {}
+princessFreedAnim = {}
 
 freshDead = nil
 crates = {}
@@ -179,6 +180,10 @@
   table.insert(midAnim, {func = AnimTeleportGear, args = {natives[1], unpack(nativeMidPos2)}})
   table.insert(midAnim, {func = AnimSay, args = {natives[1], loc("Why can't he just let her go?!"), SAY_THINK, 5000}})
   AddSkipFunction(midAnim, SkipMidAnim, {})
+
+  table.insert(princessFreedAnim, {func = AnimSay, args = {princess, loc("Thank you, my hero!"), SAY_SAY, 4000}})
+  table.insert(princessFreedAnim, {func = Victory, args = {}})
+  AddSkipFunction(princessFreedAnim, SkipPrincessFreedAnim, {})
 end
 
 --------------------------Anim skip functions--------------------------
@@ -192,7 +197,11 @@
   vCirc = AddVisualGear(0,0,vgtCircle,0,true)
   SetVisualGearValues(vCirc, 2625, 1500, 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
 end
-  
+
+function SkipPrincessFreedAnim()
+  Victory()
+end
+
 function SkipMidAnim()
   AnimTeleportGear(natives[1], unpack(nativeMidPos2))
   SkipStartAnim()
@@ -285,13 +294,18 @@
 end
 
 function DoPrincessFreed()
-  AnimSay(princess, loc("Thank you, my hero!"), SAY_SAY, 0)
-  if progress and progress<7 then
-    SaveCampaignVar("Progress", "7")
+  AddAnim(princessFreedAnim)
+end
+
+function Victory()
+  if not princessFreed then
+    if progress and progress<7 then
+      SaveCampaignVar("Progress", "7")
+    end
+    princessFreed = true
+    DismissTeam(loc("011101001"))
+    EndTurn(true)
   end
-  princessFreed = true
-  DismissTeam(loc("011101001"))
-  EndTurn(true)
 end
 
 function CheckCyborgsDead()