Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/TagaTaga.txt
1319 views
1
//-----------------Sonic CD TagaTaga 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.YVelocity
8
#alias Object.Value2 : Object.YOriginPos
9
10
#alias Object.PropertyValue : Object.Quality
11
12
// States
13
#alias 0 : TAGATAGA_SET_LAUNCH_SPEED
14
#alias 1 : TAGATAGA_EMERGE
15
#alias 2 : TAGATAGA_MOVE_PINCH_1
16
#alias 3 : TAGATAGA_TURN_1
17
#alias 4 : TAGATAGA_TURN_2
18
#alias 5 : TAGATAGA_TURN_3
19
#alias 6 : TAGATAGA_MOVE_PINCH_2
20
#alias 7 : TAGATAGA_SUBMERGE
21
22
// Stage SFX
23
#alias 3 : SFX_S_WATERSPLASH
24
25
// Badnik Quality / Property Values
26
#alias 0 : GOOD_QUALITY
27
#alias 1 : BAD_QUALITY
28
29
// Priority
30
#alias 0 : PRIORITY_BOUNDS
31
#alias 1 : PRIORITY_ACTIVE
32
33
34
sub ObjectMain
35
if Object.Quality == GOOD_QUALITY
36
37
switch Object.State
38
case TAGATAGA_SET_LAUNCH_SPEED
39
Object.YVelocity = -0x40000
40
41
Object.Timer = 1
42
43
Object.State = TAGATAGA_EMERGE
44
break
45
46
case TAGATAGA_EMERGE
47
Object.YVelocity += 0x1000
48
Object.YPos += Object.YVelocity
49
50
Object.Timer++
51
if Object.Timer > 24
52
Object.State = TAGATAGA_MOVE_PINCH_1
53
end if
54
break
55
56
case TAGATAGA_MOVE_PINCH_1
57
Object.YVelocity += 0x1000
58
Object.YPos += Object.YVelocity
59
60
Object.Timer++
61
if Object.Timer > 48
62
Object.State = TAGATAGA_TURN_1
63
end if
64
break
65
66
case TAGATAGA_TURN_1
67
Object.YVelocity += 0x1000
68
Object.YPos += Object.YVelocity
69
70
Object.Timer++
71
if Object.Timer > 56
72
Object.State = TAGATAGA_TURN_2
73
end if
74
break
75
76
case TAGATAGA_TURN_2
77
Object.YVelocity += 0x1000
78
Object.YPos += Object.YVelocity
79
80
Object.Timer++
81
if Object.Timer > 64
82
Object.State = TAGATAGA_TURN_3
83
end if
84
break
85
86
case TAGATAGA_TURN_3
87
Object.YVelocity += 0x1000
88
Object.YPos += Object.YVelocity
89
90
Object.Timer++
91
if Object.Timer > 96
92
Object.State = TAGATAGA_MOVE_PINCH_2
93
end if
94
break
95
96
case TAGATAGA_MOVE_PINCH_2
97
Object.YVelocity += 0x1000
98
Object.YPos += Object.YVelocity
99
100
Object.Timer++
101
if Object.Timer > 128
102
Object.State = TAGATAGA_SUBMERGE
103
PlayStageSfx(SFX_S_WATERSPLASH, false)
104
end if
105
break
106
107
case TAGATAGA_SUBMERGE
108
Object.Timer++
109
if Object.Timer > 204
110
Object.State = TAGATAGA_SET_LAUNCH_SPEED
111
112
Object.Timer = 0
113
114
Object.YPos = Object.YOriginPos
115
PlayStageSfx(SFX_S_WATERSPLASH, false)
116
end if
117
break
118
119
end switch
120
121
else
122
switch Object.State
123
case TAGATAGA_SET_LAUNCH_SPEED
124
Object.YVelocity = -0x30000
125
126
Object.Timer = 1
127
128
Object.State = TAGATAGA_EMERGE
129
break
130
131
case TAGATAGA_EMERGE
132
Object.YVelocity += 0xEC4
133
Object.YPos += Object.YVelocity
134
135
Object.Timer++
136
if Object.Timer > 40
137
Object.State = TAGATAGA_MOVE_PINCH_1
138
end if
139
break
140
141
case TAGATAGA_MOVE_PINCH_1
142
Object.YVelocity += 0xEC4
143
Object.YPos += Object.YVelocity
144
145
Object.Timer++
146
if Object.Timer > 50
147
Object.State = TAGATAGA_TURN_1
148
end if
149
break
150
151
case TAGATAGA_TURN_1
152
Object.YVelocity += 0xEC4
153
Object.YPos += Object.YVelocity
154
155
Object.Timer++
156
if Object.Timer > 60
157
Object.State = TAGATAGA_TURN_2
158
end if
159
break
160
161
case TAGATAGA_TURN_2
162
Object.YVelocity += 0xEC4
163
Object.YPos += Object.YVelocity
164
165
Object.Timer++
166
if Object.Timer > 104
167
Object.State = TAGATAGA_TURN_3
168
PlayStageSfx(SFX_S_WATERSPLASH, false)
169
end if
170
break
171
172
case TAGATAGA_TURN_3
173
Object.Timer++
174
if Object.Timer > 188
175
Object.State = TAGATAGA_SET_LAUNCH_SPEED
176
177
Object.Timer = 0
178
179
Object.YPos = Object.YOriginPos
180
PlayStageSfx(SFX_S_WATERSPLASH, false)
181
end if
182
break
183
184
end switch
185
186
end if
187
CallFunction(StageSetup_CheckGoodFuture) // Check if it should be a flower
188
end sub
189
190
191
sub ObjectPlayerInteraction
192
if Object.Quality == GOOD_QUALITY
193
if Object.State < TAGATAGA_SUBMERGE
194
#platform: Use_Origins
195
PlayerObjectCollision(C_ENEMY, -16, -16, 16, 16)
196
#endplatform
197
#platform: Use_Standalone
198
PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)
199
#endplatform
200
if CheckResult == true
201
CallFunction(Player_BadnikBreak)
202
end if
203
end if
204
else
205
if Object.State < TAGATAGA_TURN_3
206
#platform: Use_Origins
207
PlayerObjectCollision(C_ENEMY, -16, -16, 16, 16)
208
#endplatform
209
#platform: Use_Standalone
210
PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)
211
#endplatform
212
if CheckResult == true
213
CallFunction(Player_BadnikBreak)
214
end if
215
end if
216
end if
217
end sub
218
219
220
sub ObjectDraw
221
if Object.Quality == GOOD_QUALITY
222
switch Object.State
223
case TAGATAGA_SET_LAUNCH_SPEED
224
case TAGATAGA_EMERGE
225
DrawSprite(0)
226
break
227
228
case TAGATAGA_MOVE_PINCH_1
229
TempValue0 = Object.Timer
230
TempValue0 &= 15
231
if TempValue0 < 8
232
DrawSprite(0)
233
else
234
DrawSprite(1)
235
end if
236
break
237
238
case TAGATAGA_TURN_1
239
DrawSprite(2)
240
break
241
242
case TAGATAGA_TURN_2
243
DrawSprite(3)
244
break
245
246
case TAGATAGA_TURN_3
247
DrawSprite(4)
248
break
249
250
case TAGATAGA_MOVE_PINCH_2
251
TempValue0 = Object.Timer
252
TempValue0 &= 15
253
if TempValue0 < 8
254
DrawSprite(4)
255
else
256
DrawSprite(5)
257
end if
258
break
259
260
end switch
261
else
262
switch Object.State
263
case TAGATAGA_SET_LAUNCH_SPEED
264
case TAGATAGA_EMERGE
265
DrawSprite(6)
266
break
267
268
case TAGATAGA_MOVE_PINCH_1
269
DrawSprite(7)
270
break
271
272
case TAGATAGA_TURN_1
273
DrawSprite(8)
274
break
275
276
case TAGATAGA_TURN_2
277
DrawSprite(9)
278
break
279
280
end switch
281
end if
282
end sub
283
284
285
sub ObjectStartup
286
LoadSpriteSheet("R1/Objects.gif")
287
288
// Good TagaTaga
289
SpriteFrame(-16, -22, 32, 44, 223, 154) // #0 - TagaTaga emerge Frame 0
290
SpriteFrame(-16, -22, 32, 44, 223, 199) // #1 - TagaTaga emerge Frame 1
291
SpriteFrame(-16, -16, 32, 32, 35, 109) // #2 - TagaTaga turning Frame 0
292
SpriteFrame(-16, -16, 32, 32, 68, 109) // #3 - TagaTaga turning Frame 1
293
SpriteFrame(-16, -22, 32, 44, 1, 101) // #4 - TagaTaga submerge Frame 0
294
SpriteFrame(-16, -22, 32, 44, 1, 146) // #5 - TagaTaga submerge Frame 1
295
296
// Bad TagaTaga
297
SpriteFrame(-16, -22, 32, 44, 223, 154) // #6 - TagaTaga emerge Frame 0
298
SpriteFrame(-16, -16, 32, 32, 35, 109) // #7 - TagaTaga turning Frame 0
299
SpriteFrame(-16, -16, 32, 32, 35, 142) // #8 - TagaTaga turning Frame 1
300
SpriteFrame(-16, -22, 32, 44, 1, 191) // #9 - TagaTaga submerge Frame 0
301
302
// Used to be below LoadSpriteSheet, moved here for consistency
303
ArrayPos0 = 32
304
while ArrayPos0 < 1056
305
if Object[ArrayPos0].Type == TypeName[TagaTaga]
306
Object[ArrayPos0].YOriginPos = Object[ArrayPos0].YPos
307
end if
308
ArrayPos0++
309
loop
310
end sub
311
312
313
// ========================
314
// Editor Subs
315
// ========================
316
317
sub RSDKEdit
318
if Editor.ReturnVariable == true
319
switch Editor.VariableID
320
case EDIT_VAR_PROPVAL // Property Value
321
CheckResult = Object.PropertyValue
322
CheckResult &= 1
323
break
324
case 0 // type
325
CheckResult = Object.PropertyValue
326
CheckResult &= 1
327
break
328
end switch
329
else
330
switch Editor.VariableID
331
case EDIT_VAR_PROPVAL // Property Value
332
Object.PropertyValue = Editor.VariableValue
333
Object.PropertyValue &= 1
334
break
335
case 0 // type
336
Object.PropertyValue = Editor.VariableValue
337
Object.PropertyValue &= 1
338
break
339
end switch
340
end if
341
end sub
342
343
344
sub RSDKDraw
345
DrawSprite(Object.PropertyValue)
346
end sub
347
348
349
sub RSDKLoad
350
LoadSpriteSheet("R1/Objects.gif")
351
352
// Good TagaTaga
353
SpriteFrame(-16, -22, 32, 44, 223, 154) // #0 - TagaTaga emerge
354
// Bad TagaTaga
355
SpriteFrame(-16, -22, 32, 44, 223, 154) // #1 - TagaTaga emerge
356
357
AddEditorVariable("condition")
358
SetActiveVariable("condition")
359
AddEnumVariable("Good Quality", GOOD_QUALITY)
360
AddEnumVariable("Bad Quality", BAD_QUALITY)
361
end sub
362
363