share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
author Wuzzy <Wuzzy@disroot.org>
Wed, 28 Jun 2023 12:01:43 +0200
changeset 15964 d18261ddac4a
parent 15788 acf70c44065b
child 15970 a803428704fd
permissions -rw-r--r--
Fix errors if passing bad script param to [Tech]Racer
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
15964
d18261ddac4a Fix errors if passing bad script param to [Tech]Racer
Wuzzy <Wuzzy@disroot.org>
parents: 15788
diff changeset
   194
        roundLimit = tonumber(params["rounds"])
11926
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
15964
d18261ddac4a Fix errors if passing bad script param to [Tech]Racer
Wuzzy <Wuzzy@disroot.org>
parents: 15788
diff changeset
   198
        roundLimit = math.max(1, math.floor(roundLimit))
11926
ace20b1d8d53 Add “rounds” script parameter for Racer
Wuzzy <almikes@aol.com>
parents: 11925
diff changeset
   199
    end
11929
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   200
    if params["waypointradius"] ~= nil then
15964
d18261ddac4a Fix errors if passing bad script param to [Tech]Racer
Wuzzy <Wuzzy@disroot.org>
parents: 15788
diff changeset
   201
        wpRad = tonumber(params["waypointradius"])
11985
b2783dd12f30 Fix incorrect type check of wpRad in Racer
Wuzzy <almikes@aol.com>
parents: 11984
diff changeset
   202
        if type(wpRad) ~= "number" then
11929
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   203
             wpRad = 450
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   204
        end
15964
d18261ddac4a Fix errors if passing bad script param to [Tech]Racer
Wuzzy <Wuzzy@disroot.org>
parents: 15788
diff changeset
   205
        wpRad = math.max(WAYPOINT_RADIUS_MIN, math.floor(wpRad))
11929
167de692f2d7 Add new Racer script parameter: waypointradius
Wuzzy <almikes@aol.com>
parents: 11928
diff changeset
   206
    end
11986
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   207
    if params["maxwaypoints"] ~= nil then
15964
d18261ddac4a Fix errors if passing bad script param to [Tech]Racer
Wuzzy <Wuzzy@disroot.org>
parents: 15788
diff changeset
   208
        wpLimit = tonumber(params["maxwaypoints"])
11986
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   209
        if type(wpLimit) ~= "number" then
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   210
             wpLimit = 8
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   211
        end
15964
d18261ddac4a Fix errors if passing bad script param to [Tech]Racer
Wuzzy <Wuzzy@disroot.org>
parents: 15788
diff changeset
   212
        wpLimit = math.max(2, math.floor(wpLimit))
11986
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   213
    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
   214
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
   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
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
   217
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   218
d080b8d4c114 team coloured, just for the 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
        -- 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
   220
        for i = 0, (TeamsCount-1) do
11928
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11927
diff changeset
   221
                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
   222
                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
   223
                teamIndex[i] = 0
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   224
                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
   225
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   226
        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
   227
d080b8d4c114 team coloured, just for the 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
        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
   229
d080b8d4c114 team coloured, just for the 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
                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
   231
                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
   232
                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
   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
                        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
   235
                        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
   236
d080b8d4c114 team coloured, just for the 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
                        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
   238
                                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
   239
                                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
   240
                        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
   241
d080b8d4c114 team coloured, just for the 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
                        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
   243
d080b8d4c114 team coloured, just for the 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
                        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
   245
                                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
   246
                                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
   247
                                        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
   248
                                        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
   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
                        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
   251
d080b8d4c114 team coloured, just for the 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
                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
   253
d080b8d4c114 team coloured, just for the 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
        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
   255
d080b8d4c114 team coloured, just for the 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
        -- 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
   257
        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
   258
                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
   259
                        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
   260
                                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
   261
                                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
   262
                                        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
   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
                                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
   265
                                --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
   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
                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
   268
d080b8d4c114 team coloured, just for the 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
        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
   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
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
   272
d080b8d4c114 team coloured, just for the 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
-----------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   275
-- 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
   276
-----------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   277
11647
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   278
function onLeft()
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 onLeftUp()
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 onRight()
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 onRightUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   288
	boostX = boostX +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 onUp()
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 onUpUp()
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 onDown()
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
function onDownUp()
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   300
	boostY = boostY +boostValue
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   301
end
b4d621700bbb Allow variable boost directions in Racer
mikade <redgrinner@gmail.com>
parents: 11585
diff changeset
   302
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
   303
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
   304
d080b8d4c114 team coloured, just for the 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
        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
   306
d080b8d4c114 team coloured, just for the 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
        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
   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, 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
   310
                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
   311
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   312
                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
   313
                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
   314
                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
   315
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   316
                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
   317
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   318
                if dist < (NR*NR) then
11928
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11927
diff changeset
   319
                        wpCol[i] = GetClanColor(GetHogClan(CurrentHedgehog))
12962
52c12029c7bd Increase opacity of Racer/TechRacer waypoints
Wuzzy <Wuzzy2@mail.ru>
parents: 12407
diff changeset
   320
                        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
   321
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   322
                        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
   323
                        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
   324
                                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
   325
                                        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
   326
                                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
   327
                        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
   328
11925
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   329
                        if wpActive[i] == false then
11927
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   330
                                local wpMessage = ""
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   331
                                if wpRem-1 == 0 then
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   332
                                         wpMessage = loc("Track completed!")
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   333
                                else
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   334
                                         wpMessage = string.format(loc("Waypoints remaining: %d"), wpRem-1)
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   335
                                end
72593678e8d6 Racer: Show “Track completed!” message
Wuzzy <almikes@aol.com>
parents: 11926
diff changeset
   336
                                AddCaption(wpMessage, 0xffba00ff, capgrpGameState)
11925
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   337
                        end
7123bfc9643c Racer: Don't mess with ammo display when touching waypoint
Wuzzy <almikes@aol.com>
parents: 11924
diff changeset
   338
                        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
   339
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   340
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   341
d080b8d4c114 team coloured, just for the 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
                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
   343
                        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
   344
                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
   345
d080b8d4c114 team coloured, just for the 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
        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
   347
d080b8d4c114 team coloured, just for the 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
        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
   349
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   350
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
   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
function AdjustScores()
11930
4ed643879c0f Racer: Clean up “did not finish” mess
Wuzzy <almikes@aol.com>
parents: 11929
diff changeset
   353
	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
   354
d080b8d4c114 team coloured, just for the 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
        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
   356
d080b8d4c114 team coloured, just for the 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
        -- 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
   358
        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
   359
                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
   360
                        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
   361
                                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
   362
                                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
   363
                        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
   364
                                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
   365
                        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
   366
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   367
        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
   368
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   369
        -- 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
   370
        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
   371
                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
   372
                        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
   373
                        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
   374
                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
   375
        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
   376
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   377
        if bestTime ~= MAX_TURN_TIME then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   378
                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
   379
        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
   380
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   381
        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
   382
                if trackTime == bestTime then -- best time of the race
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   383
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   384
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   385
                        string.format(loc("New race record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   386
                        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
   387
                        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
   388
                else    -- best time for the clan
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   389
                        ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   390
                        loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   391
                        string.format(loc("New clan record: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   392
                        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
   393
                end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   394
        else -- not any kind of new score
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   395
                ShowMission(loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   396
                loc("Track completed!"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   397
                string.format(loc("Time: %.1fs"), (trackTime/1000)) .. "|" ..
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   398
                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
   399
                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
   400
        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
   401
13027
625d5a45f267 Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents: 13024
diff changeset
   402
        for i = 0, (TeamsCount-1) do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   403
                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
   404
                        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
   405
                end
625d5a45f267 Racer/TechRacer: Show best times next to team bars
Wuzzy <Wuzzy2@mail.ru>
parents: 13024
diff changeset
   406
        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
   407
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   408
        if 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
   409
d080b8d4c114 team coloured, just for the 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
                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
   411
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   412
                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
   413
                        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
   414
                        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
   415
                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
   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
                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
   418
                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
   419
d080b8d4c114 team coloured, just for the 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
        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
   421
                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
   422
                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
   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
d080b8d4c114 team coloured, just for the 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
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
   427
d080b8d4c114 team coloured, just for the 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
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
   429
d080b8d4c114 team coloured, just for the 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
        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
   431
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   432
        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
   433
        for i = 0, (TeamsCount-1) do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   434
                        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
   435
                                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
   436
                        else
11930
4ed643879c0f Racer: Clean up “did not finish” mess
Wuzzy <almikes@aol.com>
parents: 11929
diff changeset
   437
                                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
   438
                        end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   439
                        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
   440
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   441
15069
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   442
        local icon
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   443
        if roundNumber >= roundLimit then
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   444
                icon = 0
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   445
        else
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   446
                icon = 2
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   447
        end
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   448
        ShowMission(    loc("Racer"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   449
                                        loc("Status update"),
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   450
                                        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
   451
                                        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
   452
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   453
        -- 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
   454
        if roundNumber >= roundLimit then
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   455
                -- Sort the scores for the ranking list
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   456
                local unfinishedArray = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   457
                local sortedTeams = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   458
                local k = 1
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   459
                local c = 1
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   460
                local clanScores = {}
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   461
                local previousClan
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   462
                for i = 0, TeamsCount-1 do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   463
                        local clan = GetTeamClan(teamNameArr[i])
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   464
                        if not clanScores[clan+1] then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   465
	                       clanScores[clan+1] = {}
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   466
	                       clanScores[clan+1].index = clan
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   467
	                       clanScores[clan+1].score = teamScore[i]
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   468
                        end
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   469
                        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
   470
                               sortedTeams[k] = {}
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   471
                               sortedTeams[k].name = teamNameArr[i]
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   472
                               sortedTeams[k].score = teamScore[i]
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   473
	                       sortedTeams[k].clan = clan
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   474
                               k = k + 1
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   475
                        else
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   476
                               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
   477
                        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
   478
                end
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   479
                table.sort(sortedTeams, function(team1, team2)
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   480
                        if team1.score == team2.score then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   481
                                return team1.clan < team2.clan
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   482
                        else
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   483
                                return team1.score < team2.score
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   484
                        end
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   485
                end)
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   486
                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
   487
                local rank = 0
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   488
                local rankPlus = 0
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   489
                local prevScore
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   490
                local clanRanks = {}
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   491
                for c = 1, #clanScores do
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   492
                        rankPlus = rankPlus + 1
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   493
                        if clanScores[c].score ~= prevScore then
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   494
                                rank = rank + rankPlus
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   495
                                rankPlus = 0
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   496
                        end
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   497
                        prevScore = clanScores[c].score
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   498
                        clanRanks[clanScores[c].index] = rank
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   499
                end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   500
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   501
                -- Write all the stats!
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   502
                for i = 1, #sortedTeams do
14578
50f511588635 Outsource commonly used words in siPointType to QTfrontend
Wuzzy <Wuzzy2@mail.ru>
parents: 14548
diff changeset
   503
                        SendStat(siPointType, "!TIME")
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   504
			SendStat(siTeamRank, tostring(clanRanks[GetTeamClan(sortedTeams[i].name)]))
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   505
                        SendStat(siPlayerKills, sortedTeams[i].score, sortedTeams[i].name)
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   506
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   507
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   508
		local roundDraw = false
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   509
		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
   510
			roundDraw = true
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   511
                        SendStat(siGameResult, loc("Round draw"))
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   512
                        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
   513
                elseif #sortedTeams >= 1 then
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   514
                        SendStat(siGameResult, string.format(loc("%s wins!"), sortedTeams[1].name))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   515
                        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
   516
                        for i=1,#unfinishedArray do
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   517
                                 SendStat(siCustomAchievement, unfinishedArray[i])
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   518
                        end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   519
                else
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   520
			roundDraw = true
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   521
                        SendStat(siGameResult, loc("Round draw"))
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   522
                        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
   523
                        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
   524
                                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
   525
                        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
   526
                                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
   527
                        end
11923
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   528
                end
85cbb2368269 Implement stats screen for Racer
Wuzzy <almikes@aol.com>
parents: 11648
diff changeset
   529
12333
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   530
		-- Kill all the losers
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   531
		for i = 0, (numhhs-1) do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   532
			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
   533
				SetEffect(hhs[i], heResurrectable, 0)
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   534
				SetHealth(hhs[i],0)
15400
06524f2e9a74 Racer: Make winners invulnerable
Wuzzy <Wuzzy2@mail.ru>
parents: 15399
diff changeset
   535
			elseif not roundDraw then
06524f2e9a74 Racer: Make winners invulnerable
Wuzzy <Wuzzy2@mail.ru>
parents: 15399
diff changeset
   536
				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
   537
			end
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   538
		end
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   539
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   540
		gameOver = true
12964
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   541
                for i=0, wpCount-1 do
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   542
                         -- Fade out waypoints
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   543
                         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
   544
                end
12333
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   545
		EndTurn(true)
6bdabf67a012 Add back the missing winning animation for Racer and TechRecer
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   546
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
   547
        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
   548
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   549
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
   550
d080b8d4c114 team coloured, just for the 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
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
   552
d080b8d4c114 team coloured, just for the 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
        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
   554
                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
   555
        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
   556
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   557
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
   558
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
   559
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
   560
        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
   561
        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
   562
                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
   563
                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
   564
                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
   565
                        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
   566
                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
   567
                racerActive = false -- newadd
12963
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   568
12964
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   569
		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
   570
                         for i=0, wpCount-1 do
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   571
                       	         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
   572
                         end
12964
a5c5fe878a4e Racer, TechRacer: Fade out waypoints at the end
Wuzzy <Wuzzy2@mail.ru>
parents: 12963
diff changeset
   573
                elseif not gameOver then
12963
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   574
                         for i=0, wpCount-1 do
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   575
                       	         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
   576
                         end
544c4302efe4 Racer, TechRacer: Change waypoint opacity on victory or failure
Wuzzy <Wuzzy2@mail.ru>
parents: 12962
diff changeset
   577
                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
   578
        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
   579
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
   580
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   581
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
   582
d080b8d4c114 team coloured, just for the 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
        -- 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
   584
        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
   585
        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
   586
        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
   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
        -- 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
   589
        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
   590
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   591
                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
   592
13685
09ea1faf97ca Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents: 13630
diff changeset
   593
                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
   594
                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
   595
d080b8d4c114 team coloured, just for the 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
        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
   597
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   598
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
   599
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   600
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
   601
d080b8d4c114 team coloured, just for the 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 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
   603
d080b8d4c114 team coloured, just for the 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
		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
   605
			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
   606
				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
   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
		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
   609
d080b8d4c114 team coloured, just for the 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
	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
   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
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
   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
-- 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
   616
----------------------------------
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   617
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   618
function onGameInit()
15489
3c0a3c824c49 Racer: Force-enable solid land
Wuzzy <Wuzzy2@mail.ru>
parents: 15488
diff changeset
   619
        EnableGameFlags(gfInfAttack, gfSolidLand)
15402
1028f5606b5f Racer, TechRacer: Force-disable several bad game flags
Wuzzy <Wuzzy2@mail.ru>
parents: 15400
diff changeset
   620
        -- 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
   621
        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
   622
        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
   623
        WaterRise = 0
12079
8f222872d432 Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents: 11986
diff changeset
   624
        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
   625
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
   626
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
   627
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
   628
        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
   629
                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
   630
                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
   631
                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
   632
                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
   633
                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
   634
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
   635
12407
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
   636
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
   637
        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
   638
        	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
   639
        	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
   640
		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
   641
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
   642
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   643
function onGameStart()
15483
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   644
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   645
	-- 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
   646
	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
   647
		local landW = RightX - LeftX + 1
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   648
		local landH = LAND_HEIGHT - TopY
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   649
		-- Reposition pre-defined waypoints
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   650
        	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
   651
        		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
   652
        		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
   653
		end
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   654
		-- Scale waypoint size
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   655
		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
   656
	end
70aba717485a Racer: Reposition and resize predefined waypoints in scaled drawn maps
Wuzzy <Wuzzy2@mail.ru>
parents: 15413
diff changeset
   657
13769
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   658
	if ClansCount >= 2 then
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   659
		SendGameResultOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   660
		SendRankingStatsOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   661
        	SendHealthStatsOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   662
		SendAchievementsStatsOff()
e874bfe563c7 Make sure scripts don't break w/ only 1 clan
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   663
	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
   664
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   665
        -- 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
   666
        for id, _ in pairs(landObjects) do
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   667
                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
   668
        end
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   669
13124
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13103
diff changeset
   670
        SetSoundMask(sndIncoming, true)
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13103
diff changeset
   671
        SetSoundMask(sndMissed, true)
991db8fc45eb Racer: No longer play Incoming or Missed sound
Wuzzy <Wuzzy2@mail.ru>
parents: 13103
diff changeset
   672
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
   673
        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
   674
        lastRound = TotalRounds
11928
42e90b244e11 Racer: Dump old commented-out code
Wuzzy <almikes@aol.com>
parents: 11927
diff changeset
   675
        RoundHasChanged = false
14070
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13841
diff changeset
   676
        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
   677
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   678
	if GetBackgroundBrightness() == 1 then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   679
		-- Dark waypoint colour theme
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   680
		waypointColour = waypointColourDark
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   681
		waypointColourAtPlacement = waypointColourDarkAtPlacement
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   682
	elseif GetBackgroundBrightness() == 2 then
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   683
		-- Medium waypoint colour theme
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   684
		waypointColour = waypointColourMedium
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   685
		waypointColourAtPlacement = waypointColourMediumAtPlacement
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   686
	end
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   687
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
   688
        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
   689
                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
   690
        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
   691
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   692
        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
   693
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
   694
        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
   695
                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
   696
        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
   697
                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
   698
        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
   699
11946
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   700
        SetAmmoTexts(amAirAttack, loc("Place waypoint"), loc("Racer tool"),
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   701
                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
   702
		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
   703
 		loc("Cursor: Place waypoint") .. "|" ..
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   704
 		loc("Precise: Remove previous waypoint"))
11946
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   705
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   706
        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
   707
                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
   708
                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
   709
                loc("Attack: Activate"))
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   710
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
   711
        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
   712
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   713
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   714
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
   715
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
   716
    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
   717
        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
   718
d080b8d4c114 team coloured, just for the 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
            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
   720
            wpY[wpCount] = y
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   721
            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
   722
            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
   723
12965
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   724
            local flashing, minO, maxO
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   725
            if wpCount == 0 then
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   726
                -- 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
   727
                minO, maxO = 164, 255
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   728
                flashing = 5
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   729
            else
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   730
                -- 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
   731
                minO, maxO = 255, 255
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   732
                flashing = 0
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   733
            end
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   734
            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
   735
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   736
            -- 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
   737
            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
   738
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   739
            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
   740
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
            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
   742
                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
   743
                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
   744
            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
   745
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   746
    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
   747
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
   748
11983
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   749
function onPrecise()
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   750
    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
   751
        DeletePreviousWayPoint()
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   752
    end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   753
end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   754
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   755
function DeletePreviousWayPoint()
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   756
    if wpCount > 0 then
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   757
        wpCount = wpCount - 1
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   758
        wpX[wpCount] = nil
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   759
        wpY[wpCount] = nil
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   760
        wpCol[wpCount] = nil
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   761
        DeleteVisualGear(wpCirc[wpCount])
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   762
        wpCirc[wpCount] = nil
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   763
        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
   764
        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
   765
        PlaySound(sndBump)
11983
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   766
    else
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   767
        PlaySound(sndDenied)
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   768
        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
   769
    end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   770
end
9e57915f5365 Allow to remove waypoints in Racer with precise key
Wuzzy <almikes@aol.com>
parents: 11946
diff changeset
   771
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
   772
function onSpecialPoint(x,y,flag)
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   773
    if flag == 99 then
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   774
        fastX[fastCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   775
        fastY[fastCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   776
        fastCount = fastCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   777
    else
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   778
        addHashData(x)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   779
        addHashData(y)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   780
        addHashData(flag)
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   781
        specialPointsX[specialPointsCount] = x
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   782
        specialPointsY[specialPointsCount] = y
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   783
        specialPointsCount = specialPointsCount + 1
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
   784
    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
   785
end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   786
d080b8d4c114 team coloured, just for the 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
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
   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
        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
   790
        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
   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
        racerActive = false
12407
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
   793
        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
   794
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   795
        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
   796
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   797
        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
   798
        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
   799
        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
   800
        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
   801
15404
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
   802
        SetSoundMask(sndStupid, false)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
   803
        SetSoundMask(sndBugger, false)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
   804
        SetSoundMask(sndDrat, false)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
   805
15403
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   806
        -- 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
   807
        if ammoDelays == nil then
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   808
                ammoDelays = {}
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   809
                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
   810
                        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
   811
                        -- 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
   812
                        -- 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
   813
                        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
   814
                                delay = delay - 10000
2cde69c1c680 Racer: Really fix delay confusion when attempting to force-disable gfKing/gfPlaceHog
Wuzzy <Wuzzy2@mail.ru>
parents: 15410
diff changeset
   815
                        end
15403
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   816
                        ammoDelays[a] = delay
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   817
                end
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   818
        end
e347c3508f95 Racer: Fix ammo delay confusion if gfKing or gfPlaceHog were set
Wuzzy <Wuzzy2@mail.ru>
parents: 15402
diff changeset
   819
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
        -- 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
   821
        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
   822
                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
   823
                        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
   824
                        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
   825
                        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
   826
                        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
   827
                                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
   828
                        end
11946
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   829
15398
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   830
                        -- Restore old ammo delays
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   831
                        for a=0, AmmoTypeMax do
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   832
                                if a ~= amAirAttack and a ~= amSkip then
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   833
                                        SetAmmoDelay(a, ammoDelays[a])
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   834
                                end
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   835
                        end
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   836
11946
65e61f495129 Overwrite special ammo descriptions in Racer script
Wuzzy <almikes@aol.com>
parents: 11931
diff changeset
   837
                        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
   838
                else
11986
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   839
                        local infoString
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   840
                        if wpLimit > 2 then
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   841
                                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
   842
                        else
f97b1c7fa053 Allow to set Racer waypoint limit with script parameter “maxwaypoints”
Wuzzy <almikes@aol.com>
parents: 11985
diff changeset
   843
                                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
   844
                        end
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   845
                        ShowMission(loc("Racer"),
15069
e16f906224fd Change mission panel icons for a couple of game styles
Wuzzy <Wuzzy2@mail.ru>
parents: 15068
diff changeset
   846
                        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
   847
                        AddAmmo(CurrentHedgehog, amAirAttack, AMMO_INFINITE)
15398
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   848
                        for a=0, AmmoTypeMax do
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   849
                                if a ~= amAirAttack and a ~= amSkip then
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   850
                                        SetAmmoDelay(a, 9999)
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   851
                                end
09b63f9032f4 Racer: Disable other ammos in waypoint placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15397
diff changeset
   852
                        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
   853
                        SetWeapon(amAirAttack)
15137
651c1737be2a WxW, Racer: Make bots skip/auto-confirm setup phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15069
diff changeset
   854
                        -- Bots skip waypoint placement
651c1737be2a WxW, Racer: Make bots skip/auto-confirm setup phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15069
diff changeset
   855
                        if GetHogLevel(CurrentHedgehog) ~= 0 then
651c1737be2a WxW, Racer: Make bots skip/auto-confirm setup phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15069
diff changeset
   856
                                SkipTurn()
651c1737be2a WxW, Racer: Make bots skip/auto-confirm setup phase
Wuzzy <Wuzzy2@mail.ru>
parents: 15069
diff changeset
   857
                        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
   858
                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
   859
        end
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   860
12965
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   861
        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
   862
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   863
                -- 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
   864
                for id,_ in pairs(landObjects) do
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   865
                        DeleteGear(id)
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
                for i=1, #landObjectPoints do
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   868
                        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
   869
                end
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   870
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
   871
                -- 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
   872
                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
   873
                        wpActive[i] = false
12967
e32fff07b8d7 Racer: Make waypoints dark in bright themes like Bath
Wuzzy <Wuzzy2@mail.ru>
parents: 12965
diff changeset
   874
                        wpCol[i] = waypointColour
12965
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   875
                        local flashing, minO, maxO
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   876
                        if i == 0 then
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   877
                            -- 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
   878
                            minO, maxO = 92, 255
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   879
                            flashing = 2
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   880
                        else
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   881
                            minO, maxO = 164, 224
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   882
                            flashing = 10
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   883
                        end
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   884
                        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
   885
                end
13024
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   886
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   887
                if cameraGear then
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   888
                        DeleteGear(cameraGear)
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   889
                end
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
   890
                -- 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
   891
		-- 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
   892
                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
   893
                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
   894
                FollowGear(cameraGear)
12965
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   895
        end
21eda4fe383c Racer: Make first waypoint flash and highlight last waypoint while placing
Wuzzy <Wuzzy2@mail.ru>
parents: 12964
diff changeset
   896
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
   897
        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
   898
                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
   899
                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
   900
        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
   901
d080b8d4c114 team coloured, just for the 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, amTardis, 0)
13103
cf2a58dccc4a CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13027
diff changeset
   903
        AddAmmo(CurrentHedgehog, amResurrector, 0)
cf2a58dccc4a CTF: Remove tardis and resurrector
Wuzzy <Wuzzy2@mail.ru>
parents: 13027
diff changeset
   904
        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
   905
        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
   906
        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
   907
        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
   908
        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
   909
        AddAmmo(CurrentHedgehog, amSwitch, 0)
ca8896b9c7c6 Racer: Remove a few ammo types that could break the gameplay
Wuzzy <Wuzzy2@mail.ru>
parents: 15411
diff changeset
   910
        AddAmmo(CurrentHedgehog, amKamikaze, 0)
ca8896b9c7c6 Racer: Remove a few ammo types that could break the gameplay
Wuzzy <Wuzzy2@mail.ru>
parents: 15411
diff changeset
   911
        AddAmmo(CurrentHedgehog, amIceGun, 0)
15397
b186e1f4c5ed Racer: Make sure the waypoint placer always has 0 delay
Wuzzy <Wuzzy2@mail.ru>
parents: 15396
diff changeset
   912
        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
   913
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
   914
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   915
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
   916
d080b8d4c114 team coloured, just for the 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
        -- 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
   918
        if cGear ~= nil then
15410
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
   919
                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
   920
                if x > -9000 then
15410
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
   921
                        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
   922
d080b8d4c114 team coloured, just for the 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
d080b8d4c114 team coloured, just for the 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
                        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
   925
                                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
   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
                        elseif (y > WaterLine-50) then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   928
                                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
   929
                                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
   930
                        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
   931
                                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
   932
                                if wpCount == wpLimit then
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
   933
                                        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
   934
                                        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
   935
                                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
   936
                        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
   937
                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
   938
                        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
   939
                end
15410
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
   940
        	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
   941
        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
   942
d080b8d4c114 team coloured, just for the 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
        -- 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
   945
        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
   946
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   947
                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
   948
d080b8d4c114 team coloured, just for the 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
                        -- 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
   950
                        --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
   951
                        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
   952
                                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
   953
                                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
   954
                                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
   955
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   956
                                SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
15385
c35c5a9b878c Allow playing Racer without invulnerability
S-D-
parents: 15245
diff changeset
   957
                                Explode(GetX(CurrentHedgehog)+boostX,
c35c5a9b878c Allow playing Racer without invulnerability
S-D-
parents: 15245
diff changeset
   958
                                        GetY(CurrentHedgehog)+boostY,
c35c5a9b878c Allow playing Racer without invulnerability
S-D-
parents: 15245
diff changeset
   959
                                        50,
c35c5a9b878c Allow playing Racer without invulnerability
S-D-
parents: 15245
diff changeset
   960
                                        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
   961
                                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
   962
d080b8d4c114 team coloured, just for the 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
                                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
   964
d080b8d4c114 team coloured, just for the 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
                                -- 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
   966
                                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
   967
                                        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
   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
                        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
   970
                                -- 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
   971
                        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
   972
13129
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   973
        	end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   974
		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
   975
			waypointCursor = true
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
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   979
	else
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   980
		waypointCursor = false
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
   981
	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
   982
15788
acf70c44065b Use the singular 'they' in code comments, where it makes sense
Wuzzy <Wuzzy2@mail.ru>
parents: 15489
diff changeset
   983
        -- 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
   984
        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
   985
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
   986
                --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
   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
                -- 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
   989
                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
   990
d080b8d4c114 team coloured, just for the 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
                        --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
   992
                        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
   993
                                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
   994
                        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
   995
d080b8d4c114 team coloured, just for the 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
                        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
   997
d080b8d4c114 team coloured, just for the 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
                        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
   999
11924
ce277e51b603 Racer: Clean up strings
Wuzzy <almikes@aol.com>
parents: 11923
diff changeset
  1000
                                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
  1001
15404
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
  1002
				-- 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
  1003
                                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
  1004
                                        SetSoundMask(sndStupid, true)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
  1005
                                        SetSoundMask(sndBugger, true)
0e3bf53dfe47 Racer, TechRacer: Mask taunts like Stupid when track was completed successfully
Wuzzy <Wuzzy2@mail.ru>
parents: 15403
diff changeset
  1006
                                        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
  1007
                                        AdjustScores()
15400
06524f2e9a74 Racer: Make winners invulnerable
Wuzzy <Wuzzy2@mail.ru>
parents: 15399
diff changeset
  1008
                                        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
  1009
                                        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
  1010
                                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
  1011
d080b8d4c114 team coloured, just for the 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
                        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
  1013
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1014
                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
  1015
15788
acf70c44065b Use the singular 'they' in code comments, where it makes sense
Wuzzy <Wuzzy2@mail.ru>
parents: 15489
diff changeset
  1016
                -- 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
  1017
                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
  1018
                        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
  1019
                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
  1020
d080b8d4c114 team coloured, just for the 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
        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
  1022
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1023
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
  1024
13129
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1025
function onGameTick()
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1026
	if waypointCursor then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1027
		if not waypointPreview then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1028
			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
  1029
		end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1030
		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
  1031
	else
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1032
		if waypointPreview then
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1033
			DeleteVisualGear(waypointPreview)
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1034
			waypointPreview = nil
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1035
		end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1036
	end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1037
end
9a328734e469 Racer: Draw waypoint outline around cursor while in placement phase
Wuzzy <Wuzzy2@mail.ru>
parents: 13124
diff changeset
  1038
15399
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1039
function onGearDamage(gear)
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1040
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1041
        if gear == CurrentHedgehog then
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1042
                DisableTumbler(false)
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1043
        end
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1044
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1045
end
4b792051c159 Racer: Fix hog taking damage skipping turn of next team
Wuzzy <Wuzzy2@mail.ru>
parents: 15398
diff changeset
  1046
13630
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1047
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
  1048
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1049
        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
  1050
                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
  1051
        end
13630
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1052
        if vGear then
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1053
                DeleteVisualGear(vGear)
fe7d2bbf5f3f Fix resurrection animation appearing at wrong position for some missions and styles
Wuzzy <Wuzzy2@mail.ru>
parents: 13129
diff changeset
  1054
        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
  1055
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1056
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
  1057
d080b8d4c114 team coloured, just for the 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
function onGearAdd(gear)
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1059
        local gt = GetGearType(gear)
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1060
        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
  1061
                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
  1062
                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
  1063
                SetEffect(gear, heResurrectable, 1)
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1064
        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
  1065
                cGear = gear
15410
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
  1066
		local x,y = GetGearPosition(cGear)
8504fee3b601 Racer: Fix weird water splashes after waypoint placement
Wuzzy <Wuzzy2@mail.ru>
parents: 15404
diff changeset
  1067
        	SetGearPosition(cGear, 10000, y)
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1068
        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
  1069
                landObjects[gear] = true
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1070
        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
  1071
		DeleteGear(gear)
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1072
        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
  1073
            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
  1074
            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
  1075
        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
  1076
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
  1077
d080b8d4c114 team coloured, just for the 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
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
  1079
d080b8d4c114 team coloured, just for the heck of it, based on a param. also del airmine, 'cause, probably not fun here. you're invuln anyway.
nemo
parents: 10847
diff changeset
  1080
        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
  1081
                cGear = nil
15488
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1082
        elseif landObjects[gear] == true then
04b63bcdb2ab Racer: Reset mines, air mines, barrels after each turn
Wuzzy <Wuzzy2@mail.ru>
parents: 15485
diff changeset
  1083
                landObjects[gear] = nil
13024
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
  1084
        elseif gear == cameraGear then
a568bc16a99a Racer and TechRacer: Move cameera to first waypoint in Ready phase
Wuzzy <Wuzzy2@mail.ru>
parents: 12967
diff changeset
  1085
                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
  1086
        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
  1087
d080b8d4c114 team coloured, just for the 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
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
  1089
d080b8d4c114 team coloured, just for the 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
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
  1091
    at = GetCurAmmoType()
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
  1092
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
  1093
    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
  1094
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
  1095
12407
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1096
function onHogAttack(ammoType)
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1097
    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
  1098
        turnSkipped = true
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1099
    end
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1100
end
8cc070640fd1 Fix skipping in Racer causing the next team to be skipped, too
Wuzzy <almikes@aol.com>
parents: 12406
diff changeset
  1101
15245
395563ffc8b5 Racer: Count turn as skipped when computer skipped
Wuzzy <Wuzzy2@mail.ru>
parents: 15137
diff changeset
  1102
function onSkipTurn()
395563ffc8b5 Racer: Count turn as skipped when computer skipped
Wuzzy <Wuzzy2@mail.ru>
parents: 15137
diff changeset
  1103
    turnSkipped = true
395563ffc8b5 Racer: Count turn as skipped when computer skipped
Wuzzy <Wuzzy2@mail.ru>
parents: 15137
diff changeset
  1104
end
395563ffc8b5 Racer: Count turn as skipped when computer skipped
Wuzzy <Wuzzy2@mail.ru>
parents: 15137
diff changeset
  1105
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
  1106
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
  1107
    usedWeapons[amSkip] = nil
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
  1108
    usedWeapons[amExtraTime] = nil
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
  1109
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
  1110
    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
  1111
    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
  1112
    usedSaucer = usedWeapons[amJetpack] ~= nil
11563
7e5d6ce6fe14 Treat #99 point type as a ghost trace
unc0rr
parents: 11545
diff changeset
  1113
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
  1114
    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
  1115
    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
  1116
    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
  1117
    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
  1118
d080b8d4c114 team coloured, just for the 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
    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
  1120
d080b8d4c114 team coloured, just for the 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
    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
  1122
        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
  1123
    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
  1124
        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
  1125
    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
  1126
        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
  1127
    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
  1128
        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
  1129
    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
  1130
        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
  1131
    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
  1132
        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
  1133
    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
  1134
d080b8d4c114 team coloured, just for the 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
    for i = 0, (numTeams-1) do
13839
2fceeea62b10 Add tie handling for Racer and TechRacer
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
  1136
        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
  1137
            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
  1138
        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
  1139
    end
11569
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1140
14070
a5be3ef4bbbe Update official challenge hashes, improve console logging (warning: racer #17 is missing!)
Wuzzy <Wuzzy2@mail.ru>
parents: 13841
diff changeset
  1141
    if officialChallenge ~= nil and fastCount > 0 then
11569
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1142
        StartGhostPoints(fastCount)
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1143
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1144
        for i = 0, (fastCount - 1) do
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1145
            DumpPoint(fastX[i], fastY[i])
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1146
        end
294ce0fa65d0 Dump best time ghost on console
unc0rr
parents: 11563
diff changeset
  1147
    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
  1148
end