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