-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfactory.wren
3158 lines (2929 loc) · 149 KB
/
factory.wren
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
// title: Continous Factory
// author: unicorns of DEATH
// desc: Conveyor belt puzzle game
// site: https://github.com/UnicornsOfDeath/continuous-factory
// license: MIT License
// version: 1.1
// script: wren
// saveid: continuous-factory
// pal: system-mini-16
import "random" for Random
var WIDTH=240
var HEIGHT=136
var MAP_W=30
var MAP_H=17
var LEVEL=0
var TRICKY_LEVELS=7
var LEVEL_MAP=[
0,
1,
2,
3,
11,
4,
5,
13, // gateturn
17, // reverse
19, // gateturn,reverse
9, // cross
7, // return
6, // gateturn,shortpath
16, // misdirection,shortpath
22, // gateturn,reverse
10, // block,misdirection
15, // misdirection,reverse
12, // gateturn
23,
14, // misdirection,reverse
21, // gateturn
20, // block,misdirection,cross
8, // gateturn,shortpath
18, // misdirection,gateturn,reverse
]
var COLOR_BG=5
var COLOR_KEY=9
var MUSSPLASH=0
var MUSGAME=1
var MUSGAMEPLAYING=false
var MUSTITLE=2
var MUSTEMPO=100
var MUSSPD=3
var FPS=60
var MUSBEATTICKS=FPS*60/MUSTEMPO*MUSSPD/6
var SFXNEXT=1
var SFXDOTASK=2
var SFXSPAWN=3
var SFXCOMPLETE=4
var SFXINCOMPLETE=5
var SFXLEVELEND=6
var RANDOM=Random.new()
var FONTH=5
var IDLETICKS=3600
var UP=0
var RIGHT=1
var DOWN=2
var LEFT=3
// VRAM ADDRESSES
var PALETTE_MAP=0x3FF0
// BUTTONS
var BTN_UP=0
var BTN_DOWN=1
var BTN_LEFT=2
var BTN_RIGHT=3
var BTN_A=4
var BTN_B=5
var BTN_X=6
var BTN_Y=7
// MAP/TASK IDS
var EMPTY_TILE=0
var IN_TILE=16
var OUT_TILE=17
var CONV_R=18
var CONV_L=19
var CONV_U=20
var CONV_D=21
var ERASER=22
var DISK=32
var APPLE=33
var GLASS=34
var WIN=48
var LINUX=49
var HAMMER=50
var DISK_GATE=80
var APPLE_GATE=81
var GLASS_GATE=82
var WIN_GATE=83
var LINUX_GATE=84
var HAMMER_GATE=85
// JOB
var JOB_SPAWN_TICKS=104
var MOVE_TICKS=50
// Map data, for resetting
var MAPRESETS=[]
var AVAILABLEGATES=[]
// Music instruments
// 48 - BD
// 49 - HH
// 50 - soft
// 52 - lead2
// 53 - BD + bass
// 54 - stick + bass short
// 57 - splash bass
// 58 - string
// 59 - pad
// 60 - piano
// 55 - piano delay8
// 56 - piano delay4
// 63 - piano delay2
// 61 - bass
// 62 - bass short
// Star colors, brightest to darkest
var COLORS=[3,2,1,0]
var SPEEDMIN=0.001
var SPEEDMAX=0.02
class Utils {
static rot(x,y,ca,sa){
return [x*ca-y*sa,x*sa+y*ca]
}
static aspr(id,x,y,colorkey,sx,sy,flip,rotate,w,h,ox,oy,shx1,shy1,shx2,shy2){
// Draw a sprite using two textured triangles.
// Apply affine transformations: scale, shear, rotate, flip
// scale / flip
if((flip%2)==1){
sx=-sx
}
if(flip>=2){
sy=-sy
}
ox=ox*-sx
oy=oy*-sy
// shear / rotate
shx1=shx1*-sx
shy1=shy1*-sy
shx2=shx2*-sx
shy2=shy2*-sy
var rr=rotate*Num.pi/180
var sa=rr.sin
var ca=rr.cos
var r1=rot(ox+shx1,oy+shy1,ca,sa)
var r2=rot(w*8*sx+ox+shx1,oy+shy2,ca,sa)
var r3=rot(ox+shx2,h*8*sy+oy+shy1,ca,sa)
var r4=rot(w*8*sx+ox+shx2,h*8*sy+oy+shy2,ca,sa)
var x1 = x + r1[0]
var y1 = y + r1[1]
var x2 = x + r2[0]
var y2 = y + r2[1]
var x3 = x + r3[0]
var y3 = y + r3[1]
var x4 = x + r4[0]
var y4 = y + r4[1]
// UV coords
var u1=(id%16)*8
var v1=(id/16).floor*8
var u2=u1+w*8
var v2=v1+h*8
TIC.ttri(x1,y1,x2,y2,x3,y3,u1,v1,u2,v1,u1,v2,0,colorkey)
TIC.ttri(x3,y3,x4,y4,x2,y2,u1,v2,u2,v2,u2,v1,0,colorkey)
}
static easeOutBack(x){
var c1=1.70158
var c3=c1+1
return 1+c3*(x-1).pow(3)+c1*(x-1).pow(2)
}
static mapX(){
return (LEVEL_MAP[LEVEL]%8)*MAP_W
}
static mapY(){
return (LEVEL_MAP[LEVEL]/8).floor*MAP_H
}
static drawWindow(x,y,w,h) {
TIC.rectb(x,y,w,h,0)
x=x+1
y=y+1
w=w-2
h=h-2
TIC.rectb(x,y,w-1,h-1,3)
TIC.rectb(x+1,y+1,w-1,h-1,1)
x=x+1
y=y+1
w=w-2
h=h-2
TIC.rect(x,y,w,h,2)
}
// Draw a tiled sprite inside a clipping area
static drawtileclip(x,y,w,h,drawf,cx,cy,cw,ch){
TIC.clip(cx,cy,cw,ch)
// Find start of tile drawing
var xstart=x
while(xstart>cx){
xstart=xstart-w
}
while(xstart+w<=cx){
xstart=xstart+w
}
var ystart=y
while(ystart>cy){
ystart=ystart-h
}
while(ystart+h<=cy){
ystart=ystart+h
}
// Draw tiled
y=ystart
while(y<cy+ch){
x=xstart
while(x<cx+cw){
drawf.call(x,y)
x=x+w
}
y=y+h
}
TIC.clip()
}
}
class Star {
construct new(){
_x=WIDTH/2
_y=HEIGHT/2
_dx=RANDOM.float()-0.5
_dy=RANDOM.float()-0.5
var n=norm(_dx,_dy)
_dx=n[0]
_dy=n[1]
// Square rand to skew more slow stars
var s=RANDOM.float()*RANDOM.float()*(SPEEDMAX-SPEEDMIN)+SPEEDMIN
_ddx=_dx*s
_ddy=_dy*s
_dx=_dx*s
_dy=_dy*s
_mag=RANDOM.float()+0.5
}
distance(x1,y1,x2,y2){
var dx=x1-x2
var dy=y1-y2
return (dx*dx+dy*dy).sqrt
}
norm(x,y){
var d=distance(x,y,0,0)
if (d==0){
return [1,0]
}
return [x/d,y/d]
}
update(){
_x=_x+_dx
_y=_y+_dy
_dx=_dx+_ddx
_dy=_dy+_ddy
}
alive{_x>=0&&_x<=WIDTH&&_y>=0&&_y<=HEIGHT}
draw(){
var dfactor=((_x-WIDTH/2).abs+(_y-HEIGHT/2).abs)/(WIDTH/2)
var sfactor=(_dx.abs+_dy.abs-SPEEDMIN)/(SPEEDMAX-SPEEDMIN)/25
var mfactor=(dfactor*sfactor).sqrt
var i=COLORS.count-(mfactor*_mag*COLORS.count).floor.min(COLORS.count-1)-1
TIC.pix(_x,_y,COLORS[i])
}
}
class StarGenerator {
construct new(n,interval){
_n=n
_interval=interval
_counter=0
_stars=[]
}
update(){
// Add new stars
if(_stars.count<_n && _counter==0){
_stars.add(Star.new())
_counter=_interval
}
if(_counter>0){
_counter=_counter-1
}
// Move stars
_stars.each{|s|
s.update()
// Remove stars that are out of bounds
if(!s.alive){
_stars.remove(s)
}
}
}
draw(){
_stars.each{|s|
s.draw()
}
}
}
class ChunkyFont {
static init_() {
__SYM_MAP={
"}":0,
"{":1,
"^":2,
"<":3,
"=":4,
">":5,
"]":6,
"[":7,
"r":16,
"?":17,
"|":18,
"Y":19,
"o":20,
"T":21,
"P":22,
"7":23,
"6":32,
"j":33,
"v":34,
"m":35,
"_":37,
"L":38,
"J":39,
}
__WIDTH=8
__HEIGHT=8
__COLOR1=1
__COLOR2=2
__LETTERS={
"a":[
"",
"r?",
"6v"
],
"b":[
"^",
"]?",
"Lj"
],
"c":[
"",
"r>",
"6>"
],
"d":[
" ^",
"r[",
"6J"
],
"e":[
"",
"r?",
"6>"
],
"f":[
"r>",
"]>",
"v"
],
"g":[
"",
"r7",
"6[",
"<j"
],
"h":[
"^",
"]?",
"vv"
],
"i":[
"o",
"^",
"v"
],
"j":[
" o",
" ^",
" |",
"<j"
],
"k":[
"^",
"]>",
"vo"
],
"l":[
"^",
"|",
"v"
],
"m":[
"",
"PT?",
"vvv"
],
"n":[
"",
"P?",
"vv"
],
"o":[
"",
"r?",
"6j"
],
"p":[
"",
"P?",
"]j",
"v"
],
"q":[
"",
"r7",
"6[",
" v"
],
"r":[
"",
"P>",
"v"
],
"s":[
"",
"r>",
"<j"
],
"t":[
"^",
"]>",
"6>"
],
"u":[
"",
"^^",
"6J"
],
"v":[
"",
"^^",
"Lj"
],
"w":[
"",
"^^^",
"6mj"
],
"x":[
"",
"oo",
"oo"
],
"y":[
"",
"^^",
"6[",
"<j"
],
"z":[
"",
"<?",
"6>"
],
"A":[
"r=?",
"]=[",
"v v"
],
"B":[
"P=?",
"]={",
"L=j"
],
"C":[
"r=>",
"|",
"6=>"
],
"D":[
"P=?",
"| |",
"L=j"
],
"E":[
"P=>",
"]=>",
"L=>"
],
"F":[
"P=>",
"]>",
"v"
],
"G":[
"r=>",
"|<7",
"6=J"
],
"H":[
"^ ^",
"]=[",
"v v"
],
"I":[
"T",
"|",
"_"
],
"J":[
" ^",
"^ |",
"6=j"
],
"K":[
"^ ^",
"]={",
"v v"
],
"L":[
"^",
"|",
"L=>"
],
"M":[
"PY7",
"|v|",
"v v"
],
"N":[
"P?^",
"|||",
"v6J"
],
"O":[
"r=?",
"| |",
"6=j"
],
"P":[
"P=?",
"]=j",
"v"
],
"Q":[
"r=?",
"| |",
"6=o"
],
"R":[
"P=?",
"]={",
"v v"
],
"S":[
"r=>",
"6=?",
"<=j"
],
"T":[
"<T>",
" |",
" v"
],
"U":[
"^ ^",
"| |",
"6=j"
],
"V":[
"^ ^",
"|rj",
"Lj"
],
"W":[
"^ ^",
"|^|",
"6mj"
],
"X":[
"o o",
" o",
"o o"
],
"Y":[
"^ ^",
"6Yj",
" v"
],
"Z":[
"<=7",
"r=j",
"L=>"
]
}
__WIDTHADJ={
"j":-1
}
}
construct new(x,y) {
_x=x
_y=y
}
ch(c) {
var xadj=__WIDTHADJ[c]
if (xadj==null) {
xadj=0
}
var width=0
var y=_y
for (row in __LETTERS[c]) {
var x=_x+xadj*__WIDTH
var rowwidth=0
var hasletter=false
for (i in 0...row.count) {
var letter=row[i]
if (letter!=" ") {
hasletter=true
TIC.spr(__SYM_MAP[letter]+128,x,y,COLOR_KEY)
}
if (hasletter) {
rowwidth=rowwidth+1
}
x=x+__WIDTH
}
y=y+__HEIGHT
width=width.max(rowwidth)
}
_x=_x+(width+xadj)*__WIDTH
}
s(s) {
var x=_x
var readcolor=0
for (i in 0...s.count) {
var c=s[i]
if (c=="\n") {
_x=x
_y=_y+__HEIGHT*4
} else if (c=="^") {
readcolor=1
resetpalette()
} else if (readcolor==1) {
var color=tonumberfromhex(c)
TIC.poke4(PALETTE_MAP * 2 + __COLOR1, color)
readcolor=2
} else if (readcolor==2) {
var color=tonumberfromhex(c)
TIC.poke4(PALETTE_MAP * 2 + __COLOR2, color)
readcolor=0
} else {
ch(c)
}
}
resetpalette()
}
tonumberfromhex(c) {
if (c=="a") {
return 0xa
} else if (c=="b") {
return 0xb
} else if (c=="c") {
return 0xc
} else if (c=="d") {
return 0xd
} else if (c=="e") {
return 0xe
} else if (c=="f") {
return 0xf
} else {
return Num.fromString(c)
}
}
resetpalette() {
TIC.poke4(PALETTE_MAP * 2 + __COLOR1, __COLOR1)
TIC.poke4(PALETTE_MAP * 2 + __COLOR2, __COLOR2)
}
}
ChunkyFont.init_()
var MOUSESPEED=1.5
var CURSORPOINT=[1,0,0]
var CURSORHAND=[2,2,1]
var CURSORNO=[3,3,3]
var CURSORROTIDX=4
class Mouse {
construct new(speed){
_speed=speed
_mouse=TIC.mouse()
_prev=_mouse
_mx=_mouse[0]
_my=_mouse[1]
_mxp=_mouse[0]
_myp=_mouse[1]
_cursor=CURSORPOINT[0]
_dx=CURSORPOINT[1]
_dy=CURSORPOINT[2]
_tooltip=""
_tooltipticks=0
}
mouse{_mouse}
x{_mouse[0]}
y{_mouse[1]}
left{_mouse[2]}
right{_mouse[4]}
moved{_mouse[0]!=_prev[0]||_mouse[1]!=_prev[1]}
leftp{left&&!_prev[2]}
rightp{right&&!_prev[4]}
cursor=(value){
_cursor=value[0]
_dx=value[1]
_dy=value[2]
}
setTooltip(value){
if(_tooltip!=value){
_tooltip=value
_tooltipticks=0
}
}
update(){
_prev=_mouse
_mxp=_mx
_myp=_my
_mouse=TIC.mouse()
_mx=_mouse[0]
_my=_mouse[1]
if(_mx==_mxp&&_my==_myp){
// Mouse did not move, use existing mouse position
_mouse[0]=_prev[0]
_mouse[1]=_prev[1]
if(TIC.btn(BTN_UP)){
_mouse[1]=(_mouse[1]-_speed).max(0)
}else if(TIC.btn(BTN_DOWN)){
_mouse[1]=(_mouse[1]+_speed).min(HEIGHT)
}
if(TIC.btn(BTN_LEFT)){
_mouse[0]=(_mouse[0]-_speed).max(0)
}else if(TIC.btn(BTN_RIGHT)){
_mouse[0]=(_mouse[0]+_speed).min(WIDTH)
}
}
if(TIC.btn(BTN_A)){
_mouse[2]=true
}
if(TIC.btn(BTN_B)){
_mouse[4]=true
}
_tooltipticks=_tooltipticks+1
TIC.poke(0x3FFB,0) // hide cursor
}
draw(){
if(_cursor!=0){
TIC.spr(_cursor,x-_dx,y-_dy,COLOR_KEY)
}
var tooltiplen=((_tooltipticks-60)/3).floor.min(_tooltip.count-1)
if(tooltiplen>0){
var s=_tooltip[0..tooltiplen]
var len=TIC.print(s,WIDTH,HEIGHT,0,false,1,true)
var drawx=(x-_dx+5).min(WIDTH-(len+1))
TIC.rect(drawx,y-_dy+6,len+1,6,3)
TIC.print(s,drawx+1,y-_dy+6,0,false,1,true)
}
}
}
var MOUSE=Mouse.new(MOUSESPEED)
class Button {
x { _x }
x=(value) { _x=value }
y { _y }
y=(value) { _y=value }
width { _width }
height { _height }
wasDown { _wasDown }
wasDown=(value){_wasDown=value}
hover { _hover }
hover=(value){_hover=value}
clicked {_active&&_clicked}
tooltip=(value){_tooltip=value}
fillcolor{_fillcolor}
fillcolor=(value){_fillcolor=value}
bordercolor{_bordercolor}
bordercolor=(value){_bordercolor=value}
construct new(x,y,w,h,bordercolor,fillcolor,hovercolor,shadecolor){
_x=x
_y=y
_bordercolor=bordercolor
_fillcolor=fillcolor
_hovercolor=hovercolor
_shadecolor=shadecolor
_width=w
_height=h
_wasDown=false
_wasHover=false
_hover=false
_clicked=false
_tooltip=null
_active=false
}
draw() {
// border
TIC.rectb(x,y,width,height,_bordercolor)
// highlight/shading
TIC.rectb(x+1,y+1,width-2,height-2,_hovercolor)
TIC.rectb(x+2,y+2,width-3,height-3,_shadecolor)
// fill
var fc=_fillcolor
if (_hover){
fc=_hovercolor
if (wasDown){
fc=_shadecolor
}
}
TIC.rect(x+2,y+2,width-4,height-4,fc)
}
update() {
// Wait until mouse buttons released before allowing button interaction
if(!MOUSE.left&&!MOUSE.right){
_active=true
}
if(!_active){
return
}
_hover=MOUSE.x>=_x && MOUSE.x<=_x+_width && MOUSE.y>=_y && MOUSE.y<=_y+_height
// Change cursor: hand
if (_hover){
MOUSE.cursor=CURSORHAND
if(_tooltip){
MOUSE.setTooltip(_tooltip)
}
}
// Clicking on release
_clicked=false
if (!MOUSE.left && _hover && _wasHover && _wasDown){
_clicked=true
}
_wasHover=_hover
_wasDown=MOUSE.left
}
reset(){
_wasHover=false
_wasDown=false
_clicked=false
_active=false
}
}
class LabelButton is Button {
construct new(x,y,w,h,label,textcolor,fillcolor,hovercolor,shadecolor){
super(x,y,w,h,textcolor,fillcolor,hovercolor,shadecolor)
_label=label
_textcolor=textcolor
_textw=TIC.print(label,0,-6)
}
label=(value){
_label=value
_textw=TIC.print(value,0,-6)
}
draw() {
super.draw()
// label centered
TIC.print(_label,x+(width-_textw)/2,y+(height-FONTH)/2,_textcolor)
}
}
class ImageButton is Button {
construct new(x,y,w,h,sprite,spriteW,spriteH,bordercolor,fillcolor,hovercolor,shadecolor){
super(x,y,w,h,bordercolor,fillcolor,hovercolor,shadecolor)
_sprite=sprite
_spriteW=spriteW
_spriteH=spriteH
}
draw() {
super.draw()
// sprite centered
TIC.spr(_sprite,x+(width-_spriteW*8)/2,y+(height-_spriteH*8)/2,COLOR_KEY,1,0,0,_spriteW,_spriteH)
}
}
class State {
construct new() {
_tt=0
_nextstate=this
}
nextstate { _nextstate }
nextstate=(value) {
_nextstate=value
}
tt { _tt }
tt=(value) {
_tt=value
}
reset() {
_tt=0
}
update() {
_tt=_tt+1
MOUSE.cursor=CURSORPOINT
MOUSE.update()
}
finish() {
return
}
next() {
return this
}
draw() {
MOUSE.draw()
}
}
class SkipState is State {
construct new(grace) {
super()
_grace=grace
}
finish() {
TIC.sfx(-1)
TIC.sfx(SFXNEXT)
}
canSkip {tt>_grace}
next() {
if (canSkip && (MOUSE.leftp||MOUSE.rightp)) {
finish()
nextstate.reset()
return nextstate
}
return this
}
}
class SplashStateText {
t { _t }
tx { _tx }
construct new(t, tx) {
_t=t
_tx=tx
}
}