share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
author Wuzzy <almikes@aol.com>
Wed, 13 Apr 2016 14:00:03 +0200
changeset 11925 7123bfc9643c
parent 11924 ce277e51b603
child 11926 ace20b1d8d53
permissions -rw-r--r--
Racer: Don't mess with ammo display when touching waypoint
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     2
------------------------------------------
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
     3
-- RACER 0.8
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     4
-- map-independant racing script
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     5
-- by mikade
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     6
-----------------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     7
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     8
-----------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
     9
--0.1: took all the code from crazy racer and scrapped most of it
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    10
-----------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    11
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    12
-- Removed tumbler system
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    13
-- Removed extra adds like boosters etc
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    14
-- Added experimental waypoint placement system
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    15
-- More user feedback
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    16
-- Reduced race complexity limit to 5 waypoints
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    17
-- stop placement at complexity limit reached and end turn
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    18
-- guys dont keep racing after dying
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    19
-- invulnerable feasibility
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    20
-- reverted time keeping method
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    21
-- reduced feedback display time
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    22
-- colour-coded addcaptions
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    23
-- cleaned up code
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    24
-- support for more players properly added
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    25
-- tardis fix
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    26
-- remove airstrikes
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    27
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    28
-- i think the remainder 0 .456 sec of the tracktime isnt getting reset on newturn
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    29
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    30
-- update feedback
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    31
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    32
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    33
-- 0.2
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    34
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    35
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    36
-- allow gameflags
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    37
-- extend time to 90s
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    38
-- remove other air-attack based weps
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    39
-- turn off water rise for sd
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    40
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    41
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    42
-- 0.3
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    43
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    44
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    45
-- prevent WP being placed in land
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    46
-- prevent waypoints being placed outside border
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    47
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    48
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    49
-- 0.4
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    50
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    51
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    52
-- update user feedback
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    53
-- add more sounds
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    54
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    55
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    56
-- 0.5
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    57
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    58
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    59
-- fix ghost disappearing if hog falls in water or somehow dies
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    60
-- lengthen ghost tracking interval to improve performance on slower machines
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    61
-- increase waypoint limit to 8
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    62
-- allow for persistent showmission information
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    63
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    64
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    65
-- 0.6
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    66
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    67
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    68
-- remove hogs from racing area as per request
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    69
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    70
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    71
-- 0.7
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    72
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    73
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    74
-- switch to first available weapon if starting race with no weapon selected
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    75
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    76
-------
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    77
-- 0.8
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    78
-------
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    79
-- allow different boost directions
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    80
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    81
-----------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    82
-- SCRIPT BEGINS
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    83
-----------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    84
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    85
HedgewarsScriptLoad("/Scripts/Locale.lua")
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    86
HedgewarsScriptLoad("/Scripts/OfficialChallenges.lua")
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    87
HedgewarsScriptLoad("/Scripts/Params.lua")
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    88
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    89
------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    90
-- Got Variables?
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    91
------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    92
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    93
local fMod = 1000000 -- 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    94
local roundLimit = 3
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    95
local roundNumber = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    96
local firstClan = 10
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    97
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    98
local fastX = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    99
local fastY = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   100
local fastCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   101
local fastIndex = 0
11581
fd02a080d962 - Fix room config being sent unmodified
unc0rr
parents: 11569
diff changeset
   102
local fastColour = 0xffffffff
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   103
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   104
local currX = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   105
local currY = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   106
local currCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   107
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   108
local specialPointsX = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   109
local specialPointsY = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   110
local specialPointsCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   111
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   112
local TeamRope = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   113
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   114
--------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   115
-- hog and team tracking variales
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   116
--------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   117
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   118
local numhhs = 0 -- store number of hedgehogs
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   119
local hhs = {} -- store hedgehog gears
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   120
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   121
local numTeams --  store the number of teams in the game
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   122
local teamNameArr = {}  -- store the list of teams
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   123
local teamClan = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   124
local teamSize = {}     -- store how many hogs per team
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   125
local teamIndex = {} -- at what point in the hhs{} does each team begin
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   126
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   127
local teamComment = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   128
local teamScore = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   129
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   130
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   131
-- racer vars
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   132
--------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   133
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   134
local cGear = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   135
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   136
local bestClan = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   137
local bestTime = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   138
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   139
local gameBegun = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   140
local gameOver = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   141
local racerActive = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   142
local trackTime = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   143
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   144
local wpCirc = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   145
local wpX = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   146
local wpY = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   147
local wpCol = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   148
local wpActive = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   149
local wpRad = 450 --75
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   150
local wpCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   151
local wpLimit = 8
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   152
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   153
local usedWeapons = {}
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   154
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   155
local roundN
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   156
local lastRound
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   157
local RoundHasChanged
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   158
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   159
local boostX = 0
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   160
local boostY = 0
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   161
local boostValue = 1
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   162
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   163
-------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   164
-- general methods
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   165
-------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   166
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   167
function onParameters()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   168
    parseParams()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   169
    if params["teamrope"] ~= nil then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   170
        TeamRope = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   171
    end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   172
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   173
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   174
function RebuildTeamInfo()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   175
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   176
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   177
        -- make a list of individual team names
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   178
        for i = 0, (TeamsCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   179
                teamNameArr[i] = " " -- = i
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   180
                teamSize[i] = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   181
                teamIndex[i] = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   182
                teamScore[i] = 100000
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   183
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   184
        numTeams = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   185
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   186
        for i = 0, (numhhs-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   187
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   188
                z = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   189
                unfinished = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   190
                while(unfinished == true) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   191
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   192
                        newTeam = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   193
                        tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   194
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   195
                        if tempHogTeamName == teamNameArr[z] then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   196
                                newTeam = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   197
                                unfinished = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   198
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   199
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   200
                        z = z + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   201
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   202
                        if z == TeamsCount then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   203
                                unfinished = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   204
                                if newTeam == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   205
                                        teamNameArr[numTeams] = tempHogTeamName
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   206
                                        numTeams = numTeams + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   207
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   208
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   209
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   210
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   211
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   212
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   213
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   214
        -- find out how many hogs per team, and the index of the first hog in hhs
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   215
        for i = 0, (numTeams-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   216
                for z = 0, (numhhs-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   217
                        if GetHogTeamName(hhs[z]) == teamNameArr[i] then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   218
                                teamClan[i] = GetHogClan(hhs[z])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   219
                                if teamSize[i] == 0 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   220
                                        teamIndex[i] = z -- should give starting index
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   221
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   222
                                teamSize[i] = teamSize[i] + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   223
                                --add a pointer so this hog appears at i in hhs
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   224
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   225
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   226
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   227
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   228
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   229
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   230
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   231
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   232
-----------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   233
-- RACER METHODS
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   234
-----------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   235
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   236
function onLeft()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   237
	boostX = boostX +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   238
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   239
function onLeftUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   240
	boostX = boostX -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   241
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   242
function onRight()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   243
	boostX = boostX -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   244
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   245
function onRightUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   246
	boostX = boostX +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   247
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   248
function onUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   249
	boostY = boostY +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   250
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   251
function onUpUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   252
	boostY = boostY -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   253
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   254
function onDown()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   255
	boostY = boostY -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   256
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   257
function onDownUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   258
	boostY = boostY +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   259
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   260
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   261
function CheckWaypoints()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   262
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   263
        trackFinished = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   264
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   265
        for i = 0, (wpCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   266
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   267
                g1X, g1Y = GetGearPosition(CurrentHedgehog)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   268
                g2X, g2Y = wpX[i], wpY[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   269
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   270
                g1X = g1X - g2X
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   271
                g1Y = g1Y - g2Y
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   272
                dist = (g1X*g1X) + (g1Y*g1Y)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   273
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   274
                --if i == 0 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   275
                --      AddCaption(dist .. "/" .. (wpRad*wpRad) )
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   276
                --end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   277
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   278
                NR = (48/100*wpRad)/2
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   279
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   280
                if dist < (NR*NR) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   281
                --if dist < (wpRad*wpRad) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   282
                        --AddCaption("howdy")
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   283
                        wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog)) -- new                             --GetClanColor(1)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   284
                        SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   285
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   286
                        wpRem = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   287
                        for k = 0, (wpCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   288
                                if wpActive[k] == false then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   289
                                        wpRem = wpRem + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   290
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   291
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   292
11925
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   293
                        if wpActive[i] == false then
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   294
                                AddCaption(string.format(loc("Waypoints remaining: %d"), wpRem-1),0xffba00ff,capgrpGameState)
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   295
                        end
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   296
                        wpActive[i] = true
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   297
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   298
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   299
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   300
                if wpActive[i] == false then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   301
                        trackFinished = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   302
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   303
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   304
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   305
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   306
        return(trackFinished)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   307
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   308
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   309
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   310
function AdjustScores()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   311
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   312
        if bestTime == nil then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   313
                bestTime = 100000
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   314
                bestClan = 10
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   315
                bestTimeComment = "N/A"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   316
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   317
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   318
        newScore = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   319
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   320
        -- update this clan's time if the new track is better
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   321
        for i = 0, (numTeams-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   322
                if teamClan[i] == GetHogClan(CurrentHedgehog) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   323
                        if trackTime < teamScore[i] then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   324
                                teamScore[i] = trackTime
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   325
                                newScore = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   326
                        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   327
                                newScore = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   328
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   329
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   330
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   331
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   332
        --bestTime = 100000
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   333
        --bestClan = 10
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   334
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   335
        -- find the best time out of those so far
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   336
        for i = 0, (numTeams-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   337
                if teamScore[i] < bestTime then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   338
                        bestTime = teamScore[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   339
                        bestClan = teamClan[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   340
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   341
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   342
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   343
        if bestTime ~= 100000 then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   344
                bestTimeComment = string.format(loc("%.1fs"), (bestTime/1000))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   345
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   346
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   347
        if newScore == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   348
                if trackTime == bestTime then -- best time of the race
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   349
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   350
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   351
                        string.format(loc("New race record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   352
                        string.format(loc("Winning time: %s"), bestTimeComment), 0, 4000)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   353
                        PlaySound(sndHomerun)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   354
                else    -- best time for the clan
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   355
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   356
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   357
                        string.format(loc("New clan record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   358
                        string.format(loc("Winning time: %s"), bestTimeComment), 4, 4000)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   359
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   360
        else -- not any kind of new score
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   361
                ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   362
                loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   363
                string.format(loc("Time: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   364
                string.format(loc("Winning time: %s"), bestTimeComment), -amSkip, 4000)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   365
                PlaySound(sndHellish)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   366
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   367
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   368
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   369
        --------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   370
        --new
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   371
        --------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   372
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   373
        if bestTime == trackTime then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   374
                --AddCaption("wooooooooooooooooooooooooooooo")
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   375
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   376
                fastColour = GetClanColor(GetHogClan(CurrentHedgehog))
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   377
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   378
                for i = 0, (currCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   379
                        fastX[i] = currX[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   380
                        fastY[i] = currY[i]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   381
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   382
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   383
                fastCount = currCount
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   384
                fastIndex = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   385
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   386
                --currCount = 0 -- is this needed?
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   387
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   388
        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   389
                currCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   390
                fastIndex = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   391
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   392
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   393
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   394
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   395
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   396
function onNewRound()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   397
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   398
        roundNumber = roundNumber + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   399
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   400
        totalComment = ""
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   401
        for i = 0, (TeamsCount-1) do
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   402
                        if teamNameArr[i] ~= " " and teamScore[i] ~= -1 then
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   403
                                teamComment[i] = string.format(loc("%s: %.1fs"), teamNameArr[i], (teamScore[i]/1000)) .. "|"
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   404
                        else
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   405
                                teamComment[i] = string.format(loc("%s: N/A"), teamNameArr[i]) .. "|"
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   406
                        end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   407
                        totalComment = totalComment .. teamComment[i]
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   408
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   409
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   410
        ShowMission(    loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   411
                                        loc("Status update"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   412
                                        string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "|" .. " " .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   413
                                        loc("Best team times: ") .. "|" .. totalComment, 0, 4000)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   414
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   415
        -- end game if its at round limit
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   416
        if roundNumber >= roundLimit then
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   417
                gameOver = true
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   418
                TurnTimeLeft = 10000000
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   419
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   420
                -- Sort the scores for the ranking list
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   421
                local unfinishedArray = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   422
                local sortedTeams = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   423
                local k = 1
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   424
                for i = 0, TeamsCount-1 do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   425
                        if teamScore[i] ~= 100000 and teamNameArr[i] ~= " " then
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   426
                               sortedTeams[k] = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   427
                               sortedTeams[k].name = teamNameArr[i]
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   428
                               sortedTeams[k].score = teamScore[i]
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   429
                               k = k + 1
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   430
                        else
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   431
                               table.insert(unfinishedArray, string.format(loc("%s did not finish the race."), teamNameArr[i]))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   432
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   433
                end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   434
                table.sort(sortedTeams, function(team1, team2) return team1.score < team2.score end)
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   435
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   436
                -- Write all the stats!
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   437
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   438
                for i = 1, #sortedTeams do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   439
                        SendStat(siPointType, loc("milliseconds"))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   440
                        SendStat(siPlayerKills, sortedTeams[i].score, sortedTeams[i].name)
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   441
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   442
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   443
                if #sortedTeams >= 1 then
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   444
                        SendStat(siGameResult, string.format(loc("%s wins!"), sortedTeams[1].name))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   445
                        SendStat(siGameResult, string.format(loc("%s wins!"), sortedTeams[1].name))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   446
                        SendStat(siCustomAchievement, string.format(loc("%s wins with a best time of %.1fs."), sortedTeams[1].name, (sortedTeams[1].score/1000)))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   447
                        for i=1,#unfinishedArray do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   448
                                 SendStat(siCustomAchievement, unfinishedArray[i])
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   449
                        end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   450
                else
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   451
                        SendStat(siGameResult, loc("Round draw"))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   452
                        SendStat(siCustomAchievement, loc("Nobody managed to finish the race. What a shame!"))
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   453
                        SendStat(siCustomAchievement, loc("Maybe you should try easier waypoints next time."))
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   454
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   455
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   456
                -- Game over
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   457
                EndGame()
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   458
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   459
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   460
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   461
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   462
function CheckForNewRound()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   463
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   464
        -------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   465
        ------ new
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   466
        -------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   467
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   468
        --[[turnN = turnN + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   469
        if gameBegun == false then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   470
                if turnN == 2 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   471
                        for i = 0, (numhhs-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   472
                                if hhs[i] ~= nil then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   473
                                        SetEffect(hhs[i], heResurrectable, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   474
                                        SetHealth(hhs[i],0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   475
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   476
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   477
                        gameOver = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   478
                        TurnTimeLeft = 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   479
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   480
        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   481
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   482
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   483
        end]]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   484
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   485
        --[[if roundBegun == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   486
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   487
                if RoundHasChanged == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   488
                        roundN = roundN + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   489
                        RoundHasChanged = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   490
                        onNewRound()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   491
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   492
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   493
                if lastRound ~= TotalRounds then -- new round, but not really
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   494
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   495
                        if RoundHasChanged == false then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   496
                                RoundHasChanged = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   497
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   498
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   499
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   500
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   501
                AddCaption("RoundN:" .. roundN .. "; " .. "TR: " .. TotalRounds)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   502
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   503
                lastRound = TotalRounds
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   504
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   505
        end]]
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   506
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   507
        ------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   508
        ----- old
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   509
        ------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   510
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   511
        if GetHogClan(CurrentHedgehog) == firstClan then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   512
                onNewRound()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   513
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   514
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   515
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   516
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   517
function DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   518
        currCount = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   519
        fastIndex = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   520
        TurnTimeLeft = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   521
        racerActive = false -- newadd
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   522
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   523
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   524
function HandleGhost()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   525
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   526
        -- get the current xy of the racer at this point
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   527
        currX[currCount] = GetX(CurrentHedgehog)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   528
        currY[currCount] = GetY(CurrentHedgehog)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   529
        currCount = currCount + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   530
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   531
        -- draw a ping of smoke where the fastest player was at this point
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   532
        if (fastCount ~= 0) and (fastIndex < fastCount) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   533
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   534
                fastIndex = fastIndex + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   535
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   536
                tempE = AddVisualGear(fastX[fastIndex], fastY[fastIndex], vgtSmoke, 0, false)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   537
                g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   538
                SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, fastColour )
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   539
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   540
                --AddCaption("fC: " .. fastIndex .. " / " .. fastCount)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   541
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   542
        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   543
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   544
                --AddCaption("excep fC: " .. fastIndex .. " / " .. fastCount)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   545
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   546
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   547
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   548
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   549
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   550
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   551
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   552
function TryRepositionHogs()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   553
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   554
	if MapHasBorder() == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   555
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   556
		for i = 0, (numhhs-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   557
			if hhs[i] ~= nil then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   558
				SetGearPosition(hhs[i],GetX(hhs[i]), TopY-10)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   559
			end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   560
		end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   561
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   562
	end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   563
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   564
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   565
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   566
----------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   567
-- GAME METHODS / EVENT HANDLERS
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   568
----------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   569
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   570
function onGameInit()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   571
        EnableGameFlags(gfInfAttack, gfInvulnerable)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   572
        CaseFreq = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   573
        TurnTime = 90000
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   574
        WaterRise = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   575
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   576
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   577
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   578
function onGameStart()
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   579
        SendHealthStatsOff()
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   580
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   581
        roundN = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   582
        lastRound = TotalRounds
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   583
        RoundHasChanged = false -- true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   584
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   585
        for i = 0, (specialPointsCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   586
                PlaceWayPoint(specialPointsX[i], specialPointsY[i])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   587
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   588
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   589
        RebuildTeamInfo()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   590
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   591
        ShowMission     (
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   592
                                loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   593
                                loc("A Hedgewars mini-game"),
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   594
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   595
                                loc("Build a track and race.") .. "|" ..
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   596
                                string.format(loc("Round limit: %d"), roundLimit) .. "|" ..
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   597
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   598
                                "", 4, 4000
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   599
                                )
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   600
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   601
        TryRepositionHogs()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   602
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   603
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   604
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   605
function PlaceWayPoint(x,y)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   606
    if not racerActive then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   607
        if wpCount == 0 or wpX[wpCount - 1] ~= x or wpY[wpCount - 1] ~= y then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   608
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   609
            wpX[wpCount] = x
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   610
            wpY[wpCount] = y
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   611
            wpCol[wpCount] = 0xffffffff
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   612
            wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   613
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   614
            SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], 20, 100, 1, 10, 0, wpRad, 5, wpCol[wpCount])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   615
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   616
            wpCount = wpCount + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   617
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   618
            AddCaption(string.format(loc("Waypoint placed. Available points remaining: %d"), wpLimit-wpCount))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   619
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   620
    end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   621
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   622
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   623
function onSpecialPoint(x,y,flag)
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   624
    if flag == 99 then
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   625
        fastX[fastCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   626
        fastY[fastCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   627
        fastCount = fastCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   628
    else
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   629
        addHashData(x)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   630
        addHashData(y)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   631
        addHashData(flag)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   632
        specialPointsX[specialPointsCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   633
        specialPointsY[specialPointsCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   634
        specialPointsCount = specialPointsCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   635
    end
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   636
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   637
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   638
function onNewTurn()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   639
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   640
        CheckForNewRound()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   641
        TryRepositionHogs()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   642
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   643
        racerActive = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   644
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   645
        trackTime = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   646
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   647
        currCount = 0 -- hopefully this solves problem
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   648
        AddAmmo(CurrentHedgehog, amAirAttack, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   649
        gTimer = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   650
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   651
        -- Set the waypoints to unactive on new round
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   652
        for i = 0,(wpCount-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   653
                wpActive[i] = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   654
                wpCol[i] = 0xffffffff
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   655
                SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 20, 100, 1, 10, 0, wpRad, 5, wpCol[i])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   656
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   657
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   658
        -- Handle Starting Stage of Game
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   659
        if (gameOver == false) and (gameBegun == false) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   660
                if wpCount >= 3 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   661
                        gameBegun = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   662
                        roundNumber = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   663
                        firstClan = GetHogClan(CurrentHedgehog)
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   664
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   665
                        loc("A Hedgewars mini-game"),
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   666
                        loc("Complete the track as fast as you can!"), 2, 4000)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   667
                else
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   668
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   669
                        loc("Waypoint placement phase"),
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   670
                        loc("Place more waypoints using the 'Air Attack' weapon."), 2, 4000)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   671
                        AddAmmo(CurrentHedgehog, amAirAttack, 4000)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   672
                        SetWeapon(amAirAttack)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   673
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   674
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   675
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   676
        if gameOver == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   677
                gameBegun = false
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   678
                racerActive = false -- newadd
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   679
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   680
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   681
        AddAmmo(CurrentHedgehog, amTardis, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   682
        AddAmmo(CurrentHedgehog, amDrillStrike, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   683
        AddAmmo(CurrentHedgehog, amMineStrike, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   684
        AddAmmo(CurrentHedgehog, amNapalm, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   685
        AddAmmo(CurrentHedgehog, amPiano, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   686
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   687
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   688
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   689
function onGameTick20()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   690
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   691
        -- airstrike detected, convert this into a potential waypoint spot
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   692
        if cGear ~= nil then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   693
                x,y = GetGearPosition(cGear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   694
                if x > -9000 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   695
                        x,y = GetGearTarget(cGear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   696
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   697
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   698
                        if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   699
                                AddCaption(loc("Please place the waypoint in the air, within the map boundaries"))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   700
                                PlaySound(sndDenied)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   701
                        elseif (y > WaterLine-50) then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   702
                                AddCaption(loc("Please place the waypoint further away from the waterline"))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   703
                                PlaySound(sndDenied)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   704
                        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   705
                                PlaceWayPoint(x, y)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   706
                                if wpCount == wpLimit then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   707
                                        AddCaption(loc("Race complexity limit reached"))
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   708
                                        DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   709
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   710
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   711
                else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   712
                        DeleteGear(cGear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   713
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   714
        SetGearPosition(cGear, -10000, 0)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   715
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   716
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   717
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   718
        -- start the player tumbling with a boom once their turn has actually begun
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   719
        if racerActive == false then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   720
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   721
                if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   722
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   723
                        -- if the gamehas started put the player in the middle of the first
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   724
                        --waypoint that was placed
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   725
                        if gameBegun == true then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   726
                                AddCaption(loc("Good to go!"))
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   727
                                racerActive = true
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   728
                                trackTime = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   729
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   730
                                SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
11648
mikade <redgrinner@gmail.com>
parents: 11647
diff changeset
   731
                                AddGear(GetX(CurrentHedgehog)+boostX, GetY(CurrentHedgehog)+boostY, gtGrenade, 0, 0, 0, 1)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   732
                                FollowGear(CurrentHedgehog)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   733
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   734
                                HideMission()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   735
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   736
                                -- don't start empty-handed
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   737
                                if (GetCurAmmoType() == amNothing) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   738
                                        SetNextWeapon()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   739
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   740
                        else
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   741
                                -- still in placement mode
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   742
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   743
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   744
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   745
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   746
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   747
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   748
        -- has the player started his tumbling spree?
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   749
        if (CurrentHedgehog ~= nil) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   750
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   751
                --airstrike conversion used to be here
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   752
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   753
                -- if the RACE has started, show tracktimes and keep tabs on waypoints
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   754
                if (racerActive == true) and (gameBegun == true) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   755
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   756
                        --ghost
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   757
                        if GameTime%40 == 0 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   758
                                HandleGhost()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   759
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   760
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   761
                        trackTime = trackTime + 20
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   762
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   763
                        if GameTime%100 == 0 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   764
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   765
                                AddCaption(string.format(loc("Time: %.1fs"), (trackTime/1000)),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage2)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   766
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   767
                                if (CheckWaypoints() == true) then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   768
                                        AdjustScores()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   769
                                        DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   770
                                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   771
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   772
                        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   773
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   774
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   775
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   776
                -- if the player has expended his tunbling time, stop him tumbling
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   777
                if TurnTimeLeft <= 20 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   778
                        DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   779
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   780
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   781
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   782
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   783
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   784
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   785
function onGearResurrect(gear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   786
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   787
        AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   788
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   789
        if gear == CurrentHedgehog then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   790
                DisableTumbler()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   791
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   792
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   793
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   794
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   795
function onGearAdd(gear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   796
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   797
        if GetGearType(gear) == gtHedgehog then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   798
                hhs[numhhs] = gear
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   799
                numhhs = numhhs + 1
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   800
                SetEffect(gear, heResurrectable, 1)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   801
        elseif GetGearType(gear) == gtAirAttack then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   802
                cGear = gear
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   803
        elseif GetGearType(gear) == gtRope and TeamRope then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   804
            SetTag(gear,1)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   805
            SetGearValues(gear,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,GetClanColor(GetHogClan(CurrentHedgehog)))
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   806
        elseif GetGearType(gear) == gtAirMine then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   807
            DeleteGear(gear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   808
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   809
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   810
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   811
function onGearDelete(gear)
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   812
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   813
        if GetGearType(gear) == gtAirAttack then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   814
                cGear = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   815
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   816
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   817
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   818
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   819
function onAttack()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   820
    at = GetCurAmmoType()
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   821
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   822
    usedWeapons[at] = 0
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   823
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   824
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   825
function onAchievementsDeclaration()
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   826
    usedWeapons[amSkip] = nil
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   827
    usedWeapons[amExtraTime] = nil
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   828
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   829
    usedRope = usedWeapons[amRope] ~= nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   830
    usedPortal = usedWeapons[amPortalGun] ~= nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   831
    usedSaucer = usedWeapons[amJetpack] ~= nil
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   832
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   833
    usedWeapons[amNothing] = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   834
    usedWeapons[amRope] = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   835
    usedWeapons[amPortalGun] = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   836
    usedWeapons[amJetpack] = nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   837
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   838
    usedOther = next(usedWeapons) ~= nil
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   839
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   840
    if usedOther then -- smth besides nothing, skip, rope, portal or saucer used
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   841
        raceType = "unknown race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   842
    elseif usedRope and not usedPortal and not usedSaucer then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   843
        raceType = "rope race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   844
    elseif not usedRope and usedPortal and not usedSaucer then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   845
        raceType = "portal race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   846
    elseif not usedRope and not usedPortal and usedSaucer then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   847
        raceType = "saucer race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   848
    elseif (usedRope or usedPortal or usedSaucer or usedOther) == false then -- no weapons used at all?
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   849
        raceType = "no tools race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   850
    else -- at least two of rope, portal and saucer used
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   851
        raceType = "mixed race"
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   852
    end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   853
11545
86528b0cd491 detectMap() rewrite with more sane approach, also check waypoints placement to avoid cheating
unc0rr
parents: 11542
diff changeset
   854
    map = detectMapWithDigest()
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   855
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   856
    for i = 0, (numTeams-1) do
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   857
        if teamScore[i] < 100000 then
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   858
            DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   859
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   860
    end
11569
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   861
11585
026c329b1a13 Don't dump ghost points if map isn't detected
unc0rr
parents: 11581
diff changeset
   862
    if map ~= nil and fastCount > 0 then
11569
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   863
        StartGhostPoints(fastCount)
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   864
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   865
        for i = 0, (fastCount - 1) do
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   866
            DumpPoint(fastX[i], fastY[i])
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   867
        end
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
   868
    end
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   869
end