Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/MPZ/Eggman.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Eggman Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// Using MPZEggman as a prefix here because there's like 12 "Eggman" objects in the game so its less confusing this way
9
10
// ========================
11
// Aliases
12
// ========================
13
14
private alias object.value1 : object.originPos.y
15
private alias object.value2 : object.oscillationAngle
16
private alias object.value4 : object.timer
17
private alias object.value5 : object.boundsL
18
private alias object.value6 : object.boundsR
19
private alias object.value7 : object.targetPos.x
20
private alias object.value8 : object.moveBoundsB
21
private alias object.value9 : object.boundsT
22
private alias object.value10 : object.boundsB
23
private alias object.value11 : object.moveVel
24
private alias object.value12 : object.health
25
private alias object.value13 : object.invincibilityTimer
26
private alias object.value14 : object.exploding
27
private alias object.value15 : object.flameAnim
28
private alias object.value16 : object.flameAnimTimer
29
private alias object.value17 : object.balloonRadius.x
30
private alias object.value18 : object.balloonRadius.y
31
private alias object.value19 : object.balloonOffset.y
32
private alias object.value20 : object.activeBalloons
33
private alias object.value21 : object.laserID
34
private alias object.value22 : object.laserDelay
35
private alias object.value23 : object.boundsExtend.x
36
37
// Eggman States
38
private alias 0 : MPZEGGMAN_AWAITPLAYER
39
private alias 1 : MPZEGGMAN_HOVER
40
private alias 2 : MPZEGGMAN_MOVEX
41
private alias 3 : MPZEGGMAN_MOVEXY
42
private alias 4 : MPZEGGMAN_EXTENDBALLOONS
43
private alias 5 : MPZEGGMAN_RETRACTBALLOONS_Y
44
private alias 6 : MPZEGGMAN_RETRACTBALLOONS_X
45
private alias 7 : MPZEGGMAN_EXTENDBALLOONS2_Y
46
private alias 8 : MPZEGGMAN_WAITFORPOPPED
47
private alias 9 : MPZEGGMAN_RETURNTOMOVING
48
private alias 10 : MPZEGGMAN_MOVETOLASERPOS
49
private alias 11 : MPZEGGMAN_FIRINGLASERS
50
private alias 12 : MPZEGGMAN_SWAPLASERDIR
51
private alias 13 : MPZEGGMAN_EXPLODE
52
private alias 14 : MPZEGGMAN_DEFEATFALL
53
private alias 15 : MPZEGGMAN_DEFEATRISE
54
private alias 16 : MPZEGGMAN_FLEE
55
private alias 17 : MPZEGGMAN_ESCAPE
56
57
// Eggman Animations
58
private alias 0 : MPZEGGANI_INVISIBLE
59
private alias 1 : MPZEGGANI_IDLE
60
private alias 2 : MPZEGGANI_LAUGH
61
private alias 3 : MPZEGGANI_HIT
62
private alias 4 : MPZEGGANI_DEFEATED
63
private alias 5 : MPZEGGANI_TOASTED
64
private alias 6 : MPZEGGANI_PANIC
65
66
// Flame Animations
67
private alias 0 : FLAME_INACTIVE
68
private alias 1 : FLAME_ACTIVE
69
private alias 2 : FLAME_EXPLODE
70
71
// EggmanBalloon Aliases
72
private alias object.value0 : mbzEggmanBalloon.parent
73
74
// EggmanLaser Aliases
75
private alias object.value0 : mbzEggmanLaser.offset.x
76
77
// Player Aliases
78
private alias object.xpos : player.xpos
79
private alias object.xvel : player.xvel
80
private alias object.speed : player.speed
81
private alias object.animation : player.animation
82
private alias object.collisionRight : player.collisionRight
83
84
private alias object.value40 : player.hitboxLeft
85
private alias object.value38 : player.hitboxTop
86
private alias object.value41 : player.hitboxRight
87
private alias object.value39 : player.hitboxBottom
88
89
// Music Events
90
private alias 26 : SLOT_MUSICEVENT_BOSS
91
92
private alias 0 : MUSICEVENT_FADETOBOSS
93
private alias 1 : MUSICEVENT_FADETOSTAGE
94
95
96
// ========================
97
// Function Declarations
98
// ========================
99
100
reserve function MPZEggman_Oscillate
101
reserve function MPZEggman_HandleFireLaser
102
103
104
// ========================
105
// Static Values
106
// ========================
107
108
private value MPZEggman_laserType = 0
109
110
111
// ========================
112
// Tables
113
// ========================
114
115
private table MPZEggman_flameAnim1Table
116
8, 9, 9, 8, 8, 17
117
end table
118
119
private table MPZEggman_balloonReleaseTable
120
0, 2, 4, 6, 1, 3, 5
121
end table
122
123
124
// ========================
125
// Function Definitions
126
// ========================
127
128
private function MPZEggman_Oscillate
129
object.ypos = object.originPos.y
130
Sin256(temp0, object.oscillationAngle)
131
temp0 <<= 9
132
object.ypos += temp0
133
object.oscillationAngle += 4
134
object.oscillationAngle &= 0xFF
135
end function
136
137
138
private function MPZEggman_HandleFireLaser
139
object.laserDelay--
140
if object.laserDelay == 0
141
if object.laserID > 0
142
PlaySfx(SfxName[Small Laser], false)
143
object.laserDelay = 30
144
object.timer = 16
145
146
arrayPos0 = object.entityPos
147
arrayPos0 += 8
148
arrayPos0 += object.laserID
149
ResetObjectEntity(arrayPos0, MPZEggman_laserType, 0, object.xpos, object.ypos)
150
object[arrayPos0].direction = object.direction
151
object[arrayPos0].xvel = object.moveVel
152
object[arrayPos0].xvel <<= 2
153
if object.direction == FLIP_NONE
154
FlipSign(object[arrayPos0].xvel)
155
object[arrayPos0].xpos += 0x40000
156
else
157
object[arrayPos0].xpos -= 0x40000
158
end if
159
mbzEggmanLaser[arrayPos0].offset.x = object[arrayPos0].xpos
160
mbzEggmanLaser[arrayPos0].offset.x &= 0xFFFF0000
161
object[arrayPos0].ypos += 0x70000
162
object.laserID--
163
end if
164
end if
165
end function
166
167
168
// ========================
169
// Events
170
// ========================
171
172
event ObjectUpdate
173
switch object.state
174
case MPZEGGMAN_AWAITPLAYER
175
temp0 = object.ixpos
176
temp0 -= screen.xcenter
177
stage.newXBoundary1 = temp0
178
179
temp0 = object.ixpos
180
temp0 += screen.xcenter
181
stage.newXBoundary2 = temp0
182
183
temp0 = object.iypos
184
temp0 += 72
185
stage.newYBoundary2 = temp0
186
187
if player[0].xpos >= object.xpos
188
object.animation = MPZEGGANI_IDLE
189
190
ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOBOSS, 0, 0)
191
object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
192
193
object.moveVel = 0x10000
194
object.moveVel *= screen.xcenter
195
object.moveVel /= 160
196
197
object.boundsExtend.x = 0x200000
198
object.boundsExtend.x *= screen.xcenter
199
object.boundsExtend.x /= 160
200
201
object.oscillationAngle = 128
202
object.flameAnim = FLAME_ACTIVE
203
204
object.boundsL = stage.newXBoundary1
205
object.boundsL += 32
206
object.boundsL <<= 16
207
208
object.boundsR = stage.newXBoundary2
209
object.boundsR -= 32
210
object.boundsR <<= 16
211
212
arrayPos0 = object.entityPos
213
arrayPos1 = arrayPos0
214
arrayPos1 += 7
215
temp0 = 36
216
while arrayPos0 < arrayPos1
217
arrayPos0++
218
object[arrayPos0].type = TypeName[Eggman Balloon]
219
mbzEggmanBalloon[arrayPos0].parent = object.entityPos
220
object[arrayPos0].angle = temp0
221
if temp0 >= 0x80
222
object[arrayPos0].drawOrder = 2
223
end if
224
object[arrayPos0].priority = PRIORITY_ACTIVE
225
temp0 += 36
226
loop
227
228
object.balloonRadius.x = 39
229
object.balloonRadius.y = 39
230
object.targetPos.x = object.xpos
231
object.moveBoundsB = object.ypos
232
object.moveBoundsB -= 0x300000
233
object.boundsT = object.ypos
234
object.boundsT -= 0x800000
235
object.boundsB = object.ypos
236
237
object.ypos -= 0x1200000
238
object.originPos.y = object.ypos
239
object.timer = 0
240
241
#platform: USE_STANDALONE
242
object.health = 8
243
#endplatform
244
#platform: USE_ORIGINS
245
if game.bossOneLife == false
246
object.health = 8
247
else
248
object.health = 1
249
end if
250
#endplatform
251
252
object.priority = PRIORITY_ACTIVE
253
object.state = MPZEGGMAN_HOVER
254
end if
255
break
256
257
case MPZEGGMAN_HOVER
258
object.originPos.y += 0x10000
259
if object.originPos.y >= object.boundsB
260
object.xvel = object.moveVel
261
if player[0].xpos < object.xpos
262
object.direction = FLIP_NONE
263
FlipSign(object.xvel)
264
else
265
object.direction = FLIP_X
266
end if
267
object.timer = 2
268
object.state = MPZEGGMAN_MOVEX
269
end if
270
CallFunction(MPZEggman_Oscillate)
271
break
272
273
case MPZEGGMAN_MOVEX
274
object.xpos += object.xvel
275
276
temp0 = false
277
if object.direction == FLIP_NONE
278
if object.xpos <= object.boundsL
279
temp0 = true
280
end if
281
else
282
if object.xpos >= object.boundsR
283
temp0 = true
284
end if
285
end if
286
287
if temp0 == true
288
FlipSign(object.xvel)
289
object.direction ^= FLIP_X
290
291
object.timer--
292
if object.timer == 0
293
object.xvel = object.moveVel
294
if object.direction == FLIP_NONE
295
FlipSign(object.xvel)
296
end if
297
object.yvel = -0x10000
298
object.state = MPZEGGMAN_MOVEXY
299
end if
300
end if
301
CallFunction(MPZEggman_Oscillate)
302
break
303
304
case MPZEGGMAN_MOVEXY
305
object.xpos += object.xvel
306
object.originPos.y += object.yvel
307
308
if object.originPos.y <= object.moveBoundsB
309
object.yvel = 0
310
end if
311
312
if object.direction == FLIP_NONE
313
if object.xpos <= object.targetPos.x
314
temp0 = true
315
end if
316
else
317
if object.xpos >= object.targetPos.x
318
temp0 = true
319
end if
320
end if
321
322
if temp0 == true
323
object.xvel = 0
324
object.xpos = object.targetPos.x
325
object.state = MPZEGGMAN_EXTENDBALLOONS
326
end if
327
CallFunction(MPZEggman_Oscillate)
328
break
329
330
case MPZEGGMAN_EXTENDBALLOONS
331
object.balloonRadius.x++
332
object.balloonRadius.y++
333
334
if object.balloonRadius.x >= 104
335
object.state = MPZEGGMAN_RETRACTBALLOONS_Y
336
end if
337
CallFunction(MPZEggman_Oscillate)
338
break
339
340
case MPZEGGMAN_RETRACTBALLOONS_Y
341
object.balloonRadius.y--
342
if object.balloonRadius.y <= 0
343
object.state = MPZEGGMAN_RETRACTBALLOONS_X
344
end if
345
346
CallFunction(MPZEggman_Oscillate)
347
break
348
349
case MPZEGGMAN_RETRACTBALLOONS_X
350
object.balloonRadius.x--
351
if object.balloonRadius.x <= 39
352
object.state = MPZEGGMAN_EXTENDBALLOONS2_Y
353
end if
354
CallFunction(MPZEggman_Oscillate)
355
break
356
357
case MPZEGGMAN_EXTENDBALLOONS2_Y
358
object.balloonRadius.y++
359
if object.balloonRadius.y >= 39
360
object.state = MPZEGGMAN_HOVER
361
end if
362
CallFunction(MPZEggman_Oscillate)
363
break
364
365
case MPZEGGMAN_WAITFORPOPPED
366
object.originPos.y += object.yvel
367
368
if object.originPos.y <= object.boundsT
369
object.yvel = 0
370
end if
371
372
if object.balloonRadius.x > 39
373
object.balloonRadius.x--
374
end if
375
376
if object.balloonRadius.y > 0
377
object.balloonRadius.y--
378
else
379
if object.balloonOffset.y < 0x100000
380
object.balloonOffset.y += 0x8000
381
end if
382
end if
383
384
if object.activeBalloons == 0
385
if object.health > 1
386
object.state = MPZEGGMAN_RETURNTOMOVING
387
else
388
object.yvel = -0x18000
389
object.xvel = object.moveVel
390
if object.direction == FLIP_NONE
391
FlipSign(object.xvel)
392
end if
393
object.state = MPZEGGMAN_MOVETOLASERPOS
394
end if
395
end if
396
397
CallFunction(MPZEggman_Oscillate)
398
break
399
400
case MPZEGGMAN_RETURNTOMOVING
401
object.balloonOffset.y -= 0x8000
402
if object.balloonOffset.y <= 0
403
object.balloonOffset.y = 0
404
object.state = MPZEGGMAN_EXTENDBALLOONS2_Y
405
end if
406
CallFunction(MPZEggman_Oscillate)
407
break
408
409
case MPZEGGMAN_MOVETOLASERPOS
410
if object.timer == 0
411
object.xpos += object.xvel
412
413
object.originPos.y += object.yvel
414
if object.originPos.y <= object.boundsT
415
object.yvel = 0
416
end if
417
418
if object.direction == FLIP_NONE
419
temp0 = object.boundsL
420
temp0 += object.boundsExtend.x
421
if object.xpos <= temp0
422
object.yvel = 0x18000
423
object.laserID = 3
424
object.laserDelay = 30
425
object.direction = FLIP_X
426
object.state = MPZEGGMAN_FIRINGLASERS
427
end if
428
else
429
temp0 = object.boundsR
430
temp0 -= object.boundsExtend.x
431
if object.xpos >= temp0
432
object.yvel = 0x18000
433
object.laserID = 3
434
object.laserDelay = 30
435
object.direction = FLIP_NONE
436
object.state = MPZEGGMAN_FIRINGLASERS
437
end if
438
end if
439
440
CallFunction(MPZEggman_Oscillate)
441
CallFunction(MPZEggman_HandleFireLaser)
442
else
443
object.timer--
444
end if
445
break
446
447
case MPZEGGMAN_FIRINGLASERS
448
if object.timer == 0
449
object.xpos += object.xvel
450
object.originPos.y += object.yvel
451
452
if object.originPos.y >= object.boundsB
453
object.yvel = -0x18000
454
object.state = MPZEGGMAN_SWAPLASERDIR
455
end if
456
457
if object.direction == FLIP_NONE
458
if object.xpos >= object.boundsR
459
object.xvel = 0
460
end if
461
else
462
if object.xpos <= object.boundsL
463
object.xvel = 0
464
end if
465
end if
466
467
CallFunction(MPZEggman_Oscillate)
468
CallFunction(MPZEggman_HandleFireLaser)
469
else
470
object.timer--
471
end if
472
break
473
474
case MPZEGGMAN_SWAPLASERDIR
475
if object.timer == 0
476
object.xpos += object.xvel
477
object.originPos.y += object.yvel
478
479
temp0 = object.boundsB
480
temp0 -= 0x300000
481
if object.originPos.y <= temp0
482
object.xvel = object.moveVel
483
if object.direction == FLIP_NONE
484
FlipSign(object.xvel)
485
end if
486
end if
487
488
if object.originPos.y <= object.boundsT
489
object.yvel = 0
490
object.state = MPZEGGMAN_MOVETOLASERPOS
491
end if
492
CallFunction(MPZEggman_Oscillate)
493
CallFunction(MPZEggman_HandleFireLaser)
494
else
495
object.timer--
496
end if
497
break
498
499
case MPZEGGMAN_EXPLODE
500
object.timer++
501
if object.timer == 180
502
object.timer = 0
503
object.animation = MPZEGGANI_TOASTED
504
object.exploding = false
505
object.state++
506
ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOSTAGE, 0, 0)
507
object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
508
509
temp0 = tileLayer[0].xsize
510
temp0 <<= 7
511
stage.newXBoundary2 = temp0
512
end if
513
break
514
515
case MPZEGGMAN_DEFEATFALL
516
object.ypos += object.yvel
517
object.yvel += 0x1800
518
519
object.timer++
520
if object.timer == 15
521
object.yvel = 0
522
object.timer = 0
523
object.animationTimer = 0
524
object.state++
525
end if
526
break
527
528
case MPZEGGMAN_DEFEATRISE
529
if object.timer < 48
530
object.ypos += object.yvel
531
object.yvel -= 0x800
532
object.timer++
533
else
534
object.timer = 0
535
object.yvel = 0
536
object.originPos.y = object.ypos
537
object.state++
538
end if
539
break
540
541
case MPZEGGMAN_FLEE
542
object.ypos = object.originPos.y
543
CallFunction(MPZEggman_Oscillate)
544
if object.timer < 8
545
object.timer++
546
else
547
object.timer = 0
548
object.animation = MPZEGGANI_PANIC
549
object.animationTimer = 0
550
object.flameAnim = FLAME_EXPLODE
551
object.flameAnimTimer = 0
552
object.direction = FLIP_X
553
object.priority = PRIORITY_ACTIVE
554
555
#platform: USE_STANDALONE
556
temp0 = tileLayer[0].xsize
557
temp0 <<= 7
558
stage.newXBoundary2 = temp0
559
#endplatform
560
561
object.state++
562
end if
563
break
564
565
case MPZEGGMAN_ESCAPE
566
object.xpos += 0x40000
567
object.originPos.y -= 0x4000
568
CallFunction(MPZEggman_Oscillate)
569
if object.outOfBounds == true
570
object.type = TypeName[Blank Object]
571
end if
572
break
573
574
end switch
575
576
if object.health != 0
577
if object.invincibilityTimer > 0
578
object.invincibilityTimer--
579
GetBit(temp0, object.invincibilityTimer, 0)
580
if temp0 == true
581
SetPaletteEntry(0, 192, 0xE0E0E0)
582
else
583
SetPaletteEntry(0, 192, 0x000000)
584
end if
585
end if
586
587
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
588
if object.invincibilityTimer == 0
589
CheckEqual(player[currentPlayer].animation, ANI_HURT)
590
temp0 = checkResult
591
CheckEqual(player[currentPlayer].animation, ANI_DYING)
592
temp0 |= checkResult
593
CheckEqual(player[currentPlayer].animation, ANI_DROWNING)
594
temp0 |= checkResult
595
if temp0 != 0
596
if object.animation != MPZEGGANI_LAUGH
597
object.animation = MPZEGGANI_LAUGH
598
object.animationTimer = 0
599
end if
600
end if
601
602
BoxCollisionTest(C_TOUCH, object.entityPos, -24, -24, 24, 22, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)
603
if checkResult == true
604
CallFunction(Player_CheckHit)
605
if checkResult == true
606
object.health--
607
if object.health == 0
608
#platform: USE_ORIGINS
609
CallNativeFunction2(NotifyCallback, NOTIFY_KILL_BOSS, 0)
610
CallNativeFunction2(NotifyCallback, NOTIFY_BOSS_END, 1)
611
#endplatform
612
613
player.score += 1000
614
object.flameAnim = FLAME_INACTIVE
615
object.flameAnimTimer = 0
616
object.animation = MPZEGGANI_DEFEATED
617
object.animationTimer = 0
618
object.exploding = true
619
object.originPos.y = object.ypos
620
object.state = MPZEGGMAN_EXPLODE
621
object.timer = 0
622
#platform: USE_ORIGINS
623
object.invincibilityTimer = 64
624
#endplatform
625
else
626
temp0 = 7
627
temp0 -= object.health
628
629
GetTableValue(arrayPos0, temp0, MPZEggman_balloonReleaseTable)
630
arrayPos0 += object.entityPos
631
arrayPos0++
632
object[arrayPos0].state++
633
if player[0].xpos < object[arrayPos0].xpos
634
object[arrayPos0].xvel = -0x8000
635
object[arrayPos0].direction = FLIP_NONE
636
else
637
object[arrayPos0].xvel = 0x8000
638
object[arrayPos0].direction = FLIP_X
639
end if
640
object[arrayPos0].yvel = -0x40000
641
object[arrayPos0].priority = PRIORITY_ACTIVE
642
643
object.activeBalloons++
644
object.xvel = 0
645
object.yvel = -0x18000
646
object.state = MPZEGGMAN_WAITFORPOPPED
647
object.animation = MPZEGGANI_HIT
648
object.animationTimer = 0
649
object.invincibilityTimer = 64
650
PlaySfx(SfxName[Boss Hit], false)
651
end if
652
end if
653
end if
654
end if
655
next
656
end if
657
658
// Right Bounds
659
if object.state != MPZEGGMAN_ESCAPE
660
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
661
temp0 = player[currentPlayer].collisionRight
662
temp0 <<= 16
663
temp0 += player[currentPlayer].xpos
664
temp1 = stage.curXBoundary2
665
temp1 <<= 16
666
if temp0 > temp1
667
player[currentPlayer].xvel = 0
668
player[currentPlayer].speed = 0
669
player[currentPlayer].xpos = temp1
670
temp0 = player[currentPlayer].collisionRight
671
temp0 <<= 16
672
player[currentPlayer].xpos -= temp0
673
end if
674
next
675
end if
676
677
if object.exploding != false
678
temp0 = oscillation
679
temp0 &= 7
680
if temp0 == 0
681
Rand(temp0, 48)
682
temp0 -= 24
683
temp0 <<= 16
684
temp0 += object.xpos
685
686
Rand(temp1, 48)
687
temp1 -= 24
688
temp1 <<= 16
689
temp1 += object.ypos
690
691
CreateTempObject(TypeName[Explosion], 0, temp0, temp1)
692
object[tempObjectPos].drawOrder = 5
693
PlaySfx(SfxName[Explosion], false)
694
end if
695
end if
696
end event
697
698
699
event ObjectDraw
700
switch object.animation
701
default
702
case MPZEGGANI_INVISIBLE
703
break
704
705
case MPZEGGANI_IDLE
706
temp0 = object.animationTimer
707
temp0 >>= 3
708
object.animationTimer++
709
object.animationTimer &= 15
710
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
711
break
712
713
case MPZEGGANI_LAUGH
714
temp0 = object.animationTimer
715
temp0 &= 15
716
temp0 >>= 3
717
temp0 += 2
718
object.animationTimer++
719
if object.animationTimer == 50
720
object.animationTimer = 0
721
if player[0].animation != ANI_DYING
722
object.animation = MPZEGGANI_IDLE
723
end if
724
end if
725
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
726
break
727
728
case MPZEGGANI_HIT
729
temp0 = object.animationTimer
730
temp0 &= 1
731
temp0 += 2
732
object.animationTimer++
733
if object.animationTimer == 50
734
object.animationTimer = 0
735
object.animation = MPZEGGANI_IDLE
736
end if
737
DrawSpriteFX(4, FX_FLIP, object.xpos, object.ypos)
738
break
739
740
case MPZEGGANI_DEFEATED
741
temp0 = object.animationTimer
742
temp0 >>= 5
743
temp0 += 4
744
temp0 %= 5
745
object.animationTimer++
746
object.animationTimer &= 63
747
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
748
break
749
750
case MPZEGGANI_TOASTED
751
DrawSpriteFX(5, FX_FLIP, object.xpos, object.ypos)
752
break
753
754
case MPZEGGANI_PANIC
755
temp0 = object.animationTimer
756
temp0 >>= 3
757
object.animationTimer++
758
object.animationTimer &= 15
759
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
760
761
temp0 = object.animationTimer
762
temp0 >>= 2
763
temp0 &= 1
764
if temp0 == 1
765
DrawSpriteFX(16, FX_FLIP, object.xpos, object.ypos)
766
end if
767
break
768
769
end switch
770
771
if object.animation > MPZEGGANI_INVISIBLE
772
DrawSpriteFX(6, FX_FLIP, object.xpos, object.ypos)
773
DrawSpriteFX(7, FX_FLIP, object.xpos, object.ypos)
774
end if
775
776
switch object.flameAnim
777
default
778
case FLAME_INACTIVE
779
break
780
781
case FLAME_ACTIVE
782
GetTableValue(temp0, object.flameAnimTimer, MPZEggman_flameAnim1Table)
783
object.flameAnimTimer++
784
if object.flameAnimTimer == 6
785
object.flameAnimTimer = 0
786
end if
787
788
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
789
break
790
791
case FLAME_EXPLODE
792
temp0 = object.flameAnimTimer
793
temp0 /= 3
794
temp0 += 10
795
object.flameAnimTimer++
796
if object.flameAnimTimer >= 18
797
object.flameAnimTimer = 0
798
temp0 = 8
799
object.flameAnim = FLAME_ACTIVE
800
end if
801
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
802
break
803
804
end switch
805
end event
806
807
808
event ObjectStartup
809
CheckCurrentStageFolder("Zone09")
810
if checkResult == true
811
LoadSpriteSheet("MPZ/Objects.gif")
812
SpriteFrame(-28, -24, 44, 16, 195, 151) // Eggman Idle - Frame 1 - #0
813
SpriteFrame(-28, -24, 44, 16, 195, 168) // Eggman Idle - Frame 2 - #1
814
SpriteFrame(-28, -24, 44, 16, 240, 155) // Eggman Laugh - Frame 1 - #2
815
SpriteFrame(-28, -24, 44, 16, 240, 172) // Eggman Laugh - Frame 2 - #3
816
SpriteFrame(-28, -24, 44, 16, 285, 157) // Eggman Hit - #4
817
SpriteFrame(-28, -24, 44, 16, 285, 174) // Eggman Destroyed - #5
818
SpriteFrame(-24, -28, 56, 49, 220, 206) // EggMobile - #6
819
SpriteFrame(-32, -8, 8, 23, 190, 69) // Laser Cannon - #7
820
SpriteFrame(31, 4, 12, 8, 289, 125) // Flame Active - Frame 1 - #8
821
SpriteFrame(30, 2, 14, 12, 302, 125) // Flame Active - Frame 2 - #9
822
SpriteFrame(31, -2, 22, 14, 285, 192) // Flame Active - Frame 3 - #10
823
SpriteFrame(31, -9, 32, 26, 67, 75) // Flame Active - Frame 4 - #11
824
SpriteFrame(31, -2, 22, 14, 285, 192) // Flame Explode - Frame 1 - #12
825
SpriteFrame(31, -9, 32, 26, 67, 75) // Flame Explode - Frame 2 - #13
826
SpriteFrame(31, 4, 12, 8, 289, 125) // Flame Explode - Frame 3 - #14
827
SpriteFrame(30, 2, 14, 12, 302, 125) // Flame Explode - Frame 4 - #15
828
SpriteFrame(-3, -28, 11, 8, 332, 144) // Panic Sweat - Frame 1 - #16
829
SpriteFrame(0, 0, 1, 1, 332, 144) // Panic Sweat - Frame 2 - #17
830
831
MPZEggman_laserType = TypeName[Eggman Laser]
832
833
// But, MPZ isn't even in 2PVS...
834
if options.vsMode == true
835
foreach (TypeName[Eggman], arrayPos0, ALL_ENTITIES)
836
object[arrayPos0].type = TypeName[Blank Object]
837
next
838
end if
839
else
840
LoadSpriteSheet("MBZ/Objects.gif")
841
SpriteFrame(-28, -28, 60, 20, 1, 1) // Eggman Idle - Frame 1 - #0
842
SpriteFrame(-28, -28, 60, 20, 62, 1) // Eggman Idle - Frame 2 - #1
843
SpriteFrame(-28, -28, 60, 20, 1, 22) // Eggman Laugh - Frame 1 - #2
844
SpriteFrame(-28, -28, 60, 20, 62, 22) // Eggman Laugh - Frame 2 - #3
845
SpriteFrame(-28, -28, 60, 20, 1, 43) // Eggman Hit - #4
846
SpriteFrame(-28, -28, 60, 20, 62, 43) // Eggman Destroyed - #5
847
SpriteFrame(-24, -28, 56, 49, 255, 206) // EggMobile - #6
848
SpriteFrame(-32, -8, 8, 23, 316, 232) // Laser Cannon - #7
849
SpriteFrame(31, 4, 12, 8, 57, 90) // Flame Active - Frame 1 - #8
850
SpriteFrame(30, 2, 14, 12, 57, 99) // Flame Active - Frame 2 - #9
851
SpriteFrame(31, -2, 22, 14, 34, 97) // Flame Active - Frame 3 - #10
852
SpriteFrame(31, -9, 32, 26, 72, 86) // Flame Active - Frame 4 - #11
853
SpriteFrame(31, -2, 22, 14, 34, 97) // Flame Explode - Frame 1 - #12
854
SpriteFrame(31, -9, 32, 26, 72, 86) // Flame Explode - Frame 2 - #13
855
SpriteFrame(31, 4, 12, 8, 57, 90) // Flame Explode - Frame 3 - #14
856
SpriteFrame(30, 2, 14, 12, 57, 99) // Flame Explode - Frame 4 - #15
857
SpriteFrame(-3, -28, 11, 8, 45, 88) // Panic Sweat - Frame 1 - #16
858
SpriteFrame(0, 0, 0, 0, 7, 2) // Panic Sweat - Frame 2 - #17
859
860
MPZEggman_laserType = TypeName[Eggman Laser 2]
861
end if
862
end event
863
864
865
// ========================
866
// Editor Events
867
// ========================
868
869
event RSDKDraw
870
DrawSprite(0)
871
DrawSprite(6)
872
DrawSprite(7)
873
end event
874
875
876
event RSDKLoad
877
CheckCurrentStageFolder("Zone09")
878
if checkResult == true
879
LoadSpriteSheet("MPZ/Objects.gif")
880
SpriteFrame(-28, -24, 44, 16, 195, 151) // Eggman Idle - Frame 1 - #0
881
SpriteFrame(-28, -24, 44, 16, 195, 168) // Eggman Idle - Frame 2 - #1
882
SpriteFrame(-28, -24, 44, 16, 240, 155) // Eggman Laugh - Frame 1 - #2
883
SpriteFrame(-28, -24, 44, 16, 240, 172) // Eggman Laugh - Frame 2 - #3
884
SpriteFrame(-28, -24, 44, 16, 285, 157) // Eggman Hit - #4
885
SpriteFrame(-28, -24, 44, 16, 285, 174) // Eggman Destroyed - #5
886
SpriteFrame(-24, -28, 56, 49, 220, 206) // EggMobile - #6
887
SpriteFrame(-32, -8, 8, 23, 190, 69) // Laser Cannon - #7
888
SpriteFrame(31, 4, 12, 8, 289, 125) // Flame Active - Frame 1 - #8
889
SpriteFrame(30, 2, 14, 12, 302, 125) // Flame Active - Frame 2 - #9
890
SpriteFrame(31, -2, 22, 14, 285, 192) // Flame Active - Frame 3 - #10
891
SpriteFrame(31, -9, 32, 26, 67, 75) // Flame Active - Frame 4 - #11
892
SpriteFrame(31, -2, 22, 14, 285, 192) // Flame Explode - Frame 1 - #12
893
SpriteFrame(31, -9, 32, 26, 67, 75) // Flame Explode - Frame 2 - #13
894
SpriteFrame(31, 4, 12, 8, 289, 125) // Flame Explode - Frame 3 - #14
895
SpriteFrame(30, 2, 14, 12, 302, 125) // Flame Explode - Frame 4 - #15
896
SpriteFrame(-3, -28, 11, 8, 332, 144) // Panic Sweat - Frame 1 - #16
897
SpriteFrame(0, 0, 1, 1, 332, 144) // Panic Sweat - Frame 2 - #17
898
else
899
LoadSpriteSheet("MBZ/Objects.gif")
900
SpriteFrame(-28, -28, 60, 20, 1, 1) // Eggman Idle - Frame 1 - #0
901
SpriteFrame(-28, -28, 60, 20, 62, 1) // Eggman Idle - Frame 2 - #1
902
SpriteFrame(-28, -28, 60, 20, 1, 22) // Eggman Laugh - Frame 1 - #2
903
SpriteFrame(-28, -28, 60, 20, 62, 22) // Eggman Laugh - Frame 2 - #3
904
SpriteFrame(-28, -28, 60, 20, 1, 43) // Eggman Hit - #4
905
SpriteFrame(-28, -28, 60, 20, 62, 43) // Eggman Destroyed - #5
906
SpriteFrame(-24, -28, 56, 49, 255, 206) // EggMobile - #6
907
SpriteFrame(-32, -8, 8, 23, 316, 232) // Laser Cannon - #7
908
SpriteFrame(31, 4, 12, 8, 57, 90) // Flame Active - Frame 1 - #8
909
SpriteFrame(30, 2, 14, 12, 57, 99) // Flame Active - Frame 2 - #9
910
SpriteFrame(31, -2, 22, 14, 34, 97) // Flame Active - Frame 3 - #10
911
SpriteFrame(31, -9, 32, 26, 72, 86) // Flame Active - Frame 4 - #11
912
SpriteFrame(31, -2, 22, 14, 34, 97) // Flame Explode - Frame 1 - #12
913
SpriteFrame(31, -9, 32, 26, 72, 86) // Flame Explode - Frame 2 - #13
914
SpriteFrame(31, 4, 12, 8, 57, 90) // Flame Explode - Frame 3 - #14
915
SpriteFrame(30, 2, 14, 12, 57, 99) // Flame Explode - Frame 4 - #15
916
SpriteFrame(-3, -28, 11, 8, 45, 88) // Panic Sweat - Frame 1 - #16
917
SpriteFrame(0, 0, 0, 0, 7, 2) // Panic Sweat - Frame 2 - #17
918
end if
919
920
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
921
end event
922
923