Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/TitleCards/SS_TitleCard.txt
1319 views
1
//-----------------Sonic CD Title Card Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.BarPos
7
#alias Object.Value1 : Object.TextPos
8
#alias Object.Value2 : Object.TextSize
9
#alias Object.Value3 : Object.Timer
10
#alias Object.Value4 : Object.FadeR
11
#alias Object.Value5 : Object.FadeG
12
#alias Object.Value6 : Object.FadeB
13
#alias Object.Value7 : Object.CharPos
14
15
// SS Sonic aliases
16
#alias Player.ControlMode : SSSonic.ControlMode
17
18
// HUD Alias
19
#alias Object.Value1 : HUD.TimeSeconds
20
#alias Object.Value2 : HUD.TimeFrames
21
22
// States
23
#alias 0 : TITLECARD_FADEIN
24
#alias 1 : TITLECARD_SLIDEIN
25
#alias 2 : TITLECARD_DISPLAY
26
#alias 3 : TITLECARD_SLIDEOUT
27
28
// Languages
29
#alias 0 : LANG_ENGLISH
30
#alias 1 : LANG_FRENCH
31
#alias 2 : LANG_ITALIAN
32
#alias 3 : LANG_DEUTSCH
33
#alias 4 : LANG_SPANISH
34
#alias 5 : LANG_JAPANESE
35
36
// ControlMode Aliases
37
#alias -1 : CONTROLMODE_NONE
38
#alias 0 : CONTROLMODE_NORMAL
39
40
// Game Mode Aliases
41
#alias 2 : MODE_TIMEATTACK
42
43
// Priority
44
#alias 1 : PRIORITY_ACTIVE
45
46
47
sub ObjectDraw
48
// Set the starting time values
49
// (Rather than disabling the HUD timer while the title card is active,
50
// its values are simply reset here every frame until no longer needed)
51
HUD[4].TimeSeconds = 100
52
HUD[4].TimeFrames = 0
53
54
switch Object.State
55
case TITLECARD_FADEIN
56
if Object.Timer > 0
57
if Object.Timer == 256
58
// Start the stage music!
59
PlayMusic(0)
60
61
// Free Sonic's control
62
// (But, it gets locked again right after anyway...)
63
SSSonic.ControlMode = CONTROLMODE_NORMAL
64
end if
65
66
SetScreenFade(Object.FadeR, Object.FadeG, Object.FadeB, Object.Timer)
67
Object.Timer -= 8
68
else
69
// Make the Title Card start appearing
70
71
Object.State = TITLECARD_SLIDEIN
72
Object.Timer = 0
73
end if
74
75
// Lock Sonic's control
76
SSSonic.ControlMode = CONTROLMODE_NONE
77
break
78
79
case TITLECARD_SLIDEIN
80
TempValue0 = 144
81
TempValue0 += Object.CharPos
82
83
if Object.TextPos > TempValue0
84
// Slide the text to the left
85
Object.TextPos -= 8
86
87
// Now, this part got changed in an update
88
89
else
90
// -> Updated version - both the text AND the bar have to be on screen for the title card to progress
91
92
if Object.BarPos == 0
93
Object.State = TITLECARD_DISPLAY
94
end if
95
end if
96
97
if Object.BarPos < 0
98
// Move the Bar down
99
Object.BarPos += 8
100
101
// There used to be code here in older versions, but not anymore...
102
// -> Initial version - only the bar needed to be in the proper position for the title card to continue
103
// This had text get incorrectly often
104
105
end if
106
break
107
108
case TITLECARD_DISPLAY
109
// Hold for a moment to let the Player see what a nice Title Card this is
110
111
if Object.Timer == 160
112
// Time's up, start sliding out!
113
Object.State = TITLECARD_SLIDEOUT
114
else
115
Object.Timer++
116
end if
117
break
118
119
case TITLECARD_SLIDEOUT
120
if Object.TextPos < 408
121
122
// Move the text to the right, and...
123
Object.TextPos += 16
124
125
// ...move the bar upwards as well
126
Object.BarPos -= 16
127
128
else
129
// The Title Card's job is done, despawn it
130
ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)
131
132
// Free Sonic's control, for real this time
133
SSSonic.ControlMode = CONTROLMODE_NORMAL
134
135
if Options.GameMode == MODE_TIMEATTACK
136
// If in time attack, start proper time progression
137
Stage.TimeEnabled = true
138
end if
139
end if
140
break
141
142
end switch
143
144
// Before drawing, make sure this object hasn't been blanked already
145
// (Under certain circumstances, this can otherwise cause major graphical issues!!)
146
if Object.Type > TypeName[Blank Object]
147
TempValue0 = 136
148
TempValue0 += Object.CharPos
149
150
// Draw the Title Card Bar
151
DrawSpriteScreenXY(0, TempValue0, Object.BarPos)
152
153
// And then draw the Sonic CD bar and the weird three lines
154
DrawSpriteScreenXY(5, Object.TextPos, 64)
155
DrawSpriteScreenXY(6, Object.TextPos, 64)
156
DrawSpriteScreenXY(7, Object.TextPos, 64)
157
158
#platform: Use_Decomp // Creates a black rectangle that fills the empty space on wider resolutions
159
TempValue0 = Object.TextPos
160
TempValue0 += 150
161
DrawRect(TempValue0, 147, Screen.XSize, 9, 0, 0, 0, 255)
162
#endplatform
163
164
// And then Draw the Round Name
165
// (Letters start at Sprite Frame 8)
166
TempValue0 = 8
167
while TempValue0 < Object.TextSize
168
DrawSpriteScreenXY(TempValue0, Object.TextPos, 64)
169
TempValue0++
170
loop
171
end if
172
173
end sub
174
175
176
sub ObjectStartup
177
178
// Load different sheets based on the Engine's current language
179
switch Engine.Language
180
case LANG_ENGLISH
181
case LANG_JAPANESE
182
// LANG_ENGLISH and LANG_JAPANESE share the same sheet
183
LoadSpriteSheet("Special/ScoreScreen.gif")
184
break
185
186
case LANG_FRENCH
187
LoadSpriteSheet("Special/ScoreScreen_FR.gif")
188
break
189
190
case LANG_ITALIAN
191
LoadSpriteSheet("Special/ScoreScreen_IT.gif")
192
break
193
194
case LANG_DEUTSCH
195
LoadSpriteSheet("Special/ScoreScreen_DE.gif")
196
break
197
198
case LANG_SPANISH
199
LoadSpriteSheet("Special/ScoreScreen_ES.gif")
200
break
201
202
end switch
203
204
// Place the Title Card object into the level and setup its values
205
Object[20].Type = TypeName[TitleCard]
206
Object[20].Timer = 384
207
208
// Make the Title Card always active, and have it draw above everything
209
Object[20].Priority = PRIORITY_ACTIVE
210
Object[20].DrawOrder = 6
211
212
// Set initial Bar & Text Positions
213
Object[20].BarPos = -216
214
Object[20].TextPos = 336
215
216
217
Object[20].CharPos = Screen.CenterX
218
Object[20].CharPos -= 160
219
220
if Object[20].CharPos > 3
221
Object[20].CharPos -= 4
222
end if
223
224
Object[20].CharPos &= 248
225
226
Object[20].TextPos += Object[20].CharPos
227
Object[20].TextPos += Object[20].CharPos
228
229
// "SPECIAL STAGE" is 12 letters
230
Object[20].TextSize = 12
231
232
// Bump the value by 8 to correspond with the order of the Sprite Frames
233
Object[20].TextSize += 8
234
235
// Preserve the color used from the last fade. Fade_Colour is stored as RRGGBB, in hex
236
237
Object[20].FadeR = Fade_Colour
238
Object[20].FadeR >>= 16
239
240
Object[20].FadeG = Fade_Colour
241
Object[20].FadeG &= 0x00FF00
242
Object[20].FadeG >>= 8
243
244
Object[20].FadeB = Fade_Colour
245
Object[20].FadeB &= 0x0000FF
246
247
// 0 - Red Bar Frame
248
SpriteFrame(0, 0, 32, 184, 224, 37)
249
250
// These next few frames are unused leftovers from the maingame Title Card script
251
// They appear as garbage sprites here since they use values from the normal Global Display sheet,
252
// and not the Special Stage version of the sheet
253
254
// 1-3 - Act Bubbles, appear as random texts with this sheet
255
SpriteFrame(96, 96, 48, 48, 41, 1)
256
SpriteFrame(96, 96, 48, 48, 90, 1)
257
SpriteFrame(96, 96, 48, 48, 139, 1)
258
259
// 4 - "Zone" text, appears as part of BG with this sheet though
260
SpriteFrame(64, 97, 48, 16, 41, 67)
261
262
// All the letters used by the Title Card
263
// They got updated a bit post-release, we're using the updated version here
264
265
// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar
266
267
// Workaround for steam datafile to show this sprite correctly
268
#platform: Use_Origins
269
SpriteFrame(72, 81, 160, 16, 60, 227) // #5 - Sonic The Hedgehog CD
270
#endplatform
271
272
#platform: Use_Standalone
273
#platform: Standard
274
SpriteFrame(64, 81, 160, 16, 52, 227)// #5 - Sonic The Hedgehog CD
275
#endplatform
276
#endplatform
277
278
#platform: Use_Standalone
279
#platform: Mobile
280
SpriteFrame(72, 81, 160, 16, 60, 227)// #5 - Sonic The Hedgehog CD
281
#endplatform
282
#endplatform
283
284
// 6 - Continuation of the Sonic CD bar
285
SpriteFrame(16, 81, 160, 16, 52, 227)
286
287
// 7 - Set of three lines
288
SpriteFrame(100, 32, 24, 48, 182, 124)
289
290
// 8-19 - Individual letters spelling out "Special Stage"
291
SpriteFrame(0, 0, 16, 55, 207, 124) // #8 - S
292
SpriteFrame(17, 32, 10, 23, 176, 180) // #9 - P
293
SpriteFrame(28, 32, 9, 23, 187, 180) // #10 - E
294
SpriteFrame(38, 32, 8, 23, 197, 180) // #11 - C
295
SpriteFrame(47, 32, 6, 23, 206, 180) // #12 - I
296
SpriteFrame(54, 32, 11, 23, 212, 180) // #13 - A
297
SpriteFrame(66, 32, 9, 23, 176, 203) // #14 - L
298
299
SpriteFrame(0, 56, 16, 55, 207, 124) // #15 - S
300
SpriteFrame(17, 56, 10, 23, 186, 203) // #16 - T
301
SpriteFrame(28, 56, 11, 23, 212, 180) // #17 - A
302
SpriteFrame(40, 56, 10, 23, 197, 203) // #18 - G
303
SpriteFrame(51, 56, 9, 23, 187, 180) // #19 - E
304
305
#platform: Use_Origins
306
// There aren't any Special Stage missions nor are any of them part of the Boss Rush, so god knows why this code is here
307
308
if game.playMode == BOOT_PLAYMODE_MISSION
309
TempValue0 = true
310
else
311
if game.playMode == BOOT_PLAYMODE_BOSSRUSH
312
TempValue0 = true
313
else
314
TempValue0 = false
315
end if
316
end if
317
318
if TempValue0 != false
319
PlayMusic(0)
320
321
game.missionCondition = 0
322
game.missionEnd = false
323
324
Player.ControlMode = CONTROLMODE_NORMAL
325
Stage.TimeEnabled = true
326
327
ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)
328
Warp.XPos = 0
329
end if
330
#endplatform
331
end sub
332
333
334
// ========================
335
// Editor Subs
336
// ========================
337
338
sub RSDKDraw
339
Object.TextSize = 12
340
Object.TextSize += 8
341
342
TempValue0 = 136
343
TempValue0 += Object.CharPos
344
TempValue0 <<= 16
345
346
TempValue1 = 0x500000
347
TempValue1 += Object.YPos
348
349
DrawSpriteXY(0, Object.XPos, Object.YPos)
350
DrawSpriteXY(5, Object.XPos, TempValue1)
351
DrawSpriteXY(6, Object.XPos, TempValue1)
352
DrawSpriteXY(7, Object.XPos, TempValue1)
353
354
TempValue0 = 8
355
while TempValue0 < Object.TextSize
356
DrawSpriteXY(TempValue0, Object.XPos, TempValue1)
357
TempValue0++
358
loop
359
end sub
360
361
362
sub RSDKLoad
363
LoadSpriteSheet("Special/ScoreScreen.gif")
364
// 0 - Red Bar Frame
365
SpriteFrame(0, 0, 32, 184, 224, 37)
366
367
// 1-3 - Act Bubbles, not used here.
368
SpriteFrame(96, 96, 48, 48, 41, 1)
369
SpriteFrame(96, 96, 48, 48, 90, 1)
370
SpriteFrame(96, 96, 48, 48, 139, 1)
371
372
// 4 - "Zone" text, not used here.
373
SpriteFrame(64, 97, 48, 16, 41, 67)
374
375
// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar
376
SpriteFrame(72, 81, 160, 16, 60, 227)
377
378
// 6 - Continuation of the Sonic CD bar
379
SpriteFrame(16, 81, 160, 16, 52, 227)
380
381
// 7 - Set of three lines
382
SpriteFrame(100, 32, 24, 48, 182, 124)
383
384
// 8-19 - Individual letters spelling out "Special Stage"
385
SpriteFrame(0, 0, 16, 55, 207, 124) // #8 - S
386
SpriteFrame(17, 32, 10, 23, 176, 180) // #9 - P
387
SpriteFrame(28, 32, 9, 23, 187, 180) // #10 - E
388
SpriteFrame(38, 32, 8, 23, 197, 180) // #11 - C
389
SpriteFrame(47, 32, 6, 23, 206, 180) // #12 - I
390
SpriteFrame(54, 32, 11, 23, 212, 180) // #13 - A
391
SpriteFrame(66, 32, 9, 23, 176, 203) // #14 - L
392
393
SpriteFrame(0, 56, 16, 55, 207, 124) // #15 - S
394
SpriteFrame(17, 56, 10, 23, 186, 203) // #16 - T
395
SpriteFrame(28, 56, 11, 23, 212, 180) // #17 - A
396
SpriteFrame(40, 56, 10, 23, 197, 203) // #18 - G
397
SpriteFrame(51, 56, 9, 23, 187, 180) // #19 - E
398
399
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
400
end sub
401
402