Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Secrets/MessageText.txt
1319 views
1
//----------------Sonic CD Message Text Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value1 : Object.Index
7
8
// Text Info type
9
#alias 0 : TEXTINFO_TEXTDATA
10
#alias 1 : TEXTINFO_TEXTSIZE
11
12
13
sub ObjectDraw
14
15
ArrayPos0 = 0
16
17
// Get how long the target text line is
18
GetTextInfo(TempValue1, MENU_1, TEXTINFO_TEXTSIZE, Object.Index, 0)
19
20
// The text should be just about aligned to the center, so do some maths based on the character length to make that happen
21
TempValue2 = TempValue1
22
TempValue2 <<= 18
23
FlipSign(TempValue2)
24
TempValue2 += Object.XPos
25
26
// Loop through all the characters in the message
27
while TempValue1 > 0
28
29
// Get the actual character at the current char pos
30
GetTextInfo(TempValue0, MENU_1, TEXTINFO_TEXTDATA, Object.Index, ArrayPos0)
31
32
Object.Frame = 0
33
34
// Take uppercase letters and turn them into a matching Sprite Frame
35
if TempValue0 > 64
36
if TempValue0 < 91
37
Object.Frame = TempValue0
38
Object.Frame -= 64
39
end if
40
end if
41
42
// Take lowercase letters and turn them into a matching Sprite Frame
43
if TempValue0 > 96
44
if TempValue0 < 123
45
Object.Frame = TempValue0
46
Object.Frame -= 96
47
end if
48
end if
49
50
// Notably, the space character (32) is skipped over here, as it shouldn't draw anything
51
52
if Object.Frame > 0
53
// The the letter, but only if it's a valid one
54
DrawSpriteXY(Object.Frame, TempValue2, Object.YPos)
55
end if
56
57
// Move to the next letter
58
ArrayPos0++
59
60
// And decrease the remaining letter count, as well
61
TempValue1--
62
63
// Each letter should be spaced 8 pixels apart
64
TempValue2 += 0x80000
65
loop
66
end sub
67
68
69
sub ObjectStartup
70
LoadSpriteSheet("Secrets/SecretMenus.gif")
71
72
SpriteFrame(0, 0, 0, 0, 0, 0) // #0 - Dummy Sprite
73
74
// #1 -> #26 - Alphabet
75
// (Using loops to automate Sprite Framing)
76
TempValue1 = 49
77
while TempValue1 < 100
78
TempValue0 = 37
79
while TempValue0 < 136
80
SpriteFrame(-3, -6, 8, 16, TempValue0, TempValue1)
81
TempValue0 += 9
82
loop
83
84
TempValue1 += 17
85
loop
86
87
end sub
88
89
90
// ========================
91
// Editor Subs
92
// ========================
93
94
sub RSDKDraw
95
TempValue0 = 0
96
while TempValue0 < 4
97
DrawSprite(TempValue0)
98
TempValue0++
99
loop
100
end sub
101
102
103
sub RSDKLoad
104
LoadSpriteSheet("Secrets/SecretMenus.gif")
105
SpriteFrame(0, -6, 8, 16, 109, 117)
106
SpriteFrame(9, -6, 8, 16, 73, 100)
107
SpriteFrame(18, -6, 8, 16, 46, 134)
108
SpriteFrame(27, -6, 8, 16, 109, 117)
109
110
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
111
end sub
112
113