share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 15483 70aba717485a
parent 15413 ca8896b9c7c6
child 15485 91c972f126b7
equal deleted inserted replaced
15482:4cc9ec732392 15483:70aba717485a
    99 local wpX = {}
    99 local wpX = {}
   100 local wpY = {}
   100 local wpY = {}
   101 local wpCol = {}
   101 local wpCol = {}
   102 local wpActive = {}
   102 local wpActive = {}
   103 local wpRad = 450
   103 local wpRad = 450
       
   104 local WAYPOINT_RADIUS_MIN = 40
   104 local wpCount = 0
   105 local wpCount = 0
   105 local wpLimit = 8
   106 local wpLimit = 8
   106 
   107 
   107 local usedWeapons = {}
   108 local usedWeapons = {}
   108 
   109 
   191         if type(roundLimit) ~= "number" then
   192         if type(roundLimit) ~= "number" then
   192              roundLimit = 3
   193              roundLimit = 3
   193         end
   194         end
   194     end
   195     end
   195     if params["waypointradius"] ~= nil then
   196     if params["waypointradius"] ~= nil then
   196         wpRad = math.max(40, math.floor(tonumber(params["waypointradius"])))
   197         wpRad = math.max(WAYPOINT_RADIUS_MIN, math.floor(tonumber(params["waypointradius"])))
   197         if type(wpRad) ~= "number" then
   198         if type(wpRad) ~= "number" then
   198              wpRad = 450
   199              wpRad = 450
   199         end
   200         end
   200     end
   201     end
   201     if params["maxwaypoints"] ~= nil then
   202     if params["maxwaypoints"] ~= nil then
   633         	loc("Touch all waypoints as fast as you can!"),
   634         	loc("Touch all waypoints as fast as you can!"),
   634 		1, 4000)
   635 		1, 4000)
   635 end
   636 end
   636 
   637 
   637 function onGameStart()
   638 function onGameStart()
       
   639 
       
   640 	-- Adjust pre-defined waypoints in scaled drawn maps
       
   641 	if MapGen == mgDrawn and MapFeatureSize ~= 12 and specialPointsCount > 0 then
       
   642 		local landW = RightX - LeftX + 1
       
   643 		local landH = LAND_HEIGHT - TopY
       
   644 		-- Reposition pre-defined waypoints
       
   645         	for i = 0, (specialPointsCount-1) do
       
   646         		specialPointsX[i] = LeftX + div(specialPointsX[i] * landW, 4096)
       
   647         		specialPointsY[i] = TopY + div(specialPointsY[i] * landH, 2048)
       
   648 		end
       
   649 		-- Scale waypoint size
       
   650 		wpRad = math.max(WAYPOINT_RADIUS_MIN, div(wpRad * landW, 4096))
       
   651 	end
       
   652 
   638 	if ClansCount >= 2 then
   653 	if ClansCount >= 2 then
   639 		SendGameResultOff()
   654 		SendGameResultOff()
   640 		SendRankingStatsOff()
   655 		SendRankingStatsOff()
   641         	SendHealthStatsOff()
   656         	SendHealthStatsOff()
   642 		SendAchievementsStatsOff()
   657 		SendAchievementsStatsOff()