Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/ARZ/ARZSetup.txt
1478 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: ARZ Setup Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value6 : object.clrDivisor_R
13
private alias object.value7 : object.clrDivisor_G
14
private alias object.value8 : object.clrDivisor_B
15
private alias object.value9 : object.waterClrDivisor_R
16
private alias object.value10 : object.waterClrDivisor_G
17
private alias object.value11 : object.waterClrDivisor_B
18
19
private alias object.value1 : object.paletteTimer
20
21
// Tracks
22
private alias 0 : TRACK_STAGE
23
private alias 1 : TRACK_ACTFINISH
24
private alias 2 : TRACK_INVINCIBLE
25
private alias 3 : TRACK_CONTINUE
26
private alias 4 : TRACK_BOSS
27
private alias 5 : TRACK_GAMEOVER
28
private alias 6 : TRACK_DROWNING
29
private alias 7 : TRACK_SUPER
30
31
// Reserved object slots
32
private alias 10 : SLOT_ZONESETUP
33
private alias 25 : SLOT_MUSICEVENT_CHANGE
34
private alias 26 : SLOT_MUSICEVENT_BOSS
35
36
// Music Events
37
private alias 2 : MUSICEVENT_TRANSITION
38
39
private alias 0 : MUSICEVENT_FLAG_NOCHANGE
40
private alias 1 : MUSICEVENT_FLAG_SPEEDUP
41
private alias 2 : MUSICEVENT_FLAG_SLOWDOWN
42
43
// Music Loops
44
private alias 1 : MUSIC_LOOP_ARZ
45
private alias 1 : MUSIC_LOOP_ARZ_F
46
47
private alias 38679 : MUSIC_LOOP_INV
48
private alias 30897 : MUSIC_LOOP_INV_F
49
50
51
// ========================
52
// Function Declarations
53
// ========================
54
55
reserve function ARZSetup_getClrDivisor
56
reserve function ARZSetup_InitSuperSonicPal
57
reserve function ARZSetup_InitSuperTailsPal
58
reserve function ARZSetup_InitSuperKnuxPal
59
reserve function ARZSetup_InitSuperAmyPal
60
reserve function ARZSetup_SpeedUpMusic
61
reserve function ARZSetup_SlowDownMusic
62
63
64
// ========================
65
// Static Values
66
// ========================
67
68
public value Water_flashTimer = 0 // Uses "Water_" since all water objects use it from the setup so its easier to make new objs this way
69
70
71
// ========================
72
// Tables
73
// ========================
74
75
private table ARZSetup_replay_attract_S
76
0x6C0000, 0x37D0000
77
0x00, 68
78
0x08, 68
79
0x38, 1
80
0x28, 4
81
0x08, 6
82
0x00, 26
83
0x08, 37
84
0x00, 2
85
0x08, 13
86
0x00, 28
87
0x30, 1
88
0x20, 10
89
0x24, 3
90
0x20, 15
91
0x28, 5
92
0x08, 34
93
0x38, 1
94
0x28, 5
95
0x08, 170
96
0x00, 2
97
0x02, 8
98
0x06, 1
99
0x04, 15
100
0x00, 18
101
0x08, 81
102
0x00, 53
103
0x30, 1
104
0x20, 6
105
0x24, 23
106
0x00, 57
107
0x08, 52
108
0x38, 1
109
0x28, 2
110
0x08, 43
111
0x00, 76
112
0x30, 1
113
0x20, 17
114
0x28, 39
115
0x08, 32
116
0x0A, 2
117
0x02, 15
118
0x00, 35
119
0x30, 1
120
0x20, 45
121
0x00, 33
122
0x30, 1
123
0x20, 52
124
0x24, 3
125
0x04, 25
126
0x00, 5
127
0x30, 1
128
0x20, 1
129
0x28, 96
130
0x20, 1
131
0x24, 2
132
0x04, 13
133
0x00, 27
134
0x08, 7
135
0x38, 1
136
0x28, 22
137
0x08, 11
138
0x00, 1
139
0x04, 10
140
0x00, 10
141
0x08, 85
142
0x00, 8
143
0x08, 11
144
0x38, 1
145
0x28, 4
146
0x08, 23
147
0x00, 66
148
0x08, 5
149
0x38, 1
150
0x28, 19
151
0x08, 84
152
0x38, 1
153
end table
154
155
156
private table ARZSetup_replay_attract_T
157
0x6C0000, 0x3810000
158
0x00, 18
159
0x08, 63
160
0x38, 1
161
0x28, 5
162
0x08, 85
163
0x38, 1
164
0x28, 1
165
0x20, 16
166
0x28, 7
167
0x08, 175
168
0x38, 1
169
0x28, 48
170
0x08, 15
171
0x38, 1
172
0x28, 45
173
0x08, 97
174
0x0A, 3
175
0x02, 39
176
0x00, 4
177
0x08, 108
178
0x38, 1
179
0x28, 46
180
0x08, 199
181
0x38, 1
182
0x28, 59
183
0x08, 3
184
0x0A, 4
185
0x02, 4
186
0x0A, 11
187
0x08, 2
188
0x00, 1
189
0x02, 28
190
0x08, 214
191
0x0A, 2
192
0x02, 77
193
0x00, 1
194
0x04, 20
195
0x00, 65
196
0x08, 22
197
0x38, 1
198
0x28, 2
199
0x08, 161
200
0x38, 1
201
0x28, 12
202
0x08, 43
203
0x38, 1
204
0x28, 8
205
0x08, 8
206
0x38, 1
207
0x28, 7
208
0x08, 4
209
0x38, 1
210
0x28, 4
211
0x08, 4
212
0x38, 1
213
0x28, 6
214
0x08, 3
215
0x38, 1
216
0x28, 6
217
0x08, 3
218
0x38, 1
219
0x28, 6
220
0x08, 3
221
0x38, 1
222
0x28, 6
223
0x08, 3
224
0x38, 1
225
0x28, 5
226
end table
227
228
229
private table ARZSetup_replay_attract_K
230
0x6C0000, 0x37D0000
231
0x00, 50
232
0x08, 66
233
0x38, 1
234
0x28, 5
235
0x08, 86
236
0x38, 1
237
0x28, 6
238
0x08, 216
239
0x38, 1
240
0x28, 14
241
0x08, 23
242
0x38, 1
243
0x28, 18
244
0x08, 116
245
0x0A, 2
246
0x02, 5
247
0x00, 3
248
0x08, 144
249
0x38, 1
250
0x28, 23
251
0x08, 5
252
0x38, 1
253
0x28, 127
254
0x00, 11
255
0x02, 13
256
0x32, 1
257
0x22, 3
258
0x00, 5
259
0x08, 96
260
0x0A, 1
261
0x02, 8
262
0x0A, 2
263
0x08, 159
264
0x38, 1
265
0x28, 18
266
0x08, 5
267
0x38, 1
268
0x28, 57
269
0x08, 1
270
0x00, 10
271
0x02, 17
272
0x32, 1
273
0x22, 3
274
0x00, 6
275
0x08, 40
276
0x00, 19
277
0x08, 27
278
0x38, 1
279
0x28, 11
280
0x08, 6
281
0x38, 1
282
0x28, 66
283
0x29, 6
284
0x21, 14
285
0x01, 22
286
0x00, 107
287
0x01, 51
288
0x00, 6
289
0x02, 6
290
0x32, 1
291
0x22, 2
292
0x00, 1
293
end table
294
295
296
// ========================
297
// Function Definitions
298
// ========================
299
300
private function ARZSetup_getClrDivisor
301
object.clrDivisor_R = temp1
302
object.clrDivisor_R >>= 16
303
304
object.clrDivisor_G = temp1
305
object.clrDivisor_G >>= 8
306
object.clrDivisor_G &= 0xFF
307
308
object.clrDivisor_B = temp1
309
object.clrDivisor_B &= 0xFF
310
311
object.waterClrDivisor_R = temp2
312
object.waterClrDivisor_R >>= 16
313
314
object.waterClrDivisor_G = temp2
315
object.waterClrDivisor_G >>= 8
316
object.waterClrDivisor_G &= 0xFF
317
318
object.waterClrDivisor_B = temp2
319
object.waterClrDivisor_B &= 0xFF
320
321
if object.waterClrDivisor_R == 0
322
object.waterClrDivisor_R = 1
323
end if
324
325
if object.waterClrDivisor_G == 0
326
object.waterClrDivisor_G = 1
327
end if
328
329
if object.waterClrDivisor_B == 0
330
object.waterClrDivisor_B = 1
331
end if
332
333
object.clrDivisor_R <<= 8
334
object.clrDivisor_G <<= 8
335
object.clrDivisor_B <<= 8
336
object.clrDivisor_R /= object.waterClrDivisor_R
337
object.clrDivisor_G /= object.waterClrDivisor_G
338
object.clrDivisor_B /= object.waterClrDivisor_B
339
340
if object.clrDivisor_R == 0
341
object.clrDivisor_R = 0x100
342
end if
343
344
if object.clrDivisor_G == 0
345
object.clrDivisor_G = 0x100
346
end if
347
348
if object.clrDivisor_B == 0
349
object.clrDivisor_B = 0x100
350
end if
351
end function
352
353
354
private function ARZSetup_InitSuperSonicPal
355
temp0 = 0
356
357
GetPaletteEntry(1, 2, temp1)
358
SetTableValue(temp1, temp0, Player_SonicSuperAltPal)
359
temp0++
360
361
GetPaletteEntry(1, 3, temp1)
362
SetTableValue(temp1, temp0, Player_SonicSuperAltPal)
363
temp0++
364
365
GetPaletteEntry(1, 4, temp1)
366
SetTableValue(temp1, temp0, Player_SonicSuperAltPal)
367
temp0++
368
369
GetPaletteEntry(1, 5, temp1)
370
SetTableValue(temp1, temp0, Player_SonicSuperAltPal)
371
temp0++
372
373
while temp0 < 64
374
GetPaletteEntry(0, 2, temp1)
375
GetPaletteEntry(1, 2, temp2)
376
377
CallFunction(ARZSetup_getClrDivisor)
378
379
GetTableValue(temp1, temp0, Player_SonicSuperPal)
380
381
temp2 = temp1
382
temp2 >>= 8
383
temp2 &= 0xFF
384
385
temp3 = temp1
386
temp3 &= 0xFF
387
388
temp1 >>= 16
389
390
temp1 *= 0xE0
391
temp1 /= object.clrDivisor_R
392
393
temp2 *= 0xE0
394
temp2 /= object.clrDivisor_G
395
396
temp3 *= 0xE0
397
temp3 /= object.clrDivisor_B
398
399
temp1 &= 0xF0
400
temp2 &= 0xF0
401
temp3 &= 0xF0
402
403
if temp1 > 0xE0
404
temp1 = 0xE0
405
end if
406
407
if temp2 > 0xE0
408
temp2 = 0xE0
409
end if
410
411
if temp3 > 0xE0
412
temp3 = 0xE0
413
end if
414
415
temp1 <<= 16
416
temp2 <<= 8
417
temp1 += temp2
418
temp1 += temp3
419
SetTableValue(temp1, temp0, Player_SonicSuperAltPal)
420
temp0++
421
422
GetPaletteEntry(0, 3, temp1)
423
GetPaletteEntry(1, 3, temp2)
424
425
CallFunction(ARZSetup_getClrDivisor)
426
427
GetTableValue(temp1, temp0, Player_SonicSuperPal)
428
429
temp2 = temp1
430
temp2 >>= 8
431
temp2 &= 0xFF
432
433
temp3 = temp1
434
temp3 &= 0xFF
435
436
temp1 >>= 16
437
438
temp1 *= 0xE8
439
temp1 /= object.clrDivisor_R
440
441
temp2 *= 0xE8
442
temp2 /= object.clrDivisor_G
443
444
temp3 *= 0xE8
445
temp3 /= object.clrDivisor_B
446
447
temp1 &= 0xF0
448
temp2 &= 0xF0
449
temp3 &= 0xF0
450
451
if temp1 > 0xE0
452
temp1 = 0xE0
453
end if
454
455
if temp2 > 0xE0
456
temp2 = 0xE0
457
end if
458
459
if temp3 > 0xE0
460
temp3 = 0xE0
461
end if
462
463
temp1 <<= 16
464
temp2 <<= 8
465
temp1 += temp2
466
temp1 += temp3
467
SetTableValue(temp1, temp0, Player_SonicSuperAltPal)
468
temp0++
469
470
GetPaletteEntry(0, 4, temp1)
471
GetPaletteEntry(1, 4, temp2)
472
473
CallFunction(ARZSetup_getClrDivisor)
474
475
GetTableValue(temp1, temp0, Player_SonicSuperPal)
476
477
temp2 = temp1
478
temp2 >>= 8
479
temp2 &= 0xFF
480
481
temp3 = temp1
482
temp3 &= 0xFF
483
484
temp1 >>= 16
485
486
temp1 *= 0xF4
487
temp1 /= object.clrDivisor_R
488
489
temp2 *= 0xF4
490
temp2 /= object.clrDivisor_G
491
492
temp3 *= 0xF4
493
temp3 /= object.clrDivisor_B
494
495
temp1 &= 0xF0
496
temp2 &= 0xF0
497
temp3 &= 0xF0
498
499
if temp1 > 0xE0
500
temp1 = 0xE0
501
end if
502
503
if temp2 > 0xE0
504
temp2 = 0xE0
505
end if
506
507
if temp3 > 0xE0
508
temp3 = 0xE0
509
end if
510
511
temp1 <<= 16
512
temp2 <<= 8
513
temp1 += temp2
514
temp1 += temp3
515
SetTableValue(temp1, temp0, Player_SonicSuperAltPal)
516
temp0++
517
518
GetPaletteEntry(0, 5, temp1)
519
GetPaletteEntry(1, 5, temp2)
520
521
CallFunction(ARZSetup_getClrDivisor)
522
523
GetTableValue(temp1, temp0, Player_SonicSuperPal)
524
525
temp2 = temp1
526
temp2 >>= 8
527
temp2 &= 0xFF
528
529
temp3 = temp1
530
temp3 &= 0xFF
531
532
temp1 >>= 16
533
534
temp1 *= 0x100
535
temp1 /= object.clrDivisor_R
536
537
temp2 *= 0x100
538
temp2 /= object.clrDivisor_G
539
540
temp3 *= 0x100
541
temp3 /= object.clrDivisor_B
542
543
temp1 &= 0xF0
544
temp2 &= 0xF0
545
temp3 &= 0xF0
546
547
if temp1 > 0xE0
548
temp1 = 0xE0
549
end if
550
551
if temp2 > 0xE0
552
temp2 = 0xE0
553
end if
554
555
if temp3 > 0xE0
556
temp3 = 0xE0
557
end if
558
559
temp1 <<= 16
560
temp2 <<= 8
561
temp1 += temp2
562
temp1 += temp3
563
SetTableValue(temp1, temp0, Player_SonicSuperAltPal)
564
temp0++
565
loop
566
end function
567
568
569
private function ARZSetup_InitSuperTailsPal
570
temp0 = 0
571
GetPaletteEntry(1, 13, temp1)
572
SetTableValue(temp1, temp0, Player_TailsSuperAltPal)
573
temp0++
574
575
GetPaletteEntry(1, 17, temp1)
576
SetTableValue(temp1, temp0, Player_TailsSuperAltPal)
577
temp0++
578
579
GetPaletteEntry(1, 18, temp1)
580
SetTableValue(temp1, temp0, Player_TailsSuperAltPal)
581
temp0++
582
583
GetPaletteEntry(1, 16, temp1)
584
SetTableValue(temp1, temp0, Player_TailsSuperAltPal)
585
temp0++
586
587
while temp0 < 24
588
GetPaletteEntry(0, 13, temp1)
589
GetPaletteEntry(1, 13, temp2)
590
591
CallFunction(ARZSetup_getClrDivisor)
592
593
GetTableValue(temp1, temp0, Player_TailsSuperPal)
594
595
temp2 = temp1
596
temp2 >>= 8
597
temp2 &= 0xFF
598
599
temp3 = temp1
600
temp3 &= 0xFF
601
602
temp1 >>= 16
603
604
temp1 *= 0xF8
605
temp1 /= object.clrDivisor_R
606
607
temp2 *= 0xF8
608
temp2 /= object.clrDivisor_G
609
610
temp3 *= 0xF8
611
temp3 /= object.clrDivisor_B
612
613
temp1 &= 0xF0
614
temp2 &= 0xF0
615
temp3 &= 0xF0
616
617
if temp1 > 0xE0
618
temp1 = 0xE0
619
end if
620
621
if temp2 > 0xE0
622
temp2 = 0xE0
623
end if
624
625
if temp3 > 0xE0
626
temp3 = 0xE0
627
end if
628
629
temp1 <<= 16
630
temp2 <<= 8
631
temp1 += temp2
632
temp1 += temp3
633
SetTableValue(temp1, temp0, Player_TailsSuperAltPal)
634
temp0++
635
636
637
GetPaletteEntry(0, 17, temp1)
638
GetPaletteEntry(1, 17, temp2)
639
640
CallFunction(ARZSetup_getClrDivisor)
641
642
GetTableValue(temp1, temp0, Player_TailsSuperPal)
643
644
temp2 = temp1
645
temp2 >>= 8
646
temp2 &= 0xFF
647
648
temp3 = temp1
649
temp3 &= 0xFF
650
651
temp1 >>= 16
652
653
temp1 *= 0x100
654
temp1 /= object.clrDivisor_R
655
656
temp2 *= 0x100
657
temp2 /= object.clrDivisor_G
658
659
temp3 *= 0x100
660
temp3 /= object.clrDivisor_B
661
662
temp1 &= 0xF0
663
temp2 &= 0xF0
664
temp3 &= 0xF0
665
666
if temp1 > 0xE0
667
temp1 = 0xE0
668
end if
669
670
if temp2 > 0xE0
671
temp2 = 0xE0
672
end if
673
674
if temp3 > 0xE0
675
temp3 = 0xE0
676
end if
677
678
temp1 <<= 16
679
temp2 <<= 8
680
temp1 += temp2
681
temp1 += temp3
682
SetTableValue(temp1, temp0, Player_TailsSuperAltPal)
683
temp0++
684
685
686
GetPaletteEntry(0, 18, temp1)
687
GetPaletteEntry(1, 18, temp2)
688
689
CallFunction(ARZSetup_getClrDivisor)
690
691
GetTableValue(temp1, temp0, Player_TailsSuperPal)
692
693
temp2 = temp1
694
temp2 >>= 8
695
temp2 &= 0xFF
696
697
temp3 = temp1
698
temp3 &= 0xFF
699
700
temp1 >>= 16
701
702
temp1 *= 0x100
703
temp1 /= object.clrDivisor_R
704
705
temp2 *= 0x100
706
temp2 /= object.clrDivisor_G
707
708
temp3 *= 0x100
709
temp3 /= object.clrDivisor_B
710
711
temp1 &= 0xF0
712
temp2 &= 0xF0
713
temp3 &= 0xF0
714
715
if temp1 > 0xE0
716
temp1 = 0xE0
717
end if
718
719
if temp2 > 0xE0
720
temp2 = 0xE0
721
end if
722
723
if temp3 > 0xE0
724
temp3 = 0xE0
725
end if
726
727
temp1 <<= 16
728
temp2 <<= 8
729
temp1 += temp2
730
temp1 += temp3
731
SetTableValue(temp1, temp0, Player_TailsSuperAltPal)
732
temp0++
733
734
GetPaletteEntry(0, 16, temp1)
735
GetPaletteEntry(1, 16, temp2)
736
737
CallFunction(ARZSetup_getClrDivisor)
738
739
GetTableValue(temp1, temp0, Player_TailsSuperPal)
740
temp2 = temp1
741
temp2 >>= 8
742
temp2 &= 0xFF
743
744
temp3 = temp1
745
temp3 &= 0xFF
746
747
temp1 >>= 16
748
749
temp1 *= 0x100
750
temp1 /= object.clrDivisor_R
751
752
temp2 *= 0x100
753
temp2 /= object.clrDivisor_G
754
755
temp3 *= 0x100
756
temp3 /= object.clrDivisor_B
757
758
temp1 &= 0xF0
759
temp2 &= 0xF0
760
temp3 &= 0xF0
761
762
if temp1 > 0xE0
763
temp1 = 0xE0
764
end if
765
766
if temp2 > 0xE0
767
temp2 = 0xE0
768
end if
769
770
if temp3 > 0xE0
771
temp3 = 0xE0
772
end if
773
774
temp1 <<= 16
775
temp2 <<= 8
776
temp1 += temp2
777
temp1 += temp3
778
SetTableValue(temp1, temp0, Player_TailsSuperAltPal)
779
temp0++
780
loop
781
end function
782
783
784
private function ARZSetup_InitSuperKnuxPal
785
temp0 = 0
786
787
GetPaletteEntry(1, 26, temp1)
788
SetTableValue(temp1, temp0, Player_KnuxSuperAltPal)
789
temp0++
790
791
GetPaletteEntry(1, 27, temp1)
792
SetTableValue(temp1, temp0, Player_KnuxSuperAltPal)
793
temp0++
794
795
GetPaletteEntry(1, 28, temp1)
796
SetTableValue(temp1, temp0, Player_KnuxSuperAltPal)
797
temp0++
798
end function
799
800
801
private function ARZSetup_InitSuperAmyPal
802
#platform: USE_ORIGINS
803
temp0 = 0
804
805
GetPaletteEntry(1, 54, temp1)
806
SetTableValue(temp1, temp0, Player_AmySuperAltPal)
807
temp0++
808
809
GetPaletteEntry(1, 50, temp1)
810
SetTableValue(temp1, temp0, Player_AmySuperAltPal)
811
temp0++
812
813
GetPaletteEntry(1, 51, temp1)
814
SetTableValue(temp1, temp0, Player_AmySuperAltPal)
815
temp0++
816
817
GetPaletteEntry(1, 52, temp1)
818
SetTableValue(temp1, temp0, Player_AmySuperAltPal)
819
temp0++
820
821
GetPaletteEntry(1, 53, temp1)
822
SetTableValue(temp1, temp0, Player_AmySuperAltPal)
823
temp0++
824
825
while temp0 < 30
826
temp4 = temp0
827
temp4 -= 5
828
829
GetTableValue(temp1, temp4, Player_AmySuperAltPal)
830
831
temp2 = temp1
832
temp2 >>= 8
833
temp2 &= 255
834
835
temp3 = temp1
836
temp3 &= 255
837
838
temp1 >>= 16
839
temp1 += 32
840
if temp1 > 255
841
temp1 = 255
842
end if
843
844
temp2 += 32
845
if temp2 > 255
846
temp2 = 255
847
end if
848
849
temp3 += 32
850
if temp3 > 255
851
temp3 = 255
852
end if
853
854
temp1 <<= 16
855
temp2 <<= 8
856
temp1 += temp2
857
temp1 += temp3
858
SetTableValue(temp1, temp0, Player_AmySuperAltPal)
859
temp0++
860
loop
861
862
temp6 = 25
863
while temp0 < 50
864
temp5 = 0
865
while temp5 < 5
866
temp4 = temp6
867
temp4 += temp5
868
GetTableValue(temp1, temp4, Player_AmySuperAltPal)
869
SetTableValue(temp1, temp0, Player_AmySuperAltPal)
870
temp0++
871
temp5++
872
loop
873
874
temp6 -= 5
875
loop
876
#endplatform
877
end function
878
879
880
private function ARZSetup_SpeedUpMusic
881
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].type, TypeName[Music Event])
882
temp0 = checkResult
883
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].propertyValue, MUSICEVENT_TRANSITION)
884
temp0 &= checkResult
885
CheckEqual(stage.musicFlag, MUSICEVENT_FLAG_NOCHANGE)
886
temp0 &= checkResult
887
if temp0 == false
888
switch music.currentTrack
889
case TRACK_STAGE
890
SetMusicTrack("Invincibility_F.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV_F)
891
SwapMusicTrack("AquaticRuin_F.ogg", TRACK_STAGE, MUSIC_LOOP_ARZ_F, 8000)
892
break
893
894
case TRACK_INVINCIBLE
895
SetMusicTrack("AquaticRuin_F.ogg", TRACK_STAGE, MUSIC_LOOP_ARZ_F)
896
SwapMusicTrack("Invincibility_F.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV_F, 8000)
897
break
898
899
case TRACK_BOSS
900
case TRACK_DROWNING
901
case TRACK_SUPER
902
SetMusicTrack("AquaticRuin_F.ogg", TRACK_STAGE, MUSIC_LOOP_ARZ_F)
903
SetMusicTrack("Invincibility_F.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV_F)
904
break
905
end switch
906
else
907
stage.musicFlag = MUSICEVENT_FLAG_SPEEDUP
908
end if
909
end function
910
911
912
private function ARZSetup_SlowDownMusic
913
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].type, TypeName[Music Event])
914
temp0 = checkResult
915
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].propertyValue, MUSICEVENT_TRANSITION)
916
temp0 &= checkResult
917
CheckEqual(stage.musicFlag, MUSICEVENT_FLAG_NOCHANGE)
918
temp0 &= checkResult
919
if temp0 == false
920
switch music.currentTrack
921
case TRACK_STAGE
922
SetMusicTrack("Invincibility.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV)
923
SwapMusicTrack("AquaticRuin.ogg", TRACK_STAGE, MUSIC_LOOP_ARZ, 12500)
924
break
925
926
case TRACK_INVINCIBLE
927
SetMusicTrack("AquaticRuin.ogg", TRACK_STAGE, MUSIC_LOOP_ARZ)
928
SwapMusicTrack("Invincibility.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV, 12500)
929
break
930
931
case TRACK_BOSS
932
case TRACK_DROWNING
933
case TRACK_SUPER
934
SetMusicTrack("AquaticRuin.ogg", TRACK_STAGE, MUSIC_LOOP_ARZ)
935
SetMusicTrack("Invincibility.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV)
936
break
937
end switch
938
else
939
stage.musicFlag = MUSICEVENT_FLAG_SLOWDOWN
940
end if
941
end function
942
943
944
// ========================
945
// Events
946
// ========================
947
948
event ObjectUpdate
949
object.paletteTimer++
950
if object.paletteTimer == 6
951
// Animate the waterfalls
952
object.paletteTimer = 0
953
RotatePalette(0, 162, 165, true)
954
RotatePalette(1, 162, 165, true)
955
end if
956
957
if Water_flashTimer > 0
958
Water_flashTimer--
959
end if
960
end event
961
962
963
event ObjectDraw
964
temp0 = stage.waterLevel
965
temp0 -= screen.yoffset
966
if temp0 < 0
967
temp0 = 0
968
end if
969
if temp0 > screen.ysize
970
temp0 = screen.ysize
971
end if
972
973
SetActivePalette(0, 0, temp0)
974
if Water_flashTimer > 0
975
SetActivePalette(2, temp0, screen.ysize)
976
else
977
SetActivePalette(1, temp0, screen.ysize)
978
end if
979
end event
980
981
982
event ObjectStartup
983
// Set the stage layer midpoint but, this is already what's present in the scene file?
984
// So why is it set again here..?
985
stage.midPoint = 2
986
987
// Reset the boss flash color to be pure black
988
SetPaletteEntry(0, 192, 0x000000)
989
990
SetMusicTrack("AquaticRuin.ogg", TRACK_STAGE, MUSIC_LOOP_ARZ)
991
992
SpeedUpMusic = ARZSetup_SpeedUpMusic
993
SlowDownMusic = ARZSetup_SlowDownMusic
994
995
animalType1 = TypeName[Flicky]
996
animalType2 = TypeName[Pecky]
997
998
object[SLOT_ZONESETUP].type = TypeName[ARZ Setup]
999
object[SLOT_ZONESETUP].priority = PRIORITY_ACTIVE
1000
object[SLOT_ZONESETUP].drawOrder = 0
1001
1002
// Different BG properties for the different acts
1003
// -> Boss attack isn't listed here, so it uses the default values already in the scene file
1004
switch stage.actNum
1005
case 1
1006
stage.curYBoundary1 = 512
1007
tileLayer[1].scrollPos = -0x1800000
1008
tileLayer[2].scrollPos = -0x1800000
1009
tileLayer[1].parallaxFactor = 0x100
1010
tileLayer[2].parallaxFactor = 0x100
1011
break
1012
1013
case 2
1014
stage.curYBoundary1 = 384
1015
tileLayer[3].scrollPos = -0x800000
1016
tileLayer[4].scrollPos = -0x800000
1017
tileLayer[3].parallaxFactor = 0x80
1018
tileLayer[4].parallaxFactor = 0x80
1019
break
1020
end switch
1021
1022
LoadPalette("ARZ_WaterPal.act", 1, 0, 0, 256)
1023
1024
CallFunction(ARZSetup_InitSuperSonicPal)
1025
CallFunction(ARZSetup_InitSuperTailsPal)
1026
CallFunction(ARZSetup_InitSuperKnuxPal)
1027
#platform: USE_ORIGINS
1028
CallFunction(ARZSetup_InitSuperAmyPal)
1029
#endplatform
1030
1031
LoadPalette("ElectricFlash.act", 2, 0, 0, 256)
1032
Water_flashTimer = 0
1033
1034
if options.attractMode == true
1035
switch stage.playerListPos
1036
case PLAYER_SONIC_A
1037
#platform: USE_ORIGINS
1038
case PLAYER_AMY_A // Amy isn't even able to show up in demos, but check for her anyway I guess
1039
#endplatform
1040
Player_attractTable = ARZSetup_replay_attract_S
1041
Player_attractTableSize = 154
1042
Player_attractDuration = 1740
1043
break
1044
1045
case PLAYER_TAILS_A
1046
Player_attractTable = ARZSetup_replay_attract_T
1047
Player_attractTableSize = 138
1048
Player_attractDuration = 1800
1049
break
1050
1051
case PLAYER_KNUCKLES_A
1052
Player_attractTable = ARZSetup_replay_attract_K
1053
Player_attractTableSize = 126
1054
Player_attractDuration = 1800
1055
break
1056
end switch
1057
1058
CallFunction(Player_SetupAttractDemo)
1059
end if
1060
end event
1061
1062
1063
// ========================
1064
// Editor Events
1065
// ========================
1066
1067
event RSDKDraw
1068
DrawSprite(0)
1069
end event
1070
1071
1072
event RSDKLoad
1073
LoadSpriteSheet("Global/Display.gif")
1074
SpriteFrame(-16, -16, 32, 32, 1, 143)
1075
1076
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
1077
end event
1078
1079