Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Title/CWLogo.txt
1319 views
1
//----------------Sonic CD CW Logo 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
#alias Object.Value1 : Object.RectAlpha
8
#alias Object.Value2 : Object.BGScale
9
#alias Object.Value3 : Object.Unused
10
11
// States
12
#alias 0 : CWLOGO_SETUP
13
#alias 1 : CWLOGO_BGSCALE_INCREASE_1
14
#alias 2 : CWLOGO_BGSCALE_INCREASE_2
15
#alias 3 : CWLOGO_LOGO_FADEIN
16
#alias 4 : CWLOGO_BGSCALE_DECREASE
17
#alias 5 : CWLOGO_LOGO_FADEOUT
18
19
// Callbacks & Engine States
20
#alias 7 : CALLBACK_EXIT_SELECTED
21
22
// Ink Effects
23
#alias 2 : INK_ALPHA
24
25
// Engine & Callbacks
26
#alias 5 : ENGINE_ENTER_HIRESMODE
27
#alias 6 : ENGINE_EXIT_HIRESMODE
28
29
30
sub ObjectMain
31
switch Object.State
32
case CWLOGO_SETUP
33
Object.Rotation = 0
34
Object.BGScale = 0
35
Object.State++
36
break
37
38
case CWLOGO_BGSCALE_INCREASE_1
39
if Object.BGScale < 2048
40
if Object.BGScale < 2048
41
Object.BGScale += 64
42
else
43
Object.BGScale += 128
44
end if
45
else
46
Object.RectAlpha = 256
47
Object.State++
48
end if
49
50
Object.Rotation += 8
51
Object.Rotation &= 511
52
break
53
54
case CWLOGO_BGSCALE_INCREASE_2
55
if Object.BGScale < 4096
56
if Object.BGScale < 2048
57
Object.BGScale += 64
58
else
59
Object.BGScale += 128
60
end if
61
Object.Rotation += 8
62
Object.Rotation &= 511
63
end if
64
65
if Object.RectAlpha > 0
66
Object.RectAlpha -= 8
67
else
68
Object.State++
69
end if
70
break
71
72
case CWLOGO_LOGO_FADEIN
73
if Object.Timer < 144
74
Object.Timer++
75
else
76
Object.Timer = 0
77
78
// It's unknown exactly what this does, it's never referenced anywhere else
79
// And it was only added on an update too, certainly quite strange...
80
Object.Unused = 0
81
82
Object.State++
83
end if
84
break
85
86
case CWLOGO_BGSCALE_DECREASE
87
if Object.BGScale > 0
88
if Object.BGScale < 2048
89
Object.BGScale -= 64
90
else
91
Object.BGScale -= 128
92
end if
93
94
Object.Rotation -= 8
95
if Object.Rotation < 0
96
Object.Rotation += 512
97
end if
98
end if
99
100
if Object.RectAlpha < 256
101
Object.RectAlpha += 10
102
else
103
Object.State++
104
Object.RectAlpha = 256
105
end if
106
break
107
108
case CWLOGO_LOGO_FADEOUT
109
if Object.BGScale > 0
110
if Object.BGScale < 2048
111
Object.BGScale -= 64
112
else
113
Object.BGScale -= 128
114
end if
115
116
Object.Rotation -= 8
117
if Object.Rotation < 0
118
Object.Rotation += 512
119
end if
120
else
121
if Object.Timer == 16
122
ResetObjectEntity(Object.EntityNo, TypeName[Sonic], 0, Object.XPos, Object.YPos)
123
124
Object.InkEffect = INK_ALPHA
125
Object.Alpha = 0
126
Object.Timer = 0
127
#platform: Use_Standalone
128
Engine.State = ENGINE_EXIT_HIRESMODE
129
Object.RectAlpha = 256
130
#endplatform
131
else
132
Object.Timer++
133
end if
134
end if
135
break
136
137
end switch
138
139
// Windows Phone 7, certainly quite the anomaly
140
if Engine.PlatformID == RETRO_WP7
141
if KeyPress[0].ButtonB == true
142
EngineCallback(CALLBACK_EXIT_SELECTED)
143
end if
144
end if
145
146
end sub
147
148
149
sub ObjectDraw
150
// First, draw the solid color background
151
DrawRect(0, 0, Screen.XSize, Screen.YSize, 0, 0, 96, 255)
152
153
// Then, draw the 8 Point Star pattern
154
Object.Scale = Object.BGScale
155
DrawSpriteFX(1, FX_ROTOZOOM, Object.XPos, Object.YPos)
156
Object.Rotation += 64
157
DrawSpriteFX(1, FX_ROTOZOOM, Object.XPos, Object.YPos)
158
Object.Rotation -= 64
159
160
// Logo Fade In/Out
161
switch Object.State
162
case CWLOGO_BGSCALE_INCREASE_2
163
case CWLOGO_LOGO_FADEIN
164
case CWLOGO_BGSCALE_DECREASE
165
166
// Draw the CW Logo at its own Scale
167
Object.Scale = 192
168
169
DrawSpriteFX(0, FX_SCALE, Object.XPos, Object.YPos)
170
171
// And then draw its own little background
172
TempValue0 = Screen.CenterX
173
TempValue0 -= 96
174
TempValue1 = Screen.CenterY
175
TempValue1 -= 48
176
DrawRect(TempValue0, TempValue1, 192, 96, 255, 149, 18, Object.RectAlpha)
177
break
178
179
end switch
180
181
end sub
182
183
184
sub ObjectStartup
185
186
LoadSpriteSheet("Title/CWLogo.gif")
187
188
// 0 - Christian Whitehead Logo
189
SpriteFrame(-255, -117, 510, 235, 1, 1)
190
191
// 1 - Background
192
SpriteFrame(-32, -32, 64, 64, 1, 1)
193
194
end sub
195
196
197
// ========================
198
// Editor Subs
199
// ========================
200
201
sub RSDKDraw
202
DrawSprite(0)
203
end sub
204
205
206
sub RSDKLoad
207
LoadSpriteSheet("Global/Display.gif")
208
SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon
209
210
// (The actual CW Logo sprite is meant for Hi-res mode, which isn't available in the editor)
211
212
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
213
end sub
214
215