share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
author Wuzzy <Wuzzy2@mail.ru>
Fri, 02 Nov 2018 10:31:08 +0100
changeset 14075 a5be3ef4bbbe
parent 13846 b2cc4e4e380c
child 14257 bdc7ba72bbad
permissions -rw-r--r--
Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
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
------------------------------------------
11652
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
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
12393
0eb1457f7b94 Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents: 12338
diff changeset
     8
-- DEVELOPER WARNING - FOR OFFICIAL DEVELOPMENT --
0eb1457f7b94 Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents: 12338
diff changeset
     9
-- Be careful when editig this script, do not introduce changes lightly!
0eb1457f7b94 Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents: 12338
diff changeset
    10
-- This script is used for time records on the official Hedgewars server.
0eb1457f7b94 Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents: 12338
diff changeset
    11
-- Introducing breaking changes means we have to invalidate past time records!
0eb1457f7b94 Add big fat developer warning to all racing scripts about compability
Wuzzy <almikes@aol.com>
parents: 12338
diff changeset
    12
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
    13
-----------------------------------
d080b8d4c114 team coloured, just for the 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
--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
    15
-----------------------------------
d080b8d4c114 team coloured, just for the 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
d080b8d4c114 team coloured, just for the 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
-- 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
    18
-- 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
    19
-- 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
    20
-- 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
    21
-- 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
    22
-- 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
    23
-- 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
    24
-- 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
    25
-- 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
    26
-- 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
    27
-- 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
    28
-- 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
    29
-- 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
    30
-- 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
    31
-- 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
    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
-- 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
    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
-- 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
    36
d080b8d4c114 team coloured, just for the 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
-------
d080b8d4c114 team coloured, just for the 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
-- 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
    39
-------
d080b8d4c114 team coloured, just for the 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
-- 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
    42
-- 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
    43
-- 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
    44
-- 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
    45
d080b8d4c114 team coloured, just for the 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
-------
d080b8d4c114 team coloured, just for the 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
-- 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
    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
d080b8d4c114 team coloured, just for the 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
-- 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
    51
-- 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
    52
d080b8d4c114 team coloured, just for the 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
-------
d080b8d4c114 team coloured, just for the 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
-- 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
    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
d080b8d4c114 team coloured, just for the 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
-- 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
    58
-- 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
    59
d080b8d4c114 team coloured, just for the 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
-------
d080b8d4c114 team coloured, just for the 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
-- 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
    62
-------
d080b8d4c114 team coloured, just for the 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
-- 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
    65
-- 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
    66
-- 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
    67
-- 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
    68
d080b8d4c114 team coloured, just for the 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
-- 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
    71
-------
d080b8d4c114 team coloured, just for the 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
-- 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
    74
d080b8d4c114 team coloured, just for the 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
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    76
-- 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
    77
-------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    78
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    79
-- 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
    80
11652
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
    81
-------
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
    82
-- 0.8
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
    83
-------
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
    84
-- allow different boost directions
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
    85
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
    86
-----------------------------
d080b8d4c114 team coloured, just for the 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
-- 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
    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
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
    91
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
    92
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
    93
d080b8d4c114 team coloured, just for the 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
------------------
d080b8d4c114 team coloured, just for the 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
-- 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
    96
------------------
d080b8d4c114 team coloured, just for the 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 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
    99
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
   100
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
   101
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   102
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
   103
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
   104
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
   105
local fastIndex = 0
11586
fd02a080d962 - Fix room config being sent unmodified
unc0rr
parents: 11574
diff changeset
   106
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
   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 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
   109
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
   110
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
   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 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
   113
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
   114
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
   115
d080b8d4c114 team coloured, just for the 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
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
   117
13134
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   118
local waypointCursor = false
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   119
local waypointPreview = nil
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   120
14075
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13846
diff changeset
   121
local officialChallenge
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13846
diff changeset
   122
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
   123
--------------------------
d080b8d4c114 team coloured, just for the 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
-- 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
   125
--------------------------
d080b8d4c114 team coloured, just for the 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 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
   128
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
   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
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
   131
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
   132
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
   133
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
   134
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
   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 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
   137
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
   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
-------
d080b8d4c114 team coloured, just for the 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
-- 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
   141
--------
d080b8d4c114 team coloured, just for the 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
d080b8d4c114 team coloured, just for the 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
local cGear = nil
13029
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   144
local cameraGear = nil -- gear created to center the cameera on
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
   145
11935
4ed643879c0f Racer: Clean up “did not finish” mess
Wuzzy <almikes@aol.com>
parents: 11934
diff changeset
   146
local bestClan = 10
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   147
local bestTime = MAX_TURN_TIME
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
   148
d080b8d4c114 team coloured, just for the 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 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
   150
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
   151
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
   152
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
   153
d080b8d4c114 team coloured, just for the 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
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
   155
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
   156
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
   157
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
   158
local wpActive = {}
11934
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   159
local wpRad = 450
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
   160
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
   161
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
   162
d080b8d4c114 team coloured, just for the 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
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
   164
d080b8d4c114 team coloured, just for the 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
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
   166
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
   167
local RoundHasChanged
12412
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
   168
local turnSkipped = false
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
   169
11652
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   170
local boostX = 0
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   171
local boostY = 0
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   172
local boostValue = 1
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   173
12972
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   174
-- themes with bright background
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   175
local brightThemes = {
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   176
	Bath = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   177
	Bamboo = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   178
	Beach = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   179
	Blox = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   180
	Compost = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   181
	Desert = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   182
	Fruit = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   183
	Golf = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   184
	Hoggywood = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   185
	Jungle = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   186
	Olympics = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   187
	Sheep = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   188
}
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   189
-- themes with medium or heavily mixed brightness.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   190
-- only add themes here if both bright and dark waypoint
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   191
-- colors fail otherwise.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   192
local mediumThemes = {
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   193
	Halloween = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   194
}
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   195
-- All themes not explicitly listed above are assumed to
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   196
-- be "dark" and work with the default bright waypoints.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   197
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   198
-- Waypoint colors in 3 color themes!
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   199
-- We do this so the waypoints are easy on the eyes,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   200
-- at least in each of the default themes.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   201
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   202
-- Bright waypoints (default)
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   203
local waypointColourBright = 0xFFFFFFFF -- Primary colour of inactive waypoints
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   204
local waypointColourBrightAtPlacement = 0xAAAAAAFF -- Colour of non-highlighted waypoints while placing
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   205
-- Medium bright waypoints
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   206
local waypointColourMedium = 0x606060FF
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   207
local waypointColourMediumAtPlacement = 0x404040FF
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   208
-- Dark waypoints
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   209
local waypointColourDark = 0x000000FF
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   210
local waypointColourDarkAtPlacement = 0x303030FF
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   211
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   212
-- Waypoints touched by the players assume the clan color, which is unchanged.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   213
-- Touched waypoints are not important to be visible.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   214
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   215
-- Default waypoint colors (only use these color variables in the code below)
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   216
local waypointColour = waypointColourBright
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   217
local waypointColourAtPlacement = waypointColourBrightAtPlacement
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   218
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
   219
-------------------
d080b8d4c114 team coloured, just for the 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
-- 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
   221
-------------------
d080b8d4c114 team coloured, just for the 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
12972
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   223
-- Returns brightness level of background from 1-3.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   224
-- 1 = brightest
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   225
function GetBackgroundBrightness()
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   226
	-- This just looks at the theme names above.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   227
	-- This code will fail for bright unofficial themes.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   228
	-- TODO: Change how this thing works.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   229
	-- Consider adding a function into the Lua API which looks
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   230
	-- up the theme's sky color, so we could use thit instead.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   231
	if brightThemes[Theme] then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   232
		return 1
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   233
	elseif mediumThemes[Theme] then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   234
		return 2
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   235
	else
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   236
		return 3
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   237
	end
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   238
end
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   239
11934
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   240
--[[
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   241
Parameters syntax:
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   242
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   243
teamrope=true
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   244
--> The team will be colored in the color of the team.
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   245
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   246
rounds=N
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   247
--> The game will be played with N rounds (default: 3)
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   248
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   249
waypointradius=N
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   250
--> The waypoints have a radius of N pixels (default: 450)
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   251
11991
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   252
maxwaypoints=N
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   253
--> The maximum number of waypoints to be placed (default: 8)
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   254
11934
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   255
]]
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   256
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
   257
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
   258
    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
   259
    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
   260
        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
   261
    end
11931
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11930
diff changeset
   262
    if params["rounds"] ~= nil then
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11930
diff changeset
   263
        roundLimit = math.max(1, math.floor(tonumber(params["rounds"])))
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11930
diff changeset
   264
        if type(roundLimit) ~= "number" then
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11930
diff changeset
   265
             roundLimit = 3
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11930
diff changeset
   266
        end
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11930
diff changeset
   267
    end
11934
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   268
    if params["waypointradius"] ~= nil then
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   269
        wpRad = math.max(40, math.floor(tonumber(params["waypointradius"])))
11990
b2783dd12f30 Fix incorrect type check of wpRad in Racer
Wuzzy <almikes@aol.com>
parents: 11989
diff changeset
   270
        if type(wpRad) ~= "number" then
11934
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   271
             wpRad = 450
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   272
        end
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11933
diff changeset
   273
    end
11991
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   274
    if params["maxwaypoints"] ~= nil then
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   275
        wpLimit = math.max(2, math.floor(tonumber(params["maxwaypoints"])))
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   276
        if type(wpLimit) ~= "number" then
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   277
             wpLimit = 8
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   278
        end
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   279
    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
   280
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
   281
d080b8d4c114 team coloured, just for the 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
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
   283
d080b8d4c114 team coloured, just for the 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
d080b8d4c114 team coloured, just for the 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
        -- 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
   286
        for i = 0, (TeamsCount-1) do
11933
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11932
diff changeset
   287
                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
   288
                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
   289
                teamIndex[i] = 0
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   290
                teamScore[i] = MAX_TURN_TIME
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
   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
        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
   293
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   294
        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
   295
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   296
                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
   297
                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
   298
                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
   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
                        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
   301
                        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
   302
d080b8d4c114 team coloured, just for the 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
                        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
   304
                                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
   305
                                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
   306
                        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
   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
                        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
   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
                        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
   311
                                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
   312
                                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
   313
                                        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
   314
                                        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
   315
                                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
   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
                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
   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
        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
   321
d080b8d4c114 team coloured, just for the 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
        -- 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
   323
        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
   324
                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
   325
                        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
   326
                                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
   327
                                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
   328
                                        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
   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
                                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
   331
                                --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
   332
                        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
   333
                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
   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
        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
   336
d080b8d4c114 team coloured, just for the 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
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
   338
d080b8d4c114 team coloured, just for the 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
d080b8d4c114 team coloured, just for the 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
-----------------
d080b8d4c114 team coloured, just for the 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
-- 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
   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
11652
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   344
function onLeft()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   345
	boostX = boostX +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   346
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   347
function onLeftUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   348
	boostX = boostX -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   349
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   350
function onRight()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   351
	boostX = boostX -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   352
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   353
function onRightUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   354
	boostX = boostX +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   355
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   356
function onUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   357
	boostY = boostY +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   358
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   359
function onUpUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   360
	boostY = boostY -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   361
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   362
function onDown()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   363
	boostY = boostY -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   364
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   365
function onDownUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   366
	boostY = boostY +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   367
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11590
diff changeset
   368
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
   369
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
   370
d080b8d4c114 team coloured, just for the 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
        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
   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
        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
   374
d080b8d4c114 team coloured, just for the 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
                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
   376
                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
   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
                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
   379
                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
   380
                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
   381
d080b8d4c114 team coloured, just for the 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
                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
   383
d080b8d4c114 team coloured, just for the 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
                if dist < (NR*NR) then
11933
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11932
diff changeset
   385
                        wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog))
12967
52c12029c7bd Increase opacity of Racer/TechRacer waypoints
Wuzzy <Wuzzy2@mail.ru>
parents: 12412
diff changeset
   386
                        SetVisualGearValues(wpCirc[i], wpX[i], wpY[i], 64, 64, 1, 10, 0, wpRad, 5, wpCol[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
   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
                        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
   389
                        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
   390
                                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
   391
                                        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
   392
                                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
   393
                        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
   394
11930
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11929
diff changeset
   395
                        if wpActive[i] == false then
11932
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   396
                                local wpMessage = ""
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   397
                                if wpRem-1 == 0 then
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   398
                                         wpMessage = loc("Track completed!")
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   399
                                else
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   400
                                         wpMessage = string.format(loc("Waypoints remaining: %d"), wpRem-1)
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   401
                                end
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   402
                                AddCaption(wpMessage, 0xffba00ff, capgrpGameState)
11930
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11929
diff changeset
   403
                        end
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11929
diff changeset
   404
                        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
   405
d080b8d4c114 team coloured, just for the 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
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   407
d080b8d4c114 team coloured, just for the 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
                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
   409
                        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
   410
                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
   411
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   412
        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
   413
d080b8d4c114 team coloured, just for the 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
        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
   415
d080b8d4c114 team coloured, just for the 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
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
   417
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   418
function AdjustScores()
11935
4ed643879c0f Racer: Clean up “did not finish” mess
Wuzzy <almikes@aol.com>
parents: 11934
diff changeset
   419
	bestTimeComment = loc("Did not finish")
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
   420
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   421
        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
   422
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   423
        -- 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
   424
        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
   425
                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
   426
                        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
   427
                                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
   428
                                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
   429
                        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
   430
                                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
   431
                        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
   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
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   434
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   435
        -- 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
   436
        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
   437
                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
   438
                        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
   439
                        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
   440
                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
   441
        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
   442
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   443
        if bestTime ~= MAX_TURN_TIME then
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   444
                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
   445
        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
   446
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   447
        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
   448
                if trackTime == bestTime then -- best time of the race
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   449
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   450
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   451
                        string.format(loc("New race record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   452
                        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
   453
                        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
   454
                else    -- best time for the clan
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   455
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   456
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   457
                        string.format(loc("New clan record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   458
                        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
   459
                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
   460
        else -- not any kind of new score
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   461
                ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   462
                loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   463
                string.format(loc("Time: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   464
                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
   465
                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
   466
        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
   467
13032
625d5a45f267 Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents: 13029
diff changeset
   468
        for i = 0, (TeamsCount-1) do
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   469
                if teamNameArr[i] ~= " " and teamScore[i] ~= MAX_TURN_TIME then
13032
625d5a45f267 Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents: 13029
diff changeset
   470
                        SetTeamLabel(teamNameArr[i], string.format(loc("%.1fs"), teamScore[i]/1000))
625d5a45f267 Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents: 13029
diff changeset
   471
                end
625d5a45f267 Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents: 13029
diff changeset
   472
        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
   473
d080b8d4c114 team coloured, just for the 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
        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
   475
d080b8d4c114 team coloured, just for the 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
                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
   477
d080b8d4c114 team coloured, just for the 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
                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
   479
                        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
   480
                        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
   481
                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
   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
                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
   484
                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
   485
d080b8d4c114 team coloured, just for the 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
        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
   487
                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
   488
                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
   489
        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
   490
d080b8d4c114 team coloured, just for the 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
d080b8d4c114 team coloured, just for the 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
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
   493
d080b8d4c114 team coloured, just for the 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
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
   495
d080b8d4c114 team coloured, just for the 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
        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
   497
d080b8d4c114 team coloured, just for the 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
        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
   499
        for i = 0, (TeamsCount-1) do
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   500
                        if teamNameArr[i] ~= " " and teamScore[i] ~= MAX_TURN_TIME then
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   501
                                teamComment[i] = string.format(loc("%s: %.1fs"), teamNameArr[i], (teamScore[i]/1000)) .. "|"
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   502
                        else
11935
4ed643879c0f Racer: Clean up “did not finish” mess
Wuzzy <almikes@aol.com>
parents: 11934
diff changeset
   503
                                teamComment[i] = string.format(loc("%s: Did not finish"), 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
   504
                        end
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   505
                        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
   506
        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
   507
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   508
        ShowMission(    loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   509
                                        loc("Status update"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   510
                                        string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "|" .. " " .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   511
                                        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
   512
d080b8d4c114 team coloured, just for the 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 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
   514
        if roundNumber >= roundLimit then
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   515
                -- Sort the scores for the ranking list
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   516
                local unfinishedArray = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   517
                local sortedTeams = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   518
                local k = 1
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   519
                local c = 1
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   520
                local clanScores = {}
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   521
                local previousClan
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   522
                for i = 0, TeamsCount-1 do
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   523
                        local clan = GetTeamClan(teamNameArr[i])
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   524
                        if not clanScores[clan+1] then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   525
	                       clanScores[clan+1] = {}
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   526
	                       clanScores[clan+1].index = clan
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   527
	                       clanScores[clan+1].score = teamScore[i]
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   528
                        end
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   529
                        if teamScore[i] ~= MAX_TURN_TIME and teamNameArr[i] ~= " " then
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   530
                               sortedTeams[k] = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   531
                               sortedTeams[k].name = teamNameArr[i]
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   532
                               sortedTeams[k].score = teamScore[i]
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   533
	                       sortedTeams[k].clan = clan
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   534
                               k = k + 1
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   535
                        else
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   536
                               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
   537
                        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
   538
                end
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   539
                table.sort(sortedTeams, function(team1, team2)
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   540
                        if team1.score == team2.score then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   541
                                return team1.clan < team2.clan
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   542
                        else
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   543
                                return team1.score < team2.score
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   544
                        end
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   545
                end)
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   546
                table.sort(clanScores, function(clan1, clan2) return clan1.score < clan2.score end)
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   547
                local rank = 0
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   548
                local rankPlus = 0
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   549
                local prevScore
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   550
                local clanRanks = {}
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   551
                for c = 1, #clanScores do
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   552
                        rankPlus = rankPlus + 1
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   553
                        if clanScores[c].score ~= prevScore then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   554
                                rank = rank + rankPlus
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   555
                                rankPlus = 0
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   556
                        end
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   557
                        prevScore = clanScores[c].score
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   558
                        clanRanks[clanScores[c].index] = rank
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   559
                end
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   560
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   561
                -- Write all the stats!
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   562
                for i = 1, #sortedTeams do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   563
                        SendStat(siPointType, loc("milliseconds"))
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   564
			SendStat(siTeamRank, tostring(clanRanks[GetTeamClan(sortedTeams[i].name)]))
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   565
                        SendStat(siPlayerKills, sortedTeams[i].score, sortedTeams[i].name)
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   566
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   567
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   568
		local roundDraw = false
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   569
		if #clanScores >= 2 and clanScores[1].score == clanScores[2].score and clanScores[1].score ~= MAX_TURN_TIME then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   570
			roundDraw = true
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   571
                        SendStat(siGameResult, loc("Round draw"))
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   572
                        SendStat(siCustomAchievement, loc("The teams are tied for the fastest time."))
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   573
                elseif #sortedTeams >= 1 then
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   574
                        SendStat(siGameResult, string.format(loc("%s wins!"), sortedTeams[1].name))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   575
                        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: 11653
diff changeset
   576
                        for i=1,#unfinishedArray do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   577
                                 SendStat(siCustomAchievement, unfinishedArray[i])
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   578
                        end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   579
                else
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   580
			roundDraw = true
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   581
                        SendStat(siGameResult, loc("Round draw"))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   582
                        SendStat(siCustomAchievement, loc("Nobody managed to finish the race. What a shame!"))
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   583
                        if specialPointsCount > 0 then
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   584
                                SendStat(siCustomAchievement, loc("Maybe you should try an easier map next time."))
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   585
                        else
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   586
                                SendStat(siCustomAchievement, loc("Maybe you should try easier waypoints next time."))
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   587
                        end
11928
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   588
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11653
diff changeset
   589
12338
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   590
		-- Kill all the losers
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   591
		for i = 0, (numhhs-1) do
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   592
			if GetHogClan(hhs[i]) ~= bestClan or roundDraw then
12338
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   593
				SetEffect(hhs[i], heResurrectable, 0)
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   594
				SetHealth(hhs[i],0)
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   595
			end
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   596
		end
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   597
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   598
		gameOver = true
12969
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12968
diff changeset
   599
                for i=0, wpCount-1 do
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12968
diff changeset
   600
                         -- Fade out waypoints
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12968
diff changeset
   601
                         SetVisualGearValues(wpCirc[i], nil, nil, 0, 0, nil, 6)
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12968
diff changeset
   602
                end
12338
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   603
		EndTurn(true)
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12292
diff changeset
   604
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
   605
        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
   606
d080b8d4c114 team coloured, just for the 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
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
   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
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
   610
d080b8d4c114 team coloured, just for the 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
        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
   612
                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
   613
        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
   614
d080b8d4c114 team coloured, just for the 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
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
   616
12292
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   617
function DisableTumbler(endTurn)
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   618
        if endTurn == nil then endTurn = true end
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   619
        if racerActive then
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   620
                currCount = 0
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   621
                fastIndex = 0
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   622
                if endTurn then
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   623
                        EndTurn(true)
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   624
                end
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   625
                racerActive = false -- newadd
12968
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   626
12969
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12968
diff changeset
   627
		if trackFinished and not gameOver then
12968
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   628
                         for i=0, wpCount-1 do
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   629
                       	         SetVisualGearValues(wpCirc[i], nil, nil, 255, 255, nil, 2)
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   630
                         end
12969
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12968
diff changeset
   631
                elseif not gameOver then
12968
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   632
                         for i=0, wpCount-1 do
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   633
                       	         SetVisualGearValues(wpCirc[i], nil, nil, 32, 32, nil, 1)
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   634
                         end
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   635
                end
12292
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   636
        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
   637
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
   638
d080b8d4c114 team coloured, just for the 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
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
   640
d080b8d4c114 team coloured, just for the 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
        -- 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
   642
        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
   643
        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
   644
        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
   645
d080b8d4c114 team coloured, just for the 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
        -- 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
   647
        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
   648
d080b8d4c114 team coloured, just for the 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
                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
   650
13690
09ea1faf97ca Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents: 13635
diff changeset
   651
                local tempE = AddVisualGear(fastX[fastIndex], fastY[fastIndex], vgtSmoke, 0, false)
09ea1faf97ca Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents: 13635
diff changeset
   652
                SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, fastColour )
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
   653
d080b8d4c114 team coloured, just for the 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
        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
   655
d080b8d4c114 team coloured, just for the 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
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
   659
d080b8d4c114 team coloured, just for the 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 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
   661
d080b8d4c114 team coloured, just for the 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
		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
   663
			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
   664
				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
   665
			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
   666
		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
   667
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   668
	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
   669
d080b8d4c114 team coloured, just for the 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
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
   671
d080b8d4c114 team coloured, just for the 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
----------------------------------
d080b8d4c114 team coloured, just for the 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
-- 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
   674
----------------------------------
d080b8d4c114 team coloured, just for the 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
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
   677
        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
   678
        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
   679
        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
   680
        WaterRise = 0
12084
8f222872d432 Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents: 11991
diff changeset
   681
        HealthDecrease = 0
11951
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   682
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
   683
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
   684
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   685
function InstructionsBuild()
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   686
        ShowMission(
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   687
                loc("Racer"),
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   688
                loc("A Hedgewars mini-game"),
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   689
                loc("Build a track and race.") .. "|" ..
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   690
                string.format(loc("Round limit: %d"), roundLimit),
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   691
                4, 4000)
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   692
end
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   693
12412
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
   694
function InstructionsRace()
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   695
        ShowMission(loc("Racer"),
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   696
        	loc("A Hedgewars mini-game"),
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   697
        	loc("Touch all waypoints as fast as you can!"),
12412
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
   698
		2, 4000)
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   699
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
   700
d080b8d4c114 team coloured, just for the 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
function onGameStart()
13774
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   702
	if ClansCount >= 2 then
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   703
		SendGameResultOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   704
		SendRankingStatsOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   705
        	SendHealthStatsOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   706
		SendAchievementsStatsOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
   707
	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
   708
13129
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13108
diff changeset
   709
        SetSoundMask(sndIncoming, true)
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13108
diff changeset
   710
        SetSoundMask(sndMissed, true)
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13108
diff changeset
   711
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
   712
        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
   713
        lastRound = TotalRounds
11933
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11932
diff changeset
   714
        RoundHasChanged = false
14075
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13846
diff changeset
   715
        officialChallenge = detectMapWithDigest()
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
   716
12972
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   717
	if GetBackgroundBrightness() == 1 then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   718
		-- Dark waypoint colour theme
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   719
		waypointColour = waypointColourDark
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   720
		waypointColourAtPlacement = waypointColourDarkAtPlacement
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   721
	elseif GetBackgroundBrightness() == 2 then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   722
		-- Medium waypoint colour theme
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   723
		waypointColour = waypointColourMedium
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   724
		waypointColourAtPlacement = waypointColourMediumAtPlacement
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   725
	end
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   726
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
   727
        for i = 0, (specialPointsCount-1) do
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   728
                PlaceWayPoint(specialPointsX[i], specialPointsY[i], false)
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
   729
        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
   730
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   731
        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
   732
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   733
        if specialPointsCount > 0 then
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   734
                InstructionsRace()
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   735
        else
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   736
                InstructionsBuild()
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   737
        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
   738
11951
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   739
        SetAmmoTexts(amAirAttack, loc("Place waypoint"), loc("Racer tool"),
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   740
                loc("Build an awesome race track by placing|waypoints which the hedgehogs have to|touch in any order to finish a round.") .. "|" ..
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   741
		loc("Hedgehogs will start in the first waypoint.") .. "|" ..
11988
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   742
 		loc("Cursor: Place waypoint") .. "|" ..
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   743
 		loc("Precise: Remove previous waypoint"))
11951
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   744
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   745
        SetAmmoTexts(amSkip, loc("Finish waypoint placement"), loc("Racer tool"),
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   746
                loc("Happy with your race track?|Then stop building and start racing!") .. "|" ..
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   747
                loc("Or let the next player place waypoints|if less than 2 waypoints have been placed.") .. "|" ..
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   748
                loc("Attack: Activate"))
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   749
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
   750
        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
   751
d080b8d4c114 team coloured, just for the 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
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
   753
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   754
function PlaceWayPoint(x,y,placedByUser)
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
   755
    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
   756
        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
   757
d080b8d4c114 team coloured, just for the 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
            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
   759
            wpY[wpCount] = y
12972
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   760
            wpCol[wpCount] = waypointColour
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
   761
            wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
11568
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   762
12970
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   763
            local flashing, minO, maxO
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   764
            if wpCount == 0 then
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   765
                -- First waypoint flashes. Useful to know since this is the spawn position.
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   766
                minO, maxO = 164, 255
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   767
                flashing = 5
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   768
            else
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   769
                -- Other waypoints are not animated (before the race starts)
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   770
                minO, maxO = 255, 255
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   771
                flashing = 0
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   772
            end
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   773
            SetVisualGearValues(wpCirc[wpCount], wpX[wpCount], wpY[wpCount], minO, maxO, 1, flashing, 0, wpRad, 5, wpCol[wpCount])
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   774
12972
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   775
            -- Use alternate waypoint color for all waypoints but the last one. This gives a subtle “highlighting” effect.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   776
            SetVisualGearValues(wpCirc[wpCount-1], nil, nil, nil, nil, nil, nil, nil, nil, nil, waypointColourAtPlacement)
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
   777
d080b8d4c114 team coloured, just for the 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
            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
   779
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   780
            if placedByUser then
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   781
                AddCaption(string.format(loc("Waypoint placed. Available points remaining: %d"), wpLimit-wpCount))
13129
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13108
diff changeset
   782
                PlaySound(sndPlaced)
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   783
            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
   784
        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
   785
    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
   786
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
   787
11988
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   788
function onPrecise()
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   789
    if not racerActive and CurrentHedgehog ~= nil and GetCurAmmoType() == amAirAttack then
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   790
        DeletePreviousWayPoint()
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   791
    end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   792
end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   793
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   794
function DeletePreviousWayPoint()
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   795
    if wpCount > 0 then
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   796
        wpCount = wpCount - 1
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   797
        wpX[wpCount] = nil
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   798
        wpY[wpCount] = nil
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   799
        wpCol[wpCount] = nil
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   800
        DeleteVisualGear(wpCirc[wpCount])
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   801
        wpCirc[wpCount] = nil
12972
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   802
        SetVisualGearValues(wpCirc[wpCount-1], nil, nil, nil, nil, nil, nil, nil, nil, nil, waypointColour)
11988
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   803
        AddCaption(string.format(loc("Waypoint removed. Available points: %d"), wpLimit-wpCount))
13134
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   804
        PlaySound(sndBump)
11988
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   805
    else
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   806
        PlaySound(sndDenied)
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   807
        AddCaption(loc("No waypoint to be removed!"))
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   808
    end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   809
end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11951
diff changeset
   810
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
   811
function onSpecialPoint(x,y,flag)
11568
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   812
    if flag == 99 then
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   813
        fastX[fastCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   814
        fastY[fastCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   815
        fastCount = fastCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   816
    else
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   817
        addHashData(x)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   818
        addHashData(y)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   819
        addHashData(flag)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   820
        specialPointsX[specialPointsCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   821
        specialPointsY[specialPointsCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   822
        specialPointsCount = specialPointsCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
   823
    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
   824
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
   825
d080b8d4c114 team coloured, just for the 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
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
   827
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   828
        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
   829
        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
   830
d080b8d4c114 team coloured, just for the 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
        racerActive = false
12412
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
   832
        turnSkipped = false
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
d080b8d4c114 team coloured, just for the 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
        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
   835
d080b8d4c114 team coloured, just for the 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
        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
   837
        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
   838
        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
   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
        -- 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
   841
        if (gameOver == false) and (gameBegun == false) then
11936
a01a890093f3 Racer: Reduce minimum number of waypoints to 2, tweak descriptions
Wuzzy <almikes@aol.com>
parents: 11935
diff changeset
   842
                if wpCount >= 2 then
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
   843
                        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
   844
                        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
   845
                        firstClan = GetHogClan(CurrentHedgehog)
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   846
                        if specialPointsCount == 0 then
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   847
                                InstructionsRace()
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   848
                        end
11951
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   849
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11936
diff changeset
   850
                        SetAmmoTexts(amSkip, nil, nil, nil)
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
   851
                else
11991
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   852
                        local infoString
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   853
                        if wpLimit > 2 then
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   854
                                infoString = string.format(loc("Place 2-%d waypoints using the waypoint placement tool."), wpLimit)
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   855
                        else
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   856
                                infoString = loc("Place 2 waypoints using the waypoint placement tool.")
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   857
                        end
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   858
                        ShowMission(loc("Racer"),
11991
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11990
diff changeset
   859
                        loc("Waypoint placement phase"), infoString, 2, 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
   860
                        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
   861
                        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
   862
                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
   863
        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
   864
12970
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   865
        -- Set the waypoints to unactive on new round
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   866
        if gameBegun and not gameOver then
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   867
                for i = 0,(wpCount-1) do
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   868
                        wpActive[i] = false
12972
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12970
diff changeset
   869
                        wpCol[i] = waypointColour
12970
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   870
                        local flashing, minO, maxO
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   871
                        if i == 0 then
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   872
                            -- Make first waypoint flash very noticably
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   873
                            minO, maxO = 92, 255
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   874
                            flashing = 2
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   875
                        else
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   876
                            minO, maxO = 164, 224
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   877
                            flashing = 10
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   878
                        end
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   879
                        SetVisualGearValues(wpCirc[i], nil, nil, minO, maxO, nil, flashing, nil, nil, nil, wpCol[i])
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   880
                end
13029
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   881
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   882
                if cameraGear then
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   883
                        DeleteGear(cameraGear)
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   884
                end
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   885
                -- Move camera to first waypoint
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   886
		-- We use a dummy gear to feed FollowGear. It does not affect the race.
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   887
                cameraGear = AddGear(wpX[0], wpY[0], gtGenericFaller, 0, 0, 0, 5000)
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   888
                SetState(cameraGear, bor(GetState(cameraGear), gstNoGravity+gstInvisible))
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
   889
                FollowGear(cameraGear)
12970
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   890
        end
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12969
diff changeset
   891
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
   892
        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
   893
                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
   894
                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
   895
        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
   896
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   897
        AddAmmo(CurrentHedgehog, amTardis, 0)
13108
cf2a58dccc4a CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13032
diff changeset
   898
        AddAmmo(CurrentHedgehog, amResurrector, 0)
cf2a58dccc4a CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13032
diff changeset
   899
        AddAmmo(CurrentHedgehog, amInvulnerable, 0)
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
   900
        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
   901
        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
   902
        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
   903
        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
   904
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
   905
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   906
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
   907
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   908
        -- 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
   909
        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
   910
                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
   911
                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
   912
                        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
   913
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   914
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   915
                        if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   916
                                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
   917
                                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
   918
                        elseif (y > WaterLine-50) then
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   919
                                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
   920
                                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
   921
                        else
12411
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12393
diff changeset
   922
                                PlaceWayPoint(x, y, 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
   923
                                if wpCount == wpLimit then
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   924
                                        AddCaption(loc("Race complexity limit reached"))
12292
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
   925
                                        EndTurn(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
   926
                                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
   927
                        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
   928
                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
   929
                        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
   930
                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
   931
        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
   932
        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
   933
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   934
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   935
        -- 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
   936
        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
   937
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   938
                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
   939
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   940
                        -- 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
   941
                        --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
   942
                        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
   943
                                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
   944
                                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
   945
                                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
   946
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   947
                                SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
11653
mikade <redgrinner@gmail.com>
parents: 11652
diff changeset
   948
                                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
   949
                                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
   950
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   951
                                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
   952
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   953
                                -- 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
   954
                                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
   955
                                        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
   956
                                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
   957
                        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
   958
                                -- 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
   959
                        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
   960
13134
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   961
        	end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   962
		if not racerActive and not gameBegun and GetCurAmmoType() == amAirAttack then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   963
			waypointCursor = true
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   964
		else
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   965
			waypointCursor = false
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   966
		end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   967
	else
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   968
		waypointCursor = false
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
   969
	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
   970
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   971
        -- 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
   972
        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
   973
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   974
                --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
   975
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   976
                -- 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
   977
                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
   978
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   979
                        --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
   980
                        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
   981
                                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
   982
                        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
   983
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   984
                        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
   985
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   986
                        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
   987
11929
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   988
                                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
   989
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   990
                                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
   991
                                        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
   992
                                        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
   993
                                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
   994
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   995
                        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
   996
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   997
                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
   998
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   999
                -- if the player has expended his tunbling time, stop him tumbling
12412
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
  1000
                if TurnTimeLeft <= 20 and not turnSkipped then
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
  1001
                        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
  1002
                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
  1003
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1004
        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
  1005
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1006
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
  1007
13134
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1008
function onGameTick()
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1009
	if waypointCursor then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1010
		if not waypointPreview then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1011
			waypointPreview = AddVisualGear(CursorX, CursorY, vgtCircle, 0, true)
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1012
		end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1013
		SetVisualGearValues(waypointPreview, CursorX, CursorY, 200, 200, 0, 0, 0, div(wpRad, 5), 5, waypointColourAtPlacement)
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1014
	else
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1015
		if waypointPreview then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1016
			DeleteVisualGear(waypointPreview)
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1017
			waypointPreview = nil
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1018
		end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1019
	end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1020
end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1021
13635
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13134
diff changeset
  1022
function onGearResurrect(gear, vGear)
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
  1023
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1024
        if gear == CurrentHedgehog then
12292
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12084
diff changeset
  1025
                DisableTumbler(false)
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
  1026
        end
13635
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13134
diff changeset
  1027
        if vGear then
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13134
diff changeset
  1028
                DeleteVisualGear(vGear)
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13134
diff changeset
  1029
        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
  1030
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1031
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
  1032
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1033
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
  1034
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1035
        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
  1036
                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
  1037
                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
  1038
                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
  1039
        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
  1040
                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
  1041
        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
  1042
            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
  1043
            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
  1044
        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
  1045
            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
  1046
        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
  1047
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
  1048
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1049
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
  1050
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1051
        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
  1052
                cGear = nil
13029
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
  1053
        elseif gear == cameraGear then
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12972
diff changeset
  1054
                cameraGear = nil
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
  1055
        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
  1056
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1057
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
  1058
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1059
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
  1060
    at = GetCurAmmoType()
11568
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
  1061
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
  1062
    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
  1063
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
  1064
12412
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
  1065
function onHogAttack(ammoType)
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
  1066
    if ammoType == amSkip then
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
  1067
        turnSkipped = true
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
  1068
    end
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
  1069
end
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12411
diff changeset
  1070
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
  1071
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
  1072
    usedWeapons[amSkip] = nil
11568
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
  1073
    usedWeapons[amExtraTime] = nil
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
  1074
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
  1075
    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
  1076
    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
  1077
    usedSaucer = usedWeapons[amJetpack] ~= nil
11568
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11550
diff changeset
  1078
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
  1079
    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
  1080
    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
  1081
    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
  1082
    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
  1083
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1084
    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
  1085
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1086
    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
  1087
        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
  1088
    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
  1089
        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
  1090
    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
  1091
        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
  1092
    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
  1093
        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
  1094
    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
  1095
        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
  1096
    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
  1097
        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
  1098
    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
  1099
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1100
    for i = 0, (numTeams-1) do
13844
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13690
diff changeset
  1101
        if teamScore[i] < MAX_TURN_TIME then
14075
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13846
diff changeset
  1102
            DeclareAchievement(raceType, teamNameArr[i], officialChallenge, teamScore[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
  1103
        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
  1104
    end
11574
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11568
diff changeset
  1105
14075
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13846
diff changeset
  1106
    if officialChallenge ~= nil and fastCount > 0 then
11574
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11568
diff changeset
  1107
        StartGhostPoints(fastCount)
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11568
diff changeset
  1108
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11568
diff changeset
  1109
        for i = 0, (fastCount - 1) do
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11568
diff changeset
  1110
            DumpPoint(fastX[i], fastY[i])
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11568
diff changeset
  1111
        end
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11568
diff changeset
  1112
    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
  1113
end