share/hedgewars/Data/Scripts/Multiplayer/WxW.lua
author sheepluva
Tue, 21 Jan 2014 18:02:37 +0100
changeset 10036 3be36d2fdca6
parent 8043 da083f8d95e6
child 10670 638af9cb922b
permissions -rw-r--r--
use new API for changing GameFlags
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     2
----------------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     3
-- WALL TO WALL 0.4
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     4
----------------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     5
-- a shoppa minigame
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     6
-- by mikade
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     7
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     8
-- feel free to add map specific walls to LoadConfig, or post additional
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     9
-- wall suggestions on our forum at: http://www.hedgewars.org/forum
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    10
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    11
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    12
--0.1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    13
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    14
-- concept test
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    15
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    16
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    17
--0.2
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    18
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    19
-- unhardcoded turntimeleft, now uses shoppa default of 45s
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    20
-- changed some things behind the scenes
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    21
-- fixed oooooold radar bug
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    22
-- added radar / script support for multiple crates
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    23
-- tweaked weapons tables
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    24
-- added surfing and changed crate spawn requirements a bit
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    25
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    26
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    27
--0.3
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    28
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    29
-- stuffed dirty clothes into cupboard
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    30
-- improved user feedback
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    31
-- added/improved experimental config system, input masks included :D
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    32
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    33
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    34
--0.4
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    35
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    36
-- for version 0.9.18, now detects border in correct location
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    37
-- fix 0.3 config constraint
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    38
-- remove unnecessary vars
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    39
-- oops, remove hardcoding of minesnum,explosives
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    40
-- ... and unhardcode turntime (again)... man, 30s is hard :(
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    41
-- move some initialisations around
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    42
-- numerous improvements to user feedback
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    43
-- walls disappear after being touched
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    44
-- added backwards compatibility with 0.9.17
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    45
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    46
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    47
--TO DO
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    48
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    49
-- achievements / try detect shoppa moves? :|
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    50
-- maybe add ability for the user to place zones like in Racer?
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    51
-- add more hard-coded values for specific maps
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    52
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    53
-----------------------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    54
-- GO PONIES, GO PONIES, GO!
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    55
-----------------------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    56
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7183
diff changeset
    57
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7183
diff changeset
    58
HedgewarsScriptLoad("/Scripts/Tracker.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7183
diff changeset
    59
HedgewarsScriptLoad("/Scripts/Utils.lua")
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    60
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    61
-- experimental menu stuff
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    62
local menuIndex = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    63
local menu = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    64
local preMenuCfg
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    65
local postMenuCfg
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    66
local roundN = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    67
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    68
-- config and wall variables
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    69
local AFR = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    70
local allowCrazyWeps = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    71
local requireSurfer = true
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    72
local wX = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    73
local wY = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    74
local wWidth = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    75
local wHeight = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    76
local wTouched = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    77
--local margin
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    78
local wallsLeft = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    79
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    80
local highestY = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    81
local surferTimer = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    82
local hasSurfed = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    83
local allWallsHit = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    84
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    85
local gTimer = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    86
local effectTimer = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    87
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    88
local ropeG = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    89
local crateG = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    90
local allowCrate = true
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    91
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    92
-- crate radar vars
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    93
local rCirc = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    94
local rAlpha = 255
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    95
local rPingTimer = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    96
local m2Count = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    97
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    98
local weapons = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    99
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   100
--[[local unlisted = {amTardis, amLandGun,amExtraTime,amExtraDamage,
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   101
				amVampiric, amSwitch, amInvulnerable, amGirder, amJetpack,
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   102
				amPortalGun, amTeleport, amResurrector, amLaserSight, amLowGravity,
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   103
				amAirAttack, amNapalm, amMineStrike, amDrillStrike,
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   104
				amKamikaze, amSnowball, amSeduction}]]
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   105
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   106
local crazyWeps = {amWatermelon, amHellishBomb, amBallgun, amRCPlane}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   107
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   108
local groundWeps = 	{amBee, amShotgun,amDEagle,amFirePunch, amWhip,
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   109
				amPickHammer, amBaseballBat, amCake,amBallgun,
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   110
				amRCPlane, amSniperRifle, amBirdy, amBlowTorch, amGasBomb,
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   111
				amFlamethrower, amSMine, amMortar, amHammer}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   112
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   113
local ropeWeps = {amGrenade, amClusterBomb, amBazooka, amMine, amDynamite,
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   114
				amWatermelon, amHellishBomb, amDrill, amMolotov}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   115
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   116
-- 0.9.18+ extra custom data for preset maps
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   117
local MapList =
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   118
	{
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   119
	--name,      						surfer, roof, 	LRwalls
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   120
	{"Atlantis Shoppa", 			    true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   121
	{"BambooPlinko", 				    true,	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   122
	{"BrickShoppa", 				    false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   123
	{"BubbleFlow",   					true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   124
	{"Cave",       						false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   125
	{"Glass Shoppa",      				true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   126
	{"HardIce",      					false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   127
	{"Industrial",       				false,	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   128
	{"Islands",       					true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   129
	{"Hedgelove",       				true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   130
	{"NeonStyle",       				false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   131
	{"Octorama",       					false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   132
	{"red vs blue - Castle",     		true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   133
	{"red vs blue - castle2",     		true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   134
	{"red vs blue - True Shoppa Sky",   true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   135
	{"Ropes",       					false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   136
	{"Ropes Rearranged",      			false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   137
	{"RopesRevenge Flipped",    		true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   138
	{"Ropes Three",      				false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   139
	{"RopesTwo",      					false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   140
	{"ShapeShoppa1.0",     				true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   141
	{"ShappeShoppa Darkhow",      		true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   142
	{"ShoppaCave2",      				true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   143
	{"ShoppaFun",      					true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   144
	{"ShoppaGolf",      				false, 	false,  true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   145
	{"ShoppaHell",      				false, 	true,  false},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   146
	{"ShoppaKing",       				false, 	false, false},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   147
	{"ShoppaNeon",       				false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   148
	{"ShoppaSky",       				false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   149
	{"Shoppawall",       				false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   150
	{"SkatePark",       				false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   151
	{"SloppyShoppa",      				false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   152
	{"Sticks",       					true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   153
	{"Symmetrical Ropes ",       		false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   154
	{"Tetris",       					false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   155
	{"TransRopes2",      				false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   156
	{"Wildmap",      					false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   157
	{"Winter Shoppa",      				false, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   158
	{"2Cshoppa",      					true, 	false, true}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   159
	}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   160
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   161
function BoolToCfgTxt(p)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   162
	if p == false then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   163
		return("Disabled")
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   164
	else
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   165
		return("Enabled")
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   166
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   167
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   168
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   169
function LoadConfig(p)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   170
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   171
	margin = 20
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   172
	mapID = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   173
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   174
	-- 0.9.17
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   175
	if Map == "CHANGE_ME" then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   176
		AddCaption(loc("For improved features/stability, play 0.9.18+"))
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   177
		--AddWall(10,10,4085,margin)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   178
		AddWall(10,10,margin,2025)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   179
		AddWall(4085-margin,10,margin,2025)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   180
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   181
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   182
	--0.9.18+
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   183
	for i = 1, #MapList do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   184
		if Map == MapList[i][1] then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   185
			mapID = i
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   186
			--AddCaption(MapList[i][1] .. " found. reqSurf is " .. BoolToCfgTxt(MapList[i][2]))
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   187
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   188
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   189
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   190
	if (p == 1) and (mapID ~= nil) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   191
		requireSurfer = MapList[mapID][2]
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   192
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   193
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   194
	if mapID ~= nil then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   195
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   196
		-- add a wall to the roof
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   197
		if MapList[mapID][3] == true then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   198
			AddWall(LeftX+10,TopY+10,RightX-LeftX-20,margin)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   199
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   200
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   201
		-- add walls on the left and right border
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   202
		if MapList[mapID][4] == true then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   203
			AddWall(LeftX+10,TopY+10,margin,WaterLine)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   204
			AddWall(RightX-10-margin,TopY+10,margin,WaterLine)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   205
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   206
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   207
		-- add map specific walls
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   208
		if Map == "Ropes" then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   209
			AddWall(1092,934,54,262)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   210
			AddWall(2822,323,33,137)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   211
		elseif Map == "ShoppaKing" then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   212
			AddWall(3777,1520,50,196)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   213
			AddWall(1658,338,46,670)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   214
		elseif Map == "ShoppaHell" then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   215
			AddWall(2035,831,30,263)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   216
			AddWall(3968,1668,31,383)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   217
		elseif Map == "ShoppaNeon" then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   218
			AddWall(980,400,20,300)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   219
			AddWall(1940,400,20,300)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   220
			AddWall(3088,565,26,284)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   221
			AddWall(187,270,28,266)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   222
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   223
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   224
	-- if map is unrecognized, add two walls on the side borders
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   225
	-- also, if version of hw is not 0.9.17 or lower
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   226
	elseif Map ~= "CHANGE_ME" then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   227
		AddWall(LeftX+10,TopY+10,margin,WaterLine)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   228
		AddWall(RightX-10-margin,TopY+10,margin,WaterLine)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   229
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   230
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   231
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   232
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   233
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   234
function AddWall(zXMin,zYMin, zWidth, zHeight)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   235
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   236
	table.insert(wX, zXMin)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   237
	table.insert(wY, zYMin)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   238
	table.insert(wWidth, zWidth)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   239
	table.insert(wHeight, zHeight)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   240
	table.insert(wTouched, false)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   241
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   242
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   243
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   244
function DrawBlip(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   245
	SetVisualGearValues(getGearValue(gear,"CIRC"), getGearValue(gear,"RX"), getGearValue(gear,"RY"), 100, 255, 1, 10, 0, 40, 3, GetClanColor(GetHogClan(CurrentHedgehog))-rAlpha)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   246
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   247
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   248
function TrackRadarBlip(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   249
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   250
	-- work out the distance to the target
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   251
	g1X, g1Y = GetGearPosition(CurrentHedgehog)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   252
	g2X, g2Y = GetX(gear), GetY(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   253
	q = g1X - g2X
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   254
	w = g1Y - g2Y
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   255
	r = math.sqrt( (q*q) + (w*w) )	--alternate
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   256
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   257
	RCX = getGearValue(gear,"RX")
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   258
	RCY = getGearValue(gear,"RY")
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   259
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   260
	rCircDistance = r -- distance to circle
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   261
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   262
	opp = w
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   263
	if opp < 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   264
		opp = opp*-1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   265
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   266
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   267
	-- work out the angle (theta) to the target
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   268
	t = math.deg ( math.asin(opp / r) )
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   269
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   270
	-- based on the radius of the radar, calculate what x/y displacement should be
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   271
	NR = 150 -- radius at which to draw circs
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   272
	NX = math.cos( math.rad(t) ) * NR
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   273
	NY = math.sin( math.rad(t) ) * NR
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   274
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   275
	if rCircDistance < NR then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   276
		RCX = g2X
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   277
	elseif q > 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   278
		RCX = g1X - NX
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   279
	else
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   280
		RCX = g1X + NX
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   281
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   282
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   283
	if rCircDistance < NR then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   284
		RCY = g2Y
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   285
	elseif w > 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   286
		RCY = g1Y - NY
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   287
	else
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   288
		RCY = g1Y + NY
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   289
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   290
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   291
	setGearValue(gear, "RX", RCX)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   292
	setGearValue(gear, "RY", RCY)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   293
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   294
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   295
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   296
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   297
function HandleCircles()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   298
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   299
	-- enable this if you want the radar to only show for a few seconds
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   300
	-- after you spawn the crate
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   301
	--[[if rAlpha ~= 255 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   302
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   303
		rPingTimer = rPingTimer + 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   304
		if rPingTimer == 100 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   305
			rPingTimer = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   306
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   307
			rAlpha = rAlpha + 5
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   308
			if rAlpha >= 255 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   309
				rAlpha = 255
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   310
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   311
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   312
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   313
	end]]
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   314
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   315
	runOnGears(DrawBlip)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   316
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   317
	m2Count = m2Count + 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   318
	if m2Count == 25 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   319
		m2Count = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   320
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   321
		if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   322
			runOnGears(TrackRadarBlip)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   323
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   324
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   325
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   326
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   327
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   328
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   329
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   330
function CheckCrateConditions()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   331
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   332
	crateSpawn = true
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   333
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   334
	if requireSurfer == true then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   335
		if hasSurfed == false then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   336
			crateSpawn = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   337
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   338
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   339
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   340
	if #wTouched > 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   341
		if allWallsHit == false then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   342
			crateSpawn = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   343
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   344
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   345
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   346
	if crateSpawn == true then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   347
		if allowCrate == true then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   348
		--if (crateG == nil) and (allowCrate == true) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   349
			--AddCaption("")
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   350
			SpawnAmmoCrate(0, 0, weapons[1+GetRandom(#weapons)] )
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   351
			rPingTimer = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   352
			rAlpha = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   353
			PlaySound(sndWarp)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   354
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   355
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   356
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   357
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   358
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   359
function CheckSurfer()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   360
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   361
	if GetY(CurrentHedgehog) > highestY then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   362
		highestY = GetY(CurrentHedgehog)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   363
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   364
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   365
	if (highestY == (WaterLine-8)) and (hasSurfed == false)  then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   366
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   367
		surferTimer = surferTimer +1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   368
		if (surferTimer == 40) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   369
			hasSurfed = true
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   370
			AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   371
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   372
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   373
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   374
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   375
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   376
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   377
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   378
function WallHit(id, zXMin,zYMin, zWidth, zHeight)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   379
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   380
	if wTouched[id] == false then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   381
		tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   382
		PlaySound(sndExplosion)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   383
		wallsLeft = wallsLeft - 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   384
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   385
		if wallsLeft == 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   386
			AddCaption(loc("All walls touched!"))
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   387
			allWallsHit = true
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   388
			if (requireSurfer == true) and (hasSurfed == false) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   389
				AddCaption(loc("Go surf!"),0xffba00ff,capgrpMessage2)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   390
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   391
		else
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   392
			AddCaption(loc("Walls Left") .. ": " .. wallsLeft)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   393
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   394
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   395
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   396
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   397
	wTouched[id] = true
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   398
	tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, false)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   399
	--PlaySound(sndVaporize) -- yeah, this is just annoying as shit
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   400
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   401
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   402
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   403
function CheckForWallCollision()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   404
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   405
	for i = 1, #wTouched do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   406
		if gearIsInBox(CurrentHedgehog, wX[i],wY[i],wWidth[i],wHeight[i]) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   407
			WallHit(i, wX[i],wY[i],wWidth[i],wHeight[i])
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   408
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   409
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   410
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   411
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   412
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   413
function BorderSpark(zXMin,zYMin, zWidth, zHeight, bCol)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   414
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   415
	eX = zXMin + GetRandom(zWidth+10)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   416
	eY = zYMin + GetRandom(zHeight+10)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   417
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   418
	tempE = AddVisualGear(eX, eY, vgtDust, 0, false)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   419
	if tempE ~= 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   420
		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   421
		SetVisualGearValues(tempE, eX, eY, g3, g4, g5, g6, g7, 1, g9, bCol )
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   422
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   423
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   424
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   425
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   426
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   427
function HandleBorderEffects()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   428
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   429
	effectTimer = effectTimer + 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   430
	if effectTimer > 15 then --25
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   431
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   432
		effectTimer = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   433
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   434
		for i = 1, #wTouched do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   435
			if wTouched[i] == true then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   436
				--bCol = GetClanColor(GetHogClan(CurrentHedgehog))
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   437
			else
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   438
				--bCol = 0xFFFFFFFF
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   439
				bCol = GetClanColor(GetHogClan(CurrentHedgehog))
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   440
				BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], bCol)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   441
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   442
			--BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], bCol)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   443
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   444
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   445
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   446
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   447
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   448
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   449
function onLJump()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   450
	if roundN < 2 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   451
		roundN = 100
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   452
		SetInputMask(0xFFFFFFFF)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   453
		TurnTimeLeft = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   454
		AddCaption(loc("Configuration accepted."),0xffba00ff,capgrpMessage)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   455
		HideMission()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   456
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   457
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   458
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   459
function onAttack()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   460
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   461
	if roundN < 2 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   462
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   463
		if menuIndex == 1 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   464
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   465
			if #wTouched > 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   466
				for i = 1, #wTouched do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   467
					wTouched[i] = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   468
					wX[i] = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   469
					wY[i] = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   470
					wWidth[i] = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   471
					wHeight[i] = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   472
				end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   473
			else
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   474
				LoadConfig(2)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   475
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   476
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   477
		elseif menuIndex == 2 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   478
			requireSurfer = not(requireSurfer)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   479
		elseif menuIndex == 3 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   480
			AFR = not(AFR)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   481
		elseif menuIndex == 4 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   482
			allowCrazyWeps = not(allowCrazyWeps)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   483
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   484
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   485
		UpdateMenu()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   486
		configureWeapons()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   487
		HandleStartingStage()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   488
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   489
	elseif (AFR == true) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   490
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   491
		if (GetCurAmmoType() ~= amRope) and
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   492
			(GetCurAmmoType() ~= amSkip) and
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   493
			(GetCurAmmoType() ~= amNothing)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   494
		then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   495
			AddCaption(loc("You may only attack from a rope!"),0xffba00ff,capgrpMessage2)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   496
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   497
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   498
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   499
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   500
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   501
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   502
function onDown()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   503
	if roundN < 2 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   504
		menuIndex = menuIndex +1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   505
		if menuIndex > #menu then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   506
			menuIndex = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   507
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   508
		HandleStartingStage()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   509
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   510
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   511
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   512
function onUp()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   513
	if roundN < 2 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   514
		menuIndex = menuIndex -1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   515
		if 	menuIndex == 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   516
			menuIndex = #menu
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   517
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   518
		HandleStartingStage()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   519
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   520
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   521
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   522
function onGameInit()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   523
10036
3be36d2fdca6 use new API for changing GameFlags
sheepluva
parents: 8043
diff changeset
   524
	ClearGameFlags()
3be36d2fdca6 use new API for changing GameFlags
sheepluva
parents: 8043
diff changeset
   525
	EnableGameFlags(gfRandomOrder, gfBorder, gfSolidLand) --, gfInfAttack
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   526
	HealthCaseProb = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   527
	CaseFreq = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   528
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   529
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   530
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   531
function configureWeapons()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   532
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   533
	-- reset wep array
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   534
	for i = 1, #weapons do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   535
		weapons[i] = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   536
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   537
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   538
	-- add rope weps
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   539
	for i, w in pairs(ropeWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   540
        table.insert(weapons, w)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   541
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   542
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   543
	-- add ground weps
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   544
	for i, w in pairs(groundWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   545
        table.insert(weapons, w)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   546
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   547
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   548
	-- remove ground weps if attacking from rope is mandatory
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   549
	if AFR == true then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   550
		for i = 1, #weapons do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   551
			for w = 1, #groundWeps do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   552
				if groundWeps[w] == weapons[i] then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   553
					table.remove(weapons, i)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   554
				end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   555
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   556
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   557
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   558
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   559
	-- remove crazy weps is crazy weps aren't allowed
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   560
	if allowCrazyWeps == false then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   561
		for i = 1, #weapons do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   562
			for w = 1, #crazyWeps do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   563
				if crazyWeps[w] == weapons[i] then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   564
					table.remove(weapons, i)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   565
				end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   566
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   567
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   568
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   569
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   570
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   571
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   572
function onGameStart()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   573
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   574
	LoadConfig(1)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   575
	configureWeapons()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   576
	UpdateMenu()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   577
	HandleStartingStage()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   578
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   579
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   580
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   581
function onNewTurn()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   582
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   583
	wallsLeft = #wTouched
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   584
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   585
	for i = 1, #wTouched do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   586
		wTouched[i] = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   587
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   588
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   589
	allowCrate = true
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   590
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   591
	surferTimer = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   592
	hasSurfed = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   593
	allWallsHit = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   594
	highestY = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   595
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   596
	crateG = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   597
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   598
	-- new config stuff
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   599
	roundN = roundN + 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   600
	if roundN < 2 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   601
		TurnTimeLeft = -1
7183
95dc11d648fb tidy flags
nemo
parents: 7095
diff changeset
   602
		SetInputMask(0)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   603
		allowCrate = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   604
		HandleStartingStage() -- new
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   605
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   606
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   607
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   608
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   609
function UpdateMenu()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   610
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   611
	preMenuCfg = loc("Spawn the crate, and attack!") .. "|"
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   612
	postMenuCfg = loc("Press [Enter] to accept this configuration.")
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   613
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   614
	menu = 	{
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   615
			loc("Walls Required") .. ": " .. #wTouched .. "|",
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   616
			loc("Surf Before Crate") .. ": " .. BoolToCfgTxt(requireSurfer) .. "|",
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   617
			loc("Attack From Rope") .. ": " .. BoolToCfgTxt(AFR) .. "|",
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   618
			loc("Super Weapons") .. ": " .. BoolToCfgTxt(allowCrazyWeps) .. "|"
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   619
			}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   620
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   621
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   622
function HandleStartingStage()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   623
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   624
	temp = menu[menuIndex]
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   625
	menu[menuIndex] = "--> " .. menu[menuIndex]
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   626
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   627
	missionComment = ""
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   628
	for i = 1, #menu do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   629
		missionComment = missionComment .. menu[i]
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   630
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   631
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   632
	ShowMission	(
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   633
				loc("WALL TO WALL") .. " 0.4",
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   634
				loc("a shoppa minigame"),
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   635
				preMenuCfg..
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   636
				missionComment ..
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   637
				postMenuCfg ..
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   638
				--" " .. "|" ..
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   639
				"", 4, 300000
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   640
				)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   641
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   642
	menu[menuIndex] = temp
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   643
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   644
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   645
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   646
function onGameTick()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   647
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   648
	if CurrentHedgehog ~= nil then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   649
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   650
		--AddCaption(Map)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   651
		--AddCaption(RightX ..";" .. GetX(CurrentHedgehog))
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   652
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   653
		CheckSurfer()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   654
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   655
		gTimer = gTimer + 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   656
		if gTimer == 25 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   657
			gTimer = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   658
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   659
			CheckForWallCollision()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   660
			CheckCrateConditions()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   661
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   662
			if (crateG == GetFollowGear()) and (crateG ~= nil) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   663
				FollowGear(CurrentHedgehog)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   664
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   665
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   666
			-- if attackfromrope is set, forbid firing unless using rope
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   667
			if (AFR == true) and (roundN >= 2) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   668
				if (GetCurAmmoType() == amRope) or
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   669
					(GetCurAmmoType() == amSkip) or
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   670
					(GetCurAmmoType() == amNothing)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   671
				then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   672
					SetInputMask(0xFFFFFFFF)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   673
				elseif ropeG == nil then
7183
95dc11d648fb tidy flags
nemo
parents: 7095
diff changeset
   674
					SetInputMask(bnot(gmAttack))
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   675
				end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   676
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   677
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   678
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   679
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   680
		HandleBorderEffects()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   681
		HandleCircles()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   682
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   683
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   684
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   685
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   686
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   687
function onGearAdd(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   688
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   689
	if GetGearType(gear) == gtRope then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   690
		ropeG = gear
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   691
	elseif GetGearType(gear) == gtCase then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   692
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   693
		crateG = gear
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   694
		trackGear(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   695
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   696
		table.insert(rCirc, AddVisualGear(0,0,vgtCircle,0,true) )
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   697
		setGearValue(gear,"CIRC",rCirc[#rCirc])
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   698
		setGearValue(gear,"RX",0)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   699
		setGearValue(gear,"RY",0)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   700
		SetVisualGearValues(rCirc[#rCirc], 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff00ffff)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   701
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   702
		allowCrate = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   703
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   704
		rPingTimer = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   705
		rAlpha = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   706
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   707
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   708
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   709
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   710
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   711
function onGearDelete(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   712
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   713
	if gear == ropeG then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   714
		ropeG = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   715
	elseif GetGearType(gear) == gtCase then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   716
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   717
		if gear == crateG then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   718
			crateG = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   719
		--	rAlpha = 255
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   720
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   721
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   722
		for i = 1, #rCirc do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   723
			if rCirc[i] == getGearValue(gear,"CIRC") then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   724
				DeleteVisualGear(rCirc[i])
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   725
				table.remove(rCirc, i)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   726
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   727
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   728
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   729
		trackDeletion(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   730
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   731
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   732
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   733
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   734
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   735
function onAmmoStoreInit()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   736
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   737
	for i, w in pairs(ropeWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   738
        SetAmmo(w, 0, 0, 0, 1)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   739
    end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   740
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   741
    for i, w in pairs(groundWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   742
        SetAmmo(w, 0, 0, 0, 1)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   743
    end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   744
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   745
    for i, w in pairs(crazyWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   746
        SetAmmo(w, 0, 0, 0, 1)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   747
    end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   748
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   749
	SetAmmo(amRope, 9, 0, 0, 0)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   750
	SetAmmo(amSkip, 9, 0, 0, 0)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   751
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   752
end