share/hedgewars/Data/Maps/TrophyRace/map.lua
author arrom
Sun, 07 Nov 2010 13:19:55 -0500
changeset 4188 e1bf1b5a301e
parent 4174 acaa5e7fd286
child 4350 cdb3d7a39fa2
permissions -rw-r--r--
pt_BR, the return. also fix line ending screwups
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4188
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     1
-- Hedgewars - Roperace for 2+ Players
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     2
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     3
local caption = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     4
	["en"] = "TrophyRace",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     5
	["sv"] = "TrophyRace",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     6
	["pt_PT"] = "TrophyRace",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     7
	["pl"] = "TrophyRace",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     8
	["es"] = "TrophyRace",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
     9
	["pt_BR"] = "TrophyRace"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    10
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    11
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    12
local goal = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    13
	["en"] = "Use your rope to get from start to finish as fast as you can!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    14
	["sv"] = "Använd ditt rep för att ta dig från start till mål så fort som möjligt!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    15
	["pt_PT"] = "Utilizando a corda, percorre o percurso do inicio ao fim o mais rápido que conseguires!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    16
	["pl"] = "Użyj liny by jak najszybciej dotrzec od startu do mety",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    17
	["es"] = "¡Usa tu cuerda para llegar a la salida lo más rápido que puedas!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    18
	["pt_BR"] = "Use sua corda para ir do início ao fim o mais rápido que você puder!"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    19
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    20
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    21
local done = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    22
	["en"] = "You've reached the goal!| |Time: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    23
	["sv"] = "Du har nått målet!| |Tid: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    24
	["pt_PT"] = "Chegaste ao fim!| |Tempo: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    25
	["pl"] = "Dotarłeś do celu!| |Czas: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    26
	["es"] = "¡Has llegado a la meta!| |Tiempo: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    27
	["pt_BR"] = "Você alcançou o objetivo!| |Tempo: "
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    28
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    29
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    30
local eliminated = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    31
	["en"] = "Eliminating worst hedgehog this round...| |%s is OUT!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    32
	["sv"] = "Eliminerar sämsta igelkott den här rundan...| |%s är UTE!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    33
	["pt_PT"] = "A eliminar o pior ouriço da ronda...| |% está FORA!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    34
	["pl"] = "Eliminujemy najgorszego jeża tej rundy...| |%s ODPADŁ!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    35
	["es"] = "Eliminando al peor erizo de esta ronda...| |¡%s está FUERA!",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    36
	["pt_BR"] = "Eliminando o ouriço mais lento...| |%s vai para o chuveiro!"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    37
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    38
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    39
local newbesttime = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    40
	["en"] = "NEW fastest lap: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    41
	["sv"] = "NYTT snabbast varv: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    42
	["pt_PT"] = "NOVA volta recorde: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    43
	["pl"] = "NOWE najszybsze okrążenie: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    44
	["es"] = "NUEVA vuelta rápida: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    45
	["pt_BR"] = "NOVA volta mais rápida: "
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    46
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    47
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    48
local oldbesttime = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    49
	["en"] = "Fastest lap: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    50
	["sv"] = "Snabbast varv: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    51
	["pt_PT"] = "Volta mais rápida: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    52
	["pl"] = "Najszybsze okrążenie: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    53
	["es"] = "Vuelta rápida: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    54
	["pt_BR"] = "Volta mais rápida: "
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    55
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    56
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    57
local bestclantimes = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    58
	["en"] = "Best laps per team: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    59
	["sv"] = "Bästa varv per lag: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    60
	["pt_PT"] = "Melhores voltas por equipa: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    61
	["pl"] = "Najszybsze okrążenie drużyny: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    62
	["es"] = "Mejores tiempos por equipo: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    63
	["pt_BR"] = "Melhor volta por equipe: "
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    64
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    65
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    66
local clantime = {
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    67
	["en"] = "Team %d: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    68
	["sv"] = "Lag %d: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    69
	["pt_PT"] = "Equipa %d: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    70
	["pl"] = "Drużyna %d: ",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    71
	["es"] = "Equipo %d",
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    72
	["pt_BR"] = "Equipe %d: "
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    73
	}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    74
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    75
local function loc(text)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    76
	if text == nil then return "**missing**"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    77
	elseif text[L] == nil then return text["en"]
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    78
	else return text[L]
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    79
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    80
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    81
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    82
---------------------------------------------------------------
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    83
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    84
-- store number of hedgehogs
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    85
local numhhs = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    86
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    87
-- store hedgehog gears
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    88
local hhs = {}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    89
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    90
-- store best time per team
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    91
local clantimes = {}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    92
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    93
-- store best times
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    94
local times = {}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    95
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    96
-- in milisseconds
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    97
local maxtime = 99000
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    98
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
    99
-- define start area (left, top, width, height)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   100
local start_area = {1606, 498, 356, 80}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   101
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   102
-- define goal area (left, top, width, height)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   103
local goal_area = {2030, 300, 56, 280}
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   104
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   105
-- last active hog
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   106
local lasthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   107
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   108
-- active hog reached the goal?
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   109
local reached = false
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   110
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   111
-- hog with best time
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   112
local besthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   113
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   114
-- hog with worst time (per round)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   115
local worsthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   116
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   117
-- best time
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   118
local besttime = maxtime + 1
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   119
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   120
-- worst time (per round)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   121
local worsttime = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   122
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   123
function onGameInit()
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   124
	GameFlags = gfSolidLand + gfInvulnerable
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   125
	TurnTime = maxtime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   126
	CaseFreq = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   127
	MinesNum = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   128
	Explosives = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   129
	Delay = 500
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   130
	SuddenDeathTurns = 99999 -- "disable" sudden death
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   131
	Theme = 'Olympics'
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   132
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   133
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   134
function onGameStart()
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   135
	ShowMission(loc(caption), "", loc(goal), -amRope, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   136
	started = true
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   137
	p=1820
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   138
	for i = 0, numhhs - 1 do
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   139
	p = p + 50	
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   140
	SetGearPosition(hhs[i], p, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   141
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   142
	
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   143
	for i=0, ClansCount-1 do
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   144
		clantimes[i] = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   145
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   146
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   147
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   148
function onAmmoStoreInit()
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   149
	SetAmmo(amRope, 9, 2, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   150
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   151
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   152
function onGameTick()
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   153
	if TurnTimeLeft == 1 and CurrentHedgehog ~= nil then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   154
		SetHealth(CurrentHedgehog, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   155
		x, y = GetGearPosition(CurrentHedgehog)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   156
		AddGear(x, y, gtAmmo_Grenade, 0, 0, 0, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   157
		worsttime = 99999
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   158
		worsthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   159
	elseif TurnTimeLeft == maxtime - 1 and CurrentHedgehog ~= nil then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   160
		if lasthog ~= nil then 
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   161
		SetGearPosition(lasthog, p , 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   162
		end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   163
		reached = false
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   164
		SetGearPosition(CurrentHedgehog, start_area[1] + start_area[3] / 2, start_area[2] + start_area[4] / 2)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   165
	elseif CurrentHedgehog ~= nil then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   166
		x, y = GetGearPosition(CurrentHedgehog)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   167
		if not reached and x > goal_area[1] and x < goal_area[1] + goal_area[3] and y > goal_area[2] and y < goal_area[2] + goal_area[4] then -- hog is within goal rectangle
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   168
			reached = true
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   169
			local ttime = maxtime - TurnTimeLeft
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   170
			--give it a sound;)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   171
			if ttime < besttime then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   172
				PlaySound (sndHomerun)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   173
			else
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   174
				PlaySound (sndHellish)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   175
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   176
			for i = 0, numhhs - 1 do
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   177
				if hhs[i] == CurrentHedgehog then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   178
					times[numhhs] = ttime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   179
				end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   180
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   181
				
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   182
			local hscore = "| |"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   183
			local clan = GetHogClan(CurrentHedgehog)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   184
			if ttime < clantimes[clan] or clantimes[clan] == 0 then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   185
				clantimes[clan] = ttime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   186
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   187
			
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   188
			if ttime < besttime then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   189
				besttime = ttime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   190
				besthog = CurrentHedgehog
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   191
				hscore = hscore .. loc(newbesttime)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   192
			else
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   193
				hscore = hscore .. loc(oldbesttime)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   194
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   195
			if ttime > worsttime then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   196
				worsttime = ttime
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   197
				worsthog = CurrentHedgehog
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   198
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   199
			hscore = hscore .. GetHogName(besthog) .. " - " .. (besttime / 1000) .. " s | |" .. loc(bestclantimes)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   200
			
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   201
			if clan == ClansCount -1 then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   202
				-- Time for elimination - worst hog is out and the worst hog vars are reset.
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   203
				SetHealth(worsthog, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   204
				--Place a grenade to make inactive slowest hog active
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   205
				x, y = GetGearPosition(worsthog)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   206
				AddGear(x, y, gtShell, 0, 0, 0, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   207
				worsttime = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   208
				worsthog = nil
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   209
				end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   210
			
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   211
			for i=0, ClansCount -1 do
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   212
				local tt = "" .. (clantimes[i] / 1000) .. " s"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   213
				if clantimes[i] == 0 then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   214
					tt = "--"
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   215
				end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   216
				hscore = hscore .. "|" .. string.format(loc(clantime), i+1) .. tt
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   217
			end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   218
			
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   219
			ShowMission(loc(caption), "", loc(done) .. (ttime / 1000) .. " s" .. hscore, 0, 0)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   220
			TurnTimeLeft = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   221
		end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   222
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   223
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   224
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   225
function onGearAdd(gear)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   226
	if GetGearType(gear) == gtHedgehog then
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   227
		hhs[numhhs] = gear
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   228
		times[numhhs] = 0
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   229
		numhhs = numhhs + 1
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   230
	elseif GetGearType(gear) == gtRope then -- rope is shot
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   231
		
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   232
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   233
end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   234
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   235
function onGearDelete(gear)
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   236
	if GetGearType(gear) == gtRope then -- rope deletion - hog didn't manage to rerope
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   237
		--TurnTimeLeft = 0 -- end turn or not? hm...
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   238
		lasthog = CurrentHedgehog
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   239
		
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   240
	end
e1bf1b5a301e pt_BR, the return. also fix line ending screwups
arrom
parents: 4174
diff changeset
   241
end