forked from Stabyourself/mari0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.lua
2228 lines (1911 loc) · 64.4 KB
/
menu.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
function menu_load()
love.audio.stop()
editormode = false
gamestate = "menu"
selection = 1
coinanimation = 1
love.graphics.setBackgroundColor(92, 148, 252)
scrollsmoothrate = 4
optionstab = 2
optionsselection = 1
skinningplayer = 1
rgbselection = 1
mappackselection = 1
onlinemappackselection = 1
mappackhorscroll = 0
mappackhorscrollsmooth = 0
checkpointx = false
love.graphics.setBackgroundColor(backgroundcolor[1])
controlstable = {"left", "right", "up", "down", "run", "jump", "reload", "use", "aimx", "aimy", "portal1", "portal2"}
portalanimation = 1
portalanimationtimer = 0
portalanimationdelay = 0.08
infmarioY = 0
infmarioR = 0
infmarioYspeed = 200
infmarioRspeed = 4
RGBchangespeed = 200/255
huechangespeed = 0.5
spriteset = 1
portalcolors = {}
for i = 1, players do
portalcolors[i] = {}
end
continueavailable = false
if love.filesystem.getInfo("suspend.txt") then
continueavailable = true
end
mariolevel = 1
marioworld = 1
mariosublevel = 0
--load 1-1 as background
loadbackground("1-1.txt")
skipupdate = true
end
function menu_update(dt)
--coinanimation
coinanimation = coinanimation + dt*6.75
while coinanimation >= 6 do
coinanimation = coinanimation - 5
end
if mappackscroll then
--smooth the scroll
if mappackscrollsmooth > mappackscroll then
mappackscrollsmooth = mappackscrollsmooth - (mappackscrollsmooth-mappackscroll)*dt*5-0.1*dt
if mappackscrollsmooth < mappackscroll then
mappackscrollsmooth = mappackscroll
end
elseif mappackscrollsmooth < mappackscroll then
mappackscrollsmooth = mappackscrollsmooth - (mappackscrollsmooth-mappackscroll)*dt*5+0.1*dt
if mappackscrollsmooth > mappackscroll then
mappackscrollsmooth = mappackscroll
end
end
end
if onlinemappackscroll then
--smooth the scroll
if onlinemappackscrollsmooth > onlinemappackscroll then
onlinemappackscrollsmooth = onlinemappackscrollsmooth - (onlinemappackscrollsmooth-onlinemappackscroll)*dt*5-0.1*dt
if onlinemappackscrollsmooth < onlinemappackscroll then
onlinemappackscrollsmooth = onlinemappackscroll
end
elseif onlinemappackscrollsmooth < onlinemappackscroll then
onlinemappackscrollsmooth = onlinemappackscrollsmooth - (onlinemappackscrollsmooth-onlinemappackscroll)*dt*5+0.1*dt
if onlinemappackscrollsmooth > onlinemappackscroll then
onlinemappackscrollsmooth = onlinemappackscroll
end
end
end
if mappackhorscroll then
if mappackhorscrollsmooth > mappackhorscroll then
mappackhorscrollsmooth = mappackhorscrollsmooth - (mappackhorscrollsmooth-mappackhorscroll)*dt*5-0.03*dt
if mappackhorscrollsmooth < mappackhorscroll then
mappackhorscrollsmooth = mappackhorscroll
end
elseif mappackhorscrollsmooth < mappackhorscroll then
mappackhorscrollsmooth = mappackhorscrollsmooth - (mappackhorscrollsmooth-mappackhorscroll)*dt*5+0.03*dt
if mappackhorscrollsmooth > mappackhorscroll then
mappackhorscrollsmooth = mappackhorscroll
end
end
end
if gamestate == "options" and optionstab == 2 then
portalanimationtimer = portalanimationtimer + dt
while portalanimationtimer > portalanimationdelay do
portalanimation = portalanimation + 1
if portalanimation > 6 then
portalanimation = 1
end
portalanimationtimer = portalanimationtimer - portalanimationdelay
end
infmarioY = infmarioY + infmarioYspeed*dt
while infmarioY > 64 do
infmarioY = infmarioY - 64
end
infmarioR = infmarioR + infmarioRspeed*dt
while infmarioR > math.pi*2 do
infmarioR = infmarioR - math.pi*2
end
if optionsselection > 3 and optionsselection < 13 then
local colornumber = math.floor((optionsselection-1)/3)
local colorRGB = math.fmod(optionsselection-4, 3)+1
if love.keyboard.isDown("right") and mariocolors[skinningplayer][colornumber][colorRGB] < 1 then
mariocolors[skinningplayer][colornumber][colorRGB] = mariocolors[skinningplayer][colornumber][colorRGB] + RGBchangespeed*dt
if mariocolors[skinningplayer][colornumber][colorRGB] > 1 then
mariocolors[skinningplayer][colornumber][colorRGB] = 1
end
elseif love.keyboard.isDown("left") and mariocolors[skinningplayer][colornumber][colorRGB] > 0 then
mariocolors[skinningplayer][colornumber][colorRGB] = mariocolors[skinningplayer][colornumber][colorRGB] - RGBchangespeed*dt
if mariocolors[skinningplayer][colornumber][colorRGB] < 0 then
mariocolors[skinningplayer][colornumber][colorRGB] = 0
end
end
elseif optionsselection == 13 then
if love.keyboard.isDown("right") and portalhues[skinningplayer][1] < 1 then
portalhues[skinningplayer][1] = portalhues[skinningplayer][1] + huechangespeed*dt
if portalhues[skinningplayer][1] > 1 then
portalhues[skinningplayer][1] = 1
end
portalcolor[skinningplayer][1] = getrainbowcolor(portalhues[skinningplayer][1])
elseif love.keyboard.isDown("left") and portalhues[skinningplayer][1] > 0 then
portalhues[skinningplayer][1] = portalhues[skinningplayer][1] - huechangespeed*dt
if portalhues[skinningplayer][1] < 0 then
portalhues[skinningplayer][1] = 0
end
portalcolor[skinningplayer][1] = getrainbowcolor(portalhues[skinningplayer][1])
end
elseif optionsselection == 14 then
if love.keyboard.isDown("right") and portalhues[skinningplayer][2] < 1 then
portalhues[skinningplayer][2] = portalhues[skinningplayer][2] + huechangespeed*dt
if portalhues[skinningplayer][2] > 1 then
portalhues[skinningplayer][2] = 1
end
portalcolor[skinningplayer][2] = getrainbowcolor(portalhues[skinningplayer][2])
elseif love.keyboard.isDown("left") and portalhues[skinningplayer][2] > 0 then
portalhues[skinningplayer][2] = portalhues[skinningplayer][2] - huechangespeed*dt
if portalhues[skinningplayer][2] < 0 then
portalhues[skinningplayer][2] = 0
end
portalcolor[skinningplayer][2] = getrainbowcolor(portalhues[skinningplayer][2])
end
end
end
end
function menu_draw()
--GUI LIBRARY?! Never heard of that.
--I'm not proud of this at all; But I'm even lazier than not proud.
--TILES
love.graphics.translate(0, yoffset*scale)
local xtodraw
if mapwidth < width+1 then
xtodraw = mapwidth
else
if mapwidth > width then
xtodraw = width+1
else
xtodraw = width
end
end
--custom background
if custombackground then
for i = #custombackgroundimg, 1, -1 do
for y = 1, math.ceil(15/custombackgroundheight[i]) do
for x = 1, math.ceil(width/custombackgroundwidth[i])+1 do
love.graphics.draw(custombackgroundimg[i], math.floor(((x-1)*custombackgroundwidth[i])*16*scale), (y-1)*custombackgroundheight[i]*16*scale, 0, scale, scale)
end
end
end
end
local coinframe
if math.floor(coinanimation) == 4 then
coinframe = 2
elseif math.floor(coinanimation) == 5 then
coinframe = 1
else
coinframe = math.max(1, math.floor(coinanimation))
end
for y = 1, 15 do
for x = 1, xtodraw do
local t = map[x][y]
local tilenumber = tonumber(t[1])
if tilequads[tilenumber].coinblock and tilequads[tilenumber].invisible == false then --coinblock
love.graphics.draw(coinblockimage, coinblockquads[spriteset][coinframe], math.floor((x-1)*16*scale), ((y-1)*16-8)*scale, 0, scale, scale)
elseif tilenumber ~= 0 and tilequads[tilenumber].invisible == false then
love.graphics.draw(tilequads[tilenumber].image, tilequads[tilenumber].quad, math.floor((x-1)*16*scale), ((y-1)*16-8)*scale, 0, scale, scale)
end
end
end
---UI
properprint("mario", uispace*.5 - 24*scale, 8*scale)
properprint("000000", uispace*0.5-24*scale, 16*scale)
properprint("*", uispace*1.5-8*scale, 16*scale)
love.graphics.draw(coinanimationimage, coinanimationquads[1][coinframe], uispace*1.5-16*scale, 16*scale, 0, scale, scale)
properprint("00", uispace*1.5-0*scale, 16*scale)
properprint("world", uispace*2.5 - 20*scale, 8*scale)
properprint("1-1", uispace*2.5 - 12*scale, 16*scale)
properprint("time", uispace*3.5 - 16*scale, 8*scale)
for j = 1, players do
--draw player
love.graphics.setColor(1, 1, 1, 1)
for k = 1, 3 do
love.graphics.setColor(unpack(mariocolors[j][k]))
love.graphics.draw(skinpuppet[k], (startx*16-6)*scale+8*(j-1)*scale, (starty*16-23)*scale, 0, scale, scale)
end
--hat
offsets = hatoffsets["idle"]
if #mariohats[j] > 1 or mariohats[j][1] ~= 1 then
local yadd = 0
for i = 1, #mariohats[j] do
love.graphics.setColor(1, 1, 1)
love.graphics.draw(hat[mariohats[j][i]].graphic, (startx*16-11)*scale+8*(j-1)*scale, (starty*16-25)*scale, 0, scale, scale, - hat[mariohats[j][i]].x + offsets[1], - hat[mariohats[j][i]].y + offsets[2] + yadd)
yadd = yadd + hat[mariohats[j][i]].height
end
elseif #mariohats[j] == 1 then
love.graphics.setColor(mariocolors[j][1])
love.graphics.draw(hat[mariohats[j][1]].graphic, (startx*16-11)*scale+8*(j-1)*scale, (starty*16-25)*scale, 0, scale, scale, - hat[mariohats[j][1]].x + offsets[1], - hat[mariohats[j][1]].y + offsets[2])
end
love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw(skinpuppet[0], (startx*16-6)*scale+8*(j-1)*scale, (starty*16-23)*scale, 0, scale, scale)
end
love.graphics.setColor(1, 1, 1, 1)
if gamestate == "menu" then
love.graphics.draw(titleimage, 40*scale, 24*scale, 0, scale, scale)
if updatenotification then
love.graphics.setColor(1, 0, 0)
properprint("version outdated!|go to stabyourself.net|to download latest", 220*scale, 90*scale)
love.graphics.setColor(1, 1, 1, 1)
end
if selection == 0 then
love.graphics.draw(menuselection, 73*scale, (137+(selection-1)*16)*scale, 0, scale, scale)
elseif selection == 1 then
love.graphics.draw(menuselection, 73*scale, (137+(selection-1)*16)*scale, 0, scale, scale)
elseif selection == 2 then
love.graphics.draw(menuselection, 81*scale, (137+(selection-1)*16)*scale, 0, scale, scale)
elseif selection == 3 then
love.graphics.draw(menuselection, 73*scale, (137+(selection-1)*16)*scale, 0, scale, scale)
elseif selection == 4 then
love.graphics.draw(menuselection, 98*scale, (137+(selection-1)*16)*scale, 0, scale, scale)
end
local start = 9
if custombackground then
start = 1
end
for i = start, 9 do
local tx, ty = -scale, scale
love.graphics.setColor(0, 0, 0)
if i == 2 then
tx, ty = scale, scale
elseif i == 3 then
tx, ty = -scale, -scale
elseif i == 4 then
tx, ty = scale, -scale
elseif i == 5 then
tx, ty = 0, -scale
elseif i == 6 then
tx, ty = 0, scale
elseif i == 7 then
tx, ty = scale, 0
elseif i == 8 then
tx, ty = -scale, 0
elseif i == 9 then
tx, ty = 0, 0
love.graphics.setColor(1, 1, 1)
end
love.graphics.translate(tx, ty)
if continueavailable then
properprint("continue game", 87*scale, 122*scale)
end
properprint("player game", 103*scale, 138*scale)
properprint("level editor", 95*scale, 154*scale)
properprint("select mappack", 87*scale, 170*scale)
properprint("options", 111*scale, 186*scale)
properprint(players, 87*scale, 138*scale)
love.graphics.translate(-tx, -ty)
end
if players > 1 then
love.graphics.draw(playerselectimg, 82*scale, 138*scale, 0, scale, scale)
end
if players < 4 then
love.graphics.draw(playerselectimg, 102*scale, 138*scale, 0, -scale, scale)
end
if selectworldopen then
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", 30*scale, 92*scale, 200*scale, 60*scale)
love.graphics.setColor(1, 1, 1)
drawrectangle(31, 93, 198, 58)
properprint("select world", 83*scale, 105*scale)
for i = 1, 8 do
if selectworldcursor == i then
love.graphics.setColor(1, 1, 1)
elseif reachedworlds[mappack][i] then
love.graphics.setColor(0.8, 0.8, 0.8)
elseif selectworldexists[i] then
love.graphics.setColor(0.2, 0.2, 0.2)
else
love.graphics.setColor(0, 0, 0)
end
properprint(i, (55+(i-1)*20)*scale, 130*scale)
if i == selectworldcursor then
properprint("v", (55+(i-1)*20)*scale, 120*scale)
end
end
end
elseif gamestate == "mappackmenu" then
--background
love.graphics.setColor(0, 0, 0, 0.2)
love.graphics.rectangle("fill", 21*scale, 16*scale, 218*scale, 200*scale)
love.graphics.setColor(1, 1, 1, 1)
--set scissor
love.graphics.setScissor(21*scale, 16*scale, 218*scale, 200*scale)
if loadingonlinemappacks then
love.graphics.setColor(0, 0, 0, 0.8)
love.graphics.rectangle("fill", 21*scale, 16*scale, 218*scale, 200*scale)
love.graphics.setColor(1, 1, 1, 1)
properprint("a little patience..|downloading " .. currentdownload .. " of " .. downloadcount, 50*scale, 30*scale)
drawrectangle(50, 55, 152, 10)
love.graphics.rectangle("fill", 50*scale, 55*scale, 152*((currentfiledownload-1)/(filecount-1))*scale, 10*scale)
else
love.graphics.translate(-round(mappackhorscrollsmooth*scale*mappackhorscrollrange), 0)
if mappackhorscrollsmooth < 1 then
--draw each butten (even if all you do, is press ONE. BUTTEN.)
--scrollbar offset
love.graphics.translate(0, -round(mappackscrollsmooth*60*scale))
love.graphics.setScissor(240*scale, 16*scale, 200*scale, 200*scale)
love.graphics.setColor(0, 0, 0, 0.8)
love.graphics.rectangle("fill", 240*scale, 81*scale, 115*scale, 61*scale)
love.graphics.setColor(1, 1, 1)
if not savefolderfailed then
properprint("press right to|access the dlc||press m to|open your|mappack folder", 241*scale, 83*scale)
else
properprint("press right to|access the dlc||could not|open your|mappack folder", 241*scale, 83*scale)
end
love.graphics.setScissor(21*scale, 16*scale, 218*scale, 200*scale)
for i = 1, #mappacklist do
--back
love.graphics.draw(mappackback, 25*scale, (20+(i-1)*60)*scale, 0, scale, scale)
--icon
if mappackicon[i] ~= nil then
local scale2w = scale*50 / math.max(1, mappackicon[i]:getWidth())
local scale2h = scale*50 / math.max(1, mappackicon[i]:getHeight())
love.graphics.draw(mappackicon[i], 29*scale, (24+(i-1)*60)*scale, 0, scale2w, scale2h)
else
love.graphics.draw(mappacknoicon, 29*scale, (24+(i-1)*60)*scale, 0, scale, scale)
end
love.graphics.draw(mappackoverlay, 29*scale, (24+(i-1)*60)*scale, 0, scale, scale)
--name
love.graphics.setColor(0.8, 0.8, 0.8)
if mappackselection == i then
love.graphics.setColor(1, 1, 1)
end
properprint(string.sub(mappackname[i]:lower(), 1, 17), 83*scale, (26+(i-1)*60)*scale)
--author
love.graphics.setColor(0.4, 0.4, 0.4)
if mappackselection == i then
love.graphics.setColor(0.4, 0.4, 0.4)
end
if mappackauthor[i] then
properprint(string.sub("by " .. mappackauthor[i]:lower(), 1, 16), 91*scale, (35+(i-1)*60)*scale)
end
--description
love.graphics.setColor(0.5, 0.5, 0.5)
if mappackselection == i then
love.graphics.setColor(0.7, 0.7, 0.7)
end
if mappackdescription[i] then
properprint( string.sub(mappackdescription[i]:lower(), 1, 17), 83*scale, (47+(i-1)*60)*scale)
if mappackdescription[i]:len() > 17 then
properprint( string.sub(mappackdescription[i]:lower(), 18, 34), 83*scale, (56+(i-1)*60)*scale)
end
if mappackdescription[i]:len() > 34 then
properprint( string.sub(mappackdescription[i]:lower(), 35, 51), 83*scale, (65+(i-1)*60)*scale)
end
end
love.graphics.setColor(1, 1, 1)
--highlight
if i == mappackselection then
love.graphics.draw(mappackhighlight, 25*scale, (20+(i-1)*60)*scale, 0, scale, scale)
end
end
love.graphics.translate(0, round(mappackscrollsmooth*60*scale))
local i = mappackscrollsmooth / (#mappacklist-3.233)
love.graphics.draw(mappackscrollbar, 227*scale, (20+i*160)*scale, 0, scale, scale)
end
love.graphics.translate(round(mappackhorscrollsmooth*scale*mappackhorscrollrange), 0)
----------
--ONLINE--
----------
love.graphics.translate(round(mappackhorscrollrange*scale - mappackhorscrollsmooth*scale*mappackhorscrollrange), 0)
if mappackhorscrollsmooth > 0 then
if #onlinemappacklist == 0 then
properprint("something went wrong|| sorry d:||maybe your internet|does not work right?", 40*scale, 80*scale)
end
love.graphics.setScissor()
love.graphics.setColor(0, 0, 0, 0.8)
love.graphics.rectangle("fill", 241*scale, 16*scale, 150*scale, 200*scale)
love.graphics.setColor(1, 1, 1)
properprint("wanna contribute?|make a mappack and|send an email to|mappack at|stabyourself.net!||include your map-|pack! you can find|it in your appdata|love/mari0 dir.", 244*scale, 19*scale)
if outdated then
love.graphics.setColor(1, 0, 0)
properprint("version outdated!|you have an old|version of mari0!|mappacks could not|be downloaded.|go to|stabyourself.net|to download latest", 244*scale, 130*scale)
love.graphics.setColor(1, 1, 1)
elseif downloaderror then
love.graphics.setColor(1, 0, 0)
properprint("download error!|something went|wrong while|downloading|mappacks.|press left and|right to try|again. sorry.", 244*scale, 130*scale)
love.graphics.setColor(1, 1, 1)
end
love.graphics.setScissor(21*scale, 16*scale, 218*scale, 200*scale)
--scrollbar offset
love.graphics.translate(0, -round(onlinemappackscrollsmooth*60*scale))
for i = 1, #onlinemappacklist do
--back
love.graphics.draw(mappackback, 25*scale, (20+(i-1)*60)*scale, 0, scale, scale)
--icon
if onlinemappackicon[i] ~= nil then
love.graphics.draw(onlinemappackicon[i], 29*scale, (24+(i-1)*60)*scale, 0, scale, scale)
else
love.graphics.draw(mappacknoicon, 29*scale, (24+(i-1)*60)*scale, 0, scale, scale)
end
love.graphics.draw(mappackoverlay, 29*scale, (24+(i-1)*60)*scale, 0, scale, scale)
--name
love.graphics.setColor(0.8, 0.8, 0.8)
if onlinemappackselection == i then
love.graphics.setColor(1, 1, 1)
end
properprint(string.sub(onlinemappackname[i]:lower(), 1, 17), 83*scale, (26+(i-1)*60)*scale)
--author
love.graphics.setColor(0.4, 0.4, 0.4)
if onlinemappackselection == i then
love.graphics.setColor(0.4, 0.4, 0.4)
end
if onlinemappackauthor[i] then
properprint(string.sub("by " .. onlinemappackauthor[i]:lower(), 1, 16), 91*scale, (35+(i-1)*60)*scale)
end
--description
love.graphics.setColor(0.5, 0.5, 0.5)
if onlinemappackselection == i then
love.graphics.setColor(0.7, 0.7, 0.7)
end
if onlinemappackdescription[i] then
properprint( string.sub(onlinemappackdescription[i]:lower(), 1, 17), 83*scale, (47+(i-1)*60)*scale)
if onlinemappackdescription[i]:len() > 17 then
properprint( string.sub(onlinemappackdescription[i]:lower(), 18, 34), 83*scale, (56+(i-1)*60)*scale)
end
if onlinemappackdescription[i]:len() > 34 then
properprint( string.sub(onlinemappackdescription[i]:lower(), 35, 51), 83*scale, (65+(i-1)*60)*scale)
end
end
love.graphics.setColor(1, 1, 1)
--highlight
if i == onlinemappackselection then
love.graphics.draw(mappackhighlight, 25*scale, (20+(i-1)*60)*scale, 0, scale, scale)
end
end
love.graphics.translate(0, round(onlinemappackscrollsmooth*60*scale))
local i = onlinemappackscrollsmooth / (#onlinemappacklist-3.233)
love.graphics.draw(mappackscrollbar, 227*scale, (20+i*160)*scale, 0, scale, scale)
end
love.graphics.translate(- round(mappackhorscrollrange*scale - mappackhorscrollsmooth*scale*mappackhorscrollrange), 0)
end
love.graphics.setScissor()
if mappackhorscroll == 0 then
love.graphics.setColor(1, 1, 1)
love.graphics.rectangle("fill", 22*scale, 3*scale, 44*scale, 13*scale)
love.graphics.setColor(0, 0, 0)
properprint("local", 23*scale, 6*scale)
drawrectangle(22, 3, 44, 13)
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", 70*scale, 3*scale, 29*scale, 13*scale)
love.graphics.setColor(1, 1, 1)
properprint("dlc", 72*scale, 6*scale)
else
love.graphics.setColor(0, 0, 0)
love.graphics.rectangle("fill", 22*scale, 3*scale, 44*scale, 13*scale)
love.graphics.setColor(1, 1, 1)
properprint("local", 23*scale, 6*scale)
love.graphics.setColor(1, 1, 1)
love.graphics.rectangle("fill", 70*scale, 3*scale, 29*scale, 13*scale)
love.graphics.setColor(0, 0, 0)
properprint("dlc", 72*scale, 6*scale)
drawrectangle(70, 3, 29, 13)
end
elseif gamestate == "onlinemenu" then
if CLIENT == false and SERVER == false then
properprint("press c for client", 70*scale, 100*scale)
properprint("press s for server", 70*scale, 160*scale)
properprint("run away to quit", 78*scale, 170*scale)
elseif CLIENT then
properprint("waiting for server..", 62*scale, 100*scale)
elseif SERVER then
properprint("press enter to start!", 62*scale, 100*scale)
end
elseif gamestate == "options" then
love.graphics.setColor(0, 0, 0, 0.8)
love.graphics.rectangle("fill", 21*scale, 16*scale, 218*scale, 200*scale)
--Controls tab head
if optionstab == 1 then
love.graphics.setColor(0.4, 0.4, 0.4, 0.4)
love.graphics.rectangle("fill", 25*scale, 20*scale, 67*scale, 11*scale)
end
if optionstab == 1 and optionsselection == 1 then
love.graphics.setColor(1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("controls", 26*scale, 22*scale)
--Skins tab head
if optionstab == 2 then
love.graphics.setColor(0.4, 0.4, 0.4, 0.4)
love.graphics.rectangle("fill", 96*scale, 20*scale, 43*scale, 11*scale)
end
if optionstab == 2 and optionsselection == 1 then
love.graphics.setColor(1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("skins", 97*scale, 22*scale)
--Miscellaneous tab head
if optionstab == 3 then
love.graphics.setColor(0.4, 0.4, 0.4, 0.4)
love.graphics.rectangle("fill", 145*scale, 20*scale, 39*scale, 11*scale)
end
if optionstab == 3 and optionsselection == 1 then
love.graphics.setColor(1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("misc.", 146*scale, 22*scale)
--Cheat tab head
if optionstab == 4 then
love.graphics.setColor(0.4, 0.4, 0.4, 0.4)
love.graphics.rectangle("fill", 190*scale, 20*scale, 43*scale, 11*scale)
end
if optionstab == 4 and optionsselection == 1 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4, 1)
end
properprint("cheat", 191*scale, 22*scale)
love.graphics.setColor(1, 1, 1, 1)
if optionstab == 1 then
--CONTROLS
if optionsselection == 2 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4, 1)
end
properprint("edit player:" .. skinningplayer, 74*scale, 40*scale)
if optionsselection == 3 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4, 1)
end
if mouseowner == skinningplayer then
properprint("uses the mouse: yes", 46*scale, 52*scale)
else
properprint("uses the mouse: no", 46*scale, 52*scale)
end
for i = 1, #controlstable do
if mouseowner ~= skinningplayer or i <= 8 then
if optionsselection == 3+i then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4, 1)
end
properprint(controlstable[i], 30*scale, (70+(i-1)*12)*scale)
local s = ""
if controls[skinningplayer][controlstable[i]] then
for j = 1, #controls[skinningplayer][controlstable[i]] do
s = s .. controls[skinningplayer][controlstable[i]][j]
end
end
if s == " " then
s = "space"
end
properprint(s, 120*scale, (70+(i-1)*12)*scale)
end
end
if keyprompt then
love.graphics.setColor(0, 0, 0, 1)
love.graphics.rectangle("fill", 30*scale, 100*scale, 200*scale, 60*scale)
love.graphics.setColor(1, 1, 1, 1)
drawrectangle(30, 100, 200, 60)
if controlstable[optionsselection-3] == "aimx" then
properprint("move stick right", 40*scale, 110*scale)
elseif controlstable[optionsselection-3] == "aimy" then
properprint("move stick down", 40*scale, 110*scale)
else
properprint("press key for '" .. controlstable[optionsselection-3] .. "'", 40*scale, 110*scale)
end
properprint("press 'esc' to cancel", 40*scale, 140*scale)
if buttonerror then
love.graphics.setColor(0.8, 0, 0)
properprint("you can only set", 40*scale, 120*scale)
properprint("buttons for this", 40*scale, 130*scale)
elseif axiserror then
love.graphics.setColor(0.8, 0, 0)
properprint("you can only set", 40*scale, 120*scale)
properprint("axes for this", 40*scale, 130*scale)
end
end
elseif optionstab == 2 then
--SKINS
if optionsselection == 2 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4, 1)
end
properprint("edit player:" .. skinningplayer, 74*scale, 32*scale)
--PREVIEW MARIO IN BIG. WITH BIG LETTERS
love.graphics.setColor(1, 1, 1, 1)
for i = 1, 3 do
love.graphics.setColor(unpack(mariocolors[skinningplayer][i]))
love.graphics.draw(skinpuppet[i], 80*scale, 42*scale, 0, scale*2, scale*2)
end
--hat
offsets = hatoffsets["idle"]
if #mariohats[skinningplayer] > 1 or mariohats[skinningplayer][1] ~= 1 then
local yadd = 0
for i = 1, #mariohats[skinningplayer] do
love.graphics.setColor(1, 1, 1)
love.graphics.draw(hat[mariohats[skinningplayer][i]].graphic, 70*scale, 38*scale, 0, scale*2, scale*2, - hat[mariohats[skinningplayer][i]].x + offsets[1], - hat[mariohats[skinningplayer][i]].y + offsets[2] + yadd)
yadd = yadd + hat[mariohats[skinningplayer][i]].height
end
elseif #mariohats[skinningplayer] == 1 then
love.graphics.setColor(mariocolors[skinningplayer][1])
love.graphics.draw(hat[mariohats[skinningplayer][1]].graphic, 70*scale, 38*scale, 0, scale*2, scale*2, - hat[mariohats[skinningplayer][1]].x + offsets[1], - hat[mariohats[skinningplayer][1]].y + offsets[2])
end
love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw(skinpuppet[0], 80*scale, 42*scale, 0, scale*2, scale*2)
--PREVIEW PORTALS WITH FALLING MARIO BECAUSE I CAN AND IT LOOKS RAD
love.graphics.setScissor(142*scale, 42*scale, 32*scale, 32*scale)
for j = 1, 3 do
love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw(secondskinpuppet[0], 158*scale, (2+((j-1)*32)+infmarioY)*scale, infmarioR, scale, scale, 8, 8)
for i = 1, 3 do
love.graphics.setColor(unpack(mariocolors[skinningplayer][i]))
love.graphics.draw(secondskinpuppet[i], 158*scale, (2+((j-1)*32)+infmarioY)*scale, infmarioR, scale, scale, 8, 8)
end
end
local portalframe = portalanimation
love.graphics.setColor(1, 1, 1, (80 - math.abs(portalframe-3)*10)/255)
love.graphics.draw(portalglow, 174*scale, 59*scale, math.pi, scale, scale)
love.graphics.draw(portalglow, 142*scale, 57*scale, 0, scale, scale)
love.graphics.setColor(unpack(portalcolor[skinningplayer][1]))
love.graphics.draw(portalimage, portal1quad[portalframe], 174*scale, 46*scale, math.pi, scale, scale)
love.graphics.setColor(unpack(portalcolor[skinningplayer][2]))
love.graphics.draw(portalimage, portal1quad[portalframe], 142*scale, 70*scale, 0, scale, scale)
love.graphics.setScissor()
--HAT
if optionsselection == 3 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
if mariohats[skinningplayer][1] == nil then
properprint("hat: none", (79)*scale, 80*scale)
else
properprint("hat: " .. mariohats[skinningplayer][1], (95-string.len(mariohats[skinningplayer][1])*4)*scale, 80*scale)
end
love.graphics.setColor(1, 1, 1, 1)
--WHITE BACKGROUND FOR RGB BARS
if optionsselection > 3 and optionsselection < 13 then
love.graphics.rectangle("fill", 69*scale, 89*scale + math.fmod(optionsselection-4, 3)*10*scale + math.floor((optionsselection-4)/3)*14*scale, 142*scale, 10*scale)
end
if math.floor((optionsselection-1)/3) == 1 then
love.graphics.setColor(1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("hat", 35*scale, 90*scale)
if math.floor((optionsselection-1)/3) == 2 then
love.graphics.setColor(1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("hair", 31*scale, 114*scale)
if math.floor((optionsselection-1)/3) == 3 then
love.graphics.setColor(1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("skin", 31*scale, 138*scale)
for i = 1, 3 do
if math.floor((optionsselection-1)/3) == i then
love.graphics.setColor(0.4, 0, 0)
properprint("r", 70*scale, (91+(i-1)*14)*scale)
love.graphics.setColor(1, 0, 0)
properprint("r", 69*scale, (90+(i-1)*14)*scale)
love.graphics.setColor(0, 0.4, 0)
properprint("g", 70*scale, (101+(i-1)*14)*scale)
love.graphics.setColor(0, 1, 0)
properprint("g", 69*scale, (100+(i-1)*14)*scale)
love.graphics.setColor(0, 0, 0.4)
properprint("b", 70*scale, (111+(i-1)*14)*scale)
love.graphics.setColor(0, 0, 1)
properprint("b", 69*scale, (110+(i-1)*14)*scale)
end
end
for j = 1, 3 do
if math.floor((optionsselection-1)/3) == j then
love.graphics.setColor(0.4, 0, 0)
love.graphics.rectangle("fill", 81*scale, (91+(j-1)*14)*scale, math.floor(129*scale * (mariocolors[skinningplayer][j][1])), 7*scale)
love.graphics.setColor(1, 0, 0)
love.graphics.rectangle("fill", 80*scale, (90+(j-1)*14)*scale, math.floor(129*scale * (mariocolors[skinningplayer][j][1])), 7*scale)
love.graphics.setColor(0, 0.4, 0)
love.graphics.rectangle("fill", 81*scale, (101+(j-1)*14)*scale, math.floor(129*scale * (mariocolors[skinningplayer][j][2])), 7*scale)
love.graphics.setColor(0, 1, 0)
love.graphics.rectangle("fill", 80*scale, (100+(j-1)*14)*scale, math.floor(129*scale * (mariocolors[skinningplayer][j][2])), 7*scale)
love.graphics.setColor(0, 0, 0.4)
love.graphics.rectangle("fill", 81*scale, (111+(j-1)*14)*scale, math.floor(129*scale * (mariocolors[skinningplayer][j][3])), 7*scale)
love.graphics.setColor(0, 0, 1)
love.graphics.rectangle("fill", 80*scale, (110+(j-1)*14)*scale, math.floor(129*scale * (mariocolors[skinningplayer][j][3])), 7*scale)
end
end
--Portalhues
--hue
local alpha = 0.4
if optionsselection == 13 then
alpha = 1
end
love.graphics.setColor(1, 1, 1, alpha)
properprint("coop portal 1 color:", 31*scale, 150*scale)
love.graphics.draw(huebarimg, 32*scale, 170*scale, 0, scale, scale)
--marker
love.graphics.setColor(unpack(portalcolor[skinningplayer][1]))
love.graphics.rectangle("fill", math.floor(29 + (portalhues[skinningplayer][1])*178)*scale, 161*scale, 7*scale, 6*scale)
love.graphics.setColor(alpha, alpha, alpha)
love.graphics.draw(huebarmarkerimg, math.floor(28 + (portalhues[skinningplayer][1])*178)*scale, 160*scale, 0, scale, scale)
alpha = 0.4
if optionsselection == 14 then
alpha = 1
end
love.graphics.setColor(1, 1, 1, alpha)
properprint("coop portal 2 color:", 31*scale, 180*scale)
love.graphics.draw(huebarimg, 32*scale, 200*scale, 0, scale, scale)
--marker
love.graphics.setColor(unpack(portalcolor[skinningplayer][2]))
love.graphics.rectangle("fill", math.floor(29 + (portalhues[skinningplayer][2])*178)*scale, 191*scale, 7*scale, 6*scale)
love.graphics.setColor(alpha, alpha, alpha)
love.graphics.draw(huebarmarkerimg, math.floor(28 + (portalhues[skinningplayer][2])*178)*scale, 190*scale, 0, scale, scale)
elseif optionstab == 3 then
if optionsselection == 2 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("scale:", 30*scale, 40*scale)
properprint(scale, (180-string.len(scale)*8)*scale, 40*scale)
if optionsselection == 3 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("shader1:", 30*scale, 55*scale)
properprint(string.lower(shaderlist[currentshaderi1]), (180-string.len(shaderlist[currentshaderi1])*8)*scale, 55*scale)
if optionsselection == 4 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("shader2:", 30*scale, 65*scale)
properprint(string.lower(shaderlist[currentshaderi2]), (180-string.len(shaderlist[currentshaderi2])*8)*scale, 65*scale)
love.graphics.setColor(0.4, 0.4, 0.4)
properprint("shaders will really", 30*scale, 80*scale)
properprint("reduce performance!", 30*scale, 90*scale)
if optionsselection == 5 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("volume:", 30*scale, 105*scale)
drawrectangle(90, 108, 90, 1)
drawrectangle(90, 105, 1, 7)
drawrectangle(179, 105, 1, 7)
love.graphics.draw(volumesliderimg, math.floor((89+89*volume)*scale), 105*scale, 0, scale, scale)
if optionsselection == 6 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("reset game mappacks", 30*scale, 120*scale)
if optionsselection == 7 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("reset all settings", 30*scale, 135*scale)
if optionsselection == 8 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("vsync:", 30*scale, 150*scale)
if vsync then
properprint("on", (180-16)*scale, 150*scale)
else
properprint("off", (180-24)*scale, 150*scale)
end
love.graphics.setColor(0.4, 0.4, 0.4)
properprint("you can lock the|mouse with f12", 30*scale, 165*scale)
love.graphics.setColor(1, 1, 1, 1)
properprint(versionstring, 150*scale, 207*scale)
elseif optionstab == 4 then
love.graphics.setColor(1, 1, 1, 1)
if not gamefinished then
properprint("unlock this by completing", 30*scale, 40*scale)
properprint("the original levels pack!", 30*scale, 50*scale)
else
properprint("have fun with these!", 30*scale, 45*scale)
end
if optionsselection == 2 then
love.graphics.setColor(1, 1, 1, 1)
else
love.graphics.setColor(0.4, 0.4, 0.4)
end
properprint("mode:", 30*scale, 65*scale)
properprint("{" .. playertype .. "}", (180-(string.len(playertype)+2)*8)*scale, 65*scale)