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/Ending/Tornado.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Tornado 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.frame : object.propellerFrame // In states 0-2
13
private alias object.frame : object.tornadoFrame // For the rest of them
14
15
private alias object.value0 : object.timer
16
17
private alias object.value1 : object.pilot.frame
18
private alias object.value2 : object.pilot.timer
19
private alias object.value3 : object.pilot.index
20
21
private alias object.value4 : object.zoomoutSprIndex
22
23
private alias object.value5 : object.logo.timer
24
private alias object.value6 : object.text.frame
25
private alias object.value7 : object.number.frame
26
private alias object.value8 : object.logo.frame
27
28
private alias object.value9 : object.superSonic.state
29
private alias object.value10 : object.superSonic.frame
30
private alias object.value11 : object.superSonic.index
31
private alias object.value12 : object.superSonic.timer
32
private alias object.value13 : object.superSonic.x
33
private alias object.value14 : object.superSonic.y
34
35
private alias object.value15 : object.superBlendTimer
36
private alias object.value16 : object.superBlendColor
37
38
private alias 0 : TORNADO_CATCHPLAYER
39
private alias 1 : TORNADO_STABALIZE
40
private alias 2 : TORNADO_FLYING
41
private alias 3 : TORNADO_FLYINTOBG
42
private alias 4 : TORNADO_OFFSCREEN
43
private alias 5 : TORNADO_FLYINTOSCREEN
44
private alias 6 : TORNADO_INITLOGO
45
private alias 7 : TORNADO_FADEINLOGO
46
private alias 8 : TORNADO_LOGOSHINE_TEXT
47
private alias 9 : TORNADO_LOGOSHINE_NUMBER
48
private alias 10 : TORNADO_DISPLAY
49
private alias 11 : TORNADO_FADEOUT
50
51
private alias 0 : SUPERSONIC_DESCEND
52
private alias 1 : SUPERSONIC_MEETTORNADO
53
private alias 2 : SUPERSONIC_FLYALONGTORNADO
54
private alias 3 : SUPERSONIC_FLYINTOBG
55
private alias 4 : SUPERSONIC_OFFSCREEN
56
private alias 5 : SUPERSONIC_FLYINTOSCREEN
57
private alias 6 : SUPERSONIC_DISPLAY
58
59
// Player Aliases
60
private alias object.xpos : player.xpos
61
private alias object.ypos : player.ypos
62
private alias object.animation : player.animation
63
private alias object.visible : player.visible
64
65
private alias 0 : SUPERSTATE_NONE
66
67
// Bird Aliases
68
private alias object.value0 : bird.timer
69
70
71
// ========================
72
// Function Declarations
73
// ========================
74
75
reserve function Tornado_HandleSuperTailsPal
76
reserve function Tornado_AnimatePilot
77
78
79
// ========================
80
// Tables
81
// ========================
82
83
// Format followed for below two tables - first number is frame ID, second number is frame duration
84
private table Tornado_PilotAni_Tails
85
5, 32
86
6, 8
87
7, 8
88
8, 8
89
7, 8
90
6, 16
91
9, 32
92
6, 16
93
end table
94
95
private table Tornado_PilotAni_Sonic
96
10, 9
97
11, 9
98
10, 9
99
11, 9
100
10, 9
101
11, 9
102
10, 9
103
11, 9
104
end table
105
106
private table Tornado_ZoomoutSprites_Sonic
107
19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 22
108
22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23
109
end table
110
111
private table Tornado_ZoomoutSprites_SS // full name would be Tornado_ZoomoutSprites_SuperSonic but there's a 32 chars name length max lol
112
12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 15
113
15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
114
end table
115
116
private table Tornado_ZoomoutSprites_Tails
117
27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 30
118
30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31
119
end table
120
121
private table Tornado_ZoomoutSprites_Knuckles
122
35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 36, 37, 37, 37, 38
123
38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39
124
end table
125
126
private table Tornado_ZoomoutSprites_Amy
127
60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, 63
128
63, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
129
end table
130
131
private table Tornado_ZoomoutPositions
132
0xA00000, 0x700000
133
0xB00000, 0x700000
134
0xB60000, 0x710000
135
0xBC0000, 0x720000
136
0xC40000, 0x740000
137
0xC80000, 0x750000
138
0xCA0000, 0x760000
139
0xCC0000, 0x770000
140
0xCE0000, 0x780000
141
0xD00000, 0x790000
142
0xD20000, 0x7A0000
143
0xD40000, 0x7B0000
144
0xD60000, 0x7C0000
145
0xD90000, 0x7E0000
146
0xDC0000, 0x810000
147
0xDE0000, 0x840000
148
0xE10000, 0x870000
149
0xE40000, 0x8B0000
150
0xE70000, 0x8F0000
151
0xEC0000, 0x940000
152
0xF00000, 0x990000
153
0xF50000, 0x9D0000
154
0xF90000, 0xA40000
155
0x1000000, 0xAC0000
156
0x1080000, 0xB80000
157
0x1120000, 0xC40000
158
0x11F0000, 0xD30000
159
0x12C0000, 0xFA0000
160
end table
161
162
private table Tornado_SuperSonic_Sprites
163
43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46
164
46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48
165
end table
166
167
private table Tornado_SuperSonic_Positions
168
0xC00000, 0x900000
169
0xB00000, 0x910000
170
0xA80000, 0x920000
171
0x9B0000, 0x960000
172
0x990000, 0x980000
173
0x980000, 0x990000
174
0x990000, 0x9A0000
175
0x9B0000, 0x9C0000
176
0x9F0000, 0x9E0000
177
0xA40000, 0xA00000
178
0xAC0000, 0xA20000
179
0xB70000, 0xA50000
180
0xC40000, 0xA80000
181
0xD30000, 0xAB0000
182
0xDE0000, 0xAE0000
183
0xE80000, 0xB00000
184
0xEF0000, 0xB20000
185
0xF40000, 0xB50000
186
0xF90000, 0xB80000
187
0xFC0000, 0xBB0000
188
0xFE0000, 0xBE0000
189
0xFF0000, 0xC00000
190
0x1000000, 0xC20000
191
0x1010000, 0xC50000
192
0x1020000, 0xC80000
193
0x1020000, 0xCC0000
194
0x1010000, 0xD10000
195
0xFD0000, 0xD70000
196
0xF90000, 0xDE0000
197
0xF90000, 0x1180000
198
0x600000, 0x880000
199
0x500000, 0x680000
200
0x440000, 0x460000
201
0x3C0000, 0x360000
202
0x360000, 0x2A0000
203
0x330000, 0x240000
204
0x310000, 0x200000
205
0x300000, 0x1E0000
206
end table
207
208
private table Tornado_EndPosePositions
209
-0x3A0000, -0x880000
210
-0x0C0000, -0x220000
211
-0x080000, -0x100000
212
-0x040000, -0x080000
213
-0x020000, -0x040000
214
-0x010000, -0x020000
215
-0x010000, -0x020000
216
end table
217
218
// Bug Details:
219
// ..5453? it's supposed to be "54, 53" but i think they forgot a comma..
220
// The flash's fade-out is just supposed to be in the fade-in but in reverse, but this typo makes the fade-out a bit more abrupt than it should be
221
// (5453 isn't even a valid SpriteFrame number..)
222
private table Tornado_LogoTextFlash
223
51, 53, 54, 55, 5453, 51
224
end table
225
226
private table Tornado_LogoNumberFlash
227
51, 56, 57, 58, 59, 58, 57, 56, 51
228
end table
229
230
231
// ========================
232
// Function Definitions
233
// ========================
234
235
private function Tornado_HandleSuperTailsPal
236
object.superBlendTimer++
237
if object.superBlendTimer >= 12
238
object.superBlendTimer = 0
239
240
object.superBlendColor += 4
241
if object.superBlendColor >= 24
242
object.superBlendColor = 0
243
end if
244
end if
245
246
temp1 = object.superBlendColor
247
GetTableValue(temp0, temp1, Player_TailsSuperPal)
248
SetPaletteEntry(0, 202, temp0)
249
250
temp1++
251
252
GetTableValue(temp0, temp1, Player_TailsSuperPal)
253
SetPaletteEntry(0, 205, temp0)
254
255
temp1++
256
257
GetTableValue(temp0, temp1, Player_TailsSuperPal)
258
SetPaletteEntry(0, 206, temp0)
259
260
temp1++
261
262
GetTableValue(temp0, temp1, Player_TailsSuperPal)
263
SetPaletteEntry(0, 203, temp0)
264
end function
265
266
267
private function Tornado_AnimatePilot
268
object.propellerFrame++
269
object.propellerFrame &= 3
270
271
if object.pilot.timer < 2
272
if stage.playerListPos == PLAYER_TAILS_A
273
// Sonic pilots the Tornado when Tails is being saved
274
275
// Get the sprite
276
GetTableValue(object.pilot.frame, object.pilot.index, Tornado_PilotAni_Sonic)
277
object.pilot.index++
278
279
// Get its duration
280
GetTableValue(object.pilot.timer, object.pilot.index, Tornado_PilotAni_Sonic)
281
object.pilot.index++
282
else
283
// Tails pilots the Tornado for everyone else
284
285
// Get the sprite
286
GetTableValue(object.pilot.frame, object.pilot.index, Tornado_PilotAni_Tails)
287
object.pilot.index++
288
289
// Get its duration
290
GetTableValue(object.pilot.timer, object.pilot.index, Tornado_PilotAni_Tails)
291
object.pilot.index++
292
end if
293
294
// Loop after a cycle of 16
295
object.pilot.index &= 15
296
else
297
object.pilot.timer--
298
end if
299
end function
300
301
302
// ========================
303
// Events
304
// ========================
305
306
event ObjectUpdate
307
object.drawOrder = 4
308
309
if stage.playerListPos == PLAYER_TAILS_A
310
if Player_superState != SUPERSTATE_NONE
311
CallFunction(Tornado_HandleSuperTailsPal)
312
end if
313
end if
314
315
switch object.state
316
case TORNADO_CATCHPLAYER
317
object.xpos += 0x10000
318
object.ypos -= 0x8000
319
320
if object.xpos == 0xB40000
321
if Player_superState != SUPERSTATE_NONE
322
if stage.playerListPos == PLAYER_KNUCKLES_A // (PLAYER_KNUCKLES in Origins)
323
player[0].animation = ANI_GLIDING_DROP
324
end if
325
#platform: USE_ORIGINS
326
if stage.playerListPos == PLAYER_KNUCKLES_TAILS
327
player[0].animation = ANI_GLIDING_DROP
328
end if
329
#endplatform
330
end if
331
end if
332
333
if object.xpos > 0xD40000
334
#platform: USE_ORIGINS
335
switch stage.playerListPos
336
case PLAYER_AMY_A
337
case PLAYER_AMY_TAILS_A
338
// Move Amy down a bit more
339
player[0].ypos += 0x30000
340
break
341
end switch
342
#endplatform
343
344
if Player_superState == SUPERSTATE_NONE
345
player[0].animation = ANI_STOPPED
346
else
347
#platform: USE_STANDALONE
348
if stage.playerListPos == PLAYER_TAILS_A
349
player[0].animation = ANI_STOPPED
350
end if
351
352
if stage.playerListPos == PLAYER_KNUCKLES_A
353
player[0].animation = ANI_STOPPED
354
end if
355
#endplatform
356
357
#platform: USE_ORIGINS
358
// I don't understand why they don't just check if the player isn't Sonic
359
switch stage.playerListPos
360
case PLAYER_TAILS_A
361
case PLAYER_KNUCKLES_A
362
case PLAYER_KNUCKLES_TAILS_A
363
case PLAYER_AMY_A
364
case PLAYER_AMY_TAILS_A
365
player[0].animation = ANI_STOPPED
366
break
367
end switch
368
#endplatform
369
end if
370
371
EndingSetup_scrollVelocity.x = -0x10000
372
373
// Create a flock of birds
374
arrayPos0 = object[34].entityPos // ..aka "arrayPos0 = 34"
375
temp0 = 0
376
temp1 = 0
377
temp3 = false
378
while temp0 < 20
379
object[arrayPos0].type = TypeName[Bird]
380
object[arrayPos0].priority = PRIORITY_ACTIVE
381
bird[arrayPos0].timer = temp1
382
if temp3 == false
383
object[arrayPos0].drawOrder = 3
384
else
385
object[arrayPos0].drawOrder = 5
386
end if
387
388
temp3 ^= true
389
390
Rand(temp2, 16)
391
temp1 += temp2
392
arrayPos0++
393
temp0++
394
loop
395
396
switch stage.playerListPos
397
case PLAYER_SONIC_A
398
case PLAYER_SONIC_TAILS_A
399
if specialStage.emeralds >= 0x7F
400
object.superSonic.timer = 64
401
object.superSonic.state = SUPERSONIC_MEETTORNADO
402
403
stage.newXBoundary2 = screen.xsize
404
stage.newYBoundary2 = 376
405
stage.newYBoundary2 += screen.ysize
406
407
stage.deathBoundary = stage.newYBoundary2
408
stage.deathBoundary <<= 16
409
end if
410
break
411
end switch
412
413
object.state = TORNADO_STABALIZE
414
end if
415
416
CallFunction(Tornado_AnimatePilot)
417
break
418
419
case TORNADO_STABALIZE
420
EndingSetup_scrollVelocity.y += 0x400
421
if EndingSetup_scrollVelocity.y >= 0
422
object.state = TORNADO_FLYING
423
end if
424
CallFunction(Tornado_AnimatePilot)
425
break
426
427
case TORNADO_FLYING
428
object.timer++
429
if object.timer >= 1102
430
object.timer = 0
431
switch stage.playerListPos
432
case PLAYER_SONIC_A
433
case PLAYER_SONIC_TAILS_A
434
if Player_superState == SUPERSTATE_NONE
435
player[0].visible = false
436
end if
437
break
438
439
case PLAYER_TAILS_A
440
case PLAYER_KNUCKLES_A
441
#platform: USE_ORIGINS
442
case PLAYER_KNUCKLES_TAILS_A
443
case PLAYER_AMY_A
444
case PLAYER_AMY_TAILS_A
445
#endplatform
446
player[0].visible = false
447
break
448
end switch
449
450
object.state = TORNADO_FLYINTOBG
451
end if
452
CallFunction(Tornado_AnimatePilot)
453
break
454
455
case TORNADO_FLYINTOBG
456
switch stage.playerListPos
457
case PLAYER_SONIC_A
458
case PLAYER_SONIC_TAILS_A
459
if Player_superState != SUPERSTATE_NONE
460
if object.superSonic.state != SUPERSONIC_FLYINTOBG
461
object.superSonic.timer++
462
if object.superSonic.timer >= 90
463
object.superSonic.timer = 0
464
player[0].visible = false
465
object.superSonic.state = SUPERSONIC_FLYINTOBG
466
end if
467
end if
468
end if
469
break
470
end switch
471
472
object.timer--
473
if object.timer < 0
474
object.timer = 2
475
switch stage.playerListPos
476
case PLAYER_SONIC_A
477
case PLAYER_SONIC_TAILS_A
478
if specialStage.emeralds < 0x7F
479
GetTableValue(object.tornadoFrame, object.zoomoutSprIndex, Tornado_ZoomoutSprites_Sonic)
480
else
481
GetTableValue(object.tornadoFrame, object.zoomoutSprIndex, Tornado_ZoomoutSprites_SS)
482
end if
483
break
484
485
case PLAYER_TAILS_A
486
GetTableValue(object.tornadoFrame, object.zoomoutSprIndex, Tornado_ZoomoutSprites_Tails)
487
break
488
489
case PLAYER_KNUCKLES_A
490
#platform: USE_ORIGINS
491
case PLAYER_KNUCKLES_TAILS_A
492
#endplatform
493
GetTableValue(object.tornadoFrame, object.zoomoutSprIndex, Tornado_ZoomoutSprites_Knuckles)
494
break
495
496
#platform: USE_ORIGINS
497
case PLAYER_AMY_A
498
case PLAYER_AMY_TAILS_A
499
GetTableValue(object.tornadoFrame, object.zoomoutSprIndex, Tornado_ZoomoutSprites_Amy)
500
#endplatform
501
end switch
502
503
temp0 = object.zoomoutSprIndex
504
temp0 <<= 1
505
GetTableValue(object.xpos, temp0, Tornado_ZoomoutPositions)
506
object.xpos += 0x340000
507
508
temp0++
509
GetTableValue(object.ypos, temp0, Tornado_ZoomoutPositions)
510
511
temp0 = camera[0].ypos
512
temp0 -= screen.ycenter
513
temp0 += 32
514
temp0 <<= 16
515
object.ypos += temp0
516
517
object.zoomoutSprIndex++
518
if object.zoomoutSprIndex >= 28
519
object.timer = 0
520
object.zoomoutSprIndex = 0
521
if stage.playerListPos == PLAYER_TAILS_A
522
object.tornadoFrame = 49
523
else
524
object.tornadoFrame = 50
525
end if
526
object.xpos -= 0x220000
527
object.ypos += 0x450000
528
object.state = TORNADO_OFFSCREEN
529
end if
530
end if
531
break
532
533
case TORNADO_OFFSCREEN
534
switch stage.playerListPos
535
case PLAYER_SONIC_A
536
case PLAYER_SONIC_TAILS_A
537
if Player_superState != SUPERSTATE_NONE
538
if object.superSonic.state != SUPERSONIC_FLYINTOBG
539
object.superSonic.timer++
540
if object.superSonic.timer >= 90
541
object.superSonic.timer = 0
542
player[0].visible = false
543
object.superSonic.state = SUPERSONIC_FLYINTOBG
544
end if
545
end if
546
end if
547
break
548
end switch
549
550
object.timer++
551
if object.timer >= 120
552
object.timer = 0
553
object.state = TORNADO_FLYINTOSCREEN
554
end if
555
break
556
557
case TORNADO_FLYINTOSCREEN
558
object.timer--
559
if object.timer < 0
560
object.timer = 2
561
temp0 = object.zoomoutSprIndex
562
temp0 <<= 1
563
GetTableValue(temp1, temp0, Tornado_EndPosePositions)
564
object.xpos += temp1
565
566
temp0++
567
GetTableValue(temp1, temp0, Tornado_EndPosePositions)
568
object.ypos += temp1
569
object.zoomoutSprIndex++
570
if object.zoomoutSprIndex >= 7
571
object.timer = 0
572
object.state = TORNADO_INITLOGO
573
end if
574
end if
575
break
576
577
case TORNADO_INITLOGO
578
object.timer++
579
if object.timer == 4
580
object.timer = 0
581
GetTableValue(object.text.frame, 0, Tornado_LogoTextFlash)
582
GetTableValue(object.number.frame, 0, Tornado_LogoNumberFlash)
583
object.state = TORNADO_FADEINLOGO
584
end if
585
break
586
587
case TORNADO_FADEINLOGO
588
if object.alpha < 256
589
object.alpha += 4
590
end if
591
592
object.timer++
593
if object.timer == 90
594
object.timer = 0
595
object.logo.frame = 0
596
object.state = TORNADO_LOGOSHINE_TEXT
597
end if
598
break
599
600
case TORNADO_LOGOSHINE_TEXT
601
object.logo.timer++
602
if object.logo.timer == 2
603
object.logo.timer = 0
604
object.logo.frame++
605
GetTableValue(object.text.frame, object.logo.frame, Tornado_LogoTextFlash)
606
if object.logo.frame == 6
607
object.logo.frame = 0
608
object.state = TORNADO_LOGOSHINE_NUMBER
609
end if
610
end if
611
break
612
613
case TORNADO_LOGOSHINE_NUMBER
614
object.logo.timer++
615
if object.logo.timer == 2
616
object.logo.timer = 0
617
object.logo.frame++
618
GetTableValue(object.number.frame, object.logo.frame, Tornado_LogoNumberFlash)
619
if object.logo.frame == 9
620
object.logo.frame = 0
621
object.state = TORNADO_DISPLAY
622
end if
623
end if
624
break
625
626
case TORNADO_DISPLAY
627
object.timer++
628
if object.timer >= 240
629
object.timer = 0
630
object.state = TORNADO_FADEOUT
631
end if
632
break
633
634
case TORNADO_FADEOUT
635
if object.timer < 320
636
object.timer += 12
637
else
638
// Roll the credits!
639
stage.activeList = PRESENTATION_STAGE
640
stage.listPos = 2
641
LoadStage()
642
end if
643
644
if object.timer > 0
645
temp0 = object.timer
646
else
647
temp0 = 0
648
end if
649
SetScreenFade(0x00, 0x00, 0x00, temp0)
650
break
651
end switch
652
653
switch object.superSonic.state
654
case SUPERSONIC_DESCEND
655
break
656
657
case SUPERSONIC_MEETTORNADO
658
player[0].xpos += 0x08000
659
player[0].ypos += 0x10000
660
object.superSonic.timer--
661
if object.superSonic.timer < 0
662
object.superSonic.x = player[0].xpos
663
object.superSonic.y = player[0].ypos
664
object.superSonic.state = SUPERSONIC_FLYALONGTORNADO
665
end if
666
break
667
668
case SUPERSONIC_FLYALONGTORNADO
669
break
670
671
case SUPERSONIC_FLYINTOBG
672
object.superSonic.timer--
673
if object.superSonic.timer < 0
674
object.superSonic.timer = 2
675
GetTableValue(object.superSonic.frame, object.superSonic.index, Tornado_SuperSonic_Sprites)
676
temp0 = object.superSonic.index
677
temp0 <<= 1
678
679
GetTableValue(object.superSonic.x, temp0, Tornado_SuperSonic_Positions)
680
object.superSonic.x += 0x340000
681
temp0++
682
683
GetTableValue(object.superSonic.y, temp0, Tornado_SuperSonic_Positions)
684
temp0 = camera[0].ypos
685
temp0 -= screen.ycenter
686
temp0 += 32
687
temp0 <<= 16
688
object.superSonic.y += temp0
689
690
object.superSonic.index++
691
if object.superSonic.index >= 30
692
object.superSonic.timer = 0
693
object.superSonic.state = SUPERSONIC_OFFSCREEN
694
end if
695
end if
696
break
697
698
case SUPERSONIC_OFFSCREEN
699
object.superSonic.timer++
700
if object.superSonic.timer >= 60
701
object.superSonic.timer = 0
702
object.superSonic.state = SUPERSONIC_FLYINTOSCREEN
703
end if
704
break
705
706
case SUPERSONIC_FLYINTOSCREEN
707
object.superSonic.timer--
708
if object.superSonic.timer < 0
709
object.superSonic.timer = 2
710
GetTableValue(object.superSonic.frame, object.superSonic.index, Tornado_SuperSonic_Sprites)
711
temp0 = object.superSonic.index
712
temp0 <<= 1
713
714
GetTableValue(object.superSonic.x, temp0, Tornado_SuperSonic_Positions)
715
object.superSonic.x += 0x340000
716
temp0++
717
718
GetTableValue(object.superSonic.y, temp0, Tornado_SuperSonic_Positions)
719
temp0 = camera[0].ypos
720
temp0 -= screen.ycenter
721
temp0 += 32
722
temp0 <<= 16
723
object.superSonic.y += temp0
724
725
object.superSonic.index++
726
if object.superSonic.index >= 38
727
object.superSonic.state = SUPERSONIC_DISPLAY
728
end if
729
end if
730
break
731
732
case SUPERSONIC_DISPLAY
733
// Just hover in front of the screen, nothing to do here
734
break
735
end switch
736
end event
737
738
739
event ObjectDraw
740
switch object.state
741
case TORNADO_CATCHPLAYER
742
case TORNADO_STABALIZE
743
case TORNADO_FLYING
744
// The Tornado is in its normal 2D version right now, so just draw the propeller, the Tornado, and its pilot
745
DrawSprite(object.propellerFrame)
746
DrawSprite(4)
747
DrawSprite(object.pilot.frame)
748
break
749
750
case TORNADO_FLYINTOBG
751
DrawSprite(object.tornadoFrame)
752
break
753
754
case TORNADO_OFFSCREEN
755
break
756
757
case TORNADO_FLYINTOSCREEN
758
DrawSprite(object.tornadoFrame)
759
760
temp0 = object.xpos
761
temp1 = object.ypos
762
763
// Draw the first frame of the character posing for the screen
764
switch stage.playerListPos
765
case PLAYER_SONIC_A
766
case PLAYER_SONIC_TAILS_A
767
if specialStage.emeralds < 0x7F
768
temp0 -= 0x220000
769
temp1 -= 0x2F0000
770
DrawSpriteXY(24, temp0, temp1)
771
end if
772
break
773
774
case PLAYER_TAILS_A
775
temp0 -= 0x240000
776
temp1 -= 0x2D0000
777
DrawSpriteXY(32, temp0, temp1)
778
break
779
780
case PLAYER_KNUCKLES_A
781
#platform: USE_ORIGINS
782
case PLAYER_KNUCKLES_TAILS_A
783
#endplatform
784
temp0 -= 0x220000
785
temp1 -= 0x2F0000
786
DrawSpriteXY(40, temp0, temp1)
787
break
788
789
#platform: USE_ORIGINS
790
case PLAYER_AMY_A
791
case PLAYER_AMY_TAILS_A
792
temp0 -= 0x220000
793
temp1 -= 0x2F0000
794
DrawSpriteXY(65, temp0, temp1)
795
break
796
#endplatform
797
end switch
798
break
799
800
case TORNADO_INITLOGO
801
DrawSprite(object.tornadoFrame)
802
803
temp0 = object.xpos
804
temp1 = object.ypos
805
806
// Draw the second frame of the character posing for the screen
807
switch stage.playerListPos
808
case PLAYER_SONIC_A
809
case PLAYER_SONIC_TAILS_A
810
if specialStage.emeralds < 0x7F
811
temp0 -= 0x2A0000
812
temp1 -= 0x2F0000
813
DrawSpriteXY(25, temp0, temp1)
814
end if
815
break
816
817
case PLAYER_TAILS_A
818
temp0 -= 0x2A0000
819
temp1 -= 0x250000
820
DrawSpriteXY(33, temp0, temp1)
821
break
822
823
case PLAYER_KNUCKLES_A
824
#platform: USE_ORIGINS
825
case PLAYER_KNUCKLES_TAILS_A
826
#endplatform
827
temp0 -= 0x2A0000
828
temp1 -= 0x270000
829
DrawSpriteXY(41, temp0, temp1)
830
break
831
832
#platform: USE_ORIGINS
833
case PLAYER_AMY_A
834
case PLAYER_AMY_TAILS_A
835
temp0 -= 0x2A0000
836
temp1 -= 0x2F0000
837
DrawSpriteXY(66, temp0, temp1)
838
break
839
#endplatform
840
end switch
841
break
842
843
case TORNADO_FADEINLOGO
844
case TORNADO_LOGOSHINE_TEXT
845
case TORNADO_LOGOSHINE_NUMBER
846
case TORNADO_DISPLAY
847
case TORNADO_FADEOUT
848
// First draw the base logo
849
temp0 = screen.xsize
850
temp0 -= 79
851
temp1 = screen.ysize
852
temp1 -= 38
853
DrawSpriteScreenFX(52, FX_INK, temp0, temp1)
854
855
// Then draw its shines on top of it
856
DrawSpriteScreenFX(object.text.frame, FX_INK, temp0, temp1)
857
DrawSpriteScreenFX(object.number.frame, FX_INK, temp0, temp1)
858
859
// And the actual Tornado sprite
860
DrawSprite(object.tornadoFrame)
861
862
temp0 = object.xpos
863
temp1 = object.ypos
864
865
// And then draw the character posing in front of it
866
switch stage.playerListPos
867
case PLAYER_SONIC_A
868
case PLAYER_SONIC_TAILS_A
869
if specialStage.emeralds < 0x7F
870
// Only normal Sonic is drawn here
871
// Super Sonic has his own entire process below
872
temp0 -= 0x6E0000
873
temp1 -= 0x670000
874
DrawSpriteXY(26, temp0, temp1)
875
end if
876
break
877
878
case PLAYER_TAILS_A
879
temp0 -= 0x6D0000
880
temp1 -= 0x670000
881
DrawSpriteXY(34, temp0, temp1)
882
break
883
884
case PLAYER_KNUCKLES_A
885
#platform: USE_ORIGINS
886
case PLAYER_KNUCKLES_TAILS_A
887
#endplatform
888
temp0 -= 0x660000
889
temp1 -= 0x670000
890
DrawSpriteXY(42, temp0, temp1)
891
break
892
893
#platform: USE_ORIGINS
894
case PLAYER_AMY_A
895
case PLAYER_AMY_TAILS_A
896
temp0 -= 0x6E0000
897
temp1 -= 0x670000
898
DrawSpriteXY(67, temp0, temp1)
899
break
900
#endplatform
901
end switch
902
break
903
end switch
904
905
switch object.superSonic.state
906
case SUPERSONIC_FLYINTOBG
907
case SUPERSONIC_OFFSCREEN
908
case SUPERSONIC_FLYINTOSCREEN
909
case SUPERSONIC_DISPLAY
910
DrawSpriteXY(object.superSonic.frame, object.superSonic.x, object.superSonic.y)
911
break
912
end switch
913
914
if object.state >= TORNADO_FLYINTOSCREEN
915
GetBit(temp0, oscillation, 1)
916
temp0 += 17
917
DrawSprite(temp0)
918
end if
919
end event
920
921
922
event ObjectStartup
923
LoadSpriteSheet("Ending/Objects.gif")
924
925
// 0-3 - Front Propeller Frames
926
SpriteFrame(21, 8, 4, 24, 373, 191)
927
SpriteFrame(21, 11, 4, 18, 378, 194)
928
SpriteFrame(21, 16, 4, 8, 383, 199)
929
SpriteFrame(21, 11, 4, 18, 388, 194)
930
931
// 4 - Main Tornado Frame
932
SpriteFrame(-95, -16, 116, 64, 256, 191)
933
934
// 5-9 - Tails Piloting the Tornado Frames
935
SpriteFrame(-45, -8, 21, 16, 256, 174) // 5 - Looking straight ahead
936
SpriteFrame(-45, -8, 21, 16, 278, 174) // 6 - Normal head sprite (~3/4 angle one cropped from normal standing sprite)
937
SpriteFrame(-45, -8, 21, 16, 300, 174) // 7 - Mid-blink frame
938
SpriteFrame(-45, -8, 21, 16, 322, 174) // 8 - Blink frame with fully closed eyes
939
SpriteFrame(-47, -8, 23, 16, 344, 174) // 9 - Looking up
940
941
// 10-11 - Sonic Piloting the Tornado Frames
942
SpriteFrame(-50, -8, 24, 16, 256, 157)
943
SpriteFrame(-50, -8, 24, 16, 281, 157)
944
945
//12-16 - Zoomout Tornado shots, Tails as pilot and no passenger
946
SpriteFrame(-32, -16, 60, 32, 1, 1)
947
SpriteFrame(-24, -12, 44, 24, 63, 1)
948
SpriteFrame(-20, -12, 39, 24, 108, 1)
949
SpriteFrame(-20, -12, 40, 24, 149, 1)
950
SpriteFrame(-19, -12, 38, 24, 190, 1)
951
952
// 17-18 - Zoomout Propeller Frames
953
SpriteFrame(-10, 7, 31, 31, 1, 34)
954
SpriteFrame(-11, 6, 31, 31, 33, 34)
955
956
// 19-23 - Zoomout Tornado Frames, Tails as pilot and Sonic as passenger
957
SpriteFrame(-32, -28, 60, 44, 65, 26)
958
SpriteFrame(-24, -24, 44, 36, 126, 26)
959
SpriteFrame(-20, -19, 39, 31, 171, 26)
960
SpriteFrame(-20, -19, 40, 31, 211, 26)
961
SpriteFrame(-19, -15, 38, 27, 1, 146)
962
963
// 24-26 - Normal Sonic Posing Frames
964
SpriteFrame(0, 0, 31, 38, 4, 179)
965
SpriteFrame(2, 5, 29, 42, 36, 175)
966
SpriteFrame(3, 3, 77, 96, 178, 159)
967
968
// 27-31 - Zoomout Tornado Frames, Sonic as pilot and Tails as passenger
969
SpriteFrame(-32, -26, 60, 42, 1, 68)
970
SpriteFrame(-24, -23, 44, 34, 62, 75)
971
SpriteFrame(-20, -18, 39, 30, 1, 115)
972
SpriteFrame(-20, -19, 40, 31, 41, 115)
973
SpriteFrame(-19, -15, 38, 27, 82, 115)
974
975
// 32-34 - Tails Posing Frame
976
SpriteFrame(0, 2, 31, 36, 1, 219)
977
SpriteFrame(0, 10, 32, 37, 33, 218)
978
SpriteFrame(1, 0, 111, 96, 66, 159)
979
980
// 35-39 - Zoomout Tornado Frames, Tails as pilot and Knuckles as passenger
981
SpriteFrame(-32, -32, 60, 48, 181, 256)
982
SpriteFrame(-24, -24, 44, 36, 181, 305)
983
SpriteFrame(-20, -19, 39, 31, 181, 342)
984
SpriteFrame(-20, -19, 40, 31, 181, 374)
985
SpriteFrame(-19, -15, 38, 27, 181, 406)
986
987
// 40-42 - Knuckles Posing Frames
988
SpriteFrame(0, 0, 31, 38, 382, 217)
989
SpriteFrame(0, 0, 32, 39, 414, 216)
990
SpriteFrame(0, 0, 64, 104, 447, 151)
991
992
// 43-48 - Super Sonic Zoomout Frames
993
SpriteFrame(-11, -8, 19, 16, 124, 84)
994
SpriteFrame(-8, -8, 15, 12, 128, 101)
995
SpriteFrame(-7, -8, 11, 14, 132, 144)
996
SpriteFrame(-7, -7, 13, 13, 130, 129)
997
SpriteFrame(-6, -8, 13, 15, 130, 143)
998
SpriteFrame(1, 4, 111, 92, 144, 66)
999
1000
// 49 - Big Tornado Frame, Sonic as pilot
1001
SpriteFrame(-90, -53, 179, 105, 1, 256)
1002
1003
// 50 - Big Tornado Frame, Tails as pilot
1004
SpriteFrame(-90, -53, 179, 105, 1, 362)
1005
1006
// 51 - Blank Frame
1007
SpriteFrame(0, 0, 0, 0, 391, 256)
1008
1009
// 52 - `Sonic the Hedgehog 2` Complete Text Frame
1010
SpriteFrame(-60, -20, 120, 40, 391, 256)
1011
1012
// 53-55 - Flashing `Sonic` Text Frames
1013
SpriteFrame(-63, -22, 81, 38, 397, 297)
1014
SpriteFrame(-63, -22, 81, 38, 397, 336)
1015
SpriteFrame(-63, -22, 81, 38, 397, 375)
1016
1017
// 56-59 - Flashing `2` Text Frames
1018
SpriteFrame(28, -20, 32, 39, 479, 297)
1019
SpriteFrame(28, -20, 32, 39, 479, 337)
1020
SpriteFrame(28, -20, 32, 39, 479, 377)
1021
SpriteFrame(28, -20, 32, 39, 479, 417)
1022
1023
#platform: USE_ORIGINS
1024
// 60-64 - Zoomout Tornado Frames, Tails as pilot and Amy as passenger
1025
SpriteFrame(-32, -32, 60, 48, 257, 1)
1026
SpriteFrame(-24, -24, 44, 36, 402, 151)
1027
SpriteFrame(-20, -19, 39, 31, 242, 256)
1028
SpriteFrame(-20, -19, 40, 31, 282, 256)
1029
SpriteFrame(-19, -15, 38, 27, 256, 50)
1030
1031
// 65-67 - Amy Posing Frames
1032
SpriteFrame(2, 2, 27, 35, 256, 77)
1033
SpriteFrame(-1, -1, 28, 43, 256, 113)
1034
SpriteFrame(6, -3, 65, 102, 325, 256)
1035
#endplatform
1036
end event
1037
1038
1039
// ========================
1040
// Editor Events
1041
// ========================
1042
1043
event RSDKDraw
1044
DrawSprite(0)
1045
DrawSprite(1)
1046
DrawSprite(2)
1047
end event
1048
1049
1050
event RSDKLoad
1051
LoadSpriteSheet("Ending/Objects.gif")
1052
SpriteFrame(21, 8, 4, 24, 373, 191) // Propeller
1053
SpriteFrame(-95, -16, 116, 64, 256, 191) // Tornado
1054
SpriteFrame(-45, -8, 21, 16, 278, 174) // Tails
1055
1056
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
1057
end event
1058
1059