--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/journey.lua Sun Aug 19 22:38:20 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/journey.lua Sun Aug 19 23:05:41 2012 +0300
@@ -32,8 +32,8 @@
TurnsLeft = 0
stage = 0
-cyborgHidden = false
-princessHidden = false
+--cyborgHidden = false
+--princessHidden = false
blowTaken = false
fireTaken = false
gravityTaken = false
@@ -46,6 +46,7 @@
princessDead = false
cyborgDead = false
cannibalDead = {}
+hedgeHidden = {}
startAnim = {}
startAnimAD = {}
@@ -86,7 +87,7 @@
function AfterMidAnimAlone()
SetupCourse()
for i = 5, 8 do
- RestoreHog(cannibals[i])
+ RestoreHedge(cannibals[i])
AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
end
@@ -105,23 +106,15 @@
end
function SkipEndAnimAlone()
- if cyborgHidden then
- RestoreHog(cyborg)
- cyborgHidden = false
- end
- if princessHidden then
- RestoreHog(princess)
- princessHidden = false
- end
+ RestoreHedge(cyborg)
+ RestoreHedge(princess)
AnimSetGearPosition(cyborg, 437, 1700)
AnimSetGearPosition(princess, 519, 1722)
end
function SkipEndAnimDuo()
- if cyborgHidden then
- RestoreHog(cyborg)
- cyborgHidden = false
- end
+ RestoreHedge(cyborg)
+ RestoreHedge(princess)
if princessHidden then
RestoreHog(princess)
princessHidden = false
@@ -160,14 +153,9 @@
AnimSetGearPosition(leaks, 2656, 1842)
AnimSwitchHog(leaks)
SetInputMask(0xFFFFFFFF)
- if princessHidden == false then
- HideHog(princess)
- princessHidden = true
- end
- if cyborgHidden == false then
- HideHog(cyborg)
- cyborgHidden = true
- end
+ AnimWait(dense, 1)
+ AddFunction({func = HideHedge, args = {princess}})
+ AddFunction({func = HideHedge, args = {cyborg}})
end
function AfterStartAnim()
@@ -240,17 +228,15 @@
function SkipPastFlowerAnim()
AnimSetGearPosition(dense, 2656, 1842)
AnimSwitchHog(dense)
- if cyborgHidden == false then
- HideHog(cyborg)
- cyborgHidden = true
- end
+ AnimWait(dense, 1)
+ AddFunction({func = HideHedge, args = {cyborg}})
end
function AfterOutPitAnim()
SetupCourseDuo()
RestoreHog(cannibals[5])
AddAmmo(cannibals[5], amDEagle, 0)
- HideHog(cannibals[5])
+ HideHedge(cannibals[5])
AddEvent(CheckTookFire, {}, DoTookFire, {}, 0)
SetGearMessage(leaks, 0)
SetGearMessage(dense, 0)
@@ -261,17 +247,13 @@
function SkipOutPitAnim()
AnimSetGearPosition(dense, unpack(midDensePosDuo))
AnimSwitchHog(dense)
- if cyborgHidden == false then
- HideHog(cyborg)
- cyborgHidden = true
- end
+ AnimWait(dense, 1)
+ AddFunction({func = HideHedge, args = {cyborg}})
end
function RestoreCyborg(x, y, xx, yy)
- RestoreHog(cyborg)
- RestoreHog(princess)
- cyborgHidden = false
- princessHidden = false
+ RestoreHedge(cyborg)
+ RestoreHedge(princess)
AnimOutOfNowhere(cyborg, x, y)
AnimOutOfNowhere(princess, xx, yy)
HogTurnLeft(princess, false)
@@ -279,8 +261,7 @@
end
function RestoreCyborgOnly(x, y)
- RestoreHog(cyborg)
- cyborgHidden = false
+ RestoreHedge(cyborg)
SetState(cyborg, 0)
AnimOutOfNowhere(cyborg, x, y)
return true
@@ -293,21 +274,12 @@
end
function HideCyborg()
- if cyborgHidden == false then
- HideHog(cyborg)
- cyborgHidden = true
- end
- if princessHidden == false then
- HideHog(princess)
- princessHidden = true
- end
+ HideHedge(cyborg)
+ HideHedge(princess)
end
function HideCyborgOnly()
- if cyborgHidden == false then
- HideHog(cyborg)
- cyborgHidden = true
- end
+ HideHedge(cyborg)
end
function SetupKillRoom()
@@ -599,6 +571,20 @@
end
--/////////////////////////////Misc Functions////////////////////////
+function HideHedge(hedge)
+ if hedgeHidden[hedge] ~= true then
+ HideHog(hedge)
+ hedgeHidden[hedge] = true
+ end
+end
+
+function RestoreHedge(hedge)
+ if hedgeHidden[hedge] == true then
+ RestoreHog(hedge)
+ hedgeHidden[hedge] = false
+ end
+end
+
function CondNeedToTurn(hog1, hog2)
xl, xd = GetX(hog1), GetX(hog2)
if xl > xd then
@@ -688,12 +674,10 @@
AddAnim(startAnim)
AddFunction({func = AfterStartAnim, args = {}})
end
- HideHog(cyborg)
- HideHog(princess)
- cyborgHidden = true
- princessHidden = true
+ HideHedge(cyborg)
+ HideHedge(princess)
for i = 5, 8 do
- HideHog(cannibals[i])
+ HideHedge(cannibals[i])
end
end
--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua Sun Aug 19 22:38:20 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua Sun Aug 19 23:05:41 2012 +0300
@@ -98,9 +98,9 @@
FollowGear(ramon)
TurnTimeLeft = 0
SetGearMessage(ramon, 0)
- HideHog(cyborg)
- cyborgHidden = true
SetGearMessage(leaks, 0)
+ AnimWait(ramon, 1)
+ AddFunction({func = HideHog, args = {cyborg}})
end
function SkipRefusedAnim()
@@ -206,12 +206,14 @@
SpawnAmmoCrate(1370, 810, amGirder)
SpawnAmmoCrate(1300, 810, amParachute)
ShowMission(loc("The Shadow Falls"), loc("The walk of Fame"), loc("Return to Leaks A Lot! If you get stuck, press [Precise] to try again!"), 1, 6000)
- HideHog(cyborg)
AddEvent(CheckTookWeapons, {}, DoTookWeapons, {}, 0)
AddEvent(CheckNeedGirder, {}, DoNeedGirder, {}, 0)
AddEvent(CheckNeedWeapons, {}, DoNeedWeapons, {}, 0)
AddEvent(CheckRestartReturnAccepted, {}, RestartReturnAccepted, {}, 1)
RemoveEventFunc(CheckDenseDead)
+ SwitchHog(dense)
+ AnimWait(dense, 1)
+ AddFunction({func = HideHog, args = {cyborg}})
end
function SkipAcceptedAnim()
@@ -223,7 +225,6 @@
function AfterAttackedAnim()
stage = aloneStage
- HideHog(cyborg)
ShowMission(loc("The Shadow Falls"), loc("The Individualist"), loc("Defeat the cannibals!|Grenade hint: set the timer with [1-5], aim with [Up]/[Down] and hold [Space] to set power"), 1, 8000)
AddAmmo(cannibals[6], amGrenade, 5)
AddAmmo(cannibals[6], amFirePunch, 0)
@@ -231,6 +232,9 @@
SetGearMessage(leaks, 0)
TurnTimeLeft = TurnTime
AddEvent(CheckStronglingsDead, {}, DoStronglingsDeadAttacked, {}, 0)
+ SwitchHog(leaks)
+ AnimWait(dense, 1)
+ AddFunction({func = HideHog, args = {cyborg}})
end
function SkipAttackedAnim()
@@ -914,11 +918,16 @@
end
function onPrecise()
- if GameTime > 2500 then
+ if GameTime > 2500 and AnimInProgress() then
SetAnimSkip(true)
+ return
end
if stage == acceptedReturnStage then
retryReturn = true
+-- else
+-- for i = 1, 9 do
+-- DeleteGear(cannibals[i])
+-- end
end
end