share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/backstab.lua
changeset 7448 d0521a3a4358
parent 7425 3495e70c6d14
child 7463 bd5c7b8db666
equal deleted inserted replaced
7443:a7f861f1c3b8 7448:d0521a3a4358
    69 speakerHog = nil
    69 speakerHog = nil
    70 spyHog = nil
    70 spyHog = nil
    71 deployedHog = nil
    71 deployedHog = nil
    72 
    72 
    73 cyborgHidden = false
    73 cyborgHidden = false
       
    74 needToAct = 0
    74 
    75 
    75 m2Choice = 0
    76 m2Choice = 0
    76 m2DenseDead = 0
    77 m2DenseDead = 0
    77 m4DenseDead = 0
    78 m4DenseDead = 0
    78 m4BuffaloDead = 0
    79 m4BuffaloDead = 0
    93 afterChoiceAnim = {}
    94 afterChoiceAnim = {}
    94 wave2Anim = {}
    95 wave2Anim = {}
    95 wave2DeadAnim = {}
    96 wave2DeadAnim = {}
    96 wave3DeadAnim = {}
    97 wave3DeadAnim = {}
    97 
    98 
       
    99 vCircs = {}
    98 -----------------------------Animations--------------------------------
   100 -----------------------------Animations--------------------------------
    99 function Wave2Reaction()
   101 function Wave2Reaction()
   100   local i = 1
   102   local i = 1
   101   local gearr = nil
   103   local gearr = nil
   102   while nativeDead[i] == true do
   104   while nativeDead[i] == true do
   215 end
   217 end
   216 
   218 
   217 function ExplainAlive()
   219 function ExplainAlive()
   218   if needRevival == true and m4WaterDead == 1 then
   220   if needRevival == true and m4WaterDead == 1 then
   219     RestoreCyborg()
   221     RestoreCyborg()
   220     SetGearPosition(cyborg, unpack(cyborgPos))
   222     AnimSetGearPosition(cyborg, unpack(cyborgPos))
   221     AnimInsertStepNext({func = AnimCustomFunction, args = {water, HideCyborg, {}}})
   223     AnimInsertStepNext({func = AnimCustomFunction, args = {water, HideCyborg, {}}})
   222     AnimInsertStepNext({func = AnimSwitchHog, args = {water}})
   224     AnimInsertStepNext({func = AnimSwitchHog, args = {water}})
   223     AnimInsertStepNext({func = AnimSay, args = {cyborg, loc("The answer is...entertaintment. You'll see what I mean."), SAY_SAY, 8000}})
   225     AnimInsertStepNext({func = AnimSay, args = {cyborg, loc("The answer is...entertaintment. You'll see what I mean."), SAY_SAY, 8000}})
   224     AnimInsertStepNext({func = AnimSay, args = {cyborg, loc("You're probably wondering why I bought you back..."), SAY_SAY, 8000}})
   226     AnimInsertStepNext({func = AnimSay, args = {cyborg, loc("You're probably wondering why I bought you back..."), SAY_SAY, 8000}})
   225   end
   227   end
   302   table.insert(wave2Anim, {func = AnimOutOfNowhere, args = {cannibals[6], unpack(cannibalPos[6])}})
   304   table.insert(wave2Anim, {func = AnimOutOfNowhere, args = {cannibals[6], unpack(cannibalPos[6])}})
   303   table.insert(wave2Anim, {func = AnimSay, args = {speakerHog, loc("Look out! There's more of them!"), SAY_SHOUT, 5000}})
   305   table.insert(wave2Anim, {func = AnimSay, args = {speakerHog, loc("Look out! There's more of them!"), SAY_SHOUT, 5000}})
   304   AddSkipFunction(wave2Anim, SkipWave2Anim, {})
   306   AddSkipFunction(wave2Anim, SkipWave2Anim, {})
   305 end
   307 end
   306 
   308 
       
   309 function PutCircles()
       
   310   if circlesPut then
       
   311     return
       
   312   end
       
   313   vCircs[1] = AddVisualGear(0,0,vgtCircle,0,true)
       
   314   vCircs[2] = AddVisualGear(0,0,vgtCircle,0,true)
       
   315   vCircs[3] = AddVisualGear(0,0,vgtCircle,0,true)
       
   316   SetVisualGearValues(vCircs[1], cannibalPos[7][1], cannibalPos[7][2], 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
       
   317   SetVisualGearValues(vCircs[2], cannibalPos[8][1], cannibalPos[8][2], 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
       
   318   SetVisualGearValues(vCircs[3], cannibalPos[9][1], cannibalPos[9][2], 100, 255, 1, 10, 0, 120, 3, 0xff00ffff)
       
   319   circlesPut = true
       
   320 end
       
   321 
   307 function SetupWave2DeadAnim()
   322 function SetupWave2DeadAnim()
   308   for i = 7, 1, -1 do
   323   for i = 7, 1, -1 do
   309     if nativeDead[i] ~= true then
   324     if nativeDead[i] ~= true then
   310       deployedHog = natives[i]
   325       deployedHog = natives[i]
   311     end
   326     end
   319       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("Oh, silly me! I forgot that I'm the shaman."), SAY_THINK, 6000}})
   334       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("Oh, silly me! I forgot that I'm the shaman."), SAY_THINK, 6000}})
   320       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], TeleportNatives, {}}})
   335       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], TeleportNatives, {}}})
   321       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], TurnNatives, {natives[wiseNum]}}})
   336       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], TurnNatives, {natives[wiseNum]}}})
   322       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], CondNeedToTurn, {natives[wiseNum], deployedHog}}})
   337       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], CondNeedToTurn, {natives[wiseNum], deployedHog}}})
   323       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I sense another wave of cannibals heading our way!"), SAY_SAY, 6500}})
   338       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I sense another wave of cannibals heading our way!"), SAY_SAY, 6500}})
   324       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I feel something...a place! They will arrive near the graves!"), SAY_SAY, 7500}})
   339       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I feel something...a place! They will arrive near the circles!"), SAY_SAY, 7500}})
   325       table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[7][1], cannibalPos[7][2], gtGrave, 0, 0, 0, 0}})
   340       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], PutCircles, {}}})
   326       table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[8][1], cannibalPos[8][2], gtGrave, 0, 0, 0, 0}})
   341       table.insert(wave2DeadAnim, {func = AnimFollowGear, swh = false, args = {vCircs[1]}})
   327       table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[9][1], cannibalPos[9][2], gtGrave, 0, 0, 0, 0}})
   342       table.insert(wave2DeadAnim, {func = AnimWait, args = {natives[wiseNum], 1500}})
   328       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("We need to prevent their arrival!"), SAY_SAY, 4500}})
   343       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("We need to prevent their arrival!"), SAY_SAY, 4500}})
   329       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("Go, quick!"), SAY_SAY, 2500}})
   344       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("Go, quick!"), SAY_SAY, 2500}})
   330       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], DeployHog, {}}})
   345       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], DeployHog, {}}})
   331       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], RestoreCyborg, {}}})
   346       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], RestoreCyborg, {}}})
   332       table.insert(wave2DeadAnim, {func = AnimOutOfNowhere, swh = false, args = {cyborg, cyborgPos2[1], cyborgPos2[2]}})
   347       table.insert(wave2DeadAnim, {func = AnimOutOfNowhere, swh = false, args = {cyborg, cyborgPos2[1], cyborgPos2[2]}})
   340       table.insert(wave2DeadAnim, {func = AnimCustomFunction, swh = false, args = {cyborg, HideCyborg, {}}})
   355       table.insert(wave2DeadAnim, {func = AnimCustomFunction, swh = false, args = {cyborg, HideCyborg, {}}})
   341     else
   356     else
   342       table.insert(wave2DeadAnim, {func = AnimWait, args = {natives[wiseNum], 1500}})
   357       table.insert(wave2DeadAnim, {func = AnimWait, args = {natives[wiseNum], 1500}})
   343       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("What a strange feeling!"), SAY_THINK, 3000}})
   358       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("What a strange feeling!"), SAY_THINK, 3000}})
   344       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I sense another wave of cannibals heading my way!"), SAY_THINK, 6500}})
   359       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I sense another wave of cannibals heading my way!"), SAY_THINK, 6500}})
   345       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I feel something...a place! They will arrive near the graves!"), SAY_SAY, 7500}})
   360       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I feel something...a place! They will arrive near the circles!"), SAY_SAY, 7500}})
   346       table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[7][1], cannibalPos[7][2], gtGrave, 0, 0, 0, 0}})
   361       table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], PutCircles, {}}})
   347       table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[8][1], cannibalPos[8][2], gtGrave, 0, 0, 0, 0}})
   362       table.insert(wave2DeadAnim, {func = AnimFollowGear, swh = false, args = {vCircs[1]}})
   348       table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[9][1], cannibalPos[9][2], gtGrave, 0, 0, 0, 0}})
       
   349       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I need to prevent their arrival!"), SAY_THINK, 4500}})
   363       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("I need to prevent their arrival!"), SAY_THINK, 4500}})
   350       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("If only I had a way..."), SAY_THINK, 3000}})
   364       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("If only I had a way..."), SAY_THINK, 3000}})
   351       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("Oh, silly me! I forgot that I'm the shaman."), SAY_THINK, 6000}})
   365       table.insert(wave2DeadAnim, {func = AnimSay, args = {natives[wiseNum], loc("Oh, silly me! I forgot that I'm the shaman."), SAY_THINK, 6000}})
   352     end
   366     end
   353   else
   367   else
   354     table.insert(wave2DeadAnim, {func = AnimWait, args = {cyborg, 1500}})
   368     table.insert(wave2DeadAnim, {func = AnimWait, args = {cyborg, 1500}})
   355     table.insert(wave2DeadAnim, {func = AnimCustomFunction, swh = false, args = {cyborg, RestoreCyborg, {}}})
   369     table.insert(wave2DeadAnim, {func = AnimCustomFunction, swh = false, args = {cyborg, RestoreCyborg, {}}})
   356     table.insert(wave2DeadAnim, {func = AnimOutOfNowhere, args = {cyborg, cyborgPos2[1], cyborgPos2[2]}})
   370     table.insert(wave2DeadAnim, {func = AnimOutOfNowhere, args = {cyborg, cyborgPos2[1], cyborgPos2[2]}})
       
   371     table.insert(wave2DeadAnim, {func = AnimTurn, args = {cyborg, "Left"}})
   357     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {cyborg, TeleportNatives, {}}})
   372     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {cyborg, TeleportNatives, {}}})
   358     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {cyborg, TurnNatives, {cyborg}}})
   373     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {cyborg, TurnNatives, {cyborg}}})
   359     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("Oh, my! This is even more entertaining than I've expected!"), SAY_SAY, 7500}})
   374     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("Oh, my! This is even more entertaining than I've expected!"), SAY_SAY, 7500}})
   360     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("You might want to find a way to instantly kill arriving cannibals!"), SAY_SAY, 8000}})
   375     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("You might want to find a way to instantly kill arriving cannibals!"), SAY_SAY, 8000}})
   361     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("I believe there's more of them."), SAY_SAY, 4000}})
   376     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("I believe there's more of them."), SAY_SAY, 4000}})
   362     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("I marked the place of their arrival. You're welcome!"), SAY_SAY, 6000}})
   377     table.insert(wave2DeadAnim, {func = AnimSay, args = {cyborg, loc("I marked the place of their arrival. You're welcome!"), SAY_SAY, 6000}})
   363     table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[7][1], cannibalPos[7][2], gtGrave, 0, 0, 0, 0}})
   378     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], PutCircles, {}}})
   364     table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[8][1], cannibalPos[8][2], gtGrave, 0, 0, 0, 0}})
   379     table.insert(wave2DeadAnim, {func = AnimFollowGear, swh = false, args = {vCircs[1]}})
   365     table.insert(wave2DeadAnim, {func = AddGear, swh = false, args = {cannibalPos[9][1], cannibalPos[9][2], gtGrave, 0, 0, 0, 0}})
       
   366     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {deployedHog, DeployHog, {}}})
   380     table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {deployedHog, DeployHog, {}}})
   367     if nativesNum > 1 then
   381     if nativesNum > 1 then
   368 --      table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], RestoreCyborg, {}}})
   382 --      table.insert(wave2DeadAnim, {func = AnimCustomFunction, args = {natives[wiseNum], RestoreCyborg, {}}})
   369 --      table.insert(wave2DeadAnim, {func = AnimOutOfNowhere, swh = false, args = {cyborg, cyborgPos2[1], cyborgPos2[2]}})
   383 --      table.insert(wave2DeadAnim, {func = AnimOutOfNowhere, swh = false, args = {cyborg, cyborgPos2[1], cyborgPos2[2]}})
   370 --      table.insert(wave2DeadAnim, {func = AnimTurn, args = {cyborg, "Left"}})
   384 --      table.insert(wave2DeadAnim, {func = AnimTurn, args = {cyborg, "Left"}})
   532 function SkipWave2DeadAnim()
   546 function SkipWave2DeadAnim()
   533   TeleportNatives()
   547   TeleportNatives()
   534   IsolateNatives()
   548   IsolateNatives()
   535   DeployHog()
   549   DeployHog()
   536   HideCyborg()
   550   HideCyborg()
   537   AddGear(cannibalPos[7][1], cannibalPos[7][2], gtGrave, 0, 0, 0, 0)
   551   PutCircles()
   538   AddGear(cannibalPos[8][1], cannibalPos[8][2], gtGrave, 0, 0, 0, 0)
       
   539   AddGear(cannibalPos[9][1], cannibalPos[9][2], gtGrave, 0, 0, 0, 0)
       
   540 end
   552 end
   541 
   553 
   542 function SpawnPlatformCrates()
   554 function SpawnPlatformCrates()
   543   SpawnAmmoCrate(2494, 1262, amMine)
   555   SpawnAmmoCrate(2494, 1262, amMine)
   544   SpawnAmmoCrate(2574, 1279, amSMine)
   556   SpawnAmmoCrate(2574, 1279, amSMine)
   567 function SkipWave2Anim()
   579 function SkipWave2Anim()
   568   AnimSwitchHog(speakerHog)
   580   AnimSwitchHog(speakerHog)
   569 end
   581 end
   570 
   582 
   571 function SkipStartAnim()
   583 function SkipStartAnim()
   572   SetGearPosition(natives[waterNum], nativePos[denseNum][1] + 50, nativePos[denseNum][2])
   584   AnimSetGearPosition(natives[waterNum], nativePos[denseNum][1] + 50, nativePos[denseNum][2])
   573   RestoreWave(1)
   585   RestoreWave(1)
   574   ReviveNatives()
   586   ReviveNatives()
   575   SetGearMessage(CurrentHedgehog, 0)
   587   SetGearMessage(CurrentHedgehog, 0)
   576   SetState(CurrentHedgehog, 0)
   588   SetState(CurrentHedgehog, 0)
   577   if m2Choice == choiceAccepted then
   589   if m2Choice == choiceAccepted then
   621   return false
   633   return false
   622 end
   634 end
   623 
   635 
   624 function DoChoice()
   636 function DoChoice()
   625   RemoveEventFunc(CheckChoiceRefuse)
   637   RemoveEventFunc(CheckChoiceRefuse)
       
   638   SetGearMessage(CurrentHedgehog, 0)
   626   SetupAfterChoiceAnim()
   639   SetupAfterChoiceAnim()
   627   AddAnim(afterChoiceAnim)
   640   AddAnim(afterChoiceAnim)
   628   AddFunction({func = AfterAfterChoiceAnim, args = {}})
   641   AddFunction({func = AfterAfterChoiceAnim, args = {}})
   629 end
   642 end
   630 
   643 
   660   return true
   673   return true
   661 end
   674 end
   662 
   675 
   663 function DoWaveDead(index)
   676 function DoWaveDead(index)
   664   TurnTimeLeft = 0
   677   TurnTimeLeft = 0
   665   if index == 1 then
   678   needToAct = index
   666     RestoreWave(2)
       
   667     SetupWave2Anim()
       
   668     AddAnim(wave2Anim)
       
   669     AddFunction({func = AfterWave2Anim, args = {}})
       
   670   elseif index == 2 then
       
   671     SetupWave2DeadAnim()
       
   672     AddAnim(wave2DeadAnim)
       
   673     AddFunction({func = AfterWave2DeadAnim, args = {}})
       
   674   elseif index == 3 then
       
   675     AnimSwitchHog(deployedHog)
       
   676     AddFunction({func = AddWave3DeadAnim, args = {}})
       
   677   end
       
   678 end
   679 end
   679 
   680 
   680 function AddWave3DeadAnim()
   681 function AddWave3DeadAnim()
   681   HideNatives()
   682   HideNatives()
   682   SetupWave3DeadAnim()
   683   SetupWave3DeadAnim()
   857     nativeHidden[waterNum] = true
   858     nativeHidden[waterNum] = true
   858     needRevival = true
   859     needRevival = true
   859   end
   860   end
   860   if m4ChiefDead == 1 then
   861   if m4ChiefDead == 1 then
   861     DeleteGear(natives[chiefNum])
   862     DeleteGear(natives[chiefNum])
   862     SetGearPosition(natives[girlNum], unpack(nativePos[buffaloNum]))
   863     AnimSetGearPosition(natives[girlNum], unpack(nativePos[buffaloNum]))
   863     nativePos[girlNum] = nativePos[buffaloNum]
   864     nativePos[girlNum] = nativePos[buffaloNum]
   864   end
   865   end
   865   if m4BuffaloDead == 1 then
   866   if m4BuffaloDead == 1 then
   866     DeleteGear(natives[buffaloNum])
   867     DeleteGear(natives[buffaloNum])
   867   end
   868   end
   895   end
   896   end
   896 
   897 
   897 
   898 
   898   AddTeam(loc("Assault Team"), 14483456, "Skull", "Island", "Pirate", "cm_vampire")
   899   AddTeam(loc("Assault Team"), 14483456, "Skull", "Island", "Pirate", "cm_vampire")
   899   for i = 1, 6 do
   900   for i = 1, 6 do
   900     cannibals[i] = AddHog(cannibalNames[i], 1, 50, "vampirichog")
   901 --    cannibals[i] = AddHog(cannibalNames[i], 1, 50, "vampirichog")
       
   902     cannibals[i] = AddHog(cannibalNames[i], 1, 5, "vampirichog")
   901   end
   903   end
   902 
   904 
   903   AddTeam(loc("Reinforcements"), 14483456, "Skull", "Island", "Pirate", "cm_vampire")
   905   AddTeam(loc("Reinforcements"), 14483456, "Skull", "Island", "Pirate", "cm_vampire")
   904   for i = 7, 9 do
   906   for i = 7, 9 do
   905     cannibals[i] = AddHog(cannibalNames[i], 1, 50, "vampirichog")
   907 --    cannibals[i] = AddHog(cannibalNames[i], 1, 50, "vampirichog")
       
   908     cannibals[i] = AddHog(cannibalNames[i], 1, 5, "vampirichog")
   906   end
   909   end
   907 
   910 
   908   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
   911   AddTeam(loc("011101001"), 14483456, "ring", "UFO", "Robot", "cm_star")
   909   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
   912   cyborg = AddHog(loc("Unit 334a$7%;.*"), 0, 200, "cyborg1")
   910 
   913 
   911   for i = 1, 9 do
   914   for i = 1, 9 do
   912     SetGearPosition(natives[i], unpack(nativePos[i]))
   915     AnimSetGearPosition(natives[i], unpack(nativePos[i]))
   913     AnimTurn(natives[i], nativeDir[i])
   916     AnimTurn(natives[i], nativeDir[i])
   914   end
   917   end
   915 
   918 
   916   SetGearPosition(cyborg, 0, 0)
   919   AnimSetGearPosition(cyborg, 0, 0)
   917 
   920 
   918   for i = 1, 9 do
   921   for i = 1, 9 do
   919     SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
   922     AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
   920     AnimTurn(cannibals[i], cannibalDir[i])
   923     AnimTurn(cannibals[i], cannibalDir[i])
   921   end
   924   end
   922 end
   925 end
   923 
   926 
   924 function CondNeedToTurn(hog1, hog2)
   927 function CondNeedToTurn(hog1, hog2)
  1058       SetupHogDeadAnim(freshDead)
  1061       SetupHogDeadAnim(freshDead)
  1059       AddAnim(hogDeadAnim)
  1062       AddAnim(hogDeadAnim)
  1060       AddFunction({func = AfterHogDeadAnim, args = {}})
  1063       AddFunction({func = AfterHogDeadAnim, args = {}})
  1061     end
  1064     end
  1062   end
  1065   end
       
  1066   if needToAct > 0 then
       
  1067     if needToAct == 1 then
       
  1068       RestoreWave(2)
       
  1069       SetupWave2Anim()
       
  1070       AddAnim(wave2Anim)
       
  1071       AddFunction({func = AfterWave2Anim, args = {}})
       
  1072     elseif needToAct == 2 then
       
  1073       SetupWave2DeadAnim()
       
  1074       AddAnim(wave2DeadAnim)
       
  1075       AddFunction({func = AfterWave2DeadAnim, args = {}})
       
  1076     elseif needToAct == 3 then
       
  1077       AnimSwitchHog(deployedHog)
       
  1078       AddFunction({func = AddWave3DeadAnim, args = {}})
       
  1079     end
       
  1080     needToAct = 0
       
  1081   end
  1063 end
  1082 end
  1064 
  1083 
  1065 function onGearDamage(gear, damage)
  1084 function onGearDamage(gear, damage)
  1066 end
  1085 end
  1067 
  1086