Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/TAttack/SRecords.txt
1319 views
1
//--------------Sonic CD Special Records Script---------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value1 : Object.Minutes
7
#alias Object.Value2 : Object.Seconds
8
#alias Object.Value3 : Object.MilliSeconds
9
#alias Object.PropertyValue : Object.Record
10
11
// Special Large Icon Aliases
12
#alias Object.PropertyValue : SLargeIcon.Portrait
13
14
// Menu Control Aliases
15
#alias Object[0].Value0 : MenuControl.Timer
16
#alias Object[0].Value4 : MenuControl.SMYPos
17
#alias Object[0].Value5 : MenuControl.SMCurrentButton
18
#alias Object[0].State : MenuControl.State
19
20
// Menu Control States
21
// *SM = Sub Menu
22
#alias 7 : MENUCONTROL_SM_CONTROLS
23
#alias 10 : MENUCONTROL_SM_CONFIRMED
24
#alias 11 : MENUCONTROL_SM_LOAD_LEVEL
25
#alias 13 : MENUCONTROL_SM_COMFIRMED_LEAVE
26
27
// Property Values
28
#alias 0 : FIRST_RECORD
29
#alias 1 : SECOND_RECORD
30
#alias 2 : THIRD_RECORD
31
32
33
// Function declarations
34
#function SRecords_DrawRecords
35
36
function SRecords_DrawRecords
37
Object.Minutes = SaveRAM[ArrayPos0]
38
Object.Minutes /= 6000
39
40
Object.Seconds = SaveRAM[ArrayPos0]
41
Object.Seconds /= 100
42
Object.Seconds %= 60
43
44
Object.MilliSeconds = SaveRAM[ArrayPos0]
45
Object.MilliSeconds %= 100
46
47
TempValue0 = Object.XPos
48
TempValue0 >>= 16
49
TempValue0 -= 16
50
DrawNumbers(0, TempValue0, TempValue1, Object.Minutes, 2, 8, 1)
51
TempValue0 += 24
52
DrawNumbers(0, TempValue0, TempValue1, Object.Seconds, 2, 8, 1)
53
TempValue0 += 24
54
DrawNumbers(0, TempValue0, TempValue1, Object.MilliSeconds, 2, 8, 1)
55
end function
56
57
58
sub ObjectMain
59
Object.YPos = Object.Record
60
Object.YPos *= 192
61
Object.YPos -= MenuControl.SMYPos
62
if Object.YPos < -384
63
Object.YPos += 576
64
end if
65
Object.YPos += 224
66
Object.YPos <<= 16
67
end sub
68
69
70
sub ObjectDraw
71
DrawSprite(18)
72
DrawSprite(10)
73
switch Object.Record
74
case 0
75
TempValue0 = SLargeIcon[-1].Portrait
76
TempValue0 += 11
77
DrawSprite(TempValue0)
78
break
79
80
case 1
81
TempValue0 = SLargeIcon[-2].Portrait
82
TempValue0 += 11
83
DrawSprite(TempValue0)
84
break
85
86
case 2
87
TempValue0 = SLargeIcon[-3].Portrait
88
TempValue0 += 11
89
DrawSprite(TempValue0)
90
break
91
92
end switch
93
ArrayPos0 = TempValue0
94
ArrayPos0 -= 11
95
ArrayPos0 *= 18
96
97
TempValue0 = Object.Record
98
TempValue0 *= 6
99
100
ArrayPos0 += TempValue0
101
ArrayPos0 += 49
102
103
TempValue1 = Object.YPos
104
TempValue1 >>= 16
105
TempValue1 += 97
106
CallFunction(SRecords_DrawRecords)
107
108
TempValue1 += 24
109
ArrayPos0 += 2
110
CallFunction(SRecords_DrawRecords)
111
112
TempValue1 += 24
113
ArrayPos0 += 2
114
CallFunction(SRecords_DrawRecords)
115
DrawSprite(21)
116
117
#platform: Standard
118
switch MenuControl.State
119
case MENUCONTROL_SM_CONTROLS
120
switch MenuControl.SMCurrentButton
121
case 0
122
DrawSprite(19)
123
break
124
case 2
125
DrawSprite(20)
126
break
127
end switch
128
break
129
130
case MENUCONTROL_SM_CONFIRMED
131
TempValue0 = MenuControl.Timer
132
TempValue0 &= 3
133
TempValue0 >>= 1
134
if TempValue0 == 0
135
DrawSprite(20)
136
end if
137
break
138
139
case MENUCONTROL_SM_LOAD_LEVEL
140
DrawSprite(20)
141
break
142
143
case MENUCONTROL_SM_COMFIRMED_LEAVE
144
TempValue0 = MenuControl.Timer
145
TempValue0 &= 3
146
TempValue0 >>= 1
147
if TempValue0 == 0
148
DrawSprite(19)
149
end if
150
break
151
152
end switch
153
#endplatform
154
end sub
155
156
157
sub ObjectStartup
158
LoadSpriteSheet("TAttack/TimeAttack.gif")
159
160
SpriteFrame(0, 0, 8, 16, 370, 638) // #0 - 0
161
SpriteFrame(0, 0, 8, 16, 379, 638) // #1 - 1
162
SpriteFrame(0, 0, 8, 16, 388, 638) // #2 - 2
163
SpriteFrame(0, 0, 8, 16, 397, 638) // #3 - 3
164
SpriteFrame(0, 0, 8, 16, 406, 638) // #4 - 4
165
SpriteFrame(0, 0, 8, 16, 415, 638) // #5 - 5
166
SpriteFrame(0, 0, 8, 16, 424, 638) // #6 - 6
167
SpriteFrame(0, 0, 8, 16, 433, 638) // #7 - 7
168
SpriteFrame(0, 0, 8, 16, 442, 638) // #8 - 8
169
SpriteFrame(0, 0, 8, 16, 451, 638) // #9 - 9
170
SpriteFrame(-26, 17, 54, 32, 1, 797) // #10 - Special Stage
171
SpriteFrame(-20, 49, 38, 16, 368, 593) // #11 - Zone 1
172
SpriteFrame(-20, 49, 40, 15, 366, 610) // #12 - Zone 2
173
SpriteFrame(-20, 49, 40, 15, 422, 655) // #13 - Zone 3
174
SpriteFrame(-20, 49, 40, 15, 422, 671) // #14 - Zone 4
175
SpriteFrame(-20, 49, 40, 15, 422, 731) // #15 - Zone 5
176
SpriteFrame(-20, 49, 40, 15, 422, 747) // #16 - Zone 6
177
SpriteFrame(-20, 49, 40, 15, 422, 763) // #17 - Zone 7
178
SpriteFrame(-60, 0, 224, 192, 81, 831) // #18 - Record Menu
179
SpriteFrame(-36, 0, 44, 8, 306, 864) // #19 - Exit
180
SpriteFrame(8, 0, 28, 8, 390, 864) // #20 - Go
181
182
#platform: Use_Origins
183
SpriteFrame(-60, 0, 112, 8, 306, 846) // #21 - Unfocused Exit Go
184
#endplatform
185
186
#platform: Use_Standalone
187
#platform: Standard
188
SpriteFrame(-60, 0, 112, 8, 306, 846) // #21 - Unfocused Exit Go
189
#endplatform
190
#endplatform
191
192
#platform: Use_Standalone
193
#platform: Mobile
194
SpriteFrame(-60, 0, 112, 8, 306, 855) // #21 - Black Rect
195
#endplatform
196
#endplatform
197
198
end sub
199
200
201
// ========================
202
// Editor Subs
203
// ========================
204
205
sub RSDKEdit
206
if Editor.ReturnVariable == true
207
switch Editor.VariableID
208
case EDIT_VAR_PROPVAL // Property Value
209
CheckResult = Object.PropertyValue
210
break
211
case 0 // zoneID
212
CheckResult = Object.PropertyValue
213
break
214
end switch
215
else
216
switch Editor.VariableID
217
case EDIT_VAR_PROPVAL // Property Value
218
Object.PropertyValue = Editor.VariableValue
219
break
220
case 0 // zoneID
221
Object.PropertyValue = Editor.VariableValue
222
break
223
end switch
224
end if
225
end sub
226
227
228
sub RSDKDraw
229
DrawSprite(18)
230
231
DrawSprite(10)
232
233
TempValue0 = 11
234
TempValue0 += Object.PropertyValue
235
DrawSprite(TempValue0)
236
end sub
237
238
239
sub RSDKLoad
240
LoadSpriteSheet("TAttack/TimeAttack.gif")
241
SpriteFrame(0, 0, 8, 16, 370, 638) // #0 - 0
242
SpriteFrame(0, 0, 8, 16, 379, 638) // #1 - 1
243
SpriteFrame(0, 0, 8, 16, 388, 638) // #2 - 2
244
SpriteFrame(0, 0, 8, 16, 397, 638) // #3 - 3
245
SpriteFrame(0, 0, 8, 16, 406, 638) // #4 - 4
246
SpriteFrame(0, 0, 8, 16, 415, 638) // #5 - 5
247
SpriteFrame(0, 0, 8, 16, 424, 638) // #6 - 6
248
SpriteFrame(0, 0, 8, 16, 433, 638) // #7 - 7
249
SpriteFrame(0, 0, 8, 16, 442, 638) // #8 - 8
250
SpriteFrame(0, 0, 8, 16, 451, 638) // #9 - 9
251
SpriteFrame(-26, 17, 54, 32, 1, 797) // #10 - Special Stage
252
SpriteFrame(-20, 49, 38, 16, 368, 593) // #11 - Zone 1
253
SpriteFrame(-20, 49, 40, 15, 366, 610) // #12 - Zone 2
254
SpriteFrame(-20, 49, 40, 15, 422, 655) // #13 - Zone 3
255
SpriteFrame(-20, 49, 40, 15, 422, 671) // #14 - Zone 4
256
SpriteFrame(-20, 49, 40, 15, 422, 731) // #15 - Zone 5
257
SpriteFrame(-20, 49, 40, 15, 422, 747) // #16 - Zone 6
258
SpriteFrame(-20, 49, 40, 15, 422, 763) // #17 - Zone 7
259
SpriteFrame(-60, 0, 224, 192, 81, 831) // #18 - Record Menu
260
SpriteFrame(-36, 0, 44, 8, 306, 864) // #19 - Exit
261
SpriteFrame(8, 0, 28, 8, 390, 864) // #20 - Go
262
SpriteFrame(-60, 0, 112, 8, 306, 855) // #21 - Black Rect
263
264
AddEditorVariable("zoneID")
265
SetActiveVariable("zoneID")
266
AddEnumVariable("Zone 1", 0)
267
AddEnumVariable("Zone 2", 1)
268
AddEnumVariable("Zone 3", 2)
269
AddEnumVariable("Zone 4", 3)
270
AddEnumVariable("Zone 5", 4)
271
AddEnumVariable("Zone 6", 5)
272
AddEnumVariable("Zone 7", 6)
273
end sub
274
275