Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R8/BigBomb.txt
1319 views
1
//----------------Sonic CD Big Bomb 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.Value3 : Object.LeftBound
8
#alias Object.Value4 : Object.RightBound
9
#alias Object.Value5 : Object.SavedYPos
10
11
// Big Bomb Fireball aliases
12
#alias Object.Value1 : BBFireBall.XVelocity
13
#alias Object.Value2 : BBFireBall.YVelocity
14
15
// State
16
#alias 0 : BIGBOMB_SETUP
17
#alias 1 : BIGBOMB_MOVE_LEFT
18
#alias 2 : BIGBOMB_MOVE_RIGHT
19
#alias 3 : BIGBOMB_WAIT_PLAYER
20
#alias 4 : BIGBOMB_PREPARE_FUSE
21
#alias 5 : BIGBOMB_START_FUSE
22
#alias 6 : BIGBOMB_EXPLODE
23
24
// Animations
25
#alias 0 : BOMBANI_IDLE
26
#alias 1 : BOMBANI_WALKING
27
#alias 2 : BOMBANI_SPOTTED
28
#alias 3 : BOMBANI_EXPLOSION
29
30
// Stage SFX
31
#alias 5 : SFX_S_BOMB
32
33
// Collision Sides
34
#alias 0 : CSIDE_FLOOR
35
36
// Priority
37
#alias 1 : PRIORITY_ACTIVE
38
39
// Collision Planes
40
#alias 0 : COLLISION_PLANE_A
41
42
// Property Values
43
#alias 0 : MOVING_BOMB
44
#alias 1 : STATIC_BOMB
45
46
47
sub ObjectMain
48
switch Object.State
49
case BIGBOMB_SETUP
50
Object.Priority = PRIORITY_ACTIVE
51
ObjectTileCollision(CSIDE_FLOOR, 0, 27, 0)
52
if CheckResult == true
53
if Object.PropertyValue == STATIC_BOMB
54
Object.State = BIGBOMB_WAIT_PLAYER
55
56
Object.Direction = FACING_LEFT
57
58
Object.Animation = BOMBANI_IDLE
59
else
60
Object.State = BIGBOMB_MOVE_LEFT
61
Object.Animation = BOMBANI_WALKING
62
63
Object.LeftBound = Object.XPos
64
Object.LeftBound -= 0xC0000
65
66
Object.RightBound = Object.XPos
67
Object.RightBound += 0xC0000
68
end if
69
else
70
Object.YPos += 0x10000
71
end if
72
break
73
74
case BIGBOMB_MOVE_LEFT
75
Object.XPos -= 0xA000
76
if Object.XPos < Object.LeftBound
77
Object.Direction = FACING_LEFT
78
Object.State = BIGBOMB_MOVE_RIGHT
79
end if
80
81
ObjectTileGrip(CSIDE_FLOOR, 0, 27, 0)
82
PlayerObjectCollision(C_TOUCH, -96, -128, 96, 27)
83
if CheckResult == true
84
Object.State = BIGBOMB_START_FUSE
85
Object.Animation = BOMBANI_SPOTTED
86
end if
87
break
88
89
case BIGBOMB_MOVE_RIGHT
90
Object.XPos += 0xA000
91
if Object.XPos > Object.RightBound
92
Object.Direction = FACING_RIGHT
93
Object.State = BIGBOMB_MOVE_LEFT
94
end if
95
96
ObjectTileGrip(CSIDE_FLOOR, 0, 27, 0)
97
PlayerObjectCollision(C_TOUCH, -96, -128, 96, 27)
98
if CheckResult == true
99
Object.State = BIGBOMB_START_FUSE
100
Object.Animation = BOMBANI_SPOTTED
101
end if
102
break
103
104
case BIGBOMB_WAIT_PLAYER
105
PlayerObjectCollision(C_TOUCH, -96, -128, 96, 27)
106
if CheckResult == true
107
Object.Animation = BOMBANI_WALKING
108
Object.State++
109
end if
110
break
111
112
case BIGBOMB_PREPARE_FUSE
113
Object.XPos += 0x20000
114
ObjectTileGrip(CSIDE_FLOOR, 24, 27, 0)
115
if CheckResult == false
116
Object.State = BIGBOMB_START_FUSE
117
Object.Animation = BOMBANI_SPOTTED
118
end if
119
break
120
121
case BIGBOMB_START_FUSE
122
if Object.Timer < 30
123
Object.Timer++
124
else
125
Object.Timer = 0
126
Object.Animation = BOMBANI_EXPLOSION
127
Object.AnimationTimer = 0
128
Object.SavedYPos = Object.YPos
129
Object.State++
130
end if
131
break
132
133
case BIGBOMB_EXPLODE
134
if Object.Timer < 120
135
Object.Timer++
136
Object.SavedYPos += 0x4000
137
else
138
CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)
139
BBFireBall[TempObjectPos].XVelocity = -0x30000
140
BBFireBall[TempObjectPos].YVelocity = -0x62000
141
142
CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)
143
BBFireBall[TempObjectPos].XVelocity = -0x20000
144
BBFireBall[TempObjectPos].YVelocity = -0x52000
145
146
CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)
147
BBFireBall[TempObjectPos].XVelocity = -0x10000
148
BBFireBall[TempObjectPos].YVelocity = -0x42000
149
150
CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)
151
BBFireBall[TempObjectPos].XVelocity = 0
152
BBFireBall[TempObjectPos].YVelocity = -0x32000
153
154
CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)
155
BBFireBall[TempObjectPos].XVelocity = 0x10000
156
BBFireBall[TempObjectPos].YVelocity = -0x42000
157
158
CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)
159
BBFireBall[TempObjectPos].XVelocity = 0x20000
160
BBFireBall[TempObjectPos].YVelocity = -0x52000
161
162
CreateTempObject(TypeName[BB Fireball], 0, Object.XPos, Object.YPos)
163
BBFireBall[TempObjectPos].XVelocity = 0x30000
164
BBFireBall[TempObjectPos].YVelocity = -0x62000
165
166
CreateTempObject(TypeName[Explosion], 0, Object.XPos, Object.YPos)
167
ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)
168
169
PlayStageSfx(SFX_S_BOMB, false)
170
171
#platform: Use_Haptics
172
HapticEffect(77, 0, 0, 0)
173
#endplatform
174
175
end if
176
break
177
end switch
178
end sub
179
180
181
sub ObjectPlayerInteraction
182
if Player.CollisionPlane == COLLISION_PLANE_A
183
PlayerObjectCollision(C_TOUCH, -18, -18, 18, 18)
184
if CheckResult == true
185
CallFunction(Player_Hit)
186
end if
187
end if
188
end sub
189
190
191
sub ObjectDraw
192
switch Object.Animation
193
case BOMBANI_IDLE
194
DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)
195
DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)
196
DrawSpriteFX(2, FX_FLIP, Object.XPos, Object.YPos)
197
break
198
199
case BOMBANI_WALKING
200
TempValue0 = Object.AnimationTimer
201
TempValue0 /= 20
202
TempValue0 *= 3
203
TempValue0 += 3
204
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
205
TempValue0++
206
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
207
TempValue0++
208
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
209
Object.AnimationTimer++
210
Object.AnimationTimer %= 80
211
break
212
213
case BOMBANI_SPOTTED
214
TempValue0 = Object.AnimationTimer
215
TempValue0 /= 20
216
TempValue0 *= 3
217
TempValue0 += 3
218
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
219
TempValue0++
220
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
221
TempValue0++
222
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
223
break
224
225
case BOMBANI_EXPLOSION
226
TempValue0 = Object.AnimationTimer
227
TempValue0 /= 3
228
TempValue0 += 15
229
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.SavedYPos)
230
Object.AnimationTimer++
231
Object.AnimationTimer %= 6
232
DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)
233
DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)
234
break
235
end switch
236
end sub
237
238
239
sub ObjectStartup
240
LoadSpriteSheet("R8/Objects2.gif")
241
242
// Walking frames
243
SpriteFrame(-20, -20, 40, 40, 67, 82) // #0 - Big Bomb body frame 0
244
SpriteFrame(-27, 3, 48, 24, 109, 35) // #1 - Big Bomb legs frame 0
245
SpriteFrame(-4, -44, 8, 24, 176, 18) // #2 - Big Bomb fuse frame 0
246
247
SpriteFrame(-20, -22, 40, 40, 67, 82) // #3 - Big Bomb body frame 1
248
SpriteFrame(-12, 3, 32, 24, 150, 85) // #4 - Big Bomb legs frame 1
249
SpriteFrame(-4, -46, 8, 24, 176, 18) // #5 - Big Bomb fuse frame 1
250
251
SpriteFrame(-20, -20, 40, 40, 67, 82) // #6 - Big Bomb body frame 2
252
SpriteFrame(-27, 3, 48, 24, 109, 35) // #7 - Big Bomb legs frame 2
253
SpriteFrame(-4, -44, 8, 24, 176, 18) // #8 - Big Bomb fuse frame 2
254
255
SpriteFrame(-20, -22, 40, 40, 67, 82) // #9 - Big Bomb body frame 3
256
SpriteFrame(-20, 3, 48, 24, 109, 60) // #10 - Big Bomb legs frame 3
257
SpriteFrame(-4, -46, 8, 24, 176, 18) // #11 - Big Bomb fuse frame 3
258
259
// Explosion charge
260
SpriteFrame(-20, -20, 40, 40, 67, 82) // #12 - Big Bomb body frame 4
261
SpriteFrame(-20, 3, 40, 24, 109, 85) // #13 - Big Bomb legs frame 4
262
263
SpriteFrame(-4, -44, 8, 24, 176, 18) // #14 - Big Bomb active fuse frame 0
264
SpriteFrame(-4, -44, 8, 24, 158, 18) // #15 - Big Bomb active fuse frame 1
265
SpriteFrame(-4, -44, 8, 24, 167, 18) // #16 - Big Bomb active fuse frame 2
266
267
ArrayPos0 = 32
268
while ArrayPos0 < 1056
269
if Object[ArrayPos0].Type == TypeName[BigBomb] // um....?
270
// Allan please add missing code
271
end if
272
ArrayPos0++
273
loop
274
end sub
275
276
277
// ========================
278
// Editor Subs
279
// ========================
280
281
sub RSDKEdit
282
if Editor.ReturnVariable == true
283
switch Editor.VariableID
284
case EDIT_VAR_PROPVAL // Property Value
285
case 0 // Type
286
CheckResult = Object.PropertyValue
287
CheckResult &= 1
288
break
289
end switch
290
else
291
switch Editor.VariableID
292
case EDIT_VAR_PROPVAL // Property Value
293
case 0 // Type
294
Object.PropertyValue = Editor.VariableValue
295
Object.PropertyValue &= 1
296
break
297
end switch
298
end if
299
end sub
300
301
302
sub RSDKDraw
303
DrawSprite(0)
304
DrawSprite(1)
305
DrawSprite(2)
306
end sub
307
308
309
sub RSDKLoad
310
LoadSpriteSheet("R8/Objects2.gif")
311
312
// Walking frames
313
SpriteFrame(-20, -20, 40, 40, 67, 82) // #0 - Big Bomb body frame 0
314
SpriteFrame(-27, 3, 48, 24, 109, 35) // #1 - Big Bomb legs frame 0
315
SpriteFrame(-4, -44, 8, 24, 176, 18) // #2 - Big Bomb fuse frame 0
316
317
AddEditorVariable("Type")
318
SetActiveVariable("Type")
319
AddEnumVariable("Moving Bomb", 0)
320
AddEnumVariable("Static Bomb", 1)
321
end sub
322
323