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