Add winner animation for missions that didn't have it
authorWuzzy <Wuzzy2@mail.ru>
Mon, 13 May 2019 21:23:25 +0200
changeset 14928 4c5fb1ee75b7
parent 14927 9d6a25239d00
child 14929 f112847eb93e
Add winner animation for missions that didn't have it
ChangeLog.txt
share/hedgewars/Data/Maps/ClimbHome/map.lua
share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua
share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua
share/hedgewars/Data/Missions/Challenge/User_Mission_-_That_Sinking_Feeling.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Movement.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua
share/hedgewars/Data/Scripts/SimpleMission.lua
share/hedgewars/Data/Scripts/SpeedShoppa.lua
share/hedgewars/Data/Scripts/TargetPractice.lua
--- a/ChangeLog.txt	Mon May 13 20:26:07 2019 +0200
+++ b/ChangeLog.txt	Mon May 13 21:23:25 2019 +0200
@@ -19,6 +19,7 @@
  * Deny placement of piano beyond bounce world edge
  * Fix cut scenes not being skipped when pressing precise in enemy turn
  * Fix laser sight not working properly when it starts out of map bounds
+ * Add missing winner animation in single missions
 
 Styles and schemes:
  + The Specialists: Unlock game scheme
@@ -139,6 +140,7 @@
  * Fix SetAmmoDelay not working properly when called after onGameStart
  * Fix DismissTeam not clearing team properly
  * SimpleMission: Fix Lua error spam when a custom goal fails
+ * gstWinner state is preserved after the game ended
 
 ====================== 0.9.25 ======================
 HIGHLIGHTS:
--- a/share/hedgewars/Data/Maps/ClimbHome/map.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Maps/ClimbHome/map.lua	Mon May 13 21:23:25 2019 +0200
@@ -441,7 +441,6 @@
                             string.format(loc("Ahhh, home, sweet home. Made it in %d seconds."), roundedFinishTime),
                             -amRope, 0)
                 PlaySound(sndVictory,CurrentHedgehog)
-                SetState(CurrentHedgehog, gstWinner)
                 SendStat(siGameResult, loc("You have beaten the challenge!"))
                 SendStat(siGraphTitle, loc("Your height over time"))
                 SendStat(siCustomAchievement, string.format(loc("%s reached home in %.3f seconds. Congratulations!"), GetHogName(CurrentHedgehog), finishTime))
@@ -452,6 +451,7 @@
                 SendStat(siPlayerKills, tostring(rawFinishTime), GetHogTeamName(CurrentHedgehog))
 
                 EndGame()
+                SetState(CurrentHedgehog, gstWinner)
                 onAchievementsDeclaration()
                 YouWon = true
             end
--- a/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Missions/Challenge/Basic_Training_-_Sniper_Rifle.lua	Mon May 13 21:23:25 2019 +0200
@@ -190,6 +190,9 @@
 			-- ... end the game ...
 			generateStats()
 			EndGame()
+			if score == score_goal then
+				SetState(CurrentHedgehog, gstWinner)
+			end
 		end
         	end_timer = end_timer - 20
 	end
--- a/share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Missions/Challenge/User_Mission_-_RCPlane_Challenge.lua	Mon May 13 21:23:25 2019 +0200
@@ -444,12 +444,10 @@
                                 string.format(loc("Planes used: %d"), planesUsed) .. "|" ..
                                 "", 0, 0
                                 )
-			SetState(player, gstWinner)
 			PlaySound(sound, player)
 
-
-			DismissTeam(playerTeamName)
 			EndGame()
+			SetState(player, gstWinner)
 		end
 
 		if RCGear ~= nil then
--- a/share/hedgewars/Data/Missions/Challenge/User_Mission_-_That_Sinking_Feeling.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Missions/Challenge/User_Mission_-_That_Sinking_Feeling.lua	Mon May 13 21:23:25 2019 +0200
@@ -264,6 +264,9 @@
 					awardAchievement(loc("Lively Lifeguard"))
 				end
 				EndGame()
+				for _, hog in pairs(hh) do
+					SetState(hog, gstWinner)
+				end
 
 			end
 
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua	Mon May 13 21:23:25 2019 +0200
@@ -230,6 +230,7 @@
 		SendStat(siGameResult, loc("You have completed the Basic Bazooka Training!"))
 		SendStat(siPlayerKills, "0", GetHogTeamName(hog))
 		EndGame()
+		SetState(hog, gstWinner)
 		gameOver = true
 	end
 	gamePhase = gamePhase + 1
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua	Mon May 13 21:23:25 2019 +0200
@@ -218,6 +218,7 @@
 
 	EndTurn(true)
 	EndGame()
+	SetState(Player, gstWinner)
 end,
 }
 
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua	Mon May 13 21:23:25 2019 +0200
@@ -200,6 +200,7 @@
 		SendStat(siPlayerKills, "0", GetHogTeamName(hog))
 		EndGame()
 		gameOver = true
+		SetState(hog, gstWinner)
 	end
 	gamePhase = gamePhase + 1
 end
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Movement.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Movement.lua	Mon May 13 21:23:25 2019 +0200
@@ -272,6 +272,9 @@
 	SetWeapon(amNothing)
 	SetGearMessage(CurrentHedgehog, band(GetGearMessage(CurrentHedgehog), bnot(gmAllStoppable)))
 	EndGame()
+	for i=1,#hhs do
+		SetState(hhs[i], gstWinner)
+	end
 end
 
 local function switchHedgehogText()
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua	Mon May 13 21:23:25 2019 +0200
@@ -352,6 +352,7 @@
 			SendStat(siGameResult, loc("You have finished the Basic Rope Training!"))
 			SendStat(siPlayerKills, "0", teamName)
 			EndGame()
+			SetState(hog, gstWinner)
 			gameOver = true
 			SetInputMask(0)
 		end
--- a/share/hedgewars/Data/Scripts/SimpleMission.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Scripts/SimpleMission.lua	Mon May 13 21:23:25 2019 +0200
@@ -522,13 +522,14 @@
 			end
 			AddCaption(loc("Victory!"), capcolDefault, capgrpGameState)
 			SendStat(siGameResult, loc("You win!"))
-			if GetHogLevel(CurrentHedgehog) == 0 then
-				SetState(CurrentHedgehog, bor(GetState(CurrentHedgehog), gstWinner))
-				SetState(CurrentHedgehog, band(GetState(CurrentHedgehog), bnot(gstHHDriven)))
-				PlaySound(sndVictory, CurrentHedgehog)
-			end
 			_G.sm.makeStats(_G.sm.playerClan)
 			EndGame()
+			if GetHogLevel(CurrentHedgehog) == 0 then
+				for team, hog in pairs(teamHogs[GetHogTeamName(CurrentHedgehog)]) do
+					SetState(hog, gstWinner)
+					PlaySound(sndVictory, hog)
+				end
+			end
 		end
 	end
 
--- a/share/hedgewars/Data/Scripts/SpeedShoppa.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Scripts/SpeedShoppa.lua	Mon May 13 21:23:25 2019 +0200
@@ -177,6 +177,9 @@
 			end
 			gameEnded = true
 			EndGame()
+			if cratesCollected == #crates then
+				SetState(playerHog, gstWinner)
+			end
 		end
 	end
 
--- a/share/hedgewars/Data/Scripts/TargetPractice.lua	Mon May 13 20:26:07 2019 +0200
+++ b/share/hedgewars/Data/Scripts/TargetPractice.lua	Mon May 13 21:23:25 2019 +0200
@@ -227,6 +227,9 @@
 			if end_timer == 0 then
 				generateStats()
 				EndGame()
+				if scored == total_targets then
+					SetState(player, gstWinner)
+				end
 			end
 			end_timer = end_timer - 20
 		end
@@ -272,7 +275,6 @@
 						PlaySound(sndVictory, player)
 					end
 					SetEffect(player, heInvulnerable, 1)
-					SetState(player, bor(GetState(player), gstWinner))
 					time_goal = TurnTimeLeft
 					-- Disable control
 					SetInputMask(0)