Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/LBoards/LEntry.txt
1319 views
1
//--------------Sonic CD Leaderboards Entry Script------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
//------------------Only exist in WP7 Versions----------------//
5
6
// Aliases
7
#alias Object.Value0 : Object.HTimer
8
#alias Object.Value3 : Object.Index
9
#alias Object.Value4 : Object.VTimer
10
#alias Object.Value5 : Object.SavedXPos
11
12
// Menu Control Alias
13
#alias Object[0].State : MenuControl.State
14
15
// Next and previous LEntry's
16
#alias Object.State : PrevLEntry.State
17
#alias Object.State : NextLEntry.State
18
19
// States
20
#alias 0 : LENTRY_BLANK
21
#alias 1 : LENTRY_MOVE_RIGHT
22
#alias 2 : LENTRY_SCROLL_ENTRIES_R
23
#alias 3 : LENTRY_STOP_SCROLL_R
24
#alias 4 : LENTRY_MOVE_LEFT
25
#alias 5 : LENTRY_SCROLL_ENTRIES_L
26
#alias 6 : LENTRY_STOP_SCROLL_L
27
#alias 7 : LENTRY_MOVE_DOWN
28
#alias 8 : LENTRY_SCROLL_ENTRIES_D
29
#alias 9 : LENTRY_STOP_SCROLL_D
30
#alias 10 : LENTRY_MOVE_UP
31
#alias 11 : LENTRY_SCROLL_ENTRIES_U
32
#alias 12 : LENTRY_STOP_SCROLL_U
33
34
// Menu Control States
35
#alias 2 : MENUCONTROL_CONTROLS
36
37
// Priority
38
#alias 1 : PRIORITY_ACTIVE
39
40
// Ink Effect
41
#alias 2 : INK_ALPHA
42
43
// Text Info type
44
#alias 0 : TEXTINFO_TEXTDATA
45
#alias 1 : TEXTINFO_TEXTSIZE
46
47
// Online Menus
48
#alias 1 : ONLINEMENU_LEADERBOARDS
49
50
// Property Values
51
#alias 0 : ENTRY_1
52
#alias 1 : ENTRY_2
53
#alias 2 : ENTRY_3
54
#alias 3 : ENTRY_4
55
#alias 4 : ENTRY_5
56
57
58
sub ObjectMain
59
switch Object.State
60
case LENTRY_BLANK
61
break
62
63
case LENTRY_MOVE_RIGHT
64
Object.SavedXPos = Object.XPos
65
Object.Priority = PRIORITY_ACTIVE
66
Object.State++
67
break
68
69
case LENTRY_SCROLL_ENTRIES_R
70
Object.XPos -= 0x300000
71
if Object.HTimer < 25
72
Object.HTimer++
73
if Object.PropertyValue < 4
74
if Object.HTimer == 5
75
PrevLEntry[+1].State = LENTRY_MOVE_RIGHT
76
if Object.PropertyValue == ENTRY_2
77
Leaderboard.ID++
78
Leaderboard.ID %= 22
79
LoadOnlineMenu(ONLINEMENU_LEADERBOARDS)
80
end if
81
end if
82
end if
83
else
84
Object.HTimer = 0
85
Object.iXPos = Screen.XSize
86
Object.XPos += 0x100000
87
Object.State++
88
end if
89
break
90
91
case LENTRY_STOP_SCROLL_R
92
Object.XPos -= 0x300000
93
if Object.XPos < Object.SavedXPos
94
Object.XPos = Object.SavedXPos
95
Object.State = LENTRY_BLANK
96
if Object.PropertyValue == ENTRY_5
97
MenuControl.State = MENUCONTROL_CONTROLS
98
end if
99
end if
100
break
101
102
case LENTRY_MOVE_LEFT
103
Object.SavedXPos = Object.XPos
104
Object.Priority = PRIORITY_ACTIVE
105
Object.State++
106
break
107
108
case LENTRY_SCROLL_ENTRIES_L
109
Object.XPos += 0x300000
110
if Object.HTimer < 25
111
Object.HTimer++
112
if Object.PropertyValue < 4
113
if Object.HTimer == 5
114
PrevLEntry[+1].State = LENTRY_MOVE_LEFT
115
if Object.PropertyValue == ENTRY_3
116
Leaderboard.ID--
117
if Leaderboard.ID < 0
118
Leaderboard.ID = 21
119
end if
120
LoadOnlineMenu(ONLINEMENU_LEADERBOARDS)
121
end if
122
end if
123
end if
124
else
125
Object.HTimer = 0
126
Object.iXPos = -232
127
Object.XPos -= 0x100000
128
Object.State++
129
end if
130
break
131
132
case LENTRY_STOP_SCROLL_L
133
Object.XPos += 0x300000
134
if Object.XPos > Object.SavedXPos
135
Object.XPos = Object.SavedXPos
136
Object.State = LENTRY_BLANK
137
if Object.PropertyValue == ENTRY_5
138
MenuControl.State = MENUCONTROL_CONTROLS
139
end if
140
end if
141
break
142
143
case LENTRY_MOVE_DOWN
144
if Object.VTimer < 95
145
Object.VTimer += 5
146
end if
147
Object.Alpha = 255
148
Object.State++
149
break
150
151
case LENTRY_SCROLL_ENTRIES_D
152
Object.InkEffect = INK_ALPHA
153
Object.Alpha = 224
154
Object.State++
155
break
156
157
case LENTRY_STOP_SCROLL_D
158
if Object.Alpha > 0
159
Object.Alpha -= 32
160
if Object.PropertyValue < 4
161
if Object.Alpha == 128
162
PrevLEntry[+1].State = LENTRY_MOVE_DOWN
163
end if
164
end if
165
else
166
Object.State = LENTRY_BLANK
167
if Object.PropertyValue == ENTRY_5
168
MenuControl.State = MENUCONTROL_CONTROLS
169
end if
170
end if
171
break
172
173
case LENTRY_MOVE_UP
174
if Object.VTimer > 0
175
Object.VTimer -= 5
176
end if
177
Object.Alpha = 255
178
Object.State++
179
break
180
181
case LENTRY_SCROLL_ENTRIES_U
182
Object.InkEffect = INK_ALPHA
183
Object.Alpha = 224
184
Object.State++
185
break
186
187
case LENTRY_STOP_SCROLL_U
188
if Object.Alpha > 0
189
Object.Alpha -= 32
190
if Object.PropertyValue < 4
191
if Object.Alpha == 128
192
PrevLEntry[+1].State = LENTRY_MOVE_UP
193
end if
194
end if
195
else
196
Object.State = LENTRY_BLANK
197
if Object.PropertyValue == ENTRY_5
198
MenuControl.State = MENUCONTROL_CONTROLS
199
end if
200
end if
201
break
202
203
end switch
204
end sub
205
206
207
sub ObjectDraw
208
DrawSprite(142)
209
210
Object.Index = Object.PropertyValue
211
Object.Index += Object.VTimer
212
ArrayPos0 = 0
213
214
GetTextInfo(TempValue1, MENU_1, TEXTINFO_TEXTSIZE, Object.Index, 0)
215
TempValue2 = Object.XPos
216
TempValue2 += 0x80000
217
TempValue3 = 0
218
while TempValue3 < 4
219
GetTextInfo(TempValue0, MENU_1, TEXTINFO_TEXTDATA, Object.Index, ArrayPos0)
220
switch TempValue0
221
default
222
Object.Frame = 0
223
if TempValue0 > 47
224
if TempValue0 < 58
225
Object.Frame = TempValue0
226
Object.Frame -= 15
227
end if
228
end if
229
230
if Object.Frame > 0
231
Object.Frame += 71
232
DrawSpriteXY(Object.Frame, TempValue2, Object.YPos)
233
end if
234
break
235
236
case 34
237
DrawSpriteXY(100, TempValue2, Object.YPos)
238
break
239
240
case 39
241
DrawSpriteXY(99, TempValue2, Object.YPos)
242
break
243
244
case 46
245
DrawSpriteXY(98, TempValue2, Object.YPos)
246
break
247
248
end switch
249
ArrayPos0++
250
TempValue3++
251
TempValue2 += 0x80000
252
loop
253
254
TempValue1 -= 4
255
while TempValue1 > 0
256
GetTextInfo(TempValue0, MENU_1, TEXTINFO_TEXTDATA, Object.Index, ArrayPos0)
257
switch TempValue0
258
default
259
Object.Frame = 0
260
if TempValue0 > 64
261
if TempValue0 < 91
262
Object.Frame = TempValue0
263
Object.Frame -= 64
264
end if
265
end if
266
267
if TempValue0 > 96
268
if TempValue0 < 123
269
Object.Frame = TempValue0
270
Object.Frame -= 54
271
end if
272
end if
273
274
if TempValue0 > 47
275
if TempValue0 < 58
276
Object.Frame = TempValue0
277
Object.Frame -= 15
278
end if
279
end if
280
281
if Object.Frame > 0
282
DrawSpriteXY(Object.Frame, TempValue2, Object.YPos)
283
end if
284
break
285
286
case 34
287
DrawSpriteXY(29, TempValue2, Object.YPos)
288
break
289
290
case 39
291
DrawSpriteXY(28, TempValue2, Object.YPos)
292
break
293
294
case 45
295
DrawSpriteXY(69, TempValue2, Object.YPos)
296
break
297
298
case 46
299
DrawSpriteXY(27, TempValue2, Object.YPos)
300
break
301
302
end switch
303
ArrayPos0++
304
TempValue1--
305
TempValue2 += 0x80000
306
loop
307
308
if Object.State > LENTRY_STOP_SCROLL_L
309
DrawSpriteFX(143, FX_INK, Object.XPos, Object.YPos)
310
end if
311
end sub
312
313
314
sub ObjectStartup
315
LoadSpriteSheet("LBoards/Leaderboards.gif")
316
LoadTextFile(MENU_1, "Data/Game/LeaderboardText.txt", 0)
317
Leaderboard.ID = 0
318
LoadOnlineMenu(ONLINEMENU_LEADERBOARDS)
319
320
SpriteFrame(0, 0, 8, 10, 118, 298) // #0 - Blank Space
321
322
// (#1 - #70) - Alphabet
323
TempValue1 = 254
324
while TempValue1 < 308
325
TempValue0 = 127
326
while TempValue0 < 253
327
SpriteFrame(-3, -5, 8, 10, TempValue0, TempValue1)
328
TempValue0 += 9
329
loop
330
TempValue1 += 11
331
loop
332
333
SpriteFrame(0, 0, 8, 10, 118, 298) // #72 - Blank Space
334
335
// (#73 - #141) Alphabet Highlight
336
TempValue1 = 254
337
while TempValue1 < 308
338
TempValue0 = 1
339
while TempValue0 < 127
340
SpriteFrame(-3, -5, 8, 10, TempValue0, TempValue1)
341
TempValue0 += 9
342
loop
343
TempValue1 += 11
344
loop
345
346
SpriteFrame(0, -10, 232, 21, 1, 309) // #142 - Button
347
SpriteFrame(0, -10, 232, 21, 1, 232) // #143 - Button Flash
348
end sub
349
350
351
// ========================
352
// Editor Subs
353
// ========================
354
355
sub RSDKDraw
356
DrawSprite(0)
357
end sub
358
359
360
sub RSDKLoad
361
LoadSpriteSheet("LBoards/Leaderboards.gif")
362
363
SpriteFrame(0, -10, 232, 21, 1, 309) // #142 - Button
364
365
SetVariableAlias(ALIAS_VAR_PROPVAL, "entry")
366
end sub
367
368