share/hedgewars/Data/Missions/Campaign/A Classic Fairytale/shadow.lua
changeset 7448 d0521a3a4358
parent 7425 3495e70c6d14
child 7502 16c36f62247b
equal deleted inserted replaced
7443:a7f861f1c3b8 7448:d0521a3a4358
   103   SetGearMessage(leaks, 0)
   103   SetGearMessage(leaks, 0)
   104 end
   104 end
   105 
   105 
   106 function SkipRefusedAnim()
   106 function SkipRefusedAnim()
   107   RefusedStart()
   107   RefusedStart()
   108   SetGearPosition(dense, 2645, 1146)
   108   AnimSetGearPosition(dense, 2645, 1146)
   109   SetGearPosition(ramon, 2218, 1675)
   109   AnimSetGearPosition(ramon, 2218, 1675)
   110   SetGearPosition(spiky, 2400, 1675)
   110   AnimSetGearPosition(spiky, 2400, 1675)
   111 end
   111 end
   112 
   112 
   113 function AfterStartDialogue()
   113 function AfterStartDialogue()
   114   stage = spyStage
   114   stage = spyStage
   115   ShowMission(loc("The Shadow Falls"), loc("Play with me!"), loc("Defend yourself!|Hint: You can get tips on using weapons by moving your mouse over them in the weapon selection menu"), 1, 6000)
   115   ShowMission(loc("The Shadow Falls"), loc("Play with me!"), loc("Defend yourself!|Hint: You can get tips on using weapons by moving your mouse over them in the weapon selection menu"), 1, 6000)
   143   for i = 2, 5 do
   143   for i = 2, 5 do
   144     if isHidden[cannibals[i]] == true then
   144     if isHidden[cannibals[i]] == true then
   145       RestoreHog(cannibals[i])
   145       RestoreHog(cannibals[i])
   146       isHidden[cannibals[i]] = false
   146       isHidden[cannibals[i]] = false
   147     end
   147     end
   148     SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
   148     AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
   149     SetState(cannibals[i], 0)
   149     SetState(cannibals[i], 0)
   150   end
   150   end
   151   SetInputMask(0xFFFFFFFF)
   151   SetInputMask(0xFFFFFFFF)
   152 end
   152 end
   153 
   153 
   169   for i = 6, 9 do
   169   for i = 6, 9 do
   170     if isHidden[cannibals[i]] == true then
   170     if isHidden[cannibals[i]] == true then
   171       RestoreHog(cannibals[i])
   171       RestoreHog(cannibals[i])
   172       isHidden[cannibals[i]] = false
   172       isHidden[cannibals[i]] = false
   173     end
   173     end
   174     SetGearPosition(cannibals[i], unpack(cannibalPos[i]))
   174     AnimSetGearPosition(cannibals[i], unpack(cannibalPos[i]))
   175     SetState(cannibals[i], 0)
   175     SetState(cannibals[i], 0)
   176   end
   176   end
   177   if cyborgHidden == true then
   177   if cyborgHidden == true then
   178     RestoreHog(cyborg)
   178     RestoreHog(cyborg)
   179     cyborgHidden = false
   179     cyborgHidden = false
   180   end
   180   end
   181   SetState(cyborg, 0)
   181   SetState(cyborg, 0)
   182   SetState(dense, 0)
   182   SetState(dense, 0)
   183   SetGearPosition(dense, 1350, 1310)
   183   AnimSetGearPosition(dense, 1350, 1310)
   184   FollowGear(dense)
   184   FollowGear(dense)
   185   HogTurnLeft(dense, true)
   185   HogTurnLeft(dense, true)
   186   SetGearPosition(cyborg, 1250, 1310)
   186   AnimSetGearPosition(cyborg, 1250, 1310)
   187   SwitchHog(dense)
   187   SwitchHog(dense)
   188   SetInputMask(0xFFFFFFFF)
   188   SetInputMask(0xFFFFFFFF)
   189 end
   189 end
   190 
   190 
   191 function RestartReturnAccepted()
   191 function RestartReturnAccepted()
   192   retryReturn = false
   192   retryReturn = false
   193   SetGearPosition(dense, 1350, 1310)
   193   AnimSetGearPosition(dense, 1350, 1310)
   194   AddAmmo(dense, amGirder, 2)
   194   AddAmmo(dense, amGirder, 2)
   195   AddAmmo(dense, amParachute, 2)
   195   AddAmmo(dense, amParachute, 2)
   196   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)
   196   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)
   197   RemoveEventFunc(CheckNeedGirder)
   197   RemoveEventFunc(CheckNeedGirder)
   198   RemoveEventFunc(CheckNeedWeapons)
   198   RemoveEventFunc(CheckNeedWeapons)
   213   AddEvent(CheckRestartReturnAccepted, {}, RestartReturnAccepted, {}, 1)
   213   AddEvent(CheckRestartReturnAccepted, {}, RestartReturnAccepted, {}, 1)
   214   RemoveEventFunc(CheckDenseDead)
   214   RemoveEventFunc(CheckDenseDead)
   215 end
   215 end
   216 
   216 
   217 function SkipAcceptedAnim()
   217 function SkipAcceptedAnim()
   218   SetGearPosition(cyborg, unpack(cyborgPos))
   218   AnimSetGearPosition(cyborg, unpack(cyborgPos))
   219   SetState(cyborg, gstInvisible)
   219   SetState(cyborg, gstInvisible)
   220   AnimSwitchHog(dense)
   220   AnimSwitchHog(dense)
   221   SetInputMask(0xFFFFFFFF)
   221   SetInputMask(0xFFFFFFFF)
   222 end
   222 end
   223 
   223 
   239   end
   239   end
   240   SpawnAmmoCrate(2551, 994, amGrenade)
   240   SpawnAmmoCrate(2551, 994, amGrenade)
   241   SpawnAmmoCrate(3551, 994, amGrenade)
   241   SpawnAmmoCrate(3551, 994, amGrenade)
   242   SpawnAmmoCrate(3392, 1101, amShotgun)
   242   SpawnAmmoCrate(3392, 1101, amShotgun)
   243   SpawnAmmoCrate(3192, 1101, amShotgun)
   243   SpawnAmmoCrate(3192, 1101, amShotgun)
   244   SetGearPosition(cyborg, unpack(cyborgPos))
   244   AnimSetGearPosition(cyborg, unpack(cyborgPos))
   245   SetState(cyborg, gstInvisible)
   245   SetState(cyborg, gstInvisible)
   246   AnimSwitchHog(leaks)
   246   AnimSwitchHog(leaks)
   247   SetInputMask(0xFFFFFFFF)
   247   SetInputMask(0xFFFFFFFF)
   248 end
   248 end
   249 
   249 
   515 
   515 
   516 function PlaceHogs()
   516 function PlaceHogs()
   517   HogTurnLeft(leaks, true)
   517   HogTurnLeft(leaks, true)
   518 
   518 
   519   for i = 2, 9 do
   519   for i = 2, 9 do
   520     SetGearPosition(cannibals[i], unpack(cyborgPos))
   520     AnimSetGearPosition(cannibals[i], unpack(cyborgPos))
   521     AnimTurn(cannibals[i], "Left")
   521     AnimTurn(cannibals[i], "Left")
   522     cannibalDead[i] = false
   522     cannibalDead[i] = false
   523   end
   523   end
   524 
   524 
   525   SetGearPosition(cannibals[1], cannibalPos[1][1], cannibalPos[1][2])
   525   AnimSetGearPosition(cannibals[1], cannibalPos[1][1], cannibalPos[1][2])
   526   AnimTurn(cannibals[1], "Left")
   526   AnimTurn(cannibals[1], "Left")
   527 
   527 
   528   SetGearPosition(cyborg, cyborgPos[1], cyborgPos[2])
   528   AnimSetGearPosition(cyborg, cyborgPos[1], cyborgPos[2])
   529   SetGearPosition(ramon, 2218, 1675)
   529   AnimSetGearPosition(ramon, 2218, 1675)
   530   SetGearPosition(skiky, 2400, 1675)
   530   AnimSetGearPosition(skiky, 2400, 1675)
   531   SetGearPosition(dense, densePos[1], densePos[2])
   531   AnimSetGearPosition(dense, densePos[1], densePos[2])
   532   SetGearPosition(leaks, leaksPos[1], leaksPos[2]) 
   532   AnimSetGearPosition(leaks, leaksPos[1], leaksPos[2]) 
   533 end
   533 end
   534 
   534 
   535 function VisiblizeHogs()
   535 function VisiblizeHogs()
   536   for i = 1, 9 do
   536   for i = 1, 9 do
   537     SetState(cannibals[i], gstInvisible)
   537     SetState(cannibals[i], gstInvisible)
   590   cyborgHidden = false
   590   cyborgHidden = false
   591   SetState(cyborg, gstInvisible)
   591   SetState(cyborg, gstInvisible)
   592 end
   592 end
   593 
   593 
   594 function ChoiceTaken()
   594 function ChoiceTaken()
       
   595   SetGearMessage(CurrentHedgehog, 0)
   595   if choice == choiceAccept then
   596   if choice == choiceAccept then
   596     AddAnim(acceptedAnim)
   597     AddAnim(acceptedAnim)
   597     AddFunction({func = AfterAcceptedAnim, args = {}})
   598     AddFunction({func = AfterAcceptedAnim, args = {}})
   598   elseif choice == choiceRefuse then
   599   elseif choice == choiceRefuse then
   599     AddAnim(refusedAnim)
   600     AddAnim(refusedAnim)
   615   return brainiacDead
   616   return brainiacDead
   616 end
   617 end
   617 
   618 
   618 function DoBrainiacDead()
   619 function DoBrainiacDead()
   619   TurnTimeLeft = 0
   620   TurnTimeLeft = 0
       
   621   SetGearMessage(CurrentHedgehog, 0)
   620   AddAnim(weaklingsAnim)
   622   AddAnim(weaklingsAnim)
   621   AddFunction({func = AfterWeaklingsAnim, args = {}})
   623   AddFunction({func = AfterWeaklingsAnim, args = {}})
   622   stage = interSpyStage
   624   stage = interSpyStage
   623 end
   625 end
   624   
   626   
   631   return true
   633   return true
   632 end
   634 end
   633 
   635 
   634 function DoWeaklingsKilled()
   636 function DoWeaklingsKilled()
   635   TurnTimeLeft = 0
   637   TurnTimeLeft = 0
       
   638   SetGearMessage(CurrentHedgehog, 0)
   636   AddAnim(stronglingsAnim)
   639   AddAnim(stronglingsAnim)
   637   AddFunction({func = AfterStronglingsAnim, args = {}})
   640   AddFunction({func = AfterStronglingsAnim, args = {}})
   638   stage = interWeakStage
   641   stage = interWeakStage
   639   ParseCommand("teamgone " .. loc("Weaklings"))
   642   ParseCommand("teamgone " .. loc("Weaklings"))
   640 end
   643 end
   711   SetGearMessage(dense, 0)
   714   SetGearMessage(dense, 0)
   712   TurnTimeLeft = TurnTime
   715   TurnTimeLeft = TurnTime
   713 end
   716 end
   714 
   717 
   715 function DoStronglingsDead()
   718 function DoStronglingsDead()
       
   719   SetGearMessage(CurrentHedgehog, 0)
   716   if denseDead == true then
   720   if denseDead == true then
   717     AddAnim(acceptedDiedFinalAnim)
   721     AddAnim(acceptedDiedFinalAnim)
   718     SaveCampaignVar("M2DenseDead", "1")
   722     SaveCampaignVar("M2DenseDead", "1")
   719   else
   723   else
   720     SetupAcceptedSurvivedFinalAnim()
   724     SetupAcceptedSurvivedFinalAnim()