share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
author Wuzzy <Wuzzy2@mail.ru>
Sat, 07 Jul 2018 19:34:13 +0200
changeset 13451 57de4f050891
parent 13449 6aca4f45ab0a
child 13579 ff7378430675
permissions -rw-r--r--
Space Invasion: Improve how round score is displayed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
     1
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7838
diff changeset
     2
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7838
diff changeset
     3
HedgewarsScriptLoad("/Scripts/Tracker.lua")
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     4
HedgewarsScriptLoad("/Scripts/Params.lua")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     5
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     6
--[[
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     7
Space Invasion 1.2
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     8
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
     9
=== DOCUMENTATION ===
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    10
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    11
== SCRIPT CONFIGURATION ==
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    12
You can configure this script a little bit, you only have to edit the game scheme.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    13
The script makes heavy use of the script parameters, but you can also use some,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    14
but not all, of the other settings in a game scheme.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    15
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    16
You CAN use the following options:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    17
- disable girders (highly recommended!)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    18
- disable land objects
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    19
- random order
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    20
- solid land
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    21
- low gravity (makes this game much easier, but this script is probably not optimized for it yet)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    22
- bottom border
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    23
- fort mode (just changes the landscape)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    24
- teams start at opposite parts of land
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    25
- wind affects almost everything
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    26
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    27
Those options are also possible, but have no real gameplay effect:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    28
- disable wind
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    29
- tag team
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    30
- king mode (here it only changes hats, so this is just for fun)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    31
- vampiric (has no real gameplay effect; just for the grapical effect)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    32
- full border (it’s techincally possible, but the script is currently not very well optimized for this mode)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    33
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    34
You CANNOT use any other of the on/off options in the game scheme. Those settings are simply discarded by the script.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    35
12063
797d1236a56b Disable world edge in Space Invasion
Wuzzy <almikes@aol.com>
parents: 12062
diff changeset
    36
You also can change the following settings in the game scheme:
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    37
- time per round (very important)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    38
- script parameters, see below
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    39
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    40
The other settings are technically possible, but their effect is limited:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    41
- damage percentage
12063
797d1236a56b Disable world edge in Space Invasion
Wuzzy <almikes@aol.com>
parents: 12062
diff changeset
    42
- mines/air mines (they don’t harm the active hedgehog, however)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    43
- number of barrels
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    44
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    45
All other variables are discarded, the script forces its own settings.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    46
There will be never Sudden Death, any crate drops, any mines and any
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    47
barrels.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    48
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    49
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    50
== SCRIPT PARAMETERS ==
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    51
This script can be configured mostly with the script parameters.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    52
The script parameters are specified in a key=value format each,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    53
and each pair is delimeted by a comma.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    54
All values must be integer of 0 or higher. All values are optional
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    55
and have a default if unspecified
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    56
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    57
List of parameters:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    58
- rounds: Number of rounds (default: 3)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    59
- shield: Amount of shield you start with (default: 30)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    60
- barrels: Amount of ammo (barrels) you start with (default: 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    61
- pings: How many time you can use the radar per round (default: 2)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    62
- barrelbonus: How many barrels you get for collecting/destroning a green invader (default: 3)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    63
- shieldbonus: How much shield you get for collecting/destroying a purple invader (default: 30)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    64
- timebonus: How many seconds you get for killing a drone (red) (default: 4)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    65
- forcetheme: If set to false, the game will use your chosen theme instead of forcing EarthRise
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    66
-             Please note that the game may not be able to be played in some themes if the sky
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    67
               color is very bright (i.e. Bath)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    68
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    69
Example input for the field “Script parameters”:
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    70
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    71
rounds=5
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    72
>>> 5 rounds, everything else is default
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    73
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    74
forcetheme=false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    75
>>> Makes the game use whatever thme
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    76
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    77
shield=0, barrels=3, pings=0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    78
>>> no shield, no radar pings and only 3 barrels (could be some hard mode)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    79
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    80
(empty string)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    81
>>> Use defaults for everything
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    82
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
    83
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    84
-- VERSION HISTORY
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    85
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    86
-- version 0.1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    87
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    88
-- conversion of tumbler into space invasion
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    89
-- a million and one changes
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    90
-- bells and whistles
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    91
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    92
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    93
-- version 0.2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    94
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    95
-- code slowly getting cleaner, it still looks like a spaghetti monster tho
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    96
-- lots of console tracking :/
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    97
-- all visual gears are now compulsary (will probably revert this)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    98
-- implemented fMod to try combat desyncs and bring this in line with dev
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
    99
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   100
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   101
-- version 0.3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   102
----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   103
-- values of scoring changed to 3:10, and now based on vCircScore
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   104
-- time gained from killing a red circ increased from 3 to 4
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   105
-- circles now spawn at a distance of at least 800 or until sanity limit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   106
-- roundsLimit now based off MinesTime (kinda, its an experiment)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   107
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   108
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   109
--0.4
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   110
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   111
-- commented out a lot of WriteLnToConsoles (dont need them at this point)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   112
-- added some different WriteLnToConsoles
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   113
-- changed some of the collision detect for explosives in checkvarious()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   114
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   115
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   116
--0.5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   117
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   118
-- added implementation for a projectile shield
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   119
-- added a "bonus" orange invader that partially recharges player shield
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   120
-- added a tough "blueboss" blue invader
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   121
-- expanded user feedback
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   122
-- circles now have health and are capable of being merely "damaged"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   123
-- redid a lot of the collision code and added CircleDamaged
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   124
-- added more sounds to events
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   125
-- added more visual gears
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   126
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   127
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   128
--0.6
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   129
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   130
-- removed a few WriteLns
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   131
-- added randomized grunts on circ damage
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   132
-- added (mostly) graceful fading out of circles :D:
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   133
-- changed odds for circles
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   134
-- changed user feedback
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   135
-- fixed the location of the explosion where player bashes into circ
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   136
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   137
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   138
--0.7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   139
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   140
-- added PlaySound(sndSuddenDeath) when ammo gets depleted
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   141
-- added an extra "Ammo Depleted" note if user presses fire while empty
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   142
-- specified how much shield power is gained on shield powerup collection
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   143
-- changed odds for circles AGAIN, ammo is now sliiightly more common
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   144
-- switched most of the explosions/smoke effects back to non-critical vgears (with a few exceptions)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   145
-- tumbletime is now based off turntime and is variable
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   146
-- delete explosives in DeleteFarFlungBarrel rather than explode them on map boundaries to save on performance
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   147
-- utilized the improved AddCaption to tint / prevent overrides
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   148
-- temporarily disabled bugged sort that displays teams according to their score
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   149
-- reluctantly changed the colour of the bonus circ to purple
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   150
-- standarized point notation
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   151
-- added some missing locs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   152
-- commented out remaining WriteLnToConsoles for the meanwhile with the prefix "nw"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   153
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   154
-- ACHIEIVEMENTS added
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   155
-- (during one turn) aka repeatable
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   156
-- Ammo Manic (Destroy 3 green circles for + 5 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   157
-- Drone Hunter (Destroy 5 red circles for + 10 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   158
-- Shield Seeker (Destroy 3 purple circles for +10 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   159
-- Boss Slayer (Destroy 2 blue circles for +25 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   160
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   161
-- Shield Master (disolve 5 shells for +10 points)
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   162
-- Shield Miser (don't use your shield at all (3.5*roundkills)+2 points)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   163
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   164
-- Depleted Kamikaze! (kamikaze into a blue/red circ when you are out of ammo) 5pts
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   165
-- Timed Kamikaze! (kamikaze into a blue/red circ when you only have 5s left) 10pts
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   166
-- Kamikaze Expert (combination of the above two) 15pts
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   167
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   168
-- Multi-shot (destroy more than 1 invader with a single bullet) 15pts
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   169
-- X-Hit Combo (destroy another invader in less than 3 seconds) chainLength*2 points
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   170
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   171
-- Accuracy Bonus (80% accuracy at the end of your turn with more than 5 shots fired) 15pts
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   172
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   173
--(during the length of the game) aka non-repeatable
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   174
-- 10/25/50 kills (+25/+50/+100 points)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   175
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   176
-----------------
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   177
--0.8
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   178
-----------------
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   179
-- added a HUD for turntimeleft, ammo, shield
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   180
-- shieldhealth hits 0 properly
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   181
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   182
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   183
-- version 0.8.1
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   184
------------------------
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   185
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   186
-- stop hiding non-existant 4th Tag
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   187
-- redraw HUD on screen resolution change
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
   188
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   189
------------------------
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   190
-- version 0.9
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   191
------------------------
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   192
-- time for more 'EXPERIMENTS' mwahahahahahaha D:
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   193
-- (hopefully) balanced Shield Miser
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   194
-- bosses are no longer a redunkulous 50 points, but toned down to 30
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   195
-- experimental radar (it's INTERACTIVE and math-heavy :D) (visual gears are safe... right? D:)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   196
-- bugfix and balance for multishot
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   197
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   198
------------------------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   199
-- version 1.0
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   200
------------------------
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   201
-- if only version numbers actually worked like this, wouldn't that be awful :D
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   202
-- added surfer achievement
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   203
-- increased value of shield miser by 1 point per kill (OP?)
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   204
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   205
------------------------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   206
-- version 1.1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   207
------------------------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   208
-- fixed radar so that blips dont go past circs when you get very close
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   209
-- added a missing loc for shield depletion
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   210
-- increased delay to 1000 to try stop noobies missing their turn
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   211
-- added sniper achievement for hits from over a 1000000 away
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   212
-- added achievement for 3 "sniper" shots in a round
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   213
-- added achievement for 3 "point blank" shots in a round
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   214
-- added "fierce Competition" achievement for shooting an enemy hog (once per round)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   215
-- some support for more weapons later
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   216
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   217
------------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   218
-- version 1.2
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   219
------------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   220
-- show actual scores in stats screen
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   221
-- show a couple of “awards” and more or less snarky comments in stats screen
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   222
--  for various accomplisments and events those are just for fun, they don’t
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   223
--  affect score or game outcome
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   224
-- use script parameters for configuration, see top of file for more information
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   225
-- stop overwriting game most scheme’s parameters
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   226
-- disable weapon scheme
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   227
-- play “denied” sound when trying to use empty radar, ammo or shield
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   228
-- play “Hurry!” taunt when 5 seconds are left
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   229
-- play throw sound when throwing a barrel
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   230
-- play sonar sound for using radar
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   231
-- play “Kamikaze!” taunt for receiving one of the kamikaze bonuses
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   232
-- show total team score in HUD (white number)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   233
-- show message when trying to use empty radar
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   234
-- show message when time’s up
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   235
-- show message with round score at end of a round
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   236
-- disabled health graph, replaced with score per round
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   237
-- removed “selected weapon” message, we only have one weapon
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   238
-- removed unused bubbleSort function
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   239
-- play “Ooff” sound when hit by bazooka
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   240
-- fix explosion being drawn twice when colliding with circle
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   241
-- play explosion sound when barrel’s lifespan is over
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   242
]]
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   243
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   244
--------------------------
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   245
-- TODO list: notes for later
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   246
--------------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   247
-- imitate winning animation at end instead of just ending the game
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   248
12063
797d1236a56b Disable world edge in Space Invasion
Wuzzy <almikes@aol.com>
parents: 12062
diff changeset
   249
-- add support for other world edges (they are currently disabled)
797d1236a56b Disable world edge in Space Invasion
Wuzzy <almikes@aol.com>
parents: 12062
diff changeset
   250
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   251
-- maybe add a check for a tie, IMPOSSIBRU THERE ARE NO TIES
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   252
-- more achievements?
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   253
-- more just-for-fun awards (for stats screen)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   254
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   255
-- if more weps are added, replace primshotsfired all over the place
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   256
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   257
-- look for derp and let invaders shoot again
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   258
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   259
-- more weps? flamer/machineballgun,
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   260
-- some kind of bomb that just drops straight down
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   261
-- "fire and forget" missile
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   262
-- shockwave
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   263
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   264
-- some kind of ability-meter that lets you do something awesome when you are
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   265
-- doing really well in a given round.
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   266
-- probably new kind of shield that pops any invaders who come near
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   267
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   268
-- fix game never ending bug
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   269
-- fix radar
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   270
-- new invader: golden snitch, doesn't show up on your radar
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   271
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   272
-- maybe replace (48/100*vCircRadius[i])/2 with something better
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   273
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   274
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   275
------- CODE FOLLOWS -------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   276
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   277
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   278
--[[CAPTION CATEGORIES
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   279
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   280
capgrpGameState
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   281
-----------------
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   282
AddCaption(LOC_NOT("Sniper!") .. " +10 " .. LOC_NOT("points") .. "!",0xffba00ff,capgrpAmmostate)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   283
--they call me bullsye
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   284
--point blank combo
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   285
--fierce Competition
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   286
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   287
capgrpAmmostate
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   288
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   289
AddCaption( chainLength .. LOC_NOT("-chain! +") .. chainLength*2 .. LOC_NOT(" points!"),0xffba00ff,capgrpAmmostate)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   290
AddCaption(LOC_NOT("Multi-shot! +15 points!"),0xffba00ff,capgrpAmmostate)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   291
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   292
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   293
capgrpAmmoinfo
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   294
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   295
AddCaption(LOC_NOT("Shield Miser! +20 points!"),0xffba00ff,capgrpAmmoinfo)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   296
AddCaption(LOC_NOT("Shield Master! +10 points!"),0xffba00ff,capgrpAmmoinfo)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   297
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   298
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   299
capgrpVolume
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   300
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   301
AddCaption(LOC_NOT("Boom! +25 points!"),0xffba00ff,capgrpVolume)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   302
AddCaption(LOC_NOT("BOOM! +50 points!"),0xffba00ff,capgrpVolume)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   303
AddCaption(LOC_NOT("BOOM! BOOM! BOOM! +100 points!"),0xffba00ff,capgrpVolume)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   304
AddCaption(LOC_NOT("Accuracy Bonus! +15 points!"),0xffba00ff,capgrpVolume)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   305
AddCaption(LOC_NOT("Surfer! +15 points!"),0xffba00ff,capgrpVolume)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   306
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   307
-----------------
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   308
capgrpMessage
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   309
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   310
AddCaption(LOC_NOT("Ammo Depleted!"),0xff0000ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   311
AddCaption(LOC_NOT("Ammo: ") .. primShotsLeft)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   312
AddCaption(LOC_NOT("Shield Depleted"),0xff0000ff,capgrpMessage)
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   313
AddCaption( LOC_NOT("Shield ON:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") )
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   314
AddCaption(LOC_NOT("Shield OFF:") .. " " .. shieldHealth - 80 .. " " .. LOC_NOT("Power Remaining") )
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   315
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   316
AddCaption(LOC_NOT("Time Extended!") .. "+" .. 4 .. LOC_NOT("s"), 0xff0000ff,capgrpMessage )
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   317
AddCaption("+" .. 3 .. " " .. LOC_NOT("Ammo"), 0x00ff00ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   318
AddCaption(LOC_NOT("Shield boosted! +30 power"), 0xff00ffff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   319
AddCaption(LOC_NOT("Shield is fully recharged!"), 0xffae00ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   320
AddCaption(LOC_NOT("Boss defeated! +50 points!"), 0x0050ffff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   321
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   322
AddCaption(LOC_NOT("GOTCHA!"))
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   323
AddCaption(LOC_NOT("Kamikaze Expert! +15 points!"),0xffba00ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   324
AddCaption(LOC_NOT("Depleted Kamikaze! +5 points!"),0xffba00ff,capgrpMessage)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   325
AddCaption(LOC_NOT("Timed Kamikaze! +10 points!"),0xffba00ff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   326
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   327
-----------------
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   328
capgrpMessage2
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   329
-----------------
5325
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   330
AddCaption(LOC_NOT("Drone Hunter! +10 points!"),0xffba00ff,capgrpMessage2)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   331
AddCaption(LOC_NOT("Ammo Maniac! +5 points!"),0xffba00ff,capgrpMessage2)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   332
AddCaption(LOC_NOT("Shield Seeker! +10 points!"),0xffba00ff,capgrpMessage2)
261b79ba22b1 Lua update. New phrases. Try to remove some duplicates by avoiding use of space and : in short common phrases. Removed localisation of some script names, since we can't localise that in frontend yet anyway, without screwing up multiplayer.
nemo
parents: 5245
diff changeset
   333
AddCaption(LOC_NOT("Boss Slayer! +25 points!"),0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   334
]]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   335
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   336
----------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   337
-- so I herd u liek wariables
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   338
----------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   339
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   340
local fMod = 1000000 -- use this for dev and .16+ games
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   341
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   342
-- Tag IDs
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   343
local TAG_TIME = 0
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   344
local TAG_BARRELS = 1
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   345
local TAG_SHIELD = 2
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   346
local TAG_ROUND_SCORE = 4
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   347
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   348
-- some console stuff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   349
local shellID = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   350
local explosivesID = 0
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   351
local luaGameTicks = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   352
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   353
-- gaudyRacer
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   354
local boosterOn = false
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   355
local preciseOn = false
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   356
local roundLimit = 3		-- can be overridden by script parameter "rounds"
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   357
local roundNumber = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   358
local firstClan = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   359
local gameOver = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   360
local gameBegun = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   361
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   362
local bestClan = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   363
local bestScore = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   364
local sdScore = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   365
local sdName = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   366
local sdKills = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   367
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   368
local roundN = 0
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   369
local lastRound
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   370
local RoundHasChanged = true
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   371
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   372
-- for script parameters
13026
ca7fdb431b34 Construction Mode, Space Invasion: Add example script param in default schems to make editing more convenient
Wuzzy <Wuzzy2@mail.ru>
parents: 13019
diff changeset
   373
-- NOTE: If you change this, also change the default “Space Invasion” game scheme
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   374
local startBarrels = 5		-- "barrels"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   375
local startShield = 30		-- "shield"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   376
local startRadShots = 2		-- "pings"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   377
local shieldBonus = 30		-- "shieldbonus"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   378
local barrelBonus = 3		-- "barrelbonus"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   379
local timeBonus = 4		-- "timebonus"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   380
local forceTheme = true		-- "forcetheme"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   381
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   382
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   383
-- hog and team tracking variales
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   384
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   385
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   386
local numhhs = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   387
local hhs = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   388
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   389
local numTeams
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   390
local teamNameArr = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   391
local teamClan = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   392
local teamSize = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   393
local teamIndex = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   394
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   395
local teamScore = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   396
local teamCircsKilled = {}
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   397
local teamSurfer = {}
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   398
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   399
-- stats variables
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   400
local roundKills = 0
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   401
local roundScore = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   402
local RK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   403
local GK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   404
local BK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   405
local OK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   406
local SK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   407
local shieldMiser = true
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   408
local fierceComp = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   409
local chainCounter = 0
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   410
local chainLength = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   411
local shotsFired = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   412
local shotsHit = 0
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   413
local sniperHits = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   414
local pointBlankHits = 0
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   415
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   416
---------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   417
-- awards (for stats section, just for fun)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   418
---------------------
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   419
-- global awards
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   420
local awardTotalKills=0	-- overall killed invaders (min. 30)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   421
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   422
-- hog awards
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   423
local awardRoundScore	-- hog with most score in 1 round (min. 50)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   424
local awardRoundKills	-- most kills in 1 round (min. 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   425
local awardAccuracy	-- awarded to hog who didn’t miss once in his round, with most kills (min. 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   426
local awardCombo	-- hog with longest combo (min. 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   427
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
   428
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
   429
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
   430
-- Taunt trackers
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
   431
local tauntTimer = -1
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
   432
local tauntGear = nil
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
   433
local tauntSound = nil
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
   434
local tauntClanShots = 0 -- hogs of same clans shot in this turn
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
   435
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   436
---------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   437
-- tumbler goods
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   438
---------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   439
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   440
local moveTimer = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   441
local leftOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   442
local rightOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   443
local upOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   444
local downOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   445
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   446
----------------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   447
-- TUMBLER
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   448
local wep = {}
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   449
local wepAmmo = {}
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   450
local wepCol = {}
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   451
local wepIndex = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   452
local wepCount = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   453
local fireTimer = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   454
----------------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   455
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   456
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   457
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   458
local primShotsMax = 5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   459
local primShotsLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   460
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   461
local TimeLeftCounter = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   462
local TimeLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   463
local stopMovement = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   464
local tumbleStarted = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   465
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   466
local beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   467
local pShield
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   468
local shieldHealth
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   469
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   470
local shockwave
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   471
local shockwaveHealth = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   472
local shockwaveRad = 300
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   473
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   474
local timer100 = 0
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   475
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   476
local vTag = {}
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   477
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   478
-----------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   479
-- CIRCLY GOODIES
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   480
-----------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   481
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   482
local circlesAreGo = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   483
local playerIsFine = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   484
local targetHit = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   485
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   486
local fadeAlpha = 0 -- used to fade the circles out gracefully when player dies
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   487
local pTimer = 0 -- tracking projectiles following player
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   488
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   489
local circAdjustTimer = 0		-- handle adjustment of circs direction
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   490
local m2Count = 0		-- handle speed of circs
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   491
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   492
local vCirc = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   493
local vCCount = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   494
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   495
local rCirc = {}
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   496
local rCircX = {}
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   497
local rCircY = {}
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   498
local rAlpha = 255
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
   499
local rPingTimer = 0
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   500
local radShotsLeft = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   501
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   502
local vCircActive = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   503
local vCircHealth = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   504
local vType = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   505
local vCounter = {}		-- how often this circ gets to "fire" etc
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   506
local vCounterLim = {} -- when vCounter == vCounterLim circle performs its special
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   507
local vCircScore = {} -- how many points killing this invader gives
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   508
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   509
local vCircRadMax = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   510
local vCircRadMin = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   511
local vCircRadDir = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   512
local vCircRadCounter = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   513
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   514
local vCircDX = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   515
local vCircDY = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   516
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   517
local vCircX = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   518
local vCircY = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   519
local vCircMinA = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   520
local vCircMaxA = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   521
local vCircType = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   522
local vCircPulse = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   523
local vCircFuckAll = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   524
local vCircRadius = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   525
local vCircWidth = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   526
local vCircCol = {}
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   527
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   528
-------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   529
-- some lazy copypasta/modified methods
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   530
-------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   531
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   532
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   533
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   534
function HideTag(i)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   535
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   536
	SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   537
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   538
end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   539
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   540
function DrawTag(i)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   541
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   542
	local zoomL = 1.3
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   543
	local xOffset = 40
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   544
	local yOffset, tValue, tCol
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   545
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   546
	if i == TAG_TIME then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   547
		yOffset = 40
12062
3d03e9294633 Use yellow clock color in Space Invasion and Tumbler
Wuzzy <almikes@aol.com>
parents: 12061
diff changeset
   548
		tCol = 0xffee00ff
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   549
		tValue = TimeLeft
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   550
	elseif i == TAG_BARRELS then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   551
		zoomL = 1.1
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   552
		yOffset = 70
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   553
		tCol = 0x00ff00ff
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   554
		tValue = wepAmmo[wepIndex] --primShotsLeft
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   555
	elseif i == TAG_SHIELD then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   556
		zoomL = 1.1
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   557
		xOffset = 40 + 35
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   558
		yOffset = 70
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   559
		tCol = 0xa800ffff
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   560
		tValue = shieldHealth - 80
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   561
	elseif i == TAG_ROUND_SCORE then
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   562
		zoomL = 1.1
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   563
		xOffset = 40
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   564
		yOffset = 100
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   565
		tCol = 0xffffffff
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   566
		tValue = roundScore
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   567
	end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   568
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   569
	DeleteVisualGear(vTag[i])
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   570
	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
   571
	SetVisualGearValues	(
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   572
				vTag[i], 		--id
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   573
				-(div(ScreenWidth, 2)) + xOffset,	--xoffset
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   574
				ScreenHeight - yOffset, --yoffset
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   575
				0, 			--dx
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   576
				0, 			--dy
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   577
				zoomL, 			--zoom
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   578
				1, 			--~= 0 means align to screen
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   579
				nil, 			--frameticks
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   580
				tValue, 		--value
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   581
				240000, 		--timer
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   582
				tCol		--GetClanColor( GetHogClan(CurrentHedgehog) )
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   583
				)
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   584
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   585
end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
   586
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   587
function RebuildTeamInfo()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   588
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   589
	-- make a list of individual team names
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   590
	for i = 0, (TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   591
		teamSize[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   592
		teamIndex[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   593
		teamScore[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   594
		teamCircsKilled[i] = 0
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   595
		teamSurfer[i] = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   596
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   597
	numTeams = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   598
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   599
	for i = 0, (numhhs-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   600
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   601
		local z = 0
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   602
		local unfinished = true
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   603
		while(unfinished == true) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   604
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   605
			local newTeam = true
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   606
			local tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   607
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   608
			if tempHogTeamName == teamNameArr[z] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   609
				newTeam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   610
				unfinished = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   611
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   612
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   613
			z = z + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   614
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   615
			if z == (TeamsCount-1) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   616
				unfinished = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   617
				if newTeam == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   618
					teamNameArr[numTeams] = tempHogTeamName
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   619
					numTeams = numTeams + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   620
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   621
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   622
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   623
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   624
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   625
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   626
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   627
	-- find out how many hogs per team, and the index of the first hog in hhs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   628
	for i = 0, (TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   629
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   630
		for z = 0, (numhhs-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   631
			if GetHogTeamName(hhs[z]) == teamNameArr[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   632
				teamClan[i] = GetHogClan(hhs[z])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   633
				if teamSize[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   634
					teamIndex[i] = z -- should give starting index
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   635
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   636
				teamSize[i] = teamSize[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   637
				--add a pointer so this hog appears at i in hhs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   638
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   639
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   640
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   641
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   642
13019
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12426
diff changeset
   643
	for i=0, TeamsCount-1 do
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12426
diff changeset
   644
		SetTeamLabel(teamNameArr[i], teamScore[i])
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12426
diff changeset
   645
	end
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12426
diff changeset
   646
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   647
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   648
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   649
-- control
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   650
function AwardPoints(p)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   651
	roundScore = roundScore + p
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
   652
	DrawTag(TAG_ROUND_SCORE)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   653
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   654
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   655
		if teamClan[i] == GetHogClan(CurrentHedgehog) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   656
			teamScore[i] = teamScore[i] + p
13019
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12426
diff changeset
   657
			SetTeamLabel(teamNameArr[i], teamScore[i])
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   658
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   659
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   660
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   661
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   662
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   663
function AwardKills(t)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   664
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
   665
	roundKills = roundKills + 1
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   666
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   667
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   668
		if teamClan[i] == GetHogClan(CurrentHedgehog) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   669
			teamCircsKilled[i] = teamCircsKilled[i] + 1
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   670
			awardTotalKills = awardTotalKills + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   671
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   672
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   673
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   674
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   675
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   676
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   677
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   678
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   679
function UpdateSimpleAward(oldAward, value, threshold)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   680
	local awarded = false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   681
	local newAward
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   682
	if oldAward == nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   683
		if threshold == nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   684
			awarded = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   685
		elseif value > threshold then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   686
			awarded = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   687
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   688
	elseif value > oldAward.value then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   689
		if threshold == nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   690
			awarded = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   691
		elseif value > threshold then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   692
			awarded = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   693
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   694
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   695
	if awarded then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   696
		newAward = {
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   697
			hogName = GetHogName(CurrentHedgehog),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   698
			teamName = GetHogTeamName(CurrentHedgehog),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   699
			value = value
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   700
		}
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   701
	else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   702
		newAward = oldAward
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   703
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   704
	return newAward
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   705
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   706
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   707
function CommentOnScore()
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   708
	local teamStats = {}
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   709
	for i = 0,(TeamsCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   710
		sdScore[i] = teamScore[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   711
		sdKills[i] = teamCircsKilled[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   712
		sdName[i] = teamNameArr[i]
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   713
		table.insert(teamStats, {score = teamScore[i], kills = teamCircsKilled[i], name = teamNameArr[i]})
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   714
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   715
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   716
	local scorecomp = function (v1, v2)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   717
		if v1.score > v2.score then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   718
			return true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   719
		else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   720
			return false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   721
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   722
	end
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   723
	table.sort(teamStats, scorecomp)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   724
	local teamComment = {}
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   725
	for i = TeamsCount,1,-1 do
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   726
		local comment
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   727
		if teamStats[i].name ~= " " then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   728
			local comment = teamStats[i].name .. " |" ..
12059
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
   729
			string.format(loc("Score: %d"), teamStats[i].score) .. "|" ..
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
   730
			string.format(loc("Kills: %d"), teamStats[i].kills)
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
   731
			if i < TeamsCount then	
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
   732
				comment = comment .. "| |"
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
   733
			end
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   734
			table.insert(teamComment, comment)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   735
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   736
			SendStat(siClanHealth, tostring(teamStats[i].score), teamStats[i].name)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   737
		else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   738
			comment = "|"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   739
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   740
		table.insert(teamComment, comment)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   741
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   742
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   743
	local entireC = ""
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   744
	for i = TeamsCount,1,-1 do
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   745
		entireC = entireC .. teamComment[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   746
	end
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   747
	local statusText, scoreText
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   748
	if roundNumber >= roundLimit then
13019
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12426
diff changeset
   749
		statusText = loc("Game over!")
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12426
diff changeset
   750
		scoreText = loc("Final team scores:")
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   751
	else
13019
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12426
diff changeset
   752
		AddCaption(string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit, 0xFFFFFFFF))
880662cf41ee Add team score next to team bars for CTF_Blizard, Control, CTF, Mutant, Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 12426
diff changeset
   753
		return
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   754
	end
12334
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   755
	local displayTime
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   756
	if roundNumber >= roundLimit then
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   757
		displayTime = 20000
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   758
	else
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   759
		displayTime = 1
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   760
	end
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   761
	ShowMission(	loc("Space Invasion"),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   762
			statusText,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   763
			string.format(loc("Rounds complete: %d/%d"), roundNumber, roundLimit) .. "| " .. "|" ..
12334
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   764
			scoreText .. " |" ..entireC, 4, displayTime)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   765
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   766
	if roundNumber >= roundLimit then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   767
		local winnerTeam = teamStats[1].name
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   768
		for i = 0, (numhhs-1) do
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   769
			if GetHogTeamName(hhs[i]) == winnerTeam then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   770
				SetState(hhs[i], bor(GetState(hhs[i]), gstWinner))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   771
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   772
		end
12424
b9cc405541c1 Fix various loc() syntax errors in scripts
Wuzzy <almikes@aol.com>
parents: 12334
diff changeset
   773
		AddCaption(string.format(loc("%s wins!"), winnerTeam))
b9cc405541c1 Fix various loc() syntax errors in scripts
Wuzzy <almikes@aol.com>
parents: 12334
diff changeset
   774
		SendStat(siGameResult, string.format(loc("%s wins!"), winnerTeam))
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   775
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   776
		for i = 1, TeamsCount do
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   777
			SendStat(siPointType, loc("points"))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   778
			SendStat(siPlayerKills, tostring(teamStats[i].score), teamStats[i].name)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   779
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   780
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   781
		local killscomp = function (v1, v2)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   782
			if v1.kills > v2.kills then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   783
				return true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   784
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   785
				return false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   786
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   787
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   788
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   789
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   790
--[[ Award some awards (just for fun, its for the stats screen only
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   791
and has no effect on the score or game outcome. ]]
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   792
		local awardsGiven = 0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   793
	
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   794
		if awardTotalKills >= 30 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   795
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   796
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   797
				string.format(loc("%d invaders have been destroyed in this game."), awardTotalKills))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   798
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   799
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   800
		table.sort(teamStats, killscomp)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   801
		local bestKills = teamStats[1].kills
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   802
		if bestKills > 10 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   803
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   804
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   805
			if bestKills >= 50 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   806
				text = loc("BOOM! BOOM! BOOM! %s are the masters of destruction with %d destroyed invaders.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   807
			elseif bestKills >= 25 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   808
				text = loc("BOOM! %s really didn't like the invaders, so they decided to destroy as much as %d of them.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   809
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   810
				text = loc("Boom! %s has destroyed %d invaders.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   811
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   812
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   813
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   814
	                teamStats[1].name, teamStats[1].kills))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   815
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   816
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   817
		if awardRoundKills ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   818
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   819
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   820
			if awardRoundKills.value >= 33 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   821
				text = loc("%s (%s) has been invited to join the Planetary Association of the Hedgehogs, it destroyed a staggering %d invaders in just one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   822
			elseif awardRoundKills.value >= 22 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   823
				if awardRoundKills.hogName == "Rambo" then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   824
					text = loc("The hardships of the war turned %s (%s) into a killing machine: %d invaders destroyed in one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   825
				else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   826
					text = loc("%s (%s) is Rambo in a hedgehog costume! He destroyed %d invaders in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   827
				end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   828
			elseif awardRoundKills.value >= 11 then
12424
b9cc405541c1 Fix various loc() syntax errors in scripts
Wuzzy <almikes@aol.com>
parents: 12334
diff changeset
   829
				text = loc("%s (%s) is addicted to killing: %d invaders destroyed in one round.")
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   830
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   831
				text = loc("%s (%s) destroyed %d invaders in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   832
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   833
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   834
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   835
			awardRoundKills.hogName, awardRoundKills.teamName, awardRoundKills.value))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   836
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   837
		if awardRoundScore ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   838
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   839
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   840
			if awardRoundScore.value >= 300 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   841
				text = loc("%s (%s) was undoubtedly the very best professional tumbler in this game: %d points in one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   842
			elseif awardRoundScore.value >= 250 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   843
				text = loc("%s (%s) struck like a meteor: %d points in only one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   844
			elseif awardRoundScore.value >= 200 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   845
				text = loc("%s (%s) is good at this: %d points in only one round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   846
			elseif awardRoundScore.value >= 150 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   847
				text = loc("%s (%s) tumbles like no other: %d points in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   848
			elseif awardRoundScore.value >= 100 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   849
				text = loc("%s (%s) is a tumbleweed: %d points in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   850
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   851
				text = loc("%s (%s) was the best baby tumbler: %d points in one round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   852
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   853
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   854
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   855
			awardRoundScore.hogName, awardRoundScore.teamName, awardRoundScore.value))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   856
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   857
		if awardAccuracy ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   858
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   859
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   860
			if awardAccuracy.value >= 20 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   861
				text = loc("The Society of Perfectionists greets %s (%s): No misses and %d hits in its best round.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   862
			elseif awardAccuracy.value >= 10 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   863
				text = loc("%s (%s) is a hardened hunter: No misses and %d hits in its best round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   864
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   865
				text = loc("%s (%s) shot %d invaders and never missed in the best round!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   866
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   867
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   868
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   869
			awardAccuracy.hogName, awardAccuracy.teamName, awardAccuracy.value))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   870
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   871
		if awardCombo ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   872
			awardsGiven = awardsGiven + 1
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   873
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   874
			if awardCombo.value >= 11 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   875
				text = loc("%s (%s) was lightning-fast! Longest combo of %d, absolutely insane!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   876
			elseif awardCombo.value >= 8 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   877
				text = loc("%s (%s) gave short shrift to the invaders: Longest combo of %d!")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   878
			else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   879
				text = loc("%s (%s) was on fire: Longest combo of %d.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   880
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   881
			SendStat(siCustomAchievement,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   882
			string.format(text,
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   883
			awardCombo.hogName, awardCombo.teamName, awardCombo.value))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   884
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   885
		if awardsGiven == 0 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   886
			local text
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   887
			local r = math.random(1,4)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   888
			if r == 1 then text = loc("This game wasn’t really exciting.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   889
			elseif r == 2 then text = loc("Did I miss something?")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   890
			elseif r == 3 then text = loc("Nothing of interest has happened.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   891
			elseif r == 4 then text = loc("There are no snarky comments this time.")
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   892
			end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   893
		
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   894
			SendStat(siCustomAchievement, text)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   895
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   896
	end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   897
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   898
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   899
function onNewRound()
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   900
	roundNumber = roundNumber + 1
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   901
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   902
	CommentOnScore()
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   903
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   904
	-- end game if its at round limit
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   905
	if roundNumber >= roundLimit then
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   906
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   907
		for i = 0, (TeamsCount-1) do
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   908
			if teamScore[i] > bestScore then
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   909
				bestScore = teamScore[i]
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   910
				bestClan = teamClan[i]
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   911
			end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   912
		end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   913
12334
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   914
		-- Kill off all the losers
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   915
		for i = 0, (numhhs-1) do
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   916
			if GetHogClan(hhs[i]) ~= bestClan then
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   917
				SetEffect(hhs[i], heResurrectable, 0)
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   918
				SetHealth(hhs[i],0)
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   919
			end
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   920
		end
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   921
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
   922
		-- Game over
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   923
		gameOver = true
12287
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12063
diff changeset
   924
		EndTurn(true)
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   925
		TimeLeft = 0
12426
9f3387907e06 Fix even more bad/broken loc()'s in scripts (hopefully the last one)
Wuzzy <almikes@aol.com>
parents: 12424
diff changeset
   926
		SendStat(siGraphTitle, loc("Score graph"))
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   927
	end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   928
end
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   929
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   930
-- gaudy racer
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   931
function CheckForNewRound()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   932
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   933
	if GetHogClan(CurrentHedgehog) == firstClan then
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
   934
		onNewRound()
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   935
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   936
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   937
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   938
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   939
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   940
----------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   941
-- some tumbler/space invaders methods
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   942
----------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   943
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   944
function isATrackedGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   945
	if 	(GetGearType(gear) == gtExplosives) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   946
		(GetGearType(gear) == gtShell) or
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
   947
		(GetGearType(gear) == gtFlame) or
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   948
		(GetGearType(gear) == gtBall)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   949
	then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   950
		return(true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   951
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   952
		return(false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   953
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   954
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   955
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   956
function setNewGearValues(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   957
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
   958
	local lfs
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   959
	if GetGearType(gear) == gtShell then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   960
		lfs = 50	-- roughly 5 seconds
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   961
		shellID = shellID + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   962
		setGearValue(gear,"ID",shellID)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   963
		--nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this shell")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   964
	elseif GetGearType(gear) == gtBall then
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   965
		lfs = 5 --70	-- 7s
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   966
	elseif GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   967
		lfs = 15	-- 1.5s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   968
		explosivesID = explosivesID + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   969
		setGearValue(gear,"ID",explosivesID)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   970
		setGearValue(gear,"XP", GetX(gear))
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
   971
		setGearValue(gear,"YP", GetY(gear))
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   972
		--nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this explosives")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   973
	elseif GetGearType(gear) == gtFlame then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   974
		lfs = 5	-- 0.5s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   975
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   976
		lfs = 100
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   977
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   978
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   979
	setGearValue(gear,"lifespan",lfs)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   980
	--WriteLnToConsole("I also set its lifespan to " .. lfs)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   981
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   982
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   983
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   984
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   985
function HandleLifeSpan(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   986
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   987
	decreaseGearValue(gear,"lifespan")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   988
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   989
	--WriteLnToConsole("Just decreased the lifespan of a gear to " .. getGearValue(gear,"lifespan"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   990
	--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   991
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   992
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   993
	if getGearValue(gear,"lifespan") == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   994
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   995
		if GetGearType(gear) == gtShell then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   996
			AddVisualGear(GetX(gear), GetY(gear), vgtExplosion, 0, false)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
   997
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   998
			WriteLnToConsole("about to delete a shell due to lifespan == 0")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
   999
		elseif GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1000
			AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1001
			PlaySound(sndExplosion)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1002
		elseif GetGearType(gear) == gtFlame then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1003
			AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1004
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1005
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1006
		DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1007
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1008
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1009
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1010
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1011
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1012
-- this prevents ugly barrel clipping sounds when a barrel flies off map limits
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1013
function DeleteFarFlungBarrel(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1014
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1015
	if GetGearType(gear) == gtExplosives then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1016
		if 	(GetX(gear) < -1900) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1017
			(GetX(gear) > 6200) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1018
			(GetY(gear) < -3400)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1019
		then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1020
			AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1021
			DeleteGear(gear)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1022
			--WriteLnToConsole("I'm setting barrel ID " .. getGearValue(gear,"ID") .. " to 0 health because it's been flung too close to the map edges. at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1023
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1024
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1025
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1026
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1027
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1028
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1029
-----------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1030
--EVENT HANDLERS
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1031
-- action keys
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1032
-----------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1033
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1034
function ChangeWeapon()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1035
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1036
	wepIndex = wepIndex + 1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1037
	if wepIndex == wepCount then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1038
		wepIndex = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1039
	end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1040
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1041
--[[
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1042
	NOTE: Don’t show selected weapon as long we only have one. Remove this comment and activate this code
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1043
	again as soon as at least one other weapon appears.
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1044
	AddCaption(wep[wepIndex] .. " " .. loc("selected!"), wepCol[wepIndex],capgrpAmmoinfo )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1045
	AddCaption(wepAmmo[wepIndex] .. " " .. loc("shots remaining."), wepCol[wepIndex],capgrpMessage2)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1046
]]
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1047
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1048
end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1049
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1050
-- derp tumbler
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1051
function onPrecise()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1052
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1053
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and (wepAmmo[wepIndex] > 0) then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1054
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1055
		wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1056
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1057
		if wep[wepIndex] == loc("Barrel Launcher") then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1058
			shotsFired = shotsFired +1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1059
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1060
			local morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1061
			CopyPV(CurrentHedgehog, morte) -- new addition
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1062
			local x,y = GetGearVelocity(morte)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1063
			x = x*2
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1064
			y = y*2
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1065
			SetGearVelocity(morte, x, y)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1066
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1067
			if wepAmmo[wepIndex] == 0 then
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1068
				PlaySound(sndSuddenDeath)
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1069
				AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1070
			else
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1071
				PlaySound(sndThrowRelease)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1072
			end
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1073
			DrawTag(TAG_BARRELS)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1074
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1075
		elseif wep[wepIndex] == loc("Mine Deployer") then
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1076
			local morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtAirBomb, 0, 0, 0, 0)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1077
			SetTimer(morte, 1000)
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1078
			DrawTag(TAG_BARRELS)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1079
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1080
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1081
	elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1082
		PlaySound(sndDenied)
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1083
		AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1084
	end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1085
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1086
	preciseOn = true
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1087
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1088
end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1089
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1090
function onPreciseUp()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1091
	preciseOn = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1092
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1093
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1094
function onLJump()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1095
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1096
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1097
		shieldMiser = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1098
		if shieldHealth == 80 then
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1099
			AddCaption(loc("Shield depleted"),0xff0000ff,capgrpMessage)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1100
			PlaySound(sndDenied)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1101
		elseif (beam == false) and (shieldHealth > 80) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1102
			beam = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1103
			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 40, 255, 1, 10, 0, 300, 1, 0xa800ffff)
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1104
			AddCaption( string.format(loc("Shield ON: %d power remaining"), shieldHealth - 80))
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1105
			PlaySound(sndInvulnerable)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1106
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1107
			beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1108
			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), 0, 0, 1, 10, 0, 0, 0, 0xa800ffff)
12426
9f3387907e06 Fix even more bad/broken loc()'s in scripts (hopefully the last one)
Wuzzy <almikes@aol.com>
parents: 12424
diff changeset
  1109
			AddCaption( string.format(loc("Shield OFF: %d power remaining"), shieldHealth - 80))
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1110
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1111
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1112
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1113
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1114
function onHJump()
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1115
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1116
	if (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) and
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1117
	(rAlpha == 255) then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1118
		if radShotsLeft > 0 then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1119
			rPingTimer = 0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1120
			rAlpha = 0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1121
			radShotsLeft = radShotsLeft -1
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1122
			AddCaption(string.format(loc("Pings left: %d"), radShotsLeft),GetClanColor(GetHogClan(CurrentHedgehog)),capgrpMessage)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1123
			-- Play sonar sound
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1124
			PlaySound(sndJetpackLaunch)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1125
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1126
		else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1127
			AddCaption(loc("No radar pings left!"),0xFF0000FF,capgrpMessage)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1128
			PlaySound(sndDenied)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1129
		end
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1130
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1131
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1132
end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1133
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1134
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1135
-- movement keys
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1136
-----------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1137
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1138
function onLeft()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1139
	leftOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1140
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1141
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1142
function onRight()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1143
	rightOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1144
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1145
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1146
function onUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1147
	upOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1148
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1149
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1150
function onDown()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1151
	downOn = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1152
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1153
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1154
function onDownUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1155
	downOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1156
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1157
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1158
function onUpUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1159
	upOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1160
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1161
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1162
function onLeftUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1163
	leftOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1164
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1165
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1166
function onRightUp()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1167
	rightOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1168
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1169
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1170
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1171
-- other event handlers
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1172
--------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1173
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1174
function onParameters()
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1175
	parseParams()
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1176
	if params["rounds"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1177
		roundLimit = math.floor(tonumber(params["rounds"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1178
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1179
	if params["barrels"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1180
		startBarrels = math.floor(tonumber(params["barrels"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1181
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1182
	if params["pings"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1183
		startRadShots = math.floor(tonumber(params["pings"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1184
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1185
	if params["shield"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1186
		startShield = math.floor(tonumber(params["shield"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1187
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1188
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1189
	if params["barrelbonus"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1190
		barrelBonus = math.floor(tonumber(params["barrelbonus"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1191
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1192
	if params["shieldbonus"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1193
		shieldBonus = math.floor(tonumber(params["shieldbonus"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1194
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1195
	if params["timebonus"] ~= nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1196
		timeBonus = math.floor(tonumber(params["timebonus"]))
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1197
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1198
	if params["forcetheme"] == "false" then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1199
		forceTheme = false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1200
	else
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1201
		forceTheme = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1202
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1203
end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1204
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1205
function onGameInit()
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1206
	--[[ Only GameFlags which are listed here are allowed. All other game flags will be discarded.
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1207
	Nonetheless this allows for some configuration in the game scheme ]]
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1208
	local allowedFlags = 
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1209
		-- those flags are probably the most realistic one to use
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1210
		gfDisableGirders + gfRandomOrder +	-- highly recommended!
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1211
		gfDisableLandObjects + gfSolidLand + gfLowGravity +
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1212
		-- a bit unusual but may still be useful
13272
5984e8c6cbeb Add new game flag gfSwitchHog, enable hog switching at turn start
Wuzzy <Wuzzy2@mail.ru>
parents: 13028
diff changeset
  1213
		gfBottomBorder + gfDivideTeams +
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1214
		gfDisableWind + gfMoreWind + gfTagTeam +
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1215
		-- very unusual flags, they don’t affect gameplay really, they are mostly for funny graphical effects
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1216
		gfKing + 	-- King Mode doesn’t work like expected, since hedgehogs never really die here in this mode
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1217
		gfVampiric +	-- just for the grapical effects
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1218
		gfBorder 	-- technically possible, but not very fun to play
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1219
		-- any other flag is FORBIDDEN and will be disabled when it is on anyways!
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1220
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1221
	GameFlags = band(GameFlags, allowedFlags)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1222
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1223
	if forceTheme then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1224
		Theme = "EarthRise"
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1225
	end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1226
	CaseFreq = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1227
	HealthCaseProb = 0
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1228
	Delay = 1000
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1229
	SuddenDeathTurns = 50
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1230
	WaterRise = 0
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1231
	HealthDecrease = 0
12063
797d1236a56b Disable world edge in Space Invasion
Wuzzy <almikes@aol.com>
parents: 12062
diff changeset
  1232
	WorldEdge = weNone
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1233
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1234
	for i = 0, 4 do
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1235
		vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1236
	end
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1237
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1238
	HideTag(TAG_TIME)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1239
	HideTag(TAG_BARRELS)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1240
	HideTag(TAG_SHIELD)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1241
	HideTag(TAG_ROUND_SCORE)
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1242
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1243
	wep[0] = loc("Barrel Launcher")
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1244
	wep[1] = loc("Mine Deployer")
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1245
	wep[2] = loc("Flamer")
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1246
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1247
	wepCol[0] = 0x78818eff
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1248
	wepCol[1] = 0xa12a77ff
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1249
	wepCol[2] = 0xf49318ff
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1250
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1251
	wepCount = 3
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1252
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1253
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1254
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1255
function onGameStart()
12334
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1256
	SendGameResultOff()
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1257
	SendRankingStatsOff()
0bc8c5fcd08c Use the traditional winning sequence in Space Invasion again (killing off the losers)
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1258
	SendAchievementsStatsOff()
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1259
	SendHealthStatsOff()
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1260
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1261
	ShowMission	(
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1262
				loc("SPACE INVASION"),
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1263
				loc("A Hedgewars mini-game"),
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1264
12059
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
  1265
				loc("Fly into space to fight off the invaders with barrels!") .."|"..
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
  1266
				loc("Destroy invaders and collect bonuses to score points.") .. "|" ..
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
  1267
				loc("Get the highest score to win.") .. "|" ..
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
  1268
				" " .. "|" ..
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
  1269
				loc("Avoid bazookas, red and blue invaders.") .. "|" ..
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
  1270
				loc("Collect the green and purple invaders.") .. "|" ..
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
  1271
				loc("Use the shield to protect yourself from bazookas.") .. "|" ..
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1272
				" " .. "|" ..
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1273
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1274
				string.format(loc("Round Limit: %d"), roundLimit) .. "|" ..
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1275
				" " .. "|" ..
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1276
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1277
				loc("Movement: [Up], [Down], [Left], [Right]") .. "|" ..
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1278
				loc("Fire: [Precise]") .. "|" ..
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1279
				loc("Toggle Shield: [Long jump]") .. "|" ..
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1280
				loc("Radar Ping: [High jump]") .. "|" ..
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1281
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1282
				"", 4, 5000
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1283
				)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1284
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1285
	CreateMeSomeCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1286
	RebuildTeamInfo() -- control
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1287
	lastRound = TotalRounds
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1288
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1289
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1290
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1291
function onScreenResize()
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1292
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1293
	-- redraw Tags so that their screen locations are updated
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1294
	if (gameBegun == true) then
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1295
		DrawTag(TAG_ROUND_SCORE)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1296
		if (stopMovement == false) then
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1297
			DrawTag(TAG_BARRELS)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1298
			DrawTag(TAG_SHIELD)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1299
			if (tumbleStarted == true) then
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1300
				DrawTag(TAG_TIME)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1301
			end
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1302
		end
5825
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1303
	end
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1304
a6eab1b7c00d Scripting: Update screen dimensions on screen resize and introduce onScreenResize() event.
sheepluva
parents: 5629
diff changeset
  1305
end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1306
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1307
function onNewTurn()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1308
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1309
	radShotsLeft = startRadShots
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1310
	stopMovement = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1311
	tumbleStarted = false
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1312
	boosterOn = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1313
	beam = false
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1314
	shieldHealth = startShield + 80 -- 50 = 5 secs, roughly
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1315
	shockwaveHealth = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1316
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1317
	RK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1318
	GK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1319
	BK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1320
	OK = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1321
	SK = 0
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1322
	roundKills = 0
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1323
	roundScore = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1324
	shieldMiser = true
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1325
	fierceComp = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1326
	shotsFired = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1327
	shotsHit = 0
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1328
	sniperHits = 0
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1329
	pointBlankHits = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1330
	chainLength = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1331
	chainCounter = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1332
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1333
	tauntClanShots = 0
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1334
	tauntTimer = -1
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1335
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1336
	-------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1337
	-- gaudy racer
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1338
	-------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1339
	CheckForNewRound()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1340
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1341
	-- Handle Starting Stage of Game
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1342
	if (gameOver == false) and (gameBegun == false) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1343
		gameBegun = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1344
		roundNumber = 0 -- 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1345
		firstClan = GetHogClan(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1346
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1347
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1348
	if gameOver == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1349
		stopMovement = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1350
		tumbleStarted = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1351
		SetMyCircles(false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1352
	end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1353
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1354
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1355
	-------
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1356
	-- tumbler
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1357
	----
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1358
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1359
	wepAmmo[0] = startBarrels
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1360
	wepAmmo[1] = startRadShots
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1361
	wepAmmo[2] = 5000
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1362
	wepIndex = 2
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1363
	ChangeWeapon()
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1364
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1365
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1366
	HideTag(TAG_TIME)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1367
	if not gameOver then
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1368
		DrawTag(TAG_BARRELS)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1369
		DrawTag(TAG_SHIELD)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1370
		DrawTag(TAG_ROUND_SCORE)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1371
	else
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1372
		HideTag(TAG_BARRELS)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1373
		HideTag(TAG_SHIELD)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1374
		HideTag(TAG_ROUND_SCORE)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1375
	end
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1376
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1377
	---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1378
	---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1379
	--AddCaption("num g: " .. numGears() )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1380
	--WriteLnToConsole("onNewTurn, I just set a bunch of variables to their necessary states. This was done at:")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1381
	--WriteLnToConsole("The above occured at Game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1382
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1383
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1384
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1385
function ThingsToBeRunOnGears(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1386
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1387
	HandleLifeSpan(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1388
	DeleteFarFlungBarrel(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1389
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1390
	if circlesAreGo == true then
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1391
		CheckVarious(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1392
		ProjectileTrack(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1393
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1394
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1395
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1396
10670
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1397
function onGearWaterSkip(gear)
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1398
	if gear == CurrentHedgehog then
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1399
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1400
		for i = 0,(TeamsCount-1) do
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1401
			if teamClan[i] == GetHogClan(CurrentHedgehog) and (teamSurfer[i] == false) then
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1402
				teamSurfer[i] = true
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1403
				AddCaption(loc("Surfer! +15 points!"),0xffba00ff,capgrpVolume)
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1404
				AwardPoints(15)
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1405
			end
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1406
		end
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1407
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1408
	end
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
  1409
end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1410
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1411
function onGameTick()
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1412
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1413
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1414
	--WriteLnToConsole("Start of GameTick")
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1415
	luaGameTicks = luaGameTicks + 1 -- GameTime
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1416
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1417
	HandleCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1418
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1419
	timer100 = timer100 + 1
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1420
	if timer100 >= 100 then
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1421
		timer100 = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1422
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1423
		if beam == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1424
			shieldHealth = shieldHealth - 1
5629
c24d29a538af HUD for Space Invasion, minor bugfix
mikade
parents: 5334
diff changeset
  1425
			if shieldHealth < 80 then -- <= 80
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1426
				shieldHealth = 80
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1427
				beam = false
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1428
				AddCaption(loc("Shield depleted"),0xff0000ff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1429
				PlaySound(sndMineTick)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1430
				PlaySound(sndSwitchHog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1431
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1432
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1433
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1434
		if tauntTimer > 0 then
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1435
			tauntTimer = tauntTimer - 100
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1436
			if tauntTimer <= 0 and tumbleStarted and not stopMovement then
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1437
				PlaySound(tauntSound, tauntGear)
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1438
			end
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1439
		end
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1440
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1441
		--nw WriteLnToConsole("Starting ThingsToBeRunOnGears()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1442
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1443
		runOnGears(ThingsToBeRunOnGears)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1444
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1445
		--nw WriteLnToConsole("Finished ThingsToBeRunOnGears()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1446
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1447
		if circlesAreGo == true then
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1448
			CheckDistances()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1449
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1450
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1451
		-- white smoke trail as player falls from the sky
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1452
		if (TimeLeft <= 0) and (stopMovement == true) and (CurrentHedgehog ~= nil) then
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1453
			local j,k = GetGearVelocity(CurrentHedgehog)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1454
			if (j ~= 0) and (k ~= 0) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1455
				AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1456
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1457
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1458
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1459
		--nw WriteLnToConsole("Finished 100Timer")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1460
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1461
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1462
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1463
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1464
	-- start the player tumbling with a boom once their turn has actually begun
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1465
	if (tumbleStarted == false) and (gameOver == false) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1466
		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1467
			tumbleStarted = true
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  1468
			TimeLeft = (TurnTime/1000)
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1469
			fadeAlpha = 0
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1470
			rAlpha = 255
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1471
			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1472
			DrawTag(TAG_TIME)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1473
			DrawTag(TAG_BARRELS)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1474
			DrawTag(TAG_SHIELD)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1475
			DrawTag(TAG_ROUND_SCORE)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1476
			SetMyCircles(true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1477
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1478
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1479
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1480
	--WriteLnToConsole("Finished initial check")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1481
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1482
	if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1483
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1484
		-- Calculate and display turn time
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1485
		TimeLeftCounter = TimeLeftCounter + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1486
		if TimeLeftCounter == 1000 then
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1487
			TimeLeftCounter = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1488
			TimeLeft = TimeLeft - 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1489
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1490
			if TimeLeft >= 0 then
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1491
				DrawTag(TAG_TIME)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1492
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1493
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1494
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1495
12057
1ee28630d424 Space Invasion: Play countdown sounds
Wuzzy <almikes@aol.com>
parents: 12056
diff changeset
  1496
		if (TimeLeftCounter % 1000) == 0 then
1ee28630d424 Space Invasion: Play countdown sounds
Wuzzy <almikes@aol.com>
parents: 12056
diff changeset
  1497
			if TimeLeft == 5 then
1ee28630d424 Space Invasion: Play countdown sounds
Wuzzy <almikes@aol.com>
parents: 12056
diff changeset
  1498
				PlaySound(sndHurry, CurrentHedgehog)
1ee28630d424 Space Invasion: Play countdown sounds
Wuzzy <almikes@aol.com>
parents: 12056
diff changeset
  1499
			elseif TimeLeft <= 4 and TimeLeft >= 1 then
1ee28630d424 Space Invasion: Play countdown sounds
Wuzzy <almikes@aol.com>
parents: 12056
diff changeset
  1500
				PlaySound(_G["sndCountdown"..TimeLeft])
1ee28630d424 Space Invasion: Play countdown sounds
Wuzzy <almikes@aol.com>
parents: 12056
diff changeset
  1501
			end
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1502
		end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1503
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1504
		--WriteLnToConsole("Finished timeleft calculations")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1505
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1506
		-------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1507
		-- Player has run out of luck (out of time or hit by gtShell)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1508
		-------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1509
		-- checks in FloatyThings
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1510
		if PlayerIsFine() == false then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1511
			TimeLeft = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1512
		end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1513
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1514
		--WriteLnToConsole("successfully checked playerIsFine")
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1515
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1516
		if (TimeLeft == 0) then
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1517
			if PlayerIsFine() then AddCaption(loc("Time's up!")) end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1518
			if (stopMovement == false) then	--time to stop the player
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1519
				stopMovement = true
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1520
				boosterOn = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1521
				beam = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1522
				upOn = false
12058
1ebda99fd34a Remove unused flamer code from Space Invasion
Wuzzy <almikes@aol.com>
parents: 12057
diff changeset
  1523
				downOn = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1524
				leftOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1525
				rightOn = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1526
				SetMyCircles(false)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1527
				rAlpha = 255
12061
5beaf30c1cef Turn invaders white in Space Invasion when round is over
Wuzzy <almikes@aol.com>
parents: 12059
diff changeset
  1528
				FailGraphics()
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1529
				--nw WriteLnToConsole("Player is out of luck")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1530
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1531
				if shieldMiser == true then
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1532
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1533
					local p = (roundKills*3.5) - ((roundKills*3.5)%1) + 2
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1534
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1535
					AddCaption(string.format(loc("Shield Miser! +%d points!"), p),0xffba00ff,capgrpAmmoinfo)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1536
					AwardPoints(p)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1537
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1538
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1539
				local accuracy = (shotsHit / shotsFired) * 100
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1540
				if (accuracy >= 80) and (shotsFired > 4) then
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1541
					AddCaption(loc("Accuracy Bonus! +15 points"),0xffba00ff,capgrpVolume)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1542
					AwardPoints(15)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1543
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1544
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1545
					-- special award for no misses
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1546
					local award = false
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1547
					if awardAccuracy == nil then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1548
						if (shotsHit >= shotsFired) then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1549
							award = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1550
						end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1551
					elseif (shotsHit == shotsFired) and shotsHit > awardAccuracy.value then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1552
						award = true
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1553
					end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1554
					if award then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1555
						awardAccuracy = {
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1556
							hogName = GetHogName(CurrentHedgehog),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1557
							teamName = GetHogTeamName(CurrentHedgehog),
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1558
							value = shotsHit, 
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1559
						}
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1560
					end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1561
		
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1562
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1563
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1564
				-- other awards
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1565
				awardRoundScore = UpdateSimpleAward(awardRoundScore, roundScore, 50)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1566
				awardRoundKills = UpdateSimpleAward(awardRoundKills, roundKills, 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1567
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1568
				HideTag(TAG_TIME)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1569
				HideTag(TAG_BARRELS)
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1570
				HideTag(TAG_SHIELD)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1571
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1572
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1573
		else -- remove this if you want tumbler to fall slowly on death
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1574
		-------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1575
		-- Player is still in luck
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1576
		-------------------------------
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1577
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1578
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1579
			--WriteLnToConsole("about to do chainCounter checks")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1580
			if chainCounter > 0 then
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1581
				chainCounter = chainCounter -1
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1582
				if chainCounter == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1583
					chainLength = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1584
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1585
			end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5825
diff changeset
  1586
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1587
			-- handle movement based on IO
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1588
			moveTimer = moveTimer + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1589
			if moveTimer == 100 then -- 100
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1590
				--nw WriteLnToConsole("Start of Player MoveTimer")
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1591
				moveTimer = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1592
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1593
				---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1594
				-- new trail code
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1595
				---------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1596
				-- the trail lets you know you have 5s left to pilot, akin to birdy feathers
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1597
				if (TimeLeft <= 5) and (TimeLeft > 0) then							--vgtSmoke
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1598
					local tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, true)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1599
					SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(CurrentHedgehog)) )
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1600
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1601
				--------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1602
				--------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1603
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1604
				local dx, dy = GetGearVelocity(CurrentHedgehog)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1605
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1606
				--WriteLnToConsole("I just got the velocity of currenthedgehog. It is dx: " .. dx .. "; dy: " .. dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1607
				--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1608
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1609
				local dxlimit, dylimit
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1610
				if boosterOn == true then
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1611
					local tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtDust, 0, false)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1612
					SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, 1, nil, GetClanColor(GetHogClan(CurrentHedgehog)) )
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1613
					dxlimit = 0.8*fMod
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1614
					dylimit = 0.8*fMod
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1615
				else
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1616
					dxlimit = 0.4*fMod
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1617
					dylimit = 0.4*fMod
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1618
				end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1619
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1620
				if dx > dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1621
					dx = dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1622
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1623
				if dy > dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1624
					dy = dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1625
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1626
				if dx < -dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1627
					dx = -dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1628
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1629
				if dy < -dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1630
					dy = -dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1631
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1632
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1633
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1634
				if leftOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1635
					dx = dx - 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1636
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1637
				if rightOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1638
					dx = dx + 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1639
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1640
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1641
				if upOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1642
					dy = dy - 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1643
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1644
				if downOn == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1645
					dy = dy + 0.1*fMod
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1646
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1647
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1648
				SetGearVelocity(CurrentHedgehog, dx, dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1649
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1650
				--WriteLnToConsole("I just SET the velocity of currenthedgehog. It is now dx: " .. dx .. "; dy: " .. dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1651
				--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1652
				--nw WriteLnToConsole("End of Player MoveTimer")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1653
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1654
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1655
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1656
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1657
		end -- new end I put here to check if he's still alive or not
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1658
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1659
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1660
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1661
	--WriteLnToConsole("End of GameTick")
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1662
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1663
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1664
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1665
function onGearDamage(gear, damage)
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1666
	if GetGearType(gear) == gtHedgehog and damage >= 60 then
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1667
		if GetHogClan(gear) ~= GetHogClan(CurrentHedgehog) then
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1668
			if (fierceComp == false) then
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1669
				fierceComp = true
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1670
				AddCaption(loc("Fierce Competition! +8 points!"),0xffba00ff,capgrpGameState)
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1671
				AwardPoints(8)
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1672
			end
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1673
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1674
			tauntTimer = 500
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1675
			tauntGear = gear
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1676
			local r = math.random(1, 2)
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1677
			if r == 1 then
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1678
				tauntSound = sndIllGetYou
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1679
			else
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1680
				tauntSound = sndJustYouWait
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1681
			end
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1682
		elseif gear ~= CurrentHedgehog then
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1683
			tauntTimer = 500
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1684
			tauntGear = gear
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1685
			if tauntClanShots == 0 then
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1686
				tauntSound = sndSameTeam
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1687
			else
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1688
				tauntSound = sndTraitor
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1689
			end
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1690
			tauntClanShots = tauntClanShots + 1
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1691
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1692
	end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1693
end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1694
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1695
function onGearResurrect(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1696
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1697
	-- did I fall into the water? well, that was a stupid thing to do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1698
	if gear == CurrentHedgehog then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1699
		TimeLeft = 0
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1700
		playerIsFine = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1701
		--WriteLnToConsole("Current hedgehog just drowned himself")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1702
		--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1703
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1704
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1705
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1706
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1707
function onGearAdd(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1708
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1709
	if isATrackedGear(gear) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1710
		trackGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1711
		setNewGearValues(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1712
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1713
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1714
	if GetGearType(gear) == gtHedgehog then
7838
5c2337f8dbb2 Issue #443 - change in syntax for effects
nemo
parents: 7717
diff changeset
  1715
		SetEffect(gear, heResurrectable, 1)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1716
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1717
		-----------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1718
		-- control
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1719
		hhs[numhhs] = gear
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1720
		numhhs = numhhs + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1721
		-----------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1722
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1723
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1724
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1725
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1726
function onGearDelete(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1727
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1728
	if isATrackedGear(gear) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1729
		trackDeletion(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1730
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1731
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1732
	if CurrentHedgehog ~= nil then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1733
		FollowGear(CurrentHedgehog)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1734
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1735
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1736
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1737
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1738
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1739
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1740
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1741
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1742
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1743
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1744
-- FLOATY THINGS
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1745
-- "I'll make this into a generic library and code properly
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1746
-- when I have more time and feel less lazy"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1747
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1748
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1749
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1750
------------------------------------------------------------
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1751
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1752
function DoHorribleThings(cUID)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1753
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1754
	-- work out the distance to the target
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1755
	local g1X, g1Y = GetGearPosition(CurrentHedgehog)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1756
	local g2X, g2Y = vCircX[cUID], vCircY[cUID]
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1757
	local q = g1X - g2X
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1758
	local w = g1Y - g2Y
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1759
	local r = math.sqrt( (q*q) + (w*w) )	--alternate
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1760
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1761
	local opp = w
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1762
	if opp < 0 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1763
		opp = opp*-1
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1764
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1765
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1766
	-- work out the angle (theta) to the target
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1767
	local t = math.deg ( math.asin(opp / r) )
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1768
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1769
	-- based on the radius of the radar, calculate what x/y displacement should be
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1770
	local NR = 150 -- radius at which to draw circs
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1771
	local NX = math.cos( math.rad(t) ) * NR
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1772
	local NY = math.sin( math.rad(t) ) * NR
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1773
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1774
	-- displace xy based on where this thing actually is
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1775
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1776
	if r < NR then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1777
		rCircX[cUID] = g2X
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1778
	elseif q > 0 then
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1779
		rCircX[cUID] = g1X - NX
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1780
	else
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1781
		rCircX[cUID] = g1X + NX
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1782
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1783
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1784
	if r < NR then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1785
		rCircY[cUID] = g2Y
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1786
	elseif w > 0 then
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1787
		rCircY[cUID] = g1Y - NY
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1788
	else
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1789
		rCircY[cUID] = g1Y + NY
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1790
	end
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  1791
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1792
end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1793
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1794
function PlayerIsFine()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1795
	return (playerIsFine)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1796
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1797
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1798
function GetDistFromXYtoXY(a, b, c, d)
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1799
	local q = a - c
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1800
	local w = b - d
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1801
	return ( (q*q) + (w*w) )
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1802
end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1803
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1804
function GetDistFromGearToGear(gear, gear2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1805
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1806
	local g1X, g1Y = GetGearPosition(gear)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1807
	local g2X, g2Y = GetGearPosition(gear2)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1808
	local q = g1X - g2X
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1809
	local w = g1Y - g2Y
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1810
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1811
	return ( (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1812
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1813
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1814
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1815
function GetDistFromGearToXY(gear, g2X, g2Y)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1816
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1817
	local g1X, g1Y = GetGearPosition(gear)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1818
	local q = g1X - g2X
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1819
	local w = g1Y - g2Y
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1820
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1821
	return ( (q*q) + (w*w) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1822
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1823
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1824
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1825
function CreateMeSomeCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1826
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1827
	for i = 0, 7 do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1828
		vCCount = vCCount +1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1829
		vCirc[i] = AddVisualGear(0,0,vgtCircle,0,true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1830
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1831
		rCirc[i] = AddVisualGear(0,0,vgtCircle,0,true)
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1832
		rCircX[i] = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1833
		rCircY[i] = 0
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1834
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1835
		vCircDX[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1836
		vCircDY[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1837
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1838
		vType[i] = "generic"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1839
		vCounter[i] = 0
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  1840
		vCounterLim[i] = 3000
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1841
		vCircScore[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1842
		vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1843
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  1844
		vCircMinA[i] = 80
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1845
		vCircMaxA[i] = 255
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  1846
		vCircType[i] = 1
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1847
		vCircPulse[i] = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1848
		vCircFuckAll[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1849
		vCircRadius[i] = 0
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  1850
		vCircWidth[i] = 3
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1851
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1852
		vCircRadMax[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1853
		vCircRadMin[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1854
		vCircRadDir[i] = -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1855
		vCircRadCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1856
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1857
		vCircX[i], vCircY[i] = 0,0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1858
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1859
		vCircCol[i] = 0xff00ffff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1860
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1861
		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], vCircMinA[i], vCircMaxA[i], vCircType[i], vCircPulse[i], vCircFuckAll[i], vCircRadius[i], vCircWidth[i], vCircCol[i])
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1862
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1863
		SetVisualGearValues(rCirc[i], 0, 0, 100, 255, 1, 10, 0, 40, 3, vCircCol[i])
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  1864
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1865
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1866
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1867
	pShield = AddVisualGear(0,0,vgtCircle,0,true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1868
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1869
	shockwave = AddVisualGear(0,0,vgtCircle,0,true)
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  1870
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1871
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1872
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1873
function IGotMeASafeXYValue(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1874
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1875
	local acceptibleDistance = 800
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1876
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1877
	vCircX[i] = GetRandom(5000)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1878
	vCircY[i] = GetRandom(2000)
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1879
	local dist = GetDistFromGearToXY(CurrentHedgehog, vCircX[i], vCircY[i])
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1880
	if dist > acceptibleDistance*acceptibleDistance then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1881
		return(true)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1882
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1883
		return(false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1884
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1885
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1886
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1887
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1888
function CircleDamaged(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1889
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1890
	local res = ""
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1891
	vCircHealth[i] = vCircHealth[i] -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1892
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1893
	if vCircHealth[i] <= 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1894
	-- circle is dead, do death effects/consequences
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1895
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1896
		vCircActive[i] = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1897
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1898
		if (vType[i] == "drone") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1899
			PlaySound(sndHellishImpact4)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1900
			TimeLeft = TimeLeft + timeBonus
12059
e8458438dcee More helpful Space Invasion description
Wuzzy <almikes@aol.com>
parents: 12058
diff changeset
  1901
			AddCaption(string.format(loc("Time extended! +%dsec"), timeBonus), 0xff0000ff,capgrpMessage )
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1902
			DrawTag(TAG_TIME)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1903
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1904
			local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1905
			SetHealth(morte, 0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1906
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1907
			RK = RK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1908
			if RK == 5 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1909
				RK = 0
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1910
				AddCaption(loc("Drone Hunter! +10 points!"),0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1911
				AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1912
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1913
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1914
		elseif (vType[i] == "ammo") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1915
			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1916
			PlaySound(sndExplosion)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1917
			PlaySound(sndShotgunReload)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1918
			wepAmmo[0] = wepAmmo[0] + barrelBonus
12424
b9cc405541c1 Fix various loc() syntax errors in scripts
Wuzzy <almikes@aol.com>
parents: 12334
diff changeset
  1919
			AddCaption(string.format(loc("+%d Ammo"), barrelBonus), 0x00ff00ff,capgrpMessage)
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1920
			DrawTag(TAG_BARRELS)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1921
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1922
			GK = GK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1923
			if GK == 3 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1924
				GK = 0
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1925
				AddCaption(loc("Ammo Maniac! +5 points!"),0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1926
				AwardPoints(5)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1927
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1928
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1929
		elseif (vType[i] == "bonus") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1930
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1931
			AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1932
			PlaySound(sndExplosion)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1933
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1934
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1935
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1936
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1937
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1938
			AddVisualGear(vCircX[i], vCircY[i], vgtFire, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1939
			AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, false)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1940
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1941
			PlaySound(sndVaporize)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1942
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1943
			shieldHealth = shieldHealth + shieldBonus
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1944
			AddCaption(string.format(loc("Shield boosted! +%d power"),shieldBonus), 0xa800ffff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1945
			if shieldHealth >= 250 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1946
				shieldHealth = 250
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1947
				AddCaption(loc("Shield is fully recharged!"),0xa800ffff,capgrpMessage)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1948
			end
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  1949
			DrawTag(TAG_SHIELD)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1950
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1951
			OK = OK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1952
			if OK == 3 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1953
				OK = 0
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1954
				AddCaption(loc("Shield Seeker! +10 points!"),0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1955
				AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1956
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1957
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1958
		elseif (vType[i] == "blueboss") then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1959
			PlaySound(sndHellishImpact3)
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1960
			tauntTimer = 300
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1961
			tauntSound = sndEnemyDown
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  1962
			tauntGear = CurrentHedgehog
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1963
			AddCaption(loc("Boss defeated! +30 points!"), 0x0050ffff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1964
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1965
			local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1966
			SetHealth(morte, 0)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1967
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1968
			BK = BK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1969
			if BK == 2 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1970
				BK = 0
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1971
				AddCaption(loc("Boss Slayer! +25 points!"),0xffba00ff,capgrpMessage2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1972
				AwardPoints(25)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1973
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1974
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1975
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1976
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1977
		AwardPoints(vCircScore[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1978
		AwardKills()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1979
		SetUpCircle(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1980
		res = "fatal"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1981
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1982
		chainCounter = 3000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1983
		chainLength = chainLength + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1984
		if chainLength > 1 then
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  1985
			AddCaption( string.format(loc("%d-Hit Combo! +%d points!"), chainLength, chainLength*2),0xffba00ff,capgrpAmmostate)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1986
			AwardPoints(chainLength*2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1987
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1988
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1989
		awardCombo = UpdateSimpleAward(awardCombo, chainLength, 5)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1990
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1991
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1992
	-- circle is merely damaged
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1993
	-- do damage effects/sounds
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1994
		AddVisualGear(vCircX[i], vCircY[i], vgtSteam, 0, false)
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  1995
		local r = math.random(1,4)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  1996
		PlaySound(_G["sndHellishImpact" .. tostring(r)])
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1997
		res = "non-fatal"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1998
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  1999
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2000
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2001
	return(res)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2002
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2003
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2004
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2005
function SetUpCircle(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2006
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2007
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2008
	local r = GetRandom(10)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2009
	-- 80% of spawning either red/green
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2010
	if r <= 7 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2011
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2012
		r = GetRandom(2)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2013
		if r == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2014
			vCircCol[i] = 0xff0000ff -- red
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2015
			vType[i] = "drone"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2016
			vCircRadMin[i] = 50	*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2017
			vCircRadMax[i] = 90	*5
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2018
			vCounterLim[i] = 3000
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2019
			vCircScore[i] = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2020
			vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2021
		elseif r == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2022
			vCircCol[i] = 0x00ff00ff -- green
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2023
			vType[i] = "ammo"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2024
			vCircRadMin[i] = 25	*7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2025
			vCircRadMax[i] = 30	*7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2026
			vCircScore[i] = 3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2027
			vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2028
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2029
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2030
	-- 20% chance of spawning boss or bonus
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2031
	else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2032
		r = GetRandom(5)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2033
		if r <= 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2034
			vCircCol[i] = 0x0050ffff -- sexy blue
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2035
			vType[i] = "blueboss"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2036
			vCircRadMin[i] = 100*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2037
			vCircRadMax[i] = 180*5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2038
			vCircWidth[i] = 1
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2039
			vCounterLim[i] = 2000
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2040
			vCircScore[i] = 30
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2041
			vCircHealth[i] = 3
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2042
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2043
			vCircCol[i] = 0xa800ffff -- purp
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2044
			vType[i] = "bonus"
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2045
			vCircRadMin[i] = 20 *7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2046
			vCircRadMax[i] = 40 *7
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2047
			vCircScore[i] = 5
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2048
			vCircHealth[i] = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2049
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2050
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2051
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2052
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2053
	-- regenerate circle xy if too close to player or until sanity limit kicks in
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2054
	local reN = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2055
	while (reN < 10) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2056
		if IGotMeASafeXYValue(i) == false then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2057
			reN = reN + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2058
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2059
			reN = 15
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2060
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2061
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2062
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2063
	vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2064
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2065
	SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], nil, nil, nil, nil, nil, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2066
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2067
	SetVisualGearValues(rCirc[i], 0, 0, nil, nil, nil, nil, nil, nil, nil, vCircCol[i]-0x000000ff)
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2068
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2069
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2070
	vCircActive[i] = true
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2071
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2072
	--nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2073
	--nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2074
	--nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2075
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2076
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2077
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2078
function SetMyCircles(s)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2079
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2080
	circlesAreGo = s
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2081
	playerIsFine = s
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2082
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2083
	if s == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2084
		--nw WriteLnToConsole("About to set up all circles, old values are here:")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2085
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2086
			--nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2087
			--nw WriteLnToConsole("CIRC " .. i .. ": dX: " .. vCircDX[i] .. "; dY: " .. vCircDY[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2088
			--nw WriteLnToConsole("CIRC " .. i .. ": RAD:" .. vCircRadius[i])
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2089
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2090
		--nw WriteLnToConsole("Old values given, new values to follow...")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2091
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2092
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2093
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2094
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2095
		if s == false then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2096
			--vCircCol[i] = 0xffffffff
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2097
			vCircActive[i] = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2098
		elseif s == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2099
			SetUpCircle(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2100
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2101
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2102
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2103
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2104
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2105
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2106
function WellHeAintGonnaJumpNoMore(x,y,explode,kamikaze)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2107
	if explode==true then
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2108
		AddVisualGear(x, y, vgtBigExplosion, 0, false)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2109
		PlaySound(sndExplosion)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2110
		local r = math.random(1,3)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2111
		PlaySound(_G["sndOoff"..r], CurrentHedgehog)
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2112
	end
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2113
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2114
	playerIsFine = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2115
	AddCaption(loc("GOTCHA!"))
12061
5beaf30c1cef Turn invaders white in Space Invasion when round is over
Wuzzy <almikes@aol.com>
parents: 12059
diff changeset
  2116
	FailGraphics()
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2117
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2118
	if not kamikaze then
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2119
		PlaySound(sndHellish)
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2120
	end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2121
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2122
	targetHit = true
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2123
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2124
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2125
12061
5beaf30c1cef Turn invaders white in Space Invasion when round is over
Wuzzy <almikes@aol.com>
parents: 12059
diff changeset
  2126
-- Turn all circles white to indicate they can't be hit anymore
5beaf30c1cef Turn invaders white in Space Invasion when round is over
Wuzzy <almikes@aol.com>
parents: 12059
diff changeset
  2127
function FailGraphics()
5beaf30c1cef Turn invaders white in Space Invasion when round is over
Wuzzy <almikes@aol.com>
parents: 12059
diff changeset
  2128
	for i = 0,(vCCount-1) do
5beaf30c1cef Turn invaders white in Space Invasion when round is over
Wuzzy <almikes@aol.com>
parents: 12059
diff changeset
  2129
		vCircCol[i] = 0xffffffff
5beaf30c1cef Turn invaders white in Space Invasion when round is over
Wuzzy <almikes@aol.com>
parents: 12059
diff changeset
  2130
	end
5beaf30c1cef Turn invaders white in Space Invasion when round is over
Wuzzy <almikes@aol.com>
parents: 12059
diff changeset
  2131
end
5beaf30c1cef Turn invaders white in Space Invasion when round is over
Wuzzy <almikes@aol.com>
parents: 12059
diff changeset
  2132
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2133
--- collision detection for weapons fire
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2134
function CheckVarious(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2135
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2136
	targetHit = false
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2137
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2138
	-- if circle is hit by player fire
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2139
	if (GetGearType(gear) == gtExplosives) then
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2140
		local circsHit = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2141
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2142
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2143
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2144
			--nw WriteLnToConsole("Is it neccessary to check for collision with circ " .. i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2145
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2146
			--nw WriteLnToConsole("YES. about to calc distance between gtExplosives and circ " .. i)
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2147
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2148
			local dist = GetDistFromGearToXY(gear, vCircX[i], vCircY[i])
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2149
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2150
			-- calculate my real radius if I am an aura
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2151
			local NR
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2152
			if vCircType[i] == 0 then
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2153
				NR = vCircRadius[i]
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2154
			else
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2155
				NR = (48/100*vCircRadius[i])/2
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2156
			end
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2157
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2158
			if dist <= NR*NR then
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2159
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2160
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2161
				--nw WriteLnToConsole("Collision confirmed. The gtExplosives is within the circ radius!")
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2162
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2163
				dist = (GetDistFromXYtoXY(vCircX[i], vCircY[i], getGearValue(gear,"XP"), getGearValue(gear,"YP")) - (NR*NR))
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2164
				if dist >= 1000000 then
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2165
					sniperHits = sniperHits +1
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  2166
					AddCaption(loc("Sniper! +8 points!"),0xffba00ff,capgrpGameState)
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2167
					AwardPoints(8)
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2168
					if sniperHits == 3 then
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2169
						sniperHits = 0
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  2170
						AddCaption(loc("They Call Me Bullseye! +16 points!"),0xffba00ff,capgrpGameState)
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2171
						AwardPoints(16)
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2172
					end
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2173
				elseif dist <= 6000 then
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2174
					pointBlankHits = pointBlankHits +1
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2175
					if pointBlankHits == 3 then
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2176
						pointBlankHits = 0
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  2177
						AddCaption(loc("Point Blank Combo! +5 points!"),0xffba00ff,capgrpGameState)
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2178
						AwardPoints(5)
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2179
					end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2180
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2181
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2182
				AddVisualGear(GetX(gear), GetY(gear), vgtBigExplosion, 0, false)
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2183
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2184
				targetHit = true
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2185
				--WriteLnToConsole("set " .. "Exp ID: " .. getGearValue(gear,"ID") .. " health to 0")
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2186
				--WriteLnToConsole("targetHit set to true, explosive is at distance " .. dist .. "(within range " .. NR*NR.. ") of circ" )
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2187
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2188
				CircleDamaged(i)
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2189
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2190
				circsHit = circsHit + 1
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2191
				if circsHit > 1 then
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  2192
					AddCaption(loc("Multi-shot! +15 points!"),0xffba00ff,capgrpAmmostate)
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2193
					AwardPoints(15)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2194
						circsHit = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2195
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2196
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2197
				shotsHit = shotsHit + 1
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2198
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2199
			end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2200
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2201
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2202
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2203
	-- if player is hit by circle bazooka
13448
93ba1826b8c2 Fix rare Lua error message spam in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13272
diff changeset
  2204
	elseif (GetGearType(gear) == gtShell) and (CurrentHedgehog ~= nil) then
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2205
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2206
		local dist = GetDistFromGearToGear(gear, CurrentHedgehog)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2207
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2208
		if beam == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2209
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2210
			if dist < 3000 then
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2211
				local tempE = AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2212
				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xff00ffff )
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2213
				PlaySound(sndVaporize)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2214
				DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2215
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2216
				SK = SK + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2217
				if SK == 5 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2218
					SK = 0
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  2219
					AddCaption(loc("Shield Master! +10 points!"),0xffba00ff,capgrpAmmoinfo)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2220
					AwardPoints(10)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2221
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2222
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2223
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2224
		elseif dist < 1600 then
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2225
			WellHeAintGonnaJumpNoMore(GetX(gear), GetY(gear), true)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2226
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2227
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2228
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2229
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2230
	if targetHit == true then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2231
			--nw WriteLnToConsole("about to delete something due to targetHit being set to true earlier")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2232
			DeleteGear(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2233
			--nw WriteLnToConsole("there, I deleted it")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2234
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2235
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2236
	--nw WriteLnToConsole("End of CheckVarious()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2237
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2238
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2239
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2240
-- collision detection for player entering a circle
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2241
function CheckDistances()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2242
13448
93ba1826b8c2 Fix rare Lua error message spam in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13272
diff changeset
  2243
	if not CurrentHedgehog then
93ba1826b8c2 Fix rare Lua error message spam in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13272
diff changeset
  2244
		return
93ba1826b8c2 Fix rare Lua error message spam in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13272
diff changeset
  2245
	end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2246
	--nw WriteLnToConsole("Start of CheckDistances()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2247
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2248
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2249
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2250
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2251
		--nw WriteLnToConsole("Attempting to calculate dist of circ " .. i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2252
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2253
		local g1X, g1Y = GetGearPosition(CurrentHedgehog)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2254
		local g2X, g2Y = vCircX[i], vCircY[i]
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2255
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2256
		g1X = g1X - g2X
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2257
		g1Y = g1Y - g2Y
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2258
		local dist = (g1X*g1X) + (g1Y*g1Y)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2259
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2260
		--nw WriteLnToConsole("Calcs done. Dist to CurrentHedgehog is " .. dist)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2261
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2262
		-- calculate my real radius if I am an aura
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2263
		local NR
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2264
		if vCircType[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2265
			NR = vCircRadius[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2266
		else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2267
			NR = (48/100*vCircRadius[i])/2
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2268
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2269
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2270
		if dist <= NR*NR then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2271
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2272
			if 	(vCircActive[i] == true) and
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2273
				((vType[i] == "ammo") or (vType[i] == "bonus") )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2274
			then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2275
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2276
				CircleDamaged(i)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2277
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2278
			elseif (vCircActive[i] == true) and
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2279
					( (vType[i] == "drone") or (vType[i] == "blueboss") )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2280
			then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2281
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2282
				local ss = CircleDamaged(i)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2283
				local explosion
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2284
				if vType[i] == "blueboss" then explosion = true else explosion = false end
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2285
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2286
				local kamikaze = false
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2287
				if ss == "fatal" then
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2288
					if (wepAmmo[0] == 0) and (TimeLeft <= 9) then
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  2289
						AddCaption(loc("Kamikaze Expert! +15 points!"),0xffba00ff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2290
						AwardPoints(15)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2291
						PlaySound(sndKamikaze, CurrentHedgehog)
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2292
						kamikaze = true
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2293
					elseif (wepAmmo[0] == 0) then
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  2294
						AddCaption(loc("Depleted Kamikaze! +5 points!"),0xffba00ff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2295
						AwardPoints(5)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2296
						PlaySound(sndKamikaze, CurrentHedgehog)
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2297
						kamikaze = true
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2298
					elseif TimeLeft <= 9 then
12056
b68ec446a111 Space Invasion: Make all strings more translator-friendly
Wuzzy <almikes@aol.com>
parents: 12055
diff changeset
  2299
						AddCaption(loc("Timed Kamikaze! +10 points!"),0xffba00ff,capgrpMessage)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2300
						AwardPoints(10)
12054
0e6f044daeac Space Invasion: Better HUD, messages, stats screen, sounds. Add script param support
Wuzzy <almikes@aol.com>
parents: 10670
diff changeset
  2301
						PlaySound(sndKamikaze, CurrentHedgehog)
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2302
						kamikaze = true
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2303
					end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2304
				end
13028
8b6d8418d580 Play a few more taunts in Space Invasion
Wuzzy <Wuzzy2@mail.ru>
parents: 13026
diff changeset
  2305
				WellHeAintGonnaJumpNoMore(GetX(CurrentHedgehog),GetY(CurrentHedgehog),explosion,kamikaze)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2306
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2307
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2308
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2309
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2310
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2311
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2312
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2313
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2314
	--nw WriteLnToConsole("End of CheckDistances()")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2315
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2316
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2317
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2318
function HandleCircles()
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2319
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2320
	if rAlpha ~= 255 then
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2321
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2322
		rPingTimer = rPingTimer + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2323
		if rPingTimer == 100 then
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2324
			rPingTimer = 0
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2325
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2326
			rAlpha = rAlpha + 5
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2327
			if rAlpha >= 255 then
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2328
				rAlpha = 255
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2329
			end
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2330
		end
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2331
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2332
	end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2333
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2334
	for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2335
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2336
		SetVisualGearValues(rCirc[i], rCircX[i], rCircY[i], 100, 255, 1, 10, 0, 40, 3, vCircCol[i]-rAlpha)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2337
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2338
		vCounter[i] = vCounter[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2339
		if vCounter[i] >= vCounterLim[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2340
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2341
			vCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2342
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2343
			if 	((vType[i] == "drone") or (vType[i] == "blueboss") ) and
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2344
				(vCircActive[i] == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2345
				AddGear(vCircX[i], vCircY[i], gtShell, 0, 0, 0, 1)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2346
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2347
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2348
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2349
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2350
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2351
		if (vCircActive[i] == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2352
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2353
			vCircRadCounter[i] = vCircRadCounter[i] + 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2354
			if vCircRadCounter[i] == 100 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2355
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2356
				vCircRadCounter[i] = 0
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2357
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2358
				-- make my radius increase/decrease faster if I am an aura
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2359
				local M
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2360
				if vCircType[i] == 0 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2361
					M = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2362
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2363
					M = 10
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2364
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2365
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2366
				vCircRadius[i] = vCircRadius[i] + vCircRadDir[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2367
				if vCircRadius[i] > vCircRadMax[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2368
					vCircRadDir[i] = -M
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2369
				elseif vCircRadius[i] < vCircRadMin[i] then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2370
					vCircRadDir[i] = M
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2371
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2372
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2373
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2374
				-- random effect test
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2375
				-- maybe use this to tell the difference between circs
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2376
				-- you can kill by shooting or not
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2377
				--vgtSmoke vgtSmokeWhite
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2378
				--vgtSteam -- nice long trail
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2379
				--vgtDust -- short trail on earthrise
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2380
				--vgtSmokeTrace
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2381
				if vType[i] == "ammo" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2382
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2383
					local tempE = AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, true)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2384
					SetVisualGearValues(tempE, vCircX[i], vCircY[i], nil, nil, nil, nil, nil, nil, nil, vCircCol[i] )
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2385
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2386
				elseif vType[i] == "bonus" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2387
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2388
					local tempE = AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2389
					SetVisualGearValues(tempE, vCircX[i], vCircY[i], nil, nil, nil, nil, nil, 1, nil, 0xff00ffff )
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2390
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2391
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2392
				elseif vType[i] == "blueboss" then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2393
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2394
					local k = 25
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2395
					local g = vgtSteam
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2396
					local trailColour = 0xae00ffff
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2397
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2398
					-- 0xffae00ff -- orange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2399
					-- 0xae00ffff -- purp
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2400
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2401
					local tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2402
					SetVisualGearValues(tempE, vCircX[i], vCircY[i]+k, nil, nil, nil, nil, nil, nil, nil, trailColour-75 )
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2403
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2404
					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2405
					SetVisualGearValues(tempE, vCircX[i]+k, vCircY[i]-k, nil, nil, nil, nil, nil, nil, nil, trailColour-75 )
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2406
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2407
					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2408
					SetVisualGearValues(tempE, vCircX[i]-k, vCircY[i]-k, nil, nil, nil, nil, nil, nil, nil, trailColour-75 )
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2409
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2410
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2411
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2412
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2413
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2414
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2415
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2416
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2417
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2418
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2419
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2420
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2421
	-- alter the circles velocities
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2422
	circAdjustTimer = circAdjustTimer + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2423
	if circAdjustTimer == 2000 then
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2424
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2425
		circAdjustTimer = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2426
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2427
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2428
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2429
			-- bounce the circles off the edges if they go too far
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2430
			-- or make them move in random directions
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2431
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2432
			if vCircX[i] > 5500 then
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2433
				vCircDX[i] = -5	--5 circmovchange
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2434
			elseif vCircX[i] < -1500 then
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2435
				vCircDX[i] = 5	--5 circmovchange
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2436
			else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2437
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2438
				local z = GetRandom(2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2439
				if z == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2440
					z = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2441
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2442
					z = -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2443
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2444
				vCircDX[i] = vCircDX[i] + GetRandom(3)*z	--3 circmovchange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2445
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2446
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2447
			if vCircY[i] > 1500 then
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2448
				vCircDY[i] = -5	--5 circmovchange
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2449
			elseif vCircY[i] < -2900 then
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2450
				vCircDY[i] = 5	--5 circmovchange
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2451
			else
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2452
				local z = GetRandom(2)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2453
				if z == 1 then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2454
					z = 1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2455
				else
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2456
					z = -1
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2457
				end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2458
				vCircDY[i] = vCircDY[i] + GetRandom(3)*z	--3 circmovchange
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2459
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2460
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2461
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2462
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2463
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2464
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2465
	-- move the circles according to their current velocities
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2466
	m2Count = m2Count + 1
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2467
	if m2Count == 25 then	--25 circmovchange
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2468
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2469
		m2Count = 0
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2470
		for i = 0,(vCCount-1) do
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2471
			vCircX[i] = vCircX[i] + vCircDX[i]
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2472
			vCircY[i] = vCircY[i] + vCircDY[i]
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2473
6253
d73317579ae4 Add "Surfer" achievement to Space Invasion.
mikade
parents: 5894
diff changeset
  2474
			if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2475
				DoHorribleThings(i)
5894
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2476
			end
86c59c34cdd5 Balanced shield miser, multi-shot, and boss kills in SI. Added radar ping.
mikade
parents: 5827
diff changeset
  2477
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2478
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2479
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2480
		if (TimeLeft == 0) and (tumbleStarted == true) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2481
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2482
			fadeAlpha = fadeAlpha + 1
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2483
			if fadeAlpha >= 255 then
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2484
				fadeAlpha = 255
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2485
			end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2486
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2487
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2488
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2489
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2490
		-- derp
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2491
		if shockwaveHealth > 0 then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2492
			shockwaveHealth = shockwaveHealth - 1
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2493
			shockwaveRad = shockwaveRad + 80
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2494
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2495
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2496
	end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2497
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2498
	for i = 0,(vCCount-1) do
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2499
		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], nil, nil, nil, nil, nil, vCircRadius[i])
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2500
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2501
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2502
	if 	(TimeLeft == 0) or
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2503
		((tumbleStarted == false)) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2504
		for i = 0,(vCCount-1) do
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2505
			SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], nil, nil, nil, nil, nil, vCircRadius[i], nil, (vCircCol[i]-fadeAlpha))
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2506
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2507
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2508
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2509
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2510
	if (CurrentHedgehog ~= nil) then
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2511
		if beam == true then
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2512
			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 200, nil, 0xa800ffff-0x000000ff - -shieldHealth )
13451
57de4f050891 Space Invasion: Improve how round score is displayed
Wuzzy <Wuzzy2@mail.ru>
parents: 13449
diff changeset
  2513
			DrawTag(TAG_SHIELD)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2514
		else
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2515
			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2516
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2517
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2518
		if shockwaveHealth > 0 then
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2519
			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, shockwaveRad, nil, 0xff3300ff-0x000000ff - -shockwaveHealth )
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2520
		else
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2521
			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0)
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2522
		end
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2523
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2524
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2525
6819
07e8de67c3c2 Added a missing loc
mikade <redgrinner@gmail.com>
parents: 6253
diff changeset
  2526
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2527
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2528
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2529
function ProjectileTrack(gear)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2530
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2531
	if (GetGearType(gear) == gtShell) then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2532
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2533
		--nw WriteLnToConsole("ProjectileTrack() for Shell ID: " .. getGearValue(gear,"ID"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2534
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2535
		local turningSpeed = 0.1*fMod
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2536
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2537
		local dx, dy = GetGearVelocity(gear)
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2538
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2539
		--WriteLnToConsole("I'm trying to track currenthedge with shell ID: " .. getGearValue(gear,"ID"))
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2540
		--WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2541
		--WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) )
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2542
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2543
		if GetX(gear) > GetX(CurrentHedgehog) then
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2544
			dx = dx - turningSpeed
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2545
		else
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2546
			dx = dx + turningSpeed
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2547
		end
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2548
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2549
		if GetY(gear) > GetY(CurrentHedgehog) then
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2550
			dy = dy - turningSpeed
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2551
		else
12055
ddf0fee75449 Space Invasion: Dump most out-commented and unused code
Wuzzy <almikes@aol.com>
parents: 12054
diff changeset
  2552
			dy = dy + turningSpeed
7717
2684fdb9d874 revert since I didn't quite get this working smoothly enough. was close though. perhaps some other time. Shame because calling game tick less frequently can save a lot of CPU
nemo
parents: 7229
diff changeset
  2553
		end
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2554
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2555
13449
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2556
		local dxlimit = 0.4*fMod
6aca4f45ab0a Space Invasion: Localize most global variables
Wuzzy <Wuzzy2@mail.ru>
parents: 13448
diff changeset
  2557
		local dylimit = 0.4*fMod
5245
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2558
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2559
		if dx > dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2560
			dx = dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2561
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2562
		if dy > dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2563
			dy = dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2564
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2565
		if dx < -dxlimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2566
			dx = -dxlimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2567
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2568
		if dy < -dylimit then
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2569
			dy = -dylimit
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2570
		end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2571
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2572
		SetGearVelocity(gear, dx, dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2573
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2574
		--WriteLnToConsole("I just SET the velocity of shell towards currenthegdge. It is now dx: " .. dx .. "; dy: " .. dy)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2575
		--WriteLnToConsole("The above events occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2576
		--nw WriteLnToConsole("ProjectileTrack() finished successfully")
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2577
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2578
	end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2579
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2580
end
ce407084728f Fully playable version of Space Invasion (fingers crossed). No bugs known.
mikade
parents:
diff changeset
  2581