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