ACF7: Don't make princess disappear instantly after victory
authorWuzzy <almikes@aol.com>
Sat, 30 Sep 2017 14:15:18 +0200
changeset 12618 34685d3326a7
parent 12616 fb0734d5dd87
child 12619 806b6088863a
ACF7: Don't make princess disappear instantly after victory
share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua	Sat Sep 30 04:31:50 2017 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/family.lua	Sat Sep 30 14:15:18 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()