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