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/CNZ/CNZSetup.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: CNZ 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.value1 : object.paletteTimer
13
private alias object.value2 : object.paletteIndex1
14
private alias object.value3 : object.paletteIndex2
15
private alias object.value4 : object.paletteIndex3
16
private alias object.value5 : object.deformTimer
17
private alias object.value6 : object.sonicPlateFrameID
18
private alias object.value7 : object.tailsPlateFrameID
19
20
// Player Aliases
21
private alias object.state : player.state
22
private alias object.gravity : player.gravity
23
private alias object.direction : player.direction
24
private alias object.left : player.left
25
private alias object.right : player.right
26
private alias object.speed : player.speed
27
private alias object.angle : player.angle
28
private alias object.animation : player.animation
29
private alias object.animationSpeed : player.animationSpeed
30
31
private alias object.value1 : player.timer
32
private alias object.value5 : player.rollAnimationSpeed
33
private alias object.value14 : player.skidding
34
private alias object.value29 : player.rollingFriction
35
private alias object.value31 : player.rollingDeceleration
36
37
// Tracks
38
private alias 0 : TRACK_STAGE
39
private alias 1 : TRACK_ACTFINISH
40
private alias 2 : TRACK_INVINCIBLE
41
private alias 3 : TRACK_CONTINUE
42
private alias 4 : TRACK_BOSS
43
private alias 5 : TRACK_GAMEOVER
44
private alias 6 : TRACK_DROWNING
45
private alias 7 : TRACK_SUPER
46
47
// Reserved object slots
48
private alias 10 : SLOT_ZONESETUP
49
private alias 25 : SLOT_MUSICEVENT_CHANGE
50
private alias 26 : SLOT_MUSICEVENT_BOSS
51
52
// Music Events
53
private alias 2 : MUSICEVENT_TRANSITION
54
55
private alias 0 : MUSICEVENT_FLAG_NOCHANGE
56
private alias 1 : MUSICEVENT_FLAG_SPEEDUP
57
private alias 2 : MUSICEVENT_FLAG_SLOWDOWN
58
59
// Music Loops
60
private alias 62820 : MUSIC_LOOP_CNZ_1P
61
private alias 50312 : MUSIC_LOOP_CNZ_1P_F
62
63
private alias 95868 : MUSIC_LOOP_CNZ_2P
64
private alias 76718 : MUSIC_LOOP_CNZ_2P_F
65
66
private alias 38679 : MUSIC_LOOP_INV
67
private alias 30897 : MUSIC_LOOP_INV_F
68
69
70
// ========================
71
// Function Declarations
72
// ========================
73
74
// These first two functions are Player states, used by the D Plunger, Spinner H, and Spinner V
75
reserve function CNZSetup_Player_TubeRoll
76
reserve function CNZSetup_Player_TubeAirRoll
77
78
reserve function CNZSetup_SpeedUpMusic1P
79
reserve function CNZSetup_SlowDownMusic1P
80
reserve function CNZSetup_SpeedUpMusic2P
81
reserve function CNZSetup_SlowDownMusic2P
82
83
84
// ========================
85
// Tables
86
// ========================
87
88
private table CNZSetup_palCycleTable
89
0xE08000, 0xE0A000, 0xC0E000
90
0xE0E0E0, 0xA0E000, 0x40E000
91
0x00C060, 0x40C0C0, 0x0080E0
92
0x0040E0, 0x4000E0, 0x8000C0
93
0xE020C0, 0xE00080, 0xE00040
94
0xE00000, 0xE04000, 0xE06000
95
end table
96
97
private table CNZSetup_sonicPlateAniTileTable
98
390, 391, 394, 395
99
398, 399, 402, 403
100
406, 407, 410, 411
101
414, 415, 418, 419
102
422, 423, 426, 427
103
430, 431, 434, 435
104
438, 439, 442, 443
105
446, 447, 450, 451
106
end table
107
108
private table CNZSetup_tailsPlateAniTileTable
109
388, 389, 392, 393
110
396, 397, 400, 401
111
404, 405, 408, 409
112
412, 413, 416, 417
113
420, 421, 424, 425
114
428, 429, 432, 433
115
436, 437, 440, 441
116
444, 445, 448, 449
117
end table
118
119
private table CNZSetup_aniTileIndexTable
120
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
121
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
122
1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
123
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
124
4, 4, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7
125
255
126
end table
127
128
private table CNZSetup_deformationTable
129
1, 2, 1, 3, 1, 2, 2, 1, 2, 3, 1, 2, 1, 2, 0, 0
130
2, 0, 3, 2, 2, 3, 2, 2, 1, 3, 0, 0, 1, 0, 1, 3
131
1, 2, 1, 3, 1, 2, 2, 1, 2, 3, 1, 2, 1, 2, 0, 0
132
2, 0, 3, 2, 2, 3, 2, 2, 1, 3, 0, 0, 1, 0, 1, 3
133
end table
134
135
private table CNZSetup_replay_attract_S
136
0x480000, 0x2AC0000
137
0x00, 73
138
0x08, 107
139
0x00, 1
140
0x30, 1
141
0x20, 3
142
0x00, 3
143
0x04, 20
144
0x00, 37
145
0x04, 23
146
0x00, 108
147
0x04, 23
148
0x00, 24
149
0x08, 60
150
0x38, 1
151
0x28, 31
152
0x08, 4
153
0x00, 9
154
0x04, 8
155
0x00, 41
156
0x08, 99
157
0x00, 2
158
0x04, 39
159
0x00, 18
160
0x08, 2
161
0x00, 9
162
0x08, 37
163
0x38, 1
164
0x28, 17
165
0x20, 6
166
0x24, 25
167
0x20, 5
168
0x28, 42
169
0x20, 8
170
0x24, 6
171
0x20, 3
172
0x28, 89
173
0x20, 1
174
0x24, 3
175
0x04, 37
176
0x00, 5
177
0x08, 45
178
0x38, 1
179
0x28, 3
180
0x20, 13
181
0x28, 8
182
0x20, 1
183
0x24, 2
184
0x04, 71
185
0x00, 115
186
0x08, 38
187
0x00, 14
188
0x08, 12
189
0x00, 1
190
0x04, 22
191
0x00, 30
192
0x30, 1
193
0x20, 2
194
0x28, 45
195
0x20, 9
196
0x28, 8
197
0x08, 51
198
0x00, 1
199
0x04, 106
200
0x00, 14
201
0x04, 9
202
0x00, 2
203
0x04, 14
204
0x00, 15
205
0x04, 18
206
0x00, 27
207
end table
208
209
private table CNZSetup_replay_attract_T
210
0x480000, 0x2B00000
211
0x00, 52
212
0x08, 105
213
0x38, 1
214
0x20, 3
215
0x00, 8
216
0x04, 20
217
0x00, 12
218
0x08, 10
219
0x38, 1
220
0x28, 41
221
0x08, 7
222
0x00, 6
223
0x04, 11
224
0x00, 3
225
0x30, 1
226
0x20, 4
227
0x28, 31
228
0x08, 73
229
0x38, 1
230
0x28, 65
231
0x08, 29
232
0x00, 20
233
0x04, 7
234
0x00, 2
235
0x08, 36
236
0x38, 1
237
0x28, 6
238
0x08, 11
239
0x00, 2
240
0x30, 1
241
0x20, 4
242
0x28, 5
243
0x08, 5
244
0x38, 1
245
0x28, 8
246
0x08, 6
247
0x00, 46
248
0x08, 114
249
0x00, 3
250
0x04, 51
251
0x00, 28
252
0x08, 27
253
0x00, 9
254
0x04, 9
255
0x00, 179
256
0x08, 38
257
0x00, 12
258
0x08, 17
259
0x00, 1
260
0x04, 4
261
0x00, 15
262
0x04, 9
263
0x00, 1
264
0x08, 15
265
0x00, 1
266
0x04, 15
267
0x00, 8
268
0x04, 18
269
0x34, 1
270
0x24, 5
271
0x04, 7
272
0x34, 1
273
0x24, 4
274
0x04, 5
275
0x30, 1
276
0x20, 4
277
0x00, 3
278
0x30, 1
279
0x20, 4
280
0x28, 3
281
0x38, 1
282
0x28, 4
283
0x38, 1
284
0x20, 4
285
0x28, 2
286
0x08, 1
287
0x38, 1
288
0x28, 3
289
0x38, 1
290
0x28, 4
291
0x08, 1
292
0x30, 1
293
0x20, 3
294
0x30, 1
295
0x20, 4
296
0x30, 1
297
0x20, 4
298
0x30, 1
299
0x20, 3
300
0x00, 1
301
0x30, 1
302
0x20, 3
303
0x30, 1
304
0x20, 4
305
0x00, 1
306
0x30, 1
307
0x20, 3
308
0x30, 1
309
0x20, 4
310
0x30, 1
311
0x20, 4
312
0x30, 1
313
0x20, 3
314
0x00, 1
315
0x30, 1
316
0x20, 3
317
0x30, 1
318
0x20, 6
319
0x30, 1
320
0x20, 1
321
0x30, 1
322
0x20, 6
323
0x30, 1
324
0x20, 3
325
0x30, 1
326
0x20, 2
327
0x28, 4
328
0x38, 1
329
0x28, 2
330
0x38, 1
331
0x28, 1
332
0x20, 6
333
0x00, 1
334
0x30, 1
335
0x20, 2
336
0x30, 1
337
0x20, 6
338
0x30, 1
339
0x20, 3
340
0x30, 1
341
0x20, 5
342
0x00, 1
343
0x30, 1
344
0x20, 2
345
0x30, 1
346
0x20, 5
347
0x00, 1
348
0x30, 1
349
0x20, 2
350
0x30, 1
351
0x20, 5
352
0x00, 1
353
0x30, 1
354
0x20, 3
355
0x30, 1
356
0x20, 5
357
0x00, 1
358
0x30, 1
359
0x20, 3
360
0x30, 1
361
0x20, 5
362
0x30, 1
363
0x20, 1
364
0x28, 3
365
0x38, 1
366
0x28, 4
367
0x38, 1
368
0x28, 1
369
0x20, 3
370
0x30, 1
371
0x20, 5
372
0x30, 1
373
0x20, 5
374
0x30, 1
375
0x20, 5
376
0x00, 1
377
0x30, 1
378
0x20, 2
379
0x30, 1
380
0x20, 4
381
0x00, 2
382
0x30, 1
383
0x20, 2
384
0x30, 1
385
0x20, 4
386
0x30, 1
387
0x20, 4
388
0x30, 1
389
0x20, 5
390
0x24, 1
391
0x04, 1
392
0x34, 1
393
0x24, 1
394
0x34, 1
395
0x24, 7
396
0x04, 1
397
0x34, 1
398
0x24, 2
399
0x20, 1
400
0x30, 1
401
0x20, 7
402
0x00, 1
403
0x34, 1
404
0x24, 3
405
0x04, 23
406
0x34, 1
407
0x20, 1
408
0x28, 2
409
0x38, 1
410
0x28, 7
411
0x08, 1
412
0x38, 1
413
0x28, 2
414
0x38, 1
415
0x28, 1
416
0x20, 4
417
0x30, 1
418
0x20, 5
419
0x30, 1
420
0x20, 3
421
0x00, 2
422
0x30, 1
423
0x20, 2
424
0x30, 1
425
0x20, 6
426
0x00, 2
427
0x30, 2
428
0x20, 7
429
0x00, 1
430
0x30, 1
431
0x20, 1
432
0x30, 1
433
0x20, 6
434
0x30, 1
435
0x20, 3
436
0x30, 1
437
0x20, 3
438
0x30, 1
439
0x20, 5
440
0x30, 1
441
0x20, 5
442
0x00, 1
443
0x30, 1
444
0x20, 2
445
0x30, 1
446
0x20, 6
447
0x00, 2
448
0x30, 2
449
0x20, 4
450
0x28, 3
451
0x08, 3
452
0x30, 1
453
0x20, 1
454
0x30, 1
455
0x24, 6
456
0x04, 2
457
0x34, 1
458
0x24, 1
459
0x34, 1
460
0x24, 7
461
0x04, 1
462
0x34, 1
463
0x24, 3
464
0x34, 1
465
0x24, 3
466
0x04, 10
467
0x00, 9
468
0x08, 10
469
0x00, 33
470
0x08, 5
471
end table
472
473
private table CNZSetup_replay_attract_K
474
0x480000, 0x2AC0000
475
0x00, 58
476
0x08, 133
477
0x38, 1
478
0x28, 12
479
0x08, 13
480
0x38, 1
481
0x28, 250
482
0x08, 32
483
0x38, 1
484
0x28, 5
485
0x08, 6
486
0x00, 9
487
0x04, 5
488
0x00, 15
489
0x04, 4
490
0x00, 8
491
0x04, 8
492
0x00, 5
493
0x04, 13
494
0x00, 25
495
0x08, 11
496
0x00, 3
497
0x04, 23
498
0x00, 4
499
0x08, 29
500
0x30, 1
501
0x24, 8
502
0x04, 1
503
0x00, 32
504
0x04, 27
505
0x34, 1
506
0x24, 2
507
0x20, 1
508
0x00, 19
509
0x08, 14
510
0x00, 10
511
0x04, 8
512
0x34, 1
513
0x24, 18
514
0x20, 2
515
0x28, 46
516
0x20, 1
517
0x24, 20
518
0x20, 1
519
0x28, 14
520
0x2A, 43
521
0x0A, 14
522
0x3A, 1
523
0x2A, 5
524
0x0A, 2
525
0x08, 8
526
0x00, 11
527
0x04, 18
528
0x34, 1
529
0x24, 72
530
0x25, 17
531
0x05, 2
532
0x04, 34
533
0x00, 12
534
0x04, 3
535
0x00, 6
536
0x04, 102
537
0x34, 1
538
0x24, 3
539
0x04, 184
540
0x34, 1
541
0x24, 24
542
0x04, 7
543
0x34, 1
544
0x24, 10
545
0x25, 14
546
0x24, 23
547
0x25, 11
548
0x21, 2
549
0x29, 2
550
0x09, 10
551
0x39, 1
552
0x29, 11
553
0x09, 16
554
0x39, 1
555
0x29, 39
556
0x28, 2
557
0x08, 12
558
0x38, 1
559
0x28, 5
560
0x20, 10
561
0x28, 47
562
0x20, 1
563
end table
564
565
566
// ========================
567
// Function Definitions
568
// ========================
569
570
public function CNZSetup_Player_TubeRoll
571
if player.gravity == GRAVITY_AIR
572
object.state = CNZSetup_Player_TubeAirRoll
573
player.timer = 0
574
CallFunction(Player_HandleAirMovement)
575
else
576
temp1 = false
577
GetBit(temp0, player.direction, 0)
578
if temp0 == FACING_RIGHT
579
if player.left == true
580
if player.speed > 0
581
player.speed -= player.rollingDeceleration
582
else
583
player.direction ^= FACING_LEFT
584
player.speed = -0x8000
585
end if
586
else
587
if player.angle == 0
588
if player.speed <= 0
589
player.speed = 0x40000
590
end if
591
end if
592
end if
593
else
594
if player.right == true
595
if player.speed < 0
596
player.speed += player.rollingDeceleration
597
else
598
player.direction ^= FACING_LEFT
599
player.speed = 0x8000
600
end if
601
else
602
if player.angle == 0
603
if player.speed >= 0
604
player.speed = -0x40000
605
end if
606
end if
607
end if
608
end if
609
610
if player.speed > 0
611
player.speed -= player.rollingFriction
612
Sin256(temp0, player.angle)
613
if temp0 > 0
614
Sin256(temp0, player.angle)
615
temp0 *= 0x5000
616
else
617
Sin256(temp0, player.angle)
618
temp0 *= 0x1E00
619
end if
620
temp0 >>= 8
621
player.speed += temp0
622
else
623
player.speed += player.rollingFriction
624
Sin256(temp0, player.angle)
625
if temp0 < 0
626
Sin256(temp0, player.angle)
627
temp0 *= 0x5000
628
else
629
Sin256(temp0, player.angle)
630
temp0 *= 0x1E00
631
end if
632
temp0 >>= 8
633
player.speed += temp0
634
end if
635
636
CallFunction(Player_HandleRollAnimSpeed)
637
player.animationSpeed = player.rollAnimationSpeed
638
CallFunction(Player_HandleOnGround)
639
end if
640
end function
641
642
643
public function CNZSetup_Player_TubeAirRoll
644
CallFunction(Player_HandleAirFriction)
645
if player.gravity == GRAVITY_AIR
646
CallFunction(Player_HandleAirMovement)
647
else
648
player.state = CNZSetup_Player_TubeRoll
649
CallFunction(Player_HandleOnGround)
650
player.skidding = 0
651
end if
652
player.animation = ANI_JUMPING
653
end function
654
655
656
private function CNZSetup_SpeedUpMusic1P
657
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].type, TypeName[Music Event])
658
temp0 = checkResult
659
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].propertyValue, MUSICEVENT_TRANSITION)
660
temp0 &= checkResult
661
CheckEqual(stage.musicFlag, MUSICEVENT_FLAG_NOCHANGE)
662
temp0 &= checkResult
663
if temp0 == false
664
switch music.currentTrack
665
case TRACK_STAGE
666
SetMusicTrack("Invincibility_F.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV_F)
667
SwapMusicTrack("CasinoNight_F.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_1P_F, 8000)
668
break
669
670
case TRACK_INVINCIBLE
671
SetMusicTrack("CasinoNight_F.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_1P_F)
672
SwapMusicTrack("Invincibility_F.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV_F, 8000)
673
break
674
675
case TRACK_BOSS
676
case TRACK_DROWNING
677
case TRACK_SUPER
678
SetMusicTrack("CasinoNight_F.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_1P_F)
679
SetMusicTrack("Invincibility_F.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV_F)
680
break
681
682
end switch
683
else
684
stage.musicFlag = MUSICEVENT_FLAG_SPEEDUP
685
end if
686
end function
687
688
689
private function CNZSetup_SlowDownMusic1P
690
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].type, TypeName[Music Event])
691
temp0 = checkResult
692
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].propertyValue, MUSICEVENT_TRANSITION)
693
temp0 &= checkResult
694
CheckEqual(stage.musicFlag, MUSICEVENT_FLAG_NOCHANGE)
695
temp0 &= checkResult
696
if temp0 == false
697
switch music.currentTrack
698
case TRACK_STAGE
699
SetMusicTrack("Invincibility.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV)
700
SwapMusicTrack("CasinoNight.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_1P, 12500)
701
break
702
703
case TRACK_INVINCIBLE
704
SetMusicTrack("CasinoNight.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_1P)
705
SwapMusicTrack("Invincibility.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV, 12500)
706
break
707
708
case TRACK_BOSS
709
case TRACK_DROWNING
710
case TRACK_SUPER
711
SetMusicTrack("CasinoNight.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_1P)
712
SetMusicTrack("Invincibility.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV)
713
break
714
715
end switch
716
else
717
stage.musicFlag = MUSICEVENT_FLAG_SLOWDOWN
718
end if
719
end function
720
721
722
private function CNZSetup_SpeedUpMusic2P
723
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].type, TypeName[Music Event])
724
temp0 = checkResult
725
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].propertyValue, MUSICEVENT_TRANSITION)
726
temp0 &= checkResult
727
CheckEqual(stage.musicFlag, MUSICEVENT_FLAG_NOCHANGE)
728
temp0 &= checkResult
729
if temp0 == false
730
switch music.currentTrack
731
case TRACK_STAGE
732
SetMusicTrack("Invincibility_F.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV_F)
733
SwapMusicTrack("CasinoNight2_F.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_2P_F, 8000)
734
break
735
736
case TRACK_INVINCIBLE
737
SetMusicTrack("CasinoNight2_F.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_2P_F)
738
SwapMusicTrack("Invincibility_F.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV_F, 8000)
739
break
740
741
case TRACK_BOSS
742
case TRACK_DROWNING
743
case TRACK_SUPER
744
SetMusicTrack("CasinoNight2_F.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_2P_F)
745
SetMusicTrack("Invincibility_F.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV_F)
746
break
747
748
end switch
749
else
750
stage.musicFlag = MUSICEVENT_FLAG_SPEEDUP
751
end if
752
end function
753
754
755
private function CNZSetup_SlowDownMusic2P
756
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].type, TypeName[Music Event])
757
temp0 = checkResult
758
CheckEqual(object[SLOT_MUSICEVENT_CHANGE].propertyValue, MUSICEVENT_TRANSITION)
759
temp0 &= checkResult
760
CheckEqual(stage.musicFlag, MUSICEVENT_FLAG_NOCHANGE)
761
temp0 &= checkResult
762
if temp0 == false
763
switch music.currentTrack
764
case TRACK_STAGE
765
SetMusicTrack("Invincibility.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV)
766
SwapMusicTrack("CasinoNight2.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_2P, 12500)
767
break
768
769
case TRACK_INVINCIBLE
770
SetMusicTrack("CasinoNight2.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_2P)
771
SwapMusicTrack("Invincibility.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV, 12500)
772
break
773
774
case TRACK_BOSS
775
case TRACK_DROWNING
776
case TRACK_SUPER
777
SetMusicTrack("CasinoNight2.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_2P)
778
SetMusicTrack("Invincibility.ogg", TRACK_INVINCIBLE, MUSIC_LOOP_INV)
779
break
780
781
end switch
782
else
783
stage.musicFlag = MUSICEVENT_FLAG_SLOWDOWN
784
end if
785
end function
786
787
788
// ========================
789
// Events
790
// ========================
791
792
event ObjectUpdate
793
object.deformTimer++
794
if object.deformTimer > 7
795
tileLayer[1].deformationOffset++
796
object.deformTimer = 0
797
end if
798
799
object.paletteTimer++
800
if object.paletteTimer == 8
801
object.paletteTimer = 0
802
RotatePalette(0, 165, 167, true)
803
RotatePalette(0, 171, 173, true)
804
RotatePalette(0, 178, 180, false)
805
806
object.paletteIndex1++
807
object.paletteIndex1 %= 18
808
GetTableValue(temp0, object.paletteIndex1, CNZSetup_palCycleTable)
809
SetPaletteEntry(0, 187, temp0)
810
811
object.paletteIndex2++
812
object.paletteIndex2 %= 18
813
GetTableValue(temp0, object.paletteIndex2, CNZSetup_palCycleTable)
814
SetPaletteEntry(0, 186, temp0)
815
816
object.paletteIndex3++
817
object.paletteIndex3 %= 18
818
GetTableValue(temp0, object.paletteIndex3, CNZSetup_palCycleTable)
819
SetPaletteEntry(0, 185, temp0)
820
end if
821
822
if object.animationTimer < 2
823
GetTableValue(temp0, object.sonicPlateFrameID, CNZSetup_aniTileIndexTable)
824
if temp0 == 0xFF
825
object.sonicPlateFrameID = 0
826
GetTableValue(temp0, object.sonicPlateFrameID, CNZSetup_aniTileIndexTable)
827
end if
828
829
temp0 <<= 2
830
GetTableValue(temp1, temp0, CNZSetup_sonicPlateAniTileTable)
831
Copy16x16Tile(760, temp1)
832
833
temp0++
834
GetTableValue(temp1, temp0, CNZSetup_sonicPlateAniTileTable)
835
Copy16x16Tile(761, temp1)
836
837
temp0++
838
GetTableValue(temp1, temp0, CNZSetup_sonicPlateAniTileTable)
839
Copy16x16Tile(762, temp1)
840
841
temp0++
842
GetTableValue(temp1, temp0, CNZSetup_sonicPlateAniTileTable)
843
Copy16x16Tile(763, temp1)
844
845
object.sonicPlateFrameID++
846
847
GetTableValue(temp0, object.tailsPlateFrameID, CNZSetup_aniTileIndexTable)
848
if temp0 == 0xFF
849
object.tailsPlateFrameID = 0
850
GetTableValue(temp0, object.tailsPlateFrameID, CNZSetup_aniTileIndexTable)
851
end if
852
853
temp0 <<= 2
854
GetTableValue(temp1, temp0, CNZSetup_tailsPlateAniTileTable)
855
Copy16x16Tile(764, temp1)
856
857
temp0++
858
GetTableValue(temp1, temp0, CNZSetup_tailsPlateAniTileTable)
859
Copy16x16Tile(765, temp1)
860
861
temp0++
862
GetTableValue(temp1, temp0, CNZSetup_tailsPlateAniTileTable)
863
Copy16x16Tile(766, temp1)
864
temp0++
865
GetTableValue(temp1, temp0, CNZSetup_tailsPlateAniTileTable)
866
Copy16x16Tile(767, temp1)
867
868
object.tailsPlateFrameID++
869
object.animationTimer = 6
870
else
871
object.animationTimer--
872
end if
873
end event
874
875
876
event ObjectStartup
877
if options.vsMode == false
878
SetMusicTrack("CasinoNight.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_1P)
879
SpeedUpMusic = CNZSetup_SpeedUpMusic1P
880
SlowDownMusic = CNZSetup_SlowDownMusic1P
881
else
882
SetMusicTrack("CasinoNight2.ogg", TRACK_STAGE, MUSIC_LOOP_CNZ_2P)
883
SpeedUpMusic = CNZSetup_SpeedUpMusic2P
884
SlowDownMusic = CNZSetup_SlowDownMusic2P
885
end if
886
887
SetPaletteEntry(0, 192, 0x000000)
888
889
animalType1 = TypeName[Flicky]
890
animalType2 = TypeName[Becky]
891
892
arrayPos0 = 0
893
while arrayPos0 < 576
894
temp0 = arrayPos0
895
temp0 &= 0x3F
896
GetTableValue(stage.deformationData2[arrayPos0], temp0, CNZSetup_deformationTable)
897
arrayPos0++
898
loop
899
900
// 10 = SLOT_ZONESETUP
901
object[10].type = TypeName[CNZ Setup]
902
object[10].priority = PRIORITY_ACTIVE
903
object[10].paletteIndex2 = 1
904
object[10].paletteIndex3 = 2
905
object[10].tailsPlateFrameID = 70
906
907
if options.attractMode == true
908
switch stage.playerListPos
909
case PLAYER_SONIC_A
910
#platform: USE_ORIGINS
911
case PLAYER_AMY_A // Amy isn't even able to show up in demos, but check for her anyway I guess
912
#endplatform
913
Player_attractTable = CNZSetup_replay_attract_S
914
Player_attractTableSize = 142
915
Player_attractDuration = 1800
916
break
917
918
case PLAYER_TAILS_A
919
Player_attractTable = CNZSetup_replay_attract_T
920
Player_attractTableSize = 522
921
Player_attractDuration = 1800
922
break
923
924
case PLAYER_KNUCKLES_A
925
Player_attractTable = CNZSetup_replay_attract_K
926
Player_attractTableSize = 178
927
Player_attractDuration = 1800
928
break
929
end switch
930
931
CallFunction(Player_SetupAttractDemo)
932
end if
933
end event
934
935
936
// ========================
937
// Editor Events
938
// ========================
939
940
event RSDKDraw
941
DrawSprite(0)
942
end event
943
944
945
event RSDKLoad
946
LoadSpriteSheet("Global/Display.gif")
947
SpriteFrame(-16, -16, 32, 32, 1, 143)
948
949
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
950
end event
951
952