Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Mission/Boss_Face2.txt
1319 views
1
//----------------Sonic CD Boss Face 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.Oscillation
8
#alias Object.Value1 : Object.BodyEntity
9
#alias Object.Value2 : Object.ShoulderEntity
10
#alias Object.Value3 : Object.Hit
11
#alias Object.Value4 : Object.BitHolder
12
#alias Object.Value5 : Object.NewXBoundary1Value
13
#alias Object.Value6 : Object.NewXBoundary2Value
14
#alias Object.Value7 : Object.SavedXBoundary2
15
16
#alias Object.Rotation : Object.Timer
17
#alias Object.Direction : Object.FaceTimer
18
#alias Object.Scale : Object.SavedYBoundary2
19
#alias Object.InkEffect : Object.FrameTimer
20
#alias Object.PropertyValue : Object.BossSpeed
21
22
// EGG-HVC-001 Body Aliases
23
#alias Object[+1].iXPos : BossBody.iXPos
24
#alias Object[+1].iYPos : BossBody.iYPos
25
#alias Object[+1].YPos : BossBody.YPos
26
#alias Object[+1].State : BossBody.State
27
#alias Object.Value0 : Body.FaceEntity
28
#alias Object.Value1 : Body.LegJointREntity
29
#alias Object.Value2 : Body.LegJointLEntity
30
31
// Value4 is used to check key events, forward/backward movement and currently active leg
32
#alias Object.Value4 : Body.BitHolder
33
#alias Object.Value5 : Body.ChargeStart
34
#alias Object.State : Body.State
35
36
// General Aliases
37
#alias Object.Priority : BossPart.Priority
38
#alias Object.DrawOrder : BossPart.DrawOrder
39
#alias Object.Value0 : BossPart.PrevEntity
40
#alias Object.Value1 : BossPart.NextEntity
41
42
// HVC-001 Boss Right Leg Joint Aliases
43
#alias Object[+2].YPos : BossLegJointR.YPos
44
45
// HVC-001 Boss Right Leg Aliases
46
#alias Object[+3].YPos : BossLegR.YPos
47
#alias Object[+3].Value7 : BossLegR.YVelocity
48
49
// HVC-001 Boss Right Foot Aliases
50
#alias Object[+4].Value7 : BossFootR.YVelocity
51
// HVC-001 Boss Left Leg Joint Aliases
52
#alias Object[+5].YPos : BossLegJointL.YPos
53
54
// HVC-001 Boss Left Leg Aliases
55
#alias Object[+6].Value7 : BossLegL.YVelocity
56
57
// HVC-001 Boss Left Foot Aliases
58
#alias Object[+7].Value7 : BossFootL.YVelocity
59
60
// HVC-001 Boss Shoulder Aliases
61
#alias Object[+8].YPos : BossShoulder.YPos
62
#alias Object.Value0 : Shoulder.FaceEntity
63
#alias Object.Value1 : Shoulder.ArmJointLEntity
64
#alias Object.Value2 : Shoulder.ArmJointREntity
65
66
// HVC-001 Boss Left Arm Joint Aliases
67
#alias Object[+9].YPos : BossArmJointL.YPos
68
69
// HVC-001 Boss Left Arm Aliases
70
#alias Object[+10].YPos : BossArmL.YPos
71
// HVC-001 Boss Left Bumper Joint Aliases
72
#alias Object[+11].YPos : BossBumperL.YPos
73
74
// HVC-001 Boss Right Arm Joint Aliases
75
#alias Object[+12].YPos : BossArmJointR.YPos
76
77
// HVC-001 Boss Right Arm Aliases
78
#alias Object[+13].YPos : BossArmR.YPos
79
80
// HVC-001 Boss Right Bumper Joint Aliases
81
#alias Object[+14].YPos : BossBumperR.YPos
82
83
// Debris Aliases
84
#alias Object.State : Debris.State
85
#alias Object.Value2 : Debris.XOffSet
86
#alias Object.Value5 : Debris.YOffSet
87
88
// Player Aliases
89
#alias Player.Value4 : Player.InvincibleTimer
90
91
// States
92
#alias 0 : R1_EGGMAN2_SETUP
93
#alias 1 : R1_EGGMAN2_WAIT_PLAYER
94
#alias 2 : R1_EGGMAN2_BODY_CONTROLLER
95
#alias 3 : R1_EGGMAN2_DEFEATED
96
#alias 4 : R1_EGGMAN2_BLANK
97
#alias 5 : R1_EGGMAN2_RESTORE_BOUNDS
98
#alias 6 : R1_EGGMAN2_SET_BOUNDARIES
99
#alias 7 : R1_EGGMAN2_SPAWN_HVC
100
101
// EGG-HVC-001 Body States
102
#alias 1 : BOSSBODY2_DESCEND
103
#alias 5 : BOSSBODY2_MOVE_BACKWARDS
104
#alias 6 : BOSSBODY2_PREPARE_CHARGING
105
#alias 7 : BOSSBODY2_DESTROYED
106
107
// EGG-HVC-001 Arm Joint States
108
#alias 5 : BOSSARMJOINT2_DESTROYED
109
// EGG-HVC-001 Arm States
110
#alias 2 : BOSSARM2_DESTROYED
111
// EGG-HVC-001 Bumper States
112
#alias 2 : BOSSBUMPER2_DESTROYED
113
// EGG-HVC-001 Leg Joint States
114
#alias 12 : BOSSLEGJOINT2_DESTROYED
115
// EGG-HVC-001 Leg States
116
#alias 7 : BOSSLEG2_DESTROYED
117
// EGG-HVC-001 Foot States
118
#alias 6 : BOSSFOOT2_DESTROYED
119
// EGG-HVC-001 Shoulder States
120
#alias 2 : BOSSSHOULDER2_DESTROYED
121
122
// Eggman Animations
123
#alias -1 : EGGANI_NONE
124
#alias 0 : EGGANI_IDLE
125
#alias 1 : EGGANI_LAUGH
126
#alias 2 : EGGANI_HURT
127
#alias 3 : EGGANI_DESTROYED
128
129
// EGG-HVC-001 Body Bit 0 Aliases
130
#alias 0 : KEY_EVENT_FALSE
131
#alias 1 : KEY_EVENT_TRUE
132
133
// EGG-HVC-001 Body Bit 1 Aliases
134
#alias 0 : MOVE_FORWARD
135
#alias 1 : MOVE_BACKWARDS
136
137
// EGG-HVC-001 Body Bit 6 Aliases
138
#alias 0 : LEFT_LEG_ACTIVE
139
#alias 1 : RIGHT_LEG_ACTIVE
140
141
// Global SFX
142
#alias 22 : SFX_G_EXPLOSION
143
144
// Priority
145
#alias 1 : PRIORITY_ACTIVE
146
147
// Function declarations
148
#function R1_EGGMAN2_Oscillation
149
150
function R1_EGGMAN2_Oscillation
151
switch Object.Oscillation
152
case 0
153
TempValue0 = 1
154
break
155
case 1
156
TempValue0 = 0
157
break
158
case 2
159
TempValue0 = 2
160
break
161
case 3
162
TempValue0 = 0
163
break
164
case 4
165
TempValue0 = 3
166
break
167
case 5
168
TempValue0 = 0
169
break
170
case 6
171
TempValue0 = 4
172
break
173
case 7
174
TempValue0 = 5
175
break
176
case 8
177
TempValue0 = 5
178
break
179
case 9
180
TempValue0 = 5
181
break
182
case 10
183
TempValue0 = 6
184
break
185
case 11
186
TempValue0 = 10
187
break
188
case 12
189
TempValue0 = 4
190
break
191
case 13
192
TempValue0 = 14
193
break
194
case 14
195
TempValue0 = 8
196
break
197
case 15
198
TempValue0 = 50
199
break
200
case 16
201
TempValue0 = 5
202
break
203
case 17
204
TempValue0 = 14
205
break
206
case 18
207
case 19
208
TempValue0 = -1
209
break
210
end switch
211
end function
212
213
214
sub ObjectMain
215
switch Object.State
216
case R1_EGGMAN2_SETUP
217
Object.Animation = EGGANI_NONE
218
Object.Priority = PRIORITY_ACTIVE
219
220
Object.BodyEntity = Object.EntityNo
221
Object.BodyEntity += 1
222
223
Object.ShoulderEntity = Object.EntityNo
224
Object.ShoulderEntity += 8
225
226
Object.NewXBoundary1Value = BossBody.iXPos
227
228
Object.NewXBoundary2Value = Object.NewXBoundary1Value
229
Object.NewXBoundary2Value += 320
230
231
TempValue0 = Screen.CenterX
232
TempValue0 -= 160
233
TempValue0 >>= 1
234
Object.NewXBoundary2Value += TempValue0
235
236
Object.SavedXBoundary2 = Stage.XBoundary2
237
Object.SavedYBoundary2 = Stage.YBoundary2
238
239
Stage.NewXBoundary2 = Object.NewXBoundary2Value
240
241
Object.State = R1_EGGMAN2_WAIT_PLAYER
242
break
243
244
case R1_EGGMAN2_WAIT_PLAYER
245
TempValue0 = Object.NewXBoundary1Value
246
if Screen.CenterX > 160
247
TempValue0 += 180
248
else
249
TempValue0 += 160
250
end if
251
TempValue0 <<= 16
252
253
if Player.XPos > TempValue0
254
TempValue0 = Object.YPos
255
TempValue0 += 0xC00000
256
257
if Player.YPos > TempValue0
258
Stage.NewXBoundary1 = Object.NewXBoundary1Value
259
Stage.YBoundary2 = Player.YPos
260
Stage.YBoundary2 >>= 16
261
Stage.YBoundary2 += 160
262
263
if Stage.YBoundary2 < 256
264
Stage.YBoundary2 = 256
265
end if
266
267
Object.State = R1_EGGMAN2_SET_BOUNDARIES
268
end if
269
270
end if
271
break
272
273
case R1_EGGMAN2_BODY_CONTROLLER
274
if Object.Timer > 0
275
Object.Timer--
276
end if
277
if BossBody.State > 2
278
if Object.FaceTimer > 0
279
Object.FaceTimer--
280
else
281
Object.Animation = EGGANI_IDLE
282
end if
283
end if
284
285
ArrayPos0 = Object.BodyEntity
286
GetBit(TempValue0, Body[ArrayPos0].BitHolder, 0)
287
if TempValue0 == KEY_EVENT_TRUE
288
if Body[ArrayPos0].State == BOSSBODY2_PREPARE_CHARGING
289
// Object +15 is a blank object used to hold values
290
Object.YPos = Object[+15].Value0
291
BossBody.YPos = Object[+15].Value1
292
BossLegJointR.YPos = Object[+15].Value2
293
BossLegR.YVelocity = Object[+15].Value3
294
BossLegR.YPos = Object[+15].YPos
295
BossFootR.YVelocity = Object[+15].Value4
296
BossLegJointL.YPos = Object[+15].Value5
297
BossLegL.YVelocity = Object[+15].Value6
298
BossFootL.YVelocity = Object[+15].Value7
299
GetBit(TempValue0, Body[ArrayPos0].BitHolder, 6)
300
if TempValue0 == LEFT_LEG_ACTIVE
301
SetBit(Body[ArrayPos0].BitHolder, 6, RIGHT_LEG_ACTIVE)
302
else
303
SetBit(Body[ArrayPos0].BitHolder, 6, LEFT_LEG_ACTIVE)
304
end if
305
end if
306
307
SetBit(Body[ArrayPos0].BitHolder, 0, KEY_EVENT_FALSE)
308
if Object.Oscillation == 2
309
SetBit(Object.BitHolder, 3, 1) // This may be a typo... it's supposed to be changing the [Boss Body]'s value instead I imagine?
310
end if
311
312
SetBit(Body[ArrayPos0].BitHolder, 1, MOVE_FORWARD)
313
Object.Oscillation += 2
314
CallFunction(R1_EGGMAN2_Oscillation)
315
if TempValue0 < 0
316
Object.Oscillation = 6
317
end if
318
319
CallFunction(R1_EGGMAN2_Oscillation)
320
if TempValue0 == 6 // Go back
321
// Object +15 is a blank object used to hold values
322
Object[+15].Value0 = Object.YPos
323
Object[+15].Value1 = BossBody.YPos
324
Object[+15].Value2 = BossLegJointR.YPos
325
Object[+15].Value3 = BossLegR.YVelocity
326
Object[+15].YPos = BossLegR.YPos
327
Object[+15].Value4 = BossFootR.YVelocity
328
Object[+15].Value5 = BossLegJointL.YPos
329
Object[+15].Value6 = BossLegL.YVelocity
330
Object[+15].Value7 = BossFootL.YVelocity
331
end if
332
333
if Body[ArrayPos0].State == BOSSBODY2_MOVE_BACKWARDS
334
if TempValue0 == 4
335
GetBit(TempValue1, Body[ArrayPos0].BitHolder, 6)
336
if TempValue1 == LEFT_LEG_ACTIVE
337
SetBit(Body[ArrayPos0].BitHolder, 6, RIGHT_LEG_ACTIVE)
338
else
339
SetBit(Body[ArrayPos0].BitHolder, 6, LEFT_LEG_ACTIVE)
340
end if
341
end if
342
end if
343
344
Body[ArrayPos0].State = TempValue0
345
Object.Oscillation++
346
CallFunction(R1_EGGMAN2_Oscillation)
347
Object.Oscillation--
348
Body[ArrayPos0].ChargeStart = TempValue0
349
end if
350
break
351
352
case R1_EGGMAN2_DEFEATED
353
if Object.Timer < 160
354
Object.Timer++
355
356
TempValue0 = Object.Timer
357
TempValue0 &= 3
358
if TempValue0 == 3
359
Rand(TempValue0, 128)
360
TempValue0 -= 64
361
TempValue0 <<= 16
362
TempValue0 += Object.XPos
363
364
Rand(TempValue1, 64)
365
TempValue1 -= 32
366
TempValue1 <<= 16
367
TempValue1 += Object.YPos
368
369
CreateTempObject(TypeName[Explosion], 0, TempValue0, TempValue1)
370
371
PlaySfx(SFX_G_EXPLOSION, false)
372
end if
373
374
if Object.Timer == 94
375
TempValue0 = Object.EntityNo
376
TempValue0++
377
378
Player.Score += 1000
379
ResetObjectEntity(TempValue0, TypeName[Eggman Jetpack], 0, Object.XPos, Object.YPos)
380
Object.Animation = EGGANI_DESTROYED
381
382
#platform: Use_Haptics
383
HapticEffect(76, 0, 0, 0)
384
#endplatform
385
end if
386
end if
387
break
388
389
case R1_EGGMAN2_BLANK
390
break
391
392
case R1_EGGMAN2_RESTORE_BOUNDS
393
if Object.Timer < 120
394
Music.Volume--
395
396
Stage.YBoundary2 += 4
397
Stage.XBoundary2 += 6
398
399
Object.Timer++
400
else
401
Stage.YBoundary2 = Object.SavedYBoundary2
402
Stage.XBoundary2 = Object.SavedXBoundary2
403
PlayMusic(0)
404
Object.Type = TypeName[Blank Object]
405
end if
406
break
407
408
case R1_EGGMAN2_SET_BOUNDARIES
409
if Stage.YBoundary2 > BossBody.iYPos
410
Stage.YBoundary2 -= 2
411
Stage.YBoundary1 += 2
412
else
413
Stage.YBoundary2 = BossBody.iYPos
414
TempValue0 = BossBody.iYPos
415
TempValue0 -= Screen.YSize
416
if TempValue0 < 0
417
TempValue0 = 0
418
end if
419
Stage.NewYBoundary1 = TempValue0
420
421
Object.Timer = 0
422
423
Object.State = R1_EGGMAN2_SPAWN_HVC
424
end if
425
break
426
427
case R1_EGGMAN2_SPAWN_HVC
428
if Object.Timer < 120
429
if Object.Timer < 100
430
Music.Volume--
431
else
432
if Object.Timer == 100
433
PlayMusic(4)
434
end if
435
end if
436
Object.Timer++
437
else
438
Object.Timer = 0
439
Object.State = R1_EGGMAN2_BODY_CONTROLLER
440
Object.Animation = EGGANI_LAUGH
441
442
ArrayPos0 = Object.EntityNo
443
ArrayPos0++
444
445
if Object.BossSpeed < 1
446
Object.BossSpeed = 10 // Sets the speed of the boss for the mission
447
end if
448
449
ResetObjectEntity(ArrayPos0, TypeName[BossBody2], Object.BossSpeed, Object.XPos, Object.YPos)
450
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
451
452
Body[ArrayPos0].FaceEntity = Object.EntityNo
453
454
Body[ArrayPos0].LegJointREntity = Object.EntityNo
455
Body[ArrayPos0].LegJointREntity += 2
456
457
Body[ArrayPos0].LegJointLEntity = Object.EntityNo
458
Body[ArrayPos0].LegJointLEntity += 5
459
ArrayPos0++
460
461
ResetObjectEntity(ArrayPos0, TypeName[BossLegJoint2], Object.BossSpeed, Object.XPos, Object.YPos)
462
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
463
464
// Boss Body
465
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
466
BossPart[ArrayPos0].PrevEntity += 1
467
468
// Leg R
469
BossPart[ArrayPos0].NextEntity = Object.EntityNo
470
BossPart[ArrayPos0].NextEntity += 3
471
ArrayPos0++
472
473
ResetObjectEntity(ArrayPos0, TypeName[BossLeg2], Object.BossSpeed, Object.XPos, Object.YPos)
474
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
475
476
// Leg Joint R
477
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
478
BossPart[ArrayPos0].PrevEntity += 2
479
480
// Foot R
481
BossPart[ArrayPos0].NextEntity = Object.EntityNo
482
BossPart[ArrayPos0].NextEntity += 4
483
ArrayPos0++
484
485
ResetObjectEntity(ArrayPos0, TypeName[BossFoot2], Object.BossSpeed, Object.XPos, Object.YPos)
486
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
487
488
// Leg R
489
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
490
BossPart[ArrayPos0].PrevEntity += 3
491
492
// Boss Body
493
BossPart[ArrayPos0].NextEntity = Object.EntityNo
494
BossPart[ArrayPos0].NextEntity += 1
495
ArrayPos0++
496
497
ResetObjectEntity(ArrayPos0, TypeName[BossLegJoint2], Object.BossSpeed, Object.XPos, Object.YPos)
498
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
499
BossPart[ArrayPos0].DrawOrder = 2
500
501
// Boss Body
502
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
503
BossPart[ArrayPos0].PrevEntity += 1
504
505
// Leg L
506
BossPart[ArrayPos0].NextEntity = Object.EntityNo
507
BossPart[ArrayPos0].NextEntity += 6
508
ArrayPos0++
509
510
ResetObjectEntity(ArrayPos0, TypeName[BossLeg2], Object.BossSpeed, Object.XPos, Object.YPos)
511
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
512
BossPart[ArrayPos0].DrawOrder = 2
513
514
// Leg Joint L
515
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
516
BossPart[ArrayPos0].PrevEntity += 5
517
518
// Foot L
519
BossPart[ArrayPos0].NextEntity = Object.EntityNo
520
BossPart[ArrayPos0].NextEntity += 7
521
ArrayPos0++
522
523
ResetObjectEntity(ArrayPos0, TypeName[BossFoot2], Object.BossSpeed, Object.XPos, Object.YPos)
524
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
525
BossPart[ArrayPos0].DrawOrder = 2
526
527
// Leg L
528
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
529
BossPart[ArrayPos0].PrevEntity += 6
530
531
// Boss Body
532
BossPart[ArrayPos0].NextEntity = Object.EntityNo
533
BossPart[ArrayPos0].NextEntity += 1
534
ArrayPos0++
535
536
ResetObjectEntity(ArrayPos0, TypeName[BossShoulder], 0, Object.XPos, Object.YPos)
537
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
538
BossPart[ArrayPos0].DrawOrder = 4
539
540
Shoulder[ArrayPos0].FaceEntity = Object.EntityNo
541
542
// Arm Joint L
543
Shoulder[ArrayPos0].ArmJointLEntity = Object.EntityNo
544
Shoulder[ArrayPos0].ArmJointLEntity += 9
545
546
// Arm Joint R
547
Shoulder[ArrayPos0].ArmJointREntity = Object.EntityNo
548
Shoulder[ArrayPos0].ArmJointREntity += 12
549
ArrayPos0++
550
551
ResetObjectEntity(ArrayPos0, TypeName[BossArmJoint2], Object.BossSpeed, Object.XPos, Object.YPos)
552
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
553
554
// Shoulder
555
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
556
BossPart[ArrayPos0].PrevEntity += 8
557
558
// Arm L
559
BossPart[ArrayPos0].NextEntity = Object.EntityNo
560
BossPart[ArrayPos0].NextEntity += 10
561
ArrayPos0++
562
563
ResetObjectEntity(ArrayPos0, TypeName[BossArm2], Object.BossSpeed, Object.XPos, Object.YPos)
564
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
565
566
// Arm Joint L
567
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
568
BossPart[ArrayPos0].PrevEntity += 9
569
570
// Bumper L
571
BossPart[ArrayPos0].NextEntity = Object.EntityNo
572
BossPart[ArrayPos0].NextEntity += 11
573
ArrayPos0++
574
575
ResetObjectEntity(ArrayPos0, TypeName[BossBumper2], Object.BossSpeed, Object.XPos, Object.YPos)
576
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
577
578
// Arm L
579
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
580
BossPart[ArrayPos0].PrevEntity += 10
581
582
// Boss Body
583
BossPart[ArrayPos0].NextEntity = Object.EntityNo
584
BossPart[ArrayPos0].NextEntity += 1
585
ArrayPos0++
586
587
ResetObjectEntity(ArrayPos0, TypeName[BossArmJoint2], Object.BossSpeed, Object.XPos, Object.YPos)
588
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
589
BossPart[ArrayPos0].DrawOrder = 2
590
591
// Shoulder
592
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
593
BossPart[ArrayPos0].PrevEntity += 8
594
595
// Arm R
596
BossPart[ArrayPos0].NextEntity = Object.EntityNo
597
BossPart[ArrayPos0].NextEntity += 13
598
ArrayPos0++
599
600
ResetObjectEntity(ArrayPos0, TypeName[BossArm2], Object.BossSpeed, Object.XPos, Object.YPos)
601
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
602
BossPart[ArrayPos0].DrawOrder = 2
603
604
// Arm Joint R
605
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
606
BossPart[ArrayPos0].PrevEntity += 12
607
608
// Bumper R
609
BossPart[ArrayPos0].NextEntity = Object.EntityNo
610
BossPart[ArrayPos0].NextEntity += 14
611
ArrayPos0++
612
613
ResetObjectEntity(ArrayPos0, TypeName[BossBumper2], Object.BossSpeed, Object.XPos, Object.YPos)
614
BossPart[ArrayPos0].Priority = PRIORITY_ACTIVE
615
BossPart[ArrayPos0].DrawOrder = 2
616
617
// Arm R
618
BossPart[ArrayPos0].PrevEntity = Object.EntityNo
619
BossPart[ArrayPos0].PrevEntity += 13
620
621
// Boss Body
622
BossPart[ArrayPos0].NextEntity = Object.EntityNo
623
BossPart[ArrayPos0].NextEntity += 1
624
ArrayPos0++
625
end if
626
break
627
end switch
628
end sub
629
630
631
sub ObjectPlayerInteraction
632
TempValue0 = Player.CollisionRight
633
TempValue0 <<= 16
634
TempValue0 += Player.XPos
635
636
TempValue1 = Stage.XBoundary2
637
TempValue1 <<= 16
638
if TempValue0 > TempValue1
639
Player.XVelocity = 0
640
Player.Speed = 0
641
Player.XPos = TempValue1
642
643
TempValue0 = Player.CollisionRight
644
TempValue0 <<= 16
645
Player.XPos -= TempValue0
646
end if
647
648
if Object.State > R1_EGGMAN2_WAIT_PLAYER
649
if Player.Animation != ANI_HURT
650
if Object.Hit < 3
651
PlayerObjectCollision(C_ENEMY, -28, -28, 28, 28)
652
if CheckResult == true
653
TempValue2 = false
654
CheckEqual(Player.Animation, ANI_JUMPING)
655
TempValue2 |= CheckResult
656
CheckEqual(Player.Animation, ANI_HAMMER_JUMP)
657
TempValue2 |= CheckResult
658
CheckEqual(Player.Animation, ANI_HAMMER_DASH)
659
TempValue2 |= CheckResult
660
if TempValue2 == true
661
Player.XVelocity = Player.XPos
662
Player.XVelocity -= Object.XPos
663
Player.XVelocity >>= 3
664
Player.Speed = Player.XVelocity
665
666
Player.YVelocity = Player.YPos
667
Player.YVelocity -= Object.YPos
668
Player.YVelocity >>= 3
669
670
if Object.Timer == 0
671
if BossBody.State != BOSSBODY2_DESCEND
672
PlaySfx(SFX_G_EXPLOSION, false)
673
674
switch Object.Hit
675
case 0
676
Object.Hit++
677
Object.Timer = 30
678
Object.Animation = EGGANI_HURT
679
Object.FaceTimer = 120
680
681
ArrayPos0 = Object.ShoulderEntity
682
ArrayPos1 = Shoulder[ArrayPos0].ArmJointREntity
683
Debris[ArrayPos1].State = BOSSARMJOINT2_DESTROYED
684
Debris[ArrayPos1].XOffSet = 0x10000
685
Debris[ArrayPos1].YOffSet = 0x20000
686
687
// Arm Joint R to Arm R
688
ArrayPos0 = BossPart[ArrayPos1].NextEntity
689
Debris[ArrayPos0].State = BOSSARM2_DESTROYED
690
Debris[ArrayPos0].XOffSet = 0
691
Debris[ArrayPos0].YOffSet = 0x10000
692
693
// Arm R to Bumper R
694
ArrayPos1 = BossPart[ArrayPos0].NextEntity
695
Debris[ArrayPos1].State = BOSSBUMPER2_DESTROYED
696
Debris[ArrayPos1].XOffSet = 0
697
Debris[ArrayPos1].YOffSet = -0x18000
698
break
699
700
case 1
701
Object.Hit++
702
Object.Timer = 30
703
Object.Animation = EGGANI_HURT
704
Object.FaceTimer = 120
705
706
ArrayPos0 = Object.ShoulderEntity
707
ArrayPos1 = Shoulder[ArrayPos0].ArmJointLEntity
708
Debris[ArrayPos1].State = BOSSARMJOINT2_DESTROYED
709
Debris[ArrayPos1].XOffSet = 0x10000
710
Debris[ArrayPos1].YOffSet = 0x20000
711
712
// Arm Joint L to Arm L
713
ArrayPos0 = BossPart[ArrayPos1].NextEntity
714
Debris[ArrayPos0].State = BOSSARM2_DESTROYED
715
Debris[ArrayPos0].XOffSet = 0
716
Debris[ArrayPos0].YOffSet = 0x10000
717
718
// ArmL to Bumper L
719
ArrayPos1 = BossPart[ArrayPos0].NextEntity
720
Debris[ArrayPos1].State = BOSSBUMPER2_DESTROYED
721
Debris[ArrayPos1].XOffSet = 0
722
Debris[ArrayPos1].YOffSet = -0x18000
723
break
724
725
case 2
726
Object.Hit++
727
Object.State = R1_EGGMAN2_DEFEATED
728
Object.Animation = EGGANI_HURT
729
730
Stage.TimeEnabled = false
731
732
ArrayPos0 = Object.BodyEntity
733
Body[ArrayPos0].State = BOSSBODY2_DESTROYED
734
735
ArrayPos0 = Object.ShoulderEntity
736
Debris[ArrayPos0].State = BOSSSHOULDER2_DESTROYED
737
Debris[ArrayPos0].XOffSet = -0x10000
738
Debris[ArrayPos0].YOffSet = -0x20000
739
740
ArrayPos0 = Object.BodyEntity
741
ArrayPos1 = Body[ArrayPos0].LegJointREntity
742
Debris[ArrayPos1].State = BOSSLEGJOINT2_DESTROYED
743
Debris[ArrayPos1].XOffSet = 0
744
Debris[ArrayPos1].YOffSet = -0x28000
745
746
// Leg Joint R to Leg R
747
ArrayPos0 = BossPart[ArrayPos1].NextEntity
748
Debris[ArrayPos0].State = BOSSLEG2_DESTROYED
749
Debris[ArrayPos0].XOffSet = 0
750
Debris[ArrayPos0].YOffSet = -0x20000
751
752
// Leg R to Foot R
753
ArrayPos1 = BossPart[ArrayPos0].NextEntity
754
Debris[ArrayPos1].State = BOSSFOOT2_DESTROYED
755
Debris[ArrayPos1].XOffSet = 0
756
Debris[ArrayPos1].YOffSet = -0x23000
757
758
ArrayPos0 = Object.BodyEntity
759
ArrayPos1 = Body[ArrayPos0].LegJointLEntity
760
Debris[ArrayPos1].State = BOSSLEGJOINT2_DESTROYED
761
Debris[ArrayPos1].XOffSet = 0
762
Debris[ArrayPos1].YOffSet = -0x28000
763
764
// Leg Joint L to Leg L
765
ArrayPos0 = BossPart[ArrayPos1].NextEntity
766
Debris[ArrayPos0].State = BOSSLEG2_DESTROYED
767
Debris[ArrayPos0].XOffSet = 0
768
Debris[ArrayPos0].YOffSet = -0x20000
769
770
// Leg L to Foot L
771
ArrayPos1 = BossPart[ArrayPos0].NextEntity
772
Debris[ArrayPos1].State = BOSSFOOT2_DESTROYED
773
Debris[ArrayPos1].XOffSet = 0
774
Debris[ArrayPos1].YOffSet = -0x23000
775
776
break
777
end switch
778
end if
779
end if
780
else
781
if Player.InvincibleTimer == 0
782
Object.Animation = EGGANI_LAUGH
783
Object.FaceTimer = 180
784
Player.State = Player_State_GotHit
785
if Player.XPos > Object.XPos
786
Player.Speed = 0x20000
787
else
788
Player.Speed = -0x20000
789
end if
790
end if
791
end if
792
end if
793
end if
794
end if
795
end if
796
end sub
797
798
799
sub ObjectDraw
800
switch Object.Animation
801
case EGGANI_IDLE
802
DrawSprite(0)
803
break
804
805
case EGGANI_LAUGH
806
if Object.FrameTimer < 8
807
Object.FrameTimer = 8
808
else
809
if Object.FrameTimer > 23
810
Object.FrameTimer = 8
811
end if
812
end if
813
814
Object.Frame = Object.FrameTimer
815
Object.Frame >>= 3
816
817
Object.FrameTimer++
818
819
DrawSprite(Object.Frame)
820
break
821
822
case EGGANI_HURT
823
if Object.FrameTimer < 12
824
Object.FrameTimer = 12
825
else
826
if Object.FrameTimer > 27
827
Object.FrameTimer = 12
828
end if
829
end if
830
831
Object.Frame = Object.FrameTimer
832
Object.Frame >>= 2
833
834
Object.FrameTimer++
835
836
DrawSprite(Object.Frame)
837
break
838
end switch
839
end sub
840
841
842
sub ObjectStartup
843
LoadSpriteSheet("R1/Objects3.gif")
844
845
SpriteFrame(-28, -24, 40, 16, 206, 1) // #0 - Eggman Idle
846
847
SpriteFrame(-28, -24, 40, 16, 206, 18) // #1 - Eggman Laugh Frame 0
848
SpriteFrame(-28, -24, 40, 16, 206, 35) // #2 - Eggman Laugh Frame 1
849
850
SpriteFrame(-28, -40, 40, 32, 124, 1) // #3 - Eggman Hurt Frame 0
851
SpriteFrame(-28, -24, 40, 16, 206, 52) // #4 - Eggman Hurt Frame 1
852
SpriteFrame(-28, -40, 40, 32, 165, 1) // #5 - Eggman Hurt Frame 2
853
SpriteFrame(-28, -24, 40, 16, 206, 69) // #6 - Eggman Hurt Frame 3
854
855
ArrayPos0 = 32
856
while ArrayPos0 < 1056
857
if Object[ArrayPos0].Type == TypeName[Boss Face]
858
Object[ArrayPos0].Type = TypeName[BossFace2]
859
ArrayPos0 = 2000
860
end if
861
ArrayPos0++
862
loop
863
end sub
864
865
866
// ========================
867
// Editor Subs
868
// ========================
869
870
sub RSDKDraw
871
DrawSprite(0)
872
end sub
873
874
875
sub RSDKLoad
876
LoadSpriteSheet("R1/Objects3.gif")
877
SpriteFrame(-28, -24, 40, 16, 206, 1) // #0 - Eggman Idle
878
879
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
880
end sub
881
882