7568
|
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 |
|
|
57 |
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
|
|
58 |
loadfile(GetDataPath() .. "Scripts/Tracker.lua")()
|
|
59 |
loadfile(GetDataPath() .. "Scripts/Utils.lua")()
|
|
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 |
|
|
524 |
GameFlags = gfRandomOrder + gfBorder + gfSolidLand --+ gfInfAttack
|
|
525 |
HealthCaseProb = 0
|
|
526 |
CaseFreq = 0
|
|
527 |
|
|
528 |
end
|
|
529 |
|
|
530 |
function configureWeapons()
|
|
531 |
|
|
532 |
-- reset wep array
|
|
533 |
for i = 1, #weapons do
|
|
534 |
weapons[i] = nil
|
|
535 |
end
|
|
536 |
|
|
537 |
-- add rope weps
|
|
538 |
for i, w in pairs(ropeWeps) do
|
|
539 |
table.insert(weapons, w)
|
|
540 |
end
|
|
541 |
|
|
542 |
-- add ground weps
|
|
543 |
for i, w in pairs(groundWeps) do
|
|
544 |
table.insert(weapons, w)
|
|
545 |
end
|
|
546 |
|
|
547 |
-- remove ground weps if attacking from rope is mandatory
|
|
548 |
if AFR == true then
|
|
549 |
for i = 1, #weapons do
|
|
550 |
for w = 1, #groundWeps do
|
|
551 |
if groundWeps[w] == weapons[i] then
|
|
552 |
table.remove(weapons, i)
|
|
553 |
end
|
|
554 |
end
|
|
555 |
end
|
|
556 |
end
|
|
557 |
|
|
558 |
-- remove crazy weps is crazy weps aren't allowed
|
|
559 |
if allowCrazyWeps == false then
|
|
560 |
for i = 1, #weapons do
|
|
561 |
for w = 1, #crazyWeps do
|
|
562 |
if crazyWeps[w] == weapons[i] then
|
|
563 |
table.remove(weapons, i)
|
|
564 |
end
|
|
565 |
end
|
|
566 |
end
|
|
567 |
end
|
|
568 |
|
|
569 |
end
|
|
570 |
|
|
571 |
function onGameStart()
|
|
572 |
|
|
573 |
LoadConfig(1)
|
|
574 |
configureWeapons()
|
|
575 |
UpdateMenu()
|
|
576 |
HandleStartingStage()
|
|
577 |
|
|
578 |
end
|
|
579 |
|
|
580 |
function onNewTurn()
|
|
581 |
|
|
582 |
wallsLeft = #wTouched
|
|
583 |
|
|
584 |
for i = 1, #wTouched do
|
|
585 |
wTouched[i] = false
|
|
586 |
end
|
|
587 |
|
|
588 |
allowCrate = true
|
|
589 |
|
|
590 |
surferTimer = 0
|
|
591 |
hasSurfed = false
|
|
592 |
allWallsHit = false
|
|
593 |
highestY = 0
|
|
594 |
|
|
595 |
crateG = nil
|
|
596 |
|
|
597 |
-- new config stuff
|
|
598 |
roundN = roundN + 1
|
|
599 |
if roundN < 2 then
|
|
600 |
TurnTimeLeft = -1
|
|
601 |
SetInputMask(0)
|
|
602 |
allowCrate = false
|
|
603 |
HandleStartingStage() -- new
|
|
604 |
end
|
|
605 |
|
|
606 |
end
|
|
607 |
|
|
608 |
function UpdateMenu()
|
|
609 |
|
|
610 |
preMenuCfg = loc("Spawn the crate, and attack!") .. "|"
|
|
611 |
postMenuCfg = loc("Press [Enter] to accept this configuration.")
|
|
612 |
|
|
613 |
menu = {
|
|
614 |
loc("Walls Required") .. ": " .. #wTouched .. "|",
|
|
615 |
loc("Surf Before Crate") .. ": " .. BoolToCfgTxt(requireSurfer) .. "|",
|
|
616 |
loc("Attack From Rope") .. ": " .. BoolToCfgTxt(AFR) .. "|",
|
|
617 |
loc("Super Weapons") .. ": " .. BoolToCfgTxt(allowCrazyWeps) .. "|"
|
|
618 |
}
|
|
619 |
end
|
|
620 |
|
|
621 |
function HandleStartingStage()
|
|
622 |
|
|
623 |
temp = menu[menuIndex]
|
|
624 |
menu[menuIndex] = "--> " .. menu[menuIndex]
|
|
625 |
|
|
626 |
missionComment = ""
|
|
627 |
for i = 1, #menu do
|
|
628 |
missionComment = missionComment .. menu[i]
|
|
629 |
end
|
|
630 |
|
|
631 |
ShowMission (
|
|
632 |
loc("WALL TO WALL") .. " 0.4",
|
|
633 |
loc("a shoppa minigame"),
|
|
634 |
preMenuCfg..
|
|
635 |
missionComment ..
|
|
636 |
postMenuCfg ..
|
|
637 |
--" " .. "|" ..
|
|
638 |
"", 4, 300000
|
|
639 |
)
|
|
640 |
|
|
641 |
menu[menuIndex] = temp
|
|
642 |
|
|
643 |
end
|
|
644 |
|
|
645 |
function onGameTick()
|
|
646 |
|
|
647 |
if CurrentHedgehog ~= nil then
|
|
648 |
|
|
649 |
--AddCaption(Map)
|
|
650 |
--AddCaption(RightX ..";" .. GetX(CurrentHedgehog))
|
|
651 |
|
|
652 |
CheckSurfer()
|
|
653 |
|
|
654 |
gTimer = gTimer + 1
|
|
655 |
if gTimer == 25 then
|
|
656 |
gTimer = 1
|
|
657 |
|
|
658 |
CheckForWallCollision()
|
|
659 |
CheckCrateConditions()
|
|
660 |
|
|
661 |
if (crateG == GetFollowGear()) and (crateG ~= nil) then
|
|
662 |
FollowGear(CurrentHedgehog)
|
|
663 |
end
|
|
664 |
|
|
665 |
-- if attackfromrope is set, forbid firing unless using rope
|
|
666 |
if (AFR == true) and (roundN >= 2) then
|
|
667 |
if (GetCurAmmoType() == amRope) or
|
|
668 |
(GetCurAmmoType() == amSkip) or
|
|
669 |
(GetCurAmmoType() == amNothing)
|
|
670 |
then
|
|
671 |
SetInputMask(0xFFFFFFFF)
|
|
672 |
elseif ropeG == nil then
|
|
673 |
SetInputMask(bnot(gmAttack))
|
|
674 |
end
|
|
675 |
end
|
|
676 |
|
|
677 |
end
|
|
678 |
|
|
679 |
HandleBorderEffects()
|
|
680 |
HandleCircles()
|
|
681 |
|
|
682 |
end
|
|
683 |
|
|
684 |
end
|
|
685 |
|
|
686 |
function onGearAdd(gear)
|
|
687 |
|
|
688 |
if GetGearType(gear) == gtRope then
|
|
689 |
ropeG = gear
|
|
690 |
elseif GetGearType(gear) == gtCase then
|
|
691 |
|
|
692 |
crateG = gear
|
|
693 |
trackGear(gear)
|
|
694 |
|
|
695 |
table.insert(rCirc, AddVisualGear(0,0,vgtCircle,0,true) )
|
|
696 |
setGearValue(gear,"CIRC",rCirc[#rCirc])
|
|
697 |
setGearValue(gear,"RX",0)
|
|
698 |
setGearValue(gear,"RY",0)
|
|
699 |
SetVisualGearValues(rCirc[#rCirc], 0, 0, 100, 255, 1, 10, 0, 40, 3, 0xff00ffff)
|
|
700 |
|
|
701 |
allowCrate = false
|
|
702 |
|
|
703 |
rPingTimer = 0
|
|
704 |
rAlpha = 0
|
|
705 |
|
|
706 |
end
|
|
707 |
|
|
708 |
end
|
|
709 |
|
|
710 |
function onGearDelete(gear)
|
|
711 |
|
|
712 |
if gear == ropeG then
|
|
713 |
ropeG = nil
|
|
714 |
elseif GetGearType(gear) == gtCase then
|
|
715 |
|
|
716 |
if gear == crateG then
|
|
717 |
crateG = nil
|
|
718 |
-- rAlpha = 255
|
|
719 |
end
|
|
720 |
|
|
721 |
for i = 1, #rCirc do
|
|
722 |
if rCirc[i] == getGearValue(gear,"CIRC") then
|
|
723 |
DeleteVisualGear(rCirc[i])
|
|
724 |
table.remove(rCirc, i)
|
|
725 |
end
|
|
726 |
end
|
|
727 |
|
|
728 |
trackDeletion(gear)
|
|
729 |
|
|
730 |
end
|
|
731 |
|
|
732 |
end
|
|
733 |
|
|
734 |
function onAmmoStoreInit()
|
|
735 |
|
|
736 |
for i, w in pairs(ropeWeps) do
|
|
737 |
SetAmmo(w, 0, 0, 0, 1)
|
|
738 |
end
|
|
739 |
|
|
740 |
for i, w in pairs(groundWeps) do
|
|
741 |
SetAmmo(w, 0, 0, 0, 1)
|
|
742 |
end
|
|
743 |
|
|
744 |
for i, w in pairs(crazyWeps) do
|
|
745 |
SetAmmo(w, 0, 0, 0, 1)
|
|
746 |
end
|
|
747 |
|
|
748 |
SetAmmo(amRope, 9, 0, 0, 0)
|
|
749 |
SetAmmo(amSkip, 9, 0, 0, 0)
|
|
750 |
|
|
751 |
end
|