share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
author belphegorr <szabibibi@gmail.com>
Mon, 16 Jul 2012 20:56:55 +0300
changeset 7255 93cf6b3b89be
parent 7142 8842fa26698b
child 7838 5c2337f8dbb2
permissions -rw-r--r--
Fixed a visual gear in Mission 5 Animate.lua: added an optional boolean parameter to AnimVisualGear - follow
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
     1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
     2
------------------------------------------
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
     3
-- RACER 0.5
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
     4
-- map-independant racing script
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
     5
-- by mikade
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
     6
-----------------------------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
     7
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
     8
-----------------------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
     9
--0.1: took all the code from crazy racer and scrapped most of it
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    10
-----------------------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    11
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    12
-- Removed tumbler system
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    13
-- Removed extra adds like boosters etc
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    14
-- Added experimental waypoint placement system
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    15
-- More user feedback
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    16
-- Reduced race complexity limit to 5 waypoints
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    17
-- stop placement at complexity limit reached and end turn
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    18
-- guys dont keep racing after dying
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    19
-- invulnerable feasibility
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    20
-- reverted time keeping method
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    21
-- reduced feedback display time
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    22
-- colour-coded addcaptions
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    23
-- cleaned up code
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    24
-- support for more players properly added
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    25
-- tardis fix
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    26
-- remove airstrikes
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    27
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    28
-- i think the remainder 0 .456 sec of the tracktime isnt getting reset on newturn
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    29
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    30
-- update feedback
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    31
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
    32
-------
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
    33
-- 0.2
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
    34
-------
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
    35
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
    36
-- allow gameflags
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
    37
-- extend time to 90s
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
    38
-- remove other air-attack based weps
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
    39
-- turn off water rise for sd
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
    40
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
    41
-------
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
    42
-- 0.3
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
    43
-------
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
    44
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
    45
-- prevent WP being placed in land
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
    46
-- prevent waypoints being placed outside border
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
    47
5901
a00e567005be Add sounds for incorrectly placed waypoint, fastest time, and no record of any kind.
mikade
parents: 5900
diff changeset
    48
-------
a00e567005be Add sounds for incorrectly placed waypoint, fastest time, and no record of any kind.
mikade
parents: 5900
diff changeset
    49
-- 0.4
a00e567005be Add sounds for incorrectly placed waypoint, fastest time, and no record of any kind.
mikade
parents: 5900
diff changeset
    50
-------
a00e567005be Add sounds for incorrectly placed waypoint, fastest time, and no record of any kind.
mikade
parents: 5900
diff changeset
    51
a00e567005be Add sounds for incorrectly placed waypoint, fastest time, and no record of any kind.
mikade
parents: 5900
diff changeset
    52
-- update user feedback
a00e567005be Add sounds for incorrectly placed waypoint, fastest time, and no record of any kind.
mikade
parents: 5900
diff changeset
    53
-- add more sounds
a00e567005be Add sounds for incorrectly placed waypoint, fastest time, and no record of any kind.
mikade
parents: 5900
diff changeset
    54
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
    55
-------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
    56
-- 0.5
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
    57
-------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
    58
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
    59
-- fix ghost disappearing if hog falls in water or somehow dies
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
    60
-- lengthen ghost tracking interval to improve performance on slower machines
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
    61
-- increase waypoint limit to 8
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
    62
-- allow for persistent showmission information
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
    63
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    64
-----------------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    65
-- SCRIPT BEGINS
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    66
-----------------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    67
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    68
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    69
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    70
------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    71
-- Got Variables?
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    72
------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    73
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    74
local fMod = 1000000 -- 1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    75
local roundLimit = 3
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    76
local roundNumber = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    77
local firstClan = 10
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    78
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    79
local fastX = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    80
local fastY = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    81
local fastCount = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    82
local fastIndex = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    83
local fastColour
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    84
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    85
local currX = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    86
local currY = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    87
local currCount = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    88
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    89
--------------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    90
-- hog and team tracking variales
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    91
--------------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    92
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    93
local numhhs = 0 -- store number of hedgehogs
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    94
local hhs = {} -- store hedgehog gears
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    95
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    96
local numTeams --  store the number of teams in the game
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    97
local teamNameArr = {}	-- store the list of teams
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    98
local teamClan = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
    99
local teamSize = {}	-- store how many hogs per team
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   100
local teamIndex = {} -- at what point in the hhs{} does each team begin
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   101
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   102
local teamComment = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   103
local teamScore = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   104
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   105
-------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   106
-- racer vars
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   107
--------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   108
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   109
local cGear = nil
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   110
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   111
local bestClan = nil
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   112
local bestTime = nil
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   113
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   114
local gameBegun = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   115
local gameOver = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   116
local racerActive = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   117
local trackTime = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   118
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   119
local wpCirc = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   120
local wpX = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   121
local wpY = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   122
local wpCol = {}
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   123
local wpActive = {}
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   124
local wpRad = 450 --75
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   125
local wpCount = 0
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   126
local wpLimit = 8
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   127
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   128
local roundN
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   129
local lastRound
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   130
local RoundHasChanged
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   131
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   132
-------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   133
-- general methods
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   134
-------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   135
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   136
function RebuildTeamInfo()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   137
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   138
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   139
	-- make a list of individual team names
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   140
	for i = 0, (TeamsCount-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   141
		teamNameArr[i] = " " -- = i
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   142
		teamSize[i] = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   143
		teamIndex[i] = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   144
		teamScore[i] = 100000
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   145
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   146
	numTeams = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   147
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   148
	for i = 0, (numhhs-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   149
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   150
		z = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   151
		unfinished = true
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   152
		while(unfinished == true) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   153
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   154
			newTeam = true
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   155
			tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   156
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   157
			if tempHogTeamName == teamNameArr[z] then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   158
				newTeam = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   159
				unfinished = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   160
			end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   161
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   162
			z = z + 1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   163
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   164
			if z == TeamsCount then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   165
				unfinished = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   166
				if newTeam == true then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   167
					teamNameArr[numTeams] = tempHogTeamName
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   168
					numTeams = numTeams + 1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   169
				end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   170
			end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   171
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   172
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   173
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   174
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   175
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   176
	-- find out how many hogs per team, and the index of the first hog in hhs
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   177
	for i = 0, (numTeams-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   178
		for z = 0, (numhhs-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   179
			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   180
				teamClan[i] = GetHogClan(hhs[z])
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   181
				if teamSize[i] == 0 then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   182
					teamIndex[i] = z -- should give starting index
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   183
				end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   184
				teamSize[i] = teamSize[i] + 1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   185
				--add a pointer so this hog appears at i in hhs
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   186
			end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   187
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   188
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   189
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   190
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   191
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   192
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   193
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   194
-----------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   195
-- RACER METHODS
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   196
-----------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   197
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   198
function CheckWaypoints()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   199
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   200
	trackFinished = true
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   201
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   202
	for i = 0, (wpCount-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   203
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   204
		g1X, g1Y = GetGearPosition(CurrentHedgehog)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   205
		g2X, g2Y = wpX[i], wpY[i]
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   206
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   207
		g1X = g1X - g2X
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   208
		g1Y = g1Y - g2Y
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   209
		dist = (g1X*g1X) + (g1Y*g1Y)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   210
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   211
		--if i == 0 then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   212
		--	AddCaption(dist .. "/" .. (wpRad*wpRad) )
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   213
		--end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   214
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   215
		NR = (48/100*wpRad)/2
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   216
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   217
		if dist < (NR*NR) then
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   218
		--if dist < (wpRad*wpRad) then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   219
			--AddCaption("howdy")
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   220
			wpActive[i] = true
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   221
			wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog)) -- new				--GetClanColor(1)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   222
			SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   223
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   224
			wpRem = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   225
			for k = 0, (wpCount-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   226
				if wpActive[k] == false then
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   227
					wpRem = wpRem + 1
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   228
				end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   229
			end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   230
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   231
			AddCaption(loc("Way-Points Remaining") .. ": " .. wpRem,0xffba00ff,capgrpAmmoinfo)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   232
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   233
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   234
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   235
		if wpActive[i] == false then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   236
			trackFinished = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   237
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   238
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   239
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   240
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   241
	return(trackFinished)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   242
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   243
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   244
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   245
function AdjustScores()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   246
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   247
	if bestTime == nil then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   248
		bestTime = 100000
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   249
		bestClan = 10
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   250
		bestTimeComment = "N/A"
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   251
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   252
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   253
	newScore = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   254
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   255
	-- update this clan's time if the new track is better
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   256
	for i = 0, (numTeams-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   257
		if teamClan[i] == GetHogClan(CurrentHedgehog) then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   258
			if trackTime < teamScore[i] then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   259
				teamScore[i] = trackTime
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   260
				newScore = true
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   261
			else
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   262
				newScore = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   263
			end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   264
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   265
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   266
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   267
	--bestTime = 100000
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   268
	--bestClan = 10
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   269
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   270
	-- find the best time out of those so far
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   271
	for i = 0, (numTeams-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   272
		if teamScore[i] < bestTime then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   273
			bestTime = teamScore[i]
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   274
			bestClan = teamClan[i]
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   275
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   276
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   277
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   278
	if bestTime ~= 100000 then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   279
		bestTimeComment = (bestTime/1000) ..loc("s")
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   280
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   281
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   282
	if newScore == true then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   283
		if trackTime == bestTime then -- best time of the race
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   284
			ShowMission(loc("RACER"),
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   285
			loc("TRACK COMPLETED"),
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   286
			loc("NEW RACE RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   287
			loc("WINNING TIME: ") .. bestTimeComment, 0, 4000)
5901
a00e567005be Add sounds for incorrectly placed waypoint, fastest time, and no record of any kind.
mikade
parents: 5900
diff changeset
   288
			PlaySound(sndHomerun)
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   289
		else	-- best time for the clan
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   290
			ShowMission(loc("RACER"),
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   291
			loc("TRACK COMPLETED"),
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   292
			loc("NEW CLAN RECORD: ") .. (trackTime/1000) ..loc("s") .. "|" ..
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   293
			loc("WINNING TIME: ") .. bestTimeComment, 4, 4000)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   294
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   295
	else -- not any kind of new score
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   296
		ShowMission(loc("RACER"),
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   297
		loc("TRACK COMPLETED"),
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   298
		loc("TIME: ") .. (trackTime/1000) ..loc("s") .. "|" ..
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   299
		loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
5901
a00e567005be Add sounds for incorrectly placed waypoint, fastest time, and no record of any kind.
mikade
parents: 5900
diff changeset
   300
		PlaySound(sndHellish)
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   301
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   302
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   303
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   304
	--------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   305
	--new
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   306
	--------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   307
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   308
	if bestTime == trackTime then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   309
		--AddCaption("wooooooooooooooooooooooooooooo")
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   310
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   311
		fastColour = GetClanColor(GetHogClan(CurrentHedgehog))
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   312
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   313
		for i = 0, (currCount-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   314
			fastX[i] = currX[i]
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   315
			fastY[i] = currY[i]
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   316
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   317
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   318
		fastCount = currCount
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   319
		fastIndex = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   320
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   321
		--currCount = 0 -- is this needed?
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   322
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   323
	else
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   324
		currCount = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   325
		fastIndex = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   326
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   327
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   328
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   329
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   330
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   331
function onNewRound()
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   332
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   333
	roundNumber = roundNumber + 1
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   334
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   335
	totalComment = ""
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   336
	for i = 0, (TeamsCount-1) do
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   337
			if teamNameArr[i] ~= " " then				-- teamScore[teamClan[i]]
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   338
				teamComment[i] = teamNameArr[i] .. ": " .. (teamScore[i]/1000) .. loc("s|")
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   339
				totalComment = totalComment .. teamComment[i]
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   340
			elseif teamNameArr[i] == " " then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   341
				teamComment[i] = "|"
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   342
			end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   343
	end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   344
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   345
	ShowMission(	loc("RACER"),
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   346
					loc("STATUS UPDATE"),
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   347
					loc("Rounds Complete: ") .. roundNumber .. "/" .. roundLimit .. "|" .. " " .. "|" ..
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   348
					loc("Best Team Times: ") .. "|" .. totalComment, 0, 4000)
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   349
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   350
	-- end game if its at round limit
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   351
	if roundNumber == roundLimit then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   352
		for i = 0, (numhhs-1) do
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   353
			if GetHogClan(hhs[i]) ~= bestClan then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   354
				SetEffect(hhs[i], heResurrectable, false)
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   355
				SetHealth(hhs[i],0)
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   356
			end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   357
		end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   358
		gameOver = true
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   359
		TurnTimeLeft = 1
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   360
	end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   361
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   362
end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   363
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   364
function CheckForNewRound()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   365
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   366
	-------------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   367
	------ new
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   368
	-------------
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   369
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   370
	--[[turnN = turnN + 1
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   371
	if gameBegun == false then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   372
		if turnN == 2 then
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   373
			for i = 0, (numhhs-1) do
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   374
				if hhs[i] ~= nil then
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   375
					SetEffect(hhs[i], heResurrectable, false)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   376
					SetHealth(hhs[i],0)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   377
				end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   378
			end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   379
			gameOver = true
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   380
			TurnTimeLeft = 1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   381
		end
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   382
	else
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   383
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   384
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   385
	end]]
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   386
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   387
	--[[if roundBegun == true then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   388
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   389
		if RoundHasChanged == true then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   390
			roundN = roundN + 1
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   391
			RoundHasChanged = false
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   392
			onNewRound()
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   393
		end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   394
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   395
		if lastRound ~= TotalRounds then -- new round, but not really
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   396
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   397
			if RoundHasChanged == false then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   398
				RoundHasChanged = true
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   399
			end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   400
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   401
		end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   402
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   403
		AddCaption("RoundN:" .. roundN .. "; " .. "TR: " .. TotalRounds)
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   404
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   405
		lastRound = TotalRounds
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   406
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   407
	end]]
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   408
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   409
	------------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   410
	----- old
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   411
	------------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   412
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   413
	if GetHogClan(CurrentHedgehog) == firstClan then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   414
		onNewRound()
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   415
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   416
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   417
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   418
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   419
function DisableTumbler()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   420
	currCount = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   421
	fastIndex = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   422
	TurnTimeLeft = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   423
	racerActive = false -- newadd
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   424
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   425
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   426
function HandleGhost()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   427
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   428
	-- get the current xy of the racer at this point
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   429
	currX[currCount] = GetX(CurrentHedgehog)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   430
	currY[currCount] = GetY(CurrentHedgehog)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   431
	currCount = currCount + 1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   432
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   433
	-- draw a ping of smoke where the fastest player was at this point
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   434
	if (fastCount ~= 0) and (fastIndex < fastCount) then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   435
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   436
		fastIndex = fastIndex + 1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   437
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   438
		tempE = AddVisualGear(fastX[fastIndex], fastY[fastIndex], vgtSmoke, 0, false)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   439
		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   440
		SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, fastColour )
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   441
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   442
		--AddCaption("fC: " .. fastIndex .. " / " .. fastCount)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   443
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   444
	else
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   445
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   446
		--AddCaption("excep fC: " .. fastIndex .. " / " .. fastCount)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   447
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   448
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   449
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   450
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   451
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   452
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   453
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   454
----------------------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   455
-- GAME METHODS / EVENT HANDLERS
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   456
----------------------------------
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   457
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   458
function onGameInit()
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   459
	GameFlags = GameFlags + gfInfAttack + gfInvulnerable
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   460
	CaseFreq = 0
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   461
	TurnTime = 90000
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   462
	WaterRise = 0
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   463
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   464
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   465
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   466
function onGameStart()
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   467
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   468
	roundN = 0
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   469
	lastRound = TotalRounds
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   470
	RoundHasChanged = false -- true
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   471
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   472
	RebuildTeamInfo()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   473
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   474
	ShowMission	(
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   475
				loc("RACER"),
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   476
				loc("a Hedgewars mini-game"),
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   477
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   478
				loc("Build a track and race.") .. "|" ..
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   479
				loc("Round Limit:") .. " " .. roundLimit .. "|" ..
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   480
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   481
				"", 4, 4000
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   482
				)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   483
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   484
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   485
function PlaceWayPoint(x,y)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   486
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   487
	if (wpCount < wpLimit) then -- seems to not work with a hedgehog nil chek
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   488
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   489
		wpX[wpCount] = x
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   490
		wpY[wpCount] = y
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   491
		wpCol[wpCount] = 0xffffffff
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   492
		wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   493
																		--100
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   494
		SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   495
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   496
		wpCount = wpCount + 1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   497
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   498
		AddCaption(loc("Waypoint placed.") .. " " .. loc("Available points remaining: ") .. (wpLimit-wpCount))
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   499
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   500
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   501
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   502
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   503
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   504
function onNewTurn()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   505
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   506
	CheckForNewRound()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   507
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   508
	racerActive = false
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   509
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   510
	trackTime = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   511
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   512
	currCount = 0 -- hopefully this solves problem
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   513
	AddAmmo(CurrentHedgehog, amAirAttack, 0)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   514
	gTimer = 0
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   515
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   516
	-- Set the waypoints to unactive on new round
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   517
	for i = 0,(wpCount-1) do
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   518
		wpActive[i] = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   519
		wpCol[i] = 0xffffffff
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   520
		SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   521
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   522
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   523
	-- Handle Starting Stage of Game
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   524
	if (gameOver == false) and (gameBegun == false) then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   525
		if wpCount >= 3 then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   526
			gameBegun = true
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   527
			roundNumber = 0
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   528
			firstClan = GetHogClan(CurrentHedgehog)
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   529
			ShowMission(loc("RACER"),
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   530
			loc("GAME BEGUN!!!"),
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   531
			loc("Complete the track as fast as you can!"), 2, 4000)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   532
		else
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   533
			ShowMission(loc("RACER"),
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   534
			loc("NOT ENOUGH WAYPOINTS"),
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   535
			loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   536
			AddAmmo(CurrentHedgehog, amAirAttack, 4000)
7142
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   537
            ParseCommand("setweap " .. string.char(amAirAttack))
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   538
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   539
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   540
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   541
	if gameOver == true then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   542
		gameBegun = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   543
		racerActive = false -- newadd
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   544
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   545
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   546
	AddAmmo(CurrentHedgehog, amTardis, 0)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   547
	AddAmmo(CurrentHedgehog, amDrillStrike, 0)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   548
	AddAmmo(CurrentHedgehog, amMineStrike, 0)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   549
	AddAmmo(CurrentHedgehog, amNapalm, 0)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   550
	AddAmmo(CurrentHedgehog, amPiano, 0)
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   551
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   552
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   553
7139
a47fd17ba463 Also change Highlander and Racer
nemo
parents: 6253
diff changeset
   554
function onGameTick20()
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   555
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   556
	-- airstrike detected, convert this into a potential waypoint spot
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   557
	if cGear ~= nil then
7142
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   558
		x,y = GetGearPosition(cGear)
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   559
        if x > -9000 then
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   560
            x,y = GetGearTarget(cGear)
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   561
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   562
7142
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   563
            if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   564
                AddCaption(loc("Please place the way-point in the open, within the map boundaries."))
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   565
                PlaySound(sndDenied)
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   566
            elseif (y > WaterLine-50) then
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   567
                AddCaption(loc("Please place the way-point further from the waterline."))
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   568
                PlaySound(sndDenied)
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   569
            else
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   570
                PlaceWayPoint(x, y)
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   571
                if wpCount == wpLimit then
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   572
                    AddCaption(loc("Race complexity limit reached."))
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   573
                    DisableTumbler()
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   574
                end
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   575
            end
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   576
        else
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   577
            DeleteGear(cGear)
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   578
        end
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   579
        SetGearPosition(cGear, -10000, 0)
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   580
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   581
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   582
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   583
	-- start the player tumbling with a boom once their turn has actually begun
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   584
	if racerActive == false then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   585
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   586
		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   587
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   588
			-- if the gamehas started put the player in the middle of the first
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   589
			--waypoint that was placed
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   590
			if gameBegun == true then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   591
				AddCaption(loc("Good to go!"))
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   592
				racerActive = true
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   593
				trackTime = 0
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   594
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   595
				SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   596
				AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   597
				FollowGear(CurrentHedgehog)
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   598
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   599
				HideMission()
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   600
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   601
			else
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   602
				-- still in placement mode
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   603
			end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   604
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   605
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   606
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   607
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   608
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   609
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   610
	-- has the player started his tumbling spree?
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   611
	if (CurrentHedgehog ~= nil) then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   612
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   613
		--airstrike conversion used to be here
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   614
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   615
		-- if the RACE has started, show tracktimes and keep tabs on waypoints
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   616
		if (racerActive == true) and (gameBegun == true) then
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   617
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   618
			--ghost
7139
a47fd17ba463 Also change Highlander and Racer
nemo
parents: 6253
diff changeset
   619
			if GameTime%40 == 0 then
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   620
				HandleGhost()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   621
			end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   622
7139
a47fd17ba463 Also change Highlander and Racer
nemo
parents: 6253
diff changeset
   623
			trackTime = trackTime + 20
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   624
7139
a47fd17ba463 Also change Highlander and Racer
nemo
parents: 6253
diff changeset
   625
			if GameTime%100 == 0 then
7142
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   626
                
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   627
                if trackTime%1000 == 0 then
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   628
                    AddCaption((trackTime/1000)..'.0',GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   629
                else
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   630
                    AddCaption(trackTime/1000,GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
8842fa26698b Set air attack to active by default, make time look a bit nicer, avoid plane buzz activating.
nemo
parents: 7139
diff changeset
   631
                end
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   632
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   633
				if (CheckWaypoints() == true) then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   634
					AdjustScores()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   635
					racerActive = false
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   636
					DisableTumbler()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   637
				end
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   638
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   639
			end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   640
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   641
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   642
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   643
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   644
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   645
		-- if the player has expended his tunbling time, stop him tumbling
7139
a47fd17ba463 Also change Highlander and Racer
nemo
parents: 6253
diff changeset
   646
		if TurnTimeLeft <= 20 then
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   647
			DisableTumbler()
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   648
		end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   649
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   650
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   651
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   652
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   653
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   654
function onGearResurrect(gear)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   655
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   656
	AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   657
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   658
	if gear == CurrentHedgehog then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   659
		DisableTumbler()
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   660
	end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5923
diff changeset
   661
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   662
	-- if the player stops and "dies" or flies into water, stop him racing
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   663
	--[[if gear == CurrentHedgehog then
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   664
		DisableTumbler()
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   665
		ShowMission(loc("RACER"),
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   666
		loc("TRACK FAILED!"),
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   667
		loc("WINNING TIME: ") .. bestTimeComment, -amSkip, 4000)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   668
	end]]
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   669
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   670
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   671
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   672
function onGearAdd(gear)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   673
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   674
	if GetGearType(gear) == gtHedgehog then
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   675
		hhs[numhhs] = gear
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   676
		numhhs = numhhs + 1
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   677
		SetEffect(gear, heResurrectable, true)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   678
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   679
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   680
	if GetGearType(gear) == gtAirAttack then
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   681
		cGear = gear
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   682
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   683
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   684
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   685
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   686
function onGearDelete(gear)
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   687
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   688
	if GetGearType(gear) == gtAirAttack then
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   689
		cGear = nil
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   690
	end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   691
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   692
end
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   693
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   694
--[[function onAmmoStoreInit()
5900
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   695
	SetAmmo(amRope, 9, 0, 0, 0)
37516a3bdb0e Revert currently unneccessary changes to uScript.
mikade
parents: 5894
diff changeset
   696
	SetAmmo(amJetpack, 9, 0, 0, 0)
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   697
	SetAmmo(amSkip, 9, 0, 0, 0)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5845
diff changeset
   698
end]]
5845
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   699
b20a1e0a0e7e Substitute broken Tumbler-based GaudyRacer with generic, map independant Racer.
mikade
parents:
diff changeset
   700