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