-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.lua
777 lines (683 loc) · 22.2 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
-- For engine globals, see `conf.lua`.
engineGlobals(true)
-- Splash screen
if not isMobile and love.graphics then
local s = love.graphics.newImage(splash)
love.graphics.clear(0, 0, 0, 1)
love.graphics.draw(s, (love.graphics.getWidth()/2)-(s:getWidth()/2), (love.graphics.getHeight()/2)-(s:getHeight()/2))
love.graphics.present()
s:release()
end
drawShader = drawShader and love.graphics.newShader([[
vec4 position(mat4 transform_projection, vec4 vertex_position)
{
vertex_position.xy = floor(vertex_position.xy);
return transform_projection * vertex_position;
}
]])
serQueue = nil
deserQueue = nil
keyboardCheck = {}
gamepadCheck = {}
doCheckDelay = false
lastPressed = {type=nil, input=nil, name=nil}
lastTouch = {x=nil, y=nil, id=nil, pressure=nil}
lastTextInput = nil
altEnterOnce = false
scaleOnce = {false, false, false, false, false, false, false, false, false}
savestateOnce = false
function useDefaultBinds()
input.unbind()
local defaultInputBinds, defaultInputBindsExtra = defaultBindsTable()
input.bind(defaultInputBinds.up, "up1", true)
input.bind(defaultInputBinds.down, "down1", true)
input.bind(defaultInputBinds.left, "left1", true)
input.bind(defaultInputBinds.right, "right1", true)
input.bind(defaultInputBinds.jump, "jump1", true)
input.bind(defaultInputBinds.shoot, "shoot1", true)
input.bind(defaultInputBinds.dash, "dash1", true)
input.bind(defaultInputBinds.start, "start1", true)
input.bind(defaultInputBinds.select, "select1", true)
input.bind(defaultInputBinds.prev, "prev1", true)
input.bind(defaultInputBinds.next, "next1", true)
for i=2, maxPlayerCount do
if defaultInputBindsExtra[i] then
input.bind(defaultInputBindsExtra[i].up, "up" .. tostring(i))
input.bind(defaultInputBindsExtra[i].down, "down" .. tostring(i))
input.bind(defaultInputBindsExtra[i].left, "left" .. tostring(i))
input.bind(defaultInputBindsExtra[i].right, "right" .. tostring(i))
input.bind(defaultInputBindsExtra[i].jump, "jump" .. tostring(i))
input.bind(defaultInputBindsExtra[i].shoot, "shoot" .. tostring(i))
input.bind(defaultInputBindsExtra[i].dash, "dash" .. tostring(i))
input.bind(defaultInputBindsExtra[i].start, "start" .. tostring(i))
input.bind(defaultInputBindsExtra[i].select, "select" .. tostring(i))
input.bind(defaultInputBindsExtra[i].prev, "prev" .. tostring(i))
input.bind(defaultInputBindsExtra[i].next, "next" .. tostring(i))
end
end
end
function loadBinds()
useDefaultBinds()
local data = save.load("main.sav")
if data and data.inputBinds then
for i = 1, maxPlayerCount do
if data.inputBinds["up" .. tostring(i)] then
input.bind(data.inputBinds["up" .. tostring(i)],"up" .. tostring(i), i == 1)
end
if data.inputBinds["down" .. tostring(i)] then
input.bind(data.inputBinds["down" .. tostring(i)], "down" .. tostring(i), i == 1)
end
if data.inputBinds["left" .. tostring(i)] then
input.bind(data.inputBinds["left" .. tostring(i)], "left" .. tostring(i), i == 1)
end
if data.inputBinds["right" .. tostring(i)] then
input.bind(data.inputBinds["right" .. tostring(i)], "right" .. tostring(i), i == 1)
end
if data.inputBinds["jump" .. tostring(i)] then
input.bind(data.inputBinds["jump" .. tostring(i)], "jump" .. tostring(i), i == 1)
end
if data.inputBinds["shoot" .. tostring(i)] then
input.bind(data.inputBinds["shoot" .. tostring(i)], "shoot" .. tostring(i), i == 1)
end
if data.inputBinds["dash" .. tostring(i)] then
input.bind(data.inputBinds["dash" .. tostring(i)], "dash" .. tostring(i), i == 1)
end
if data.inputBinds["start" .. tostring(i)] then
input.bind(data.inputBinds["start" .. tostring(i)], "start" .. tostring(i), i == 1)
end
if data.inputBinds["select" .. tostring(i)] then
input.bind(data.inputBinds["select" .. tostring(i)], "select" .. tostring(i), i == 1)
end
if data.inputBinds["prev" .. tostring(i)] then
input.bind(data.inputBinds["prev" .. tostring(i)], "prev" .. tostring(i), i == 1)
end
if data.inputBinds["next" .. tostring(i)] then
input.bind(data.inputBinds["next" .. tostring(i)], "next" .. tostring(i), i == 1)
end
end
end
end
-- Initializes the whole game to its base state.
function initEngine()
keyboardCheck = {}
gamepadCheck = {}
doCheckDelay = false
love.graphics.setFont(mmFont)
globals = {}
megautils.runFile("core/commands.lua")
-- Game globals.
globals.checkpoint = "start"
globals.lifeSegments = 7
globals.startingLives = 2
globals.disclaimerState = "assets/states/menus/disclaimer.state.lua"
globals.bossIntroState = "assets/states/menus/bossintro.state.lua"
globals.weaponGetState = "assets/states/menus/weaponget.state.lua"
globals.rebindState = "assets/states/menus/rebind.state.lua"
globals.titleState = "assets/states/menus/title.state.lua"
globals.menuState = "assets/states/menus/menu.state.tmx"
globals.playerSelectState = "assets/states/menus/players.state.lua"
globals.stageSelectState = "assets/states/menus/stageSelect.state.tmx"
globals.gameOverState = "assets/states/menus/cont.state.tmx"
globals.defeats = {} -- This should be filled out automatically by bossEntity
globals.defeatRequirementsForWily = {
"stickMan"
}
local wilyIntro = function()
error("Placeholder for Wily")
--states.setq("WILY INTRO HERE")
end
-- [RM 1] [RM 2] [RM 3]
-- [RM 4] [Wily] [RM 5]
-- [RM 6] [RM 7] [RM 8]
-- Every value in this list should either be a function, or a `.lua` file that returns an entity.
globals.robotMasterEntities = {
nil, nil, nil,
nil, wilyIntro, "demo/stickMan/stickman.lua",
nil, nil, nil
}
megautils.difficultyChangeFuncs.startingLives = {func=function(d)
globals.startingLives = (d == "easy") and 3 or 2
end, autoClean=false}
megautils.runCallback(megautils.cleanFuncs)
loader.clear()
megautils.setDifficulty("normal")
megautils.runCallback(megautils.initEngineFuncs)
end
function love.load()
require("requires")
view.init(gameWidth, gameHeight)
console.init()
initEngine()
local data = save.load("main.sav")
if data then
if data.fullscreen ~= nil then
megautils.setFullscreen(data.fullscreen)
end
if data.scale then
megautils.setScale(data.scale)
end
else
save.save("main.sav", {})
end
states.setq(globals.disclaimerState)
console.parse("exec autoexec")
end
function love.resize(w, h)
view.resize(w, h)
if console.state == 0 and console.y == -console.h then
console.y = -math.huge
console.update()
end
end
function love.joystickadded(j)
loadBinds()
end
function love.joystickremoved(j)
loadBinds()
end
function love.keypressed(k, s, r)
if pressingHardInputs(k) and not record.pressAnyway then
if record.recordInput then
record._backupKey = k
end
return
end
if record.demo and not record.pressAnyway then
record.anyPressedDuringRec = true
return
end
record.anyPressed = true
if record.recordInput then
if not record.keyPressedRec then
record.keyPressedRec = {}
end
record.keyPressedRec[#record.keyPressedRec+1] = {k, s, r}
end
-- keypressed event must be hijacked for console to work
if useConsole then
if k == "`" then
if console.state == 0 then
console.open()
elseif console.state == 1 then
console.close()
end
return
elseif console.state == 1 then
if k == "backspace" then
console.backspace()
end
if k == "return" then
console.send()
end
if k == "up" or k == "down" then
console.cycle(k)
end
if k == "tab" and #console.input > 0 and #console.getCompletion(console.input) > 0 then
console.complete()
end
if k == "v" and (love.keyboard.isDown("lctrl") or love.keyboard.isDown("rctrl")) and
love.system.getClipboardText() then
console.doInput(love.system.getClipboardText())
end
return
end
end
if not doCheckDelay or not keyboardCheck[k] then
lastPressed.type = "keyboard"
lastPressed.input = k
end
keyboardCheck[k] = 5
end
function love.gamepadpressed(j, b)
if record.demo and not record.pressAnyway then
record.anyPressedDuringRec = true
return
end
if useConsole and console.state == 1 then return end
if not doCheckDelay or not gamepadCheck[b] then
lastPressed.type = "gamepad"
lastPressed.input = b
lastPressed.name = j:getName()
end
gamepadCheck[b] = 5
record.anyPressed = true
if record.recordInput then
if not record.gamepadPressedRec then
record.gamepadPressedRec = {}
end
record.gamepadPressedRec[#record.gamepadPressedRec+1] = {k, s, r}
end
end
function love.gamepadaxis(j, b, v)
if record.demo and not record.pressAnyway then return end
if useConsole and console.state == 1 then return end
if not math.between(v, -deadZone, deadZone) then
if not doCheckDelay or not gamepadCheck[b] then
if (b == "leftx" or b == "lefty" or b == "rightx" or b == "righty") then
globals.axisTmp = {}
if b == "leftx" or b == "rightx" then
globals.axisTmp.x = {"axis", b .. (v > 0 and "+" or "-"), v, j:getName()}
elseif b == "lefty" or b == "righty" then
globals.axisTmp.y = {"axis", b .. (v > 0 and "+" or "-"), v, j:getName()}
end
else
lastPressed.type = "axis"
lastPressed.input = b .. (v > 0 and "+" or "-")
lastPressed.name = j:getName()
end
end
gamepadCheck[b] = 10
end
if record.recordInput then
if not record.gamepadAxisRec then
record.gamepadAxisRec = {}
end
record.gamepadAxisRec[#record.gamepadAxisRec+1] = {k, s, r}
end
end
function love.mousepressed(x, y, button, touch)
if love.mouse and not touch then
lastTouch.x, lastTouch.y = cscreen.project(x, y)
lastTouch.id = "mousetouch"
lastTouch.pressure = 1
input.usingTouch = true
end
end
function love.touchpressed(id, x, y, dx, dy, pressure)
if record.demo and not record.pressAnyway then
record.anyPressedDuringRec = true
return
end
if useConsole and console.state == 1 then return end
lastTouch.x, lastTouch.y = cscreen.project(x, y)
lastTouch.id = id
lastTouch.pressure = pressure
input.usingTouch = true
if record.recordInput then
if not record.touchPressedRec then
record.touchPressedRec = {}
end
record.touchPressedRec[#record.touchPressedRec+1] = {k, s, r}
end
end
function love.textinput(k)
if pressingHardInputs(k) and not record.pressAnyway then return end
if record.demo and not record.pressAnyway then return end
if useConsole then console.doInput(k) end
lastTextInput = k
if record and record.recordInput then
if not record.textInputRec then
record.textInputRec = {}
end
record.textInputRec[#record.textInputRec+1] = k
end
end
local lt = love.timer
local lt_sleep = love.timer.sleep
local lt_getTime = love.timer.getTime
local lt_step = love.timer.step
local lk = love.keyboard
local lk_isDown = love.keyboard.isDown
local le = love.event
local le_pump = love.event.pump
local le_poll = love.event.poll
local lg = love.graphics
local lg_isActive = love.graphics.isActive
local lg_origin = love.graphics.origin
local lg_clear = love.graphics.clear
local lg_getBackgroundColor = love.graphics.getBackgroundColor
local lg_present = love.graphics.present
local lg_push = love.graphics.push
local lg_pop = love.graphics.pop
function pressingHardInputs(k)
if megautils then
local isHardKey = false
local checkMod = 0
if k == "return" then
isHardKey = true
checkMod = 1
elseif (k == "o" or k == "p" or k == "r") and megautils.isCheating() then
isHardKey = true
checkMod = 2
elseif k == "backspace" and record.recordInput then
isHardKey = true
elseif k == "ralt" or k == "lalt" then
isHardKey = true
checkMod = -1
elseif (k == "rctrl" or k == "lctrl") and megautils.isCheating() then
isHardKey = true
checkMod = -2
end
for i=1, 9 do
if (i == k or ("kp" .. i == k)) then
isHardKey = true
end
end
return isHardKey and lk_isDown(k) and (checkMod == 0 or (checkMod == 1 and
(lk_isDown("ralt") or lk_isDown("lalt"))) or
(checkMod == 2 and (lk_isDown("rctrl") or lk_isDown("lctrl"))) or
(checkMod == -1 and lk_isDown("return")) or
(checkMod == -2 and (lk_isDown("o") or lk_isDown("p") or lk_isDown("r"))))
end
return false
end
local function beforeUpdate()
if lk and console and save and megautils then
if not (useConsole and console.state == 1) then
if canDoFullscreenShortcut then
if not lk_isDown("return") then
altEnterOnce = false
elseif (lk_isDown("ralt") or lk_isDown("lalt")) and lk_isDown("return") then
if not altEnterOnce then
megautils.setFullscreen(not megautils.getFullscreen())
local data = save.load("main.sav") or {}
data.fullscreen = megautils.getFullscreen()
save.save("main.sav", data)
end
altEnterOnce = true
end
end
if canDoScaleShortcuts then
for i=1, 9 do
local k = tostring(i)
if lk_isDown(k) or lk_isDown("kp" .. k) then
if view.w * i ~= lg.getWidth() or
view.h * i ~= lg.getHeight() then
local last = megautils.getScale()
megautils.setScale(i)
if i ~= last then
if not scaleOnce[i] then
local data = save.load("main.sav") or {}
data.scale = megautils.getScale()
save.save("main.sav", data)
end
scaleOnce[i] = true
end
end
else
scaleOnce[i] = false
end
end
end
end
if canDoSavestateAndRecordShortcuts then
if not lk_isDown("o") and not lk_isDown("p") and not lk_isDown("r") then
savestateOnce = false
elseif lk_isDown("lctrl") or lk_isDown("rctrl") then
if lk_isDown("o") then
if not savestateOnce then
console.parse("sssave quickSavestate")
end
savestateOnce = true
elseif lk_isDown("p") then
if not savestateOnce then
console.parse("ssopen quickSavestate")
end
savestateOnce = true
elseif lk_isDown("r") then
if not savestateOnce then
console.parse("rec")
end
savestateOnce = true
end
end
end
end
if serQueue then
local f = serQueue
serQueue = nil
f(ser())
end
if deserQueue then
local f = deserQueue
if type(deserQueue) == "function" then
f = deserQueue()
end
deserQueue = nil
deser(f)
end
if record._openRecQ then
local f = record._openRecQ
record._openRecQ = nil
record.openRec(f)
end
if record._startRecQ then
record._startRecQ = false
record.startRec()
end
end
local function afterUpdate()
megautils.checkQueue()
states.checkQueue()
sfx.updateGMEVoiceMutes()
music.checkQueue()
console.doWait()
record.anyPressed = false
record.anyPressedDuringRec = false
cscreen.updateFade()
lastPressed.type = nil
lastPressed.input = nil
lastPressed.name = nil
lastTouch.x = nil
lastTouch.y = nil
lastTouch.id = nil
lastTouch.pressure = nil
lastTextInput = nil
end
function love.update(dt)
if isWeb then
beforeUpdate()
end
if love.joystick then
if globals.axisTmp then
if globals.axisTmp.x and (not globals.axisTmp.y or
math.abs(globals.axisTmp.x[3]) > math.abs(globals.axisTmp.y[3])) then
lastPressed.type, lastPressed.input, lastPressed.name = globals.axisTmp.x[1],
globals.axisTmp.x[2], globals.axisTmp.x[4]
elseif globals.axisTmp.y then
lastPressed.type, lastPressed.input, lastPressed.name = globals.axisTmp.y[1],
globals.axisTmp.y[2], globals.axisTmp.y[4]
end
globals.axisTmp = nil
end
end
local doAgain = true
while doAgain do
states.switched = false
if not record.demo then
input.poll()
vPad.update()
end
record.update()
if useConsole then console.update(dt) end
states.update(dt)
entities.update(dt)
megautils.checkQueue()
states.checkQueue()
input.flush()
record.anyPressed = false
doAgain = states.switched
end
music.update()
if love.joystick then
for k, _ in safepairs(gamepadCheck) do
gamepadCheck[k] = gamepadCheck[k] - 1
if gamepadCheck[k] < 0 then
gamepadCheck[k] = nil
end
end
end
if love.keyboard then
for k, _ in safepairs(keyboardCheck) do
keyboardCheck[k] = keyboardCheck[k] - 1
if keyboardCheck[k] < 0 then
keyboardCheck[k] = nil
end
end
end
end
function love.draw()
lg_push()
view.draw()
lg_pop()
vPad.draw()
if useConsole then console.draw() end
if isWeb then
afterUpdate()
end
end
function love.quit()
if music and music.clean() then end
end
-- Love2D doesn't fire the resize event for several functions, so here's some hacks.
local lf = love.window.setFullscreen
local lsm = love.window.setMode
local lum = love.window.updateMode
function love.window.setFullscreen(s)
if not isWeb then
lf(s)
end
love.resize(love.graphics.getDimensions())
end
function love.window.setMode(w, h, f)
if not isWeb then
lsm(w, h, f)
end
love.resize(love.graphics.getDimensions())
end
function love.window.updateMode(w, h, f)
if not isWeb then
lum(w, h, f)
end
love.resize(love.graphics.getDimensions())
end
if not isWeb then
local lu = love.update
local ld = love.draw
local lh = love.handlers
local lq = love.quit
function love.run()
local bu = lt and lt.getTime()
if love.load then love.load(love.arg.parseGameArguments(arg), arg) end
if lt then lt.step() end
assert(le and lu and lt and lg, "Manditory Love2D module / event not loaded!")
return function()
beforeUpdate()
le_pump()
for name, a,b,c,d,e,f in le_poll() do
if name == "quit" then
if not lq or not lq() then
return a or 0
end
end
lh[name](a,b,c,d,e,f)
end
lu(lt_step())
if lg_isActive() then
lg_origin()
lg_clear(lg_getBackgroundColor())
ld()
lg_present()
end
afterUpdate()
local delta, fps = lt_getTime() - bu, 1/megautils.getFPS()
if delta < fps then lt_sleep(fps - delta) end
bu = lt_getTime()
end
end
end
-- Save state to memory
function ser()
local data = {
serQueue = serQueue,
deserQueue = deserQueue,
backgroundColor = {love.graphics.getBackgroundColor()},
isMobile = isMobile,
isWeb = isWeb,
compatMusicMode = compatMusicMode,
canUseGME = canUseGME,
spriteBatchTileMaps = spriteBatchTileMaps,
input = input.ser(),
vPad = vPad.ser(),
view = view.ser(),
megautils = megautils.ser(),
state = states.ser(),
basicEntity = basicEntity.basicEntityImgCache,
entities = entities.ser(),
section = section.ser(),
loader = loader.ser(),
music = music.ser(),
record = record.ser(),
collision = collision.ser(),
banner = banner and banner.ser(),
banIDs = pickUp.banIDs,
weapon = weapon.ser(),
camera = camera.main and camera.main,
fade = fade.main and fade.main,
megaMan = megaMan.ser(),
lastPressed = lastPressed,
lastTextInput = lastTextInput,
lastTouch = lastTouch,
keyboardCheck = keyboardCheck,
gamepadCheck = gamepadCheck,
doCheckDelay = doCheckDelay,
globals = globals,
convars = convar.getAllValues(),
rstate = love.math.getRandomState(),
seed = love.math.getRandomSeed(),
console = console.ser(),
mapEntity = mapEntity.ser()
}
return binser.serialize(data)
end
-- Load state
function deser(from, dontChangeMusic)
love.audio.stop()
sfx._cachedMutes = {}
sfx.curS = {}
local t = binser.deserialize(from)
serQueue = t.serQueue
deserQueue = t.deserQueue
love.graphics.setBackgroundColor(unpack(t.backgroundColor))
isMobile = t.isMobile
isWeb = t.isWeb
compatMusicMode = t.compatMusicMode
canUseGME = t.canUseGME
spriteBatchTileMaps = t.spriteBatchTileMaps
input.deser(t.input)
vPad.deser(t.vPad)
view.deser(t.view)
megautils.deser(t.megautils)
states.deser(t.state)
entities.deser(t.entities)
basicEntity._imgCache = t.basicEntityImgCache
section.deser(t.section)
loader.deser(t.loader)
if not dontChangeMusic then
music.deser(t.music)
end
record.deser(t.record)
collision.deser(t.collision)
if t.banner then
banner.deser(t.banner)
end
pickUp.banIDs = t.banIDs
weapon.deser(t.weapon)
camera.main = t.camera
fade.main = t.fade
megaMan.deser(t.megaMan)
lastPressed = t.lastPressed
lastTextInput = t.lastTextInput
lastTouch = t.lastTouch
keyboardCheck = t.keyboardCheck
gamepadCheck = t.gamepadCheck
doCheckDelay = t.doCheckDelay
globals = t.globals
convar.setAllValues(t.convars)
love.math.setRandomSeed(t.seed)
love.math.setRandomState(t.rstate)
console.deser(t.console)
mapEntity.deser(t.mapEntity)
collectgarbage()
collectgarbage()
end