Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/TAttack/Records.txt
1319 views
1
//------------------Sonic CD 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
// Large Icon Aliases
12
#alias Object.PropertyValue : LargeIcon.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
// Priority
33
#alias 1 : PRIORITY_ACTIVE
34
35
// Function delarations
36
#function Records_DrawRecords
37
38
function Records_DrawRecords
39
Object.Minutes = SaveRAM[ArrayPos0]
40
Object.Minutes /= 6000
41
42
Object.Seconds = SaveRAM[ArrayPos0]
43
Object.Seconds /= 100
44
Object.Seconds %= 60
45
46
Object.MilliSeconds = SaveRAM[ArrayPos0]
47
Object.MilliSeconds %= 100
48
49
TempValue0 = Object.XPos
50
TempValue0 >>= 16
51
TempValue0 -= 16
52
DrawNumbers(26, TempValue0, TempValue1, Object.Minutes, 2, 8, 1)
53
TempValue0 += 24
54
DrawNumbers(26, TempValue0, TempValue1, Object.Seconds, 2, 8, 1)
55
TempValue0 += 24
56
DrawNumbers(26, TempValue0, TempValue1, Object.MilliSeconds, 2, 8, 1)
57
end function
58
59
60
sub ObjectMain
61
Object.YPos = Object.Record
62
Object.YPos *= 192
63
Object.YPos -= MenuControl.SMYPos
64
if Object.YPos < -384
65
Object.YPos += 576
66
end if
67
Object.YPos += 224
68
Object.YPos <<= 16
69
end sub
70
71
72
sub ObjectDraw
73
DrawSprite(47)
74
switch Object.PropertyValue
75
case FIRST_RECORD
76
TempValue0 = LargeIcon[-1].Portrait
77
TempValue0 += 36
78
DrawSprite(TempValue0)
79
DrawSprite(44)
80
break
81
82
case SECOND_RECORD
83
TempValue0 = LargeIcon[-2].Portrait
84
TempValue0 += 36
85
DrawSprite(TempValue0)
86
DrawSprite(45)
87
break
88
89
case THIRD_RECORD
90
TempValue0 = LargeIcon[-3].Portrait
91
TempValue0 += 36
92
DrawSprite(TempValue0)
93
DrawSprite(46)
94
break
95
end switch
96
97
ArrayPos0 = TempValue0
98
ArrayPos0 -= 36
99
ArrayPos0 *= 18
100
101
TempValue0 = Object.Record
102
TempValue0 *= 6
103
104
ArrayPos0 += TempValue0
105
ArrayPos0 += 48
106
107
TempValue1 = Object.YPos
108
TempValue1 >>= 16
109
TempValue1 += 97
110
CallFunction(Records_DrawRecords)
111
112
TempValue1 += 24
113
ArrayPos0 += 2
114
CallFunction(Records_DrawRecords)
115
116
TempValue1 += 24
117
ArrayPos0 += 2
118
CallFunction(Records_DrawRecords)
119
120
#platform: Standard
121
switch MenuControl.State
122
case MENUCONTROL_SM_CONTROLS
123
switch MenuControl.SMCurrentButton
124
case 0
125
DrawSprite(48)
126
break
127
case 1
128
DrawSprite(49)
129
break
130
case 2
131
DrawSprite(50)
132
break
133
end switch
134
break
135
136
case MENUCONTROL_SM_CONFIRMED
137
TempValue0 = MenuControl.Timer
138
TempValue0 &= 3
139
TempValue0 >>= 1
140
if TempValue0 == 0
141
DrawSprite(50)
142
end if
143
break
144
145
case MENUCONTROL_SM_LOAD_LEVEL
146
DrawSprite(50)
147
break
148
149
case MENUCONTROL_SM_COMFIRMED_LEAVE
150
TempValue0 = MenuControl.Timer
151
TempValue0 &= 3
152
TempValue0 >>= 1
153
if TempValue0 == 0
154
DrawSprite(48)
155
end if
156
break
157
158
end switch
159
#endplatform
160
161
#platform: Mobile
162
DrawSprite(51) // Blocks the PC buttons
163
#endplatform
164
end sub
165
166
167
sub ObjectStartup
168
LoadSpriteSheet("TAttack/TimeAttack.gif")
169
170
SpriteFrame(0, 0, 8, 16, 136, 638) // #0 - A
171
SpriteFrame(0, 0, 8, 16, 145, 638) // #1 - B
172
SpriteFrame(0, 0, 8, 16, 154, 638) // #2 - C
173
SpriteFrame(0, 0, 8, 16, 163, 638) // #3 - D
174
SpriteFrame(0, 0, 8, 16, 172, 638) // #4 - E
175
SpriteFrame(0, 0, 8, 16, 181, 638) // #5 - F
176
SpriteFrame(0, 0, 8, 16, 190, 638) // #6 - G
177
SpriteFrame(0, 0, 8, 16, 199, 638) // #7 - H
178
SpriteFrame(0, 0, 8, 16, 208, 638) // #8 - I
179
SpriteFrame(0, 0, 8, 16, 217, 638) // #9 - J
180
SpriteFrame(0, 0, 8, 16, 226, 638) // #10 - K
181
SpriteFrame(0, 0, 8, 16, 235, 638) // #11 - L
182
SpriteFrame(0, 0, 8, 16, 244, 638) // #12 - M
183
SpriteFrame(0, 0, 8, 16, 253, 638) // #13 - N
184
SpriteFrame(0, 0, 8, 16, 262, 638) // #14 - O
185
SpriteFrame(0, 0, 8, 16, 280, 638) // #15 - P
186
SpriteFrame(0, 0, 8, 16, 289, 638) // #16 - Q
187
SpriteFrame(0, 0, 8, 16, 298, 638) // #17 - R
188
SpriteFrame(0, 0, 8, 16, 307, 638) // #18 - S
189
SpriteFrame(0, 0, 8, 16, 316, 638) // #19 - T
190
SpriteFrame(0, 0, 8, 16, 325, 638) // #20 - U
191
SpriteFrame(0, 0, 8, 16, 334, 638) // #21 - V
192
SpriteFrame(0, 0, 8, 16, 343, 638) // #22 - W
193
SpriteFrame(0, 0, 8, 16, 352, 638) // #23 - X
194
SpriteFrame(0, 0, 8, 16, 361, 638) // #24 - Y
195
SpriteFrame(0, 0, 8, 16, 361, 638) // #25 - Z
196
SpriteFrame(0, 0, 8, 16, 370, 638) // #26 - 0
197
SpriteFrame(0, 0, 8, 16, 379, 638) // #27 - 1
198
SpriteFrame(0, 0, 8, 16, 388, 638) // #28 - 2
199
SpriteFrame(0, 0, 8, 16, 397, 638) // #29 - 3
200
SpriteFrame(0, 0, 8, 16, 406, 638) // #30 - 4
201
SpriteFrame(0, 0, 8, 16, 415, 638) // #31 - 5
202
SpriteFrame(0, 0, 8, 16, 424, 638) // #32 - 6
203
SpriteFrame(0, 0, 8, 16, 433, 638) // #33 - 7
204
SpriteFrame(0, 0, 8, 16, 442, 638) // #34 - 8
205
SpriteFrame(0, 0, 8, 16, 451, 638) // #35 - 9
206
SpriteFrame(-32, 17, 64, 32, 1, 731) // #36 - Palmtree Panic
207
SpriteFrame(-32, 17, 65, 32, 66, 731) // #37 - Collision Chaos
208
SpriteFrame(-30, 17, 60, 32, 132, 731) // #38 - Tidal Tempest
209
SpriteFrame(-35, 17, 70, 32, 193, 731) // #39 - Quartz Quadrant
210
SpriteFrame(-38, 17, 77, 32, 264, 731) // #40 - Wacky Workbench
211
SpriteFrame(-34, 17, 68, 32, 342, 731) // #41 - Stardust Speedway
212
SpriteFrame(-32, 17, 64, 32, 1, 764) // #42 - Metallic Madness
213
SpriteFrame(-32, 17, 64, 32, 1, 764) // #43 - Copy of above (unused)
214
SpriteFrame(-20, 49, 38, 16, 368, 593) // #44 - Zone 1
215
SpriteFrame(-20, 49, 40, 15, 366, 610) // #45 - Zone 2
216
SpriteFrame(-20, 49, 40, 15, 422, 655) // #46 - Zone 3
217
SpriteFrame(-60, 0, 224, 192, 81, 831) // #47 - Record Menu
218
SpriteFrame(-60, 0, 44, 8, 306, 864) // #48 - Exit
219
SpriteFrame(-16, 0, 40, 8, 350, 864) // #49 - Next
220
SpriteFrame(24, 0, 28, 8, 390, 864) // #50 - Go
221
SpriteFrame(-60, 0, 112, 8, 306, 855) // #51 - Black Rect
222
223
// Used to be below LoadSpriteSheet, moved here for consistency with the rest of scripts
224
ArrayPos0 = 32
225
while ArrayPos0 < 1056
226
if Object[ArrayPos0].Type == TypeName[Records]
227
TempValue0 = Screen.CenterX
228
TempValue0 += 76
229
TempValue0 <<= 16
230
Object[ArrayPos0].XPos = TempValue0
231
Object[ArrayPos0].DrawOrder = 2
232
Object[ArrayPos0].Priority = PRIORITY_ACTIVE
233
end if
234
ArrayPos0++
235
loop
236
237
end sub
238
239
240
// ========================
241
// Editor Subs
242
// ========================
243
244
sub RSDKEdit
245
if Editor.ReturnVariable == true
246
switch Editor.VariableID
247
case EDIT_VAR_PROPVAL // Property Value
248
CheckResult = Object.PropertyValue
249
break
250
case 0 // zoneID
251
CheckResult = Object.PropertyValue
252
break
253
end switch
254
else
255
switch Editor.VariableID
256
case EDIT_VAR_PROPVAL // Property Value
257
Object.PropertyValue = Editor.VariableValue
258
break
259
case 0 // zoneID
260
Object.PropertyValue = Editor.VariableValue
261
break
262
end switch
263
end if
264
end sub
265
266
267
sub RSDKDraw
268
DrawSprite(47)
269
270
DrawSprite(36)
271
272
TempValue0 = 44
273
TempValue0 += Object.PropertyValue
274
DrawSprite(TempValue0)
275
end sub
276
277
278
sub RSDKLoad
279
LoadSpriteSheet("TAttack/TimeAttack.gif")
280
281
SpriteFrame(0, 0, 8, 16, 136, 638) // #0 - A
282
SpriteFrame(0, 0, 8, 16, 145, 638) // #1 - B
283
SpriteFrame(0, 0, 8, 16, 154, 638) // #2 - C
284
SpriteFrame(0, 0, 8, 16, 163, 638) // #3 - D
285
SpriteFrame(0, 0, 8, 16, 172, 638) // #4 - E
286
SpriteFrame(0, 0, 8, 16, 181, 638) // #5 - F
287
SpriteFrame(0, 0, 8, 16, 190, 638) // #6 - G
288
SpriteFrame(0, 0, 8, 16, 199, 638) // #7 - H
289
SpriteFrame(0, 0, 8, 16, 208, 638) // #8 - I
290
SpriteFrame(0, 0, 8, 16, 217, 638) // #9 - J
291
SpriteFrame(0, 0, 8, 16, 226, 638) // #10 - K
292
SpriteFrame(0, 0, 8, 16, 235, 638) // #11 - L
293
SpriteFrame(0, 0, 8, 16, 244, 638) // #12 - M
294
SpriteFrame(0, 0, 8, 16, 253, 638) // #13 - N
295
SpriteFrame(0, 0, 8, 16, 262, 638) // #14 - O
296
SpriteFrame(0, 0, 8, 16, 280, 638) // #15 - P
297
SpriteFrame(0, 0, 8, 16, 289, 638) // #16 - Q
298
SpriteFrame(0, 0, 8, 16, 298, 638) // #17 - R
299
SpriteFrame(0, 0, 8, 16, 307, 638) // #18 - S
300
SpriteFrame(0, 0, 8, 16, 316, 638) // #19 - T
301
SpriteFrame(0, 0, 8, 16, 325, 638) // #20 - U
302
SpriteFrame(0, 0, 8, 16, 334, 638) // #21 - V
303
SpriteFrame(0, 0, 8, 16, 343, 638) // #22 - W
304
SpriteFrame(0, 0, 8, 16, 352, 638) // #23 - X
305
SpriteFrame(0, 0, 8, 16, 361, 638) // #24 - Y
306
SpriteFrame(0, 0, 8, 16, 361, 638) // #25 - Z
307
SpriteFrame(0, 0, 8, 16, 370, 638) // #26 - 0
308
SpriteFrame(0, 0, 8, 16, 379, 638) // #27 - 1
309
SpriteFrame(0, 0, 8, 16, 388, 638) // #28 - 2
310
SpriteFrame(0, 0, 8, 16, 397, 638) // #29 - 3
311
SpriteFrame(0, 0, 8, 16, 406, 638) // #30 - 4
312
SpriteFrame(0, 0, 8, 16, 415, 638) // #31 - 5
313
SpriteFrame(0, 0, 8, 16, 424, 638) // #32 - 6
314
SpriteFrame(0, 0, 8, 16, 433, 638) // #33 - 7
315
SpriteFrame(0, 0, 8, 16, 442, 638) // #34 - 8
316
SpriteFrame(0, 0, 8, 16, 451, 638) // #35 - 9
317
SpriteFrame(-32, 17, 64, 32, 1, 731) // #36 - Palmtree Panic
318
SpriteFrame(-32, 17, 65, 32, 66, 731) // #37 - Collision Chaos
319
SpriteFrame(-30, 17, 60, 32, 132, 731) // #38 - Tidal Tempest
320
SpriteFrame(-35, 17, 70, 32, 193, 731) // #39 - Quartz Quadrant
321
SpriteFrame(-38, 17, 77, 32, 264, 731) // #40 - Wacky Workbench
322
SpriteFrame(-34, 17, 68, 32, 342, 731) // #41 - Stardust Speedway
323
SpriteFrame(-32, 17, 64, 32, 1, 764) // #42 - Metallic Madness
324
SpriteFrame(-32, 17, 64, 32, 1, 764) // #43 - Copy of above (unused)
325
SpriteFrame(-20, 49, 38, 16, 368, 593) // #44 - Zone 1
326
SpriteFrame(-20, 49, 40, 15, 366, 610) // #45 - Zone 2
327
SpriteFrame(-20, 49, 40, 15, 422, 655) // #46 - Zone 3
328
SpriteFrame(-60, 0, 224, 192, 81, 831) // #47 - Record Menu
329
SpriteFrame(-60, 0, 44, 8, 306, 864) // #48 - Exit
330
SpriteFrame(-16, 0, 40, 8, 350, 864) // #49 - Next
331
SpriteFrame(24, 0, 28, 8, 390, 864) // #50 - Go
332
SpriteFrame(-60, 0, 112, 8, 306, 855) // #51 - Black Rect
333
334
AddEditorVariable("zoneID")
335
SetActiveVariable("zoneID")
336
AddEnumVariable("Zone 1", 0)
337
AddEnumVariable("Zone 2", 1)
338
AddEnumVariable("Zone 3", 2)
339
end sub
340
341