Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Mission/Boss_Foot2.txt
1319 views
1
//-----------------Sonic CD Boss Foot 2 Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
//---------Used on Mission "M099 - Eggman: Speed Up"----------//
5
6
// Aliases
7
#alias Object.Value0 : Object.LegsEntity
8
#alias Object.Value1 : Object.BodyEntity
9
#alias Object.Value2 : Object.XOffSet
10
#alias Object.Value4 : Object.LegSide
11
#alias Object.Value5 : Object.YOffSet
12
#alias Object.Value6 : Object.XVelocity
13
#alias Object.Value7 : Object.YVelocity
14
15
// Leg Joint Aliases
16
#alias Object.XPos : LegJoint.XPos
17
#alias Object.YPos : LegJoint.YPos
18
#alias Object.Value0 : LegJoint.BodyEntity
19
#alias Object.Value4 : LegJoint.LegJointSide
20
21
#alias Object.Value5 : LegJointR.YOffSet
22
#alias Object.Value1 : LegJointR.LegREntity
23
24
// Legs Aliases
25
#alias Object.XPos : Legs.XPos
26
#alias Object.YPos : Legs.YPos
27
#alias Object.Value0 : Legs.LegJointEntity
28
#alias Object.Value4 : Legs.LegSide
29
30
#alias Object.Value1 : LegR.FootREntity
31
32
// Body Aliases
33
#alias Object.XPos : Body.XPos
34
#alias Object.YPos : Body.YPos
35
#alias Object.Value0 : Body.FaceEntity
36
#alias Object.Value1 : Body.LegJointREntity
37
38
// Face Aliases
39
#alias Object.XPos : Face.XPos
40
#alias Object.YPos : Face.YPos
41
#alias Object.Animation : Face.Animation
42
#alias Object.Direction : Face.FaceTimer
43
44
// Foot Aliases
45
#alias Object.XPos : FootR.XPos
46
#alias Object.YPos : FootR.YPos
47
48
// Player Aliases
49
#alias Player.Value4 : Player.InvincibleTimer
50
51
// States
52
#alias 0 : BOSSFOOT2_SETUP
53
#alias 1 : BOSSFOOT2_STEP
54
#alias 2 : BOSSFOOT2_HANDLE_STEP
55
#alias 3 : BOSSFOOT2_STEP_OPPOSITE
56
#alias 4 : BOSSFOOT2_HANDLE_STEP_OPPOSITE
57
#alias 5 : BOSSFOOT2_LANDING
58
#alias 6 : BOSSFOOT2_DESTROYED
59
60
// Eggman Animations
61
#alias 1 : EGGANI_LAUGH
62
63
// Collision Sides
64
#alias 0 : CSIDE_FLOOR
65
66
// Priority
67
#alias 0 : PRIORITY_BOUNDS
68
69
// Stage SFX
70
#alias 0 : SFX_S_MECHSTEP
71
72
// Function declarations
73
#function BossFoot2_HandleMovement
74
#function BossFoot2_StepEarthQuake
75
#function BossFoot2_SaveFootPosition
76
#function BossFoot2_CheckStepHeight
77
#function BossFoot2_Unused
78
79
function BossFoot2_HandleMovement
80
ArrayPos0 = Object.LegsEntity
81
82
Object.XPos = Legs[ArrayPos0].XPos
83
Object.XPos -= 0xB0000
84
Object.XPos += Object.XVelocity
85
86
Object.YPos = Legs[ArrayPos0].YPos
87
Object.YPos += 0xE0000
88
Object.YPos += Object.YVelocity
89
end function
90
91
92
function BossFoot2_StepEarthQuake
93
SetBit(Object.LegSide, 4, 1)
94
95
ArrayPos0 = Object.LegsEntity
96
SetBit(Legs[ArrayPos0].LegSide, 4, 1)
97
98
ArrayPos1 = Legs[ArrayPos0].LegJointEntity
99
SetBit(LegJoint[ArrayPos1].LegJointSide, 4, 1)
100
101
Screen.ShakeY = 4
102
103
ArrayPos0 = Object.BodyEntity
104
ArrayPos0++
105
if LegJointR[ArrayPos0].YOffSet > 2
106
ArrayPos0--
107
Body[ArrayPos0].YPos -= 0x18000
108
109
ArrayPos0--
110
Face[ArrayPos0].YPos -= 0x18000
111
end if
112
113
PlayStageSfx(SFX_S_MECHSTEP, false)
114
end function
115
116
117
function BossFoot2_SaveFootPosition
118
GetBit(TempValue0, Object.LegSide, 4)
119
if TempValue0 == false
120
CallFunction(BossFoot2_HandleMovement)
121
else
122
GetBit(TempValue0, Object.LegSide, 5)
123
if TempValue0 == true
124
TempValue6 = Object.XOffSet
125
TempValue7 = Object.YOffSet
126
if Object.State != BOSSFOOT2_STEP_OPPOSITE
127
FlipSign(TempValue6)
128
FlipSign(TempValue7)
129
end if
130
131
ArrayPos0 = Object.LegsEntity
132
Legs[ArrayPos0].XPos -= TempValue6
133
Legs[ArrayPos0].YPos += TempValue7
134
135
ArrayPos1 = Legs[ArrayPos0].LegJointEntity
136
LegJoint[ArrayPos1].XPos -= TempValue6
137
LegJoint[ArrayPos1].YPos += TempValue7
138
139
ArrayPos0 = LegJoint[ArrayPos1].BodyEntity
140
Body[ArrayPos0].XPos -= TempValue6
141
Body[ArrayPos0].YPos += TempValue7
142
143
ArrayPos1 = Body[ArrayPos0].FaceEntity
144
Face[ArrayPos1].XPos -= TempValue6
145
Face[ArrayPos1].YPos += TempValue7
146
end if
147
end if
148
end function
149
150
151
function BossFoot2_Unused
152
TempValue0 = Object.YPos
153
ObjectTileCollision(CSIDE_FLOOR, 0, 20, 0)
154
if CheckResult == true
155
GetBit(TempValue0, Object.LegSide, 5)
156
if TempValue0 == true
157
TempValue0 -= Object.YPos
158
159
ArrayPos0 = Object.LegsEntity
160
Legs[ArrayPos0].YPos -= TempValue0
161
162
ArrayPos1 = Legs[ArrayPos0].LegJointEntity
163
LegJoint[ArrayPos1].YPos -= TempValue0
164
165
ArrayPos0 = LegJoint[ArrayPos1].BodyEntity
166
Body[ArrayPos1].YPos -= TempValue0
167
168
ArrayPos1 = Body[ArrayPos0].FaceEntity
169
Face[ArrayPos1].YPos -= TempValue0
170
end if
171
end if
172
end function
173
174
// Probably made to be make sure the boss doesn't glitch with the extended walking area
175
function BossFoot2_CheckStepHeight
176
CheckEqual(Object.iYPos, 436)
177
TempValue0 = CheckResult
178
CheckGreater(Object.iYPos, 436)
179
CheckResult |= TempValue0
180
if CheckResult == true
181
Object.iYPos = 436
182
ArrayPos0 = Object.LegsEntity
183
Object.YVelocity = Object.YPos
184
Object.YVelocity -= Legs[ArrayPos0].YPos
185
Object.YVelocity -= 0xE0000
186
end if
187
end function
188
189
190
sub ObjectMain
191
switch Object.State
192
case BOSSFOOT2_SETUP
193
TempValue0 = 0x4000
194
TempValue0 *= Object.PropertyValue // Set off
195
TempValue0 /= 10
196
197
Object.XOffSet = TempValue0
198
Object.YOffSet = TempValue0
199
Object.YOffSet <<= 1
200
201
Object.XVelocity = -0x80000
202
Object.YVelocity = 0x100000
203
204
SetBit(Object.LegSide, 0, 1)
205
CallFunction(BossFoot2_HandleMovement)
206
Object.State=BOSSFOOT2_HANDLE_STEP
207
break
208
209
case BOSSFOOT2_STEP
210
Object.XVelocity -= Object.XOffSet
211
Object.YVelocity += Object.YOffSet
212
213
TempValue1 = true
214
GetBit(TempValue0, Object.LegSide, 4)
215
CheckResult = TempValue0
216
GetBit(TempValue0, Object.LegSide, 7)
217
CheckResult &= TempValue0
218
219
if CheckResult == true
220
221
if Object.YVelocity >= 0xC0000
222
SetBit(Object.LegSide, 0, 1)
223
Object.State = BOSSFOOT2_HANDLE_STEP
224
TempValue1 = false
225
end if
226
227
else
228
229
if Object.YVelocity >= 0x100000
230
SetBit(Object.LegSide, 0, 1)
231
Object.State = BOSSFOOT2_HANDLE_STEP
232
TempValue1 = false
233
end if
234
235
end if
236
237
if TempValue1 == true
238
CallFunction(BossFoot2_SaveFootPosition)
239
ObjectTileCollision(CSIDE_FLOOR, 0, 20, 0)
240
TempValue2 = CheckResult
241
CallFunction(BossFoot2_CheckStepHeight)
242
TempValue2 |= CheckResult
243
if TempValue2 == true
244
CallFunction(BossFoot2_StepEarthQuake)
245
end if
246
end if
247
break
248
249
case BOSSFOOT2_HANDLE_STEP
250
GetBit(TempValue0, Object.LegSide, 4)
251
if TempValue0 == false
252
CallFunction(BossFoot2_HandleMovement)
253
254
ObjectTileCollision(CSIDE_FLOOR, 0, 20, 0)
255
TempValue2 = CheckResult
256
CallFunction(BossFoot2_CheckStepHeight)
257
TempValue2 |= CheckResult
258
if TempValue2 == true
259
CallFunction(BossFoot2_StepEarthQuake)
260
end if
261
end if
262
break
263
264
case BOSSFOOT2_STEP_OPPOSITE
265
Object.XVelocity += Object.XOffSet
266
Object.YVelocity -= Object.YOffSet
267
268
if Object.YVelocity <= 0
269
Object.XVelocity = 0
270
Object.YVelocity = 0
271
SetBit(Object.LegSide, 0, 1)
272
Object.State = BOSSFOOT2_HANDLE_STEP_OPPOSITE
273
end if
274
CallFunction(BossFoot2_SaveFootPosition)
275
break
276
277
case BOSSFOOT2_HANDLE_STEP_OPPOSITE
278
CallFunction(BossFoot2_HandleMovement)
279
break
280
281
case BOSSFOOT2_LANDING
282
ArrayPos0 = Object.BodyEntity
283
ArrayPos1 = Body[ArrayPos0].LegJointREntity
284
285
ArrayPos0 = LegJointR[ArrayPos1].LegREntity
286
ArrayPos1 = LegR[ArrayPos0].FootREntity
287
288
Object.XPos = FootR[ArrayPos1].XPos
289
Object.XPos -= 0xA0000
290
Object.YPos = FootR[ArrayPos1].YPos
291
break
292
case BOSSFOOT2_DESTROYED
293
GetBit(TempValue0, Object.LegSide, 4)
294
if TempValue0 == false
295
Object.XOffSet -= 0x660
296
else
297
Object.XOffSet += 0x660
298
end if
299
Object.YOffSet += 0x1660
300
301
Object.XPos += Object.XOffSet
302
Object.YPos += Object.YOffSet
303
if Object.OutOfBounds == true
304
Object.Type = TypeName[Blank Object]
305
Object.Priority = PRIORITY_BOUNDS
306
end if
307
break
308
309
end switch
310
end sub
311
312
313
sub ObjectPlayerInteraction
314
if Object.State < BOSSFOOT2_DESTROYED
315
if Player.InvincibleTimer == 0
316
PlayerObjectCollision(C_TOUCH, -28, -20, 26, 20)
317
if CheckResult == true
318
319
ArrayPos0 = Object.LegsEntity
320
ArrayPos1 = Legs[ArrayPos0].LegJointEntity
321
ArrayPos0 = LegJoint[ArrayPos1].BodyEntity
322
ArrayPos1 = Body[ArrayPos0].FaceEntity
323
324
Face[ArrayPos1].Animation = EGGANI_LAUGH
325
Face[ArrayPos1].FaceTimer = 180
326
327
Player.State = Player_State_GotHit
328
if Player.XPos > Object.XPos
329
Player.Speed = 0x20000
330
else
331
Player.Speed = -0x20000
332
end if
333
end if
334
end if
335
end if
336
end sub
337
338
339
sub ObjectDraw
340
DrawSprite(0)
341
end sub
342
343
344
sub ObjectStartup
345
LoadSpriteSheet("R1/Objects3.gif")
346
347
SpriteFrame(-32, -20, 58, 40, 1, 66) // #0 - EGG-HVC-001 Foot
348
end sub
349
350
351
// ========================
352
// Editor Subs
353
// ========================
354
355
sub RSDKDraw
356
DrawSprite(0)
357
end sub
358
359
360
sub RSDKLoad
361
LoadSpriteSheet("R1/Objects3.gif")
362
SpriteFrame(-32, -20, 58, 40, 1, 66) // #0 - EGG-HVC-001 Foot
363
364
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
365
end sub
366
367