CTF_Blizzard: Dump dead code / out-commented code
authorWuzzy <Wuzzy2@mail.ru>
Thu, 08 Mar 2018 15:15:11 +0100
changeset 13121 3b7cd18c4a06
parent 13120 64d84011a48e
child 13122 cd1561b0337f
CTF_Blizzard: Dump dead code / out-commented code
share/hedgewars/Data/Maps/CTF_Blizzard/map.lua
--- a/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Thu Mar 08 15:05:42 2018 +0100
+++ b/share/hedgewars/Data/Maps/CTF_Blizzard/map.lua	Thu Mar 08 15:15:11 2018 +0100
@@ -115,7 +115,6 @@
 local numhhs = 0 -- store number of hedgehogs
 local hhs = {} -- store hedgehog gears
 
-local numTeams --  store the number of teams in the game
 local teamNameArr = {}	-- store the list of teams
 local teamSize = {}	-- store how many hogs per team
 local teamIndex = {} -- at what point in the hhs{} does each team begin
@@ -135,8 +134,6 @@
 
 local fThiefX = {}
 local fThiefY = {}
-local FTTC = 0 -- flag thief tracker counter
---local fThiefsHealed = false
 
 local fSpawnC = {}
 local fCirc = {} -- flag/carrier marker circles
@@ -160,7 +157,6 @@
 
 local redTel
 local orangeTel
---local areaArr = {} -- no longer used
 
 local zXMin = {}
 local zWidth = {}
@@ -176,20 +172,19 @@
 
 function ManageTeleporterEffects()
 	effectTimer = effectTimer + 1
-	if effectTimer > 50 then -- 100
+	if effectTimer > 50 then
 		effectTimer = 0
 
 		for i = 0,1 do
-			eX = 10 + zXMin[i] + GetRandom(zWidth[i]-10)
-			eY = 50 + zYMin[i] + GetRandom(zHeight[i]-110)
+			local eX = 10 + zXMin[i] + GetRandom(zWidth[i]-10)
+			local eY = 50 + zYMin[i] + GetRandom(zHeight[i]-110)
 
-	-- steam and smoke and DUST look good, smokering looks trippy
-	-- smoketrace and eviltrace are not effected by wind?
-	-- chunk is a LR falling gear
-			tempE = AddVisualGear(eX, eY, vgtDust, 0, false)
+			-- steam and smoke and DUST look good, smokering looks trippy
+			-- smoketrace and eviltrace are not effected by wind?
+			-- chunk is a LR falling gear
+			local tempE = AddVisualGear(eX, eY, vgtDust, 0, false)
 			if tempE ~= 0 then
-				g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
-				SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, g8, g9, fCol[i])
+				SetVisualGearValues(tempE, eX, eY, nil, nil, nil, nil, nil, nil, nil, fCol[i])
 			end
 		end
 	end
@@ -227,6 +222,7 @@
 
 function CheckScore(teamID)
 
+	local alt
 	if teamID == 0 then
 		alt = 1
 
@@ -264,6 +260,7 @@
 
 function FlagDeleted(gear)
 
+	local wtf, bbq
 	PlaySound(sndShotgunReload)
 	if (gear == fGear[0]) then
 		wtf = 0
@@ -273,11 +270,8 @@
 		bbq = 0
 	end
 
-	--ShowMission("OH HAI!", "FlagDeleted was called", "Oh noes!", -amBazooka, 0)
-
 	if CurrentHedgehog ~= nil then
 
-		--ShowMission("GUESS WAT?", "I'm not nil", "Oh noes!", -amBazooka, 0)
 		--if the player picks up the flag
 		if CheckDistance(CurrentHedgehog, fGear[wtf]) < 1600 then
 
@@ -289,7 +283,7 @@
 				fNeedsRespawn[wtf] = true
 				fIsMissing[bbq] = false
 				fNeedsRespawn[bbq] = true
-				fCaptures[wtf] = fCaptures[wtf] +1					--fCaptures[wtf]
+				fCaptures[wtf] = fCaptures[wtf] +1
 
 				AddCaption(string.format(loc("%s has scored!"), GetHogTeamName(CurrentHedgehog)), 0xFFFFFFFF, capgrpGameState)
 				for i=1, #clanTeams[wtf] do
@@ -297,7 +291,6 @@
 				end
 
 				PlaySound(sndHomerun)
-				--SetEffect(fThief[bbq], hePoisoned, false)
 				fThief[bbq] = nil -- player no longer has the enemy flag
 				CheckScore(wtf)
 
@@ -314,16 +307,12 @@
 					AddCaption(loc("That was pointless. The flag will respawn next round."))
 				end
 
-				--fIsMissing[wtf] = false
-				--ShowMission("Flag returned!", "Hooray", "", -amBazooka, 0)
-
 			--if the player is taking the enemy flag
 			elseif GetHogClan(CurrentHedgehog) == bbq then
 				fIsMissing[wtf] = true
 				for i = 0,numhhs-1 do
 					if CurrentHedgehog == hhs[i] then
 						fThief[wtf] = hhs[i]
-						--SetEffect(fThief[wtf], hePoisoned, true)
 					end
 				end
 
@@ -355,7 +344,6 @@
 	-- probably only gets called if the flag thief drowns himself
 	-- otherwise the above one will work fine
 	else
-		--ShowMission("NIL PLAYER!", "Oh snap", "Oh noes!", -amBazooka, 0)
 		fGear[wtf] = nil
 		fIsMissing[wtf] = true
 		fNeedsRespawn[wtf] = true
@@ -366,6 +354,7 @@
 
 function FlagThiefDead(gear)
 
+	local wtf, bbq
 	if (gear == fThief[0]) then
 		wtf = 0
 		bbq = 1
@@ -392,14 +381,11 @@
 
 	for i = 0, 1 do
 		if fIsMissing[i] == false then -- draw a circle at the flag's spawning place
-			--SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i])
 			SetVisualGearValues(fCirc[i], fSpawnX[i],fSpawnY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
 		elseif (fIsMissing[i] == true) and (fNeedsRespawn[i] == false) then
 			if fThief[i] ~= nil then -- draw circle round flag carrier
-				--SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], 20, 200, 0, 0, 100, 33, 2, fCol[i])
 				SetVisualGearValues(fCirc[i], fThiefX[i], fThiefY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
 			elseif fThief[i] == nil then -- draw cirle round dropped flag
-				--SetVisualGearValues(fCirc[i], GetX(fGear[i]), GetY(fGear[i]), 20, 200, 0, 0, 100, 33, 2, fCol[i])
 				SetVisualGearValues(fCirc[i], GetX(fGear[i]),GetY(fGear[i]), vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
 			end
 		end
@@ -417,16 +403,12 @@
 
 function CheckDistance(gear1, gear2)
 
-	g1X, g1Y = GetGearPosition(gear1)
-	g2X, g2Y = GetGearPosition(gear2)
+	local g1X, g1Y = GetGearPosition(gear1)
+	local g2X, g2Y = GetGearPosition(gear2)
 
 	g1X = g1X - g2X
 	g1Y = g1Y - g2Y
-	z = (g1X*g1X) + (g1Y*g1Y)
-
-	--dist = math.sqrt(z)
-
-	dist = z
+	local dist = (g1X*g1X) + (g1Y*g1Y)
 
 	return dist
 
@@ -434,7 +416,7 @@
 
 function CheckTeleporters()
 
-	teleportActive = false
+	local teleportActive = false
 
 	if (GearIsInZone(CurrentHedgehog, redTel) == true) and (GetHogClan(CurrentHedgehog) == 0) then
 		teleportActive = true
@@ -483,10 +465,9 @@
 		teamIndex[i] = 0
 		SetTeamLabel(teamNameArr[i], "0")
 	end
-	numTeams = TeamsCount
 
 	-- find out how many hogs per team, and the index of the first hog in hhs
-	for i = 0, numTeams-1 do
+	for i = 0, TeamsCount-1 do
 
 		for z = 0, numhhs-1 do
 			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
@@ -553,7 +534,6 @@
 	MinesNum = 0 -- The number of mines being placed
 	MinesTime  = 2000
 	Explosives = 0 -- The number of explosives being placed
-	Delay = 10 -- The delay between each round
 	-- Disable Sudden Death
 	WaterRise = 0
 	HealthDecrease = 0
@@ -575,9 +555,8 @@
 
 	--new improved placement schematics aw yeah
 	RebuildTeamInfo()
-	--ShowMission("Team Info Rebuilt", "Here you go:", "TeamCount: " .. TeamsCount .. "|" .. teamNameArr[0] .. ": " .. teamSize[0] .. " Hogs|" .. teamNameArr[1] .. ": " .. teamSize[1] .. " Hogs|" .. teamNameArr[2] .. ": " .. teamSize[2] .. " Hogs|", 0, 0)
-	team1Placed = 0
-	team2Placed = 0
+	local team1Placed = 0
+	local team2Placed = 0
 	for i = 0, (TeamsCount-1) do
 		for g = teamIndex[i], (teamIndex[i]+teamSize[i]-1) do
 			if GetHogClan(hhs[g]) == 0 then
@@ -600,7 +579,6 @@
 
 	--spawn starting ufos and or super weapons
 	SpawnSupplyCrate(2048,1858,amJetpack)
-	--SpawnSupplyCrate(2048,1858,amExtraTime)
 
 	--set flag spawn points and spawn the flags
 	fSpawnX[0] = 957
@@ -639,25 +617,9 @@
 
 function onNewTurn()
 
-	if lastTeam ~= GetHogTeamName(CurrentHedgehog) then
-		lastTeam = GetHogTeamName(CurrentHedgehog)
-	end
-
-	for i = 0, 1 do
-		if fThief[i] ~= nil then
-			--adjust = 5 + GetHealth(fThief[i])
-			--SetHealth(fThief[i], adjust)
-			--AddCaption('Helped out the flag poisoned flag thiefs')
-		end
-	end
-
-	--AddCaption("Handling respawns")
 	HandleRespawns()
 	HandleCrateDrops()
 
-	--myC = AddVisualGear(GetX(CurrentHedgehog),GetY(CurrentHedgehog),vgtCircle,0,true)
-	--SetVisualGearValues(myC, GetX(CurrentHedgehog),GetY(CurrentHedgehog), 20, 200, 0, 0, 100, 50, 3, GetClanColor(GetHogClan(CurrentHedgehog)))
-
 end
 
 function onGameTick()
@@ -665,21 +627,16 @@
 	-- onRessurect calls AFTER you have resurrected,
 	-- so keeping track of x,y a few milliseconds before
 	-- is useful
-	--FTTC = FTTC + 1
-	--if FTTC == 100 then
-	--	FTTC = 0
-		for i = 0,1 do
-			if fThief[i] ~= nil then
-				fThiefX[i] = GetX(fThief[i])
-				fThiefY[i] = GetY(fThief[i])
-			end
+
+	for i = 0,1 do
+		if fThief[i] ~= nil then
+			fThiefX[i] = GetX(fThief[i])
+			fThiefY[i] = GetY(fThief[i])
 		end
-	--end
+	end
 
 	-- things we wanna check often
 	if (CurrentHedgehog ~= nil) then
-		--AddCaption(GetX(CurrentHedgehog) .. "; " .. GetY(CurrentHedgehog))
-		--AddCaption("Checking Teleporters")
 		CheckTeleporters()
 	end
 
@@ -697,14 +654,11 @@
 	SetAmmo(amGrenade,9,0,0,0)
 	SetAmmo(amClusterBomb,4,0,0,0)
 
-	--SetAmmo(amDEagle, 4, 0, 0, 0)
 	SetAmmo(amShotgun, 9, 0, 0, 0)
 	SetAmmo(amFlamethrower, 1, 0, 0, 1)
 
 	SetAmmo(amFirePunch, 9, 0, 0, 0)
 	SetAmmo(amBaseballBat, 2, 0, 0, 0)
-	--SetAmmo(amKamikaze, 2, 0, 0, 0)
-
 
 	SetAmmo(amDynamite,2,0,0,1)
 	SetAmmo(amSMine,4,0,0,0)
@@ -729,8 +683,6 @@
 
 function onGearResurrect(gear)
 
-	--AddCaption("A gear has been resurrected!")
-
 	-- mark the flag thief as dead if he needed a respawn
 	for i = 0,1 do
 		if gear == fThief[i] then
@@ -749,17 +701,6 @@
 
 end
 
-function onGearDamage(gear, damage)
-
-	-- >_< damn, occurs too fast, before the hog has finished moving / updated his health
-	--if GetGearType(gear) == gtHedgehog then
-	--	if damage > GetHealth(gear) then
-	--		AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
-	--	end
-	--end
-
-end
-
 function onGearAdd(gear)
 
 	if GetGearType(gear) == gtHedgehog then