Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/Special/SpecialFinish.txt
1484 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Special Finish 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.value0 : object.timer
13
private alias object.value1 : object.textPos
14
private alias object.value2 : object.rotateSpeed
15
private alias object.value3 : object.scorePos
16
private alias object.value4 : object.ringPos
17
private alias object.value5 : object.ringBonus
18
private alias object.value6 : object.emeraldAlpha
19
private alias object.value7 : object.continuePos
20
private alias object.value8 : object.hasContinue
21
private alias object.value9 : object.messageState
22
private alias object.value10 : object.specialListPos
23
private alias object.value11 : object.emeralds
24
25
// States
26
private alias 0 : SPECIALFINISH_SETUPSPIN
27
private alias 1 : SPECIALFINISH_SPINNING
28
private alias 2 : SPECIALFINISH_SETUPRESULTS
29
private alias 3 : SPECIALFINISH_FADEIN_DELAY
30
private alias 4 : SPECIALFINISH_SETUPTEXT
31
private alias 5 : SPECIALFINISH_ENTERTEXT
32
private alias 6 : SPECIALFINISH_ENTERRESULTS
33
private alias 7 : SPECIALFINISH_ENTEREMERALDS
34
private alias 8 : SPECIALFINISH_TALLYSCORE
35
private alias 9 : SPECIALFINISH_SHOWRESULTS
36
private alias 10 : SPECIALFINISH_FADEOUT
37
private alias 11 : SPECIALFINISH_SAVEANDRETURN
38
private alias 12 : SPECIALFINISH_HASCONTINUE
39
private alias 13 : SPECIALFINISH_SHOWCONTINUE
40
private alias 14 : SPECIALFINISH_SETUPTATTACK
41
private alias 15 : SPECIALFINISH_EXIT_TATTACK
42
private alias 16 : SPECIALFINISH_SUPERMSG_DELAY
43
private alias 17 : SPECIALFINISH_SHOW_SUPERMSG
44
private alias 18 : SPECIALFINISH_WAITFORCALLBACK
45
46
// Player aliases
47
private alias object.value0 : player.rings
48
49
// Music Events
50
private alias 25 : SLOT_MUSICEVENT_CHANGE
51
52
private alias 2 : MUSICEVENT_TRANSITION
53
54
private alias StageStatsUsabilityParam5 : stageStat.playerRings
55
56
// Achievement Aliases
57
private alias 9 : ACHIEVEMENT_CHAOSCONNOISSEUR
58
59
60
// ========================
61
// Function Declarations
62
// ========================
63
64
reserve function SpecialFinish_DisplaySuperMessage
65
66
67
// ========================
68
// Function Definitions
69
// ========================
70
71
private function SpecialFinish_DisplaySuperMessage
72
switch object.messageState
73
case 0
74
temp0 = screen.xcenter
75
FlipSign(temp0)
76
temp0 -= 160
77
object.textPos -= 16
78
if object.textPos <= temp0
79
object.textPos = temp0
80
object.messageState++
81
end if
82
break
83
84
case 1
85
object.textPos += 16
86
if object.textPos >= 0
87
object.textPos = 0
88
object.messageState++
89
end if
90
break
91
end switch
92
end function
93
94
95
// ========================
96
// Events
97
// ========================
98
99
event ObjectUpdate
100
switch object.state
101
case SPECIALFINISH_SETUPSPIN
102
object.rotation = Player_stageRotation
103
Player_rotateSpeed = 2
104
object.rotation <<= 2
105
object.rotateSpeed = 8
106
object.state = SPECIALFINISH_SPINNING
107
break
108
109
case SPECIALFINISH_SPINNING
110
object.rotation -= object.rotateSpeed
111
if object.rotation < 0
112
object.rotation += 0x800
113
end if
114
115
object.rotateSpeed += 2
116
Player_stageRotation = object.rotation
117
Player_stageRotation >>= 2
118
119
if object.rotateSpeed > 248
120
if options.gameMode < MODE_TIMEATTACK
121
object.state = SPECIALFINISH_SETUPRESULTS
122
else
123
object.state = SPECIALFINISH_SETUPTATTACK
124
end if
125
end if
126
break
127
128
case SPECIALFINISH_SETUPRESULTS
129
object.rotation -= object.rotateSpeed
130
if object.rotation < 0
131
object.rotation += 0x800
132
end if
133
134
object.rotateSpeed += 2
135
Player_stageRotation = object.rotation
136
Player_stageRotation >>= 2
137
138
if object.timer < 256
139
object.timer += 8
140
SetScreenFade(0xE0, 0xE0, 0xE0, object.timer)
141
else
142
#platform: USE_ORIGINS
143
object.specialListPos = specialStage.listPos
144
object.emeralds = specialStage.emeralds
145
#endplatform
146
147
if Player_isWinner == true
148
temp0 = stage.actNum
149
temp0--
150
#platform: USE_STANDALONE
151
SetBit(specialStage.emeralds, temp0, true)
152
#endplatform
153
#platform: USE_ORIGINS
154
CheckGreater(6, temp0)
155
temp1 = checkResult
156
CheckNotEqual(options.superStates, false)
157
temp1 |= checkResult
158
if temp1 != false
159
SetBit(object.emeralds, temp0, true)
160
end if
161
#endplatform
162
end if
163
164
#platform: USE_ORIGINS
165
stageStat.playerRings = player[0].rings
166
#endplatform
167
object.ringBonus = player[0].rings
168
object.ringBonus *= 100
169
if player[0].rings >= 50
170
object.hasContinue = true
171
end if
172
173
// Due to Origins crashing if I try to wrap "switch <variable>"
174
// in a platform check, I'll have to use a temp value workaround.
175
// I am truly sorry.
176
#platform: USE_STANDALONE
177
stage.listPos = specialStage.nextZone
178
stage.activeList = REGULAR_STAGE
179
temp2 = specialStage.emeralds
180
#endplatform
181
#platform: USE_ORIGINS
182
temp2 = object.emeralds
183
#endplatform
184
switch temp2
185
case 0x3F // 6 emeralds
186
if options.superStates == false
187
object.frame = 3
188
#platform: USE_STANDALONE
189
specialStage.listPos++
190
specialStage.listPos %= 6
191
#endplatform
192
#platform: USE_ORIGINS
193
object.specialListPos++
194
object.specialListPos %= 6
195
#endplatform
196
temp0 = true
197
else
198
object.frame = 2
199
#platform: USE_STANDALONE
200
specialStage.listPos = 6
201
#endplatform
202
#platform: USE_ORIGINS
203
object.specialListPos = 6
204
#endplatform
205
temp0 = true
206
end if
207
break
208
209
case 0x7F // 7 emeralds
210
object.frame = 3
211
#platform: USE_STANDALONE
212
specialStage.listPos++
213
specialStage.listPos %= 7
214
#endplatform
215
#platform: USE_ORIGINS
216
object.specialListPos++
217
object.specialListPos %= 7
218
#endplatform
219
temp0 = true
220
break
221
222
default
223
object.frame = 2
224
temp0 = false
225
while temp0 == false
226
#platform: USE_STANDALONE
227
specialStage.listPos++
228
if specialStage.listPos > 5
229
specialStage.listPos = 0
230
end if
231
232
GetBit(temp1, specialStage.emeralds, specialStage.listPos)
233
#endplatform
234
#platform: USE_ORIGINS
235
object.specialListPos++
236
if object.specialListPos > 5
237
object.specialListPos = 0
238
end if
239
240
GetBit(temp1, object.emeralds, object.specialListPos)
241
#endplatform
242
if temp1 == false
243
temp0 = true
244
end if
245
loop
246
break
247
end switch
248
249
if Player_isWinner == false
250
object.frame = 1
251
end if
252
object.timer = 0
253
254
temp0 = 0
255
while temp0 < 20
256
ResetObjectEntity(temp0, TypeName[Blank Object], 0, 0, 0)
257
temp0++
258
loop
259
260
temp0++
261
while temp0 < 0x4A0
262
ResetObjectEntity(temp0, TypeName[Blank Object], 0, 0, 0)
263
temp0++
264
loop
265
266
stage.activeLayer[0] = 9
267
stage.activeLayer[1] = 9
268
stage.activeLayer[2] = 9
269
stage.activeLayer[3] = 9
270
object.controlMode = CONTROLMODE_P1
271
keyDown[1].left = false
272
keyDown[1].right = false
273
object.direction = FLIP_NONE
274
275
#platform: USE_ORIGINS
276
game.callbackResult = -1
277
CallNativeFunction4(NotifyCallback, NOTIFY_SPECIAL_RETRY, Player_isWinner, object.specialListPos, object.emeralds)
278
object.state = SPECIALFINISH_WAITFORCALLBACK
279
#endplatform
280
281
#platform: USE_STANDALONE
282
if options.gameMode == MODE_SAVEGAME
283
arrayPos1 = options.saveSlot
284
arrayPos1 <<= 3
285
if stage.player2Enabled == true
286
saveRAM[arrayPos1] = PLAYER_SONIC_TAILS_A
287
else
288
saveRAM[arrayPos1] = stage.playerListPos
289
end if
290
arrayPos1++
291
saveRAM[arrayPos1] = player.lives
292
arrayPos1++
293
saveRAM[arrayPos1] = player.score
294
arrayPos1++
295
saveRAM[arrayPos1] = player.scoreBonus
296
arrayPos1++
297
temp0 = stage.listPos
298
temp0++
299
if temp0 > saveRAM[arrayPos1]
300
saveRAM[arrayPos1] = temp0
301
else
302
if saveRAM[arrayPos1] >= 0x80
303
saveRAM[arrayPos1] = temp0
304
end if
305
end if
306
arrayPos1++
307
saveRAM[arrayPos1] = specialStage.emeralds
308
arrayPos1++
309
saveRAM[arrayPos1] = specialStage.listPos
310
WriteSaveRAM()
311
end if
312
object.state = SPECIALFINISH_FADEIN_DELAY
313
#endplatform
314
315
SetScreenFade(0xF4, 0xF4, 0xF4, 0xFF)
316
end if
317
break
318
319
case SPECIALFINISH_FADEIN_DELAY
320
if object.timer < 45
321
object.timer++
322
else
323
object.timer = 0
324
object.state++
325
#platform: USE_ORIGINS
326
stage.activeList = REGULAR_STAGE
327
stage.listPos = specialStage.nextZone
328
#endplatform
329
end if
330
SetScreenFade(0xF4, 0xF4, 0xF4, 0xFF)
331
break
332
333
case SPECIALFINISH_SETUPTEXT
334
PlayMusic(1)
335
object.drawOrder = 6
336
object.priority = PRIORITY_ACTIVE
337
object.inkEffect = INK_ALPHA
338
object.alpha = 0
339
340
object.xpos = screen.xcenter
341
object.xpos += 128
342
343
object.textPos = screen.xcenter
344
FlipSign(object.textPos)
345
object.textPos -= 160
346
347
object.scorePos = screen.xcenter
348
object.scorePos += 192
349
350
object.ringPos = object.scorePos
351
object.ringPos += 32
352
353
object.continuePos = object.ringPos
354
object.continuePos += 32
355
356
if stage.debugMode == false
357
if specialStage.emeralds >= 0x3F
358
CallNativeFunction2(SetAchievement, ACHIEVEMENT_CHAOSCONNOISSEUR, 100)
359
end if
360
end if
361
object.state++
362
break
363
364
case SPECIALFINISH_ENTERTEXT
365
if object.xpos > 0
366
object.xpos -= 16
367
if object.xpos < 0
368
object.xpos = 0
369
end if
370
end if
371
372
if object.textPos < 0
373
object.textPos += 16
374
if object.textPos > 0
375
object.textPos = 0
376
end if
377
else
378
object.state++
379
end if
380
break
381
382
case SPECIALFINISH_ENTERRESULTS
383
if object.emeraldAlpha < 0x100
384
object.emeraldAlpha += 8
385
end if
386
387
if object.scorePos > 0
388
object.scorePos -= 16
389
if object.scorePos < 0
390
object.scorePos = 0
391
end if
392
end if
393
394
if object.ringPos > 0
395
object.ringPos -= 16
396
if object.ringPos < 0
397
object.ringPos = 0
398
end if
399
end if
400
401
if object.continuePos > 0
402
object.continuePos -= 16
403
if object.continuePos < 0
404
object.continuePos = 0
405
end if
406
else
407
object.state++
408
end if
409
break
410
411
case SPECIALFINISH_ENTEREMERALDS
412
if object.emeraldAlpha < 0x100
413
object.emeraldAlpha += 8
414
end if
415
416
object.timer++
417
if object.timer > 299
418
object.timer = 0
419
object.state++
420
end if
421
break
422
423
case SPECIALFINISH_TALLYSCORE
424
if object.ringBonus > 0
425
object.ringBonus -= 100
426
player.score += 100
427
end if
428
429
if player.score >= player.scoreBonus
430
#platform: USE_STANDALONE
431
player.lives++
432
#endplatform
433
#platform: USE_ORIGINS
434
if game.coinMode == false
435
player.lives++
436
else
437
CallNativeFunction2(NotifyCallback, NOTIFY_ADD_COIN, 1)
438
end if
439
#endplatform
440
player.scoreBonus += 50000
441
PlaySfx(SfxName[Life], false)
442
PauseMusic()
443
ResetObjectEntity(SLOT_MUSICEVENT_CHANGE, TypeName[Music Event], MUSICEVENT_TRANSITION, 0, 0)
444
object[SLOT_MUSICEVENT_CHANGE].priority = PRIORITY_ACTIVE
445
end if
446
447
if object.ringBonus > 0
448
object.timer++
449
if object.timer == 2
450
PlaySfx(SfxName[Score Add], false)
451
object.timer = 0
452
end if
453
else
454
if object.hasContinue == false
455
object.state++
456
if Player_isWinner == true
457
#platform: USE_ORIGINS
458
if specialStage.emeralds >= 0x3F
459
CallNativeFunction2(NotifyCallback, NOTIFY_STATS_PARAM_2, 0)
460
end if
461
#endplatform
462
if specialStage.emeralds == 0x7F
463
object.state = SPECIALFINISH_SUPERMSG_DELAY
464
end if
465
end if
466
else
467
object.state = SPECIALFINISH_HASCONTINUE
468
end if
469
object.timer = 0
470
PlaySfx(SfxName[Score Total], false)
471
end if
472
break
473
474
case SPECIALFINISH_SHOWRESULTS
475
object.timer++
476
if object.timer == 160
477
object.timer = 0
478
object.state++
479
PlaySfx(SfxName[Warp], false)
480
end if
481
break
482
483
case SPECIALFINISH_FADEOUT
484
if object.timer < 400
485
object.timer += 8
486
SetScreenFade(0xF8, 0xF8, 0xF8, object.timer)
487
else
488
object.timer = 248
489
object.state++
490
SetScreenFade(0xF8, 0xF8, 0xF8, 0xFF)
491
end if
492
break
493
494
case SPECIALFINISH_SAVEANDRETURN
495
if object.timer > 0
496
object.timer -= 8
497
else
498
if options.gameMode == MODE_SAVEGAME
499
arrayPos1 = options.saveSlot
500
arrayPos1 <<= 3
501
if stage.player2Enabled == true
502
#platform: USE_STANDALONE
503
saveRAM[arrayPos1] = PLAYER_SONIC_TAILS_A
504
#endplatform
505
#platform: USE_ORIGINS
506
switch stage.playerListPos
507
case PLAYER_SONIC_A
508
saveRAM[arrayPos1] = PLAYER_SONIC_TAILS
509
break
510
case PLAYER_AMY_A
511
saveRAM[arrayPos1] = PLAYER_AMY_TAILS
512
break
513
end switch
514
#endplatform
515
else
516
saveRAM[arrayPos1] = stage.playerListPos
517
end if
518
arrayPos1++
519
520
saveRAM[arrayPos1] = player.lives
521
arrayPos1++
522
523
saveRAM[arrayPos1] = player.score
524
arrayPos1++
525
526
saveRAM[arrayPos1] = player.scoreBonus
527
arrayPos1++
528
529
temp0 = stage.listPos
530
temp0++
531
if temp0 > saveRAM[arrayPos1]
532
saveRAM[arrayPos1] = temp0
533
else
534
if saveRAM[arrayPos1] >= 0x80
535
saveRAM[arrayPos1] = temp0
536
end if
537
end if
538
arrayPos1++
539
540
saveRAM[arrayPos1] = specialStage.emeralds
541
arrayPos1++
542
543
saveRAM[arrayPos1] = specialStage.listPos
544
545
WriteSaveRAM()
546
547
#platform: USE_ORIGINS
548
recScore = player.score
549
#endplatform
550
end if
551
552
fadeColor = 0x000000
553
554
#platform: USE_ORIGINS
555
CallNativeFunction2(NotifyCallback, NOTIFY_STATS_RING, stageStat.playerRings)
556
stageStat.playerRings = 0
557
#endplatform
558
559
if stage.listPos < stage.listSize
560
LoadStage()
561
else
562
stage.activeList = PRESENTATION_STAGE
563
stage.listPos = 0
564
LoadStage()
565
end if
566
end if
567
SetScreenFade(object.timer, object.timer, object.timer, 0xFF)
568
break
569
570
case SPECIALFINISH_HASCONTINUE
571
object.timer++
572
if object.timer == 120
573
object.timer = 0
574
object.hasContinue++
575
object.state++
576
577
#platform: USE_ORIGINS
578
if game.coinMode != false
579
CallNativeFunction2(NotifyCallback, NOTIFY_ADD_COIN, 3)
580
end if
581
#endplatform
582
583
PlaySfx(SfxName[Continue], false)
584
end if
585
break
586
587
case SPECIALFINISH_SHOWCONTINUE
588
if specialStage.emeralds == 0x7F
589
CallFunction(SpecialFinish_DisplaySuperMessage)
590
end if
591
592
object.timer++
593
if object.timer == 360
594
object.timer = 0
595
object.state = SPECIALFINISH_FADEOUT
596
PlaySfx(SfxName[Warp], false)
597
end if
598
break
599
600
case SPECIALFINISH_SETUPTATTACK
601
object.rotation -= object.rotateSpeed
602
if object.rotation < 0
603
object.rotation += 0x800
604
end if
605
606
object.rotateSpeed += 2
607
Player_stageRotation = object.rotation
608
Player_stageRotation >>= 2
609
if object.timer < 480
610
object.timer += 8
611
music.volume -= 2
612
else
613
object.timer = 248
614
object.state++
615
616
temp0 = 0
617
while temp0 < 20
618
ResetObjectEntity(temp0, TypeName[Blank Object], 0, 0, 0)
619
temp0++
620
loop
621
622
temp0++
623
while temp0 < 0x4A0
624
ResetObjectEntity(temp0, TypeName[Blank Object], 0, 0, 0)
625
temp0++
626
loop
627
628
stage.activeLayer[0] = 9
629
stage.activeLayer[1] = 9
630
stage.activeLayer[2] = 9
631
stage.activeLayer[3] = 9
632
633
StopMusic()
634
end if
635
SetScreenFade(0xF8, 0xF8, 0xF8, object.timer)
636
break
637
638
case SPECIALFINISH_EXIT_TATTACK
639
if object.timer > 0
640
object.timer -= 8
641
else
642
if Player_isWinner == true
643
timeAttack.result = stage.seconds
644
timeAttack.result *= 100
645
temp0 = stage.minutes
646
temp0 *= 6000
647
timeAttack.result += temp0
648
timeAttack.result += stage.milliSeconds
649
else
650
timeAttack.result = 100000
651
end if
652
653
engine.state = 8
654
end if
655
SetScreenFade(object.timer, object.timer, object.timer, 0xFF)
656
break
657
658
case SPECIALFINISH_SUPERMSG_DELAY
659
object.timer++
660
if object.timer == 120
661
object.timer = 0
662
object.state++
663
end if
664
break
665
666
case SPECIALFINISH_SHOW_SUPERMSG
667
CallFunction(SpecialFinish_DisplaySuperMessage)
668
object.timer++
669
if object.timer == 480
670
object.timer = 0
671
object.state = SPECIALFINISH_FADEOUT
672
PlaySfx(SfxName[Warp], false)
673
end if
674
break
675
676
#platform: USE_ORIGINS
677
case SPECIALFINISH_WAITFORCALLBACK
678
if game.callbackResult >= 0
679
object.state = SPECIALFINISH_FADEIN_DELAY
680
object.timer = 0
681
specialStage.listPos = object.specialListPos
682
specialStage.emeralds = object.emeralds
683
if options.gameMode == MODE_SAVEGAME
684
arrayPos1 = options.saveSlot
685
arrayPos1 <<= 3
686
if stage.player2Enabled == true
687
switch stage.playerListPos
688
case PLAYER_SONIC_A
689
saveRAM[arrayPos1] = PLAYER_SONIC_TAILS
690
break
691
case PLAYER_AMY_A
692
saveRAM[arrayPos1] = PLAYER_AMY_TAILS
693
break
694
end switch
695
else
696
saveRAM[arrayPos1] = stage.playerListPos
697
end if
698
arrayPos1++
699
saveRAM[arrayPos1] = player.lives
700
arrayPos1++
701
saveRAM[arrayPos1] = player.score
702
arrayPos1++
703
saveRAM[arrayPos1] = player.scoreBonus
704
arrayPos1++
705
temp0 = stage.listPos
706
temp0++
707
if temp0 > saveRAM[arrayPos1]
708
saveRAM[arrayPos1] = temp0
709
else
710
if saveRAM[arrayPos1] >= 0x80
711
saveRAM[arrayPos1] = temp0
712
end if
713
end if
714
arrayPos1++
715
saveRAM[arrayPos1] = specialStage.emeralds
716
arrayPos1++
717
saveRAM[arrayPos1] = specialStage.listPos
718
WriteSaveRAM()
719
recScore = player.score
720
end if
721
end if
722
SetScreenFade(0xD0, 0xFF, 0xE0, 0xFF)
723
break
724
#endplatform
725
end switch
726
end event
727
728
729
event ObjectDraw
730
switch object.state
731
default
732
case SPECIALFINISH_SETUPSPIN
733
case SPECIALFINISH_SPINNING
734
case SPECIALFINISH_SETUPRESULTS
735
case SPECIALFINISH_FADEIN_DELAY
736
case SPECIALFINISH_SETUPTATTACK
737
case SPECIALFINISH_EXIT_TATTACK
738
#platform: USE_ORIGINS
739
case SPECIALFINISH_WAITFORCALLBACK
740
#endplatform
741
break
742
743
case SPECIALFINISH_SETUPTEXT
744
case SPECIALFINISH_ENTERTEXT
745
case SPECIALFINISH_ENTERRESULTS
746
case SPECIALFINISH_ENTEREMERALDS
747
case SPECIALFINISH_TALLYSCORE
748
case SPECIALFINISH_SHOWRESULTS
749
case SPECIALFINISH_FADEOUT
750
case SPECIALFINISH_SAVEANDRETURN
751
case SPECIALFINISH_HASCONTINUE
752
case SPECIALFINISH_SHOWCONTINUE
753
case SPECIALFINISH_SUPERMSG_DELAY
754
case SPECIALFINISH_SHOW_SUPERMSG
755
// BG
756
DrawRect(0, 0, screen.xsize, screen.ysize, 0xE0, 0xE0, 0xE0, 0xFF)
757
758
// Message
759
temp0 = screen.xcenter
760
temp0 += object.xpos
761
DrawSpriteScreenXY(0, temp0, 48)
762
if object.messageState == 0
763
temp0 = screen.xcenter
764
temp0 += object.textPos
765
DrawSpriteScreenXY(object.frame, temp0, 68)
766
else
767
temp0 = screen.xcenter
768
temp0 += object.textPos
769
DrawSpriteScreenXY(26, temp0, 68)
770
DrawSpriteScreenXY(27, temp0, 68)
771
DrawSpriteScreenXY(28, temp0, 68)
772
temp0 = screen.xcenter
773
temp0 -= object.textPos
774
DrawSpriteScreenXY(29, temp0, 68)
775
DrawSpriteScreenXY(30, temp0, 68)
776
end if
777
778
// Score
779
temp0 = screen.xcenter
780
temp0 -= 79
781
temp0 += object.scorePos
782
DrawSpriteScreenXY(4, temp0, 151)
783
temp0 += 151
784
DrawNumbers(9, temp0, 153, player.score, 6, 8, false)
785
786
// Ring Bonus
787
temp0 = screen.xcenter
788
temp0 -= 79
789
temp0 += object.ringPos
790
DrawSpriteScreenXY(5, temp0, 167)
791
temp0 += 151
792
DrawNumbers(9, temp0, 169, object.ringBonus, 5, 8, false)
793
794
// Continues/Coins
795
if object.hasContinue != false
796
temp0 = screen.xcenter
797
temp0 -= 79
798
temp0 += object.continuePos
799
#platform: USE_ORIGINS
800
if game.coinMode == false
801
#endplatform
802
DrawSpriteScreenXY(6, temp0, 183)
803
if object.hasContinue == 2
804
temp0 += 151
805
GetBit(temp1, object.timer, 4)
806
temp1 += 7
807
if object.state != SPECIALFINISH_SHOWCONTINUE
808
temp1 = 7
809
end if
810
DrawSpriteScreenXY(temp1, temp0, 196)
811
end if
812
#platform: USE_ORIGINS
813
else
814
DrawSpriteScreenXY(31, temp0, 183)
815
DrawSpriteScreenXY(32, temp0, 183)
816
if object.hasContinue == 2
817
temp0 += 124
818
DrawSpriteScreenXY(33, temp0, 183)
819
temp2 = object.timer
820
temp2 &= 15
821
temp2 >>= 2
822
temp2 += 34
823
DrawSpriteScreenXY(temp2, temp0, 183)
824
end if
825
end if
826
#endplatform
827
end if
828
829
// Emerald Opacity
830
object.animationTimer += 16
831
object.animationTimer &= 0x1FF
832
Sin(temp0, object.animationTimer)
833
temp0 >>= 3
834
temp0 += 190
835
temp0 *= object.emeraldAlpha
836
temp0 >>= 8
837
object.alpha = temp0
838
839
temp0 = 0
840
temp1 = 19
841
temp3 = screen.xcenter
842
if specialStage.emeralds == 0x7F
843
temp3 += 12
844
end if
845
846
// Draw Emeralds
847
while temp0 < 7
848
GetBit(temp2, specialStage.emeralds, temp0)
849
if temp2 == true
850
DrawSpriteScreenFX(temp1, FX_INK, temp3, 112)
851
end if
852
temp0++
853
temp1++
854
loop
855
break
856
end switch
857
end event
858
859
860
event ObjectStartup
861
LoadSpriteSheet("Special/Objects.gif")
862
863
SpriteFrame(-32, 0, 56, 56, 63, 401) // 0 - Oval
864
SpriteFrame(-99, 0, 197, 16, 120, 401) // 1 - "SPECIAL STAGE" large text
865
SpriteFrame(-112, 0, 223, 16, 156, 418) // 2 - "CHAOS EMERALDS" large text
866
867
switch stage.playerListPos
868
case PLAYER_SONIC_A
869
case PLAYER_SONIC_TAILS_A
870
SpriteFrame(-127, 0, 254, 16, 156, 435) // 3 - "SONIC GOT THEM ALL"
871
break
872
873
case PLAYER_TAILS_A
874
if options.region == false
875
SpriteFrame(-127, 0, 254, 16, 156, 452) // 3 - "TAILS GOT THEM ALL"
876
else
877
SpriteFrame(-127, 0, 254, 16, 156, 469) // 3 - "MILES GOT THEM ALL"
878
end if
879
break
880
881
case PLAYER_KNUCKLES_A
882
SpriteFrame(-149, 0, 298, 16, 156, 486) // 3 - "KNUCKLES GOT THEM ALL"
883
break
884
885
#platform: USE_ORIGINS
886
case PLAYER_AMY_A
887
SpriteFrame(-127, 0, 254, 16, 156, 503) // 3 - "AMY GOT THEM ALL"
888
break
889
#endplatform
890
end switch
891
892
SpriteFrame(0, 0, 44, 16, 35, 458) // 4 - "SCORE" small text
893
SpriteFrame(0, 0, 85, 16, 35, 475) // 5 - "RING BONUS" small text
894
SpriteFrame(0, 0, 69, 16, 35, 492) // 6 - "CONTINUE" small text
895
896
// 7-8 - Character icons, dependant on the main character
897
switch stage.playerListPos
898
case PLAYER_SONIC_A
899
case PLAYER_SONIC_TAILS_A
900
SpriteFrame(-8, -11, 16, 23, 399, 376)
901
SpriteFrame(-8, -11, 16, 23, 416, 376)
902
break
903
904
case PLAYER_TAILS_A
905
SpriteFrame(-8, -11, 16, 23, 433, 376)
906
SpriteFrame(-8, -11, 16, 23, 450, 376)
907
break
908
909
case PLAYER_KNUCKLES_A
910
SpriteFrame(-8, -11, 16, 23, 467, 376)
911
SpriteFrame(-8, -11, 16, 23, 484, 376)
912
break
913
914
#platform: USE_ORIGINS
915
case PLAYER_AMY_A
916
SpriteFrame(-9, -10, 17, 22, 465, 417)
917
SpriteFrame(-9, -10, 17, 22, 483, 417)
918
break
919
#endplatform
920
end switch
921
922
// 9-18 - Numbers
923
SpriteFrame(0, 0, 8, 11, 120, 418)
924
SpriteFrame(0, 0, 8, 11, 129, 418)
925
SpriteFrame(0, 0, 8, 11, 138, 418)
926
SpriteFrame(0, 0, 8, 11, 147, 418)
927
SpriteFrame(0, 0, 8, 11, 120, 430)
928
SpriteFrame(0, 0, 8, 11, 129, 430)
929
SpriteFrame(0, 0, 8, 11, 138, 430)
930
SpriteFrame(0, 0, 8, 11, 147, 430)
931
SpriteFrame(0, 0, 8, 11, 120, 442)
932
SpriteFrame(0, 0, 8, 11, 129, 442)
933
934
// 19-24 - Chaos Emeralds
935
SpriteFrame(-28, -4, 24, 24, 176, 276)
936
SpriteFrame(-4, -4, 24, 24, 201, 276)
937
if options.superStates == false
938
SpriteFrame(-52, -4, 24, 24, 226, 276)
939
else
940
SpriteFrame(-52, -4, 24, 24, 426, 276)
941
end if
942
SpriteFrame(20, -4, 24, 24, 251, 276)
943
SpriteFrame(-76, -4, 24, 24, 276, 276)
944
SpriteFrame(44, -4, 24, 24, 301, 276)
945
SpriteFrame(-100, -4, 24, 24, 401, 276)
946
947
// Texts
948
switch stage.playerListPos
949
case PLAYER_SONIC_A
950
case PLAYER_SONIC_TAILS_A
951
SpriteFrame(-113, -12, 53, 16, 411, 435) // "NOW"
952
SpriteFrame(-51, -12, 70, 16, 156, 435) // "SONIC"
953
SpriteFrame(28, -12, 85, 16, 411, 452) // "CAN BE"
954
SpriteFrame(-77, 12, 76, 16, 411, 469) // "SUPER"
955
SpriteFrame(8, 12, 70, 16, 156, 435) // "SONIC" (different offset)
956
break
957
958
case PLAYER_TAILS_A
959
if options.region == false
960
SpriteFrame(-113, -12, 53, 16, 411, 435) // "NOW"
961
SpriteFrame(-51, -12, 70, 16, 156, 452) // "TAILS"
962
SpriteFrame(28, -12, 85, 16, 411, 452) // "CAN BE"
963
SpriteFrame(-77, 12, 76, 16, 411, 469) // "SUPER"
964
SpriteFrame(8, 12, 70, 16, 156, 452) // "TAILS" (different offset)
965
else
966
SpriteFrame(-113, -12, 53, 16, 411, 435) // "NOW"
967
SpriteFrame(-51, -12, 70, 16, 156, 469) // "MILES"
968
SpriteFrame(28, -12, 85, 16, 411, 452) // "CAN BE"
969
SpriteFrame(-77, 12, 76, 16, 411, 469) // "SUPER"
970
SpriteFrame(8, 12, 70, 16, 156, 469) // "MILES" (different offset)
971
end if
972
break
973
974
case PLAYER_KNUCKLES_A
975
SpriteFrame(-134, -12, 53, 16, 411, 435) // "NOW"
976
SpriteFrame(-73, -12, 113, 16, 156, 486) // "KNUCKLES"
977
SpriteFrame(50, -12, 85, 16, 411, 452) // "CAN BE"
978
SpriteFrame(-99, 12, 76, 16, 411, 469) // "SUPER"
979
SpriteFrame(-14, 12, 113, 16, 156, 486) // "KNUCKLES" (different offset)
980
break
981
982
#platform: USE_ORIGINS
983
case PLAYER_AMY_A
984
SpriteFrame(-101, -12, 53, 16, 411, 435) // "NOW"
985
SpriteFrame(-39, -12, 46, 16, 174, 503) // "AMY"
986
SpriteFrame(16, -12, 85, 16, 411, 452) // "CAN BE"
987
SpriteFrame(-65, 12, 76, 16, 411, 469) // "SUPER"
988
SpriteFrame(22, 12, 46, 16, 174, 503) // "AMY" (different offset)
989
break
990
#endplatform
991
end switch
992
993
#platform: USE_ORIGINS
994
SpriteFrame(0, 0, 32, 16, 1, 489) // "COIN"
995
SpriteFrame(32, 0, 53, 16, 67, 475) // " BONUS"
996
SpriteFrame(0, 0, 50, 16, 80, 458) // Coin x 3
997
SpriteFrame(-4, -4, 24, 24, 401, 76) // Coin Sparkle 1
998
SpriteFrame(-4, -4, 24, 24, 426, 76) // Coin Sparkle 2
999
SpriteFrame(-4, -4, 24, 24, 451, 76) // Coin Sparkle 3
1000
SpriteFrame(-4, -4, 24, 24, 476, 76) // Coin Sparkle 4
1001
#endplatform
1002
end event
1003
1004
1005
// ========================
1006
// Editor Events
1007
// ========================
1008
1009
event RSDKDraw
1010
DrawSprite(0)
1011
end event
1012
1013
1014
event RSDKLoad
1015
LoadSpriteSheet("Global/Display.gif")
1016
SpriteFrame(-16, -16, 32, 32, 1, 143)
1017
1018
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
1019
end event
1020
1021