Fix resurrection animation appearing at wrong position for some missions and styles
authorWuzzy <Wuzzy2@mail.ru>
Tue, 07 Aug 2018 13:04:02 +0200
changeset 13635 fe7d2bbf5f3f
parent 13634 c9a49d06f1a2
child 13636 946b21a1fbf6
Fix resurrection animation appearing at wrong position for some missions and styles
ChangeLog.txt
share/hedgewars/Data/Maps/CTF_Blizzard/map.lua
share/hedgewars/Data/Maps/Control/map.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/Multiplayer/Capture_the_Flag.lua
share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
--- a/ChangeLog.txt	Tue Aug 07 12:15:59 2018 +0200
+++ b/ChangeLog.txt	Tue Aug 07 13:04:02 2018 +0200
@@ -70,6 +70,7 @@
  * A Space Adeventure: Fix clan membership of PAotH in main Death Planet mission
  * The Great Escape: Infinite attack mode did not work
  * Shotgun/Sniper Rifle Target Practicse: Suppress “X remaining” message
+ * Fix resurrection animation appearing at wrong position for some missions and styles
 
 Content:
  + New Sudden Death water texture for CrazyMission theme
--- a/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -677,7 +677,7 @@
 end
 
 
-function onGearResurrect(gear)
+function onGearResurrect(gear, vGear)
 
 	-- mark the flag thief as dead if he needed a respawn
 	for i = 0,1 do
@@ -693,7 +693,9 @@
 		FindPlace(gear, false, 2048, LAND_WIDTH)
 	end
 
-	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
+	if vGear then
+		SetVisualGearValues(vGear, GetX(gear), GetY(gear))
+	end
 
 end
 
--- a/share/hedgewars/Data/Maps/Control/map.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Maps/Control/map.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -474,10 +474,6 @@
 
 end
 
-function onGearResurrect(gear)
-	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
-end
-
 function InABetterPlaceNow(gear)
 	for i = 0, (numhhs-1) do
 		if gear == hhs[i] then
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -55,10 +55,13 @@
 	SendHealthStatsOff()
 end
 
-function onGearResurrect(gear)
+function onGearResurrect(gear, vGear)
 	if gear == hog then
 		flawless = false
 		SetGearPosition(hog, 1485, 2001)
+		if vGear then
+			SetVisualGearValues(vGear, GetX(hog), GetY(hog))
+		end
 		AddCaption(loc("Your hedgehog has been revived!"))
 	end
 end
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Flying_Saucer.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -549,10 +549,13 @@
 	end
 end
 
-function onGearResurrect(Gear)
+function onGearResurrect(Gear, VGear)
 	if Gear == Player then
 		AddCaption(loc("Oh no! You have died. Try again!"), 0xFFFFFFFF, capgrpMessage2)
 		ResetCurrentTarget()
+		if VGear then
+			SetVisualGearValues(VGear, GetX(Gear), GetY(Gear))
+		end
 	end
 end
 
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -47,10 +47,13 @@
 	SendHealthStatsOff()
 end
 
-function onGearResurrect(gear)
+function onGearResurrect(gear, vGear)
 	if gear == hog then
 		flawless = false
 		SetGearPosition(hog, 570, 157)
+		if vGear then
+			SetVisualGearValues(vGear, GetX(hog), GetY(hog))
+		end
 		AddCaption(loc("Your hedgehog has been revived!"))
 	end
 end
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Movement.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Movement.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -399,7 +399,7 @@
 	end
 end
 
-function onGearResurrect(gear)
+function onGearResurrect(gear, vGear)
 	AddCaption(loc("Your hedgehog has been revived!"))
 	if gear == hog_cappy then
 		SetGearPosition(gear, 404, 1714)
@@ -409,6 +409,9 @@
 		-- Generic teleport to Rhombus' cage
 		SetGearPosition(gear, 619, 1559)
 	end
+	if vGear then
+		SetVisualGearValues(vGear, GetX(gear), GetY(gear))
+	end
 	FollowGear(gear)
 end
 
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -267,10 +267,13 @@
 	end
 end
 
-function onGearResurrect(gear)
+function onGearResurrect(gear, vGear)
 	-- Teleport hog to previous checkpoint
 	if gear == hog then
 		SetGearPosition(hog, cpX, cpY)
+		if vGear then
+			SetVisualGearValues(vGear, GetX(hog), GetY(hog))
+		end
 		FollowGear(hog)
 		AddCaption(loc("Your hedgehog has been revived!"))
 		if isInMineChallenge then
--- a/share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Capture_the_Flag.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -570,7 +570,6 @@
 				FlagThiefDead(gear)
 			end
 		end
-		AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
 	end
 
 end
--- a/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Construction_Mode.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -1848,10 +1848,12 @@
 end
 
 
-function onGearResurrect(gear)
+function onGearResurrect(gear, vGear)
 	if GetGearType(gear) == gtHedgehog then
-		AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
 		FindRespawner(gear)
+		if vGear then
+			SetVisualGearValues(vGear, GetX(gear), GetY(gear))
+		end
 	end
 end
 
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -981,13 +981,14 @@
 	end
 end
 
-function onGearResurrect(gear)
-
-        AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
+function onGearResurrect(gear, vGear)
 
         if gear == CurrentHedgehog then
                 DisableTumbler(false)
         end
+        if vGear then
+                DeleteVisualGear(vGear)
+        end
 
 end
 
--- a/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua	Tue Aug 07 12:15:59 2018 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua	Tue Aug 07 13:04:02 2018 +0200
@@ -1110,13 +1110,14 @@
 
 end
 
-function onGearResurrect(gear)
-
-	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
+function onGearResurrect(gear, vGear)
 
 	if gear == CurrentHedgehog then
 	       DisableTumbler(false)
 	end
+	if vGear then
+		DeleteVisualGear(vGear)
+	end
 
 end