Solved "floating repositionings" in every mission
authorbelphegorr <szabibibi@gmail.com>
Fri, 10 Aug 2012 04:26:58 +0300
changeset 7448 d0521a3a4358
parent 7443 a7f861f1c3b8
child 7451 d2dce3b530f8
Solved "floating repositionings" in every mission Fixed bug where gear message wouldn't be reset after animations Mission 5: fixed bug where control would be messed up when animation interrupted the turn of a hedgehog that was using multi-shot weapons Replaced graves with circles for marking enemy positions
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/backstab.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/dragon.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/family.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/first_blood.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/journey.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/queen.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua
share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/united.lua
share/hedgewars/Data/Scripts/Animate.lua
--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/backstab.lua	Fri Aug 10 00:20:52 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/backstab.lua	Fri Aug 10 04:26:58 2012 +0300
@@ -71,6 +71,7 @@
 deployedHog = nil
 
 cyborgHidden = false
+needToAct = 0
 
 m2Choice = 0
 m2DenseDead = 0
@@ -95,6 +96,7 @@
 wave2DeadAnim = {}
 wave3DeadAnim = {}
 
+vCircs = {}
 -----------------------------Animations--------------------------------
 function Wave2Reaction()
   local i = 1
@@ -217,7 +219,7 @@
 function ExplainAlive()
   if needRevival == true and m4WaterDead == 1 then
     RestoreCyborg()
-    SetGearPosition(cyborg, unpack(cyborgPos))
+    AnimSetGearPosition(cyborg, unpack(cyborgPos))
     AnimInsertStepNext({func = AnimCustomFunction, args = {water, HideCyborg, {}}})
     AnimInsertStepNext({func = AnimSwitchHog, args = {water}})
     AnimInsertStepNext({func = AnimSay, args = {cyborg, loc("The answer is...entertaintment. You'll see what I mean."), SAY_SAY, 8000}})
@@ -304,6 +306,19 @@
   AddSkipFunction(wave2Anim, SkipWave2Anim, {})
 end
 
+function PutCircles()
+  if circlesPut then
+    return
+  end
+  vCircs[1] = AddVisualGear(0,0,vgtCircle,0,true)
+  vCircs[2] = AddVisualGear(0,0,vgtCircle,0,true)
+  vCircs[3] = AddVisualGear(0,0,vgtCircle,0,true)
+  SetVisualGearValues(vCircs[1], cannibalPos[7][1], cannibalPos[7][2], 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
+  SetVisualGearValues(vCircs[2], cannibalPos[8][1], cannibalPos[8][2], 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
+  SetVisualGearValues(vCircs[3], cannibalPos[9][1], cannibalPos[9][2], 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
+  circlesPut = true
+end
+
 function SetupWave2DeadAnim()
   for i = 7, 1, -1 do
     if nativeDead[i] ~= true then
@@ -321,10 +336,10 @@
       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], TurnNatives, {natives[wiseNum]}}})
       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], CondNeedToTurn, {natives[wiseNum], deployedHog}}})
       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I sense another wave of cannibals heading our way!"), SAY_SAY, 6500}})
-      table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I feel something...a place! They will arrive near the graves!"), SAY_SAY, 7500}})
-      table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[7][1], cannibalPos[7][2], gtGrave, 0, 0, 0, 0}})
-      table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[8][1], cannibalPos[8][2], gtGrave, 0, 0, 0, 0}})
-      table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[9][1], cannibalPos[9][2], gtGrave, 0, 0, 0, 0}})
+      table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I feel something...a place! They will arrive near the circles!"), SAY_SAY, 7500}})
+      table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], PutCircles, {}}})
+      table.insert(wave2DeadAnim, {func = AnimFollowGear, swh = false, args = {vCircs[1]}})
+      table.insert(wave2DeadAnim, {func = AnimWait, args = {natives[wiseNum], 1500}})
       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("We need to prevent their arrival!"), SAY_SAY, 4500}})
       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("Go, quick!"), SAY_SAY, 2500}})
       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], DeployHog, {}}})
@@ -342,10 +357,9 @@
       table.insert(wave2DeadAnim, {func = AnimWait, args = {natives[wiseNum], 1500}})
       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("What a strange feeling!"), SAY_THINK, 3000}})
       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I sense another wave of cannibals heading my way!"), SAY_THINK, 6500}})
-      table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I feel something...a place! They will arrive near the graves!"), SAY_SAY, 7500}})
-      table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[7][1], cannibalPos[7][2], gtGrave, 0, 0, 0, 0}})
-      table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[8][1], cannibalPos[8][2], gtGrave, 0, 0, 0, 0}})
-      table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[9][1], cannibalPos[9][2], gtGrave, 0, 0, 0, 0}})
+      table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I feel something...a place! They will arrive near the circles!"), SAY_SAY, 7500}})
+      table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], PutCircles, {}}})
+      table.insert(wave2DeadAnim, {func = AnimFollowGear, swh = false, args = {vCircs[1]}})
       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I need to prevent their arrival!"), SAY_THINK, 4500}})
       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("If only I had a way..."), SAY_THINK, 3000}})
       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("Oh, silly me! I forgot that I'm the shaman."), SAY_THINK, 6000}})
@@ -354,15 +368,15 @@
     table.insert(wave2DeadAnim, {func = AnimWait, args = {cyborg, 1500}})
     table.insert(wave2DeadAnim, {func = AnimCustomFunction, swh = false, args = {cyborg, RestoreCyborg, {}}})
     table.insert(wave2DeadAnim, {func = AnimOutOfNowhere, args = {cyborg, cyborgPos2[1], cyborgPos2[2]}})
+    table.insert(wave2DeadAnim, {func = AnimTurn, args = {cyborg, "Left"}})
     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {cyborg, TeleportNatives, {}}})
     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {cyborg, TurnNatives, {cyborg}}})
     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("Oh, my! This is even more entertaining than I've expected!"), SAY_SAY, 7500}})
     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("You might want to find a way to instantly kill arriving cannibals!"), SAY_SAY, 8000}})
     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("I believe there's more of them."), SAY_SAY, 4000}})
     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("I marked the place of their arrival. You're welcome!"), SAY_SAY, 6000}})
-    table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[7][1], cannibalPos[7][2], gtGrave, 0, 0, 0, 0}})
-    table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[8][1], cannibalPos[8][2], gtGrave, 0, 0, 0, 0}})
-    table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[9][1], cannibalPos[9][2], gtGrave, 0, 0, 0, 0}})
+    table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], PutCircles, {}}})
+    table.insert(wave2DeadAnim, {func = AnimFollowGear, swh = false, args = {vCircs[1]}})
     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {deployedHog, DeployHog, {}}})
     if nativesNum > 1 then
 --      table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], RestoreCyborg, {}}})
@@ -534,9 +548,7 @@
   IsolateNatives()
   DeployHog()
   HideCyborg()
-  AddGear(cannibalPos[7][1], cannibalPos[7][2], gtGrave, 0, 0, 0, 0)
-  AddGear(cannibalPos[8][1], cannibalPos[8][2], gtGrave, 0, 0, 0, 0)
-  AddGear(cannibalPos[9][1], cannibalPos[9][2], gtGrave, 0, 0, 0, 0)
+  PutCircles()
 end
 
 function SpawnPlatformCrates()
@@ -569,7 +581,7 @@
 end
 
 function SkipStartAnim()
-  SetGearPosition(natives[waterNum], nativePos[denseNum][1] + 50, nativePos[denseNum][2])
+  AnimSetGearPosition(natives[waterNum], nativePos[denseNum][1] + 50, nativePos[denseNum][2])
   RestoreWave(1)
   ReviveNatives()
   SetGearMessage(CurrentHedgehog, 0)
@@ -623,6 +635,7 @@
 
 function DoChoice()
   RemoveEventFunc(CheckChoiceRefuse)
+  SetGearMessage(CurrentHedgehog, 0)
   SetupAfterChoiceAnim()
   AddAnim(afterChoiceAnim)
   AddFunction({func = AfterAfterChoiceAnim, args = {}})
@@ -662,19 +675,7 @@
 
 function DoWaveDead(index)
   TurnTimeLeft = 0
-  if index == 1 then
-    RestoreWave(2)
-    SetupWave2Anim()
-    AddAnim(wave2Anim)
-    AddFunction({func = AfterWave2Anim, args = {}})
-  elseif index == 2 then
-    SetupWave2DeadAnim()
-    AddAnim(wave2DeadAnim)
-    AddFunction({func = AfterWave2DeadAnim, args = {}})
-  elseif index == 3 then
-    AnimSwitchHog(deployedHog)
-    AddFunction({func = AddWave3DeadAnim, args = {}})
-  end
+  needToAct = index
 end
 
 function AddWave3DeadAnim()
@@ -859,7 +860,7 @@
   end
   if m4ChiefDead == 1 then
     DeleteGear(natives[chiefNum])
-    SetGearPosition(natives[girlNum], unpack(nativePos[buffaloNum]))
+    AnimSetGearPosition(natives[girlNum], unpack(nativePos[buffaloNum]))
     nativePos[girlNum] = nativePos[buffaloNum]
   end
   if m4BuffaloDead == 1 then
@@ -897,26 +898,28 @@
 
   AddTeam(loc("Assault Team"), 14483456, "Skull", "Island", "Pirate", "cm_vampire")
   for i = 1, 6 do
-    cannibals[i] = AddHog(cannibalNames[i], 1, 50, "vampirichog")
+--    cannibals[i] = AddHog(cannibalNames[i], 1, 50, "vampirichog")
+    cannibals[i] = AddHog(cannibalNames[i], 1, 5, "vampirichog")
   end
 
   AddTeam(loc("Reinforcements"), 14483456, "Skull", "Island", "Pirate", "cm_vampire")
   for i = 7, 9 do
-    cannibals[i] = AddHog(cannibalNames[i], 1, 50, "vampirichog")
+--    cannibals[i] = AddHog(cannibalNames[i], 1, 50, "vampirichog")
+    cannibals[i] = AddHog(cannibalNames[i], 1, 5, "vampirichog")
   end
 
   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
 
   for i = 1, 9 do
-    SetGearPosition(natives[i], unpack(nativePos[i]))
+    AnimSetGearPosition(natives[i], unpack(nativePos[i]))
     AnimTurn(natives[i], nativeDir[i])
   end
 
-  SetGearPosition(cyborg, 0, 0)
+  AnimSetGearPosition(cyborg, 0, 0)
 
   for i = 1, 9 do
-    SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
+    AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
     AnimTurn(cannibals[i], cannibalDir[i])
   end
 end
@@ -1060,6 +1063,22 @@
       AddFunction({func = AfterHogDeadAnim, args = {}})
     end
   end
+  if needToAct > 0 then
+    if needToAct == 1 then
+      RestoreWave(2)
+      SetupWave2Anim()
+      AddAnim(wave2Anim)
+      AddFunction({func = AfterWave2Anim, args = {}})
+    elseif needToAct == 2 then
+      SetupWave2DeadAnim()
+      AddAnim(wave2DeadAnim)
+      AddFunction({func = AfterWave2DeadAnim, args = {}})
+    elseif needToAct == 3 then
+      AnimSwitchHog(deployedHog)
+      AddFunction({func = AddWave3DeadAnim, args = {}})
+    end
+    needToAct = 0
+  end
 end
 
 function onGearDamage(gear, damage)
--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/dragon.lua	Fri Aug 10 00:20:52 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/dragon.lua	Fri Aug 10 04:26:58 2012 +0300
@@ -318,7 +318,7 @@
 end
 
 function SkipKilledAnim()
-  SetGearPosition(native, unpack(secondPos[1]))
+  AnimSetGearPosition(native, unpack(secondPos[1]))
   AnimSwitchHog(native)
   AnimWait(native, 1)
 end
@@ -359,6 +359,7 @@
   NullifyAmmo()
   RestoreHedge(cyborg)
   SetupKilledAnim()
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(killedAnim)
   AddFunction({func = AfterKilledAnim, args = {}})
 end
@@ -374,6 +375,7 @@
 
 function DoCratesTaken()
   SetupKillAnim()
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(killAnim)
   AddFunction({func = AfterKillAnim, args = {}})
 end
@@ -404,7 +406,7 @@
 end
 
 function DoRetry()
-  SetGearPosition(native, unpack(nativePos))
+  AnimSetGearPosition(native, unpack(nativePos))
   for i = 1, cratesNum do
     if gearDead[crates[i]] ~= true then
       DeleteGear(crates[i])
@@ -511,13 +513,13 @@
   cyborgsLeft = 4
 
   for i = 1, 7 do
-    SetGearPosition(natives[i], unpack(nativePos))
+    AnimSetGearPosition(natives[i], unpack(nativePos))
   end
 
-  SetGearPosition(cyborg, unpack(cyborgPos))
+  AnimSetGearPosition(cyborg, unpack(cyborgPos))
 
   for i = 1, 4 do
-    SetGearPosition(cyborgs[i], unpack(cyborgsPos[i]))
+    AnimSetGearPosition(cyborgs[i], unpack(cyborgsPos[i]))
     AnimTurn(cyborgs[i], cyborgsDir[i])
   end
 
--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/family.lua	Fri Aug 10 00:20:52 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/family.lua	Fri Aug 10 04:26:58 2012 +0300
@@ -281,6 +281,7 @@
 end
 
 function DoCyborgsDead()
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(midAnim)
   AddFunction({func = AfterMidAnim, args = {}})
 end
@@ -391,14 +392,14 @@
   cyborgsLeft = cyborgsNum
 
   for i = 1, 3 do
-    SetGearPosition(natives[i], unpack(nativePos[i]))
+    AnimSetGearPosition(natives[i], unpack(nativePos[i]))
   end
 
-  SetGearPosition(cyborg, unpack(cyborgPos))
-  SetGearPosition(princess, unpack(princessPos))
+  AnimSetGearPosition(cyborg, unpack(cyborgPos))
+  AnimSetGearPosition(princess, unpack(princessPos))
 
   for i = 1, cyborgsNum do
-    SetGearPosition(cyborgs[i], unpack(cyborgsPos[i]))
+    AnimSetGearPosition(cyborgs[i], unpack(cyborgsPos[i]))
     AnimTurn(cyborgs[i], cyborgsDir[i])
   end
 end
--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/first_blood.lua	Fri Aug 10 00:20:52 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/first_blood.lua	Fri Aug 10 04:26:58 2012 +0300
@@ -92,7 +92,7 @@
 
 function SkipOnShroom()
   Skipanim(onShroomAnim)
-  SetGearPosition(elderh, 2700, 1278)
+  AnimSetGearPosition(elderh, 2700, 1278)
 end
 
 function AnimationSetup()
@@ -322,6 +322,7 @@
 
 function DoOnShroom()
   ropeCrate1 = SpawnUtilityCrate(2751, 1194, amRope)
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(onShroomAnim)
   AddEvent(CheckOnFlower, {}, DoOnFlower, {}, 0)
 end
@@ -333,6 +334,7 @@
 function DoOnFlower()
   AddAmmo(youngh, amRope, 100)
   paraCrate = SpawnUtilityCrate(3245, 1758, amParachute)
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(onFlowerAnim)
   AddEvent(CheckTookParaCrate, {}, DoTookParaCrate, {}, 0)
 end
@@ -343,6 +345,7 @@
 
 function DoTookParaCrate()
   AddAmmo(youngh, amParachute, 100)
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(tookParaAnim)
   AddEvent(CheckOnMoleHead, {}, DoOnMoleHead, {}, 0)
   AddEvent(CheckPastMoleHead, {}, DoPastMoleHead, {}, 0)
@@ -363,6 +366,7 @@
   RemoveEventFunc(CheckOnMoleHead)
   ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope)
   AddAmmo(youngh, amRope, 0)
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(pastMoleHeadAnim)
   AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0)
 end
@@ -371,6 +375,7 @@
   RemoveEventFunc(CheckPastMoleHead)
   ropeCrate2 = SpawnUtilityCrate(2782, 1720, amRope)
   AddAmmo(youngh, amRope, 0)
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(onMoleHeadAnim)
   AddEvent(CheckTookRope2, {}, DoTookRope2, {}, 0)
 end
@@ -381,6 +386,7 @@
 
 function DoTookRope2()
   AddAmmo(youngh, amRope, 100)
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(tookRope2Anim)
   punchCrate = SpawnAmmoCrate(2460, 1321, amFirePunch)
   AddEvent(CheckTookPunch, {}, DoTookPunch, {})
@@ -393,6 +399,7 @@
 function DoTookPunch()
   AddAmmo(youngh, amFirePunch, 100)
   AddAmmo(youngh, amRope, 0)
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(tookPunchAnim)
   targets[1] = AddGear(1594, 1185, gtTarget, 0, 0, 0, 0)
   targets[2] = AddGear(2188, 1314, gtTarget, 0, 0, 0, 0)
@@ -407,6 +414,7 @@
 end
 
 function DoTargDestroyed()
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(challengeAnim)
   targetsDestroyed = 0
   AddFunction({func = SetChoice, args = {}})
@@ -443,6 +451,7 @@
 
 function DoChallengeWon()
   desertCrate = SpawnAmmoCrate(1240, 1212, amDEagle)
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(challengeCompletedAnim)
   AddEvent(CheckDesertColled, {}, DoDesertColled, {}, 0)
 end
@@ -469,6 +478,7 @@
 
 function DoChallengeFailed()
   challengeFailed = false
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(challengeFailedAnim)
   chalTries = chalTries + 1
   difficulty = 0
@@ -498,6 +508,7 @@
     RemoveEventFunc(CheckTargetsKilled)
     SetState(cannibal, gstVisible)
     cannibalVisible = true
+    SetGearMessage(CurrentHedgehog, 0)
     AddAnim(beforeKillAnim)
     AddEvent(CheckCloseToCannibal, {}, DoCloseToCannibal, {}, 0)
     AddEvent(CheckCannibalKilled, {}, DoCannibalKilled, {}, 0)
@@ -514,6 +525,7 @@
 end
 
 function DoCloseToCannibal()
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(closeCannim)
   AddFunction({func = SpawnAmmoCrate, args = {targetPosX[1][1], targetPosY[1][1], amWhip}})
   AddFunction({func = SpawnAmmoCrate, args = {targetPosX[1][2], targetPosY[1][2], amBaseballBat}})
@@ -599,16 +611,16 @@
 	youngh = AddHog(loc("Leaks A Lot"), 0, 100, "Rambo")
   elderh = AddHog(loc("Righteous Beard"), 0, 99, "IndianChief")
   princess = AddHog(loc("Fell From Heaven"), 0, 300, "tiara")
-  SetGearPosition(princess, 1911, 1361)
+  AnimSetGearPosition(princess, 1911, 1361)
   HogTurnLeft(princess, true)
-  SetGearPosition(elderh, 2667, 1208)
+  AnimSetGearPosition(elderh, 2667, 1208)
   HogTurnLeft(elderh, true)
-  SetGearPosition(youngh, 1862, 1362)
+  AnimSetGearPosition(youngh, 1862, 1362)
   HogTurnLeft(youngh, false)
 
   AddTeam(loc("Cannibals"), 14483456, "Skull", "Island", "Pirate","cm_vampire")
   cannibal = AddHog(loc("Brainiac"), 0, 5, "Zombi")
-  SetGearPosition(cannibal, 525, 1256)
+  AnimSetGearPosition(cannibal, 525, 1256)
   HogTurnLeft(cannibal, false)
   
   AnimInit()
--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/journey.lua	Fri Aug 10 00:20:52 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/journey.lua	Fri Aug 10 04:26:58 2012 +0300
@@ -87,7 +87,7 @@
   SetupCourse()
   for i = 5, 8 do
     RestoreHog(cannibals[i])
-    SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
+    AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
   end
 
   AddAmmo(cannibals[5], amDEagle, 0)
@@ -101,7 +101,7 @@
   TurnTimeLeft = TurnTime
   ShowMission(loc("The Journey Back"), loc("Collateral Damage"), loc("Save the princess by collecting the crate in under 12 turns!"), 0, 6000)
   -----------------------///////////////------------
-  --SetGearPosition(leaks, 417, 1800)
+  --AnimSetGearPosition(leaks, 417, 1800)
 end
 
 function SkipEndAnimAlone()
@@ -113,8 +113,8 @@
     RestoreHog(princess)
     princessHidden = false
   end
-  SetGearPosition(cyborg, 437, 1700)
-  SetGearPosition(princess, 519, 1722)
+  AnimSetGearPosition(cyborg, 437, 1700)
+  AnimSetGearPosition(princess, 519, 1722)
 end
 
 function SkipEndAnimDuo()
@@ -126,10 +126,10 @@
     RestoreHog(princess)
     princessHidden = false
   end
-  SetGearPosition(cyborg, 437, 1700)
-  SetGearPosition(princess, 519, 1722)
-  SetGearPosition(leaks, 763, 1760)
-  SetGearPosition(dense, 835, 1519)
+  AnimSetGearPosition(cyborg, 437, 1700)
+  AnimSetGearPosition(princess, 519, 1722)
+  AnimSetGearPosition(leaks, 763, 1760)
+  AnimSetGearPosition(dense, 835, 1519)
   HogTurnLeft(leaks, true)
   HogTurnLeft(dense, true)
 end
@@ -157,7 +157,7 @@
 end
 
 function SkipMidAnimAlone()
-  SetGearPosition(leaks, 2656, 1842)
+  AnimSetGearPosition(leaks, 2656, 1842)
   AnimSwitchHog(leaks)
   SetInputMask(0xFFFFFFFF)
   if princessHidden == false then
@@ -238,7 +238,7 @@
 end
 
 function SkipPastFlowerAnim()
-  SetGearPosition(dense, 2656, 1842)
+  AnimSetGearPosition(dense, 2656, 1842)
   AnimSwitchHog(dense)
   if cyborgHidden == false then
     HideHog(cyborg)
@@ -259,7 +259,7 @@
 end
 
 function SkipOutPitAnim()
-  SetGearPosition(dense, unpack(midDensePosDuo))
+  AnimSetGearPosition(dense, unpack(midDensePosDuo))
   AnimSwitchHog(dense)
   if cyborgHidden == false then
     HideHog(cyborg)
@@ -637,16 +637,16 @@
   SetTimer(AddGear(2201, 1321, gtMine, 0, 0, 0, 0), 3000)
   SetTimer(AddGear(2239, 1295, gtMine, 0, 0, 0, 0), 3000)
 
-  SetGearPosition(leaks, 3781, 1583)
-  --SetGearPosition(leaks, 1650, 1583)
+  AnimSetGearPosition(leaks, 3781, 1583)
+  --AnimSetGearPosition(leaks, 1650, 1583)
   AddAmmo(cannibals[1], amShotgun, 100)
   AddAmmo(leaks, amSwitch, 0)
 end
 
 function SetupPlaceDuo()
   PlaceCratesDuo()
-  SetGearPosition(leaks, unpack(startLeaksPosDuo))
-  SetGearPosition(dense, unpack(startDensePosDuo))
+  AnimSetGearPosition(leaks, unpack(startLeaksPosDuo))
+  AnimSetGearPosition(dense, unpack(startDensePosDuo))
 end
 
 function SetupEventsDuo()
@@ -944,22 +944,22 @@
   cannibals = {}
   for i = 1, 4 do
     cannibals[i] = AddHog(cannibalNames[i], 3, 40, "Zombi")
-    SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
+    AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
   end
 
   for i = 5, 8 do
     cannibals[i] = AddHog(cannibalNames[i], 3, 40, "Zombi")
-    SetGearPosition(cannibals[i], 0, 0)
+    AnimSetGearPosition(cannibals[i], 0, 0)
   end
 
   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
   cyborg = AddHog(loc("Y3K1337"), 0, 200, "cyborg1")
   princess = AddHog(loc("Fell From Heaven"), 0, 200, "tiara")
 
-  SetGearPosition(dense, 0, 0)
-  SetGearPosition(leaks, 0, 0)
-  SetGearPosition(cyborg, 0, 0)
-  SetGearPosition(princess, 0, 0)
+  AnimSetGearPosition(dense, 0, 0)
+  AnimSetGearPosition(leaks, 0, 0)
+  AnimSetGearPosition(cyborg, 0, 0)
+  AnimSetGearPosition(princess, 0, 0)
   
   AnimInit()
 end
--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/queen.lua	Fri Aug 10 00:20:52 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/queen.lua	Fri Aug 10 04:26:58 2012 +0300
@@ -618,7 +618,7 @@
   end
   for i = 1, 4 do 
     if GetHogName(natives[i]) == GetHogName(enemy) then
-      SetGearPosition(enemy, GetGearPosition(natives[i]))
+      AnimSetGearPosition(enemy, GetGearPosition(natives[i]))
       DeleteGear(natives[i])
       DeleteGear(cyborgs[cyborgsLeft])
     end
@@ -679,14 +679,14 @@
   enemy = AddHog(loc("Name"), 2, 200, "cyborg1")
 
   for i = 1, nativesNum do
-    SetGearPosition(natives[i], unpack(nativePos[i]))
+    AnimSetGearPosition(natives[i], unpack(nativePos[i]))
   end
 
-  SetGearPosition(enemy, unpack(enemyPos))
+  AnimSetGearPosition(enemy, unpack(enemyPos))
   AnimTurn(enemy, "Left")
 
   for i = 1, cyborgsNum do
-    SetGearPosition(cyborgs[i], unpack(cyborgsPos[i]))
+    AnimSetGearPosition(cyborgs[i], unpack(cyborgsPos[i]))
     AnimTurn(cyborgs[i], cyborgsDir[i])
   end
 end
--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua	Fri Aug 10 00:20:52 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua	Fri Aug 10 04:26:58 2012 +0300
@@ -105,9 +105,9 @@
 
 function SkipRefusedAnim()
   RefusedStart()
-  SetGearPosition(dense, 2645, 1146)
-  SetGearPosition(ramon, 2218, 1675)
-  SetGearPosition(spiky, 2400, 1675)
+  AnimSetGearPosition(dense, 2645, 1146)
+  AnimSetGearPosition(ramon, 2218, 1675)
+  AnimSetGearPosition(spiky, 2400, 1675)
 end
 
 function AfterStartDialogue()
@@ -145,7 +145,7 @@
       RestoreHog(cannibals[i])
       isHidden[cannibals[i]] = false
     end
-    SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
+    AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
     SetState(cannibals[i], 0)
   end
   SetInputMask(0xFFFFFFFF)
@@ -171,7 +171,7 @@
       RestoreHog(cannibals[i])
       isHidden[cannibals[i]] = false
     end
-    SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
+    AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
     SetState(cannibals[i], 0)
   end
   if cyborgHidden == true then
@@ -180,17 +180,17 @@
   end
   SetState(cyborg, 0)
   SetState(dense, 0)
-  SetGearPosition(dense, 1350, 1310)
+  AnimSetGearPosition(dense, 1350, 1310)
   FollowGear(dense)
   HogTurnLeft(dense, true)
-  SetGearPosition(cyborg, 1250, 1310)
+  AnimSetGearPosition(cyborg, 1250, 1310)
   SwitchHog(dense)
   SetInputMask(0xFFFFFFFF)
 end
 
 function RestartReturnAccepted()
   retryReturn = false
-  SetGearPosition(dense, 1350, 1310)
+  AnimSetGearPosition(dense, 1350, 1310)
   AddAmmo(dense, amGirder, 2)
   AddAmmo(dense, amParachute, 2)
   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)
@@ -215,7 +215,7 @@
 end
 
 function SkipAcceptedAnim()
-  SetGearPosition(cyborg, unpack(cyborgPos))
+  AnimSetGearPosition(cyborg, unpack(cyborgPos))
   SetState(cyborg, gstInvisible)
   AnimSwitchHog(dense)
   SetInputMask(0xFFFFFFFF)
@@ -241,7 +241,7 @@
   SpawnAmmoCrate(3551, 994, amGrenade)
   SpawnAmmoCrate(3392, 1101, amShotgun)
   SpawnAmmoCrate(3192, 1101, amShotgun)
-  SetGearPosition(cyborg, unpack(cyborgPos))
+  AnimSetGearPosition(cyborg, unpack(cyborgPos))
   SetState(cyborg, gstInvisible)
   AnimSwitchHog(leaks)
   SetInputMask(0xFFFFFFFF)
@@ -517,19 +517,19 @@
   HogTurnLeft(leaks, true)
 
   for i = 2, 9 do
-    SetGearPosition(cannibals[i], unpack(cyborgPos))
+    AnimSetGearPosition(cannibals[i], unpack(cyborgPos))
     AnimTurn(cannibals[i], "Left")
     cannibalDead[i] = false
   end
 
-  SetGearPosition(cannibals[1], cannibalPos[1][1], cannibalPos[1][2])
+  AnimSetGearPosition(cannibals[1], cannibalPos[1][1], cannibalPos[1][2])
   AnimTurn(cannibals[1], "Left")
 
-  SetGearPosition(cyborg, cyborgPos[1], cyborgPos[2])
-  SetGearPosition(ramon, 2218, 1675)
-  SetGearPosition(skiky, 2400, 1675)
-  SetGearPosition(dense, densePos[1], densePos[2])
-  SetGearPosition(leaks, leaksPos[1], leaksPos[2]) 
+  AnimSetGearPosition(cyborg, cyborgPos[1], cyborgPos[2])
+  AnimSetGearPosition(ramon, 2218, 1675)
+  AnimSetGearPosition(skiky, 2400, 1675)
+  AnimSetGearPosition(dense, densePos[1], densePos[2])
+  AnimSetGearPosition(leaks, leaksPos[1], leaksPos[2]) 
 end
 
 function VisiblizeHogs()
@@ -592,6 +592,7 @@
 end
 
 function ChoiceTaken()
+  SetGearMessage(CurrentHedgehog, 0)
   if choice == choiceAccept then
     AddAnim(acceptedAnim)
     AddFunction({func = AfterAcceptedAnim, args = {}})
@@ -617,6 +618,7 @@
 
 function DoBrainiacDead()
   TurnTimeLeft = 0
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(weaklingsAnim)
   AddFunction({func = AfterWeaklingsAnim, args = {}})
   stage = interSpyStage
@@ -633,6 +635,7 @@
 
 function DoWeaklingsKilled()
   TurnTimeLeft = 0
+  SetGearMessage(CurrentHedgehog, 0)
   AddAnim(stronglingsAnim)
   AddFunction({func = AfterStronglingsAnim, args = {}})
   stage = interWeakStage
@@ -713,6 +716,7 @@
 end
 
 function DoStronglingsDead()
+  SetGearMessage(CurrentHedgehog, 0)
   if denseDead == true then
     AddAnim(acceptedDiedFinalAnim)
     SaveCampaignVar("M2DenseDead", "1")
--- a/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/united.lua	Fri Aug 10 00:20:52 2012 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/united.lua	Fri Aug 10 04:26:58 2012 +0300
@@ -53,7 +53,7 @@
 end
 
 function SkipStartAnim()
-  SetGearPosition(water, 2467, 754)
+  AnimSetGearPosition(water, 2467, 754)
   if cratesSpawned[1] ~= true then
     SpawnCrates(1)
   end
@@ -319,17 +319,17 @@
   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
 
-  SetGearPosition(leaks,   unpack(leaksPos))
-  SetGearPosition(dense,   unpack(densePos))
-  SetGearPosition(water,   unpack(waterPos))
+  AnimSetGearPosition(leaks,   unpack(leaksPos))
+  AnimSetGearPosition(dense,   unpack(densePos))
+  AnimSetGearPosition(water,   unpack(waterPos))
   HogTurnLeft(water, true)
-  SetGearPosition(buffalo, unpack(buffaloPos))
+  AnimSetGearPosition(buffalo, unpack(buffaloPos))
   HogTurnLeft(buffalo, true)
-  SetGearPosition(chief,   unpack(chiefPos))
+  AnimSetGearPosition(chief,   unpack(chiefPos))
   HogTurnLeft(chief, true)
-  SetGearPosition(cyborg, 0, 0)
+  AnimSetGearPosition(cyborg, 0, 0)
   for i = 1, 8 do
-    SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
+    AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
   end
 end
 
--- a/share/hedgewars/Data/Scripts/Animate.lua	Fri Aug 10 00:20:52 2012 +0300
+++ b/share/hedgewars/Data/Scripts/Animate.lua	Fri Aug 10 04:26:58 2012 +0300
@@ -181,18 +181,26 @@
   return false
 end
 
+function AnimSetGearPosition(gear, destX, destY, fall)
+  SetGearPosition(gear, destX, destY)
+  if fall ~= false then
+    SetGearVelocity(gear, 0, 10)
+  end
+  return true
+end
+
 function AnimDisappear(gear, destX, destY)
 	AddVisualGear(GetX(gear)-5, GetY(gear)-5, vgtSmoke, 0, false)
 	AddVisualGear(GetX(gear)+5, GetY(gear)+5, vgtSmoke, 0, false)
 	AddVisualGear(GetX(gear)-5, GetY(gear)+5, vgtSmoke, 0, false)
 	AddVisualGear(GetX(gear)+5, GetY(gear)-5, vgtSmoke, 0, false)
   PlaySound(sndExplosion)
-	SetGearPosition(gear, destX, destY)
+	AnimSetGearPosition(gear, destX, destY)
   return true
 end
 
 function AnimOutOfNowhere(gear, destX, destY)
-  SetGearPosition(gear, destX, destY)
+  AnimSetGearPosition(gear, destX, destY)
   AddVisualGear(destX, destY, vgtBigExplosion, 0, false)
   PlaySound(sndExplosion)
   AnimGearWait(gear, 50)
@@ -204,7 +212,7 @@
 	AddVisualGear(GetX(gear)+5, GetY(gear)+5, vgtSmoke, 0, false)
 	AddVisualGear(GetX(gear)-5, GetY(gear)+5, vgtSmoke, 0, false)
 	AddVisualGear(GetX(gear)+5, GetY(gear)-5, vgtSmoke, 0, false)
-	SetGearPosition(gear, destX, destY)
+	AnimSetGearPosition(gear, destX, destY)
 	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
   PlaySound(sndExplosion)
   FollowGear(gear)
@@ -212,11 +220,6 @@
   return true
 end
 
-function AnimSetGearPosition(gear, x, y)
-  SetGearPosition(gear, x, y)
-  return true
-end
-
 function AnimVisualGear(gear, x, y, vgType, state, critical, follow)
   local vgear = AddVisualGear(x, y, vgType, state, critical)
   if follow == true then