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