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