Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/Boss_Body.txt
1319 views
1
//----------------Sonic CD Boss Body Script-------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.FaceEntity
7
#alias Object.Value1 : Object.LegJointREntity
8
#alias Object.Value2 : Object.LegJointLEntity
9
#alias Object.Value3 : Object.InFloor
10
// Value4 is used to check key events, forward/backward movement and currently active leg
11
#alias Object.Value4 : Object.BitHolder
12
#alias Object.Value5 : Object.ChargeStart
13
#alias Object.Value6 : Object.ChargeDistance
14
#alias Object.Value7 : Object.ChargeXPos
15
16
// General Aliases
17
#alias Object.State : BossPart.State
18
#alias Object.Value4 : BossPart.Charging
19
#alias Object.Value2 : BossPart.XOffSet
20
#alias Object.Value5 : BossPart.YOffSet
21
22
// Face Aliases
23
#alias Object[-1].YPos : Face.YPos
24
#alias Object.Value2 : Face.ShoulderEntity
25
26
// Shoulder Aliases
27
#alias Object.Value1 : Shoulder.ArmJointLEntity
28
#alias Object.Value2 : Shoulder.ArmJointREntity
29
30
// Leg Joint Aliases
31
#alias Object.Value1 : LegJointR.LegREntity
32
#alias Object.Value1 : LegJointL.LegLEntity
33
34
#alias Object.Value1 : LegJoint.LegEntity
35
#alias Object.Value4 : LegJoint.LegSide
36
37
// Leg Aliases
38
#alias Object.Value1 : LegR.FootREntity
39
#alias Object.Value1 : LegL.FootLEntity
40
41
#alias Object.Value1 : Leg.FootEntity
42
#alias Object.Value4 : Leg.LegSide
43
44
// Foot Aliases
45
#alias Object.Value4 : Foot.LegSide
46
47
// Arm Joint Aliases
48
#alias Object.Value1 : ArmJointR.ArmREntity
49
#alias Object.Value1 : ArmJointL.ArmLEntity
50
51
// Arm Aliases
52
#alias Object.Frame : Arm.Frame
53
54
// States
55
#alias 0 : BOSSBODY_SETUP
56
#alias 1 : BOSSBODY_DESCEND
57
#alias 2 : BOSSBODY_LANDING
58
#alias 3 : BOSSBODY_FIRST_STEP
59
#alias 4 : BOSSBODY_MOVE_FORWARD
60
#alias 5 : BOSSBODY_MOVE_BACKWARDS
61
#alias 6 : BOSSBODY_PREPARE_CHARGING
62
#alias 7 : BOSSBODY_DESTROYED
63
#alias 8 : BOSSBODY_STOP_CHARGE
64
65
// Boss Foot States
66
#alias 1 : BOSSFOOT_STEP
67
#alias 2 : BOSSFOOT_HANDLE_STEP
68
#alias 5 : BOSSFOOT_LANDING
69
70
// Boss Leg States
71
#alias 1 : BOSSLEG_LANDING
72
#alias 2 : BOSSLEG_L_MIMIC_R
73
#alias 3 : BOSSLEG_MOVE
74
#alias 4 : BOSSLEG_MOVE_OPPOSITE
75
#alias 5 : BOSSLEG_MOVE_C
76
#alias 6 : BOSSLEG_MOVE_OPPOSITE_C
77
78
// Boss Leg Joint States
79
#alias 1 : BOSSLEGJOINT_STEP_START
80
#alias 4 : BOSSLEGJOINT_WAIT_LEG
81
#alias 5 : BOSSLEGJOINT_LANDING
82
#alias 6 : BOSSLEGJOINT_DESCEND
83
#alias 7 : BOSSLEGJOINT_STAND
84
#alias 8 : BOSSLEGJOINT_MIMIC_RIGHT
85
#alias 9 : BOSSLEGJOINT_STEP_START_BW
86
#alias 11 : BOSSLEGJOINT_WAIT_LEG_BW
87
88
// Boss Arm States
89
#alias 3 : BOSSARM_MOVE_TO_FRONT
90
#alias 4 : BOSSARM_MOVE_TO_BACK
91
#alias 5 : BOSSARM_START_CHARGE
92
93
// Boss Arm Joint
94
#alias 1 : BOSSARMJOINT_REPOSITION_F
95
#alias 3 : BOSSARMJOINT_REPOSITION_B
96
#alias 5 : BOSSARMJOINT_DESTROYED
97
98
// Object.BitHolder SetBit Values
99
// Bit 0 - Check of key events for BossFace (landing, start of charge, first move, etc)
100
// Bit 1 - Forward or Backward movement (Forwards 0, Backwards 1)
101
// Bit 6 - Which leg moves (Left 0, Right 1)
102
103
// Bit 0 Aliases
104
#alias 0 : KEY_EVENT_FALSE
105
#alias 1 : KEY_EVENT_TRUE
106
107
// Bit 1 Aliases
108
#alias 0 : MOVE_FORWARD
109
#alias 1 : MOVE_BACKWARDS
110
111
// Bit 6 Aliases
112
#alias 0 : LEFT_LEG_ACTIVE
113
#alias 1 : RIGHT_LEG_ACTIVE
114
115
// Collision Sides
116
#alias 0 : CSIDE_FLOOR
117
118
// Function declarations
119
#function BossBody_RestoreNormalSpeed
120
#function BossBody_SetLegPosSaveTrue
121
#function BossBody_SetLegPosSaveFalse
122
#function BossBody_SwitchLeg
123
#function BossBody_SwitchLeg_Revert
124
#function BossBody_MoveRArmToFront
125
#function BossBody_MoveLArmToFront
126
#function BossBody_HandleCharge
127
#function BossBody_SetArmsToCharge
128
129
130
function BossBody_RestoreNormalSpeed
131
ArrayPos0 = Object.LegJointREntity
132
// Leg Joint R
133
BossPart[ArrayPos0].YOffSet = 2
134
135
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
136
// Leg R
137
BossPart[ArrayPos1].XOffSet = 0x8000
138
BossPart[ArrayPos1].YOffSet = 0x4000
139
140
ArrayPos0 = LegR[ArrayPos1].FootREntity
141
// Foot R
142
BossPart[ArrayPos0].XOffSet = 0x4000
143
BossPart[ArrayPos0].YOffSet = 0x8000
144
145
ArrayPos0 = Object.LegJointLEntity
146
// Leg Joint L
147
BossPart[ArrayPos0].YOffSet = 2
148
149
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
150
// Leg L
151
BossPart[ArrayPos1].XOffSet = 0x8000
152
BossPart[ArrayPos1].YOffSet = 0x4000
153
154
ArrayPos0 = LegL[ArrayPos1].FootLEntity
155
// Foot L
156
BossPart[ArrayPos0].XOffSet = 0x4000
157
BossPart[ArrayPos0].YOffSet = 0x8000
158
159
ArrayPos0 = Object.FaceEntity
160
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
161
ArrayPos0 = Shoulder[ArrayPos1].ArmJointLEntity
162
SetBit(BossPart[ArrayPos0].Charging, 7, 0) // Left Arm Joing
163
164
ArrayPos1 = ArmJointL[ArrayPos0].ArmLEntity
165
SetBit(BossPart[ArrayPos1].Charging, 7, 0) // Left Arm
166
167
ArrayPos0 = Object.FaceEntity
168
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
169
ArrayPos0 = Shoulder[ArrayPos1].ArmJointREntity
170
SetBit(BossPart[ArrayPos0].Charging, 7, 0) // Right Arm Joint
171
172
ArrayPos1 = ArmJointR[ArrayPos0].ArmREntity
173
SetBit(BossPart[ArrayPos1].Charging, 7, 0) // Right Arm
174
end function
175
176
177
function BossBody_SetLegPosSaveTrue
178
SetBit(LegJoint[ArrayPos0].LegSide, 5, 1)
179
180
ArrayPos1 = LegJoint[ArrayPos0].LegEntity
181
SetBit(Leg[ArrayPos1].LegSide, 5, 1)
182
183
ArrayPos0 = Leg[ArrayPos1].FootEntity
184
SetBit(Foot[ArrayPos0].LegSide, 5, 1)
185
end function
186
187
188
function BossBody_SetLegPosSaveFalse
189
SetBit(LegJoint[ArrayPos0].LegSide, 5, 0)
190
191
ArrayPos1 = LegJoint[ArrayPos0].LegEntity
192
SetBit(Leg[ArrayPos1].LegSide, 5, 0)
193
194
ArrayPos0 = Leg[ArrayPos1].FootEntity
195
SetBit(Foot[ArrayPos0].LegSide, 5, 0)
196
end function
197
198
199
function BossBody_SwitchLeg
200
SetBit(LegJoint[ArrayPos0].LegSide, 4, 1)
201
202
ArrayPos1 = LegJoint[ArrayPos0].LegEntity
203
SetBit(Leg[ArrayPos1].LegSide, 4, 1)
204
205
ArrayPos0 = Leg[ArrayPos1].FootEntity
206
SetBit(Foot[ArrayPos0].LegSide, 4, 1)
207
end function
208
209
210
function BossBody_SwitchLeg_Revert
211
SetBit(LegJoint[ArrayPos0].LegSide, 4, 0)
212
213
ArrayPos1 = LegJoint[ArrayPos0].LegEntity
214
SetBit(Leg[ArrayPos1].LegSide, 4, 0)
215
216
ArrayPos0 = Leg[ArrayPos1].FootEntity
217
SetBit(Foot[ArrayPos0].LegSide, 4, 0)
218
end function
219
220
221
// Right arm to front
222
function BossBody_MoveRArmToFront
223
ArrayPos0 = Object.FaceEntity
224
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
225
ArrayPos0 = Shoulder[ArrayPos1].ArmJointREntity
226
if BossPart[ArrayPos0].State < BOSSARMJOINT_DESTROYED
227
BossPart[ArrayPos0].State = BOSSARMJOINT_REPOSITION_B
228
229
ArrayPos1 = ArmJointR[ArrayPos0].ArmREntity
230
BossPart[ArrayPos1].State = BOSSARM_MOVE_TO_FRONT
231
Arm[ArrayPos1].Frame = 0
232
end if
233
234
ArrayPos0 = Object.FaceEntity
235
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
236
ArrayPos0 = Shoulder[ArrayPos1].ArmJointLEntity
237
if BossPart[ArrayPos0].State < BOSSARMJOINT_DESTROYED
238
BossPart[ArrayPos0].State = BOSSARMJOINT_REPOSITION_F
239
240
ArrayPos1 = ArmJointL[ArrayPos0].ArmLEntity
241
BossPart[ArrayPos1].State = BOSSARM_MOVE_TO_BACK
242
Arm[ArrayPos1].Frame = 0
243
end if
244
end function
245
246
// Left arm to front
247
function BossBody_MoveLArmToFront
248
ArrayPos0 = Object.FaceEntity
249
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
250
ArrayPos0 = Shoulder[ArrayPos1].ArmJointREntity
251
if BossPart[ArrayPos0].State < BOSSARMJOINT_DESTROYED
252
BossPart[ArrayPos0].State = BOSSARMJOINT_REPOSITION_F
253
254
ArrayPos1 = ArmJointR[ArrayPos0].ArmREntity
255
BossPart[ArrayPos1].State = BOSSARM_MOVE_TO_BACK
256
Arm[ArrayPos1].Frame = 0
257
end if
258
259
ArrayPos0 = Object.FaceEntity
260
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
261
ArrayPos0 = Shoulder[ArrayPos1].ArmJointLEntity
262
if BossPart[ArrayPos0].State < BOSSARMJOINT_DESTROYED
263
BossPart[ArrayPos0].State = BOSSARMJOINT_REPOSITION_B
264
265
ArrayPos1 = ArmJointL[ArrayPos0].ArmLEntity
266
BossPart[ArrayPos1].State = BOSSARM_MOVE_TO_FRONT
267
Arm[ArrayPos1].Frame = 0
268
end if
269
end function
270
271
272
function BossBody_HandleCharge
273
ArrayPos0 = Object.LegJointREntity
274
// Leg Joint R
275
BossPart[ArrayPos0].YOffSet = 8
276
277
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
278
// Leg R
279
BossPart[ArrayPos1].XOffSet = 0x10000
280
BossPart[ArrayPos1].YOffSet = 0x8000
281
282
ArrayPos0 = LegR[ArrayPos1].FootREntity
283
// Foot R
284
BossPart[ArrayPos0].XOffSet = 0xC000
285
BossPart[ArrayPos0].YOffSet = 0x18000
286
287
ArrayPos0 = Object.LegJointLEntity
288
// Leg Joint L
289
BossPart[ArrayPos0].YOffSet = 8
290
291
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
292
// Leg L
293
BossPart[ArrayPos1].XOffSet = 0x10000
294
BossPart[ArrayPos1].YOffSet = 0x8000
295
296
ArrayPos0 = LegL[ArrayPos1].FootLEntity
297
// Foot L
298
BossPart[ArrayPos0].XOffSet = 0xC000
299
BossPart[ArrayPos0].YOffSet = 0x18000
300
301
ArrayPos0 = Object.FaceEntity
302
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
303
ArrayPos0 = Shoulder[ArrayPos1].ArmJointLEntity
304
SetBit(BossPart[ArrayPos0].Charging, 7, 1) // Left Arm Joint
305
306
ArrayPos1 = ArmJointL[ArrayPos0].ArmLEntity
307
SetBit(BossPart[ArrayPos1].Charging, 7, 1) // Left Arm
308
309
ArrayPos0 = Object.FaceEntity
310
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
311
ArrayPos0 = Shoulder[ArrayPos1].ArmJointREntity
312
SetBit(BossPart[ArrayPos0].Charging, 7, 1) // Right Arm Joint
313
314
ArrayPos1 = ArmJointR[ArrayPos0].ArmREntity
315
SetBit(BossPart[ArrayPos1].Charging, 7, 1) // Right Arm
316
end function
317
318
319
function BossBody_SetArmsToCharge
320
ArrayPos0 = Object.FaceEntity
321
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
322
ArrayPos0 = Shoulder[ArrayPos1].ArmJointREntity
323
if BossPart[ArrayPos0].State < BOSSARMJOINT_DESTROYED
324
BossPart[ArrayPos0].State = BOSSARMJOINT_REPOSITION_F
325
326
ArrayPos1 = ArmJointR[ArrayPos0].ArmREntity
327
BossPart[ArrayPos1].State = BOSSARM_START_CHARGE
328
Arm[ArrayPos1].Frame = 1
329
end if
330
331
ArrayPos0 = Object.FaceEntity
332
ArrayPos1 = Face[ArrayPos0].ShoulderEntity
333
ArrayPos0 = Shoulder[ArrayPos1].ArmJointLEntity
334
if BossPart[ArrayPos0].State < BOSSARMJOINT_DESTROYED
335
BossPart[ArrayPos0].State = BOSSARMJOINT_REPOSITION_F
336
337
ArrayPos1 = ArmJointL[ArrayPos0].ArmLEntity
338
BossPart[ArrayPos1].State = BOSSARM_START_CHARGE
339
Arm[ArrayPos1].Frame = 1
340
end if
341
end function
342
343
344
sub ObjectMain
345
switch Object.State
346
case BOSSBODY_SETUP
347
CallFunction(BossBody_RestoreNormalSpeed)
348
349
Object.ChargeDistance = Object.XPos
350
Object.ChargeDistance -= 0x7A0000
351
352
Object.ChargeXPos = Object.XPos
353
Object.ChargeXPos -= 0x320000
354
355
Object.State = BOSSBODY_DESCEND
356
break
357
358
case BOSSBODY_DESCEND
359
ArrayPos0 = Object.LegJointLEntity
360
BossPart[ArrayPos0].State = BOSSLEGJOINT_MIMIC_RIGHT
361
362
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
363
BossPart[ArrayPos1].State = BOSSLEG_L_MIMIC_R
364
365
ArrayPos0 = LegL[ArrayPos1].FootLEntity
366
BossPart[ArrayPos0].State = BOSSFOOT_LANDING
367
368
ArrayPos0 = Object.LegJointREntity
369
CallFunction(BossBody_SetLegPosSaveTrue)
370
ArrayPos0 = Object.LegJointREntity
371
GetBit(TempValue0, LegJoint[ArrayPos0].LegSide, 4)
372
if TempValue0 == false
373
Object.YPos += 0x18000
374
ArrayPos0 = Object.FaceEntity
375
Face[ArrayPos0].YPos += 0x18000
376
else
377
SetBit(Object.BitHolder, 0, KEY_EVENT_TRUE)
378
end if
379
break
380
381
case BOSSBODY_LANDING
382
ArrayPos0 = Object.LegJointLEntity
383
SetBit(LegJoint[ArrayPos0].LegSide, 0, 0)
384
385
ArrayPos0 = Object.LegJointREntity
386
GetBit(TempValue0, LegJoint[ArrayPos0].LegSide, 0)
387
if TempValue0 == true
388
389
SetBit(LegJoint[ArrayPos0].LegSide, 0, 0)
390
if BossPart[ArrayPos0].State != BOSSLEGJOINT_DESCEND
391
392
if BossPart[ArrayPos0].State != BOSSLEGJOINT_LANDING
393
BossPart[ArrayPos0].State = BOSSLEGJOINT_STEP_START
394
CallFunction(BossBody_SetLegPosSaveFalse)
395
396
ArrayPos0 = Object.LegJointREntity
397
CallFunction(BossBody_SwitchLeg_Revert)
398
399
ArrayPos0 = Object.LegJointLEntity
400
BossPart[ArrayPos0].State = BOSSLEGJOINT_WAIT_LEG
401
CallFunction(BossBody_SetLegPosSaveFalse)
402
403
ArrayPos0 = Object.LegJointLEntity
404
CallFunction(BossBody_SwitchLeg)
405
406
ArrayPos0 = Object.LegJointLEntity
407
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
408
BossPart[ArrayPos1].State = BOSSLEG_LANDING
409
410
ArrayPos0 = LegL[ArrayPos1].FootLEntity
411
BossPart[ArrayPos0].State = BOSSFOOT_HANDLE_STEP
412
SetBit(Object.BitHolder, 0, KEY_EVENT_TRUE)
413
else
414
BossPart[ArrayPos0].State = BOSSLEGJOINT_STAND
415
end if
416
417
else
418
BossPart[ArrayPos0].State = BOSSLEGJOINT_LANDING
419
end if
420
421
end if
422
break
423
424
case BOSSBODY_FIRST_STEP
425
GetBit(TempValue0, Object.BitHolder, 1)
426
if TempValue0 == MOVE_FORWARD
427
SetBit(Object.BitHolder, 1, MOVE_BACKWARDS)
428
CallFunction(BossBody_MoveRArmToFront)
429
end if
430
431
ArrayPos0 = Object.LegJointREntity
432
GetBit(TempValue0, LegJoint[ArrayPos0].LegSide, 0)
433
if TempValue0 == true
434
435
ArrayPos0 = Object.LegJointLEntity
436
GetBit(TempValue0, LegJoint[ArrayPos0].LegSide, 0)
437
if TempValue0 == true
438
SetBit(Object.BitHolder, 1, MOVE_FORWARD)
439
SetBit(Object.BitHolder, 6, RIGHT_LEG_ACTIVE)
440
SetBit(Object.BitHolder, 0, KEY_EVENT_TRUE)
441
end if
442
443
end if
444
break
445
446
case BOSSBODY_MOVE_FORWARD
447
ArrayPos0 = Object.LegJointREntity
448
GetBit(CheckResult, LegJoint[ArrayPos0].LegSide, 0)
449
ArrayPos0 = Object.LegJointLEntity
450
GetBit(TempValue0, LegJoint[ArrayPos0].LegSide, 0)
451
CheckResult &= TempValue0
452
if CheckResult == true
453
ArrayPos0 = Object.LegJointREntity
454
SetBit(LegJoint[ArrayPos0].LegSide, 0, 0)
455
456
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
457
SetBit(Leg[ArrayPos1].LegSide, 0, 0)
458
459
ArrayPos0 = Object.LegJointLEntity
460
SetBit(LegJoint[ArrayPos0].LegSide, 0, 0)
461
462
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
463
SetBit(Leg[ArrayPos1].LegSide, 0, 0)
464
465
if Object.XPos < Object.ChargeDistance
466
Object.ChargeStart = 1
467
end if
468
469
Object.ChargeStart--
470
if Object.ChargeStart == 0
471
SetBit(Object.BitHolder, 0, KEY_EVENT_TRUE)
472
SetBit(Object.BitHolder, 1, MOVE_FORWARD)
473
else
474
GetBit(TempValue0, Object.BitHolder, 6)
475
if TempValue0 == LEFT_LEG_ACTIVE
476
SetBit(Object.BitHolder, 6, 1)
477
ArrayPos0 = Object.LegJointREntity
478
BossPart[ArrayPos0].State = BOSSLEGJOINT_STEP_START
479
CallFunction(BossBody_SetLegPosSaveFalse)
480
481
ArrayPos0 = Object.LegJointREntity
482
CallFunction(BossBody_SwitchLeg_Revert)
483
484
ArrayPos0 = Object.LegJointREntity
485
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
486
BossPart[ArrayPos1].State = BOSSLEG_MOVE_OPPOSITE
487
488
ArrayPos0 = Object.LegJointLEntity
489
BossPart[ArrayPos0].State = BOSSLEGJOINT_WAIT_LEG
490
CallFunction(BossBody_SetLegPosSaveTrue)
491
492
ArrayPos0 = Object.LegJointLEntity
493
CallFunction(BossBody_SwitchLeg)
494
495
ArrayPos0 = Object.LegJointLEntity
496
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
497
BossPart[ArrayPos1].State = BOSSLEG_MOVE
498
CallFunction(BossBody_MoveRArmToFront)
499
else
500
SetBit(Object.BitHolder, 6, 0)
501
ArrayPos0 = Object.LegJointREntity
502
BossPart[ArrayPos0].State = BOSSLEGJOINT_WAIT_LEG
503
CallFunction(BossBody_SetLegPosSaveTrue)
504
505
ArrayPos0 = Object.LegJointREntity
506
CallFunction(BossBody_SwitchLeg)
507
508
ArrayPos0 = Object.LegJointREntity
509
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
510
BossPart[ArrayPos1].State = BOSSLEG_MOVE
511
512
ArrayPos0 = Object.LegJointLEntity
513
BossPart[ArrayPos0].State = BOSSLEGJOINT_STEP_START
514
CallFunction(BossBody_SetLegPosSaveFalse)
515
516
ArrayPos0 = Object.LegJointLEntity
517
CallFunction(BossBody_SwitchLeg_Revert)
518
519
ArrayPos0 = Object.LegJointLEntity
520
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
521
BossPart[ArrayPos1].State = BOSSLEG_MOVE_OPPOSITE
522
CallFunction(BossBody_MoveLArmToFront)
523
end if
524
end if
525
end if
526
break
527
528
case BOSSBODY_MOVE_BACKWARDS
529
ArrayPos0 = Object.LegJointREntity
530
GetBit(CheckResult, LegJoint[ArrayPos0].LegSide, 0)
531
532
ArrayPos0 = Object.LegJointLEntity
533
GetBit(TempValue0, LegJoint[ArrayPos0].LegSide, 0)
534
535
CheckResult &= TempValue0
536
if CheckResult == true
537
538
GetBit(TempValue0, Object.BitHolder, 1)
539
if TempValue0 == MOVE_FORWARD
540
SetBit(Object.BitHolder, 1, MOVE_BACKWARDS)
541
CallFunction(BossBody_RestoreNormalSpeed)
542
else
543
ArrayPos0 = Object.LegJointREntity
544
SetBit(LegJoint[ArrayPos0].LegSide, 0, 0)
545
546
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
547
SetBit(Leg[ArrayPos1].LegSide, 0, 0)
548
549
ArrayPos0 = Object.LegJointLEntity
550
SetBit(LegJoint[ArrayPos0].LegSide, 0, 0)
551
552
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
553
SetBit(Leg[ArrayPos1].LegSide, 0, 0)
554
555
if Object.XPos >= Object.ChargeXPos
556
Object.ChargeStart = 1
557
end if
558
559
Object.ChargeStart--
560
if Object.ChargeStart == 0
561
SetBit(Object.BitHolder, 1, MOVE_FORWARD)
562
SetBit(Object.BitHolder, 0, KEY_EVENT_TRUE)
563
else
564
GetBit(TempValue0, Object.BitHolder, 6)
565
if TempValue0 == LEFT_LEG_ACTIVE
566
SetBit(Object.BitHolder, 6, RIGHT_LEG_ACTIVE)
567
ArrayPos0 = Object.LegJointREntity
568
BossPart[ArrayPos0].State = BOSSLEGJOINT_WAIT_LEG_BW
569
CallFunction(BossBody_SetLegPosSaveTrue)
570
571
ArrayPos0 = Object.LegJointREntity
572
CallFunction(BossBody_SwitchLeg)
573
574
ArrayPos0 = Object.LegJointREntity
575
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
576
BossPart[ArrayPos1].State = BOSSLEG_MOVE_OPPOSITE
577
578
ArrayPos0 = Object.LegJointLEntity
579
BossPart[ArrayPos0].State = BOSSLEGJOINT_STEP_START_BW
580
CallFunction(BossBody_SetLegPosSaveFalse)
581
582
ArrayPos0 = Object.LegJointLEntity
583
CallFunction(BossBody_SwitchLeg_Revert)
584
ArrayPos0 = Object.LegJointLEntity
585
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
586
BossPart[ArrayPos1].State = BOSSLEG_MOVE
587
CallFunction(BossBody_MoveRArmToFront)
588
else
589
SetBit(Object.BitHolder, 6, LEFT_LEG_ACTIVE)
590
ArrayPos0 = Object.LegJointREntity
591
BossPart[ArrayPos0].State = BOSSLEGJOINT_STEP_START_BW
592
CallFunction(BossBody_SetLegPosSaveFalse)
593
594
ArrayPos0 = Object.LegJointREntity
595
CallFunction(BossBody_SwitchLeg_Revert)
596
597
ArrayPos0 = Object.LegJointREntity
598
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
599
BossPart[ArrayPos1].State = BOSSLEG_MOVE
600
601
ArrayPos0 = Object.LegJointLEntity
602
BossPart[ArrayPos0].State = BOSSLEGJOINT_WAIT_LEG_BW
603
CallFunction(BossBody_SetLegPosSaveTrue)
604
605
ArrayPos0 = Object.LegJointLEntity
606
CallFunction(BossBody_SwitchLeg)
607
608
ArrayPos0 = Object.LegJointLEntity
609
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
610
BossPart[ArrayPos1].State = BOSSLEG_MOVE_OPPOSITE
611
CallFunction(BossBody_MoveLArmToFront)
612
end if
613
614
end if
615
616
end if
617
618
end if
619
break
620
621
case BOSSBODY_PREPARE_CHARGING
622
GetBit(TempValue0, Object.BitHolder, 1)
623
if TempValue0 == MOVE_FORWARD
624
SetBit(Object.BitHolder, 1, MOVE_BACKWARDS)
625
CallFunction(BossBody_HandleCharge)
626
end if
627
628
GetBit(TempValue0, Object.BitHolder, 6)
629
if TempValue0 == RIGHT_LEG_ACTIVE
630
ArrayPos0 = Object.LegJointREntity
631
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
632
BossPart[ArrayPos1].State = BOSSLEG_MOVE_C
633
634
ArrayPos0 = Object.LegJointLEntity
635
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
636
BossPart[ArrayPos1].State = BOSSLEG_MOVE_OPPOSITE_C
637
else
638
ArrayPos0 = Object.LegJointLEntity
639
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
640
BossPart[ArrayPos1].State = BOSSLEG_MOVE_C
641
642
ArrayPos0 = Object.LegJointREntity
643
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
644
BossPart[ArrayPos1].State = BOSSLEG_MOVE_OPPOSITE_C
645
end if
646
647
ArrayPos0 = Object.LegJointREntity
648
GetBit(CheckResult, LegJoint[ArrayPos0].LegSide, 0)
649
ArrayPos0 = Object.LegJointLEntity
650
GetBit(TempValue0, LegJoint[ArrayPos0].LegSide, 0)
651
CheckResult &= TempValue0
652
if CheckResult == true
653
ArrayPos0 = Object.LegJointREntity
654
SetBit(LegJoint[ArrayPos0].LegSide, 0, 0)
655
656
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
657
SetBit(Leg[ArrayPos1].LegSide, 0, 0)
658
659
ArrayPos0 = Object.LegJointLEntity
660
SetBit(LegJoint[ArrayPos0].LegSide, 0, 0)
661
662
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
663
SetBit(Leg[ArrayPos1].LegSide, 0, 0)
664
665
Object.ChargeStart--
666
if Object.ChargeStart == 0
667
SetBit(Object.BitHolder, 1, MOVE_FORWARD)
668
SetBit(Object.BitHolder, 0, KEY_EVENT_TRUE)
669
else
670
GetBit(TempValue0, Object.BitHolder, 6)
671
if TempValue0 == LEFT_LEG_ACTIVE
672
SetBit(Object.BitHolder, 6, RIGHT_LEG_ACTIVE)
673
ArrayPos0 = Object.LegJointREntity
674
SetBit(LegJoint[ArrayPos0].LegSide, 1, 0)
675
CallFunction(BossBody_SetLegPosSaveTrue)
676
677
ArrayPos0 = Object.LegJointREntity
678
CallFunction(BossBody_SwitchLeg)
679
680
ArrayPos0 = Object.LegJointREntity
681
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
682
BossPart[ArrayPos1].State = BOSSLEG_MOVE_C
683
ArrayPos0 = LegR[ArrayPos1].FootREntity
684
BossPart[ArrayPos0].State = BOSSFOOT_STEP
685
686
ArrayPos0 = Object.LegJointLEntity
687
SetBit(LegJoint[ArrayPos0].LegSide, 1, 0)
688
BossPart[ArrayPos0].State = BOSSLEGJOINT_STEP_START
689
CallFunction(BossBody_SetLegPosSaveFalse)
690
691
ArrayPos0 = Object.LegJointLEntity
692
CallFunction(BossBody_SwitchLeg_Revert)
693
694
ArrayPos0 = Object.LegJointLEntity
695
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
696
BossPart[ArrayPos1].State = BOSSLEG_MOVE_OPPOSITE_C
697
CallFunction(BossBody_SetArmsToCharge)
698
else
699
SetBit(Object.BitHolder, 6, LEFT_LEG_ACTIVE)
700
ArrayPos0 = Object.LegJointLEntity
701
SetBit(LegJoint[ArrayPos0].LegSide, 1, 0)
702
CallFunction(BossBody_SetLegPosSaveTrue)
703
704
ArrayPos0 = Object.LegJointLEntity
705
CallFunction(BossBody_SwitchLeg)
706
707
ArrayPos0 = Object.LegJointLEntity
708
ArrayPos1 = LegJointL[ArrayPos0].LegLEntity
709
BossPart[ArrayPos1].State = BOSSLEG_MOVE_C
710
711
ArrayPos0 = LegL[ArrayPos1].FootLEntity
712
BossPart[ArrayPos0].State = BOSSFOOT_STEP
713
714
ArrayPos0 = Object.LegJointREntity
715
SetBit(LegJoint[ArrayPos0].LegSide, 1, 0)
716
717
BossPart[ArrayPos0].State = BOSSLEGJOINT_STEP_START
718
CallFunction(BossBody_SetLegPosSaveFalse)
719
720
ArrayPos0 = Object.LegJointREntity
721
CallFunction(BossBody_SwitchLeg_Revert)
722
723
ArrayPos0 = Object.LegJointREntity
724
ArrayPos1 = LegJointR[ArrayPos0].LegREntity
725
BossPart[ArrayPos1].State = BOSSLEG_MOVE_OPPOSITE_C
726
CallFunction(BossBody_SetArmsToCharge)
727
end if
728
729
end if
730
731
end if
732
break
733
734
case BOSSBODY_DESTROYED
735
if Object.InFloor == false
736
Object.YPos += 0x20000
737
ObjectTileCollision(CSIDE_FLOOR, 0, 30, 0)
738
Object.InFloor = CheckResult
739
Face.YPos = Object.YPos
740
end if
741
break
742
743
case BOSSBODY_STOP_CHARGE
744
Object.ChargeStart--
745
if Object.ChargeStart == 0
746
CallFunction(BossBody_RestoreNormalSpeed)
747
SetBit(Object.BitHolder, 0, KEY_EVENT_TRUE)
748
SetBit(Object.BitHolder, 1, MOVE_FORWARD)
749
end if
750
break
751
end switch
752
end sub
753
754
755
sub ObjectDraw
756
DrawSprite(0)
757
DrawSprite(1)
758
end sub
759
760
761
sub ObjectStartup
762
LoadSpriteSheet("R1/Objects3.gif")
763
764
SpriteFrame(-36, -32, 72, 64, 1, 1) // #0 - Egg Mobile
765
SpriteFrame(0, 8, 24, 24, 99, 1) // #1 - Arm Connector
766
end sub
767
768
769
// ========================
770
// Editor Subs
771
// ========================
772
773
sub RSDKDraw
774
DrawSprite(0)
775
DrawSprite(1)
776
end sub
777
778
779
sub RSDKLoad
780
LoadSpriteSheet("R1/Objects3.gif")
781
SpriteFrame(-36, -32, 72, 64, 1, 1) // #0 - Egg Mobile
782
SpriteFrame(0, 8, 24, 24, 99, 1) // #1 - Arm Connector
783
784
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
785
end sub
786
787