Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Title/Sonic.txt
1319 views
1
//-------------------Sonic CD Sonic 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
// States
9
#alias 0 : SONIC_SETUP
10
#alias 1 : SONIC_TURNING
11
12
// Control Mode
13
#alias 0 : CONTROLMODE_NORMAL
14
15
// Players
16
#alias 0 : PLAYER_SONIC_A
17
18
19
sub ObjectDraw
20
// Fill the screen with the blue background color
21
DrawRect(0, 0, Screen.XSize, Screen.YSize, 0, 0, 96, 255)
22
23
switch Object.State
24
case SONIC_SETUP
25
if Object.Alpha > 8
26
// Fade him in
27
28
DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)
29
end if
30
31
if Object.Timer < 256
32
Object.Timer += 8
33
34
// Object.Alpha is a byte so it's prone to overflow, which is why we're doing this
35
36
if Object.Timer < 256
37
Object.Alpha = Object.Timer
38
else
39
// Cap it at 255
40
Object.Alpha = 255
41
end if
42
else
43
if Object.Timer < 272
44
Object.Timer++
45
else
46
Object.Timer = 0
47
Object.State = SONIC_TURNING
48
49
// Reset some stuff
50
LampPost.Check = 0
51
Player.ControlMode = CONTROLMODE_NORMAL
52
Stage.PlayerListPos = PLAYER_SONIC_A // PLAYER_SONIC in origins
53
54
// Start the music!
55
PlayMusic(Options.Soundtrack)
56
end if
57
end if
58
break
59
60
case SONIC_TURNING
61
TempValue0 = Object.Timer
62
TempValue0 >>= 2
63
DrawSprite(TempValue0)
64
65
// Get Sonic's Arm Position
66
TempValue0 = 11
67
TempValue0 += Screen.CenterX
68
69
// If at a point where Sonic's sprite is armless, then give him his arm back
70
if Object.Timer > 15
71
DrawSpriteScreenXY(5, TempValue0, 72)
72
end if
73
74
Object.Timer++
75
if Object.Timer > 19
76
ResetObjectEntity(Object.EntityNo, TypeName[Logo], 0, Object.XPos, Object.YPos)
77
Object.Timer = 256
78
79
// Place some other Title Screen elements into the scene now
80
81
ArrayPos0 = Object.EntityNo
82
ArrayPos0 -= 2
83
84
// First, add the Background into the scene, at Object[-2]
85
Object[ArrayPos0].Type = TypeName[Background]
86
Object[ArrayPos0].DrawOrder = 0
87
88
// There's nothing on this layer anyway, but may as well I guess?
89
Stage[2].ActiveLayer = 9
90
91
ArrayPos0++
92
93
// And then add the 3d Clouds into Object[-1]
94
Object[ArrayPos0].Type = TypeName[Clouds]
95
96
#platform: Mobile
97
// Lite!
98
if Engine.TrialMode == true
99
if Engine.PlatformID == RETRO_ANDROID
100
ArrayPos0 = Object.EntityNo
101
ArrayPos0 += 2
102
ResetObjectEntity(ArrayPos0, TypeName[Lite Ribbon], 0, 0, 0)
103
Object[ArrayPos0].DrawOrder = 6
104
end if
105
end if
106
#endplatform
107
end if
108
break
109
110
end switch
111
112
end sub
113
114
115
sub ObjectStartup
116
117
// Set both of the Title Screen tracks here, both of them set to not loop
118
SetMusicTrack("JP/TitleScreen.ogg", 0, false)
119
SetMusicTrack("US/TitleScreen.ogg", 1, false)
120
121
LoadSpriteSheet("Title/Title.gif")
122
123
SpriteFrame(-47, -89, 96, 112, 1, 203) // #0 - Sonic Turning Frame 0
124
SpriteFrame(-47, -89, 104, 120, 98, 203) // #1 - Sonic Turning Frame 1
125
SpriteFrame(-47, -96, 96, 120, 1, 316) // #2 - Sonic Turning Frame 2
126
SpriteFrame(-47, -96, 104, 120, 98, 324) // #3 - Sonic Turning Frame 3
127
SpriteFrame(-47, -96, 104, 120, 1, 1) // #4 - Sonic Base Frame
128
SpriteFrame(0, 0, 45, 55, 210, 203) // #5 - Sonic Base Arm Frame
129
130
end sub
131
132
133
// ========================
134
// Editor Subs
135
// ========================
136
137
sub RSDKDraw
138
DrawSprite(0)
139
end sub
140
141
142
sub RSDKLoad
143
LoadSpriteSheet("Title/Title.gif")
144
SpriteFrame(-47, -96, 104, 120, 1, 1)
145
146
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
147
end sub
148
149