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/MCZ/Eggman.txt
1487 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 MCZEggman as a prefix here because there's like 12 "Eggman" objects in the game so it's less confusing this way
9
10
// ========================
11
// Aliases
12
// ========================
13
14
private alias object.value0 : object.timer
15
private alias object.value1 : object.originPos.y
16
private alias object.value2 : object.oscillationAngle
17
private alias object.value3 : object.health
18
private alias object.value4 : object.invincibilityTimer
19
private alias object.value5 : object.exploding
20
21
private alias object.value6 : object.boundsM
22
private alias object.value7 : object.boundsL
23
private alias object.value8 : object.boundsR
24
private alias object.value9 : object.boundsT
25
private alias object.value10 : object.boundsB
26
27
// value11 is unused
28
29
private alias object.value12 : object.flameAnimation
30
private alias object.value13 : object.flameAnimTimer
31
32
private alias object.value14 : object.lightsFrame
33
34
private alias object.value15 : object.drillOffsetL.x
35
private alias object.value16 : object.drillOffsetR.x
36
private alias object.value17 : object.drillOffset.y
37
private alias object.value18 : object.drillFrame
38
private alias object.value19 : object.drillAnimSpeed
39
40
private alias object.value20 : object.shakeStopPos
41
private alias object.value21 : object.shakeTimer
42
43
// Eggman States
44
private alias 0 : MCZEGGMAN_AWAITPLAYER
45
private alias 1 : MCZEGGMAN_ENTERDELAY
46
private alias 2 : MCZEGGMAN_ENTEREGGMAN
47
private alias 3 : MCZEGGMAN_RISE
48
private alias 4 : MCZEGGMAN_LANDINGDRILLTURN
49
private alias 5 : MCZEGGMAN_RISINGDRILLTURN
50
private alias 6 : MCZEGGMAN_ADVANCELEFT
51
private alias 7 : MCZEGGMAN_ADVANCERIGHT
52
private alias 8 : MCZEGGMAN_EXPLODING
53
private alias 9 : MCZEGGMAN_DEFEATFALL
54
private alias 10 : MCZEGGMAN_DEFEATRISE
55
private alias 11 : MCZEGGMAN_FLEE
56
private alias 12 : MCZEGGMAN_ESCAPE
57
58
// Eggman Animations
59
private alias 0 : MCZEGGANI_INVISIBLE
60
private alias 1 : MCZEGGANI_IDLE
61
private alias 2 : MCZEGGANI_LAUGH
62
private alias 3 : MCZEGGANI_HIT
63
private alias 4 : MCZEGGANI_DEFEATED
64
private alias 5 : MCZEGGANI_TOASTED
65
private alias 6 : MCZEGGANI_PANIC
66
67
// Jet States
68
private alias 0 : FLAMEANI_INACITVE
69
private alias 1 : FLAMEANI_ACITVE
70
71
// Drill states
72
private alias 0 : DRILL_ACTIVE
73
private alias 1 : DRILL_FELLOFF
74
75
// Player aliases
76
private alias object.xpos : player.xpos
77
private alias object.xvel : player.xvel
78
private alias object.speed : player.speed
79
private alias object.animation : player.animation
80
private alias object.collisionRight : player.collisionRight
81
private alias object.value40 : player.hitboxLeft
82
private alias object.value38 : player.hitboxTop
83
private alias object.value41 : player.hitboxRight
84
private alias object.value39 : player.hitboxBottom
85
86
// Music Events
87
private alias 26 : SLOT_MUSICEVENT_BOSS
88
89
private alias 0 : MUSICEVENT_FADETOBOSS
90
private alias 1 : MUSICEVENT_FADETOSTAGE
91
92
93
// ========================
94
// Function Declarations
95
// ========================
96
97
reserve function MCZEggman_Oscillate
98
reserve function MCZEggman_UpdateDrills
99
reserve function MCZEggman_ShakeScreen
100
101
102
// ========================
103
// Tables
104
// ========================
105
106
private table MCZEggman_flameAnimTimerTable
107
9, 9, 10, 10
108
end table
109
110
111
// ========================
112
// Function Definitions
113
// ========================
114
115
private function MCZEggman_Oscillate
116
// Used after getting defeated
117
Sin256(object.ypos, object.oscillationAngle)
118
object.ypos <<= 10
119
object.ypos += object.originPos.y
120
object.oscillationAngle += 2
121
object.oscillationAngle &= 0xFF
122
end function
123
124
125
private function MCZEggman_UpdateDrills
126
// Set the two drill's angles so that they can properly rotate
127
object[-1].angle = object.rotation
128
object[+1].angle = object.rotation
129
130
object[-1].frame = object.drillFrame
131
object[-1].frame >>= 2
132
133
if object.rotation > 88
134
object[-1].frame += 3
135
temp0 = object.rotation
136
temp0 -= 128
137
temp0 &= 511
138
else
139
temp0 = object.rotation
140
end if
141
142
// The two drills should use the same frame
143
object[+1].frame = object[-1].frame
144
145
// Animation of the drills is done here
146
object.drillFrame += object.drillAnimSpeed
147
object.drillFrame %= 12
148
149
object[-1].xpos = object.xpos
150
object[+1].xpos = object.xpos
151
152
if object.direction == FLIP_NONE
153
object[-1].xpos += object.drillOffsetL.x
154
object[+1].xpos += object.drillOffsetR.x
155
object[-1].rotation = 0x200
156
object[-1].rotation -= temp0
157
object[-1].rotation &= 0x1FF
158
object[+1].rotation = object[-1].rotation
159
else
160
object[-1].xpos -= object.drillOffsetL.x
161
object[+1].xpos -= object.drillOffsetR.x
162
object[-1].rotation = temp0
163
object[+1].rotation = temp0
164
end if
165
166
object[-1].ypos = object.ypos
167
object[-1].ypos += object.drillOffset.y
168
object[-1].direction = object.direction
169
170
object[+1].ypos = object.ypos
171
object[+1].ypos += object.drillOffset.y
172
object[+1].direction = object.direction
173
end function
174
175
176
private function MCZEggman_ShakeScreen
177
// Called when "burrowing" in the rock in order to shake the screen and spawn rocks
178
if object.ypos < object.shakeStopPos
179
object.shakeTimer++
180
object.shakeTimer %= 40
181
if object.shakeTimer == 8
182
PlaySfx(SfxName[Rumble], false)
183
end if
184
185
temp0 = object.shakeTimer
186
temp0 &= 3
187
if temp0 == 0
188
screen.shakeY = 2
189
end if
190
191
temp0 = oscillation
192
temp0 &= 7
193
if temp0 == 0
194
temp0 = oscillation
195
temp0 &= 15
196
if temp0 == 0
197
temp0 = 1
198
else
199
temp0 = 0
200
end if
201
202
Rand(temp1, screen.xsize)
203
temp2 = object.shakeTimer
204
temp2 <<= 4
205
temp1 += temp2
206
temp1 %= screen.xsize
207
temp1 -= screen.xcenter
208
temp1 <<= 16
209
temp1 += object.boundsM
210
temp2 = object.boundsT
211
temp2 += 0x900000
212
CreateTempObject(TypeName[Boss Rock], temp0, temp1, temp2)
213
end if
214
end if
215
end function
216
217
218
// ========================
219
// Events
220
// ========================
221
222
event ObjectUpdate
223
switch object.state
224
case MCZEGGMAN_AWAITPLAYER
225
temp0 = object[-1].xpos
226
temp0 -= 0x100000
227
if player[0].xpos > temp0
228
// Set screen bounds
229
// object[-1] is drill A's slot, [+1] is drill B's slot
230
temp0 = object[-1].ixpos
231
temp0 -= screen.xcenter
232
stage.newXBoundary1 = temp0
233
234
temp0 = object[-1].ixpos
235
temp0 += screen.xcenter
236
stage.newXBoundary2 = temp0
237
238
temp0 = stage.newYBoundary2
239
temp0 -= screen.ysize
240
stage.newYBoundary1 = temp0
241
242
object.boundsM = object[-1].xpos
243
244
object.boundsL = -112
245
object.boundsL *= screen.xsize
246
object.boundsL /= 320
247
object.boundsL <<= 16
248
249
object.boundsR = object.boundsL
250
FlipSign(object.boundsR)
251
252
object.boundsL += object[-1].xpos
253
object.boundsR += object[-1].xpos
254
255
object.boundsT = object[-1].ypos
256
object.boundsT -= 0x1200000
257
258
object.boundsB = object[-1].ypos
259
object.boundsB -= 0x200000
260
261
object.shakeStopPos = object[+1].ypos
262
object.shakeStopPos += 0x280000
263
264
object.xpos = 16
265
object.xpos *= screen.xsize
266
object.xpos /= 320
267
object.xpos <<= 16
268
object.xpos += object[-1].xpos
269
270
object.ypos = object.boundsT
271
272
object.animation = MCZEGGANI_IDLE
273
274
// Start the boss music
275
ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOBOSS, 0, 0)
276
object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
277
278
// Spawn the drills
279
CheckCurrentStageFolder("Zone06")
280
if checkResult == true
281
// In Mystic Cave - no special action needed here
282
object[-1].type = TypeName[Eggman Drill]
283
object[+1].type = TypeName[Eggman Drill]
284
else
285
// In EGZ, the `Eggman Drill` namespace is already taken up by another object so use a renamed variant
286
object[-1].type = TypeName[Eggman Drill 2]
287
object[+1].type = TypeName[Eggman Drill 2]
288
end if
289
290
object.lightsFrame = 6
291
292
object.flameAnimation = FLAMEANI_ACITVE
293
294
object.drillOffsetL.x = -0x120000
295
object.drillOffsetR.x = 0x160000
296
CallFunction(MCZEggman_UpdateDrills) // Called to init the drills' other values
297
298
object.drillOffset.y = 0
299
300
#platform: USE_STANDALONE
301
object.health = 8
302
#endplatform
303
#platform: USE_ORIGINS
304
if game.bossOneLife == false
305
object.health = 8
306
else
307
object.health = 1
308
end if
309
#endplatform
310
311
object.priority = PRIORITY_ACTIVE
312
object.state = MCZEGGMAN_ENTERDELAY
313
end if
314
break
315
316
case MCZEGGMAN_ENTERDELAY
317
object.timer++
318
if object.timer == 60
319
object.timer = 0
320
object.yvel = 0xC000
321
object.drillAnimSpeed = 2
322
object.state = MCZEGGMAN_ENTEREGGMAN
323
end if
324
break
325
326
case MCZEGGMAN_ENTEREGGMAN
327
object.ypos += object.yvel
328
if object.ypos >= object.boundsB
329
object.ypos = object.boundsB
330
object.lightsFrame = 7
331
object.flameAnimation = FLAMEANI_INACITVE
332
object.drillAnimSpeed = 1
333
if player[0].xpos > object.xpos
334
object.direction = FLIP_X
335
end if
336
object.state = MCZEGGMAN_LANDINGDRILLTURN
337
end if
338
339
CallFunction(MCZEggman_UpdateDrills)
340
CallFunction(MCZEggman_ShakeScreen)
341
break
342
343
case MCZEGGMAN_RISE
344
object.ypos += object.yvel
345
if object.ypos <= object.boundsT
346
object.ypos = object.boundsT
347
object.yvel = 0x10000
348
if player[0].xpos > object.boundsM
349
object.xpos = object.boundsL
350
object.direction = FLIP_X
351
else
352
object.xpos = object.boundsR
353
object.direction = FLIP_NONE
354
end if
355
object.state = MCZEGGMAN_ENTEREGGMAN
356
end if
357
358
CallFunction(MCZEggman_UpdateDrills)
359
CallFunction(MCZEggman_ShakeScreen)
360
break
361
362
case MCZEGGMAN_LANDINGDRILLTURN
363
// Turning the drills horizontally after burrowing out
364
object.timer++
365
if object.timer == 100
366
object.timer = 0
367
object.drillAnimSpeed = 2
368
if object.direction == FLIP_NONE
369
object.xvel = -0x20000
370
object.state = MCZEGGMAN_ADVANCELEFT
371
else
372
object.xvel = 0x20000
373
object.state = MCZEGGMAN_ADVANCERIGHT
374
end if
375
end if
376
377
if object.timer > 40
378
if object.rotation < 128
379
object.rotation += 4
380
end if
381
382
temp0 = 128
383
temp0 -= object.rotation
384
temp0 <<= 9
385
temp1 = object.rotation
386
temp1 <<= 9
387
388
object.drillOffsetL.x = -18
389
object.drillOffsetR.x = 22
390
object.drillOffsetL.x *= temp0
391
object.drillOffsetR.x *= temp0
392
object.drillOffset.y = 0
393
object.drillOffset.y *= temp0
394
395
temp2 = -6
396
temp3 = 34
397
temp2 *= temp1
398
temp3 *= temp1
399
temp4 = 4
400
temp4 *= temp1
401
402
object.drillOffsetL.x += temp2
403
object.drillOffsetR.x += temp3
404
object.drillOffset.y += temp4
405
end if
406
407
CallFunction(MCZEggman_UpdateDrills)
408
break
409
410
case MCZEGGMAN_RISINGDRILLTURN
411
// Turning the drills vertically in order to burrow back into the roof of rocks
412
object.timer++
413
if object.timer == 100
414
object.timer = 0
415
object.drillAnimSpeed = 2
416
object.yvel = -0xC000
417
object.lightsFrame = 6
418
object.state = MCZEGGMAN_RISE
419
end if
420
421
if object.timer > 40
422
if object.rotation > 0
423
object.rotation -= 4
424
end if
425
426
temp0 = 128
427
temp0 -= object.rotation
428
temp0 <<= 9
429
temp1 = object.rotation
430
temp1 <<= 9
431
432
object.drillOffsetL.x = -18
433
object.drillOffsetR.x = 22
434
object.drillOffsetL.x *= temp0
435
object.drillOffsetR.x *= temp0
436
object.drillOffset.y = 0
437
object.drillOffset.y *= temp0
438
439
temp2 = -6
440
temp3 = 34
441
temp2 *= temp1
442
temp3 *= temp1
443
temp4 = 4
444
temp4 *= temp1
445
446
object.drillOffsetL.x += temp2
447
object.drillOffsetR.x += temp3
448
object.drillOffset.y += temp4
449
end if
450
451
CallFunction(MCZEggman_UpdateDrills)
452
break
453
454
case MCZEGGMAN_ADVANCELEFT
455
object.xpos += object.xvel
456
if object.xpos <= object.boundsL
457
object.xpos = object.boundsL
458
object.flameAnimation = FLAMEANI_ACITVE
459
object.drillAnimSpeed = 1
460
object.state = MCZEGGMAN_RISINGDRILLTURN
461
end if
462
463
CallFunction(MCZEggman_UpdateDrills)
464
break
465
466
case MCZEGGMAN_ADVANCERIGHT
467
object.xpos += object.xvel
468
if object.xpos >= object.boundsR
469
object.xpos = object.boundsR
470
object.flameAnimation = FLAMEANI_ACITVE
471
object.drillAnimSpeed = 1
472
object.state = MCZEGGMAN_RISINGDRILLTURN
473
end if
474
475
CallFunction(MCZEggman_UpdateDrills)
476
break
477
478
case MCZEGGMAN_EXPLODING
479
object.timer++
480
481
if object.timer == 60
482
if object.direction == FLIP_NONE
483
object[-1].xvel = -0x10000
484
else
485
object[-1].xvel = 0x10000
486
end if
487
object[-1].yvel = -0x20000
488
object[-1].state = DRILL_FELLOFF
489
end if
490
491
if object.timer == 120
492
if object.direction == FLIP_NONE
493
object[+1].xvel = 0x10000
494
else
495
object[+1].xvel = -0x10000
496
end if
497
object[+1].yvel = -0x20000
498
object[+1].state = DRILL_FELLOFF
499
end if
500
501
if object.timer == 180
502
object.timer = 0
503
object.animation = MCZEGGANI_TOASTED
504
object.exploding = false
505
object.yvel = 0
506
object.state = MCZEGGMAN_DEFEATFALL
507
ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOSTAGE, 0, 0)
508
object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
509
temp0 = tileLayer[0].xsize
510
temp0 <<= 7
511
stage.newXBoundary2 = temp0
512
end if
513
break
514
515
case MCZEGGMAN_DEFEATFALL
516
object.ypos += object.yvel
517
object.yvel += 0x1800
518
object.timer++
519
if object.timer == 16
520
object.yvel = 0
521
object.timer = 0
522
object.animationTimer = 0
523
object.state++
524
end if
525
break
526
527
case MCZEGGMAN_DEFEATRISE
528
if object.timer < 24
529
object.ypos += object.yvel
530
object.yvel -= 0x800
531
object.timer++
532
else
533
object.timer = 0
534
object.yvel = 0
535
object.originPos.y = object.ypos
536
object.state++
537
end if
538
break
539
540
case MCZEGGMAN_FLEE
541
CallFunction(MCZEggman_Oscillate)
542
if object.timer < 8
543
object.timer++
544
else
545
object.timer = 0
546
object.animation = MCZEGGANI_PANIC
547
object.flameAnimation = FLAMEANI_ACITVE
548
object.animationTimer = 0
549
object.direction = FLIP_X
550
object.priority = PRIORITY_ACTIVE
551
552
#platform: USE_STANDALONE
553
temp0 = tileLayer[0].xsize
554
temp0 <<= 7
555
stage.newXBoundary2 = temp0
556
#endplatform
557
558
object.state++
559
end if
560
break
561
562
case MCZEGGMAN_ESCAPE
563
object.xpos += 0x40000
564
object.originPos.y -= 0x4000
565
CallFunction(MCZEggman_Oscillate)
566
if object.outOfBounds == true
567
ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, 0, 0)
568
end if
569
break
570
571
end switch
572
573
if object.health != 0
574
if object.invincibilityTimer > 0
575
// Update boss flashing
576
object.invincibilityTimer--
577
GetBit(temp0, object.invincibilityTimer, 0)
578
if temp0 == true
579
SetPaletteEntry(0, 192, 0xE0E0E0)
580
else
581
SetPaletteEntry(0, 192, 0x000000)
582
end if
583
end if
584
585
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
586
if object.invincibilityTimer < 32
587
CheckEqual(player[currentPlayer].animation, ANI_HURT)
588
temp0 = checkResult
589
CheckEqual(player[currentPlayer].animation, ANI_DYING)
590
temp0 |= checkResult
591
CheckEqual(player[currentPlayer].animation, ANI_DROWNING)
592
temp0 |= checkResult
593
if temp0 != false
594
if object.animation != MCZEGGANI_LAUGH
595
// If the player just got hurt, then start chuckling
596
object.animation = MCZEGGANI_LAUGH
597
object.animationTimer = 0
598
end if
599
end if
600
601
BoxCollisionTest(C_TOUCH, object.entityPos, -24, -24, 24, 24, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)
602
if checkResult == true
603
CallFunction(Player_CheckHit)
604
if checkResult == true
605
object.health--
606
if object.health == 0
607
#platform: USE_ORIGINS
608
CallNativeFunction2(NotifyCallback, NOTIFY_KILL_BOSS, 0)
609
CallNativeFunction2(NotifyCallback, NOTIFY_BOSS_END, 1)
610
#endplatform
611
612
player.score += 1000
613
object.timer = 0
614
object.animation = MCZEGGANI_DEFEATED
615
object.flameAnimation = FLAMEANI_INACITVE
616
object.animationTimer = 0
617
object.exploding = true
618
object.originPos.y = object.ypos
619
object.state = MCZEGGMAN_EXPLODING
620
object[-1].interaction = false
621
object[+1].interaction = false
622
SetPaletteEntry(0, 192, 0x000000)
623
else
624
object.animation = MCZEGGANI_HIT
625
object.animationTimer = 0
626
object.invincibilityTimer = 64
627
PlaySfx(SfxName[Boss Hit], false)
628
end if
629
end if
630
end if
631
end if
632
next
633
end if
634
635
if object.state != MCZEGGMAN_ESCAPE
636
// Enforce the right wall
637
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
638
temp0 = player[currentPlayer].collisionRight
639
temp0 <<= 16
640
temp0 += player[currentPlayer].xpos
641
temp1 = stage.curXBoundary2
642
temp1 <<= 16
643
if temp0 > temp1
644
player[currentPlayer].xvel = 0
645
player[currentPlayer].speed = 0
646
player[currentPlayer].xpos = temp1
647
temp0 = player[currentPlayer].collisionRight
648
temp0 <<= 16
649
player[currentPlayer].xpos -= temp0
650
end if
651
next
652
end if
653
654
if object.exploding == true
655
temp0 = oscillation
656
temp0 &= 7
657
if temp0 == 0
658
Rand(temp0, 48)
659
temp0 -= 24
660
temp0 <<= 16
661
temp0 += object.xpos
662
Rand(temp1, 48)
663
temp1 -= 24
664
temp1 <<= 16
665
temp1 += object.ypos
666
CreateTempObject(TypeName[Explosion], 0, temp0, temp1)
667
object[tempObjectPos].drawOrder = 5
668
PlaySfx(SfxName[Explosion], false)
669
end if
670
end if
671
end event
672
673
674
event ObjectDraw
675
676
// First draw the ship
677
DrawSpriteFX(6, FX_FLIP, object.xpos, object.ypos)
678
if object.lightsFrame == 7 // ??? - This could be a simple `DrawSpriteFX(object.lightsFrame, ...)` instead, as the variable's set up like that
679
DrawSpriteFX(7, FX_FLIP, object.xpos, object.ypos)
680
end if
681
682
// Then draw Eggman himself, he's animated here as well
683
switch object.animation
684
case MCZEGGANI_INVISIBLE
685
default
686
break
687
688
case MCZEGGANI_IDLE
689
temp0 = object.animationTimer
690
temp0 >>= 3
691
object.animationTimer++
692
object.animationTimer &= 15
693
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
694
break
695
696
case MCZEGGANI_LAUGH
697
temp0 = object.animationTimer
698
temp0 &= 15
699
temp0 >>= 3
700
temp0 += 2
701
object.animationTimer++
702
if object.animationTimer == 50
703
object.animationTimer = 0
704
705
if player[0].animation != ANI_DYING // If P1 is dead, continue laughing
706
object.animation = MCZEGGANI_IDLE
707
end if
708
end if
709
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
710
break
711
712
case MCZEGGANI_HIT
713
temp0 = object.animationTimer
714
temp0 &= 1
715
temp0 += 2
716
object.animationTimer++
717
if object.animationTimer == 50
718
object.animationTimer = 0
719
object.animation = MCZEGGANI_IDLE
720
end if
721
DrawSpriteFX(4, FX_FLIP, object.xpos, object.ypos)
722
break
723
724
case MCZEGGANI_DEFEATED
725
temp0 = object.animationTimer
726
temp0 >>= 5
727
temp0 += 4
728
temp0 %= 5
729
object.animationTimer++
730
object.animationTimer &= 63
731
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
732
break
733
734
case MCZEGGANI_TOASTED
735
DrawSpriteFX(5, FX_FLIP, object.xpos, object.ypos)
736
break
737
738
case MCZEGGANI_PANIC
739
temp0 = object.animationTimer
740
temp0 >>= 3
741
object.animationTimer++
742
object.animationTimer &= 15
743
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
744
temp0 = object.animationTimer
745
temp0 >>= 2
746
temp0 &= 1
747
if temp0 == 1
748
DrawSpriteFX(11, FX_FLIP, object.xpos, object.ypos)
749
end if
750
break
751
752
end switch
753
754
switch object.flameAnimation
755
case FLAMEANI_INACITVE
756
// The jet isn't "on" so just draw the frame without any fire coming from it
757
DrawSpriteFX(8, FX_FLIP, object.xpos, object.ypos)
758
break
759
760
case FLAMEANI_ACITVE
761
// The jet is active, animate it
762
GetTableValue(temp0, object.flameAnimTimer, MCZEggman_flameAnimTimerTable)
763
object.flameAnimTimer++
764
object.flameAnimTimer &= 3
765
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
766
break
767
768
end switch
769
end event
770
771
772
event ObjectStartup
773
CheckCurrentStageFolder("Zone06")
774
775
if checkResult == true
776
LoadSpriteSheet("MCZ/Objects.gif")
777
SpriteFrame(-26, -24, 44, 16, 34, 48) // 0 - Robotnik normal frame 1
778
SpriteFrame(-26, -24, 44, 16, 79, 48) // 1 - Robotnik normal frame 2
779
SpriteFrame(-26, -24, 44, 16, 34, 65) // 2 - Robotnik laughing frame 2
780
SpriteFrame(-26, -24, 44, 16, 79, 65) // 3 - Robotnik laughing frame 2
781
SpriteFrame(-26, -24, 44, 16, 34, 82) // 4 - Robotnik hurt frame 2
782
SpriteFrame(-26, -24, 44, 16, 79, 82) // 5 - Robotnik hurt frame 2
783
SpriteFrame(-38, -37, 70, 58, 74, 197) // 6 - Ship, lights off frame
784
SpriteFrame(-34, 0, 17, 16, 5, 234) // 7 - Ship, lights on frame
785
SpriteFrame(-8, 18, 24, 8, 207, 152) // 8 - Jet frame 1
786
SpriteFrame(-8, 18, 24, 16, 190, 165) // 9 - Jet frame 2
787
SpriteFrame(-8, 18, 24, 32, 176, 132) // 10 - Jet frame 3
788
SpriteFrame(3, -28, 11, 8, 76, 132) // 11 - Panic frame
789
790
if options.vsMode == true
791
// No bosses in 2P
792
foreach (TypeName[Eggman], arrayPos0, ALL_ENTITIES)
793
object[arrayPos0].type = TypeName[Blank Object]
794
next
795
end if
796
else
797
LoadSpriteSheet("MBZ/Objects.gif")
798
SpriteFrame(-26, -24, 44, 16, 1, 5)
799
SpriteFrame(-26, -24, 44, 16, 62, 5)
800
SpriteFrame(-26, -24, 44, 16, 1, 26)
801
SpriteFrame(-26, -24, 44, 16, 62, 26)
802
SpriteFrame(-26, -24, 44, 16, 1, 47)
803
SpriteFrame(-26, -24, 44, 16, 62, 47)
804
SpriteFrame(-38, -37, 70, 58, 182, 197)
805
SpriteFrame(-34, 0, 17, 16, 182, 180)
806
SpriteFrame(-8, 18, 24, 8, 388, 227)
807
SpriteFrame(-8, 18, 24, 16, 388, 210)
808
SpriteFrame(-8, 18, 24, 32, 388, 177)
809
SpriteFrame(3, -28, 11, 8, 45, 88)
810
end if
811
end event
812
813
814
// ========================
815
// Editor Events
816
// ========================
817
818
event RSDKDraw
819
DrawSprite(1) // ship
820
DrawSprite(0) // robotnik
821
822
if editor.showGizmos == true
823
editor.drawingOverlay = true
824
825
// TODO: boss stuff
826
827
editor.drawingOverlay = false
828
end if
829
end event
830
831
832
event RSDKLoad
833
CheckCurrentStageFolder("Zone06")
834
if checkResult == true
835
LoadSpriteSheet("MCZ/Objects.gif")
836
SpriteFrame(-26, -24, 44, 16, 34, 48)
837
SpriteFrame(-38, -37, 70, 58, 74, 197)
838
else
839
LoadSpriteSheet("MBZ/Objects.gif")
840
SpriteFrame(-26, -24, 44, 16, 1, 5)
841
SpriteFrame(-38, -37, 70, 58, 182, 197)
842
end if
843
844
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
845
end event
846
847