Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/MovingBlocks.txt
1319 views
1
//----------------Sonic CD Moving Blocks Script---------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.BlockXPos_1
7
#alias Object.Value1 : Object.BlockYPos_1
8
#alias Object.Value2 : Object.BlockXPos_2
9
#alias Object.Value3 : Object.BlockYPos_2
10
#alias Object.Value4 : Object.BlockXPos_3
11
#alias Object.Value5 : Object.BlockYPos_3
12
#alias Object.Value6 : Object.BlockXPos_4
13
#alias Object.Value7 : Object.BlockYPos_4
14
#alias Object.Direction : Object.BlockState
15
#alias Object.Rotation : Object.MovePattern
16
#alias Object.InkEffect : Object.CrushCheck
17
18
#alias 0 : FORMATION_L_AND_LINES
19
#alias 1 : FORMATION_TETROMINOS_LEFT
20
#alias 3 : FORMATION_L_AND_LINES_CCW
21
#alias 4 : FORMATION_TETROMINOS_RIGHT
22
23
// States
24
#alias 0 : MOVINGBLOCKS_MOVE
25
#alias 1 : MOVINGBLOCKS_CHANGE_PATTERN
26
27
// Player Collision
28
#alias 1 : PLAYER_COL_FLOOR
29
#alias 2 : PLAYER_COL_LWALL
30
#alias 3 : PLAYER_COL_RWALL
31
#alias 4 : PLAYER_COL_ROOF
32
33
#alias 0 : GRAVITY_GROUND
34
35
// Function declarations
36
#function MovingBlocks_MoveType_1
37
#function MovingBlocks_MoveType_2
38
#function MovingBlocks_MoveType_3
39
#function MovingBlocks_MoveType_4
40
#function MovingBlocks_CrushCheck
41
#function MovingBlocks_CrushCheckTop
42
43
44
function MovingBlocks_MoveType_1
45
switch Object.BlockState
46
case 0
47
Object.BlockYPos_1 -= 0x8000
48
#platform: Use_Origins
49
TempValue2 = 1
50
TempValue3 = 1
51
#endplatform
52
if Object.AnimationTimer == 64
53
Object.BlockYPos_2 = Object.BlockYPos_1
54
end if
55
break
56
57
case 1
58
Object.BlockYPos_1 -= 0x8000
59
#platform: Use_Origins
60
TempValue2 = 1
61
TempValue3 = 1
62
#endplatform
63
if Object.AnimationTimer == 64
64
Object.BlockYPos_3 = Object.BlockYPos_1
65
end if
66
break
67
68
case 2
69
Object.BlockYPos_1 -= 0x8000
70
#platform: Use_Origins
71
TempValue2 = 1
72
TempValue3 = 1
73
#endplatform
74
if Object.AnimationTimer == 64
75
Object.BlockYPos_4 = Object.BlockYPos_1
76
Object.BlockYPos_1 = Object.YPos
77
end if
78
break
79
80
case 3
81
Object.BlockXPos_1 += 0x8000
82
Object.BlockYPos_4 += 0x8000
83
#platform: Use_Origins
84
TempValue2 = 1
85
TempValue3 = 3
86
#endplatform
87
if Object.AnimationTimer == 64
88
Object.BlockXPos_3 = Object.BlockXPos_1
89
Object.BlockYPos_3 = Object.BlockYPos_1
90
end if
91
break
92
93
case 4
94
Object.BlockXPos_1 += 0x8000
95
Object.BlockYPos_4 += 0x8000
96
#platform: Use_Origins
97
TempValue2 = 1
98
TempValue3 = 3
99
#endplatform
100
if Object.AnimationTimer == 64
101
Object.BlockXPos_2 = Object.BlockXPos_1
102
Object.BlockYPos_2 = Object.BlockYPos_1
103
end if
104
break
105
106
case 5
107
Object.BlockXPos_1 += 0x8000
108
Object.BlockYPos_4 += 0x8000
109
#platform: Use_Origins
110
TempValue2 = 1
111
TempValue3 = 3
112
#endplatform
113
if Object.AnimationTimer == 64
114
Object.BlockXPos_4 = Object.BlockXPos_1
115
Object.BlockXPos_1 = Object.XPos
116
end if
117
break
118
119
case 6
120
Object.BlockYPos_1 += 0x8000
121
Object.BlockXPos_4 -= 0x8000
122
#platform: Use_Origins
123
TempValue2 = 1
124
TempValue3 = 4
125
#endplatform
126
if Object.AnimationTimer == 64
127
Object.BlockXPos_2 = Object.BlockXPos_1
128
Object.BlockYPos_2 = Object.BlockYPos_1
129
end if
130
break
131
132
case 7
133
Object.BlockYPos_1 += 0x8000
134
Object.BlockXPos_4 -= 0x8000
135
#platform: Use_Origins
136
TempValue2 = 1
137
TempValue3 = 4
138
#endplatform
139
if Object.AnimationTimer == 64
140
Object.BlockXPos_3 = Object.BlockXPos_1
141
Object.BlockYPos_3 = Object.BlockYPos_1
142
end if
143
break
144
145
case 8
146
Object.BlockYPos_1 += 0x8000
147
Object.BlockXPos_4 -= 0x8000
148
#platform: Use_Origins
149
TempValue2 = 1
150
TempValue3 = 4
151
#endplatform
152
if Object.AnimationTimer == 64
153
Object.BlockYPos_4 = Object.BlockYPos_1
154
Object.BlockYPos_1 = Object.YPos
155
end if
156
break
157
158
case 9
159
Object.BlockXPos_1 -= 0x8000
160
Object.BlockYPos_4 -= 0x8000
161
#platform: Use_Origins
162
TempValue2 = 1
163
TempValue3 = 2
164
#endplatform
165
if Object.AnimationTimer == 64
166
Object.BlockXPos_3 = Object.BlockXPos_1
167
Object.BlockYPos_3 = Object.BlockYPos_1
168
end if
169
break
170
171
case 10
172
Object.BlockXPos_1 -= 0x8000
173
Object.BlockYPos_4 -= 0x8000
174
#platform: Use_Origins
175
TempValue2 = 1
176
TempValue3 = 2
177
#endplatform
178
if Object.AnimationTimer == 64
179
Object.BlockXPos_2 = Object.BlockXPos_1
180
Object.BlockYPos_2 = Object.BlockYPos_1
181
end if
182
break
183
184
case 11
185
Object.BlockXPos_1 -= 0x8000
186
Object.BlockYPos_4 -= 0x8000
187
#platform: Use_Origins
188
TempValue2 = 1
189
TempValue3 = 2
190
#endplatform
191
if Object.AnimationTimer == 64
192
Object.BlockXPos_4 = Object.BlockXPos_1
193
Object.BlockYPos_4 = Object.BlockYPos_1
194
Object.BlockXPos_1 = Object.XPos
195
end if
196
break
197
198
case 12
199
Object.BlockYPos_1 -= 0x8000
200
Object.BlockXPos_4 += 0x8000
201
#platform: Use_Origins
202
TempValue2 = 1
203
TempValue3 = 1
204
#endplatform
205
if Object.AnimationTimer == 64
206
Object.BlockXPos_2 = Object.BlockXPos_1
207
Object.BlockYPos_2 = Object.BlockYPos_1
208
end if
209
break
210
211
case 13
212
Object.BlockYPos_1 -= 0x8000
213
Object.BlockXPos_4 += 0x8000
214
#platform: Use_Origins
215
TempValue2 = 1
216
TempValue3 = 1
217
#endplatform
218
if Object.AnimationTimer == 64
219
Object.BlockXPos_3 = Object.BlockXPos_1
220
Object.BlockYPos_3 = Object.BlockYPos_1
221
end if
222
break
223
224
case 14
225
Object.BlockYPos_1 -= 0x8000
226
Object.BlockXPos_4 += 0x8000
227
#platform: Use_Origins
228
TempValue2 = 1
229
TempValue3 = 1
230
#endplatform
231
if Object.AnimationTimer == 64
232
Object.BlockYPos_4 = Object.BlockYPos_1
233
Object.BlockYPos_1 = Object.YPos
234
end if
235
break
236
end switch
237
end function
238
239
240
function MovingBlocks_MoveType_2
241
switch Object.Direction
242
case 0
243
Object.BlockYPos_1 -= 0x8000
244
#platform: Use_Origins
245
TempValue2 = 1
246
TempValue3 = 1
247
#endplatform
248
if Object.AnimationTimer == 64
249
Object.BlockYPos_2 = Object.BlockYPos_1
250
end if
251
break
252
253
case 1
254
Object.BlockYPos_1 -= 0x8000
255
#platform: Use_Origins
256
TempValue2 = 1
257
TempValue3 = 1
258
#endplatform
259
if Object.AnimationTimer == 64
260
Object.BlockYPos_3 = Object.BlockYPos_1
261
end if
262
break
263
264
case 2
265
Object.BlockYPos_1 -= 0x8000
266
#platform: Use_Origins
267
TempValue2 = 1
268
TempValue3 = 1
269
#endplatform
270
if Object.AnimationTimer == 64
271
Object.BlockYPos_4 = Object.BlockYPos_1
272
Object.BlockYPos_1 = Object.YPos
273
end if
274
break
275
case 3
276
Object.BlockXPos_1 -= 0x8000
277
Object.BlockYPos_4 += 0x8000
278
#platform: Use_Origins
279
TempValue2 = 1
280
TempValue3 = 2
281
#endplatform
282
if Object.AnimationTimer == 64
283
Object.BlockXPos_3 = Object.BlockXPos_1
284
Object.BlockYPos_3 = Object.BlockYPos_1
285
end if
286
break
287
288
case 4
289
Object.BlockXPos_1 -= 0x8000
290
Object.BlockYPos_4 += 0x8000
291
#platform: Use_Origins
292
TempValue2 = 1
293
TempValue3 = 2
294
#endplatform
295
if Object.AnimationTimer == 64
296
Object.BlockXPos_2 = Object.BlockXPos_1
297
Object.BlockYPos_2 = Object.BlockYPos_1
298
end if
299
break
300
301
case 5
302
Object.BlockXPos_1 -= 0x8000
303
Object.BlockYPos_4 += 0x8000
304
#platform: Use_Origins
305
TempValue2 = 1
306
TempValue3 = 2
307
#endplatform
308
if Object.AnimationTimer == 64
309
Object.BlockXPos_4 = Object.BlockXPos_1
310
Object.BlockYPos_4 = Object.BlockYPos_1
311
Object.BlockXPos_1 = Object.XPos
312
end if
313
break
314
315
case 6
316
Object.BlockYPos_1 += 0x8000
317
Object.BlockXPos_4 += 0x8000
318
#platform: Use_Origins
319
TempValue2 = 1
320
TempValue3 = 4
321
#endplatform
322
if Object.AnimationTimer == 64
323
Object.BlockXPos_2 = Object.BlockXPos_1
324
Object.BlockYPos_2 = Object.BlockYPos_1
325
end if
326
break
327
328
case 7
329
Object.BlockYPos_1 += 0x8000
330
Object.BlockXPos_4 += 0x8000
331
#platform: Use_Origins
332
TempValue2 = 1
333
TempValue3 = 4
334
#endplatform
335
if Object.AnimationTimer == 64
336
Object.BlockXPos_3 = Object.BlockXPos_1
337
Object.BlockYPos_3 = Object.BlockYPos_1
338
end if
339
break
340
341
case 8
342
Object.BlockYPos_1 += 0x8000
343
Object.BlockXPos_4 += 0x8000
344
#platform: Use_Origins
345
TempValue2 = 1
346
TempValue3 = 4
347
#endplatform
348
if Object.AnimationTimer == 64
349
Object.BlockYPos_4 = Object.BlockYPos_1
350
Object.BlockYPos_1 = Object.YPos
351
end if
352
break
353
354
case 9
355
Object.BlockXPos_1 += 0x8000
356
Object.BlockYPos_4 -= 0x8000
357
#platform: Use_Origins
358
TempValue2 = 1
359
TempValue3 = 3
360
#endplatform
361
if Object.AnimationTimer == 64
362
Object.BlockXPos_3 = Object.BlockXPos_1
363
Object.BlockYPos_3 = Object.BlockYPos_1
364
end if
365
break
366
367
case 10
368
Object.BlockXPos_1 += 0x8000
369
Object.BlockYPos_4 -= 0x8000
370
#platform: Use_Origins
371
TempValue2 = 1
372
TempValue3 = 3
373
#endplatform
374
if Object.AnimationTimer == 64
375
Object.BlockXPos_2 = Object.BlockXPos_1
376
Object.BlockYPos_2 = Object.BlockYPos_1
377
end if
378
break
379
380
case 11
381
Object.BlockXPos_1 += 0x8000
382
Object.BlockYPos_4 -= 0x8000
383
#platform: Use_Origins
384
TempValue2 = 1
385
TempValue3 = 3
386
#endplatform
387
if Object.AnimationTimer == 64
388
Object.BlockXPos_4 = Object.BlockXPos_1
389
Object.BlockXPos_1 = Object.XPos
390
end if
391
break
392
393
case 12
394
Object.BlockYPos_1 -= 0x8000
395
Object.BlockXPos_4 -= 0x8000
396
#platform: Use_Origins
397
TempValue2 = 1
398
TempValue3 = 3
399
#endplatform
400
if Object.AnimationTimer == 64
401
Object.BlockXPos_2 = Object.BlockXPos_1
402
Object.BlockYPos_2 = Object.BlockYPos_1
403
end if
404
break
405
406
case 13
407
Object.BlockYPos_1 -= 0x8000
408
Object.BlockXPos_4 -= 0x8000
409
#platform: Use_Origins
410
TempValue2 = 1
411
TempValue3 = 1
412
#endplatform
413
if Object.AnimationTimer == 64
414
Object.BlockXPos_3 = Object.BlockXPos_1
415
Object.BlockYPos_3 = Object.BlockYPos_1
416
end if
417
break
418
419
case 14
420
Object.BlockYPos_1 -= 0x8000
421
Object.BlockXPos_4 -= 0x8000
422
#platform: Use_Origins
423
TempValue2 = 1
424
TempValue3 = 1
425
#endplatform
426
if Object.AnimationTimer == 64
427
Object.BlockYPos_4 = Object.BlockYPos_1
428
Object.BlockYPos_1 = Object.YPos
429
end if
430
break
431
end switch
432
end function
433
434
435
function MovingBlocks_MoveType_3
436
switch Object.Direction
437
case 0
438
Object.BlockYPos_1 -= 0x8000
439
#platform: Use_Origins
440
TempValue2 = 1
441
TempValue3 = 1
442
#endplatform
443
if Object.AnimationTimer == 64
444
Object.BlockYPos_2 = Object.BlockYPos_1
445
end if
446
break
447
448
case 1
449
Object.BlockYPos_1 -= 0x8000
450
#platform: Use_Origins
451
TempValue2 = 1
452
TempValue3 = 1
453
#endplatform
454
if Object.AnimationTimer == 64
455
Object.BlockYPos_3 = Object.BlockYPos_1
456
end if
457
break
458
459
case 2
460
Object.BlockXPos_1 += 0x8000
461
#platform: Use_Origins
462
TempValue2 = 1
463
TempValue3 = 3
464
#endplatform
465
break
466
467
case 3
468
Object.BlockXPos_1 -= 0x8000
469
Object.BlockXPos_4 += 0x8000
470
#platform: Use_Origins
471
TempValue2 = 4
472
TempValue3 = 3
473
#endplatform
474
if Object.AnimationTimer == 64
475
Object.BlockXPos_3 = Object.BlockXPos_4
476
Object.BlockYPos_3 = Object.BlockYPos_4
477
end if
478
break
479
480
case 4
481
Object.BlockYPos_1 += 0x8000
482
Object.BlockYPos_4 -= 0x8000
483
#platform: Use_Origins
484
TempValue2 = 4
485
TempValue3 = 1
486
#endplatform
487
if Object.AnimationTimer == 64
488
Object.BlockXPos_2 = Object.BlockXPos_4
489
Object.BlockYPos_2 = Object.BlockYPos_4
490
end if
491
break
492
493
case 5
494
Object.BlockYPos_1 += 0x8000
495
Object.BlockXPos_4 += 0x8000
496
#platform: Use_Origins
497
TempValue2 = 1
498
TempValue3 = 4
499
#endplatform
500
break
501
502
case 6
503
Object.BlockYPos_1 += 0x8000
504
Object.BlockXPos_4 -= 0x8000
505
#platform: Use_Origins
506
TempValue2 = 1
507
TempValue3 = 4
508
#endplatform
509
if Object.AnimationTimer == 64
510
Object.BlockXPos_2 = Object.BlockXPos_1
511
Object.BlockYPos_2 = Object.BlockYPos_1
512
end if
513
break
514
515
case 7
516
Object.BlockYPos_1 += 0x8000
517
Object.BlockYPos_4 += 0x8000
518
#platform: Use_Origins
519
TempValue2 = 1
520
TempValue3 = 4
521
#endplatform
522
if Object.AnimationTimer == 64
523
Object.BlockXPos_3 = Object.BlockXPos_1
524
Object.BlockYPos_3 = Object.BlockYPos_1
525
end if
526
break
527
528
case 8
529
Object.BlockXPos_1 += 0x8000
530
Object.BlockXPos_4 -= 0x8000
531
#platform: Use_Origins
532
TempValue2 = 1
533
TempValue3 = 3
534
#endplatform
535
break
536
537
case 9
538
Object.BlockXPos_1 -= 0x8000
539
Object.BlockXPos_4 -= 0x8000
540
#platform: Use_Origins
541
TempValue2 = 4
542
TempValue3 = 2
543
#endplatform
544
if Object.AnimationTimer == 64
545
Object.BlockXPos_3 = Object.BlockXPos_4
546
Object.BlockYPos_3 = Object.BlockYPos_4
547
end if
548
break
549
550
case 10
551
Object.BlockYPos_1 -= 0x8000
552
Object.BlockXPos_4 -= 0x8000
553
#platform: Use_Origins
554
TempValue2 = 4
555
TempValue3 = 2
556
#endplatform
557
if Object.AnimationTimer == 64
558
Object.BlockXPos_2 = Object.BlockXPos_4
559
Object.BlockYPos_2 = Object.BlockYPos_4
560
end if
561
break
562
563
case 11
564
Object.BlockYPos_1 -= 0x8000
565
Object.BlockXPos_4 -= 0x8000
566
#platform: Use_Origins
567
TempValue2 = 4
568
TempValue3 = 2
569
#endplatform
570
break
571
572
case 12
573
Object.BlockYPos_1 -= 0x8000
574
Object.BlockXPos_4 += 0x8000
575
#platform: Use_Origins
576
TempValue2 = 1
577
TempValue3 = 1
578
#endplatform
579
if Object.AnimationTimer == 64
580
Object.BlockXPos_2 = Object.BlockXPos_1
581
Object.BlockYPos_2 = Object.BlockYPos_1
582
end if
583
break
584
585
case 13
586
Object.BlockYPos_1 -= 0x8000
587
Object.BlockXPos_4 += 0x8000
588
#platform: Use_Origins
589
TempValue2 = 1
590
TempValue3 = 1
591
#endplatform
592
if Object.AnimationTimer == 64
593
Object.BlockXPos_3 = Object.BlockXPos_1
594
Object.BlockYPos_3 = Object.BlockYPos_1
595
end if
596
break
597
598
case 14
599
Object.BlockXPos_1 += 0x8000
600
Object.BlockXPos_4 += 0x8000
601
#platform: Use_Origins
602
TempValue2 = 1
603
TempValue3 = 3
604
#endplatform
605
break
606
end switch
607
end function
608
609
610
function MovingBlocks_MoveType_4
611
switch Object.Direction
612
case 0
613
Object.BlockXPos_1 += 0x8000
614
#platform: Use_Origins
615
TempValue2 = 1
616
TempValue3 = 3
617
#endplatform
618
if Object.AnimationTimer == 64
619
Object.BlockXPos_2 = Object.BlockXPos_1
620
end if
621
break
622
623
case 1
624
Object.BlockXPos_1 += 0x8000
625
#platform: Use_Origins
626
TempValue2 = 1
627
TempValue3 = 3
628
#endplatform
629
if Object.AnimationTimer == 64
630
Object.BlockXPos_3 = Object.BlockXPos_1
631
end if
632
break
633
634
case 2
635
Object.BlockYPos_1 -= 0x8000
636
#platform: Use_Origins
637
TempValue2 = 1
638
TempValue3 = 1
639
#endplatform
640
break
641
case 3
642
Object.BlockYPos_1 += 0x8000
643
Object.BlockYPos_4 += 0x8000
644
#platform: Use_Origins
645
TempValue2 = 4
646
TempValue3 = 4
647
#endplatform
648
if Object.AnimationTimer == 64
649
Object.BlockXPos_3 = Object.BlockXPos_4
650
Object.BlockYPos_3 = Object.BlockYPos_4
651
end if
652
break
653
654
case 4
655
Object.BlockXPos_1 -= 0x8000
656
Object.BlockXPos_4 -= 0x8000
657
#platform: Use_Origins
658
TempValue2 = 4
659
TempValue3 = 2
660
#endplatform
661
if Object.AnimationTimer == 64
662
Object.BlockXPos_2 = Object.BlockXPos_4
663
Object.BlockYPos_2 = Object.BlockYPos_4
664
end if
665
break
666
667
case 5
668
Object.BlockXPos_1 -= 0x8000
669
Object.BlockXPos_4 -= 0x8000
670
#platform: Use_Origins
671
TempValue2 = 4
672
TempValue3 = 2
673
#endplatform
674
break
675
676
case 6
677
Object.BlockXPos_1 -= 0x8000
678
Object.BlockXPos_4 += 0x8000
679
#platform: Use_Origins
680
TempValue2 = 1
681
TempValue3 = 2
682
#endplatform
683
if Object.AnimationTimer == 64
684
Object.BlockXPos_2 = Object.BlockXPos_1
685
Object.BlockYPos_2 = Object.BlockYPos_1
686
end if
687
break
688
689
case 7
690
Object.BlockYPos_1 -= 0x8000
691
Object.BlockXPos_4 += 0x8000
692
#platform: Use_Origins
693
TempValue2 = 1
694
TempValue3 = 1
695
#endplatform
696
if Object.AnimationTimer == 64
697
Object.BlockXPos_3 = Object.BlockXPos_1
698
Object.BlockYPos_3 = Object.BlockYPos_1
699
end if
700
break
701
702
case 8
703
Object.BlockXPos_1 -= 0x8000
704
Object.BlockYPos_4 -= 0x8000
705
#platform: Use_Origins
706
TempValue2 = 1
707
TempValue3 = 2
708
#endplatform
709
break
710
711
case 9
712
Object.BlockXPos_1 += 0x8000
713
Object.BlockYPos_4 -= 0x8000
714
#platform: Use_Origins
715
TempValue2 = 4
716
TempValue3 = 1
717
#endplatform
718
if Object.AnimationTimer == 64
719
Object.BlockXPos_3 = Object.BlockXPos_4
720
Object.BlockYPos_3 = Object.BlockYPos_4
721
end if
722
break
723
724
case 10
725
Object.BlockYPos_1 += 0x8000
726
Object.BlockXPos_4 += 0x8000
727
#platform: Use_Origins
728
TempValue2 = 4
729
TempValue3 = 3
730
#endplatform
731
if Object.AnimationTimer == 64
732
Object.BlockXPos_2 = Object.BlockXPos_4
733
Object.BlockYPos_2 = Object.BlockYPos_4
734
end if
735
break
736
737
case 11
738
Object.BlockXPos_1 += 0x8000
739
Object.BlockYPos_4 -= 0x8000
740
#platform: Use_Origins
741
TempValue2 = 4
742
TempValue3 = 1
743
#endplatform
744
break
745
746
case 12
747
Object.BlockXPos_1 += 0x8000
748
Object.BlockYPos_4 += 0x8000
749
#platform: Use_Origins
750
TempValue2 = 1
751
TempValue3 = 3
752
#endplatform
753
if Object.AnimationTimer == 64
754
Object.BlockXPos_2 = Object.BlockXPos_1
755
Object.BlockYPos_2 = Object.BlockYPos_1
756
end if
757
break
758
759
case 13
760
Object.BlockXPos_1 += 0x8000
761
Object.BlockXPos_4 -= 0x8000
762
#platform: Use_Origins
763
TempValue2 = 1
764
TempValue3 = 3
765
#endplatform
766
if Object.AnimationTimer == 64
767
Object.BlockXPos_3 = Object.BlockXPos_1
768
Object.BlockYPos_3 = Object.BlockYPos_1
769
end if
770
break
771
772
case 14
773
Object.BlockYPos_1 -= 0x8000
774
Object.BlockYPos_4 += 0x8000
775
#platform: Use_Origins
776
TempValue2 = 1
777
TempValue3 = 1
778
#endplatform
779
break
780
end switch
781
end function
782
783
784
function MovingBlocks_CrushCheck
785
#platform: Use_Origins
786
if TempValue3 == 4
787
if Player.Gravity == GRAVITY_GROUND
788
Player.XPos = TempValue4
789
Player.YPos = TempValue5
790
PlayerObjectCollision(C_BOX, -8, -17, 8, 8)
791
if CheckResult == PLAYER_COL_ROOF
792
CallFunction(Player_Kill)
793
end if
794
end if
795
end if
796
ArrayPos0 = 0
797
TempValue6 = 0
798
while ArrayPos0 < 1056
799
if Object[ArrayPos0].Type == TypeName[MovingBlocks]
800
if ArrayPos0 != Object.EntityNo
801
if Object[ArrayPos0].CrushCheck > 0
802
TempValue6 = Object[ArrayPos0].CrushCheck
803
end if
804
end if
805
end if
806
ArrayPos0++
807
loop
808
809
if TempValue6 > 0
810
GetBit(CheckResult, TempValue6, 2)
811
if CheckResult == true
812
if TempValue3 == 3
813
Player.XPos = TempValue4
814
Player.YPos = TempValue5
815
PlayerObjectCollision(C_BOX, -16, -9, 14, 8)
816
if CheckResult == PLAYER_COL_RWALL
817
CallFunction(Player_Kill)
818
end if
819
end if
820
end if
821
822
GetBit(CheckResult, TempValue6, 3)
823
if CheckResult == true
824
if TempValue3 == 2
825
Player.XPos = TempValue4
826
Player.YPos = TempValue5
827
PlayerObjectCollision(C_BOX, -14, -9, 16, 8)
828
if CheckResult == PLAYER_COL_LWALL
829
CallFunction(Player_Kill)
830
end if
831
end if
832
end if
833
834
GetBit(CheckResult, TempValue6, 1)
835
if CheckResult == true
836
if TempValue3 == 4
837
Player.XPos = TempValue4
838
Player.YPos = TempValue5
839
PlayerObjectCollision(C_BOX, -8, -16, 8, 4)
840
if CheckResult == PLAYER_COL_ROOF
841
CallFunction(Player_Kill)
842
end if
843
end if
844
end if
845
846
if TempValue3 == 1
847
SetBit(Object.CrushCheck, 0, 1)
848
end if
849
end if
850
PlayerObjectCollision(C_BOX, -16, -17, 16, 16)
851
TempValue4 = Player.XPos
852
TempValue5 = Player.YPos
853
#endplatform
854
end function
855
856
857
function MovingBlocks_CrushCheckTop
858
#platform: Use_Origins
859
Player.XPos = TempValue4
860
Player.YPos = TempValue5
861
PlayerObjectCollision(C_BOX, -16, -17, 16, 4)
862
if CheckResult == PLAYER_COL_ROOF
863
ArrayPos0 = 0
864
TempValue6 = 0
865
while ArrayPos0 < 1056
866
if Object[ArrayPos0].Type == TypeName[MovingBlocks]
867
if ArrayPos0 != Object.EntityNo
868
GetBit(CheckResult, Object[ArrayPos0].CrushCheck, 0)
869
if CheckResult == true
870
TempValue6 = Object[ArrayPos0].CrushCheck
871
end if
872
end if
873
end if
874
ArrayPos0++
875
loop
876
877
if TempValue6 > 0
878
GetBit(CheckResult, TempValue6, 1)
879
if CheckResult == true
880
CallFunction(Player_Kill)
881
end if
882
end if
883
end if
884
#endplatform
885
end function
886
887
888
sub ObjectMain
889
if Object.State == MOVINGBLOCKS_MOVE
890
if Object.AnimationTimer < 64
891
Object.AnimationTimer++
892
CallFunction(Object.MovePattern)
893
else
894
Object.AnimationTimer = 0
895
Object.State = MOVINGBLOCKS_CHANGE_PATTERN
896
Object.BlockState++
897
if Object.BlockState > 14
898
Object.BlockState = 3
899
end if
900
end if
901
else
902
if Object.AnimationTimer < 30
903
Object.AnimationTimer++
904
else
905
Object.AnimationTimer = 0
906
Object.State = MOVINGBLOCKS_MOVE
907
end if
908
end if
909
end sub
910
911
912
sub ObjectPlayerInteraction
913
#platform: Use_Origins
914
Object.CrushCheck = 0
915
TempValue4 = Player.XPos
916
TempValue5 = Player.YPos
917
#endplatform
918
919
TempValue0 = Object.XPos
920
TempValue1 = Object.YPos
921
922
Object.XPos = Object.BlockXPos_1
923
Object.YPos = Object.BlockYPos_1
924
PlayerObjectCollision(C_BOX, -16, -17, 16, 16)
925
if CheckResult == PLAYER_COL_FLOOR
926
Player.YPos += 0x10000
927
#platform: Use_Origins
928
TempValue5 = Player.YPos
929
#endplatform
930
end if
931
#platform: Use_Origins
932
if CheckResult > 0
933
SetBit(Object.CrushCheck, CheckResult, 1)
934
if TempValue2 == 1
935
CallFunction(MovingBlocks_CrushCheck)
936
else
937
if CheckResult == PLAYER_COL_ROOF
938
CallFunction(MovingBlocks_CrushCheckTop)
939
end if
940
end if
941
end if
942
TempValue4 = Player.XPos
943
TempValue5 = Player.YPos
944
#endplatform
945
946
Object.XPos = Object.BlockXPos_2
947
Object.YPos = Object.BlockYPos_2
948
PlayerObjectCollision(C_BOX, -16, -17, 16, 16)
949
if CheckResult == PLAYER_COL_FLOOR
950
Player.YPos += 0x10000
951
#platform: Use_Origins
952
TempValue5 = Player.YPos
953
#endplatform
954
end if
955
956
#platform: Use_Origins
957
if CheckResult > 0
958
SetBit(Object.CrushCheck, CheckResult, 1)
959
if TempValue2 == 2
960
CallFunction(MovingBlocks_CrushCheck)
961
else
962
if CheckResult == PLAYER_COL_ROOF
963
CallFunction(MovingBlocks_CrushCheckTop)
964
end if
965
end if
966
end if
967
TempValue4 = Player.XPos
968
TempValue5 = Player.YPos
969
#endplatform
970
971
Object.XPos = Object.BlockXPos_3
972
Object.YPos = Object.BlockYPos_3
973
PlayerObjectCollision(C_BOX, -16, -17, 16, 16)
974
if CheckResult == PLAYER_COL_FLOOR
975
Player.YPos += 0x10000
976
#platform: Use_Origins
977
TempValue5 = Player.YPos
978
#endplatform
979
end if
980
981
#platform: Use_Origins
982
if CheckResult > 0
983
SetBit(Object.CrushCheck, CheckResult, 1)
984
if TempValue2 == 3
985
CallFunction(MovingBlocks_CrushCheck)
986
else
987
if CheckResult == PLAYER_COL_ROOF
988
CallFunction(MovingBlocks_CrushCheckTop)
989
end if
990
end if
991
end if
992
#endplatform
993
994
Object.XPos = Object.BlockXPos_4
995
Object.YPos = Object.BlockYPos_4
996
PlayerObjectCollision(C_BOX, -16, -17, 16, 16)
997
if CheckResult == PLAYER_COL_FLOOR
998
Player.YPos += 0x10000
999
#platform: Use_Origins
1000
TempValue5 = Player.YPos
1001
#endplatform
1002
end if
1003
1004
#platform: Use_Origins
1005
if CheckResult > 0
1006
SetBit(Object.CrushCheck, CheckResult, 1)
1007
if TempValue2 == 4
1008
CallFunction(MovingBlocks_CrushCheck)
1009
else
1010
if CheckResult == PLAYER_COL_ROOF
1011
CallFunction(MovingBlocks_CrushCheckTop)
1012
end if
1013
end if
1014
end if
1015
#endplatform
1016
Object.XPos = TempValue0
1017
Object.YPos = TempValue1
1018
PlayerObjectCollision(C_BOX, -16, -16, 16, 16)
1019
#platform: Use_Origins
1020
if CheckResult > 0
1021
SetBit(Object.CrushCheck, CheckResult, 1)
1022
if CheckResult == PLAYER_COL_ROOF
1023
CallFunction(MovingBlocks_CrushCheckTop)
1024
end if
1025
end if
1026
TempValue2 = 0
1027
TempValue3 = 0
1028
#endplatform
1029
end sub
1030
1031
1032
sub ObjectDraw
1033
DrawSpriteXY(0, Object.BlockXPos_1, Object.BlockYPos_1)
1034
DrawSpriteXY(0, Object.BlockXPos_4, Object.BlockYPos_4)
1035
DrawSpriteXY(0, Object.BlockXPos_2, Object.BlockYPos_2)
1036
DrawSpriteXY(0, Object.BlockXPos_3, Object.BlockYPos_3)
1037
1038
DrawSprite(0)
1039
end sub
1040
1041
1042
sub ObjectStartup
1043
LoadSpriteSheet("R6/Objects.gif")
1044
1045
SpriteFrame(-16, -16, 32, 32, 173, 1) // #0 - Block
1046
1047
ArrayPos0 = 32
1048
while ArrayPos0 < 1056
1049
if Object[ArrayPos0].Type == TypeName[Moving Blocks]
1050
Object[ArrayPos0].BlockXPos_1 = Object[ArrayPos0].XPos
1051
Object[ArrayPos0].BlockYPos_1 = Object[ArrayPos0].YPos
1052
Object[ArrayPos0].BlockXPos_2 = Object[ArrayPos0].XPos
1053
Object[ArrayPos0].BlockYPos_2 = Object[ArrayPos0].YPos
1054
Object[ArrayPos0].BlockXPos_3 = Object[ArrayPos0].XPos
1055
Object[ArrayPos0].BlockYPos_3 = Object[ArrayPos0].YPos
1056
Object[ArrayPos0].BlockXPos_4 = Object[ArrayPos0].XPos
1057
Object[ArrayPos0].BlockYPos_4 = Object[ArrayPos0].YPos
1058
1059
switch Object[ArrayPos0].PropertyValue
1060
case FORMATION_L_AND_LINES
1061
Object[ArrayPos0].MovePattern = MovingBlocks_MoveType_1
1062
break
1063
case FORMATION_TETROMINOS_LEFT
1064
Object[ArrayPos0].MovePattern = MovingBlocks_MoveType_4
1065
break
1066
case FORMATION_L_AND_LINES_CCW
1067
Object[ArrayPos0].MovePattern = MovingBlocks_MoveType_2
1068
break
1069
case FORMATION_TETROMINOS_RIGHT
1070
Object[ArrayPos0].MovePattern = MovingBlocks_MoveType_3
1071
break
1072
end switch
1073
end if
1074
ArrayPos0++
1075
loop
1076
end sub
1077
1078
1079
// ========================
1080
// Editor Subs
1081
// ========================
1082
1083
sub RSDKEdit
1084
if Editor.ReturnVariable == true
1085
switch Editor.VariableID
1086
case EDIT_VAR_PROPVAL // Property Value
1087
CheckResult = Object.PropertyValue
1088
break
1089
case 0 // movementPattern
1090
CheckResult = Object.PropertyValue
1091
CheckResult &= 3
1092
break
1093
end switch
1094
else
1095
switch Editor.VariableID
1096
case EDIT_VAR_PROPVAL // Property Value
1097
Object.PropertyValue = Editor.VariableValue
1098
break
1099
case 0 // movementPattern
1100
Object.PropertyValue = Editor.VariableValue
1101
Object.PropertyValue &= 3
1102
break
1103
end switch
1104
end if
1105
end sub
1106
1107
sub RSDKDraw
1108
TempValue0 = Object.YPos
1109
TempValue0 -= 0x100000
1110
TempValue1 = Object.XPos
1111
TempValue1 -= 0x100000
1112
switch Object.PropertyValue
1113
case FORMATION_L_AND_LINES
1114
case FORMATION_L_AND_LINES_CCW
1115
if Editor.ShowGizmos == true
1116
Editor.DrawingOverlay = true
1117
TempValue0 -= 0x200000
1118
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1119
DrawArrow(Object.XPos,Object.YPos,Object.XPos,TempValue0, 255, 0, 0)
1120
TempValue0 -= 0x200000
1121
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1122
TempValue0 -= 0x200000
1123
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1124
if object.PropertyValue == FORMATION_L_AND_LINES
1125
TempValue1 += 0x200000
1126
else
1127
TempValue1 -= 0x200000
1128
end if
1129
TempValue0 = Object.YPos
1130
TempValue0 -= 0x100000
1131
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1132
Editor.DrawingOverlay = false
1133
end if
1134
break
1135
1136
case FORMATION_TETROMINOS_LEFT
1137
if Editor.ShowGizmos == true
1138
Editor.DrawingOverlay = true
1139
TempValue1 += 0x200000
1140
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1141
TempValue1 += 0x200000
1142
DrawArrow(Object.XPos,Object.YPos,TempValue1,Object.YPos, 255, 0, 0)
1143
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1144
TempValue0 -= 0x200000
1145
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1146
TempValue0 = Object.YPos
1147
TempValue0 -= 0x100000
1148
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1149
Editor.DrawingOverlay = false
1150
end if
1151
break
1152
1153
case FORMATION_TETROMINOS_RIGHT
1154
if Editor.ShowGizmos == true
1155
Editor.DrawingOverlay = true
1156
TempValue0 -= 0x200000
1157
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1158
DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, 0, 0)
1159
TempValue0 -= 0x200000
1160
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1161
TempValue1 += 0x200000
1162
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1163
TempValue1 -= 0x200000
1164
DrawRectOutline(TempValue1,TempValue0, 0x20, 0x20, 255, 255, 0, 255)
1165
Editor.DrawingOverlay = false
1166
end if
1167
break
1168
end switch
1169
DrawSprite(0)
1170
end sub
1171
1172
1173
sub RSDKLoad
1174
LoadSpriteSheet("R6/Objects.gif")
1175
1176
SpriteFrame(-16, -16, 32, 32, 173, 1) // #0 - Block
1177
1178
AddEditorVariable("movementPattern")
1179
SetActiveVariable("movementPattern")
1180
AddEnumVariable("L and Lines", FORMATION_L_AND_LINES)
1181
AddEnumVariable("Tetrominos (left)", FORMATION_TETROMINOS_LEFT)
1182
AddEnumVariable("L and Lines, counter-clockwise", FORMATION_L_AND_LINES_CCW)
1183
AddEnumVariable("Tetrominos (right)", FORMATION_TETROMINOS_RIGHT)
1184
end sub
1185
1186