forked from alesan99/mari0_ae
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
3191 lines (2816 loc) · 95.3 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
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
STEAL MY SHIT AND I'LL FUCK YOU UP
PRETTY MUCH EVERYTHING BY MAURICE GUÉGAN AND IF SOMETHING ISN'T BY ME THEN IT SHOULD BE OBVIOUS OR NOBODY CARES
Please keep in mind that for obvious reasons, I do not hold the rights to artwork, audio or trademarked elements of the game.
This license only applies to the code and original other assets. Obviously. Duh.
Anyway, enjoy.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.]]
--[[
-----------------------------------------------------------------------------
"AWESOME" mod by Alesan99
OTHER COOL DUDES
-Maurice and Fakeuser for regular turrets
-Automatik for helping me with the poison mushroom
-Superjustinbros for some SMBS sprites
-Qcode for some code and advice
-Trosh for raccoon sprites from SE
-Galas for power up sprites
-Bobthelawyer for mario's hammer physics code
-KGK64 for Dry beetle sprites
-Skysometric for animated quad cache code from Mari0 SE Community Edtion
-Oxiriar and Toonn from the Mari0 Gang Discord for smb3 item sprites
-NH1507 for toad and toadette character sprites
-HansAgain for new portal sprites, new mario sprites, banzai bills, and pneumatic tubes
-Subpixel for bowser3, rotodiscs, ninji, and splunkin sprites
-Critfish for overgrown portal sprites
-Britdan for general bugtesting and misc. contributions on github
-MadNyle for propeller sound effect and mega mushroom
-fußmatte for helping create a TON of new characters for the font and Esperanto Translation
-HugoBDesigner for Portugese-Br translation
-Los for Russian Translation
-qixils for the automatic GitHub workflows and LÖVE 11.4 update
-WilliamFr0g and Kant for contributions on GitHub
-----------------------------------------------------------------------------
]]
--version check
if love._version_major ~= 11 then error("You have an outdated version of Love2d! Get 11.5 and retry.") end
----- COLOR MIGRATION helpers -----
FFIAVAILABLE = pcall(function () require("ffi") end)
local function convertText(text)
if type(text) == "table" then
for i, v in ipairs(text) do
if type(v) == "table" then
text[i] = {love.math.colorFromBytes(unpack(v))}
end
end
end
return text
end
----- COLOR MIGRATION for real -----
local defaultSetColor = love.graphics.setColor
function love.graphics.setColor(r, g, b, a)
if type(r) == "table" then r, g, b, a = unpack(r) end
return defaultSetColor(love.math.colorFromBytes(r, g, b, a))
end
local defaultGetColor = love.graphics.getColor
function love.graphics.getColor()
return love.math.colorToBytes(defaultGetColor())
end
local defaultSetBackgroundColor = love.graphics.setBackgroundColor
function love.graphics.setBackgroundColor(r, g, b, a)
if type(r) == "table" then r, g, b, a = unpack(r) end
return defaultSetBackgroundColor(love.math.colorFromBytes(r, g, b, a))
end
local defaultGetBackgroundColor = love.graphics.getBackgroundColor
function love.graphics.getBackgroundColor()
return love.math.colorToBytes(defaultGetBackgroundColor())
end
local defaultClear = love.graphics.clear
function love.graphics.clear(r, g, b, a, ...)
if r ~= nil and g ~= nil and b ~= nil then
r, g, b, a = love.math.colorFromBytes(r, g, b, a)
end
return defaultClear(r, g, b, a, ...)
end
local defaultPrint = love.graphics.print
function love.graphics.print(text, ...)
return defaultPrint(convertText(text), ...)
end
local defaultPrintf = love.graphics.printf
function love.graphics.printf(text, ...)
return defaultPrintf(convertText(text), ...)
end
local defaultNewText = love.graphics.newText
function love.graphics.newText(font, text, ...)
return defaultNewText(font, convertText(text), ...)
end
local Text = debug.getregistry().Text
local defaultTextSet = Text.set
function Text:set(text, ...)
return defaultTextSet(self, convertText(text), ...)
end
local defaultTextSetf = Text.setf
function Text:setf(text, ...)
return defaultTextSetf(self, convertText(text), ...)
end
local defaultTextAdd = Text.add
function Text:add(text, ...)
return defaultTextAdd(self, convertText(text), ...)
end
local defaultTextAddf = Text.addf
function Text:addf(text, ...)
return defaultTextAddf(self, convertText(text), ...)
end
local SpriteBatch = debug.getregistry().SpriteBatch
local defaultSpriteBatchSetColor = SpriteBatch.setColor
function SpriteBatch:setColor(...)
return defaultSpriteBatchSetColor(self, love.math.colorFromBytes(...))
end
local defaultSpriteBatchGetColor = SpriteBatch.getColor
function SpriteBatch:getColor(...)
return love.math.colorToBytes(defaultSpriteBatchGetColor(self, ...))
end
local ImageData = debug.getregistry().ImageData -- TODO: use FFI by default? not sure if fetching the pointer constantly will actually be efficient
local defaultImageDataSetPixel = ImageData.setPixel
function ImageData:setPixel(x, y, ...)
return defaultImageDataSetPixel(self, x, y, love.math.colorFromBytes(...))
end
local defaultImageDataGetPixel = ImageData.getPixel
function ImageData:getPixel(...)
return love.math.colorToBytes(defaultImageDataGetPixel(self, ...))
end
local defaultImageDataMapPixel = ImageData.mapPixel
function ImageData:mapPixel(pixelFunction, ...)
return defaultImageDataMapPixel(self, function(x, y, r, g, b, a)
local nr, ng, nb, na = pixelFunction(x, y, love.math.colorToBytes(r, g, b, a))
if nr == nil then return r, g, b, a end
return love.math.colorFromBytes(nr, ng, nb, na)
end, ...)
end
-- TODO: ParticleSystem, linear/gamma functions, points, newMesh, [gs]etVertex
----- MAIN -----
require("utils")
hardloadhttps()
local debugconsole = false --debug
if debugconsole then debuginputon = true; debuginput = "print()"; print("DEBUG ON") end
local debugGraph,fpsGraph,memGraph,drawGraph
local debugGraphs = false
VERSION = 13.2002
VERSIONSTRING = "13.2 (10/26/2024)"
ANDROIDVERSION = 18
android = (love.system.getOS() == "Android" or love.system.getOS() == "iOS") --[DROID]
androidtest = false--testing android on pc
local loadingbarv = 0 --0-1
local loadingbardraw = function(add)
love.graphics.clear()
love.graphics.push()
if android then
love.graphics.scale(winwidth/(width*16*scale), winheight/(224*scale))
end
love.graphics.setColor(150, 150, 150)
properprint("loading mari0..", ((width*16)*scale)/2-string.len("loading mari0..")*4*scale, 20*scale)
love.graphics.setColor(50, 50, 50)
local scale2 = scale
if scale2 <= 1 then
scale2 = 0.5
else
scale2 = 1
end
properprint(loadingtext, ((width*16)*scale)/2-string.len(loadingtext)*4*scale, ((height*16)*scale)/2+165*scale2)
if FamilyFriendly then
love.graphics.setColor(255, 255, 255)
properprint("stys.eu", ((width*16)*scale)/2-string.len("stys.eu")*4*scale, 110*scale)
else
love.graphics.setColor(255, 255, 255)
love.graphics.draw(logo, ((width*16)*scale)/2, ((height*16)*scale)/2, 0, scale2, scale2, 142, 150)
end
loadingbarv = loadingbarv + (add)/(8)
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", 0, (height*16-3)*scale, (width*16*loadingbarv)*scale, 3*scale)
love.graphics.pop()
love.graphics.present()
end
function love.load()
loadingbarv = 0
marioversion = 1006
versionstring = "version 1.6"
shaderlist = love.filesystem.getDirectoryItems( "shaders/" )
dlclist = {"dlc_a_portal_tribute", "dlc_acid_trip", "dlc_escape_the_lab", "dlc_scienceandstuff", "dlc_smb2J", "dlc_the_untitled_game"}
magicdns_session_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
magicdns_session = ""
for i = 1, 8 do
rand = math.random(string.len(magicdns_session_chars))
magicdns_session = magicdns_session .. string.sub(magicdns_session_chars, rand, rand)
end
--use love.filesystem.getIdentity() when it works
magicdns_identity = love.filesystem.getSaveDirectory():split("/")
magicdns_identity = string.upper(magicdns_identity[#magicdns_identity])
local rem
for i, v in pairs(shaderlist) do
if v == "init.lua" then
rem = i
else
shaderlist[i] = string.sub(v, 1, string.len(v)-5)
end
end
table.remove(shaderlist, rem)
table.insert(shaderlist, 1, "none")
currentshaderi1 = 1
currentshaderi2 = 1
if android and not androidtest then
love.filesystem.setIdentity("mari0_android") --[DROID]
else
love.filesystem.setIdentity("mari0")
end
local ok, result = pcall(loadconfig)
if not ok then
print("Corrupt settings: " .. tostring(result))
players = 1
defaultconfig()
end
saveconfig()
if fourbythree then
width = 16
else
width = 25
end
height = 14 --?
fsaa = 0
fullscreen = true
resizable = true;
if scale == 2 and resizable then
changescale(5, fullscreen)
else
changescale(scale, fullscreen)
end
love.window.setTitle( "Mari0: AE" )
love.window.setIcon(love.image.newImageData("graphics/icon.png"))
love.graphics.setDefaultFilter("nearest", "nearest")
love.graphics.setBackgroundColor(0, 0, 0)
logo = love.graphics.newImage("graphics/stabyourself.png") --deleted later to save memory
logoblood = love.graphics.newImage("graphics/stabyourselfblood.png")
--UTF8 Font
fontimage = love.graphics.newImage("graphics/SMB/font.png")
fontbackimage = love.graphics.newImage("graphics/SMB/fontback.png")
font = love.graphics.newFont("font.fnt", "graphics/SMB/font.png")
fontback = love.graphics.newFont("font.fnt", "graphics/SMB/fontback.png")
fontCAP = love.graphics.newFont("fontcap.fnt", "graphics/SMB/font.png")
fontbackCAP = love.graphics.newFont("fontcap.fnt", "graphics/SMB/fontback.png")
--gamefont = font
--gamefontback = fontback
--gamefontCAP = fontCAP
--gamefontbackCAp = fontbackCAP
love.graphics.setFont(font)
utf8 = require("utf8")
local t = require("libs.utf8_simple")
utf8.chars = t.chars
utf8.sub = t.sub
fontglyphs = [[
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789 ⇒←→↑↓
.!?,:;'"-_+=><#%&*()[]{}/\
@©~¡¿°^$£€¥
ÁÂÀÄÅÃÆÇÉÊÈËÍÎÌÏÑÓÔÒÖÕØŒÚÛ
ÙÜŠÝŸẞÞÐĆŃŚŹĄĘŁĈĜĤĴŜŬŽİŞƏĞ
áâàäåãæçéêèëíîìïñóôòöõøœúû
ùüšýÿßþðćńśźąęłĉĝĥĵŝŭžışəğ
АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШ
ЩЪЫЬЭЮЯ№«»„
абвгдеёжзийклмнопрстуфхцчш
щъыьэюя
]]
fontglyphs = fontglyphs:gsub(" ","")
fontquads = {}
fontquadsback = {}
fontindexCAP = {} --all uppercase
fontindexOLD = {} --old font with all uppercase and U=up D=down A=, B=-
--local out = string.format("chars count=%s\n", utf8.len(fontglyphs:gsub("\n",""))) --Export font.fnt (doesn't)
local s = fontglyphs:split("\n")
for line = 1, #s do
for i, c, b in utf8.chars(s[line]) do
fontquads[c] = love.graphics.newQuad((i-1)*10+1, (line-1)*10+1, 8, 8, fontimage:getWidth(),fontimage:getHeight())
fontquadsback[c] = love.graphics.newQuad((i-1)*10, (line-1)*10, 10, 10, fontimage:getWidth(),fontimage:getHeight())
--UPPER CASE
local ci = c
if line == 2 then
ci = utf8.sub(s[1],i,i)
elseif line == 8 or line == 9 then
ci = utf8.sub(s[line-2],i,i)
elseif line == 12 or line == 13 then
ci = utf8.sub(s[line-2],i,i)
end
fontindexCAP[c] = ci
--export font.fnt layout
--out = out .. string.format("char id=%d x=%d y=%d width=10 height=10 xoffset=-1 yoffset=0 xadvance=8 page=0 chnl=15\n", utf8.codepoint(c), (i-1)*10, (line-1)*10)
--Capitals
--local qx,qy = fontquads[ci]:getViewport()
--out = out .. string.format("char id=%d x=%d y=%d width=10 height=10 xoffset=-1 yoffset=0 xadvance=8 page=0 chnl=15\n", utf8.codepoint(c), qx-1,qy-1)
end
end
--love.system.setClipboardText(out)
fontindexCAP["{"] = "←"
fontindexCAP["}"] = "→"
for j, w in pairs(fontindexCAP) do
fontindexOLD[j] = w
end
fontindexOLD["A"] = ","
fontindexOLD["B"] = "-"
fontindexOLD["D"] = "↓"
fontindexOLD["U"] = "↑"
if love.filesystem.getInfo("alesans_entities/familyfriendly.txt") then FamilyFriendly = true end
math.randomseed(os.time());math.random();math.random()
--intro
loadingtexts = {"reticulating splines", "rendering important stuff", "01110000011011110110111001111001", "sometimes, i dream about cheese",
"baking cake", "happy explosion day", "raising coolness by a fifth", "yay facepunch", "stabbing myself", "sharpening knives",
"tanaka, thai kick", "loading game genie..", "slime will find you", "becoming self-aware", "it's a secret to everybody", "there is no minus world",
"oh my god, jc, a bomb", "silly loading message here", "motivational art by jorichi", "you're my favorite deputy",
"licensed under wtfpl", "banned in australia", "loading anti-piracy module", "watch out there's a sni", "attack while its tail's up!",
"what a horrible night to have a curse", "han shot first", "establishing connection to nsa servers..","how do i programm",
"making palette inaccurate..", "y cant mario crawl?", "please hold..", "avoiding lawsuits", "loading bugs", "traduciendo a ingles",
"fixign typo..", "swing your arms", "this message will self destruct in 3 2 1", "preparing deadly neurotoxin", "loading asleons entetis..",
"now with online multiplayer", "any second now..", "all according to keikaku", "we need pow blocks!", "cross your fingers",
"not accurate to the nes!", "improved stability to enhance user experience.", "0118 999 881 999 119 7253", "hoo-ray",
"removing herobrine", "how do i play multiplayer????", "not mario maker", "hello there", "this statement is false",
"zap to the extreme", "it just works", "eat your arms", "travelling qpus...", "im a tire", "in real life!", "bold and brash",
"giant enemy crabs", "but im super duper, with a big tuper", "see that mountain? you can climb it", "loading alesan99's stuff"}
loadingtext = loadingtexts[math.random(#loadingtexts)]
loadingbardraw(1)
--require ALL the files!
require "shaders"
require "spriteloader"
require "variables"
require "mappack"
require "class"
require "sha1"
require "netplay"
JSON = require "JSON"
require "notice"
require "languages"
local luas = {"intro", "menu", "levelscreen", "game", "editor", "physics", "online", "quad", "animatedquad", "entity", "dailychallenge",
"portalwall", "tile", "mario", "mushroom", "hatconfigs", "flower", "star", "coinblockanimation",
"scrollingscore", "platform", "platformspawner", "portalparticle", "portalprojectile", "box", "emancipationgrill", "door",
"button", "groundlight", "wallindicator", "walltimer", "lightbridge", "faithplate", "laser", "laserdetector", "gel", "geldispenser",
"cubedispenser", "pushbutton", "screenboundary", "fireball", "gui", "blockdebris", "firework", "vine", "spring", "seesaw",
"seesawplatform", "bubble", "rainboom", "miniblock", "notgate", "musicloader", "smbsitem",
"donut", "levelball", "leaf", "mariotail", "windleaf", "energylauncher", "energycatcher", "blocktogglebutton", "squarewave",
"delayer", "coin", "funnel", "longfire", "pedestal", "portalent", "text", "regiontrigger", "tiletool",
"enemytool", "randomizer", "yoshi", "musicchanger", "mariohammer", "regiondrag", "flipblock",
"characters", "checkpoint", "onlinemenu", "lobby", "magic", "doorsprite", "enemies", "enemy", "itemanimation", "cappy",
"emancipationfizzle", "emancipateanimation", "ceilblocker", "belt", "hatloader", "poof", "animationguiline", "animation",
"animationsystem", "animationtrigger", "dialogbox", "portal", "orgate", "andgate", "animatedtiletrigger", "rsflipflop", "animatedtimer",
"collectable", "powblock", "smallspring", "risingwater", "redseesaw", "snakeblock", "frozencoin", "entitytooltip", "spawnanimation",
"camerastop", "clearpipe", "track", "tilemoving", "laserfield", "checkpointflag", "ice", "pipe", "errorwindow", "filebrowser"}
for i = 1, #luas do
require(luas[i])
end
print("done loading .luas!")
loadingbardraw(1)
local enemyluas = love.filesystem.getDirectoryItems("enemies")
for i = 1, #enemyluas do
require("enemies." .. enemyluas[i]:sub(1, enemyluas[i]:len()-4))
end
print("done loading enemies!")
loadingbardraw(1)
--json error window
JSONcrashgame = true
jsonerrorwindow = errorwindow:new("","")
--internet connection
http = require("socket.http")
http.TIMEOUT = 1
credited = true
http.TIMEOUT = 7
graphicspack = "SMB" --SMB, ALLSTARS
playertypei = 1
playertype = playertypelist[playertypei] --portal, minecraft
if volume == 0 then
soundenabled = false
else
soundenabled = true
end
love.filesystem.createDirectory("mappacks")
love.filesystem.createDirectory("saves")
love.filesystem.createDirectory("alesans_entities")
love.filesystem.createDirectory("alesans_entities/mappacks")
love.filesystem.createDirectory("alesans_entities/saves")
love.filesystem.createDirectory("alesans_entities/onlinemappacks")
love.filesystem.createDirectory("alesans_entities/characters")
love.filesystem.createDirectory("alesans_entities/hats")
--[[copy included zip dlcs to save folder (because of course you can't mount from source directory :/)
local zips = love.filesystem.getDirectoryItems("alesans_entities/dlc_mappacks")
if #zips > 0 then
for j, w in pairs(zips) do
if not love.filesystem.getInfo("alesans_entities/onlinemappacks/" .. w) then
local filedata = love.filesystem.newFileData("alesans_entities/dlc_mappacks/" .. w)
love.filesystem.write("alesans_entities/onlinemappacks/" .. w, filedata)
if j == 1 and not love.filesystem.getInfo("alesans_entities/onlinemappacks/" .. w) then
break
end
end
end
end]]
--mount dlc zip files
if onlinedlc then
mountalldlc()
end
if checkmappack and love.filesystem.getInfo(mappackfolder .. "/" .. checkmappack .. "/") then
mappack = checkmappack
checkmappack = nil
saveconfig()
end
if love.filesystem.getInfo("suspend") then
convertoldsuspendfile()
end
loadingbardraw(1)
--check date for daily challenges
datet = {os.date("%m"),os.date("%d"),os.date("%Y")}
DChigh = {"-", "-", "-"}
DChightemp = false
if love.filesystem.getInfo("alesans_entities/dc.txt") then
local s = love.filesystem.read("alesans_entities/dc.txt")
local s2 = s:split("~")
DCcompleted = tonumber(s2[1])
if s2[2] == datet[1] .. "/" .. datet[2] .. "/" .. datet[3] then
DChigh[1] = "finished"
DChightemp = true
end
else
DCcompleted = 0
end
DCchalobjective = select(2, getdailychallenge())
DCchalobjectivet = {""} --wrap the text so it won't look ugly in the menu
local splt = DCchalobjective:split(" ")
local i = 1
while splt[i] do
if (DCchalobjectivet[#DCchalobjectivet] .. splt[i] .. " "):len() <= 15 then
DCchalobjectivet[#DCchalobjectivet] = DCchalobjectivet[#DCchalobjectivet] .. splt[i] .. " "
i = i + 1
else
table.insert(DCchalobjectivet, "")
end
end
--nitpicks
loadnitpicks()
loadcustomplayers()
editormode = false
yoffset = 0
love.graphics.setPointSize(3*scale)
love.graphics.setLineWidth(3*scale)
uispace = math.floor(width*16*scale/4)
guielements = {}
--limit hats
for playerno = 1, players do
for i = 1, #mariohats[playerno] do
if mariohats[playerno][i] > hatcount then
mariohats[playerno][i] = hatcount
end
end
end
defaultcustomtext("initial")
loadcustomtext()
loadingbardraw(1)
--custom players
--loadplayer()
--Backgroundcolors
backgroundcolor = {}
backgroundcolor[1] = {92, 148, 252}
backgroundcolor[2] = {0, 0, 0}
backgroundcolor[3] = {32, 56, 236}
backgroundcolor[4] = {0, 0, 0} --custom
--[[backgroundcolor[5] = {60, 188, 252}
backgroundcolor[6] = {168, 228, 252}
backgroundcolor[7] = {252, 216, 168}
backgroundcolor[8] = {252, 188, 176}
backgroundcolor[9] = {24, 60, 92}]]
--IMAGES--
menuselectimg = love.graphics.newImage("graphics/" .. graphicspack .. "/menuselect.png")
mappackback = love.graphics.newImage("graphics/GUI/mappackback.png")
mappacknoicon = love.graphics.newImage("graphics/GUI/mappacknoicon.png")
mappackonlineicon = love.graphics.newImage("graphics/GUI/mappackonlineicon.png")
mappackloadingicon = love.graphics.newImage("graphics/GUI/mappackloading.png")
mappackoverlay = love.graphics.newImage("graphics/GUI/mappackoverlay.png")
mappackhighlight = love.graphics.newImage("graphics/GUI/mappackhighlight.png")
mappackscrollbar = love.graphics.newImage("graphics/GUI/mappackscrollbar.png")
uparrowimg = love.graphics.newImage("graphics/GUI/uparrow.png")
downarrowimg = love.graphics.newImage("graphics/GUI/downarrow.png")
customenemyiconimg = love.graphics.newImage("graphics/GUI/customenemy.png")
pathmarkerimg = love.graphics.newImage("graphics/GUI/pathmarker.png")
trackmarkerimg = love.graphics.newImage("graphics/GUI/trackmarker.png")
antsimg = love.graphics.newImage("graphics/GUI/ants.png")
markbaseimg = love.graphics.newImage("graphics/markbase.png")
markoverlayimg = love.graphics.newImage("graphics/markoverlay.png")
--tiles
smbtilesimg = love.graphics.newImage("graphics/" .. graphicspack .. "/smbtiles.png")
portaltilesimg = love.graphics.newImage("graphics/" .. graphicspack .. "/portaltiles.png")
entitiesimg = love.graphics.newImage("graphics/" .. graphicspack .. "/entities.png")
tilequads = {}
rgblist = {}
--add smb tiles
loadtiles("smb", "initial")
--add portal tiles
loadtiles("portal", "initial")
--add entities
entityquads = {}
loadtiles("entity", "initial")
--formated entities list
entitiesform = {
{name = "level markers",
1,8,100,312,11, --erase and start
21,--[[161,]]31,--[[233,256,]]81, --pipes (possibly combine them later?)
257, --celing block (possibly camera block too?)
23,24,25, 89, 33,34, 95,96, 131,132, 159,160, --zones
35, --drag in
304,--camera stop
},
{name = "platforming elements",
309,--[[18,19,]]32,41,--[[42,]]92,80,289, --platforms
258,137, --donut
148,278, --block like entities
266,287, --conveyors
290, --snake block
93,122,281,282, --springs
14,219,--vines
163,248,249,250, --doors
79,--[[82,]]265,191, 228, --fire
315, --grinder
285,164, --water
211,292,293, 178,208,279,179,180,--buttons
300,301, --helmet boxes
302,--clear pipe
306,317--tracks!
},
{name = "items",
--[[297,]]2,3,101,4,187,296,5, --regulars
121,269,217,218,113, --smbs items
299,202,155,141,151,252,253,254,255,239,311,193,286,307,308, --new powerups
207, --yoshi
154, --? Ball
},
{name = "enemies",
6,--[[9,]]103,114,237,118,--[[119,]] --goomba
7,--[[10,]]117,78,158,116, 12,--[[13,]]77, 156,--[[157,]] --koopa, red, blue
98,--[[99,]]263,261,115, --spiny
75,--[[76,]]209,262,130, --beetle
212,--[[213,]] --spiketop
70,102,123,124,147,149,129,305, --plants
15,120,241,138,221, --hammer bros
16,17,298,184, 94,162,242, --fishies (and bloopers)
22,83,264, 109,110, --lakitu and sun
188, --fuzzy
60,246,104,105,150,--[[192,]]303,145,--[[146,]] --bullets and military stuff
142,260,247, 111,--[[112,]]--boos and splunkins
--[[125,]]224,283,284,234,259, 127,--[[128,]]288,126,133,--[[134,]]235,--[[236,]]135,136, 97, --castle stuffs
90,91,153,238,316,240, --bowser bosses
106,216,107,108,280, --smbs enemies
203,--[[204,]]140,214,215,--smb2 enemies
139,152,189,190, --flying beetles
--[[143,]]314,144,223, --moles
220, 243, 244,251, 245, 294,295, --mario maker enemies
313, --super size
},
{name = "i/o objects",
275,210,271,270,291,200,199,276,277,201,205},
{name = "gates",
30,74, --not really logic gates
84,274,273,186,272,185,206},
{name = "portal elements",
20,165,222, --cubes
40,267,268, 68,--[[69,]] --buttons
28,--[[29,]] --doors
--[[26,]]27,--[[311,]] --emancipation and laserfield
36,--[[37,38,39,]] 52,--[[53,54,55,]] 56,--[[57,58,59,]] --lasers
43,44,45,46,47,48, --powerline
49,--[50,51,]] --faithplate
67, 61,--[[62,63, 64,65,66, 71,72,73, 181,182,183, 225,226,227,]] --dispensers
85,--[[86,87,88,]] --gel
166,--[[167,168,169,]] 170,--[[171,172,173,]] --energy launcher
174,--[[175, 176,177,]] 194, --turrets
195, --glados
196,
197,198, --portals
231,--[[229,230,232]] --funnels
310,--pneumatic tube (just clearpipe but shhh)
},
{name = "custom enemies",
},
}
local namespacing = 10
local ly = 0 --listy
for list = 1, #entitiesform do
ly = ly + namespacing
entitiesform[list].y = ly
entitiesform[list].h = 17*(math.ceil(#entitiesform[list]/22))
ly = ly + entitiesform[list].h
end
--check if entities are missing because i'm stupid
--[[local entitycheck = {}
for i = 1, entitiescount do
entitycheck[i] = 0 --false
end
for j, form in pairs(entitiesform) do
for i = 1, #form do
entitycheck[form[i] ] = entitycheck[form[i] ] + 1-- = true
end
end
for j, w in pairs(entitycheck) do
local s = w
if s == 0 then
s = "false"
else
s = "true " .. s
end
print(j .. " - " .. s)
end]]
--sledge bro shock
shockimg = love.graphics.newImage("graphics/" .. graphicspack .. "/shock.png")
shockquad = {}
shockquad[1] = love.graphics.newQuad(0, 0, 4, 25, 8, 25)
shockquad[2] = love.graphics.newQuad(4, 0, 4, 25, 8, 25)
--if lights out mode isn't supported on device
mariolightimg = love.graphics.newImage("graphics/" .. graphicspack .. "/mariolight.png")
calendarimg = love.graphics.newImage("graphics/" .. graphicspack .. "/calendar.png")
--menut tips
menutips = {"resize the game window by changing the scale to 'resizable' in the options!",
"download dlc mappacks by going to the dlc tab in the mappack menu!",
"is there a problem with the mod? tell me at the stabyourself.net forums!",
"there are currently about " .. math.floor(entitiescount-100) .. " new entities in this mod! try them out!",
--"change your mappack folder to 'alesans_entities/mappacks' in the options to prevent crashes when you use unmodded mari0!",
"lock your mouse with f12!",
"display fps with f11!",
"experienced an error? post your error found in 'mari0/alesans_entities/crashes' at the stabyourself.net forums!",
"you can access the mari0 folder easily by pressing 'm' in the mappack selection menu!",
"try out the dlc mappacks!",
"try out today's daily challenge by going to the mappack selection menu and going to the 'daily challenge' tab!",
"finish the super mario bros. mappack to unlock something special!",
"turn on assist mode in the editor by pressing the +/equal sign key!",
"play with friends online! press the left key to start!",
"enter fullscreen with alt and enter.",
"change your character in the settings!",
"add more playable characters in the 'mari0/alesans_entities/characters' folder."}
disabletips = false
loadingbardraw(1)
------------------------------
------------QUADS-------------
------------------------------
numberglyphs = "012458"
font2quads = {}
for i = 1, 6 do
font2quads[string.sub(numberglyphs, i, i)] = love.graphics.newQuad((i-1)*4, 0, 4, 8, 32, 8)
end
directionsimg = love.graphics.newImage("graphics/GUI/directions.png")
local directionquadnames = {"hor", "ver", "left", "up", "right", "down", "cw", "ccw", "left up", "right up", "left down", "right down"}
directionsquad = {}
for x = 1, #directionquadnames do
directionsquad[directionquadnames[x]] = love.graphics.newQuad((x-1)*7, 0, 7, 7, #directionquadnames*7, 7)
end
pathmarkerquad = {
love.graphics.newQuad(0, 0, 16, 16, 64, 48),
love.graphics.newQuad(16, 0, 16, 16, 64, 48),
love.graphics.newQuad(0, 16, 32, 16, 64, 48),
love.graphics.newQuad(0, 32, 32, 16, 64, 48),
love.graphics.newQuad(32, 16, 32, 32, 64, 48),
}
trackmarkerquad = {
love.graphics.newQuad(0, 0, 16, 16, 64, 16),
love.graphics.newQuad(16, 0, 16, 16, 64, 16),
love.graphics.newQuad(32, 0, 16, 16, 64, 16),
love.graphics.newQuad(48, 0, 16, 16, 64, 16),
}
linktoolpointerimg = love.graphics.newImage("graphics/GUI/linktoolpointer.png")
local pipedirs = {"up", "left", "down", "right", "default", ""}
pipesimg = love.graphics.newImage("graphics/GUI/pipes.png")
pipesquad = {}
for y = 1, 4 do
pipesquad[y] = {}
for x = 1, 6 do
pipesquad[y][pipedirs[x]] = love.graphics.newQuad((x-1)*16, (y-1)*16, 16, 16, 96, 64)
end
end
loadquads(true)
--portals
portalquad = {}
for i = 0, 7 do
portalquad[i] = love.graphics.newQuad(0, i*4, 32, 4, 32, 28)
end
--portals
portal1quad = {}
for i = 0, 7 do
portal1quad[i] = love.graphics.newQuad(0, i*4, 32, 4, 64, 32)
end
portal2quad = {}
for i = 0, 7 do
portal2quad[i] = love.graphics.newQuad(32, i*4, 32, 4, 64, 32)
end
--Portal props
pushbuttonquad = {}
for y = 1, 4 do
pushbuttonquad[y] = {}
for x = 1, 2 do
pushbuttonquad[y][x] = love.graphics.newQuad(16*(x-1), 16*(y-1), 16, 16, 32, 64)
end
end
buttonquad = {}
for y = 1, 4 do
buttonquad[y] = {}
for i = 1, 3 do
buttonquad[y][i] = {}
for x = 1, 2 do
buttonquad[y][i][x] = love.graphics.newQuad(64*(i-1)+32*(x-1), 5*(y-1), 32, 5, 192, 20)
end
end
end
wallindicatorquad = {}
for y = 1, 4 do
wallindicatorquad[y] = {love.graphics.newQuad(0, 16*(y-1), 16, 16, 32, 64), love.graphics.newQuad(16, 16*(y-1), 16, 16, 32, 64)}
end
walltimerquad = {}
for y = 1, 4 do
walltimerquad[y] = {}
for i = 1, 10 do
walltimerquad[y][i] = love.graphics.newQuad((i-1)*16, (y-1)*16, 16, 16, 160, 64)
end
end
excursionquad = {}
for x = 1, 8 do
excursionquad[x] = love.graphics.newQuad((x-1)*8, 0, 8, 32, 64, 32)
end
gelquad = {love.graphics.newQuad(0, 0, 12, 12, 36, 12), love.graphics.newQuad(12, 0, 12, 12, 36, 12), love.graphics.newQuad(24, 0, 12, 12, 36, 12)}
--ground lights
groundlightquad = {}
for s = 1, 4 do
groundlightquad[s] = {}
for x = 1, 6 do
groundlightquad[s][x] = {}
for y = 1, 2 do
groundlightquad[s][x][y] = love.graphics.newQuad((x-1)*16, (s-1)*32+(y-1)*16, 16, 16, 96, 128)
end
end
end
--turrets
turretquad = {}
for x = 1, 2 do
turretquad[x] = love.graphics.newQuad((x-1)*12, 0, 12, 14, 24, 14)
end
--cube dispenser
cubedispenserquad = {}
for y = 1, 4 do
cubedispenserquad[y] = love.graphics.newQuad(0, (y-1)*32, 32, 32, 32, 128)
end
--gel dispensers
geldispenserquad = {}
for y = 1, 4 do
geldispenserquad[y] = {}
for x = 1, 5 do
geldispenserquad[y][x] = love.graphics.newQuad((x-1)*32, (y-1)*32, 32, 32, 160, 128)
end
end
--faithplate
faithplatequad = {}
for y = 1, 4 do
faithplatequad[y] = love.graphics.newQuad(0, (y-1)*16, 32, 16, 32, 32)
end
--laserdetector
laserdetectorquad = {}
for x = 1, 2 do
laserdetectorquad[x] = love.graphics.newQuad((x-1)*16, 0, 16, 16, 32, 16)
end
--emanceside
emancesidequad = {}
for y = 1, 4 do
emancesidequad[y] = {}
for x = 1, 2 do
emancesidequad[y][x] = love.graphics.newQuad((x-1)*5, (y-1)*8, 5, 8, 10, 32)
end
end
--ice
icequad = {}
for i = 1, 9 do
icequad[i] = love.graphics.newQuad((((i-1)%3))*8, math.floor(i/3-.1)*8, 8, 8, 24, 24)
end
bunnyearsimg = love.graphics.newImage("graphics/" .. graphicspack .. "/bunnyears.png")
bunnyearsquad = {}
for x = 1, 3 do
bunnyearsquad[x] = love.graphics.newQuad((x-1)*15, 0, 15, 7, 30, 7)
end
capeimg = love.graphics.newImage("graphics/" .. graphicspack .. "/cape.png")
capequad = {}
for x = 1, 19 do
capequad[x] = love.graphics.newQuad((x-1)*16, 0, 16, 34, 304, 34)
end
--eh
rainboomquad = {}
for x = 1, 7 do
for y = 1, 7 do
rainboomquad[x+(y-1)*7] = love.graphics.newQuad((x-1)*204, (y-1)*182, 204, 182, 1428, 1274)
end
end
--magic!
magicimg = love.graphics.newImage("graphics/magic.png")
magicquad = {}
for x = 1, 6 do
magicquad[x] = love.graphics.newQuad((x-1)*9, 0, 9, 9, 54, 9)
end
--GUI
checkboximg = love.graphics.newImage("graphics/GUI/checkbox.png")
checkboxquad = {{love.graphics.newQuad(0, 0, 9, 9, 18, 18), love.graphics.newQuad(9, 0, 9, 9, 18, 18)}, {love.graphics.newQuad(0, 9, 9, 9, 18, 18), love.graphics.newQuad(9, 9, 9, 9, 18, 18)}}
dropdownarrowimg = love.graphics.newImage("graphics/GUI/dropdownarrow.png")
quickmenuarrowimg = love.graphics.newImage("graphics/GUI/quickmenuarrow.png")
customimagebackimg = love.graphics.newImage("graphics/GUI/customimageback.png")
tilepropertiesimg = love.graphics.newImage("graphics/tileproperties.png")
mappackonlineiconquad = {}
mappackonlineiconquad[1] = love.graphics.newQuad(0, 0, 50, 50, 64, 64)
mappackonlineiconquad[2] = love.graphics.newQuad(50, 0, 14, 14, 64, 64)
mappackonlineiconquad[3] = love.graphics.newQuad(50, 14*1, 14, 14, 64, 64)
mappackonlineiconquad[4] = love.graphics.newQuad(50, 14*2, 14, 14, 64, 64)
mappackonlineiconquad[5] = love.graphics.newQuad(50, 14*3, 14, 14, 64, 64)
mappackonlineiconquad[6] = love.graphics.newQuad(0, 50, 14, 14, 64, 64)
mappackonlineiconquad[7] = love.graphics.newQuad(14, 50, 14, 14, 64, 64)
hudclockquad = {}
hudclockquad[false] = love.graphics.newQuad(0, 0, 10, 9, 10, 18)
hudclockquad[true] = love.graphics.newQuad(0, 9, 10, 9, 10, 18) --outline
--Portal FX
portalgunimg = love.graphics.newImage("graphics/" .. graphicspack .. "/portalgun.png")
portalparticleimg = love.graphics.newImage("graphics/" .. graphicspack .. "/portalparticle.png")
portalcrosshairimg = love.graphics.newImage("graphics/" .. graphicspack .. "/portalcrosshair.png")
portaldotimg = love.graphics.newImage("graphics/" .. graphicspack .. "/portaldot.png")
portalprojectileimg = love.graphics.newImage("graphics/" .. graphicspack .. "/portalprojectile.png")
portalprojectileparticleimg = love.graphics.newImage("graphics/" .. graphicspack .. "/portalprojectileparticle.png")
--Menu shit
huebarimg = love.graphics.newImage("graphics/GUI/huebar.png")
huebarmarkerimg = love.graphics.newImage("graphics/GUI/huebarmarker.png")
volumesliderimg = love.graphics.newImage("graphics/GUI/volumeslider.png")
laserfieldimg = love.graphics.newImage("graphics/" .. graphicspack .. "/laserfield.png")
gradientimg = love.graphics.newImage("graphics/gradient.png");gradientimg:setFilter("linear", "linear")
rainboomimg = love.graphics.newImage("graphics/rainboom.png")
--sprites
customsprites = false
loadcustomsprites(true)
--Ripping off
minecraftbreakimg = love.graphics.newImage("graphics/Minecraft/blockbreak.png")
minecraftbreakquad = {}
for i = 1, 10 do
minecraftbreakquad[i] = love.graphics.newQuad((i-1)*16, 0, 16, 16, 160, 16)
end
minecraftgui = love.graphics.newImage("graphics/Minecraft/gui.png")
minecraftselected = love.graphics.newImage("graphics/Minecraft/selected.png")
minecraftpickaxeimg = love.graphics.newImage("graphics/Minecraft/pickaxe.png")
minecraftpickaxequad = {}
for y = 1, 5 do
minecraftpickaxequad[y] = love.graphics.newQuad(0, (y-1)*20, 20, 20, 20, 100)
end
print("done loading all quads!")
loadingbardraw(1)
--AUDIO--
--sounds
jumpsound = love.audio.newSource("sounds/jump.ogg", "static")
jumpbigsound = love.audio.newSource("sounds/jumpbig.ogg", "static")