share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
changeset 10554 48e9b1099ff4
child 10596 75b5b674387a
equal deleted inserted replaced
10553:67c6de2a0213 10554:48e9b1099ff4
       
     1 ------------------------------------------
       
     2 -- TECH RACER
       
     3 -----------------------------------------
       
     4 
       
     5 -----------------------------
       
     6 -- SCRIPT BEGINS
       
     7 -----------------------------
       
     8 
       
     9 HedgewarsScriptLoad("/Scripts/Locale.lua")
       
    10 --HedgewarsScriptLoad("/Scripts/OfficialChallenges.lua")
       
    11 HedgewarsScriptLoad("/Scripts/Tracker.lua")
       
    12 HedgewarsScriptLoad("/Scripts/Params.lua")
       
    13 
       
    14 ------------------
       
    15 -- Got Variables?
       
    16 ------------------
       
    17 
       
    18  local activationStage = 0
       
    19  local jet = nil
       
    20 
       
    21 local fMod = 1000000 -- 1
       
    22 local roundLimit = 3
       
    23 local roundNumber = 0
       
    24 local firstClan = 10
       
    25 
       
    26 local fastX = {}
       
    27 local fastY = {}
       
    28 local fastCount = 0
       
    29 local fastIndex = 0
       
    30 local fastColour
       
    31 
       
    32 local currX = {}
       
    33 local currY = {}
       
    34 local currCount = 0
       
    35 
       
    36 local specialPointsX = {}
       
    37 local specialPointsY = {}
       
    38 local specialPointsCount = 0
       
    39 
       
    40 mapID = 22
       
    41 
       
    42 --------------------------
       
    43 -- hog and team tracking variales
       
    44 --------------------------
       
    45 
       
    46 local numhhs = 0 -- store number of hedgehogs
       
    47 local hhs = {} -- store hedgehog gears
       
    48 
       
    49 local numTeams --  store the number of teams in the game
       
    50 local teamNameArr = {}  -- store the list of teams
       
    51 local teamClan = {}
       
    52 local teamSize = {}     -- store how many hogs per team
       
    53 local teamIndex = {} -- at what point in the hhs{} does each team begin
       
    54 
       
    55 local teamComment = {}
       
    56 local teamScore = {}
       
    57 
       
    58 -------
       
    59 -- racer vars
       
    60 --------
       
    61 
       
    62 local cGear = nil
       
    63 
       
    64 local bestClan = nil
       
    65 local bestTime = nil
       
    66 
       
    67 local gameBegun = false
       
    68 local gameOver = false
       
    69 local racerActive = false
       
    70 local trackTime = 0
       
    71 
       
    72 local wpCirc = {}
       
    73 local wpX = {}
       
    74 local wpY = {}
       
    75 local wpCol = {}
       
    76 local wpActive = {}
       
    77 local wpRad = 450 --75
       
    78 local wpCount = 0
       
    79 local wpLimit = 8
       
    80 
       
    81 local usedWeapons = {}
       
    82 
       
    83 local roundN
       
    84 local lastRound
       
    85 local RoundHasChanged
       
    86 
       
    87 -------------------
       
    88 -- general methods
       
    89 -------------------
       
    90 
       
    91 function onPrecise()
       
    92 	AddCaption(mapID)
       
    93 end
       
    94 
       
    95 function RebuildTeamInfo()
       
    96 
       
    97 
       
    98         -- make a list of individual team names
       
    99         for i = 0, (TeamsCount-1) do
       
   100                 teamNameArr[i] = " " -- = i
       
   101                 teamSize[i] = 0
       
   102                 teamIndex[i] = 0
       
   103                 teamScore[i] = 100000
       
   104         end
       
   105         numTeams = 0
       
   106 
       
   107         for i = 0, (numhhs-1) do
       
   108 
       
   109                 z = 0
       
   110                 unfinished = true
       
   111                 while(unfinished == true) do
       
   112 
       
   113                         newTeam = true
       
   114                         tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
       
   115 
       
   116                         if tempHogTeamName == teamNameArr[z] then
       
   117                                 newTeam = false
       
   118                                 unfinished = false
       
   119                         end
       
   120 
       
   121                         z = z + 1
       
   122 
       
   123                         if z == TeamsCount then
       
   124                                 unfinished = false
       
   125                                 if newTeam == true then
       
   126                                         teamNameArr[numTeams] = tempHogTeamName
       
   127                                         numTeams = numTeams + 1
       
   128                                 end
       
   129                         end
       
   130 
       
   131                 end
       
   132 
       
   133         end
       
   134 
       
   135         -- find out how many hogs per team, and the index of the first hog in hhs
       
   136         for i = 0, (numTeams-1) do
       
   137                 for z = 0, (numhhs-1) do
       
   138                         if GetHogTeamName(hhs[z]) == teamNameArr[i] then
       
   139                                 teamClan[i] = GetHogClan(hhs[z])
       
   140                                 if teamSize[i] == 0 then
       
   141                                         teamIndex[i] = z -- should give starting index
       
   142                                 end
       
   143                                 teamSize[i] = teamSize[i] + 1
       
   144                                 --add a pointer so this hog appears at i in hhs
       
   145                         end
       
   146                 end
       
   147 
       
   148         end
       
   149 
       
   150 end
       
   151 
       
   152 
       
   153 -----------------
       
   154 -- RACER METHODS
       
   155 -----------------
       
   156 
       
   157 function CheckWaypoints()
       
   158 
       
   159         trackFinished = true
       
   160 
       
   161         for i = 0, (wpCount-1) do
       
   162 
       
   163                 g1X, g1Y = GetGearPosition(CurrentHedgehog)
       
   164                 g2X, g2Y = wpX[i], wpY[i]
       
   165 
       
   166                 g1X = g1X - g2X
       
   167                 g1Y = g1Y - g2Y
       
   168                 dist = (g1X*g1X) + (g1Y*g1Y)
       
   169 
       
   170                 --if i == 0 then
       
   171                 --      AddCaption(dist .. "/" .. (wpRad*wpRad) )
       
   172                 --end
       
   173 
       
   174                 NR = (48/100*wpRad)/2
       
   175 
       
   176                 if dist < (NR*NR) then
       
   177                 --if dist < (wpRad*wpRad) then
       
   178                         --AddCaption("howdy")
       
   179                         wpActive[i] = true
       
   180                         wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog)) -- new                             --GetClanColor(1)
       
   181                         SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
       
   182 
       
   183                         wpRem = 0
       
   184                         for k = 0, (wpCount-1) do
       
   185                                 if wpActive[k] == false then
       
   186                                         wpRem = wpRem + 1
       
   187                                 end
       
   188                         end
       
   189 
       
   190                         AddCaption(loc("Way-Points Remaining") .. ": " .. wpRem,0xffba00ff,capgrpAmmoinfo)
       
   191 
       
   192                 end
       
   193 
       
   194                 if wpActive[i] == false then
       
   195                         trackFinished = false
       
   196                 end
       
   197 
       
   198         end
       
   199 
       
   200         return(trackFinished)
       
   201 
       
   202 end
       
   203 
       
   204 function AdjustScores()
       
   205 
       
   206         if bestTime == nil then
       
   207                 bestTime = 100000
       
   208                 bestClan = 10
       
   209                 bestTimeComment = "N/A"
       
   210         end
       
   211 
       
   212         newScore = false
       
   213 
       
   214         -- update this clan's time if the new track is better
       
   215         for i = 0, (numTeams-1) do
       
   216                 if teamClan[i] == GetHogClan(CurrentHedgehog) then
       
   217                         if trackTime < teamScore[i] then
       
   218                                 teamScore[i] = trackTime
       
   219                                 newScore = true
       
   220                         else
       
   221                                 newScore = false
       
   222                         end
       
   223                 end
       
   224         end
       
   225 
       
   226         --bestTime = 100000
       
   227         --bestClan = 10
       
   228 
       
   229         -- find the best time out of those so far
       
   230         for i = 0, (numTeams-1) do
       
   231                 if teamScore[i] < bestTime then
       
   232                         bestTime = teamScore[i]
       
   233                         bestClan = teamClan[i]
       
   234                 end
       
   235         end
       
   236 
       
   237         if bestTime ~= 100000 then
       
   238                 bestTimeComment = (bestTime/1000) ..loc("s")
       
   239         end
       
   240 
       
   241         if newScore == true then
       
   242                 if trackTime == bestTime then -- best time of the race
       
   243                         ShowMission(loc("RACER"),
       
   244                         loc("TRACK COMPLETED"),
       
   245                         loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
       
   246                         loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
       
   247                         PlaySound(sndHomerun)
       
   248                 else    -- best time for the clan
       
   249                         ShowMission(loc("RACER"),
       
   250                         loc("TRACK COMPLETED"),
       
   251                         loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
       
   252                         loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
       
   253                 end
       
   254         else -- not any kind of new score
       
   255                 ShowMission(loc("RACER"),
       
   256                 loc("TRACK COMPLETED"),
       
   257                 loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" ..
       
   258                 loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
       
   259                 PlaySound(sndHellish)
       
   260         end
       
   261 
       
   262 
       
   263         --------
       
   264         --new
       
   265         --------
       
   266 
       
   267         if bestTime == trackTime then
       
   268                 --AddCaption("wooooooooooooooooooooooooooooo")
       
   269 
       
   270                 fastColour = GetClanColor(GetHogClan(CurrentHedgehog))
       
   271 
       
   272                 for i = 0, (currCount-1) do
       
   273                         fastX[i] = currX[i]
       
   274                         fastY[i] = currY[i]
       
   275                 end
       
   276 
       
   277                 fastCount = currCount
       
   278                 fastIndex = 0
       
   279 
       
   280                 --currCount = 0 -- is this needed?
       
   281 
       
   282         else
       
   283                 currCount = 0
       
   284                 fastIndex = 0
       
   285         end
       
   286 
       
   287 
       
   288 end
       
   289 
       
   290 function onNewRound()
       
   291 
       
   292         roundNumber = roundNumber + 1
       
   293 
       
   294         totalComment = ""
       
   295         for i = 0, (TeamsCount-1) do
       
   296                         if teamNameArr[i] ~= " " then                           -- teamScore[teamClan[i]]
       
   297                                 teamComment[i] = teamNameArr[i] .. ": " .. (teamScore[i]/1000) .. loc("s|")
       
   298                                 totalComment = totalComment .. teamComment[i]
       
   299                         elseif teamNameArr[i] == " " then
       
   300                                 teamComment[i] = "|"
       
   301                         end
       
   302         end
       
   303 
       
   304         ShowMission(    loc("RACER"),
       
   305                                         loc("STATUS UPDATE"),
       
   306                                         loc("Rounds Complete: ") .. roundNumber .. "/" .. roundLimit .. "|" .. " " .. "|" ..
       
   307                                         loc("Best Team Times: ") .. "|" .. totalComment, 0, 4000)
       
   308 
       
   309         -- end game if its at round limit
       
   310         if roundNumber >= roundLimit then
       
   311                 for i = 0, (numhhs-1) do
       
   312                         if GetHogClan(hhs[i]) ~= bestClan then
       
   313                                 SetEffect(hhs[i], heResurrectable, 0)
       
   314                                 SetHealth(hhs[i],0)
       
   315                         end
       
   316                 end
       
   317                 gameOver = true
       
   318                 TurnTimeLeft = 1
       
   319         end
       
   320 
       
   321 end
       
   322 
       
   323 function CheckForNewRound()
       
   324 
       
   325         -------------
       
   326         ------ new
       
   327         -------------
       
   328 
       
   329         --[[turnN = turnN + 1
       
   330         if gameBegun == false then
       
   331                 if turnN == 2 then
       
   332                         for i = 0, (numhhs-1) do
       
   333                                 if hhs[i] ~= nil then
       
   334                                         SetEffect(hhs[i], heResurrectable, 0)
       
   335                                         SetHealth(hhs[i],0)
       
   336                                 end
       
   337                         end
       
   338                         gameOver = true
       
   339                         TurnTimeLeft = 1
       
   340                 end
       
   341         else
       
   342 
       
   343 
       
   344         end]]
       
   345 
       
   346         --[[if roundBegun == true then
       
   347 
       
   348                 if RoundHasChanged == true then
       
   349                         roundN = roundN + 1
       
   350                         RoundHasChanged = false
       
   351                         onNewRound()
       
   352                 end
       
   353 
       
   354                 if lastRound ~= TotalRounds then -- new round, but not really
       
   355 
       
   356                         if RoundHasChanged == false then
       
   357                                 RoundHasChanged = true
       
   358                         end
       
   359 
       
   360                 end
       
   361 
       
   362                 AddCaption("RoundN:" .. roundN .. "; " .. "TR: " .. TotalRounds)
       
   363 
       
   364                 lastRound = TotalRounds
       
   365 
       
   366         end]]
       
   367 
       
   368         ------------
       
   369         ----- old
       
   370         ------------
       
   371 
       
   372         if GetHogClan(CurrentHedgehog) == firstClan then
       
   373                 onNewRound()
       
   374         end
       
   375 
       
   376 end
       
   377 
       
   378 function DisableTumbler()
       
   379         currCount = 0
       
   380         fastIndex = 0
       
   381         TurnTimeLeft = 0
       
   382         racerActive = false -- newadd
       
   383 end
       
   384 
       
   385 function HandleGhost()
       
   386 
       
   387         -- get the current xy of the racer at this point
       
   388         currX[currCount] = GetX(CurrentHedgehog)
       
   389         currY[currCount] = GetY(CurrentHedgehog)
       
   390         currCount = currCount + 1
       
   391 
       
   392         -- draw a ping of smoke where the fastest player was at this point
       
   393         if (fastCount ~= 0) and (fastIndex < fastCount) then
       
   394 
       
   395                 fastIndex = fastIndex + 1
       
   396 
       
   397                 tempE = AddVisualGear(fastX[fastIndex], fastY[fastIndex], vgtSmoke, 0, false)
       
   398                 g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
       
   399                 SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, fastColour )
       
   400 
       
   401                 --AddCaption("fC: " .. fastIndex .. " / " .. fastCount)
       
   402 
       
   403         else
       
   404 
       
   405                 --AddCaption("excep fC: " .. fastIndex .. " / " .. fastCount)
       
   406 
       
   407         end
       
   408 
       
   409 
       
   410 
       
   411 end
       
   412 
       
   413 function BoomGirder(x,y,rot)
       
   414 	girTime = 1
       
   415 	if rot < 4 then
       
   416 				AddGear(x, y, gtGrenade, 0, 0, 0, girTime)
       
   417 	elseif rot == 4 then
       
   418 				g = AddGear(x-45, y, gtGrenade, 0, 0, 0, girTime) -- needed?
       
   419 				g = AddGear(x-30, y, gtGrenade, 0, 0, 0, girTime)
       
   420 				g = AddGear(x, y, gtGrenade, 0, 0, 0, girTime) -- needed?
       
   421 				g = AddGear(x+30, y, gtGrenade, 0, 0, 0, girTime)
       
   422 				g = AddGear(x+45, y, gtGrenade, 0, 0, 0, girTime) -- needed?
       
   423 	elseif rot == 5 then ------- diag
       
   424 				g = AddGear(x+45, y+45, gtGrenade, 0, 0, 0, girTime) --n
       
   425 				g = AddGear(x+30, y+30, gtGrenade, 0, 0, 0, girTime)
       
   426 				g = AddGear(x, y, gtGrenade, 0, 0, 0, girTime) -- needed?
       
   427 				g = AddGear(x-30, y-30, gtGrenade, 0, 0, 0, girTime)
       
   428 				g = AddGear(x-45, y-45, gtGrenade, 0, 0, 0, girTime) --n
       
   429 	elseif rot == 6 then
       
   430 				g = AddGear(x, y-45, gtGrenade, 0, 0, 0, girTime) -- needed?
       
   431 				g = AddGear(x, y+30, gtGrenade, 0, 0, 0, girTime)
       
   432 				g = AddGear(x, y, gtGrenade, 0, 0, 0, girTime) -- needed?
       
   433 				g = AddGear(x, y-30, gtGrenade, 0, 0, 0, girTime)
       
   434 				g = AddGear(x, y+45, gtGrenade, 0, 0, 0, girTime) -- needed?
       
   435 	elseif rot == 7 then -------
       
   436 				g = AddGear(x+45, y-45, gtGrenade, 0, 0, 0, girTime) --n
       
   437 				g = AddGear(x+30, y-30, gtGrenade, 0, 0, 0, girTime)
       
   438 				g = AddGear(x, y, gtGrenade, 0, 0, 0, girTime) -- needed?
       
   439 				g = AddGear(x-30, y+30, gtGrenade, 0, 0, 0, girTime)
       
   440 				g = AddGear(x-45, y+45, gtGrenade, 0, 0, 0, girTime) --n
       
   441 	end
       
   442 end
       
   443 
       
   444 function RemoveGear(gear)
       
   445 	if (isATrackedGear(gear) == true) and (GetGearType(gear) ~= gtHedgehog) then
       
   446 		DeleteGear(gear)
       
   447 	end
       
   448 end
       
   449 
       
   450 function ClearMap()
       
   451 
       
   452 	runOnGears(RemoveGear)
       
   453 
       
   454 end
       
   455 
       
   456 function HandleFreshMapCreation()
       
   457 
       
   458 	-- the boom stage, boom girders, reset ammo, and delete other map objects
       
   459 	if activationStage == 1 then
       
   460 
       
   461 
       
   462 		ClearMap()
       
   463 		activationStage = activationStage + 1
       
   464 
       
   465 	-- the creation stage, place girders and needed gears, grant ammo
       
   466 	elseif activationStage == 2 then
       
   467 
       
   468 		-- these are from onParameters()
       
   469 		if mapID == "0" then
       
   470 			--AddCaption("zero")
       
   471 		elseif mapID == "1" then
       
   472 
       
   473 			--testmap1
       
   474 			------ GIRDER LIST ------
       
   475 			PlaceGirder(306, 530, 7)
       
   476 			PlaceGirder(451, 474, 4)
       
   477 			PlaceGirder(595, 531, 5)
       
   478 			PlaceGirder(245, 679, 6)
       
   479 			PlaceGirder(305, 822, 5)
       
   480 			PlaceGirder(449, 887, 4)
       
   481 			PlaceGirder(593, 825, 7)
       
   482 			PlaceGirder(657, 681, 6)
       
   483 			PlaceGirder(1063, 682, 6)
       
   484 			PlaceGirder(1121, 532, 7)
       
   485 			PlaceGirder(1266, 476, 4)
       
   486 			PlaceGirder(1411, 535, 5)
       
   487 			PlaceGirder(1472, 684, 6)
       
   488 			PlaceGirder(1415, 828, 7)
       
   489 			PlaceGirder(1271, 892, 4)
       
   490 			PlaceGirder(1126, 827, 5)
       
   491 			PlaceGirder(841, 1079, 4)
       
   492 			PlaceGirder(709, 1153, 7)
       
   493 			PlaceGirder(975, 1154, 5)
       
   494 			PlaceGirder(653, 1265, 2)
       
   495 			PlaceGirder(1021, 1266, 2)
       
   496 			PlaceGirder(713, 1369, 5)
       
   497 			PlaceGirder(960, 1371, 7)
       
   498 			PlaceGirder(835, 1454, 4)
       
   499 			PlaceGirder(185, 1617, 2)
       
   500 			PlaceGirder(1317, 1399, 2)
       
   501 			PlaceGirder(1711, 1811, 2)
       
   502 			PlaceGirder(2087, 1424, 2)
       
   503 			PlaceGirder(2373, 1804, 2)
       
   504 			PlaceGirder(2646, 1434, 2)
       
   505 			PlaceGirder(1876, 667, 6)
       
   506 			PlaceGirder(1934, 517, 7)
       
   507 			PlaceGirder(2079, 461, 4)
       
   508 			PlaceGirder(2224, 519, 5)
       
   509 			PlaceGirder(1935, 810, 5)
       
   510 			PlaceGirder(2080, 875, 4)
       
   511 			PlaceGirder(2224, 811, 7)
       
   512 			PlaceGirder(2370, 582, 4)
       
   513 			PlaceGirder(2370, 759, 4)
       
   514 			PlaceGirder(2530, 582, 4)
       
   515 			PlaceGirder(2690, 582, 4)
       
   516 			PlaceGirder(2530, 759, 4)
       
   517 			PlaceGirder(2690, 759, 4)
       
   518 			PlaceGirder(2836, 634, 5)
       
   519 			PlaceGirder(2835, 822, 5)
       
   520 			PlaceGirder(2951, 751, 5)
       
   521 			PlaceGirder(2950, 939, 5)
       
   522 			PlaceGirder(2964, 1054, 7)
       
   523 			PlaceGirder(2978, 1172, 5)
       
   524 			PlaceGirder(3095, 1185, 7)
       
   525 			PlaceGirder(3211, 1069, 7)
       
   526 			PlaceGirder(3038, 843, 1)
       
   527 			PlaceGirder(3126, 825, 7)
       
   528 			PlaceGirder(3271, 768, 4)
       
   529 			PlaceGirder(3357, 1014, 4)
       
   530 			PlaceGirder(3416, 826, 5)
       
   531 			PlaceGirder(3454, 969, 6)
       
   532 			PlaceGirder(3439, 369, 6)
       
   533 			PlaceGirder(3500, 220, 7)
       
   534 			PlaceGirder(3502, 513, 5)
       
   535 			PlaceGirder(3646, 162, 4)
       
   536 			PlaceGirder(3791, 224, 5)
       
   537 			PlaceGirder(3851, 374, 6)
       
   538 			PlaceGirder(3792, 518, 7)
       
   539 			PlaceGirder(3994, 1731, 7)
       
   540 			PlaceGirder(3877, 1848, 7)
       
   541 			PlaceGirder(3789, 1942, 3)
       
   542 			PlaceGirder(3986, 1929, 2)
       
   543 			PlaceGirder(2837, 1937, 4)
       
   544 			PlaceGirder(2997, 1938, 4)
       
   545 			PlaceGirder(3157, 1938, 4)
       
   546 			PlaceGirder(1152, 1844, 4)
       
   547 			PlaceGirder(1299, 1898, 5)
       
   548 			PlaceGirder(1005, 1900, 7)
       
   549 			PlaceGirder(3578, 575, 6)
       
   550 			PlaceGirder(3714, 576, 6)
       
   551 			PlaceGirder(3579, 740, 6)
       
   552 			PlaceGirder(3714, 741, 6)
       
   553 			PlaceGirder(3580, 903, 6)
       
   554 			PlaceGirder(3715, 904, 6)
       
   555 			PlaceGirder(3552, 452, 1)
       
   556 			PlaceGirder(3528, 370, 2)
       
   557 			PlaceGirder(3568, 297, 3)
       
   558 			PlaceGirder(3736, 455, 3)
       
   559 			PlaceGirder(3757, 378, 2)
       
   560 			PlaceGirder(3725, 299, 1)
       
   561 			PlaceGirder(3646, 261, 0)
       
   562 			PlaceGirder(3648, 997, 4)
       
   563 			PlaceGirder(3649, 1275, 2)
       
   564 			PlaceGirder(3514, 1750, 0)
       
   565 
       
   566 			------ RUBBER BAND LIST ------
       
   567 
       
   568 			------ LAND SPRITE LIST ------
       
   569 
       
   570 			------ HEALTH CRATE LIST ------
       
   571 
       
   572 			------ AMMO CRATE LIST ------
       
   573 			tempG = SpawnAmmoCrate(1707, 1755, amBazooka)
       
   574 			tempG = SpawnAmmoCrate(3983, 1873, amBazooka)
       
   575 			tempG = SpawnAmmoCrate(184, 1561, amBazooka)
       
   576 			tempG = SpawnAmmoCrate(2644, 1378, amBazooka)
       
   577 			tempG = SpawnAmmoCrate(2914, 865, amBazooka)
       
   578 
       
   579 			------ MINE LIST ------
       
   580 			SetTimer(AddGear(2340, 580, gtMine, 0, 0, 0, 0), 1)
       
   581 			SetTimer(AddGear(2399, 580, gtMine, 0, 0, 0, 0), 1)
       
   582 			SetTimer(AddGear(2448, 580, gtMine, 0, 0, 0, 0), 1)
       
   583 			SetTimer(AddGear(2517, 579, gtMine, 0, 0, 0, 0), 1)
       
   584 			SetTimer(AddGear(2575, 581, gtMine, 0, 0, 0, 0), 1)
       
   585 			SetTimer(AddGear(2647, 582, gtMine, 0, 0, 0, 0), 1)
       
   586 			SetTimer(AddGear(2720, 582, gtMine, 0, 0, 0, 0), 1)
       
   587 			SetTimer(AddGear(2760, 581, gtMine, 0, 0, 0, 0), 1)
       
   588 			SetTimer(AddGear(2331, 757, gtMine, 0, 0, 0, 0), 1)
       
   589 			SetTimer(AddGear(2409, 758, gtMine, 0, 0, 0, 0), 1)
       
   590 			SetTimer(AddGear(2477, 758, gtMine, 0, 0, 0, 0), 1)
       
   591 			SetTimer(AddGear(2545, 759, gtMine, 0, 0, 0, 0), 1)
       
   592 			SetTimer(AddGear(2613, 760, gtMine, 0, 0, 0, 0), 1)
       
   593 			SetTimer(AddGear(2679, 758, gtMine, 0, 0, 0, 0), 1)
       
   594 			SetTimer(AddGear(2744, 757, gtMine, 0, 0, 0, 0), 1)
       
   595 			SetTimer(AddGear(2813, 610, gtMine, 0, 0, 0, 0), 1)
       
   596 			SetTimer(AddGear(2855, 650, gtMine, 0, 0, 0, 0), 1)
       
   597 			SetTimer(AddGear(2887, 686, gtMine, 0, 0, 0, 0), 1)
       
   598 
       
   599 		elseif mapID == "2" then
       
   600 
       
   601 
       
   602 		-- land flags test map
       
   603 
       
   604 
       
   605 
       
   606 				------ GIRDER LIST ------
       
   607 	PlaceSprite(335, 622, sprAmGirder, 16,16384)
       
   608 	PlaceSprite(474, 569, sprAmGirder, 13,16384)
       
   609 	PlaceSprite(343, 748, sprAmGirder, 14,16384)
       
   610 	PlaceSprite(466, 756, sprAmGirder, 16,16384)
       
   611 	PlaceSprite(609, 702, sprAmGirder, 13,16384)
       
   612 	PlaceSprite(635, 570, sprAmGirder, 13,16384)
       
   613 	PlaceSprite(770, 702, sprAmGirder, 13,16384)
       
   614 	PlaceSprite(960, 730, sprAmGirder, 18,2048)
       
   615 	PlaceSprite(1061, 608, sprAmGirder, 16,16384)
       
   616 	PlaceSprite(1207, 552, sprAmGirder, 13,16384)
       
   617 	PlaceSprite(1205, 409, sprAmGirder, 13,16384)
       
   618 	PlaceSprite(2312, 637, sprAmGirder, 6,0)
       
   619 	PlaceSprite(2312, 472, sprAmGirder, 6,0)
       
   620 	PlaceSprite(2311, 308, sprAmGirder, 6,0)
       
   621 	PlaceSprite(2292, 155, sprAmGirder, 6,0)
       
   622 	PlaceSprite(727, 611, sprAmGirder, 6,0)
       
   623 	PlaceSprite(1298, 480, sprAmGirder, 6,0)
       
   624 
       
   625 	------ RUBBER BAND LIST ------
       
   626 	PlaceSprite(1411, 625, sprAmRubber, 1, lfBouncy)
       
   627 	PlaceSprite(1525, 739, sprAmRubber, 1, lfBouncy)
       
   628 	PlaceSprite(1638, 852, sprAmRubber, 1, lfBouncy)
       
   629 	PlaceSprite(1754, 963, sprAmRubber, 1, lfBouncy)
       
   630 	PlaceSprite(1870, 1076, sprAmRubber, 1, lfBouncy)
       
   631 	PlaceSprite(2013, 1131, sprAmRubber, 0, lfBouncy)
       
   632 	PlaceSprite(2159, 1070, sprAmRubber, 3, lfBouncy)
       
   633 	PlaceSprite(2268, 952, sprAmRubber, 3, lfBouncy)
       
   634 	PlaceSprite(2315, 802, sprAmRubber, 2, lfBouncy)
       
   635 
       
   636 	------ AMMO CRATE LIST ------
       
   637 	tempG = SpawnAmmoCrate(472, 711, amBazooka)
       
   638 
       
   639 	tempG = SpawnUtilityCrate(540, 660, amParachute)
       
   640 
       
   641 	tempG = SpawnAmmoCrate(1155, 528, amBazooka)
       
   642 
       
   643 	------ UTILITY CRATE LIST ------
       
   644 	tempG = SpawnUtilityCrate(2006, 1102, amRope)
       
   645 
       
   646 
       
   647 
       
   648 		else
       
   649 
       
   650 
       
   651 
       
   652 
       
   653 
       
   654 
       
   655 
       
   656 
       
   657 
       
   658 
       
   659 			-- first test epic multi map
       
   660 			------ GIRDER LIST ------
       
   661 			PlaceSprite(430, 1871, sprAmGirder, 2, lfNormal)
       
   662 			PlaceSprite(1249, 1914, sprAmGirder, 4, lfNormal)
       
   663 			PlaceSprite(1394, 1849, sprAmGirder, 7, lfNormal)
       
   664 			PlaceSprite(1522, 1848, sprAmGirder, 5, lfNormal)
       
   665 			PlaceSprite(1578, 1959, sprAmGirder, 2, lfNormal)
       
   666 			PlaceSprite(1545, 2011, sprAmGirder, 0, lfNormal)
       
   667 			PlaceSprite(430, 1749, sprAmGirder, 6, lfNormal)
       
   668 			PlaceSprite(430, 1589, sprAmGirder, 6, lfNormal)
       
   669 			PlaceSprite(358, 1499, sprAmGirder, 4, lfNormal)
       
   670 			PlaceSprite(198, 1499, sprAmGirder, 4, lfNormal)
       
   671 			PlaceSprite(72, 1571, sprAmGirder, 7, lfNormal)
       
   672 			PlaceSprite(339, 1618, sprAmGirder, 4, lfNormal)
       
   673 			PlaceSprite(520, 1499, sprAmGirder, 4, lfNormal)
       
   674 			PlaceSprite(680, 1499, sprAmGirder, 4, lfNormal)
       
   675 			PlaceSprite(839, 1499, sprAmGirder, 4, lfNormal)
       
   676 			PlaceSprite(1000, 1499, sprAmGirder, 4, lfNormal)
       
   677 			PlaceSprite(1404, 1730, sprAmGirder, 5, lfNormal)
       
   678 			PlaceSprite(1288, 1613, sprAmGirder, 5, lfNormal)
       
   679 			PlaceSprite(1200, 1529, sprAmGirder, 1, lfNormal)
       
   680 			PlaceSprite(1125, 1495, sprAmGirder, 0, lfNormal)
       
   681 			PlaceSprite(1667, 2011, sprAmGirder, 4, lfNormal)
       
   682 			PlaceSprite(1812, 1951, sprAmGirder, 7, lfNormal)
       
   683 			PlaceSprite(1964, 2024, sprAmGirder, 0, lfNormal)
       
   684 			PlaceSprite(1957, 1892, sprAmGirder, 4, lfNormal)
       
   685 			PlaceSprite(2103, 1949, sprAmGirder, 5, lfNormal)
       
   686 			PlaceSprite(2242, 2017, sprAmGirder, 4, lfNormal)
       
   687 			PlaceSprite(2404, 2017, sprAmGirder, 4, lfNormal)
       
   688 			PlaceSprite(2548, 1955, sprAmGirder, 7, lfNormal)
       
   689 			PlaceSprite(2635, 1871, sprAmGirder, 3, lfNormal)
       
   690 			PlaceSprite(2749, 1836, sprAmGirder, 4, lfNormal)
       
   691 			PlaceSprite(2751, 1999, sprAmGirder, 2, lfNormal)
       
   692 			PlaceSprite(2749, 1947, sprAmGirder, 0, lfNormal)
       
   693 			PlaceSprite(2865, 1870, sprAmGirder, 1, lfNormal)
       
   694 			PlaceSprite(2954, 1954, sprAmGirder, 5, lfNormal)
       
   695 			PlaceSprite(3061, 2017, sprAmGirder, 0, lfNormal)
       
   696 			PlaceSprite(3137, 1984, sprAmGirder, 3, lfNormal)
       
   697 			PlaceSprite(3169, 1864, sprAmGirder, 6, lfNormal)
       
   698 			PlaceSprite(3169, 1702, sprAmGirder, 6, lfNormal)
       
   699 			PlaceSprite(3170, 1540, sprAmGirder, 6, lfNormal)
       
   700 			PlaceSprite(3170, 1418, sprAmGirder, 2, lfNormal)
       
   701 			PlaceSprite(3138, 1339, sprAmGirder, 1, lfNormal)
       
   702 			PlaceSprite(3107, 1260, sprAmGirder, 2, lfNormal)
       
   703 			PlaceSprite(3153, 1194, sprAmGirder, 3, lfNormal)
       
   704 			PlaceSprite(3230, 1163, sprAmGirder, 0, lfNormal)
       
   705 			PlaceSprite(3305, 1201, sprAmGirder, 1, lfNormal)
       
   706 			PlaceSprite(3334, 1277, sprAmGirder, 2, lfNormal)
       
   707 			PlaceSprite(3227, 1540, sprAmGirder, 6, lfNormal)
       
   708 			PlaceSprite(3228, 1419, sprAmGirder, 2, lfNormal)
       
   709 			PlaceSprite(3334, 1358, sprAmGirder, 2, lfNormal)
       
   710 			PlaceSprite(3280, 1387, sprAmGirder, 0, lfNormal)
       
   711 			PlaceSprite(3227, 1702, sprAmGirder, 6, lfNormal)
       
   712 			PlaceSprite(3227, 1864, sprAmGirder, 6, lfNormal)
       
   713 			PlaceSprite(3253, 1981, sprAmGirder, 1, lfNormal)
       
   714 			PlaceSprite(3366, 2017, sprAmGirder, 4, lfNormal)
       
   715 			PlaceSprite(3528, 2018, sprAmGirder, 4, lfNormal)
       
   716 			PlaceSprite(3689, 2018, sprAmGirder, 4, lfNormal)
       
   717 			PlaceSprite(246, 1262, sprAmGirder, 4, lfNormal)
       
   718 			PlaceSprite(407, 1262, sprAmGirder, 4, lfNormal)
       
   719 			PlaceSprite(568, 1262, sprAmGirder, 4, lfNormal)
       
   720 			PlaceSprite(731, 1262, sprAmGirder, 4, lfNormal)
       
   721 			PlaceSprite(894, 1261, sprAmGirder, 4, lfNormal)
       
   722 			PlaceSprite(1056, 1261, sprAmGirder, 4, lfNormal)
       
   723 			PlaceSprite(1179, 1262, sprAmGirder, 0, lfNormal)
       
   724 			PlaceSprite(1288, 1314, sprAmGirder, 5, lfNormal)
       
   725 			PlaceSprite(1406, 1433, sprAmGirder, 5, lfNormal)
       
   726 			PlaceSprite(1525, 1549, sprAmGirder, 5, lfNormal)
       
   727 			PlaceSprite(1642, 1666, sprAmGirder, 5, lfNormal)
       
   728 			PlaceSprite(1749, 1728, sprAmGirder, 0, lfNormal)
       
   729 			PlaceSprite(1956, 1802, sprAmGirder, 6, lfNormal)
       
   730 			PlaceSprite(1956, 1640, sprAmGirder, 6, lfNormal)
       
   731 			PlaceSprite(1782, 1638, sprAmGirder, 6, lfNormal)
       
   732 			PlaceSprite(1835, 1487, sprAmGirder, 7, lfNormal)
       
   733 			PlaceSprite(1942, 1430, sprAmGirder, 0, lfNormal)
       
   734 			PlaceSprite(2051, 1486, sprAmGirder, 5, lfNormal)
       
   735 			PlaceSprite(2109, 1639, sprAmGirder, 6, lfNormal)
       
   736 			PlaceSprite(2177, 1778, sprAmGirder, 5, lfNormal)
       
   737 			PlaceSprite(2323, 1840, sprAmGirder, 4, lfNormal)
       
   738 			PlaceSprite(49, 1029, sprAmGirder, 0, lfNormal)
       
   739 			PlaceSprite(499, 1172, sprAmGirder, 6, lfNormal)
       
   740 			PlaceSprite(527, 1054, sprAmGirder, 3, lfNormal)
       
   741 			PlaceSprite(604, 1026, sprAmGirder, 0, lfNormal)
       
   742 			PlaceSprite(680, 1056, sprAmGirder, 1, lfNormal)
       
   743 			PlaceSprite(719, 1168, sprAmGirder, 6, lfNormal)
       
   744 			PlaceSprite(89, 728, sprAmGirder, 4, lfNormal)
       
   745 			PlaceSprite(251, 728, sprAmGirder, 4, lfNormal)
       
   746 			PlaceSprite(412, 728, sprAmGirder, 4, lfNormal)
       
   747 			PlaceSprite(572, 728, sprAmGirder, 4, lfNormal)
       
   748 			PlaceSprite(733, 728, sprAmGirder, 4, lfNormal)
       
   749 			PlaceSprite(894, 728, sprAmGirder, 4, lfNormal)
       
   750 			PlaceSprite(1016, 728, sprAmGirder, 0, lfNormal)
       
   751 			PlaceSprite(1067, 799, sprAmGirder, 6, lfNormal)
       
   752 			PlaceSprite(1139, 891, sprAmGirder, 4, lfNormal)
       
   753 			PlaceSprite(1067, 1171, sprAmGirder, 6, lfNormal)
       
   754 			PlaceSprite(1067, 1049, sprAmGirder, 2, lfNormal)
       
   755 			PlaceSprite(1136, 999, sprAmGirder, 4, lfNormal)
       
   756 			PlaceSprite(1005, 854, sprAmGirder, 2, lfNormal)
       
   757 			PlaceSprite(972, 803, sprAmGirder, 0, lfNormal)
       
   758 			PlaceSprite(920, 780, sprAmGirder, 2, lfNormal)
       
   759 			PlaceSprite(891, 1206, sprAmGirder, 2, lfNormal)
       
   760 			PlaceSprite(887, 1150, sprAmGirder, 0, lfNormal)
       
   761 			PlaceSprite(3018, 1311, sprAmGirder, 4, lfNormal)
       
   762 			PlaceSprite(2871, 1369, sprAmGirder, 7, lfNormal)
       
   763 			PlaceSprite(2809, 1523, sprAmGirder, 6, lfNormal)
       
   764 			PlaceSprite(2809, 1647, sprAmGirder, 2, lfNormal)
       
   765 			PlaceSprite(2469, 1777, sprAmGirder, 7, lfNormal)
       
   766 			PlaceSprite(2612, 1715, sprAmGirder, 4, lfNormal)
       
   767 			PlaceSprite(2809, 1702, sprAmGirder, 0, lfNormal)
       
   768 			PlaceSprite(2727, 1694, sprAmGirder, 0, lfNormal)
       
   769 
       
   770 			PlaceSprite(3334, 1481, sprAmGirder, 6, lfNormal)
       
   771 			PlaceSprite(3334, 1643, sprAmGirder, 6, lfNormal)
       
   772 			PlaceSprite(3334, 1804, sprAmGirder, 6, lfNormal)
       
   773 			PlaceSprite(3403, 1940, sprAmGirder, 5, lfNormal)
       
   774 			PlaceSprite(1120, 944, sprAmGirder, 2, lfNormal)
       
   775 			PlaceSprite(1163, 945, sprAmGirder, 2, lfNormal)
       
   776 			PlaceSprite(1141, 781, sprAmGirder, 5, lfNormal)
       
   777 			PlaceSprite(81, 629, sprAmGirder, 1, lfNormal)
       
   778 			PlaceSprite(102, 498, sprAmGirder, 3, lfNormal)
       
   779 			PlaceSprite(81, 373, sprAmGirder, 1, lfNormal)
       
   780 			PlaceSprite(179, 453, sprAmGirder, 6, lfNormal)
       
   781 			PlaceSprite(100, 260, sprAmGirder, 3, lfNormal)
       
   782 			PlaceSprite(179, 330, sprAmGirder, 2, lfNormal)
       
   783 			PlaceSprite(249, 544, sprAmGirder, 4, lfNormal)
       
   784 			PlaceSprite(410, 545, sprAmGirder, 4, lfNormal)
       
   785 			PlaceSprite(571, 543, sprAmGirder, 4, lfNormal)
       
   786 			PlaceSprite(731, 543, sprAmGirder, 4, lfNormal)
       
   787 			PlaceSprite(891, 544, sprAmGirder, 4, lfNormal)
       
   788 			PlaceSprite(1014, 544, sprAmGirder, 0, lfNormal)
       
   789 			PlaceSprite(1779, 1321, sprAmGirder, 6, lfNormal)
       
   790 			PlaceSprite(1779, 1159, sprAmGirder, 6, lfNormal)
       
   791 			PlaceSprite(1779, 997, sprAmGirder, 6, lfNormal)
       
   792 			PlaceSprite(1779, 836, sprAmGirder, 6, lfNormal)
       
   793 			PlaceSprite(1722, 684, sprAmGirder, 5, lfNormal)
       
   794 			PlaceSprite(1137, 545, sprAmGirder, 4, lfNormal)
       
   795 			PlaceSprite(1298, 545, sprAmGirder, 4, lfNormal)
       
   796 			PlaceSprite(1460, 546, sprAmGirder, 4, lfNormal)
       
   797 			PlaceSprite(1608, 600, sprAmGirder, 5, lfNormal)
       
   798 			PlaceSprite(1508, 1005, sprAmGirder, 4, lfNormal)
       
   799 			PlaceSprite(160, 246, sprAmGirder, 1, lfNormal)
       
   800 			PlaceSprite(1821, 1356, sprAmGirder, 3, lfNormal)
       
   801 			PlaceSprite(1938, 1323, sprAmGirder, 4, lfNormal)
       
   802 			PlaceSprite(2086, 1381, sprAmGirder, 5, lfNormal)
       
   803 			PlaceSprite(4004, 2018, sprAmGirder, 4, lfNormal)
       
   804 			PlaceSprite(3934, 1926, sprAmGirder, 6, lfNormal)
       
   805 			PlaceSprite(3965, 1835, sprAmGirder, 0, lfNormal)
       
   806 			PlaceSprite(4015, 1763, sprAmGirder, 6, lfNormal)
       
   807 			PlaceSprite(4015, 1603, sprAmGirder, 6, lfNormal)
       
   808 			PlaceSprite(4015, 1442, sprAmGirder, 6, lfNormal)
       
   809 			PlaceSprite(4015, 1280, sprAmGirder, 6, lfNormal)
       
   810 			PlaceSprite(4014, 1118, sprAmGirder, 6, lfNormal)
       
   811 			PlaceSprite(4014, 956, sprAmGirder, 6, lfNormal)
       
   812 			PlaceSprite(4014, 793, sprAmGirder, 6, lfNormal)
       
   813 			PlaceSprite(4014, 632, sprAmGirder, 6, lfNormal)
       
   814 			PlaceSprite(4014, 469, sprAmGirder, 6, lfNormal)
       
   815 			PlaceSprite(3981, 351, sprAmGirder, 1, lfNormal)
       
   816 			PlaceSprite(3985, 204, sprAmGirder, 3, lfNormal)
       
   817 			PlaceSprite(4045, 156, sprAmGirder, 0, lfNormal)
       
   818 			PlaceSprite(3667, 344, sprAmGirder, 0, lfNormal)
       
   819 			PlaceSprite(4016, 1925, sprAmGirder, 6, lfNormal)
       
   820 			PlaceSprite(3998, 1926, sprAmGirder, 6, lfNormal)
       
   821 			PlaceSprite(3980, 1925, sprAmGirder, 6, lfNormal)
       
   822 			PlaceSprite(3957, 1926, sprAmGirder, 6, lfNormal)
       
   823 			PlaceSprite(3843, 1832, sprAmGirder, 4, lfNormal)
       
   824 			PlaceSprite(3682, 1832, sprAmGirder, 4, lfNormal)
       
   825 			PlaceSprite(3561, 1833, sprAmGirder, 0, lfNormal)
       
   826 			PlaceSprite(3484, 1796, sprAmGirder, 1, lfNormal)
       
   827 			PlaceSprite(3455, 1675, sprAmGirder, 6, lfNormal)
       
   828 			PlaceSprite(3455, 1513, sprAmGirder, 6, lfNormal)
       
   829 			PlaceSprite(3455, 1351, sprAmGirder, 6, lfNormal)
       
   830 			PlaceSprite(1601, 476, sprAmGirder, 7, lfNormal)
       
   831 			PlaceSprite(1706, 421, sprAmGirder, 0, lfNormal)
       
   832 			PlaceSprite(1888, 366, sprAmGirder, 6, lfNormal)
       
   833 
       
   834 			PlaceSprite(3997, 1743, sprAmGirder, 6, lfNormal)
       
   835 			PlaceSprite(3979, 1742, sprAmGirder, 6, lfNormal)
       
   836 			PlaceSprite(3962, 1741, sprAmGirder, 6, lfNormal)
       
   837 			PlaceSprite(3943, 1741, sprAmGirder, 6, lfNormal)
       
   838 			PlaceSprite(2199, 393, sprAmGirder, 7, lfNormal)
       
   839 			PlaceSprite(2304, 337, sprAmGirder, 0, lfNormal)
       
   840 			PlaceSprite(2409, 392, sprAmGirder, 5, lfNormal)
       
   841 			PlaceSprite(2470, 502, sprAmGirder, 2, lfNormal)
       
   842 			PlaceSprite(2412, 606, sprAmGirder, 7, lfNormal)
       
   843 			PlaceSprite(2308, 673, sprAmGirder, 0, lfNormal)
       
   844 			PlaceSprite(2202, 612, sprAmGirder, 5, lfNormal)
       
   845 			PlaceSprite(2138, 507, sprAmGirder, 2, lfNormal)
       
   846 			PlaceSprite(2739, 378, sprAmGirder, 7, lfNormal)
       
   847 			PlaceSprite(2847, 322, sprAmGirder, 0, lfNormal)
       
   848 			PlaceSprite(2953, 378, sprAmGirder, 5, lfNormal)
       
   849 			PlaceSprite(2680, 489, sprAmGirder, 2, lfNormal)
       
   850 			PlaceSprite(3012, 489, sprAmGirder, 2, lfNormal)
       
   851 			PlaceSprite(2736, 594, sprAmGirder, 5, lfNormal)
       
   852 			PlaceSprite(2841, 657, sprAmGirder, 0, lfNormal)
       
   853 			PlaceSprite(2949, 594, sprAmGirder, 7, lfNormal)
       
   854 			PlaceSprite(2448, 837, sprAmGirder, 7, lfNormal)
       
   855 			PlaceSprite(2594, 779, sprAmGirder, 4, lfNormal)
       
   856 			PlaceSprite(2739, 836, sprAmGirder, 5, lfNormal)
       
   857 			PlaceSprite(2390, 950, sprAmGirder, 2, lfNormal)
       
   858 			PlaceSprite(2789, 950, sprAmGirder, 2, lfNormal)
       
   859 			PlaceSprite(2593, 904, sprAmGirder, 4, lfNormal)
       
   860 			PlaceSprite(2727, 1056, sprAmGirder, 7, lfNormal)
       
   861 			PlaceSprite(2452, 1058, sprAmGirder, 5, lfNormal)
       
   862 			PlaceSprite(2510, 1215, sprAmGirder, 6, lfNormal)
       
   863 			PlaceSprite(2663, 1208, sprAmGirder, 6, lfNormal)
       
   864 			PlaceSprite(2510, 1378, sprAmGirder, 6, lfNormal)
       
   865 			PlaceSprite(2664, 1369, sprAmGirder, 6, lfNormal)
       
   866 			PlaceSprite(300, 275, sprAmGirder, 0, lfNormal)
       
   867 			PlaceSprite(439, 274, sprAmGirder, 0, lfNormal)
       
   868 			PlaceSprite(628, 273, sprAmGirder, 4, lfNormal)
       
   869 			PlaceSprite(811, 271, sprAmGirder, 0, lfNormal)
       
   870 			PlaceSprite(737, 373, sprAmGirder, 4, lfNormal)
       
   871 			PlaceSprite(934, 440, sprAmGirder, 0, lfNormal)
       
   872 			PlaceSprite(1075, 439, sprAmGirder, 0, lfNormal)
       
   873 			PlaceSprite(1209, 438, sprAmGirder, 0, lfNormal)
       
   874 			PlaceSprite(1383, 439, sprAmGirder, 4, lfNormal)
       
   875 			--PlaceSprite(2159, 1525, sprAmGirder, 6, lfNormal)
       
   876 			PlaceSprite(3547, 344, sprAmGirder, 4, lfNormal)
       
   877 			PlaceSprite(3584, 254, sprAmGirder, 6, lfNormal)
       
   878 			PlaceSprite(3508, 132, sprAmGirder, 5, lfNormal)
       
   879 			PlaceSprite(3335, 1117, sprAmGirder, 6, lfNormal)
       
   880 			PlaceSprite(3335, 956, sprAmGirder, 6, lfNormal)
       
   881 			PlaceSprite(3335, 795, sprAmGirder, 6, lfNormal)
       
   882 			PlaceSprite(3335, 634, sprAmGirder, 6, lfNormal)
       
   883 			PlaceSprite(3335, 513, sprAmGirder, 2, lfNormal)
       
   884 			PlaceSprite(3401, 404, sprAmGirder, 7, lfNormal)
       
   885 			PlaceSprite(3455, 1190, sprAmGirder, 6, lfNormal)
       
   886 			PlaceSprite(3455, 1029, sprAmGirder, 6, lfNormal)
       
   887 			PlaceSprite(3455, 868, sprAmGirder, 6, lfNormal)
       
   888 			PlaceSprite(3455, 705, sprAmGirder, 6, lfNormal)
       
   889 			PlaceSprite(3455, 582, sprAmGirder, 2, lfNormal)
       
   890 			PlaceSprite(3485, 503, sprAmGirder, 3, lfNormal)
       
   891 			PlaceSprite(3601, 475, sprAmGirder, 4, lfNormal)
       
   892 			PlaceSprite(3719, 444, sprAmGirder, 3, lfNormal)
       
   893 			PlaceSprite(3094, 828, sprAmGirder, 5, lfNormal)
       
   894 			PlaceSprite(2064, 947, sprAmGirder, 7, lfNormal)
       
   895 			PlaceSprite(1826, 512, sprAmGirder, 7, lfNormal)
       
   896 
       
   897 			PlaceSprite(3420, 49, sprAmGirder, 1, lfNormal)
       
   898 			PlaceSprite(410, 682, sprAmGirder, 3, lfNormal)
       
   899 			PlaceSprite(528, 653, sprAmGirder, 4, lfNormal)
       
   900 			PlaceSprite(688, 653, sprAmGirder, 4, lfNormal)
       
   901 			PlaceSprite(805, 684, sprAmGirder, 1, lfNormal)
       
   902 			PlaceSprite(528, 672, sprAmGirder, 4, lfNormal)
       
   903 			PlaceSprite(688, 672, sprAmGirder, 4, lfNormal)
       
   904 			PlaceSprite(500, 696, sprAmGirder, 4, lfNormal)
       
   905 			PlaceSprite(701, 696, sprAmGirder, 4, lfNormal)
       
   906 
       
   907 			------ AMMO CRATE LIST ------
       
   908 			tempG = SpawnAmmoCrate(889, 1126, amBaseballBat)
       
   909 
       
   910 			tempG = SpawnAmmoCrate(1211, 975, amSineGun)
       
   911 			tempG = SpawnAmmoCrate(3619, 451, amFirePunch)
       
   912 
       
   913 			------ UTILITY CRATE LIST ------
       
   914 			tempG = SpawnUtilityCrate(304, 1594, amRope)
       
   915 			tempG = SpawnUtilityCrate(1538, 1987, amJetpack)
       
   916 			tempG = SpawnUtilityCrate(1958, 2000, amExtraTime)
       
   917 			tempG = SpawnUtilityCrate(2744, 1923, amJetpack)
       
   918 			tempG = SpawnUtilityCrate(3283, 1363, amParachute)
       
   919 			tempG = SpawnUtilityCrate(2749, 1812, amRope)
       
   920 			tempG = SpawnUtilityCrate(970, 779, amJetpack)
       
   921 
       
   922 			tempG = SpawnUtilityCrate(3284, 1332, amExtraTime)
       
   923 			tempG = SpawnUtilityCrate(1082, 975, amBlowTorch)
       
   924 			tempG = SpawnUtilityCrate(1547, 981, amJetpack)
       
   925 			tempG = SpawnUtilityCrate(1707, 397, amRope)
       
   926 			tempG = SpawnUtilityCrate(2309, 649, amExtraTime)
       
   927 			tempG = SpawnUtilityCrate(1116, 867, amExtraTime)
       
   928 
       
   929 			------ AMMO CRATE LIST ------
       
   930 			tempG = SpawnAmmoCrate(2559, 880, amBazooka)
       
   931 			tempG = SpawnAmmoCrate(2630, 880, amBazooka)
       
   932 			tempG = SpawnAmmoCrate(1951, 1406, amGrenade)
       
   933 
       
   934 			------ UTILITY CRATE LIST ------
       
   935 			tempG = SpawnUtilityCrate(3536, 320, amBlowTorch)
       
   936 			tempG = SpawnUtilityCrate(3582, 1994, amJetpack)
       
   937 			tempG = SpawnUtilityCrate(682, 349, amExtraTime)
       
   938 			tempG = SpawnUtilityCrate(2842, 633, amExtraTime)
       
   939 
       
   940 			------ BARREL LIST ------
       
   941 			SetHealth(AddGear(506, 1034, gtExplosives, 0, 0, 0, 0), 1)
       
   942 			SetHealth(AddGear(556, 1002, gtExplosives, 0, 0, 0, 0), 1)
       
   943 			SetHealth(AddGear(615, 1002, gtExplosives, 0, 0, 0, 0), 1)
       
   944 			SetHealth(AddGear(676, 1010, gtExplosives, 0, 0, 0, 0), 1)
       
   945 			SetHealth(AddGear(716, 1050, gtExplosives, 0, 0, 0, 0), 1)
       
   946 			SetHealth(AddGear(67, 1005, gtExplosives, 0, 0, 0, 0), 50)
       
   947 
       
   948 			------ MINE LIST ------
       
   949 			SetTimer(AddGear(1187, 1908, gtMine, 0, 0, 0, 0), 1)
       
   950 			SetTimer(AddGear(1235, 1908, gtMine, 0, 0, 0, 0), 1)
       
   951 			SetTimer(AddGear(1283, 1908, gtMine, 0, 0, 0, 0), 1)
       
   952 			SetTimer(AddGear(1323, 1908, gtMine, 0, 0, 0, 0), 1)
       
   953 			SetTimer(AddGear(1361, 1875, gtMine, 0, 0, 0, 0), 1)
       
   954 			SetTimer(AddGear(1399, 1837, gtMine, 0, 0, 0, 0), 1)
       
   955 			SetTimer(AddGear(1426, 1810, gtMine, 0, 0, 0, 0), 1)
       
   956 			SetTimer(AddGear(234, 1493, gtMine, 0, 0, 0, 0), 1)
       
   957 			SetTimer(AddGear(308, 1493, gtMine, 0, 0, 0, 0), 1)
       
   958 			SetTimer(AddGear(377, 1493, gtMine, 0, 0, 0, 0), 1)
       
   959 			SetTimer(AddGear(460, 1493, gtMine, 0, 0, 0, 0), 1)
       
   960 			SetTimer(AddGear(550, 1493, gtMine, 0, 0, 0, 0), 1)
       
   961 			SetTimer(AddGear(633, 1493, gtMine, 0, 0, 0, 0), 1)
       
   962 			SetTimer(AddGear(722, 1493, gtMine, 0, 0, 0, 0), 1)
       
   963 			SetTimer(AddGear(795, 1493, gtMine, 0, 0, 0, 0), 1)
       
   964 			SetTimer(AddGear(881, 1493, gtMine, 0, 0, 0, 0), 1)
       
   965 			SetTimer(AddGear(975, 1493, gtMine, 0, 0, 0, 0), 1)
       
   966 			SetTimer(AddGear(1060, 1493, gtMine, 0, 0, 0, 0), 1)
       
   967 			SetTimer(AddGear(1127, 1489, gtMine, 0, 0, 0, 0), 1)
       
   968 			SetTimer(AddGear(1207, 1526, gtMine, 0, 0, 0, 0), 1)
       
   969 			SetTimer(AddGear(1261, 1580, gtMine, 0, 0, 0, 0), 1)
       
   970 			SetTimer(AddGear(1315, 1634, gtMine, 0, 0, 0, 0), 1)
       
   971 			SetTimer(AddGear(1372, 1692, gtMine, 0, 0, 0, 0), 1)
       
   972 			SetTimer(AddGear(1416, 1736, gtMine, 0, 0, 0, 0), 1)
       
   973 			SetTimer(AddGear(1465, 1792, gtMine, 0, 0, 0, 0), 1)
       
   974 			SetTimer(AddGear(1518, 1838, gtMine, 0, 0, 0, 0), 1)
       
   975 			SetTimer(AddGear(1566, 1886, gtMine, 0, 0, 0, 0), 1)
       
   976 			SetTimer(AddGear(1623, 2005, gtMine, 0, 0, 0, 0), 1)
       
   977 			SetTimer(AddGear(1686, 2005, gtMine, 0, 0, 0, 0), 1)
       
   978 			SetTimer(AddGear(1799, 1957, gtMine, 0, 0, 0, 0), 1)
       
   979 			SetTimer(AddGear(1839, 1917, gtMine, 0, 0, 0, 0), 1)
       
   980 			SetTimer(AddGear(1902, 1886, gtMine, 0, 0, 0, 0), 1)
       
   981 			SetTimer(AddGear(1933, 1886, gtMine, 0, 0, 0, 0), 1)
       
   982 			SetTimer(AddGear(2076, 1916, gtMine, 0, 0, 0, 0), 1)
       
   983 			SetTimer(AddGear(2138, 1978, gtMine, 0, 0, 0, 0), 1)
       
   984 			SetTimer(AddGear(2221, 2011, gtMine, 0, 0, 0, 0), 1)
       
   985 			SetTimer(AddGear(2305, 2011, gtMine, 0, 0, 0, 0), 1)
       
   986 			SetTimer(AddGear(2390, 2011, gtMine, 0, 0, 0, 0), 1)
       
   987 			SetTimer(AddGear(2578, 1918, gtMine, 0, 0, 0, 0), 1)
       
   988 			SetTimer(AddGear(2494, 2002, gtMine, 0, 0, 0, 0), 1)
       
   989 			SetTimer(AddGear(1758, 1728, gtMine, 0, 0, 0, 0), 1)
       
   990 			SetTimer(AddGear(1683, 1707, gtMine, 0, 0, 0, 0), 1)
       
   991 			SetTimer(AddGear(1635, 1657, gtMine, 0, 0, 0, 0), 1)
       
   992 			SetTimer(AddGear(1572, 1596, gtMine, 0, 0, 0, 0), 1)
       
   993 			SetTimer(AddGear(1517, 1542, gtMine, 0, 0, 0, 0), 1)
       
   994 			SetTimer(AddGear(1447, 1477, gtMine, 0, 0, 0, 0), 1)
       
   995 			SetTimer(AddGear(1401, 1432, gtMine, 0, 0, 0, 0), 1)
       
   996 			SetTimer(AddGear(1338, 1365, gtMine, 0, 0, 0, 0), 1)
       
   997 			SetTimer(AddGear(1290, 1310, gtMine, 0, 0, 0, 0), 1)
       
   998 			SetTimer(AddGear(1230, 1266, gtMine, 0, 0, 0, 0), 1)
       
   999 			SetTimer(AddGear(1149, 1260, gtMine, 0, 0, 0, 0), 1)
       
  1000 			SetTimer(AddGear(1054, 1257, gtMine, 0, 0, 0, 0), 1)
       
  1001 			SetTimer(AddGear(978, 1257, gtMine, 0, 0, 0, 0), 1)
       
  1002 			SetTimer(AddGear(895, 1258, gtMine, 0, 0, 0, 0), 1)
       
  1003 			SetTimer(AddGear(819, 1257, gtMine, 0, 0, 0, 0), 1)
       
  1004 			SetTimer(AddGear(753, 1258, gtMine, 0, 0, 0, 0), 1)
       
  1005 			SetTimer(AddGear(671, 1260, gtMine, 0, 0, 0, 0), 1)
       
  1006 			SetTimer(AddGear(599, 1260, gtMine, 0, 0, 0, 0), 1)
       
  1007 			SetTimer(AddGear(526, 1259, gtMine, 0, 0, 0, 0), 1)
       
  1008 			SetTimer(AddGear(466, 1259, gtMine, 0, 0, 0, 0), 1)
       
  1009 			SetTimer(AddGear(408, 1261, gtMine, 0, 0, 0, 0), 1)
       
  1010 			SetTimer(AddGear(336, 1260, gtMine, 0, 0, 0, 0), 1)
       
  1011 			SetTimer(AddGear(290, 1259, gtMine, 0, 0, 0, 0), 1)
       
  1012 			SetTimer(AddGear(218, 1260, gtMine, 0, 0, 0, 0), 1)
       
  1013 			SetTimer(AddGear(1777, 1263, gtMine, 0, 0, 0, 0), 1)
       
  1014 			SetTimer(AddGear(1776, 1198, gtMine, 0, 0, 0, 0), 1)
       
  1015 			SetTimer(AddGear(1778, 1141, gtMine, 0, 0, 0, 0), 1)
       
  1016 			SetTimer(AddGear(1781, 1078, gtMine, 0, 0, 0, 0), 1)
       
  1017 			SetTimer(AddGear(1778, 1027, gtMine, 0, 0, 0, 0), 1)
       
  1018 			SetTimer(AddGear(1778, 985, gtMine, 0, 0, 0, 0), 1)
       
  1019 			SetTimer(AddGear(1779, 925, gtMine, 0, 0, 0, 0), 1)
       
  1020 			SetTimer(AddGear(1777, 882, gtMine, 0, 0, 0, 0), 1)
       
  1021 			SetTimer(AddGear(4052, 2010, gtMine, 0, 0, 0, 0), 1)
       
  1022 			SetTimer(AddGear(3965, 226, gtMine, 0, 0, 0, 0), 1)
       
  1023 			SetTimer(AddGear(3962, 326, gtMine, 0, 0, 0, 0), 1)
       
  1024 
       
  1025 				------ STICKY MINE LIST ------
       
  1026 			tempG = AddGear(3170, 1907, gtSMine, 0, 0, 0, 0)
       
  1027 			tempG = AddGear(3170, 1860, gtSMine, 0, 0, 0, 0)
       
  1028 			tempG = AddGear(3169, 1809, gtSMine, 0, 0, 0, 0)
       
  1029 			tempG = AddGear(3170, 1761, gtSMine, 0, 0, 0, 0)
       
  1030 			tempG = AddGear(3170, 1711, gtSMine, 0, 0, 0, 0)
       
  1031 			tempG = AddGear(3172, 1668, gtSMine, 0, 0, 0, 0)
       
  1032 			tempG = AddGear(3170, 1624, gtSMine, 0, 0, 0, 0)
       
  1033 			tempG = AddGear(3169, 1579, gtSMine, 0, 0, 0, 0)
       
  1034 			tempG = AddGear(3171, 1526, gtSMine, 0, 0, 0, 0)
       
  1035 			tempG = AddGear(3168, 1469, gtSMine, 0, 0, 0, 0)
       
  1036 			tempG = AddGear(3171, 1418, gtSMine, 0, 0, 0, 0)
       
  1037 			tempG = AddGear(3227, 1416, gtSMine, 0, 0, 0, 0)
       
  1038 			tempG = AddGear(3226, 1465, gtSMine, 0, 0, 0, 0)
       
  1039 			tempG = AddGear(3225, 1523, gtSMine, 0, 0, 0, 0)
       
  1040 			tempG = AddGear(3224, 1576, gtSMine, 0, 0, 0, 0)
       
  1041 			tempG = AddGear(3225, 1624, gtSMine, 0, 0, 0, 0)
       
  1042 			tempG = AddGear(3228, 1667, gtSMine, 0, 0, 0, 0)
       
  1043 			tempG = AddGear(3228, 1707, gtSMine, 0, 0, 0, 0)
       
  1044 			tempG = AddGear(3230, 1757, gtSMine, 0, 0, 0, 0)
       
  1045 			tempG = AddGear(3228, 1803, gtSMine, 0, 0, 0, 0)
       
  1046 			tempG = AddGear(3229, 1856, gtSMine, 0, 0, 0, 0)
       
  1047 			tempG = AddGear(3228, 1910, gtSMine, 0, 0, 0, 0)
       
  1048 			tempG = AddGear(258, 534, gtSMine, 0, 0, 0, 0)
       
  1049 			tempG = AddGear(329, 534, gtSMine, 0, 0, 0, 0)
       
  1050 			tempG = AddGear(410, 535, gtSMine, 0, 0, 0, 0)
       
  1051 			tempG = AddGear(482, 535, gtSMine, 0, 0, 0, 0)
       
  1052 			tempG = AddGear(565, 533, gtSMine, 0, 0, 0, 0)
       
  1053 			tempG = AddGear(670, 533, gtSMine, 0, 0, 0, 0)
       
  1054 			tempG = AddGear(763, 533, gtSMine, 0, 0, 0, 0)
       
  1055 			tempG = AddGear(858, 534, gtSMine, 0, 0, 0, 0)
       
  1056 			tempG = AddGear(917, 534, gtSMine, 0, 0, 0, 0)
       
  1057 			tempG = AddGear(1012, 534, gtSMine, 0, 0, 0, 0)
       
  1058 			tempG = AddGear(1147, 535, gtSMine, 0, 0, 0, 0)
       
  1059 			tempG = AddGear(1102, 535, gtSMine, 0, 0, 0, 0)
       
  1060 			tempG = AddGear(1220, 535, gtSMine, 0, 0, 0, 0)
       
  1061 			tempG = AddGear(1293, 535, gtSMine, 0, 0, 0, 0)
       
  1062 			tempG = AddGear(1368, 535, gtSMine, 0, 0, 0, 0)
       
  1063 			tempG = AddGear(1440, 536, gtSMine, 0, 0, 0, 0)
       
  1064 			tempG = AddGear(223, 534, gtSMine, 0, 0, 0, 0)
       
  1065 			tempG = AddGear(814, 534, gtSMine, 0, 0, 0, 0)
       
  1066 			tempG = AddGear(3909, 1822, gtSMine, 0, 0, 0, 0)
       
  1067 			tempG = AddGear(3867, 1822, gtSMine, 0, 0, 0, 0)
       
  1068 			tempG = AddGear(3824, 1822, gtSMine, 0, 0, 0, 0)
       
  1069 			tempG = AddGear(3784, 1822, gtSMine, 0, 0, 0, 0)
       
  1070 			tempG = AddGear(3732, 1822, gtSMine, 0, 0, 0, 0)
       
  1071 			tempG = AddGear(3682, 1822, gtSMine, 0, 0, 0, 0)
       
  1072 			tempG = AddGear(3627, 1822, gtSMine, 0, 0, 0, 0)
       
  1073 			tempG = AddGear(3557, 1823, gtSMine, 0, 0, 0, 0)
       
  1074 		end
       
  1075 
       
  1076 
       
  1077 		activationStage = 200
       
  1078 
       
  1079 		--runOnHogs(RestoreHog)
       
  1080 
       
  1081 	end
       
  1082 
       
  1083 end
       
  1084 
       
  1085 function TryRepositionHogs()
       
  1086 
       
  1087         if MapHasBorder() == true then
       
  1088 
       
  1089                 for i = 0, (numhhs-1) do
       
  1090                         if hhs[i] ~= nil then
       
  1091                                 SetGearPosition(hhs[i],GetX(hhs[i]), TopY-10)
       
  1092                         end
       
  1093                 end
       
  1094 
       
  1095         end
       
  1096 
       
  1097 end
       
  1098 
       
  1099 ----------------------------------
       
  1100 -- GAME METHODS / EVENT HANDLERS
       
  1101 ----------------------------------
       
  1102 
       
  1103 function onParameters()
       
  1104     parseParams()
       
  1105 	mapID = params["m"]
       
  1106 end
       
  1107 
       
  1108 function onGameInit()
       
  1109         --EnableGameFlags(gfInfAttack, gfInvulnerable)
       
  1110         EnableGameFlags(gfInfAttack, gfDisableWind)
       
  1111 		DisableGameFlags(gfSolidLand)
       
  1112 		CaseFreq = 0
       
  1113         TurnTime = 90000
       
  1114         WaterRise = 0
       
  1115 end
       
  1116 
       
  1117 
       
  1118 function onGameStart()
       
  1119 
       
  1120 
       
  1121 		trackTeams()
       
  1122 		roundN = 0
       
  1123         lastRound = TotalRounds
       
  1124         RoundHasChanged = false -- true
       
  1125 
       
  1126         for i = 0, (specialPointsCount-1) do
       
  1127                 PlaceWayPoint(specialPointsX[i], specialPointsY[i])
       
  1128         end
       
  1129 
       
  1130         RebuildTeamInfo()
       
  1131 
       
  1132         ShowMission     (
       
  1133                                 loc("RACER"),
       
  1134                                 loc("a Hedgewars mini-game"),
       
  1135 
       
  1136                                 loc("Build a track and race.") .. "|" ..
       
  1137                                 loc("Round Limit:") .. " " .. roundLimit .. "|" ..
       
  1138 
       
  1139                                 "", 4, 4000
       
  1140                                 )
       
  1141 
       
  1142         TryRepositionHogs()
       
  1143 
       
  1144 end
       
  1145 
       
  1146 function PlaceWayPoint(x,y)
       
  1147     if not racerActive then
       
  1148         if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then
       
  1149 
       
  1150             wpX[wpCount] = x
       
  1151             wpY[wpCount] = y
       
  1152             wpCol[wpCount] = 0xffffffff
       
  1153             wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
       
  1154 
       
  1155             SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
       
  1156 
       
  1157             wpCount = wpCount + 1
       
  1158 
       
  1159             AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
       
  1160         end
       
  1161     end
       
  1162 end
       
  1163 
       
  1164 function onSpecialPoint(x,y,flag)
       
  1165     specialPointsX[specialPointsCount] = x
       
  1166     specialPointsY[specialPointsCount] = y
       
  1167     specialPointsCount = specialPointsCount + 1
       
  1168 end
       
  1169 
       
  1170 
       
  1171 
       
  1172 function onNewTurn()
       
  1173 
       
  1174         --runOnHogs(HideHog)
       
  1175 
       
  1176 		CheckForNewRound()
       
  1177         TryRepositionHogs()
       
  1178 
       
  1179         racerActive = false
       
  1180 
       
  1181 		activationStage = 1
       
  1182 
       
  1183 		--AddAmmo(CurrentHedgehog, amBazooka, 100)
       
  1184 		--AddAmmo(CurrentHedgehog, amJetpack, 100)
       
  1185 
       
  1186 		--ClearMap()
       
  1187 
       
  1188 
       
  1189         trackTime = 0
       
  1190 
       
  1191         currCount = 0 -- hopefully this solves problem
       
  1192         AddAmmo(CurrentHedgehog, amAirAttack, 0)
       
  1193         gTimer = 0
       
  1194 
       
  1195         -- Set the waypoints to unactive on new round
       
  1196         for i = 0,(wpCount-1) do
       
  1197                 wpActive[i] = false
       
  1198                 wpCol[i] = 0xffffffff
       
  1199                 SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
       
  1200         end
       
  1201 
       
  1202         -- Handle Starting Stage of Game
       
  1203         if (gameOver == false) and (gameBegun == false) then
       
  1204                 if wpCount >= 3 then
       
  1205                         gameBegun = true
       
  1206 						--activationStage = 200
       
  1207                         roundNumber = 0
       
  1208                         firstClan = GetHogClan(CurrentHedgehog)
       
  1209                         ShowMission(loc("RACER"),
       
  1210                         loc("GAME BEGUN!!!"),
       
  1211                         loc("Complete the track as fast as you can!"), 2, 4000)
       
  1212                 else
       
  1213                         ShowMission(loc("RACER"),
       
  1214                         loc("NOT ENOUGH WAYPOINTS"),
       
  1215                         loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
       
  1216                         AddAmmo(CurrentHedgehog, amAirAttack, 4000)
       
  1217             ParseCommand("setweap " .. string.char(amAirAttack))
       
  1218                 end
       
  1219         end
       
  1220 
       
  1221         if gameOver == true then
       
  1222                 gameBegun = false
       
  1223                 racerActive = false -- newadd
       
  1224         end
       
  1225 
       
  1226         AddAmmo(CurrentHedgehog, amTardis, 0)
       
  1227         AddAmmo(CurrentHedgehog, amDrillStrike, 0)
       
  1228         AddAmmo(CurrentHedgehog, amMineStrike, 0)
       
  1229         AddAmmo(CurrentHedgehog, amNapalm, 0)
       
  1230         AddAmmo(CurrentHedgehog, amPiano, 0)
       
  1231 
       
  1232 end
       
  1233 
       
  1234 function onGameTick20()
       
  1235 
       
  1236 
       
  1237 		if jet ~= nil then
       
  1238 			--SetHealth(jet, 2000)
       
  1239 		end
       
  1240 
       
  1241         -- airstrike detected, convert this into a potential waypoint spot
       
  1242         if cGear ~= nil then
       
  1243                 x,y = GetGearPosition(cGear)
       
  1244         if x > -9000 then
       
  1245             x,y = GetGearTarget(cGear)
       
  1246 
       
  1247 
       
  1248             if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
       
  1249                 AddCaption(loc("Please place the way-point in the open, within the map boundaries."))
       
  1250                 PlaySound(sndDenied)
       
  1251             elseif (y > WaterLine-50) then
       
  1252                 AddCaption(loc("Please place the way-point further from the waterline."))
       
  1253                 PlaySound(sndDenied)
       
  1254             else
       
  1255                 PlaceWayPoint(x, y)
       
  1256                 if wpCount == wpLimit then
       
  1257                     AddCaption(loc("Race complexity limit reached."))
       
  1258                     DisableTumbler()
       
  1259                 end
       
  1260             end
       
  1261         else
       
  1262             DeleteGear(cGear)
       
  1263         end
       
  1264         SetGearPosition(cGear, -10000, 0)
       
  1265         end
       
  1266 
       
  1267 
       
  1268 		if activationStage < 10 then
       
  1269 				HandleFreshMapCreation()
       
  1270 		end
       
  1271 
       
  1272 
       
  1273         -- start the player tumbling with a boom once their turn has actually begun
       
  1274         if racerActive == false then
       
  1275 
       
  1276                 if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
       
  1277 
       
  1278                         -- if the gamehas started put the player in the middle of the first
       
  1279                         --waypoint that was placed
       
  1280                         --if activationStage == 200 then
       
  1281 						if gameBegun == true then
       
  1282                                 AddCaption(loc("Good to go!"))
       
  1283                                 racerActive = true
       
  1284                                 trackTime = 0
       
  1285 
       
  1286 
       
  1287 								SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
       
  1288                                 --AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
       
  1289                                 --SetGearVelocity(CurrentHedgehog,1000000,1000000)
       
  1290 								SetGearMessage(CurrentHedgehog,gmLeft)
       
  1291 
       
  1292 
       
  1293 								FollowGear(CurrentHedgehog)
       
  1294 
       
  1295                                 HideMission()
       
  1296 								activationStage = 201
       
  1297 
       
  1298 						else
       
  1299                                 -- still in placement mode
       
  1300                         end
       
  1301 
       
  1302                 end
       
  1303 
       
  1304         elseif (activationStage == 201) and (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
       
  1305 			SetGearMessage(CurrentHedgehog,0)
       
  1306 			activationStage = 202
       
  1307 		end
       
  1308 
       
  1309 
       
  1310 
       
  1311         -- has the player started his tumbling spree?
       
  1312         if (CurrentHedgehog ~= nil) then
       
  1313 
       
  1314                 --airstrike conversion used to be here
       
  1315 
       
  1316                 -- if the RACE has started, show tracktimes and keep tabs on waypoints
       
  1317                 if (racerActive == true) and (activationStage == 202) then
       
  1318 
       
  1319                         --ghost
       
  1320                         if GameTime%40 == 0 then
       
  1321                                 HandleGhost()
       
  1322                         end
       
  1323 
       
  1324                         trackTime = trackTime + 20
       
  1325 
       
  1326                         if GameTime%100 == 0 then
       
  1327 
       
  1328                 if trackTime%1000 == 0 then
       
  1329                     AddCaption((trackTime/1000)..'.0',GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
       
  1330                 else
       
  1331                     AddCaption(trackTime/1000,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
       
  1332                 end
       
  1333 
       
  1334                                 if (CheckWaypoints() == true) then
       
  1335                                         AdjustScores()
       
  1336                                         DisableTumbler()
       
  1337                                 end
       
  1338 
       
  1339                         end
       
  1340 
       
  1341                 end
       
  1342 
       
  1343                 -- if the player has expended his tunbling time, stop him tumbling
       
  1344                 if TurnTimeLeft <= 20 then
       
  1345                         DisableTumbler()
       
  1346                 end
       
  1347 
       
  1348         end
       
  1349 
       
  1350 end
       
  1351 
       
  1352 function onGearResurrect(gear)
       
  1353 
       
  1354         AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
       
  1355 
       
  1356         if gear == CurrentHedgehog then
       
  1357                 DisableTumbler()
       
  1358         end
       
  1359 
       
  1360 end
       
  1361 
       
  1362 function isATrackedGear(gear)
       
  1363 	if 	(GetGearType(gear) == gtHedgehog) or
       
  1364 		(GetGearType(gear) == gtGrenade) or
       
  1365 		(GetGearType(gear) == gtTarget) or
       
  1366 		(GetGearType(gear) == gtFlame) or
       
  1367 		(GetGearType(gear) == gtExplosives) or
       
  1368 		(GetGearType(gear) == gtMine) or
       
  1369 		(GetGearType(gear) == gtSMine) or
       
  1370 		(GetGearType(gear) == gtCase)
       
  1371 	then
       
  1372 		return(true)
       
  1373 	else
       
  1374 		return(false)
       
  1375 	end
       
  1376 end
       
  1377 
       
  1378 function onGearAdd(gear)
       
  1379 
       
  1380         if isATrackedGear(gear) then
       
  1381 			trackGear(gear)
       
  1382 		end
       
  1383 
       
  1384 		if GetGearType(gear) == gtHedgehog then
       
  1385                 hhs[numhhs] = gear
       
  1386                 numhhs = numhhs + 1
       
  1387                 SetEffect(gear, heResurrectable, 1)
       
  1388         end
       
  1389 
       
  1390         if GetGearType(gear) == gtAirAttack then
       
  1391                 cGear = gear
       
  1392         elseif GetGearType(gear) == gtJetpack then
       
  1393 			jet = gear
       
  1394 		end
       
  1395 
       
  1396 end
       
  1397 
       
  1398 function onGearDelete(gear)
       
  1399 
       
  1400         if isATrackedGear(gear) then
       
  1401 			trackDeletion(gear)
       
  1402 		elseif GetGearType(gear) == gtAirAttack then
       
  1403                 cGear = nil
       
  1404         elseif GetGearType(gear) == gtJetpack then
       
  1405 			jet = nil
       
  1406 		end
       
  1407 
       
  1408 end
       
  1409 
       
  1410 function onAttack()
       
  1411     at = GetCurAmmoType()
       
  1412 
       
  1413     usedWeapons[at] = 0
       
  1414 end
       
  1415 
       
  1416 
       
  1417