add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
authornemo
Sat, 02 Jun 2012 16:25:13 -0400
changeset 7165 aad1aea05f1e
parent 7164 fad64b97947e
child 7167 0b3b306f129a
add onGameTick20 to basic training, extend laser sight out way more (it was visible at top when completely zoomed out), move call of new turn to after AfterSwitchHedgehog to avoid lua issues in onNewTurn - if this causes problems, lua can do delayed actions in onGameTick
hedgewars/uGears.pas
hedgewars/uGearsRender.pas
share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Cluster_Bomb.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Shotgun.lua
share/hedgewars/Data/Missions/Training/Basic_Training_-_Sniper_Rifle.lua
--- a/hedgewars/uGears.pas	Fri Jun 01 12:42:44 2012 +0400
+++ b/hedgewars/uGears.pas	Sat Jun 02 16:25:13 2012 -0400
@@ -363,11 +363,11 @@
 
                 FreeActionsList; // could send -left, -right and similar commands, so should be called before /nextturn
 
-                ParseCommand('/nextturn', true);
                 SwitchHedgehog;
 
                 AfterSwitchHedgehog;
-                bBetweenTurns:= false
+                bBetweenTurns:= false;
+                ParseCommand('/nextturn', true)
                 end;
             step:= Low(step)
             end;
--- a/hedgewars/uGearsRender.pas	Fri Jun 01 12:42:44 2012 +0400
+++ b/hedgewars/uGearsRender.pas	Sat Jun 02 16:25:13 2012 -0400
@@ -321,8 +321,8 @@
                 // reached edge of land. assume infinite beam. Extend it way out past camera
                 if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then
                     begin
-                    tx:= round(lx + ax * (LAND_WIDTH div 4));
-                    ty:= round(ly + ay * (LAND_WIDTH div 4));
+                    tx:= round(lx + ax * (LAND_WIDTH div 2));
+                    ty:= round(ly + ay * (LAND_WIDTH div 2));
                     end;
 
                 //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua	Fri Jun 01 12:42:44 2012 +0400
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Bazooka.lua	Sat Jun 02 16:25:13 2012 -0400
@@ -111,11 +111,11 @@
 -- Note that there are 1000 ticks within one second.
 -- You shouldn't try to calculate too complicated
 -- code here as this might slow down your game.
-function onGameTick()
+function onGameTick20()
 	-- If time's up, set the game to be lost.
 	-- We actually check the time to be "1 ms" as it
 	-- will be at "0 ms" right at the start of the game.
-	if TurnTimeLeft == 1 and score < score_goal then
+	if TurnTimeLeft < 40 and TurnTimeLeft > 0 and score < score_goal then
 		game_lost = true
 		-- ... and show a short message.
 		ShowMission(loc("Bazooka Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0)
@@ -133,7 +133,7 @@
 			EndGame()
 		else
 			-- ... or just lower the timer by 1.
-			end_timer = end_timer - 1
+			end_timer = end_timer - 20
 			-- Reset the time left to stop the timer
 			TurnTimeLeft = time_goal
 		end
@@ -150,8 +150,8 @@
 -- This function is called when a new gear is added.
 -- We don't need it for this training, so we can
 -- keep it empty.
-function onGearAdd(gear)
-end
+-- function onGearAdd(gear)
+-- end
 
 -- This function is called before a gear is destroyed.
 -- We use it to count the number of targets destroyed.
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Cluster_Bomb.lua	Fri Jun 01 12:42:44 2012 +0400
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Cluster_Bomb.lua	Sat Jun 02 16:25:13 2012 -0400
@@ -63,9 +63,9 @@
 
 end
 
-function onGameTick()
+function onGameTick20()
 
-	if TurnTimeLeft == 1 and scored < 12 and game_lost == false then
+	if TurnTimeLeft < 40 and TurnTimeLeft > 0 and scored < 12 and game_lost == false then
 		game_lost = true
 		ShowMission(loc("Cluster Bomb Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0)
 		SetHealth(player, 0)
@@ -76,7 +76,7 @@
 		if end_timer == 0 then
 			EndGame()
 		else
-			end_timer = end_timer - 1
+			end_timer = end_timer - 20
 			TurnTimeLeft = time_goal
 		end
 	end
@@ -87,8 +87,8 @@
 	ParseCommand("setweap " .. string.char(amClusterBomb))
 end
 
-function onGearAdd(gear)
-end
+--function onGearAdd(gear)
+--end
 
 function onGearDamage(gear, damage)
 
@@ -120,4 +120,4 @@
 end
 
 function onGearDelete(gear)
-end
\ No newline at end of file
+end
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua	Fri Jun 01 12:42:44 2012 +0400
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Grenade.lua	Sat Jun 02 16:25:13 2012 -0400
@@ -114,11 +114,11 @@
 -- Note that there are 1000 ticks within one second.
 -- You shouldn't try to calculate too complicated
 -- code here as this might slow down your game.
-function onGameTick()
+function onGameTick20()
 	-- If time's up, set the game to be lost.
 	-- We actually check the time to be "1 ms" as it
 	-- will be at "0 ms" right at the start of the game.
-	if TurnTimeLeft == 1 and score < score_goal then
+	if TurnTimeLeft < 40 and TurnTimeLeft > 0 and score < score_goal then
 		game_lost = true
 		-- ... and show a short message.
 		ShowMission(loc("Grenade Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0)
@@ -145,7 +145,7 @@
 			end
 		else
 			-- ... or just lower the timer by 1.
-			end_timer = end_timer - 1
+			end_timer = end_timer - 20
 			-- Reset the time left to stop the timer
 			TurnTimeLeft = time_goal
 		end
@@ -162,8 +162,8 @@
 -- This function is called when a new gear is added.
 -- We don't need it for this training, so we can
 -- keep it empty.
-function onGearAdd(gear)
-end
+-- function onGearAdd(gear)
+-- end
 
 -- This function is called before a gear is destroyed.
 -- We use it to count the number of targets destroyed.
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua	Fri Jun 01 12:42:44 2012 +0400
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Rope.lua	Sat Jun 02 16:25:13 2012 -0400
@@ -128,8 +128,8 @@
 	ParseCommand( "setweap " .. string.char( amRope ) ) -- Set the default weapon to Rope
 end
 
-function onGameTick()
-	if TurnTimeLeft == 1 then -- Round starts at 0, so we check if the round is finished by using 1
+function onGameTick20()
+	if TurnTimeLeft < 40 and TurnTimeLeft > 0 then -- Round starts at 0, so we check if the round is finished by using 1
 		GameLost = true -- You lost the game
 		Info( "Aiming Practice", "You did not make it in time, try again!", -amSkip )
 		SetHealth( Player, 0 ) -- Kill the player so he can't keep moving!
@@ -151,7 +151,7 @@
 
 			WaitTime = -1
 		else
-			WaitTime = WaitTime - 1
+			WaitTime = WaitTime - 20
 		end
 	end
 
@@ -161,7 +161,7 @@
 			FollowTime = 1500
 			FollowGear( Player )
 		else
-			FollowTime = FollowTime - 1
+			FollowTime = FollowTime - 20
 		end
 	end
 
@@ -172,7 +172,7 @@
 		end
 	end
 
-	GetTime = GetTime + 1
+	GetTime = GetTime + 20
 
 	CheckPosition( Player, 70 ) -- Run the CheckPosition function to check if the player is close to a target
 end
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Shotgun.lua	Fri Jun 01 12:42:44 2012 +0400
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Shotgun.lua	Sat Jun 02 16:25:13 2012 -0400
@@ -111,11 +111,11 @@
 -- Note that there are 1000 ticks within one second.
 -- You shouldn't try to calculate too complicated
 -- code here as this might slow down your game.
-function onGameTick()
+function onGameTick20()
 	-- If time's up, set the game to be lost.
 	-- We actually check the time to be "1 ms" as it
 	-- will be at "0 ms" right at the start of the game.
-	if TurnTimeLeft == 1 and score < score_goal then
+	if TurnTimeLeft < 40 and TurnTimeLeft > 20 and score < score_goal then
 		game_lost = true
 		-- ... and show a short message.
 		ShowMission(loc("Shotgun Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0)
@@ -133,7 +133,7 @@
 			EndGame()
 		else
 			-- ... or just lower the timer by 1.
-			end_timer = end_timer - 1
+			end_timer = end_timer - 20
 			-- Reset the time left to stop the timer
 			TurnTimeLeft = time_goal
 		end
@@ -150,8 +150,8 @@
 -- This function is called when a new gear is added.
 -- We don't need it for this training, so we can
 -- keep it empty.
-function onGearAdd(gear)
-end
+-- function onGearAdd(gear)
+-- end
 
 -- This function is called before a gear is destroyed.
 -- We use it to count the number of targets destroyed.
--- a/share/hedgewars/Data/Missions/Training/Basic_Training_-_Sniper_Rifle.lua	Fri Jun 01 12:42:44 2012 +0400
+++ b/share/hedgewars/Data/Missions/Training/Basic_Training_-_Sniper_Rifle.lua	Sat Jun 02 16:25:13 2012 -0400
@@ -112,7 +112,7 @@
 -- Note that there are 1000 ticks within one second.
 -- You shouldn't try to calculate too complicated
 -- code here as this might slow down your game.
-function onGameTick()
+function onGameTick20()
 	if game_lost then
 		return
 	end
@@ -127,7 +127,7 @@
 	-- If time's up, set the game to be lost.
 	-- We actually check the time to be "1 ms" as it
 	-- will be at "0 ms" right at the start of the game.
-	if TurnTimeLeft == 1 and score < score_goal then
+	if TurnTimeLeft < 40 and TurnTimeLeft > 0 and score < score_goal then
 		game_lost = true
 		-- ... and show a short message.
 		ShowMission(loc("Sniper Training"), loc("Aiming Practice"), loc("Oh no! Time's up! Just try again."), -amSkip, 0)
@@ -145,7 +145,7 @@
 			EndGame()
 		else
 			-- ... or just lower the timer by 1.
-			end_timer = end_timer - 1
+			end_timer = end_timer - 20
 			-- Reset the time left to stop the timer
 			TurnTimeLeft = time_goal
 		end
@@ -162,8 +162,8 @@
 -- This function is called when a new gear is added.
 -- We don't need it for this training, so we can
 -- keep it empty.
-function onGearAdd(gear)
-end
+-- function onGearAdd(gear)
+-- end
 
 -- This function is called before a gear is destroyed.
 -- We use it to count the number of targets destroyed.