Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Global/ActFinish.txt
1319 views
1
//----------------Sonic CD Act Finish Script------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
8
// All texts have their own X Position values
9
#alias Object.XPos : Object.LineXPos0 // "SONIC GOT" Line
10
#alias Object.Value1 : Object.LineXPos1 // "THROUGH ZONE X" Line
11
#alias Object.Value2 : Object.LineXPos2 // Score Line
12
#alias Object.Value3 : Object.LineXPos3 // Ring Bonus Line
13
#alias Object.Value4 : Object.LineXPos4 // Time Bonus Line
14
15
#alias Object.Value5 : Object.TimeBonus
16
#alias Object.Value6 : Object.RingBonus
17
18
// New to Origins!
19
// The Stage List Pos of the current stage's Present version
20
#alias Object.Value7 : Object.StagePosP
21
22
// HUD Alias
23
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
24
25
// Player Aliases
26
#alias Object[0].Type : Player.Type
27
#alias Object[0].Value0 : Player.Rings
28
29
// States
30
#alias -1 : ACTFINISH_NULL // Origins exclusive
31
32
#alias 0 : ACTFINISH_INIT
33
#alias 1 : ACTFINISH_SLIDEIN
34
#alias 2 : ACTFINISH_DISPLAYTALLY
35
#alias 3 : ACTFINISH_TALLYUP
36
#alias 4 : ACTFINISH_DISPLAYFINAL
37
#alias 5 : ACTFINISH_FADEOUT
38
39
#alias 6 : ACTFINISH_HOLDOVERRESTART // Origins exclusive
40
#alias 7 : ACTFINISH_WAITFORCALLBACK // Origins exclusive
41
42
43
#alias 0 : PLAYER_SONIC_A
44
#alias 1 : PLAYER_TAILS_A
45
46
47
// Time Period Aliases
48
#alias 0 : TIME_PRESENT
49
#alias 1 : TIME_PAST
50
#alias 2 : TIME_GOOD_FUTURE
51
#alias 3 : TIME_BAD_FUTURE
52
53
// Global SFX
54
#alias 16 : SFX_G_SCOREADD
55
#alias 17 : SFX_G_SCORETOTAL
56
#alias 19 : SFX_G_SPECIALWARP
57
58
// Soundtrack
59
#alias 0 : OST_JP
60
61
// How long the Zone Complete jingle for each soundtrack is
62
#alias 299 : JP_ZONECOMPLETE_LENGTH
63
#alias 429 : US_ZONECOMPLETE_LENGTH
64
65
// Callbacks Aliases
66
#alias 11 : CALLBACK_TRIAL_ENDED
67
68
// Game Modes
69
#alias 1 : MODE_SAVEGAME
70
#alias 2 : MODE_TIMEATTACK
71
#alias 3 : MODE_TRIAL
72
73
// Presentation List Stages
74
#alias 0 : STAGE_P_TITLE
75
#alias 2 : STAGE_P_TATTACK
76
#alias 11 : STAGE_P_DOWNLOADSCREEN
77
78
// Engine States
79
#alias 8 : ENGINE_WAIT
80
81
82
sub ObjectMain
83
switch Object.State
84
case ACTFINISH_INIT
85
// Setup initial values such as text positions
86
87
// "SONIC GOT" is gonna come from the left, while all the other text slides in from the right
88
Object.LineXPos0 = -799
89
Object.LineXPos1 = 0x490
90
Object.LineXPos2 = 0x4E7
91
Object.LineXPos3 = 0x527
92
Object.LineXPos4 = 0x57A
93
94
#platform: Use_Standalone
95
Object.State = ACTFINISH_SLIDEIN
96
#endplatform
97
98
// Calculate Time Bonus
99
switch Stage.Minutes
100
case 0
101
if Stage.Seconds < 30
102
// 0:00 - 0:29 - Wow that's fast, get a Mega Bonus!
103
Object.TimeBonus = 50000
104
else
105
if Stage.Seconds < 45
106
// 0:30 - 0:44
107
Object.TimeBonus = 10000
108
else
109
// 0:45 - 0:59
110
Object.TimeBonus = 5000
111
end if
112
end if
113
break
114
115
case 1
116
if Stage.Seconds < 30
117
// 1:00 - 1:29
118
Object.TimeBonus = 4000
119
else
120
// 1:30 - 1:59
121
Object.TimeBonus = 3000
122
end if
123
break
124
125
case 2
126
// 2:00 - 2:59
127
Object.TimeBonus = 2000
128
break
129
130
case 3
131
// 3:00 - 3:59
132
Object.TimeBonus = 1000
133
break
134
135
case 4
136
// 4:00 - 4:59
137
Object.TimeBonus = 500
138
break
139
140
case 5
141
// 5:00 - 5:59
142
Object.TimeBonus = 100
143
break
144
145
// Anything after that, you get nothing, you lose!
146
147
end switch
148
149
#platform: Use_Origins
150
// If you Time Over'd, no Time Bonus either of course
151
if game.timeOver != false
152
Object.TimeBonus = 0
153
end if
154
#endplatform
155
156
// Ring Bonus calculation is far easier - just take the Player's ring count and multiply that by 100
157
Object.RingBonus = Player.Rings
158
Object.RingBonus *= 100
159
160
#platform: Use_Origins
161
// Find the Present version of the current stage
162
Object.StagePosP = Stage.ListPos
163
switch HUD.CurrentTimePeriod
164
case TIME_PRESENT
165
break
166
167
case TIME_PAST
168
Object.StagePosP--
169
break
170
171
case TIME_GOOD_FUTURE
172
Object.StagePosP -= 2
173
break
174
175
case TIME_BAD_FUTURE
176
Object.StagePosP -= 3
177
break
178
179
end switch
180
181
// If in a Mission, we don't need Act Results
182
if game.playMode == BOOT_PLAYMODE_MISSION
183
Object.State = ACTFINISH_NULL
184
// Back it up a bit
185
Stage.ListPos = Object.StagePosP
186
else
187
// In Boss Rush, we don't need Act Results either
188
if game.playMode == BOOT_PLAYMODE_BOSSRUSH
189
Object.State = ACTFINISH_NULL
190
else
191
// We're in a normal mode, let's just show the Results normally
192
Object.State = ACTFINISH_SLIDEIN
193
end if
194
end if
195
196
// Send to the Engine how many Enemies have been destroyed so far
197
game.callbackParam0 = StageStatsUsabilityParam1 // Enemies destroyed by any means
198
game.callbackParam1 = StageStatsUsabilityParam2 // Enemies destroyed by rolling
199
game.callbackParam2 = 0
200
EngineCallback(NOTIFY_STATS_ENEMY)
201
202
// Send to the Engine how many Rings the Player has
203
game.callbackParam0 = Player.Rings
204
EngineCallback(NOTIFY_STATS_RING)
205
206
// Signal to the Engine that the current level is over
207
EngineCallback(NOTIFY_ACT_FINISH)
208
if Stage.PlayerListPos == PLAYER_KNUCKLES
209
if Good_Future == true
210
EngineCallback(NOTIFY_STATS_SAVE_FUTURE)
211
end if
212
end if
213
214
// Reset loads of stuff...
215
StageStatsUsabilityParam1 = 0
216
StageStatsUsabilityParam2 = 0
217
StageStatsUsabilityParam3 = 0
218
StageStatsUsabilityParam4 = 0
219
StatsUsabilityParam1 = 0
220
StatsUsabilityParam2 = 0
221
StatsUsabilityParam3 = 0
222
StatsUsabilityParam4 = 0
223
#endplatform
224
break
225
226
case ACTFINISH_SLIDEIN
227
228
// Get a base Position of 60 pixels off centre screen
229
TempValue0 = Screen.CenterX
230
TempValue0 -= 68
231
232
// Update position of the "SONIC GOT" line
233
if Object.LineXPos0 < TempValue0
234
Object.LineXPos0 += 16
235
if Object.LineXPos0 > TempValue0
236
// Past the max, enforce it
237
Object.LineXPos0 = TempValue0
238
239
end if
240
else
241
// Just stay put for now
242
Object.LineXPos0 = TempValue0
243
end if
244
245
// Update Position of the "THROUGH Zone" line
246
TempValue0 -= 32
247
if Object.LineXPos1 > TempValue0
248
Object.LineXPos1 -= 16
249
if Object.LineXPos1 < TempValue0
250
// Enforce a minimum
251
Object.LineXPos1 = TempValue0
252
end if
253
else
254
// Hold!
255
Object.LineXPos1 = TempValue0
256
end if
257
258
// The Score, Ring, and Time bonuses are all around the same X Position
259
TempValue0 += 9
260
261
// Score Line
262
if Object.LineXPos2 > TempValue0
263
Object.LineXPos2 -= 16
264
if Object.LineXPos2 < TempValue0
265
Object.LineXPos2 = TempValue0
266
end if
267
else
268
Object.LineXPos2 = TempValue0
269
end if
270
271
// Ring Bonus Line
272
if Object.LineXPos3 > TempValue0
273
Object.LineXPos3 -= 16
274
if Object.LineXPos3 < TempValue0
275
Object.LineXPos3 = TempValue0
276
end if
277
else
278
Object.LineXPos3 = TempValue0
279
end if
280
281
// Time Bonus line
282
if Object.LineXPos4 > TempValue0
283
Object.LineXPos4 -= 16
284
if Object.LineXPos4 < TempValue0
285
Object.LineXPos4 = TempValue0
286
end if
287
else
288
Object.LineXPos4 = TempValue0
289
290
// Proceed with the Act Results, now that everything's in position
291
Object.State = ACTFINISH_DISPLAYTALLY
292
Object.Timer = 0
293
end if
294
break
295
296
case ACTFINISH_DISPLAYTALLY
297
Object.Timer++
298
299
// The two soundtracks have different Zone Complete lengths
300
if Options.Soundtrack == OST_JP
301
if Object.Timer > JP_ZONECOMPLETE_LENGTH
302
303
// Proceed, now that the Jingle's over
304
305
Object.Timer = 0
306
307
Object.State = ACTFINISH_TALLYUP
308
309
// See if the Paradise Found achievement should be unlocked
310
if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins
311
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
312
if Stage.DebugMode == false
313
SetAchievement(2, 100)
314
end if
315
end if
316
end if
317
318
end if
319
else
320
if Object.Timer > US_ZONECOMPLETE_LENGTH
321
322
// It's now over, proceed with the Results
323
324
Object.Timer = 0
325
326
Object.State = ACTFINISH_TALLYUP
327
328
// See if the Paradise Found achievement should be unlocked
329
if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins
330
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
331
if Stage.DebugMode == false
332
SetAchievement(2, 100)
333
end if
334
end if
335
end if
336
337
end if
338
end if
339
break
340
341
case ACTFINISH_TALLYUP
342
343
// Tally up the Ring Bonus and Time Bonus simultaneously
344
345
if Object.RingBonus > 0
346
Object.RingBonus -= 100
347
Player.Score += 100
348
end if
349
350
if Object.TimeBonus > 0
351
Object.TimeBonus -= 100
352
Player.Score += 100
353
end if
354
355
// See if they're both over
356
357
CheckGreater(Object.RingBonus, 0)
358
TempValue0 = CheckResult
359
CheckGreater(Object.TimeBonus, 0)
360
TempValue0 |= CheckResult
361
362
if TempValue0 == true
363
364
// If they're not done yet, then play the Tally SFX
365
366
Object.Timer++
367
368
if Object.Timer == 2
369
PlaySfx(SFX_G_SCOREADD, false)
370
Object.Timer = 0
371
end if
372
373
else
374
375
// They're both over now, go over now
376
377
Object.State = ACTFINISH_DISPLAYFINAL
378
Object.Timer = 0
379
380
// Ka-ching!
381
PlaySfx(SFX_G_SCORETOTAL, false)
382
383
end if
384
break
385
386
case ACTFINISH_DISPLAYFINAL
387
388
// Pause for a moment, to let the Player see what they got
389
390
Object.Timer++
391
392
if Object.Timer == 160
393
#platform: Use_Origins
394
// Check if the player is replaying the stage from My Data & Rankings
395
if game.oneStageFlag != false
396
// If needed, let the Player retry the stage
397
Object.StagePosP = Stage.ListPos
398
game.callbackResult = -1 // Reset any callback result
399
game.callbackParam0 = 1 // 0 - Normal Retry, anything else - Show current and best time
400
game.callbackParam1 = Object.StagePosP // Get current stage
401
game.callbackParam2 = 0 // Unknown
402
EngineCallback(NOTIFY_STAGE_RETRY)
403
404
Object.Timer = 0
405
// Go over to the holdover state and wait for the result
406
Object.State = ACTFINISH_HOLDOVERRESTART
407
else
408
// Nope, everything can be resumed normally from here
409
Object.Timer = 0
410
Object.State = ACTFINISH_FADEOUT
411
end if
412
#endplatform
413
414
#platform: Use_Standalone
415
Object.Timer = 0
416
Object.State = ACTFINISH_FADEOUT
417
#endplatform
418
419
// If the Player's a Blank Object, then that means they entered a Special Ring
420
if Player.Type == TypeName[Blank Object]
421
PlaySfx(SFX_G_SPECIALWARP, false)
422
end if
423
end if
424
break
425
426
case ACTFINISH_FADEOUT
427
if Player.Type == TypeName[Blank Object]
428
// Special Stage!
429
Object.Timer += 8
430
// Use kinda-white to fade out, rather than black
431
SetScreenFade(208, 255, 224, Object.Timer)
432
433
#platform: Use_Standalone
434
if Engine.TrialMode == true
435
if Object.Timer == 1016
436
EngineCallback(CALLBACK_TRIAL_ENDED)
437
end if
438
end if
439
#endplatform
440
441
if Object.Timer == 1024
442
// Set Fade_Colour to be off-white (0xD0FFE0)
443
Fade_Colour = 208
444
Fade_Colour <<= 16
445
TempValue0 = 255
446
TempValue0 <<= 8
447
Fade_Colour += TempValue0
448
Fade_Colour += 224
449
450
// Reset more stuff
451
Player.Direction = FACING_RIGHT
452
Object.Timer = 0
453
LampPost.Check = 0
454
455
Good_Future_Count += Good_Future
456
Good_Future = false
457
458
Transporter_Destroyed = false
459
MetalSonic_Destroyed = false
460
461
if Stage.ActNo == 2
462
if Good_Future_Count < 2
463
Stage.ListPos++
464
end if
465
end if
466
467
if Stage.ActNo == 3
468
Good_Future_Count = 0
469
end if
470
471
// Get the Stage List Pos of the next stage's Present version
472
switch HUD.CurrentTimePeriod
473
case TIME_PRESENT
474
Stage.ListPos += 4
475
break
476
477
case TIME_PAST
478
Stage.ListPos += 3
479
break
480
481
case TIME_GOOD_FUTURE
482
Stage.ListPos += 2
483
break
484
485
case TIME_BAD_FUTURE
486
Stage.ListPos++
487
break
488
489
end switch
490
491
if Options.GameMode == MODE_SAVEGAME
492
ArrayPos1 = Options.SaveSlot
493
ArrayPos1 <<= 3
494
SaveRAM[ArrayPos1] = Stage.PlayerListPos
495
ArrayPos1++
496
SaveRAM[ArrayPos1] = Player.Lives
497
ArrayPos1++
498
SaveRAM[ArrayPos1] = Player.Score
499
ArrayPos1++
500
SaveRAM[ArrayPos1] = Stage.ListPos
501
// Add 81 to the Stage List Pos to signify that it's a Special Stage save
502
SaveRAM[ArrayPos1] += 81
503
ArrayPos1++
504
SaveRAM[ArrayPos1] = SpecialStage.TimeStones
505
ArrayPos1++
506
SaveRAM[ArrayPos1] = SpecialStage.ListPos
507
ArrayPos1++
508
SaveRAM[ArrayPos1] = Player.ScoreBonus
509
510
ArrayPos1++
511
SaveRAM[ArrayPos1] = MetalSonic_List
512
SaveRAM[ArrayPos1] <<= 16
513
SaveRAM[ArrayPos1] += Good_Future_List
514
515
WriteSaveRAM()
516
end if
517
518
#platform: Use_Origins
519
recScore = Player.Score
520
SpecialStage.NextZone = Stage.ListPos
521
// Origins got the SPECIAL_STAGE alias swapped with BONUS_STAGE
522
Stage.ActiveList = 3
523
Stage.ListPos = SpecialStage.ListPos
524
525
// Check if the player is replaying the stage from My Data & Rankings
526
if game.oneStageFlag != false
527
Stage.ActiveList = REGULAR_STAGE
528
Stage.ListPos = Object.StagePosP
529
530
Object.State = ACTFINISH_WAITFORCALLBACK
531
else
532
TempValue0 = Engine.TrialMode
533
if Stage.ListPos >= Stage.ListSize
534
TempValue0 = true
535
end if
536
537
if TempValue0 == false
538
LoadStage()
539
else
540
Stage.ActiveList = PRESENTATION_STAGE
541
Stage.ListPos = STAGE_P_TITLE
542
543
Engine.State = ENGINE_WAIT
544
end if
545
end if
546
#endplatform
547
548
#platform: Use_Standalone
549
SpecialStage.NextZone = Stage.ListPos
550
Stage.ListPos = SpecialStage.ListPos
551
Stage.ActiveList = SPECIAL_STAGE
552
553
TempValue0 = Engine.TrialMode
554
if Stage.ListPos >= Stage.ListSize
555
TempValue0 = true
556
end if
557
558
if TempValue0 == false
559
LoadStage()
560
else
561
Stage.ActiveList = PRESENTATION_STAGE
562
Stage.ListPos = STAGE_P_TITLE
563
LoadStage()
564
end if
565
#endplatform
566
end if
567
else
568
// We didn't enter a Special Ring, we're staying in normal stages
569
Object.Timer += 4
570
SetScreenFade(0, 0, 0, Object.Timer)
571
572
if Engine.TrialMode == true
573
if Object.Timer == 380
574
EngineCallback(CALLBACK_TRIAL_ENDED)
575
end if
576
end if
577
578
if Object.Timer == 384
579
// Set Fade_Colour to be black
580
Fade_Colour = 0
581
582
// Reset some cool values
583
Object.Timer = 0
584
LampPost.Check = 0
585
586
Player.Direction = FACING_RIGHT
587
588
Good_Future_Count += Good_Future
589
Good_Future = false
590
591
Transporter_Destroyed = false
592
MetalSonic_Destroyed = false
593
594
if Stage.ActNo == 2
595
if Good_Future_Count < 2
596
Stage.ListPos++
597
end if
598
end if
599
600
if Stage.ActNo == 3
601
Good_Future_Count = 0
602
end if
603
604
// Get the Stage ID of the next stage's starting version
605
switch HUD.CurrentTimePeriod
606
case TIME_PRESENT
607
Stage.ListPos += 4
608
break
609
610
case TIME_PAST
611
Stage.ListPos += 3
612
break
613
614
case TIME_GOOD_FUTURE
615
Stage.ListPos += 2
616
break
617
618
case TIME_BAD_FUTURE
619
Stage.ListPos++
620
break
621
622
end switch
623
624
if Options.GameMode == MODE_SAVEGAME
625
ArrayPos1 = Options.SaveSlot
626
ArrayPos1 <<= 3
627
SaveRAM[ArrayPos1] = Stage.PlayerListPos
628
ArrayPos1++
629
SaveRAM[ArrayPos1] = Player.Lives
630
ArrayPos1++
631
SaveRAM[ArrayPos1] = Player.Score
632
ArrayPos1++
633
SaveRAM[ArrayPos1] = Stage.ListPos
634
SaveRAM[ArrayPos1]++
635
ArrayPos1++
636
SaveRAM[ArrayPos1] = SpecialStage.TimeStones
637
ArrayPos1++
638
SaveRAM[ArrayPos1] = SpecialStage.ListPos
639
ArrayPos1++
640
SaveRAM[ArrayPos1] = Player.ScoreBonus
641
642
ArrayPos1++
643
SaveRAM[ArrayPos1] = MetalSonic_List
644
SaveRAM[ArrayPos1] <<= 16
645
SaveRAM[ArrayPos1] += Good_Future_List
646
647
WriteSaveRAM()
648
end if
649
650
#platform: Use_Origins
651
recScore = Player.Score
652
653
// Check if the player is replaying the stage from My Data & Rankings
654
if game.oneStageFlag != false
655
Stage.ActiveList = REGULAR_STAGE
656
Stage.ListPos = Object.StagePosP
657
Object.State = ACTFINISH_WAITFORCALLBACK
658
else
659
if Options.GameMode == MODE_TIMEATTACK
660
if Stage.PlayerListPos == PLAYER_SONIC
661
// Get the act number
662
TempValue0 = Stage.ListPos
663
TempValue0 %= 10
664
TempValue0 >>= 2
665
666
// Get the current Round
667
TempValue1 = Stage.ListPos
668
TempValue1 /= 10
669
TempValue1 *= 3
670
671
// Add them together to get the stage ID
672
TempValue0 += TempValue1
673
TempValue0++
674
675
// And now, tally up all the time
676
677
TempValue1 = Stage.Seconds
678
TempValue1 *= 100
679
680
TempValue2 = Stage.Minutes
681
TempValue2 *= 6000
682
683
TempValue1 += TempValue2
684
TempValue1 += Stage.MilliSeconds
685
686
// Enter all that data into the Leaderboard, make your mark on the world!
687
SetLeaderboard(TempValue0, TempValue1)
688
end if
689
690
// Tally up all the results, into one single large number
691
TimeAttack.Result = Stage.Seconds
692
TimeAttack.Result *= 100
693
694
TempValue0 = Stage.Minutes
695
TempValue0 *= 6000
696
697
TimeAttack.Result += TempValue0
698
TimeAttack.Result += Stage.MilliSeconds
699
700
Stage.ActiveList = PRESENTATION_STAGE
701
Stage.ListPos = STAGE_P_TATTACK
702
703
LoadStage()
704
else
705
// Don't lie to me SEGA, there was a demo for origins planned!!!
706
if Options.GameMode < MODE_TRIAL
707
TempValue0 = Engine.TrialMode
708
else
709
TempValue0 = false
710
end if
711
712
if Stage.ListPos >= Stage.ListSize
713
TempValue0 = true
714
end if
715
716
if TempValue0 == false
717
LoadStage()
718
else
719
if Engine.TrialMode == true
720
Stage.ActiveList = PRESENTATION_STAGE
721
Stage.ListPos = STAGE_P_DOWNLOADSCREEN
722
LoadStage()
723
else
724
Engine.State = ENGINE_WAIT
725
end if
726
end if
727
end if
728
end if
729
#endplatform
730
731
#platform: Use_Standalone
732
// this check can only happen in mobile
733
if Options.GameMode == MODE_TRIAL
734
// Set Trial Recoerds
735
TimeAttack.Result = Stage.Seconds
736
TimeAttack.Result *= 100
737
738
TempValue0 = Stage.Minutes
739
TempValue0 *= 6000
740
741
TimeAttack.Result += TempValue0
742
TimeAttack.Result += Stage.MilliSeconds
743
744
switch TimeAttack.Round
745
case 0
746
if TimeAttack.Result < SaveRAM[48] // PPZ Record
747
SaveRAM[48] = TimeAttack.Result
748
end if
749
break
750
case 1
751
if TimeAttack.Result < SaveRAM[49] // QQZ Record
752
SaveRAM[49] = TimeAttack.Result
753
end if
754
break
755
end switch
756
WriteSaveRAM()
757
Stage.ActiveList = PRESENTATION_STAGE
758
Stage.ListPos = STAGE_P_DOWNLOADSCREEN
759
end if
760
761
if Options.GameMode == MODE_TIMEATTACK
762
TimeAttack.Result = Stage.Seconds
763
TimeAttack.Result *= 100
764
TempValue0 = Stage.Minutes
765
TempValue0 *= 6000
766
TimeAttack.Result += TempValue0
767
TimeAttack.Result += Stage.MilliSeconds
768
Stage.ActiveList = PRESENTATION_STAGE
769
Stage.ListPos = STAGE_P_TATTACK
770
LoadStage()
771
else
772
// this check can only happen in mobile
773
if Options.GameMode < MODE_TRIAL
774
TempValue0 = Engine.TrialMode
775
else
776
TempValue0 = false
777
end if
778
779
if Stage.ListPos >= Stage.ListSize // tldr - check if you are playing a trial
780
TempValue0 = true
781
end if
782
783
if TempValue0 == false
784
LoadStage()
785
else
786
Stage.ActiveList = PRESENTATION_STAGE
787
Stage.ListPos = STAGE_P_TITLE
788
LoadStage()
789
end if
790
end if
791
#endplatform
792
end if
793
end if
794
break
795
796
#platform: Use_Origins
797
case ACTFINISH_HOLDOVERRESTART
798
// Wait and see, does the Player want to restart the stage?
799
if game.callbackResult >= 0
800
Object.Timer = 0
801
Object.State = ACTFINISH_FADEOUT
802
end if
803
break
804
805
case ACTFINISH_WAITFORCALLBACK
806
SetScreenFade(0, 0, 0, 255)
807
break
808
#endplatform
809
end switch
810
end sub
811
812
813
sub ObjectDraw
814
// First two lines are dependant on if Sonic made a Good Future or not
815
// Regardless of the path taken here, TempValue0 afterwards should be where the "Zone" text is drawn,
816
// in order for the following code to be done correctly
817
if Good_Future == false
818
// No Good Future here, just do the normal results
819
820
// First line - "Sonic GOT"
821
DrawSpriteScreenXY(0, Object.LineXPos0, 65)
822
823
// Second line - "THROUGH"
824
DrawSpriteScreenXY(4, Object.LineXPos1, 89)
825
826
// To the right of that, draw "Zone"
827
TempValue0 = Object.LineXPos1
828
TempValue0 += 128
829
DrawSpriteScreenXY(5, TempValue0, 89)
830
else
831
// We made a Good Future!
832
// Let's used the altered version of the text to let the Player know
833
834
// Draw "SONIC MADE A GOOD" for the first line
835
// (For Knux, this is just "MADE A GOOD", with his name being drawn separately down below)
836
DrawSpriteScreenXY(20, Object.LineXPos0, 65)
837
838
#platform: Use_Origins
839
if Stage.PlayerListPos == PLAYER_KNUCKLES
840
// "KNUCKLES"
841
DrawSpriteScreenXY(22, Object.XPos, 65)
842
end if
843
#endplatform
844
845
// Then, comes "FUTURE IN"
846
DrawSpriteScreenXY(21, Object.LineXPos1, 89)
847
848
// And to the right of that, draw the "Zone" text
849
TempValue0 = Object.LineXPos1
850
TempValue0 += 140
851
DrawSpriteScreenXY(5, TempValue0, 89)
852
end if
853
854
// From where the "Zone" text was drawn, draw the Act Number next to it
855
TempValue0 += 64
856
DrawSpriteScreenXY(Stage.ActNo, TempValue0, 89)
857
858
// Draw the Score text
859
DrawSpriteScreenXY(6, Object.LineXPos2, 121)
860
861
// And then to the right of that, draw the Score numbers
862
TempValue0 = Object.LineXPos2
863
TempValue0 += 163
864
DrawNumbers(10, TempValue0, 121, Player.Score, 6, 8, false)
865
866
// The fourth line holds the Rings text
867
DrawSpriteScreenXY(7, Object.LineXPos3, 145)
868
869
// Append "Bonus" to the end of that Rings text
870
TempValue0 = Object.LineXPos3
871
TempValue0 += 40
872
DrawSpriteScreenXY(9, TempValue0, 145)
873
874
// And on the same line, draw the Ring Bonus
875
TempValue0 += 123
876
DrawNumbers(10, TempValue0, 145, Object.RingBonus, 5, 8, false)
877
878
// The fifth line holds the Time Bonus
879
880
// So, draw the "Time" sprite first
881
DrawSpriteScreenXY(8, Object.LineXPos4, 169)
882
883
// And then similarly, append "Bonus" to that
884
TempValue0 = Object.LineXPos4
885
TempValue0 += 40
886
DrawSpriteScreenXY(9, TempValue0, 169)
887
888
//And now, draw the Time Bonus numbers at the end of the line
889
TempValue0 += 123
890
DrawNumbers(10, TempValue0, 169, Object.TimeBonus, 5, 8, false)
891
end sub
892
893
894
sub ObjectStartup
895
// Load the appropriate sheet based on the current character
896
if Stage.PlayerListPos == PLAYER_SONIC_A
897
LoadSpriteSheet("Global/Display.gif")
898
end if
899
if Stage.PlayerListPos == PLAYER_TAILS_A
900
LoadSpriteSheet("Global/Display_t.gif")
901
end if
902
903
#platform: Use_Origins
904
if Stage.PlayerListPos == PLAYER_KNUCKLES
905
LoadSpriteSheet("Global/Display_k.gif")
906
end if
907
if Stage.PlayerListPos == PLAYER_AMY
908
LoadSpriteSheet("Global/Display_a.gif")
909
end if
910
// Act Results Frames
911
912
if Stage.PlayerListPos == PLAYER_KNUCKLES
913
// 0 - "KNUCKLES GOT"
914
SpriteFrame(-27, 0, 191, 16, 35, 257)
915
else
916
// 0 - "SONIC GOT"
917
SpriteFrame(0, 0, 136, 16, 0, 206)
918
end if
919
#endplatform
920
921
#platform: Use_Standalone
922
// 0 - "SONIC GOT"
923
SpriteFrame(0, 0, 136, 16, 0, 206)
924
#endplatform
925
926
927
// 1-3 - Act Numbers
928
SpriteFrame(0, 0, 8, 16, 194, 223)
929
SpriteFrame(0, 0, 16, 16, 203, 223)
930
SpriteFrame(0, 0, 16, 16, 220, 223)
931
932
// 4 - "THROUGH"
933
SpriteFrame(0, 0, 113, 16, 137, 206)
934
935
// 5 - "Zone"
936
SpriteFrame(0, 0, 56, 16, 137, 223)
937
938
// 6 - Score text
939
SpriteFrame(0, 0, 39, 11, 1, 1)
940
941
// 7 - Rings text
942
SpriteFrame(0, 0, 31, 11, 1, 33)
943
944
// 8 - Time text
945
SpriteFrame(0, 0, 31, 11, 1, 17)
946
947
// 9 - Bonus text
948
SpriteFrame(0, 0, 41, 11, 1, 107)
949
950
// 10-19 - Numbers
951
SpriteFrame(0, 0, 8, 11, 1, 50)
952
SpriteFrame(0, 0, 8, 11, 10, 50)
953
SpriteFrame(0, 0, 8, 11, 19, 50)
954
SpriteFrame(0, 0, 8, 11, 28, 50)
955
SpriteFrame(0, 0, 8, 11, 1, 62)
956
SpriteFrame(0, 0, 8, 11, 10, 62)
957
SpriteFrame(0, 0, 8, 11, 19, 62)
958
SpriteFrame(0, 0, 8, 11, 28, 62)
959
SpriteFrame(0, 0, 8, 11, 1, 74)
960
SpriteFrame(0, 0, 8, 11, 10, 74)
961
962
#platform: Use_Standalone
963
// 20 - "SONIC MADE A GOOD"
964
SpriteFrame(-60, 0, 256, 16, 0, 240)
965
966
// 21 - "FUTURE IN"
967
SpriteFrame(-12, 0, 136, 16, 0, 223)
968
#endplatform
969
970
#platform: Use_Origins
971
if Stage.PlayerListPos == PLAYER_KNUCKLES
972
// 20 - " MADE A GOOD"
973
SpriteFrame(-41, 0, 256, 16, 0, 240)
974
// 21 - "FUTURE IN"
975
SpriteFrame(-12, 0, 136, 16, 0, 223)
976
// 22 - "KNUCKLES"
977
SpriteFrame(-79, 0, 127, 16, 35, 257)
978
else
979
// 20 - "SONIC MADE A GOOD"
980
SpriteFrame(-60, 0, 256, 16, 0, 240)
981
// 21 - "FUTURE IN"
982
SpriteFrame(-12, 0, 136, 16, 0, 223)
983
end if
984
985
#endplatform
986
end sub
987
988
989
// ========================
990
// Editor Subs
991
// ========================
992
993
sub RSDKDraw
994
DrawSprite(0)
995
end sub
996
997
998
sub RSDKLoad
999
LoadSpriteSheet("Global/Display.gif")
1000
SpriteFrame(0, 0, 113, 16, 137, 206)
1001
1002
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
1003
end sub
1004