Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/TAttack/SpecialIcon.txt
1319 views
1
//----------------Sonic CD Special Icon Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
#alias Object.Value1 : Object.Minutes
8
#alias Object.Value2 : Object.Seconds
9
#alias Object.Value3 : Object.Milliseconds
10
#alias Object.Value4 : Object.LockedZone
11
#alias Object.PropertyValue : Object.Portrait
12
13
// Menu Control Aliases
14
#alias Object[0].Value2 : MenuControl.SelectedButton // Only used for Mobile
15
#alias Object[0].Value3 : MenuControl.SavedRound // This is used AFTER you play in time attack
16
#alias Object[0].State : MenuControl.State // This is used AFTER you play in time attack
17
18
// States
19
#alias 0 : ROUNDICON_BLANK
20
#alias 1 : ROUNDICON_SELECTED_ZONE
21
22
// MenuControl States
23
#alias 2 : MENUCONTROL_CONTROLS
24
#alias 3 : MENUCONTROL_BLANK
25
#alias 4 : MENUCONTROL_RETURN_TO_MENU
26
#alias 5 : MENUCONTROL_ENTER_SM
27
28
// Global SFX
29
#alias 27 : SFX_G_SELECT
30
31
// Property Values
32
#alias 0 : SPECIAL_STAGE_1_ICON
33
#alias 1 : SPECIAL_STAGE_2_ICON
34
#alias 2 : SPECIAL_STAGE_3_ICON
35
#alias 3 : SPECIAL_STAGE_4_ICON
36
#alias 4 : SPECIAL_STAGE_5_ICON
37
#alias 5 : SPECIAL_STAGE_6_ICON
38
#alias 6 : SPECIAL_STAGE_7_ICON
39
#alias 7 : EXIT_ICON
40
41
42
sub ObjectMain
43
#platform: Mobile
44
if Options.PhysicalControls == false
45
if MenuControl.State == MENUCONTROL_CONTROLS
46
TempValue0 = Object.iXPos
47
TempValue0 -= 34
48
TempValue1 = Object.iXPos
49
TempValue1 += 34
50
TempValue2 = Object.iYPos
51
TempValue2 -= 45
52
TempValue3 = Object.iYPos
53
TempValue3 += 45
54
CheckTouchRect(TempValue0, TempValue2, TempValue1, TempValue3)
55
if CheckResult > -1
56
MenuControl.SelectedButton = Object.PropertyValue
57
else
58
CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)
59
if CheckResult < 0
60
if MenuControl.SelectedButton == Object.PropertyValue
61
PlaySfx(SFX_G_SELECT, false)
62
MenuControl.State = MENUCONTROL_BLANK
63
Object.State = ROUNDICON_SELECTED_ZONE
64
if Object.Portrait == EXIT_ICON
65
StopMusic()
66
end if
67
end if
68
else
69
if MenuControl.SelectedButton == Object.Portrait
70
MenuControl.SelectedButton = -1
71
end if
72
end if
73
end if
74
end if
75
end if
76
#endplatform
77
end sub
78
79
80
sub ObjectDraw
81
DrawSprite(10)
82
// Icon Movement
83
Object.Rotation++
84
Object.Rotation &= 511
85
Cos(TempValue0, Object.Rotation)
86
TempValue0 >>= 4
87
Sin(TempValue1, Object.Rotation)
88
TempValue1 >>= 4
89
90
switch Object.Portrait
91
case SPECIAL_STAGE_1_ICON
92
TempValue0 += 64
93
TempValue1 += 364
94
break
95
case SPECIAL_STAGE_2_ICON
96
TempValue0 += 192
97
TempValue1 += 364
98
break
99
case SPECIAL_STAGE_3_ICON
100
TempValue0 += 320
101
TempValue1 += 364
102
break
103
case SPECIAL_STAGE_4_ICON
104
TempValue0 += 448
105
TempValue1 += 364
106
break
107
case SPECIAL_STAGE_5_ICON
108
TempValue0 += 64
109
TempValue1 += 508
110
break
111
case SPECIAL_STAGE_6_ICON
112
TempValue0 += 192
113
TempValue1 += 508
114
break
115
case SPECIAL_STAGE_7_ICON
116
TempValue0 += 320
117
TempValue1 += 508
118
break
119
end switch
120
121
if Object.Portrait < EXIT_ICON // Draw for all special stages
122
VertexBuffer[0].x = Object.XPos
123
VertexBuffer[0].x >>= 16
124
VertexBuffer[0].x -= 32
125
VertexBuffer[0].u = TempValue0
126
VertexBuffer[0].u -= 32
127
VertexBuffer[0].y = Object.YPos
128
VertexBuffer[0].y >>= 16
129
VertexBuffer[0].y -= 43
130
VertexBuffer[0].v = TempValue1
131
VertexBuffer[0].v -= 43
132
VertexBuffer[1].x = Object.XPos
133
VertexBuffer[1].x >>= 16
134
VertexBuffer[1].x += 31
135
VertexBuffer[1].u = TempValue0
136
VertexBuffer[1].u += 31
137
VertexBuffer[1].y = VertexBuffer[0].y
138
VertexBuffer[1].v = VertexBuffer[0].v
139
VertexBuffer[2].x = VertexBuffer[0].x
140
VertexBuffer[2].u = VertexBuffer[0].u
141
VertexBuffer[2].y = Object.YPos
142
VertexBuffer[2].y >>= 16
143
VertexBuffer[2].y += 24
144
VertexBuffer[2].v = TempValue1
145
VertexBuffer[2].v += 24
146
VertexBuffer[3].x = VertexBuffer[1].x
147
VertexBuffer[3].u = VertexBuffer[1].u
148
VertexBuffer[3].y = VertexBuffer[2].y
149
VertexBuffer[3].v = VertexBuffer[2].v
150
Draw3DScene()
151
DrawSprite(19)
152
153
TempValue0 = Object.XPos
154
TempValue0 >>= 16
155
TempValue0 -= 24
156
TempValue1 = Object.YPos
157
TempValue1 >>= 16
158
TempValue1 += 34
159
// Zone specific time
160
DrawNumbers(0, TempValue0, TempValue1, Object.Minutes, 2, 6, 1)
161
TempValue0 += 16
162
DrawNumbers(0, TempValue0, TempValue1, Object.Seconds, 2, 6, 1)
163
TempValue0 += 19
164
DrawNumbers(0, TempValue0, TempValue1, Object.Milliseconds, 2, 6, 1)
165
else // Draw the Exit
166
DrawSprite(20)
167
TempValue0 = Object.XPos
168
TempValue0 >>= 16
169
TempValue0 -= 18
170
TempValue1 = Object.YPos
171
TempValue1 >>= 16
172
TempValue1 += 34
173
// Total Time
174
DrawNumbers(0, TempValue0, TempValue1, Object.Minutes, 3, 6, 1)
175
TempValue0 += 16
176
DrawNumbers(0, TempValue0, TempValue1, Object.Seconds, 2, 6, 1)
177
TempValue0 += 19
178
DrawNumbers(0, TempValue0, TempValue1, Object.Milliseconds, 2, 6, 1)
179
DrawSprite(22)
180
end if
181
182
DrawSprite(Object.Frame)
183
if Object.State == ROUNDICON_SELECTED_ZONE
184
TempValue0 = Object.Timer
185
TempValue0 &= 3
186
TempValue0 >>= 1
187
if TempValue0 == 0
188
if MenuControl.SavedRound == Object.Portrait
189
DrawSprite(21)
190
end if
191
end if
192
193
Object.Timer++
194
if Object.Timer == 30
195
Object.Timer = 0
196
Object.State = ROUNDICON_BLANK
197
if Object.Portrait == EXIT_ICON
198
MenuControl.State = MENUCONTROL_RETURN_TO_MENU
199
else
200
MenuControl.State = MENUCONTROL_ENTER_SM
201
MenuControl.SelectedButton = -1
202
end if
203
end if
204
else
205
if MenuControl.State == MENUCONTROL_CONTROLS
206
if MenuControl.SavedRound == Object.PropertyValue
207
DrawSprite(21)
208
end if
209
end if
210
end if
211
end sub
212
213
214
sub ObjectStartup
215
LoadSpriteSheet("TAttack/TimeAttack.gif")
216
217
SpriteFrame(0, 0, 6, 8, 330, 577) // #0 - 0
218
SpriteFrame(0, 0, 6, 8, 337, 577) // #1 - 1
219
SpriteFrame(0, 0, 6, 8, 344, 577) // #2 - 2
220
SpriteFrame(0, 0, 6, 8, 351, 577) // #3 - 3
221
SpriteFrame(0, 0, 6, 8, 330, 586) // #4 - 4
222
SpriteFrame(0, 0, 6, 8, 337, 586) // #5 - 5
223
SpriteFrame(0, 0, 6, 8, 344, 586) // #6 - 6
224
SpriteFrame(0, 0, 6, 8, 351, 586) // #7 - 7
225
SpriteFrame(0, 0, 6, 8, 330, 595) // #8 - 8
226
SpriteFrame(0, 0, 6, 8, 337, 595) // #9 - 9
227
SpriteFrame(-34, -45, 68, 90, 1, 609) // #10 - Border
228
SpriteFrame(-32, 15, 64, 16, 66, 764) // #11 - Special Zone 1
229
SpriteFrame(-32, 15, 64, 16, 131, 764) // #12 - Special Zone 2
230
SpriteFrame(-32, 15, 64, 16, 196, 764) // #13 - Special Zone 3
231
SpriteFrame(-32, 15, 64, 16, 261, 764) // #14 - Special Zone 4
232
SpriteFrame(-32, 15, 64, 16, 66, 780) // #15 - Special Zone 5
233
SpriteFrame(-32, 15, 64, 16, 131, 780) // #16 - Special Zone 6
234
SpriteFrame(-32, 15, 64, 16, 196, 780) // #17 - Special Zone 7
235
SpriteFrame(-32, 15, 64, 16, 265, 593) // #18 - Total Time
236
SpriteFrame(-32, 31, 64, 13, 70, 638) // #19 - ' "
237
SpriteFrame(-32, 31, 64, 13, 70, 652) // #20 - ' "
238
SpriteFrame(-35, -46, 70, 92, 441, 860) // #21 - Selected Border
239
SpriteFrame(-29, -22, 56, 21, 223, 679) // #22 - Exit
240
241
ArrayPos0 = 32
242
while ArrayPos0 < 1056
243
if Object[ArrayPos0].Type == TypeName[Special Icon]
244
Object[ArrayPos0].Frame = Object[ArrayPos0].Portrait
245
Object[ArrayPos0].Frame += 11
246
247
Object[ArrayPos0].Rotation = Object[ArrayPos0].Portrait
248
Object[ArrayPos0].Rotation <<= 8
249
250
if Object[ArrayPos0].Portrait > 3
251
Object[ArrayPos0].Rotation += 256
252
end if
253
end if
254
ArrayPos0++
255
loop
256
end sub
257
258
259
// ========================
260
// Editor Subs
261
// ========================
262
263
sub RSDKEdit
264
if Editor.ReturnVariable == true
265
switch Editor.VariableID
266
case EDIT_VAR_PROPVAL // Property Value
267
CheckResult = Object.PropertyValue
268
CheckResult &= 7
269
break
270
case 0 // roundID
271
CheckResult = Object.PropertyValue
272
CheckResult &= 7
273
break
274
end switch
275
else
276
switch Editor.VariableID
277
case EDIT_VAR_PROPVAL // Property Value
278
Object.PropertyValue = Editor.VariableValue
279
Object.PropertyValue &= 7
280
break
281
case 0 // roundID
282
Object.PropertyValue = Editor.VariableValue
283
Object.PropertyValue &= 7
284
break
285
end switch
286
end if
287
end sub
288
289
290
sub RSDKDraw
291
Object.Frame = Object.PropertyValue
292
Object.Frame += 11
293
294
DrawSprite(10)
295
296
if Object.PropertyValue < 7 // Draw for all main stages
297
DrawSprite(19)
298
else // Draw the Exit
299
DrawSprite(20)
300
DrawSprite(22)
301
end if
302
303
DrawSprite(Object.Frame)
304
end sub
305
306
307
sub RSDKLoad
308
LoadSpriteSheet("TAttack/TimeAttack.gif")
309
SpriteFrame(0, 0, 6, 8, 330, 577) // #0 - 0
310
SpriteFrame(0, 0, 6, 8, 337, 577) // #1 - 1
311
SpriteFrame(0, 0, 6, 8, 344, 577) // #2 - 2
312
SpriteFrame(0, 0, 6, 8, 351, 577) // #3 - 3
313
SpriteFrame(0, 0, 6, 8, 330, 586) // #4 - 4
314
SpriteFrame(0, 0, 6, 8, 337, 586) // #5 - 5
315
SpriteFrame(0, 0, 6, 8, 344, 586) // #6 - 6
316
SpriteFrame(0, 0, 6, 8, 351, 586) // #7 - 7
317
SpriteFrame(0, 0, 6, 8, 330, 595) // #8 - 8
318
SpriteFrame(0, 0, 6, 8, 337, 595) // #9 - 9
319
SpriteFrame(-34, -45, 68, 90, 1, 609) // #10 - Border
320
SpriteFrame(-32, 15, 64, 16, 66, 764) // #11 - Special Zone 1
321
SpriteFrame(-32, 15, 64, 16, 131, 764) // #12 - Special Zone 2
322
SpriteFrame(-32, 15, 64, 16, 196, 764) // #13 - Special Zone 3
323
SpriteFrame(-32, 15, 64, 16, 261, 764) // #14 - Special Zone 4
324
SpriteFrame(-32, 15, 64, 16, 66, 780) // #15 - Special Zone 5
325
SpriteFrame(-32, 15, 64, 16, 131, 780) // #16 - Special Zone 6
326
SpriteFrame(-32, 15, 64, 16, 196, 780) // #17 - Special Zone 7
327
SpriteFrame(-32, 15, 64, 16, 265, 593) // #18 - Total Time
328
SpriteFrame(-32, 31, 64, 13, 70, 638) // #19 - ' "
329
SpriteFrame(-32, 31, 64, 13, 70, 652) // #20 - ' "
330
SpriteFrame(-35, -46, 70, 92, 441, 860) // #21 - Selected Border
331
SpriteFrame(-29, -22, 56, 21, 223, 679) // #22 - Exit
332
333
AddEditorVariable("roundID")
334
SetActiveVariable("roundID")
335
AddEnumVariable("Special Zone 1", 0)
336
AddEnumVariable("Special Zone 2", 1)
337
AddEnumVariable("Special Zone 3", 2)
338
AddEnumVariable("Special Zone 4", 3)
339
AddEnumVariable("Special Zone 5", 4)
340
AddEnumVariable("Special Zone 6", 5)
341
AddEnumVariable("Special Zone 7", 6)
342
AddEnumVariable("Total Time", 7)
343
end sub
344
345