share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
author Wuzzy <Wuzzy2@mail.ru>
Fri, 28 May 2021 15:06:39 +0200
changeset 15788 acf70c44065b
parent 15489 3c0a3c824c49
child 15964 d18261ddac4a
permissions -rw-r--r--
Use the singular 'they' in code comments, where it makes sense
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15396
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
     1
--[[
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
     2
RACER
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
     3
map-independant racing script
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
     4
originally by mikade, edited heavily by others
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
     5
15396
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
     6
-----------------------------------------
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
     7
Script parameters:
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
     8
rounds=N
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
     9
--> The game will be played with N rounds (default: 3)
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    10
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    11
waypointradius=N
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    12
--> The waypoints have a radius of N pixels (default: 450)
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    13
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    14
maxwaypoints=N
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    15
--> The maximum number of waypoints to be placed (default: 8)
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    16
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    17
teamrope=true
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    18
--> The team will be colored in the color of the team.
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
    19
-----------------------------------------
d080b8d4c114 team coloured, just for the 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
15396
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    21
DEVELOPER WARNING - FOR OFFICIAL DEVELOPMENT --
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    22
Be careful when editig this script, do not introduce changes lightly!
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    23
This script is used for time records on the official Hedgewars server.
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    24
Introducing breaking changes means we have to invalidate past time records!
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
    25
15396
1c71406fc281 Racer: Clean up comments
Wuzzy <Wuzzy2@mail.ru>
parents: 15385
diff changeset
    26
]]
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
    27
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
    28
-----------------------------
d080b8d4c114 team coloured, just for the 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
-- 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
    30
-----------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    31
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    32
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
    33
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
    34
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
    35
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    36
------------------
d080b8d4c114 team coloured, just for the 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
-- 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
    38
------------------
d080b8d4c114 team coloured, just for the 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
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
    41
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
    42
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
    43
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    44
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
    45
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
    46
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
    47
local fastIndex = 0
11581
fd02a080d962 - Fix room config being sent unmodified
unc0rr
parents: 11569
diff changeset
    48
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
    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
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
    51
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
    52
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
    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
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
    55
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
    56
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
    57
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
    58
local landObjectPoints = {}
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
    59
local landObjects = {}
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
    60
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
    61
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
    62
13129
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
    63
local waypointCursor = false
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
    64
local waypointPreview = nil
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
    65
14070
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13841
diff changeset
    66
local officialChallenge
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13841
diff changeset
    67
15403
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
    68
local ammoDelays
15398
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
    69
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
    70
--------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    71
-- 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
    72
--------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    73
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    74
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
    75
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
    76
d080b8d4c114 team coloured, just for the 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
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
    78
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
    79
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
    80
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
    81
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
    82
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    83
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
    84
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
    85
d080b8d4c114 team coloured, just for the 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
-- 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
    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
local cGear = nil
13024
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
    91
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
    92
11930
4ed643879c0f Racer: Clean up “did not finish” mess
Wuzzy <almikes@aol.com>
parents: 11929
diff changeset
    93
local bestClan = 10
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
    94
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
    95
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
    96
local 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
    97
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
    98
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
    99
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
   100
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   101
local 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
   102
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
   103
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
   104
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
   105
local wpActive = {}
11929
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   106
local wpRad = 450
15483
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   107
local WAYPOINT_RADIUS_MIN = 40
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
   108
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
   109
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
   110
d080b8d4c114 team coloured, just for the 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
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
   112
d080b8d4c114 team coloured, just for the 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 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
   114
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
   115
local RoundHasChanged
12407
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
   116
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
   117
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   118
local boostX = 0
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   119
local boostY = 0
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   120
local boostValue = 1
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   121
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   122
-- themes with bright background
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   123
local brightThemes = {
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   124
	Bath = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   125
	Bamboo = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   126
	Beach = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   127
	Blox = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   128
	Compost = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   129
	Desert = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   130
	Fruit = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   131
	Golf = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   132
	Hoggywood = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   133
	Jungle = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   134
	Olympics = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   135
	Sheep = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   136
}
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   137
-- themes with medium or heavily mixed brightness.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   138
-- 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: 12965
diff changeset
   139
-- colors fail otherwise.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   140
local mediumThemes = {
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   141
	Halloween = true,
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   142
}
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   143
-- All themes not explicitly listed above are assumed to
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   144
-- be "dark" and work with the default bright waypoints.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   145
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   146
-- Waypoint colors in 3 color themes!
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   147
-- 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: 12965
diff changeset
   148
-- at least in each of the default themes.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   149
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   150
-- Bright waypoints (default)
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   151
local waypointColourBright = 0xFFFFFFFF -- Primary colour of inactive waypoints
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   152
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: 12965
diff changeset
   153
-- Medium bright waypoints
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   154
local waypointColourMedium = 0x606060FF
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   155
local waypointColourMediumAtPlacement = 0x404040FF
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   156
-- Dark waypoints
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   157
local waypointColourDark = 0x000000FF
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   158
local waypointColourDarkAtPlacement = 0x303030FF
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   159
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   160
-- 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: 12965
diff changeset
   161
-- Touched waypoints are not important to be visible.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   162
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   163
-- 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: 12965
diff changeset
   164
local waypointColour = waypointColourBright
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   165
local waypointColourAtPlacement = waypointColourBrightAtPlacement
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   166
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
   167
-------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   168
-- 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
   169
-------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   170
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   171
-- Returns brightness level of background from 1-3.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   172
-- 1 = brightest
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   173
function GetBackgroundBrightness()
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   174
	-- This just looks at the theme names above.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   175
	-- This code will fail for bright unofficial themes.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   176
	-- TODO: Change how this thing works.
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   177
	-- 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: 12965
diff changeset
   178
	-- 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: 12965
diff changeset
   179
	if brightThemes[Theme] then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   180
		return 1
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   181
	elseif mediumThemes[Theme] then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   182
		return 2
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   183
	else
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   184
		return 3
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   185
	end
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   186
end
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   187
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
   188
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
   189
    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
   190
    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
   191
        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
   192
    end
11926
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   193
    if params["rounds"] ~= nil then
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   194
        roundLimit = math.max(1, math.floor(tonumber(params["rounds"])))
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   195
        if type(roundLimit) ~= "number" then
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   196
             roundLimit = 3
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   197
        end
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   198
    end
11929
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   199
    if params["waypointradius"] ~= nil then
15483
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   200
        wpRad = math.max(WAYPOINT_RADIUS_MIN, math.floor(tonumber(params["waypointradius"])))
11985
b2783dd12f30 Fix incorrect type check of wpRad in Racer
Wuzzy <almikes@aol.com>
parents: 11984
diff changeset
   201
        if type(wpRad) ~= "number" then
11929
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   202
             wpRad = 450
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   203
        end
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   204
    end
11986
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   205
    if params["maxwaypoints"] ~= nil then
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   206
        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: 11985
diff changeset
   207
        if type(wpLimit) ~= "number" then
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   208
             wpLimit = 8
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   209
        end
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   210
    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
   211
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
   212
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   213
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
   214
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   215
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   216
        -- 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
   217
        for i = 0, (TeamsCount-1) do
11928
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11927
diff changeset
   218
                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
   219
                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
   220
                teamIndex[i] = 0
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   221
                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
   222
        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
   223
        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
   224
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   225
        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
   226
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   227
                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
   228
                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
   229
                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
   230
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   231
                        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
   232
                        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
   233
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   234
                        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
   235
                                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
   236
                                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
   237
                        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
   238
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   239
                        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
   240
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   241
                        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
   242
                                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
   243
                                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
   244
                                        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
   245
                                        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
   246
                                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
   247
                        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
   248
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   249
                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
   250
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   251
        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
   252
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   253
        -- 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
   254
        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
   255
                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
   256
                        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
   257
                                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
   258
                                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
   259
                                        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
   260
                                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
   261
                                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
   262
                                --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
   263
                        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
   264
                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
   265
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   266
        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
   267
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   268
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
   269
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   270
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   271
-----------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   272
-- 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
   273
-----------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   274
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   275
function onLeft()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   276
	boostX = boostX +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   277
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   278
function onLeftUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   279
	boostX = boostX -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   280
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   281
function onRight()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   282
	boostX = boostX -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   283
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   284
function onRightUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   285
	boostX = boostX +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   286
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   287
function onUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   288
	boostY = boostY +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   289
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   290
function onUpUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   291
	boostY = boostY -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   292
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   293
function onDown()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   294
	boostY = boostY -boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   295
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   296
function onDownUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   297
	boostY = boostY +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   298
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   299
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
   300
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
   301
d080b8d4c114 team coloured, just for the 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
        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
   303
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   304
        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
   305
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   306
                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
   307
                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
   308
d080b8d4c114 team coloured, just for the 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
                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
   310
                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
   311
                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
   312
d080b8d4c114 team coloured, just for the 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
                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
   314
d080b8d4c114 team coloured, just for the 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
                if dist < (NR*NR) then
11928
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11927
diff changeset
   316
                        wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog))
12962
52c12029c7bd Increase opacity of Racer/TechRacer waypoints
Wuzzy <Wuzzy2@mail.ru>
parents: 12407
diff changeset
   317
                        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
   318
d080b8d4c114 team coloured, just for the 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
                        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
   320
                        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
   321
                                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
   322
                                        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
   323
                                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
   324
                        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
   325
11925
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   326
                        if wpActive[i] == false then
11927
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   327
                                local wpMessage = ""
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   328
                                if wpRem-1 == 0 then
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   329
                                         wpMessage = loc("Track completed!")
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   330
                                else
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   331
                                         wpMessage = string.format(loc("Waypoints remaining: %d"), wpRem-1)
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   332
                                end
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   333
                                AddCaption(wpMessage, 0xffba00ff, capgrpGameState)
11925
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   334
                        end
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   335
                        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
   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
                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
   340
                        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
   341
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   342
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   343
        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
   344
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   345
        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
   346
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   347
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
   348
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   349
function AdjustScores()
11930
4ed643879c0f Racer: Clean up “did not finish” mess
Wuzzy <almikes@aol.com>
parents: 11929
diff changeset
   350
	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
   351
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   352
        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
   353
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   354
        -- 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
   355
        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
   356
                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
   357
                        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
   358
                                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
   359
                                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
   360
                        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
   361
                                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
   362
                        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
   363
                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
   364
        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
   365
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   366
        -- 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
   367
        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
   368
                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
   369
                        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
   370
                        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
   371
                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
   372
        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
   373
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   374
        if bestTime ~= MAX_TURN_TIME then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   375
                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
   376
        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
   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
        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
   379
                if trackTime == bestTime then -- best time of the race
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   380
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   381
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   382
                        string.format(loc("New race record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   383
                        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
   384
                        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
   385
                else    -- best time for the clan
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   386
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   387
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   388
                        string.format(loc("New clan record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   389
                        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
   390
                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
   391
        else -- not any kind of new score
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   392
                ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   393
                loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   394
                string.format(loc("Time: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   395
                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
   396
                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
   397
        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
   398
13027
625d5a45f267 Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents: 13024
diff changeset
   399
        for i = 0, (TeamsCount-1) do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   400
                if teamNameArr[i] ~= " " and teamScore[i] ~= MAX_TURN_TIME then
13027
625d5a45f267 Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents: 13024
diff changeset
   401
                        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: 13024
diff changeset
   402
                end
625d5a45f267 Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents: 13024
diff changeset
   403
        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
   404
d080b8d4c114 team coloured, just for the 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
        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
   406
d080b8d4c114 team coloured, just for the 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
                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
   408
d080b8d4c114 team coloured, just for the 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
                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
   410
                        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
   411
                        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
   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
                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
   415
                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
   416
d080b8d4c114 team coloured, just for the 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
        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
   418
                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
   419
                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
   420
        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
   421
d080b8d4c114 team coloured, just for the 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
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
   424
d080b8d4c114 team coloured, just for the 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
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
   426
d080b8d4c114 team coloured, just for the 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
        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
   428
d080b8d4c114 team coloured, just for the 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
        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
   430
        for i = 0, (TeamsCount-1) do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   431
                        if teamNameArr[i] ~= " " and teamScore[i] ~= MAX_TURN_TIME then
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   432
                                teamComment[i] = string.format(loc("%s: %.1fs"), teamNameArr[i], (teamScore[i]/1000)) .. "|"
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   433
                        else
11930
4ed643879c0f Racer: Clean up “did not finish” mess
Wuzzy <almikes@aol.com>
parents: 11929
diff changeset
   434
                                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
   435
                        end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   436
                        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
   437
        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
   438
15069
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   439
        local icon
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   440
        if roundNumber >= roundLimit then
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   441
                icon = 0
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   442
        else
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   443
                icon = 2
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   444
        end
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   445
        ShowMission(    loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   446
                                        loc("Status update"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   447
                                        string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "|" .. " " .. "|" ..
15069
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   448
                                        loc("Best team times: ") .. "|" .. totalComment, icon, 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
   449
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   450
        -- 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
   451
        if roundNumber >= roundLimit then
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   452
                -- Sort the scores for the ranking list
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   453
                local unfinishedArray = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   454
                local sortedTeams = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   455
                local k = 1
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   456
                local c = 1
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   457
                local clanScores = {}
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   458
                local previousClan
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   459
                for i = 0, TeamsCount-1 do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   460
                        local clan = GetTeamClan(teamNameArr[i])
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   461
                        if not clanScores[clan+1] then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   462
	                       clanScores[clan+1] = {}
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   463
	                       clanScores[clan+1].index = clan
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   464
	                       clanScores[clan+1].score = teamScore[i]
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   465
                        end
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   466
                        if teamScore[i] ~= MAX_TURN_TIME and teamNameArr[i] ~= " " then
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   467
                               sortedTeams[k] = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   468
                               sortedTeams[k].name = teamNameArr[i]
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   469
                               sortedTeams[k].score = teamScore[i]
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   470
	                       sortedTeams[k].clan = clan
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   471
                               k = k + 1
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   472
                        else
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   473
                               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
   474
                        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
   475
                end
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   476
                table.sort(sortedTeams, function(team1, team2)
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   477
                        if team1.score == team2.score then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   478
                                return team1.clan < team2.clan
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   479
                        else
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   480
                                return team1.score < team2.score
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   481
                        end
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   482
                end)
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   483
                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: 13685
diff changeset
   484
                local rank = 0
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   485
                local rankPlus = 0
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   486
                local prevScore
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   487
                local clanRanks = {}
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   488
                for c = 1, #clanScores do
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   489
                        rankPlus = rankPlus + 1
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   490
                        if clanScores[c].score ~= prevScore then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   491
                                rank = rank + rankPlus
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   492
                                rankPlus = 0
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   493
                        end
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   494
                        prevScore = clanScores[c].score
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   495
                        clanRanks[clanScores[c].index] = rank
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   496
                end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   497
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   498
                -- Write all the stats!
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   499
                for i = 1, #sortedTeams do
14578
50f511588635 Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents: 14548
diff changeset
   500
                        SendStat(siPointType, "!TIME")
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   501
			SendStat(siTeamRank, tostring(clanRanks[GetTeamClan(sortedTeams[i].name)]))
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   502
                        SendStat(siPlayerKills, sortedTeams[i].score, sortedTeams[i].name)
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   503
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   504
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   505
		local roundDraw = false
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   506
		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: 13685
diff changeset
   507
			roundDraw = true
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   508
                        SendStat(siGameResult, loc("Round draw"))
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   509
                        SendStat(siCustomAchievement, loc("The teams are tied for the fastest time."))
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   510
                elseif #sortedTeams >= 1 then
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   511
                        SendStat(siGameResult, string.format(loc("%s wins!"), sortedTeams[1].name))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   512
                        SendStat(siCustomAchievement, string.format(loc("%s wins with a best time of %.1fs."), sortedTeams[1].name, (sortedTeams[1].score/1000)))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   513
                        for i=1,#unfinishedArray do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   514
                                 SendStat(siCustomAchievement, unfinishedArray[i])
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   515
                        end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   516
                else
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   517
			roundDraw = true
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   518
                        SendStat(siGameResult, loc("Round draw"))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   519
                        SendStat(siCustomAchievement, loc("Nobody managed to finish the race. What a shame!"))
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   520
                        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: 12388
diff changeset
   521
                                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: 12388
diff changeset
   522
                        else
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   523
                                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: 12388
diff changeset
   524
                        end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   525
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   526
12333
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   527
		-- Kill all the losers
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   528
		for i = 0, (numhhs-1) do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   529
			if GetHogClan(hhs[i]) ~= bestClan or roundDraw then
12333
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   530
				SetEffect(hhs[i], heResurrectable, 0)
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   531
				SetHealth(hhs[i],0)
15400
06524f2e9a74 Racer: Make winners invulnerable
Wuzzy <Wuzzy2@mail.ru>
parents: 15399
diff changeset
   532
			elseif not roundDraw then
06524f2e9a74 Racer: Make winners invulnerable
Wuzzy <Wuzzy2@mail.ru>
parents: 15399
diff changeset
   533
				SetEffect(hhs[i], heInvulnerable, 1)
12333
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   534
			end
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   535
		end
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   536
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   537
		gameOver = true
12964
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   538
                for i=0, wpCount-1 do
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   539
                         -- Fade out waypoints
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   540
                         SetVisualGearValues(wpCirc[i], nil, nil, 0, 0, nil, 6)
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   541
                end
12333
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   542
		EndTurn(true)
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   543
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
   544
        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
   545
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   546
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   547
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   548
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
   549
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   550
        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
   551
                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
   552
        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
   553
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   554
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
   555
12287
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   556
function DisableTumbler(endTurn)
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   557
        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: 12079
diff changeset
   558
        if racerActive then
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   559
                currCount = 0
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   560
                fastIndex = 0
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   561
                if endTurn then
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   562
                        EndTurn(true)
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   563
                end
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   564
                racerActive = false -- newadd
12963
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   565
12964
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   566
		if trackFinished and not gameOver then
12963
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   567
                         for i=0, wpCount-1 do
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   568
                       	         SetVisualGearValues(wpCirc[i], nil, nil, 255, 255, nil, 2)
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   569
                         end
12964
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   570
                elseif not gameOver then
12963
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   571
                         for i=0, wpCount-1 do
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   572
                       	         SetVisualGearValues(wpCirc[i], nil, nil, 32, 32, nil, 1)
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   573
                         end
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   574
                end
12287
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   575
        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
   576
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
   577
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   578
function 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
   579
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   580
        -- 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
   581
        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
   582
        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
   583
        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
   584
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   585
        -- 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
   586
        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
   587
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   588
                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
   589
13685
09ea1faf97ca Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents: 13630
diff changeset
   590
                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: 13630
diff changeset
   591
                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
   592
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   593
        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
   594
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   595
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
   596
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   597
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
   598
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   599
	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
   600
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   601
		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
   602
			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
   603
				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
   604
			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
   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
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
   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
----------------------------------
d080b8d4c114 team coloured, just for the 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
-- 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
   613
----------------------------------
d080b8d4c114 team coloured, just for the 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
function onGameInit()
15489
3c0a3c824c49 Racer: Force-enable solid land
Wuzzy <Wuzzy2@mail.ru>
parents: 15488
diff changeset
   616
        EnableGameFlags(gfInfAttack, gfSolidLand)
15402
1028f5606b5f Racer, TechRacer: Force-disable several bad game flags
Wuzzy <Wuzzy2@mail.ru>
parents: 15400
diff changeset
   617
        -- Force-disable various game flags that would break the script
1028f5606b5f Racer, TechRacer: Force-disable several bad game flags
Wuzzy <Wuzzy2@mail.ru>
parents: 15400
diff changeset
   618
        DisableGameFlags(gfKing, gfSwitchHog, gfAISurvival, gfPlaceHog, gfTagTeam)
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   619
        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
   620
        WaterRise = 0
12079
8f222872d432 Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents: 11986
diff changeset
   621
        HealthDecrease = 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
   622
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
   623
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   624
function InstructionsBuild()
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   625
        ShowMission(
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   626
                loc("Racer"),
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   627
                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: 12388
diff changeset
   628
                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: 12388
diff changeset
   629
                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: 12388
diff changeset
   630
                4, 4000)
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   631
end
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   632
12407
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
   633
function InstructionsRace()
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   634
        ShowMission(loc("Racer"),
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   635
        	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: 12388
diff changeset
   636
        	loc("Touch all waypoints as fast as you can!"),
15068
6f51c75994a4 Semi-standardize usage of icons in many mission panels
Wuzzy <Wuzzy2@mail.ru>
parents: 14578
diff changeset
   637
		1, 4000)
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   638
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
   639
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   640
function onGameStart()
15483
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   641
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   642
	-- Adjust pre-defined waypoints in scaled drawn maps
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   643
	if MapGen == mgDrawn and MapFeatureSize ~= 12 and specialPointsCount > 0 then
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   644
		local landW = RightX - LeftX + 1
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   645
		local landH = LAND_HEIGHT - TopY
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   646
		-- Reposition pre-defined waypoints
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   647
        	for i = 0, (specialPointsCount-1) do
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   648
        		specialPointsX[i] = LeftX + div(specialPointsX[i] * landW, 4096)
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   649
        		specialPointsY[i] = TopY + div(specialPointsY[i] * landH, 2048)
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   650
		end
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   651
		-- Scale waypoint size
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   652
		wpRad = math.max(WAYPOINT_RADIUS_MIN, div(wpRad * landW, 4096))
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   653
	end
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   654
13769
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   655
	if ClansCount >= 2 then
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   656
		SendGameResultOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   657
		SendRankingStatsOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   658
        	SendHealthStatsOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   659
		SendAchievementsStatsOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   660
	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
   661
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   662
        -- Keep track of land objects that got placed by the scheme (mines, air mines, barrels)
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   663
        for id, _ in pairs(landObjects) do
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   664
                table.insert(landObjectPoints, { type = GetGearType(id), x = GetX(id), y = GetY(id) })
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   665
        end
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   666
13124
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13103
diff changeset
   667
        SetSoundMask(sndIncoming, true)
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13103
diff changeset
   668
        SetSoundMask(sndMissed, true)
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13103
diff changeset
   669
10856
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   670
        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
   671
        lastRound = TotalRounds
11928
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11927
diff changeset
   672
        RoundHasChanged = false
14070
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13841
diff changeset
   673
        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
   674
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   675
	if GetBackgroundBrightness() == 1 then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   676
		-- Dark waypoint colour theme
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   677
		waypointColour = waypointColourDark
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   678
		waypointColourAtPlacement = waypointColourDarkAtPlacement
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   679
	elseif GetBackgroundBrightness() == 2 then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   680
		-- Medium waypoint colour theme
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   681
		waypointColour = waypointColourMedium
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   682
		waypointColourAtPlacement = waypointColourMediumAtPlacement
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   683
	end
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   684
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
   685
        for i = 0, (specialPointsCount-1) do
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   686
                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
   687
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   688
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   689
        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
   690
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   691
        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: 12388
diff changeset
   692
                InstructionsRace()
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   693
        else
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   694
                InstructionsBuild()
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   695
        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
   696
11946
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   697
        SetAmmoTexts(amAirAttack, loc("Place waypoint"), loc("Racer tool"),
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   698
                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: 11931
diff changeset
   699
		loc("Hedgehogs will start in the first waypoint.") .. "|" ..
11983
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   700
 		loc("Cursor: Place waypoint") .. "|" ..
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   701
 		loc("Precise: Remove previous waypoint"))
11946
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   702
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   703
        SetAmmoTexts(amSkip, loc("Finish waypoint placement"), loc("Racer tool"),
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   704
                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: 11931
diff changeset
   705
                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: 11931
diff changeset
   706
                loc("Attack: Activate"))
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   707
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
        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
   709
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   710
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   711
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   712
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
   713
    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
   714
        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
   715
d080b8d4c114 team coloured, just for the 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
            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
   717
            wpY[wpCount] = y
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   718
            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
   719
            wpCirc[wpCount] = AddVisualGear(wpX[wpCount],wpY[wpCount],vgtCircle,0,true)
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   720
12965
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   721
            local flashing, minO, maxO
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   722
            if wpCount == 0 then
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   723
                -- 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: 12964
diff changeset
   724
                minO, maxO = 164, 255
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   725
                flashing = 5
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   726
            else
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   727
                -- 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: 12964
diff changeset
   728
                minO, maxO = 255, 255
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   729
                flashing = 0
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   730
            end
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   731
            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: 12964
diff changeset
   732
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   733
            -- 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: 12965
diff changeset
   734
            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
   735
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   736
            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
   737
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   738
            if placedByUser then
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   739
                AddCaption(string.format(loc("Waypoint placed. Available points remaining: %d"), wpLimit-wpCount))
13124
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13103
diff changeset
   740
                PlaySound(sndPlaced)
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   741
            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
   742
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   743
    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
   744
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   745
11983
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   746
function onPrecise()
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   747
    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: 11946
diff changeset
   748
        DeletePreviousWayPoint()
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   749
    end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   750
end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   751
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   752
function DeletePreviousWayPoint()
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   753
    if wpCount > 0 then
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   754
        wpCount = wpCount - 1
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   755
        wpX[wpCount] = nil
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   756
        wpY[wpCount] = nil
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   757
        wpCol[wpCount] = nil
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   758
        DeleteVisualGear(wpCirc[wpCount])
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   759
        wpCirc[wpCount] = nil
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   760
        SetVisualGearValues(wpCirc[wpCount-1], nil, nil, nil, nil, nil, nil, nil, nil, nil, waypointColour)
11983
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   761
        AddCaption(string.format(loc("Waypoint removed. Available points: %d"), wpLimit-wpCount))
13129
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   762
        PlaySound(sndBump)
11983
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   763
    else
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   764
        PlaySound(sndDenied)
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   765
        AddCaption(loc("No waypoint to be removed!"))
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   766
    end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   767
end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   768
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
   769
function onSpecialPoint(x,y,flag)
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   770
    if flag == 99 then
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   771
        fastX[fastCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   772
        fastY[fastCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   773
        fastCount = fastCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   774
    else
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   775
        addHashData(x)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   776
        addHashData(y)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   777
        addHashData(flag)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   778
        specialPointsX[specialPointsCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   779
        specialPointsY[specialPointsCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   780
        specialPointsCount = specialPointsCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   781
    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
   782
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
   783
d080b8d4c114 team coloured, just for the 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
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
   785
d080b8d4c114 team coloured, just for the 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
        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
   787
        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
   788
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   789
        racerActive = false
12407
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
   790
        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
   791
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   792
        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
   793
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   794
        currCount = 0 -- hopefully this solves problem
14548
c572eb57dd2d Fix Racer ghost not resetting properly after a skip (bug 565)
Wuzzy <Wuzzy2@mail.ru>
parents: 14252
diff changeset
   795
        fastIndex = 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
   796
        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
   797
        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
   798
15404
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
   799
        SetSoundMask(sndStupid, false)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
   800
        SetSoundMask(sndBugger, false)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
   801
        SetSoundMask(sndDrat, false)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
   802
15403
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   803
        -- Remember ammo delays for later
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   804
        if ammoDelays == nil then
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   805
                ammoDelays = {}
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   806
                for a=0, AmmoTypeMax do
15411
2cde69c1c680 Racer: Really fix delay confusion when attempting to force-disable gfKing/gfPlaceHog
Wuzzy <Wuzzy2@mail.ru>
parents: 15410
diff changeset
   807
                        local _, _, delay = GetAmmo(a)
2cde69c1c680 Racer: Really fix delay confusion when attempting to force-disable gfKing/gfPlaceHog
Wuzzy <Wuzzy2@mail.ru>
parents: 15410
diff changeset
   808
                        -- delay >= 10000 is special value used in hog placement phase.
2cde69c1c680 Racer: Really fix delay confusion when attempting to force-disable gfKing/gfPlaceHog
Wuzzy <Wuzzy2@mail.ru>
parents: 15410
diff changeset
   809
                        -- This extracts the "true" delay
2cde69c1c680 Racer: Really fix delay confusion when attempting to force-disable gfKing/gfPlaceHog
Wuzzy <Wuzzy2@mail.ru>
parents: 15410
diff changeset
   810
                        if delay >= 10000 then
2cde69c1c680 Racer: Really fix delay confusion when attempting to force-disable gfKing/gfPlaceHog
Wuzzy <Wuzzy2@mail.ru>
parents: 15410
diff changeset
   811
                                delay = delay - 10000
2cde69c1c680 Racer: Really fix delay confusion when attempting to force-disable gfKing/gfPlaceHog
Wuzzy <Wuzzy2@mail.ru>
parents: 15410
diff changeset
   812
                        end
15403
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   813
                        ammoDelays[a] = delay
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   814
                end
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   815
        end
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   816
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
   817
        -- 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
   818
        if (gameOver == false) and (gameBegun == false) then
11931
a01a890093f3 Racer: Reduce minimum number of waypoints to 2, tweak descriptions
Wuzzy <almikes@aol.com>
parents: 11930
diff changeset
   819
                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
   820
                        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
   821
                        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
   822
                        firstClan = GetHogClan(CurrentHedgehog)
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   823
                        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: 12388
diff changeset
   824
                                InstructionsRace()
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   825
                        end
11946
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   826
15398
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   827
                        -- Restore old ammo delays
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   828
                        for a=0, AmmoTypeMax do
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   829
                                if a ~= amAirAttack and a ~= amSkip then
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   830
                                        SetAmmoDelay(a, ammoDelays[a])
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   831
                                end
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   832
                        end
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   833
11946
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   834
                        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
   835
                else
11986
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   836
                        local infoString
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   837
                        if wpLimit > 2 then
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   838
                                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: 11985
diff changeset
   839
                        else
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   840
                                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: 11985
diff changeset
   841
                        end
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   842
                        ShowMission(loc("Racer"),
15069
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   843
                        loc("Waypoint placement phase"), infoString, -amAirAttack, 4000)
15397
b186e1f4c5ed Racer: Make sure the waypoint placer always has 0 delay
Wuzzy <Wuzzy2@mail.ru>
parents: 15396
diff changeset
   844
                        AddAmmo(CurrentHedgehog, amAirAttack, AMMO_INFINITE)
15398
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   845
                        for a=0, AmmoTypeMax do
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   846
                                if a ~= amAirAttack and a ~= amSkip then
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   847
                                        SetAmmoDelay(a, 9999)
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   848
                                end
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   849
                        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
   850
                        SetWeapon(amAirAttack)
15137
651c1737be2a WxW, Racer: Make bots skip/auto-confirm setup phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15069
diff changeset
   851
                        -- Bots skip waypoint placement
651c1737be2a WxW, Racer: Make bots skip/auto-confirm setup phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15069
diff changeset
   852
                        if GetHogLevel(CurrentHedgehog) ~= 0 then
651c1737be2a WxW, Racer: Make bots skip/auto-confirm setup phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15069
diff changeset
   853
                                SkipTurn()
651c1737be2a WxW, Racer: Make bots skip/auto-confirm setup phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15069
diff changeset
   854
                        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
   855
                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
   856
        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
   857
12965
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   858
        if gameBegun and not gameOver then
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   859
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   860
                -- Reset land objects so each player starts with same racing conditions
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   861
                for id,_ in pairs(landObjects) do
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   862
                        DeleteGear(id)
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   863
                end
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   864
                for i=1, #landObjectPoints do
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   865
                        AddGear(landObjectPoints[i].x, landObjectPoints[i].y, landObjectPoints[i].type, 0, 0, 0, 0)
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   866
                end
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   867
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   868
                -- Set the waypoints to unactive
12965
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   869
                for i = 0,(wpCount-1) do
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   870
                        wpActive[i] = false
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   871
                        wpCol[i] = waypointColour
12965
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   872
                        local flashing, minO, maxO
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   873
                        if i == 0 then
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   874
                            -- Make first waypoint flash very noticably
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   875
                            minO, maxO = 92, 255
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   876
                            flashing = 2
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   877
                        else
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   878
                            minO, maxO = 164, 224
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   879
                            flashing = 10
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   880
                        end
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   881
                        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: 12964
diff changeset
   882
                end
13024
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   883
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   884
                if cameraGear then
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   885
                        DeleteGear(cameraGear)
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   886
                end
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   887
                -- Move camera to first waypoint
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   888
		-- 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: 12967
diff changeset
   889
                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: 12967
diff changeset
   890
                SetState(cameraGear, bor(GetState(cameraGear), gstNoGravity+gstInvisible))
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   891
                FollowGear(cameraGear)
12965
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   892
        end
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   893
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
   894
        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
   895
                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
   896
                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
   897
        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
   898
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   899
        AddAmmo(CurrentHedgehog, amTardis, 0)
13103
cf2a58dccc4a CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13027
diff changeset
   900
        AddAmmo(CurrentHedgehog, amResurrector, 0)
cf2a58dccc4a CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13027
diff changeset
   901
        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
   902
        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
   903
        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
   904
        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
   905
        AddAmmo(CurrentHedgehog, amPiano, 0)
15413
ca8896b9c7c6 Racer: Remove a few ammo types that could break the gameplay
Wuzzy <Wuzzy2@mail.ru>
parents: 15411
diff changeset
   906
        AddAmmo(CurrentHedgehog, amSwitch, 0)
ca8896b9c7c6 Racer: Remove a few ammo types that could break the gameplay
Wuzzy <Wuzzy2@mail.ru>
parents: 15411
diff changeset
   907
        AddAmmo(CurrentHedgehog, amKamikaze, 0)
ca8896b9c7c6 Racer: Remove a few ammo types that could break the gameplay
Wuzzy <Wuzzy2@mail.ru>
parents: 15411
diff changeset
   908
        AddAmmo(CurrentHedgehog, amIceGun, 0)
15397
b186e1f4c5ed Racer: Make sure the waypoint placer always has 0 delay
Wuzzy <Wuzzy2@mail.ru>
parents: 15396
diff changeset
   909
        SetAmmoDelay(amAirAttack, 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
   910
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
   911
d080b8d4c114 team coloured, just for the 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
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
   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
        -- 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
   915
        if cGear ~= nil then
15410
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
   916
                local x,y = GetGearPosition(cGear)
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
                if x > -9000 then
15410
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
   918
                        local x,y = GetGearTarget(cGear)
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
   919
d080b8d4c114 team coloured, just for the 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
d080b8d4c114 team coloured, just for the 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
                        if TestRectForObstacle(x-20, y-20, x+20, y+20, true) then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   922
                                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
   923
                                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
   924
                        elseif (y > WaterLine-50) then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   925
                                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
   926
                                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
   927
                        else
12406
cd53f1bf52ff Stop telling the player to build a track in Racer when it is already built
Wuzzy <almikes@aol.com>
parents: 12388
diff changeset
   928
                                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
   929
                                if wpCount == wpLimit then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   930
                                        AddCaption(loc("Race complexity limit reached"))
12287
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
   931
                                        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
   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
                        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
   934
                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
   935
                        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
   936
                end
15410
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
   937
        	SetGearPosition(cGear, -10000, y)
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
   938
        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
   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
d080b8d4c114 team coloured, just for the 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
        -- 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
   942
        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
   943
d080b8d4c114 team coloured, just for the 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
                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
   945
d080b8d4c114 team coloured, just for the 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
                        -- 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
   947
                        --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
   948
                        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
   949
                                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
   950
                                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
   951
                                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
   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
                                SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
15385
c35c5a9b878c Allow playing Racer without invulnerability
S-D-
parents: 15245
diff changeset
   954
                                Explode(GetX(CurrentHedgehog)+boostX,
c35c5a9b878c Allow playing Racer without invulnerability
S-D-
parents: 15245
diff changeset
   955
                                        GetY(CurrentHedgehog)+boostY,
c35c5a9b878c Allow playing Racer without invulnerability
S-D-
parents: 15245
diff changeset
   956
                                        50,
c35c5a9b878c Allow playing Racer without invulnerability
S-D-
parents: 15245
diff changeset
   957
                                        EXPLNoDamage + EXPLAutoSound)
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
   958
                                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
   959
d080b8d4c114 team coloured, just for the 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
                                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
   961
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   962
                                -- 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
   963
                                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
   964
                                        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
   965
                                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
   966
                        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
   967
                                -- 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
   968
                        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
   969
13129
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   970
        	end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   971
		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: 13124
diff changeset
   972
			waypointCursor = true
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   973
		else
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   974
			waypointCursor = false
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   975
		end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   976
	else
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   977
		waypointCursor = false
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   978
	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
   979
15788
acf70c44065b Use the singular 'they' in code comments, where it makes sense
Wuzzy <Wuzzy2@mail.ru>
parents: 15489
diff changeset
   980
        -- has the player started?
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
   981
        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
   982
d080b8d4c114 team coloured, just for the 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
                --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
   984
d080b8d4c114 team coloured, just for the 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
                -- 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
   986
                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
   987
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   988
                        --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
   989
                        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
   990
                                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
   991
                        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
   992
d080b8d4c114 team coloured, just for the 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
                        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
   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
                        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
   996
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   997
                                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
   998
15404
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
   999
				-- Track completed, all waypoints touched
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
  1000
                                if (CheckWaypoints() == true) then
15404
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
  1001
                                        SetSoundMask(sndStupid, true)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
  1002
                                        SetSoundMask(sndBugger, true)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
  1003
                                        SetSoundMask(sndDrat, 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
  1004
                                        AdjustScores()
15400
06524f2e9a74 Racer: Make winners invulnerable
Wuzzy <Wuzzy2@mail.ru>
parents: 15399
diff changeset
  1005
                                        SetEffect(CurrentHedgehog, heInvulnerable, 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
  1006
                                        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
  1007
                                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
  1008
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1009
                        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
  1010
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1011
                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
  1012
15788
acf70c44065b Use the singular 'they' in code comments, where it makes sense
Wuzzy <Wuzzy2@mail.ru>
parents: 15489
diff changeset
  1013
                -- if the player has expended their time, stop
12407
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1014
                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
  1015
                        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
  1016
                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
  1017
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1018
        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
  1019
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1020
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
  1021
13129
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1022
function onGameTick()
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1023
	if waypointCursor then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1024
		if not waypointPreview then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1025
			waypointPreview = AddVisualGear(CursorX, CursorY, vgtCircle, 0, true)
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1026
		end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1027
		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: 13124
diff changeset
  1028
	else
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1029
		if waypointPreview then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1030
			DeleteVisualGear(waypointPreview)
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1031
			waypointPreview = nil
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1032
		end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1033
	end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1034
end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1035
15399
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1036
function onGearDamage(gear)
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1037
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1038
        if gear == CurrentHedgehog then
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1039
                DisableTumbler(false)
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1040
        end
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1041
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1042
end
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1043
13630
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1044
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
  1045
d080b8d4c114 team coloured, just for the 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
        if gear == CurrentHedgehog then
12287
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12079
diff changeset
  1047
                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
  1048
        end
13630
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1049
        if vGear then
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1050
                DeleteVisualGear(vGear)
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1051
        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
  1052
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1053
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
  1054
d080b8d4c114 team coloured, just for the 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
function onGearAdd(gear)
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1056
        local gt = GetGearType(gear)
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1057
        if gt == gtHedgehog 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
  1058
                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
  1059
                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
  1060
                SetEffect(gear, heResurrectable, 1)
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1061
        elseif gt == gtAirAttack 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
  1062
                cGear = gear
15410
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
  1063
		local x,y = GetGearPosition(cGear)
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
  1064
        	SetGearPosition(cGear, 10000, y)
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1065
        elseif (gt == gtMine or gt == gtAirMine or gt == gtExplosives) then
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1066
                landObjects[gear] = true
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1067
        elseif (not gameBegun) and gt == gtAirBomb then
15410
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
  1068
		DeleteGear(gear)
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1069
        elseif gt == gtRope and TeamRope 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
  1070
            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
  1071
            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
  1072
        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
  1073
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
  1074
d080b8d4c114 team coloured, just for the 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
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
  1076
d080b8d4c114 team coloured, just for the 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
        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
  1078
                cGear = nil
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1079
        elseif landObjects[gear] == true then
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1080
                landObjects[gear] = nil
13024
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
  1081
        elseif gear == cameraGear then
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
  1082
                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
  1083
        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
  1084
d080b8d4c114 team coloured, just for the 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
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
  1086
d080b8d4c114 team coloured, just for the 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
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
  1088
    at = GetCurAmmoType()
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
  1089
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
  1090
    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
  1091
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
  1092
12407
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1093
function onHogAttack(ammoType)
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1094
    if ammoType == amSkip then
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1095
        turnSkipped = true
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1096
    end
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1097
end
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1098
15245
395563ffc8b5 Racer: Count turn as skipped when computer skipped
Wuzzy <Wuzzy2@mail.ru>
parents: 15137
diff changeset
  1099
function onSkipTurn()
395563ffc8b5 Racer: Count turn as skipped when computer skipped
Wuzzy <Wuzzy2@mail.ru>
parents: 15137
diff changeset
  1100
    turnSkipped = true
395563ffc8b5 Racer: Count turn as skipped when computer skipped
Wuzzy <Wuzzy2@mail.ru>
parents: 15137
diff changeset
  1101
end
395563ffc8b5 Racer: Count turn as skipped when computer skipped
Wuzzy <Wuzzy2@mail.ru>
parents: 15137
diff changeset
  1102
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
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
  1104
    usedWeapons[amSkip] = nil
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
  1105
    usedWeapons[amExtraTime] = nil
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
  1106
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
  1107
    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
  1108
    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
  1109
    usedSaucer = usedWeapons[amJetpack] ~= nil
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
  1110
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
  1111
    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
  1112
    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
  1113
    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
  1114
    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
  1115
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1116
    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
  1117
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1118
    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
  1119
        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
  1120
    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
  1121
        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
  1122
    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
  1123
        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
  1124
    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
  1125
        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
  1126
    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
  1127
        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
  1128
    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
  1129
        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
  1130
    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
  1131
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1132
    for i = 0, (numTeams-1) do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
  1133
        if teamScore[i] < MAX_TURN_TIME then
14070
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13841
diff changeset
  1134
            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
  1135
        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
  1136
    end
11569
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1137
14070
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13841
diff changeset
  1138
    if officialChallenge ~= nil and fastCount > 0 then
11569
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1139
        StartGhostPoints(fastCount)
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1140
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1141
        for i = 0, (fastCount - 1) do
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1142
            DumpPoint(fastX[i], fastY[i])
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1143
        end
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1144
    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
  1145
end