Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/GHZ/Eggman.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: GHZ Eggman Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// Using GHZEggman as a prefix here because there's like 6 "Eggman" objects in the game so its less confusing this way
9
10
// ========================
11
// Aliases
12
// ========================
13
14
private alias object.value0 : object.timer
15
private alias object.value1 : object.health
16
private alias object.value2 : object.arenaBorder
17
private alias object.value3 : object.oscillatePos
18
private alias object.value4 : object.originY
19
private alias object.value5 : object.arenaOffset
20
private alias object.value6 : object.ballPos
21
private alias object.value7 : object.lightPos
22
23
// object[-1] (WreckingBall) Aliases,
24
// this object is structured like a v3 one so these are all used here instead of in WreckingBall
25
private alias object.value1 : object.initialMoveVel
26
private alias object.value2 : object.moveVelocity
27
private alias object.value3 : object.arenaSize
28
private alias object.value4 : object.invincibilityTimer
29
private alias object.value5 : object.gravityStrength
30
private alias object.value6 : object.flameAnim
31
private alias object.value7 : object.flameAnimTimer
32
33
// Player Aliases
34
private alias object.value40 : player.hitboxLeft
35
private alias object.value38 : player.hitboxTop
36
private alias object.value41 : player.hitboxRight
37
private alias object.value39 : player.hitboxBottom
38
39
// Eggman States
40
private alias 0 : GHZEGGMAN_AWAITPLAYER
41
private alias 1 : GHZEGGMAN_ENTEREGGMAN
42
private alias 2 : GHZEGGMAN_MOVEINTOPLACE
43
private alias 3 : GHZEGGMAN_LOWERBALL
44
private alias 4 : GHZEGGMAN_INITIALSWING
45
private alias 5 : GHZEGGMAN_MOVERIGHT
46
private alias 6 : GHZEGGMAN_MOVELEFT
47
private alias 7 : GHZEGGMAN_EXPLODE
48
private alias 8 : GHZEGGMAN_DEFEATFALL
49
private alias 9 : GHZEGGMAN_DEFEATRISE
50
private alias 10 : GHZEGGMAN_FLEE
51
private alias 11 : GHZEGGMAN_ESCAPE
52
53
// Wrecking Ball States
54
private alias 0 : WRECKINGBALL_INACTIVE
55
private alias 1 : WRECKINGBALL_ACTIVE
56
private alias 2 : WRECKINGBALL_EXPLODE
57
58
// Eggman Animations
59
private alias 0 : GHZEGGANI_INVISIBLE
60
private alias 1 : GHZEGGANI_IDLE
61
private alias 2 : GHZEGGANI_LAUGH
62
private alias 3 : GHZEGGANI_HIT
63
private alias 4 : GHZEGGANI_DEFEATED
64
private alias 5 : GHZEGGANI_TOASTED
65
private alias 6 : GHZEGGANI_PANIC
66
67
// Flame Animations
68
private alias 0 : FLAME_INACTIVE
69
private alias 1 : FLAME_ACTIVE
70
private alias 2 : FLAME_EXPLODE
71
72
// Player Aliases
73
private alias object.xpos : player.xpos
74
private alias object.xvel : player.xvel
75
private alias object.speed: player.speed
76
private alias object.animation : player.animation
77
private alias object.collisionRight : player.collisionRight
78
79
// Music Events
80
private alias 26 : SLOT_MUSICEVENT_BOSS
81
82
private alias 0 : MUSICEVENT_FADETOBOSS
83
private alias 1 : MUSICEVENT_FADETOSTAGE
84
private alias 2 : MUSICEVENT_TRANSITION
85
86
87
// ========================
88
// Function Declarations
89
// ========================
90
91
reserve function GHZEggman_Oscillate
92
reserve function GHZEggman_FlyAway
93
reserve function GHZEggman_SwingBall
94
95
96
// ========================
97
// Function Definitions
98
// ========================
99
100
private function GHZEggman_Oscillate
101
object.rotation += 2
102
object.rotation &= 511
103
temp0 = object.rotation
104
temp0 <<= 1
105
temp0 += 128
106
Sin(object.ypos, temp0)
107
object.ypos <<= 9
108
object.ypos += object.originY
109
end function
110
111
112
private function GHZEggman_FlyAway
113
object.rotation += 4
114
object.rotation &= 511
115
Sin(object.ypos, object.rotation)
116
object.ypos <<= 9
117
object.ypos += object.oscillatePos
118
end function
119
120
121
private function GHZEggman_SwingBall
122
// Lights
123
object[-6].xpos = object.xpos
124
object[-6].ypos = object.ypos
125
object[-6].ypos += object.lightPos
126
Sin(temp1, object.rotation)
127
temp1 >>= 2
128
temp1 += 128
129
130
// Chain 1
131
temp0 = 16
132
Cos(object[-5].xpos, temp1)
133
object[-5].xpos *= temp0
134
object[-5].xpos <<= 7
135
object[-5].xpos += object[-6].xpos
136
Sin(object[-5].ypos, temp1)
137
object[-5].ypos *= temp0
138
object[-5].ypos <<= 7
139
object[-5].ypos += object[-6].ypos
140
141
// Chain 2
142
temp0 += 16
143
Cos(object[-4].xpos, temp1)
144
object[-4].xpos *= temp0
145
object[-4].xpos <<= 7
146
object[-4].xpos += object[-6].xpos
147
Sin(object[-4].ypos, temp1)
148
object[-4].ypos *= temp0
149
object[-4].ypos <<= 7
150
object[-4].ypos += object[-6].ypos
151
152
// Chain 3
153
temp0 += 16
154
Cos(object[-3].xpos, temp1)
155
object[-3].xpos *= temp0
156
object[-3].xpos <<= 7
157
object[-3].xpos += object[-6].xpos
158
Sin(object[-3].ypos, temp1)
159
object[-3].ypos *= temp0
160
object[-3].ypos <<= 7
161
object[-3].ypos += object[-6].ypos
162
163
// Chain 4
164
temp0 += 16
165
Cos(object[-2].xpos, temp1)
166
object[-2].xpos *= temp0
167
object[-2].xpos <<= 7
168
object[-2].xpos += object[-6].xpos
169
Sin(object[-2].ypos, temp1)
170
object[-2].ypos *= temp0
171
object[-2].ypos <<= 7
172
object[-2].ypos += object[-6].ypos
173
174
// Ball
175
temp0 += 32
176
Cos(object[-1].xpos, temp1)
177
object[-1].xpos *= temp0
178
object[-1].xpos <<= 7
179
object[-1].xpos += object[-6].xpos
180
Sin(object[-1].ypos, temp1)
181
object[-1].ypos *= temp0
182
object[-1].ypos <<= 7
183
object[-1].ypos += object[-6].ypos
184
object[-1].rotation = temp1
185
186
if object.rotation >= 0x100
187
object.direction = FLIP_NONE
188
else
189
object.direction = FLIP_X
190
end if
191
end function
192
193
194
// ========================
195
// Events
196
// ========================
197
198
event ObjectUpdate
199
switch object.state
200
case GHZEGGMAN_AWAITPLAYER
201
temp0 = object[-1].ixpos
202
temp0 -= screen.xcenter
203
stage.newXBoundary1 = temp0
204
205
temp0 = object[-1].ixpos
206
temp0 += screen.xcenter
207
stage.newXBoundary2 = temp0
208
209
temp0 = object.iypos
210
temp0 += 64
211
if screen.yoffset > temp0
212
if player[0].xpos > object[-1].xpos
213
object.animation = GHZEGGANI_IDLE
214
#platform: USE_ORIGINS
215
if game.bossOneLife == false
216
object.health = 8
217
else
218
object.health = 1
219
end if
220
#endplatform
221
#platform: USE_STANDALONE
222
object.health = 8
223
#endplatform
224
ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOBOSS, 0, 0)
225
object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
226
object.state++
227
end if
228
end if
229
break
230
231
case GHZEGGMAN_ENTEREGGMAN
232
object.ypos += 0x10000
233
if object.ypos >= object.oscillatePos
234
object.ypos = object.oscillatePos
235
object.timer = 96
236
object[-1].flameAnim = FLAME_ACTIVE
237
object.state++
238
end if
239
break
240
241
case GHZEGGMAN_MOVEINTOPLACE
242
if object.timer > 0
243
object.timer--
244
object.xpos = object.timer
245
object.xpos <<= 16
246
object.xpos += object[-1].xpos
247
temp0 = object.timer
248
temp0 <<= 7
249
temp0 /= 96
250
Cos(object.ypos, temp0)
251
object.ypos *= -0xB00
252
object.ypos += object.oscillatePos
253
else
254
object.xpos = object[-1].xpos
255
object.arenaBorder = object[-1].xpos
256
object.ypos = object.originY
257
object.originY -= 0x40000
258
object.state++
259
object[-1].type = TypeName[Wrecking Ball]
260
object[-1].ypos = object.ypos
261
object[-6].type = TypeName[Boss Lights]
262
object[-6].ypos = object.ypos
263
object.animation = GHZEGGANI_LAUGH
264
object[-1].flameAnim = FLAME_INACTIVE
265
end if
266
break
267
268
case GHZEGGMAN_LOWERBALL
269
if object.ballPos < 0x7C0000
270
CallFunction(GHZEggman_Oscillate)
271
272
object.ballPos += 0x10000
273
if object.lightPos < 0x1C0000
274
object.lightPos += 0x8000
275
end if
276
277
if object.ballPos > 0x2C0000
278
object[-5].type = TypeName[Boss Chain]
279
end if
280
281
if object.ballPos > 0x3C0000
282
object[-4].type = TypeName[Boss Chain]
283
end if
284
285
if object.ballPos > 0x4C0000
286
object[-3].type = TypeName[Boss Chain]
287
end if
288
289
if object.ballPos > 0x5C0000
290
object[-2].type = TypeName[Boss Chain]
291
end if
292
293
// Ball
294
object[-1].ypos = object.ypos
295
object[-1].ypos += object.ballPos
296
297
// Lights
298
object[-6].ypos = object.ypos
299
object[-6].ypos += object.lightPos
300
301
// Chain 1
302
object[-5].ypos = object[-6].ypos
303
object[-5].ypos += 0x100000
304
305
// Chain 2
306
object[-4].ypos = object[-5].ypos
307
object[-4].ypos += 0x100000
308
309
// Chain 3
310
object[-3].ypos = object[-4].ypos
311
object[-3].ypos += 0x100000
312
313
// Chain 4
314
object[-2].ypos = object[-3].ypos
315
object[-2].ypos += 0x100000
316
317
object.animationTimer %= 10
318
else
319
object.rotation = 256
320
CallFunction(GHZEggman_Oscillate)
321
CallFunction(GHZEggman_SwingBall)
322
object[-1].initialMoveVel = object.arenaOffset
323
object[-1].initialMoveVel >>= 2
324
object[-1].moveVelocity = object.arenaOffset
325
object[-1].arenaSize = object.arenaOffset
326
object[-1].arenaSize *= 64
327
temp0 = object[-1].arenaSize
328
temp0 >>= 1
329
object.arenaBorder -= temp0
330
object.state++
331
object.animation = GHZEGGANI_IDLE
332
object[-1].flameAnim = FLAME_ACTIVE
333
object[-1].state = WRECKINGBALL_ACTIVE
334
end if
335
break
336
337
case GHZEGGMAN_INITIALSWING
338
CallFunction(GHZEggman_Oscillate)
339
CallFunction(GHZEggman_SwingBall)
340
if object.xpos > object.arenaBorder
341
object.xpos -= object[-1].initialMoveVel
342
if object.xpos < object.arenaBorder
343
object.xpos = object.arenaBorder
344
end if
345
else
346
object[-1].flameAnim = FLAME_INACTIVE
347
object.arenaBorder += object[-1].arenaSize
348
object.state++
349
end if
350
break
351
352
case GHZEGGMAN_MOVERIGHT
353
CallFunction(GHZEggman_Oscillate)
354
CallFunction(GHZEggman_SwingBall)
355
if object.xpos < object.arenaBorder
356
if object.rotation >= 128
357
object[-1].flameAnim = FLAME_ACTIVE
358
object.xpos += object[-1].moveVelocity
359
if object.xpos > object.arenaBorder
360
object.xpos = object.arenaBorder
361
end if
362
end if
363
else
364
object[-1].flameAnim = FLAME_INACTIVE
365
object.arenaBorder -= object[-1].arenaSize
366
object.state++
367
end if
368
break
369
370
case GHZEGGMAN_MOVELEFT
371
CallFunction(GHZEggman_Oscillate)
372
CallFunction(GHZEggman_SwingBall)
373
if object.xpos > object.arenaBorder
374
if object.rotation >= 384
375
object[-1].flameAnim = FLAME_ACTIVE
376
object.xpos -= object[-1].moveVelocity
377
if object.xpos < object.arenaBorder
378
object.xpos = object.arenaBorder
379
end if
380
end if
381
else
382
object[-1].flameAnim = FLAME_INACTIVE
383
object.arenaBorder += object[-1].arenaSize
384
object.state--
385
end if
386
break
387
388
case GHZEGGMAN_EXPLODE
389
object.timer++
390
temp0 = object.timer
391
temp0 &= 7
392
if temp0 == 4
393
Rand(temp0, 96)
394
temp0 -= 48
395
temp0 <<= 16
396
temp0 += object.xpos
397
Rand(temp1, 48)
398
temp1 -= 24
399
temp1 <<= 16
400
temp1 += object.ypos
401
CreateTempObject(TypeName[Explosion], 0, temp0, temp1)
402
PlaySfx(SfxName[Explosion], false)
403
end if
404
405
if object.timer == 180
406
object.animation = GHZEGGANI_TOASTED
407
object.animationTimer = 0
408
object.timer = 0
409
object.direction = FLIP_X
410
ResetObjectEntity(SLOT_MUSICEVENT_BOSS, TypeName[Music Event], MUSICEVENT_FADETOSTAGE, 0, 0)
411
object[SLOT_MUSICEVENT_BOSS].priority = PRIORITY_ACTIVE
412
object.state++
413
end if
414
break
415
416
case GHZEGGMAN_DEFEATFALL
417
object.ypos += object[-1].gravityStrength
418
object[-1].gravityStrength += 0x1800
419
420
object.timer++
421
if object.timer == 38
422
object[-1].gravityStrength = 0
423
object.timer = 0
424
object.animationTimer = 0
425
object.state++
426
end if
427
break
428
429
case GHZEGGMAN_DEFEATRISE
430
if object.timer < 48
431
object.ypos += object[-1].gravityStrength
432
object[-1].gravityStrength -= 0x800
433
object.timer++
434
else
435
object.timer = 0
436
object[-1].gravityStrength = 0
437
object.rotation = 0
438
object.oscillatePos = object.ypos
439
object.state++
440
end if
441
break
442
443
case GHZEGGMAN_FLEE
444
CallFunction(GHZEggman_FlyAway)
445
446
if object.timer < 8
447
object.timer++
448
else
449
object.timer = 0
450
object.animation = GHZEGGANI_PANIC
451
object.animationTimer = 0
452
object[-1].flameAnim = FLAME_EXPLODE
453
object[-1].flameAnimTimer = 0
454
object.priority = PRIORITY_ACTIVE
455
temp0 = tileLayer[0].xsize
456
temp0 <<= 7
457
stage.newXBoundary2 = temp0
458
object.state++
459
end if
460
break
461
462
case GHZEGGMAN_ESCAPE
463
CallFunction(GHZEggman_FlyAway)
464
object.xpos += 0x40000
465
object.oscillatePos -= 0x4000
466
if object.outOfBounds == true
467
object.type = TypeName[Blank Object]
468
object.priority = PRIORITY_BOUNDS
469
end if
470
break
471
472
end switch
473
474
if object[-1].invincibilityTimer > 0
475
object[-1].invincibilityTimer--
476
end if
477
478
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
479
if object[-1].invincibilityTimer == 0
480
CheckEqual(player[currentPlayer].animation, ANI_HURT)
481
temp0 = checkResult
482
CheckEqual(player[currentPlayer].animation, ANI_DYING)
483
temp0 |= checkResult
484
CheckEqual(player[currentPlayer].animation, ANI_DROWNING)
485
temp0 |= checkResult
486
if temp0 != 0
487
if object.animation != GHZEGGANI_LAUGH
488
object.animation = GHZEGGANI_LAUGH
489
object.animationTimer = 0
490
end if
491
end if
492
493
switch object.state
494
default
495
break
496
497
case GHZEGGMAN_INITIALSWING
498
case GHZEGGMAN_MOVERIGHT
499
case GHZEGGMAN_MOVELEFT
500
#platform: USE_STANDALONE
501
BoxCollisionTest(C_TOUCH, object.entityPos, -20, -16, 20, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
502
#endplatform
503
#platform: USE_ORIGINS
504
BoxCollisionTest(C_TOUCH, object.entityPos, -20, -16, 20, 16, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)
505
#endplatform
506
507
if checkResult == true
508
CallFunction(Player_CheckHit)
509
if checkResult == true
510
object.health--
511
if object.health == 0
512
#platform: USE_ORIGINS
513
CallNativeFunction2(NotifyCallback, NOTIFY_KILL_BOSS, 0)
514
CallNativeFunction2(NotifyCallback, NOTIFY_BOSS_END, true)
515
#endplatform
516
player.score += 1000
517
object.animationTimer = 0
518
object.animation = GHZEGGANI_DEFEATED
519
temp0 = object.entityPos
520
temp0 -= 2
521
ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-2].xpos, object[-2].ypos)
522
temp0--
523
ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-3].xpos, object[-3].ypos)
524
temp0--
525
ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-4].xpos, object[-4].ypos)
526
temp0--
527
ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-5].xpos, object[-5].ypos)
528
temp0--
529
ResetObjectEntity(temp0, TypeName[Explosion], 0, object[-6].xpos, object[-6].ypos)
530
object[-1].state = WRECKINGBALL_EXPLODE
531
object[-1].flameAnim = FLAME_INACTIVE
532
object.timer = 0
533
object.state = GHZEGGMAN_EXPLODE
534
else
535
object.animationTimer = 0
536
object.animation = GHZEGGANI_HIT
537
object[-1].invincibilityTimer = 32
538
PlaySfx(SfxName[Boss Hit], false)
539
end if
540
end if
541
end if
542
end switch
543
544
// Arena Boundaries
545
// They're only enforced when Eggman is vulnerable for some reason??
546
// (With how the rest of this script is like, maybe this was originally just part of sub ObjectPlayerInteraction,
547
// and only during the updating process these bounds were accidentally moved to only be enforced while vulnerable?
548
// Don't know if what I'm saying even makes any sense, hopefully it does...)
549
if object.state < GHZEGGMAN_ESCAPE
550
temp0 = player[currentPlayer].collisionRight
551
temp0 <<= 16
552
temp0 += player[currentPlayer].xpos
553
temp1 = stage.curXBoundary2
554
temp1 <<= 16
555
if temp0 > temp1
556
player[currentPlayer].xvel = 0
557
player[currentPlayer].speed = 0
558
player[currentPlayer].xpos = temp1
559
temp0 = player[currentPlayer].collisionRight
560
temp0 <<= 16
561
player[currentPlayer].xpos -= temp0
562
end if
563
end if
564
end if
565
next
566
end event
567
568
569
event ObjectDraw
570
switch object.animation
571
default
572
case GHZEGGANI_INVISIBLE
573
break
574
575
case GHZEGGANI_IDLE
576
temp0 = object.animationTimer
577
temp0 /= 6
578
object.animationTimer++
579
object.animationTimer %= 12
580
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
581
break
582
583
case GHZEGGANI_LAUGH
584
temp0 = object.animationTimer
585
temp0 %= 10
586
temp0 /= 5
587
temp0 += 9
588
object.animationTimer++
589
if object.animationTimer == 50
590
object.animationTimer = 0
591
if player[0].animation != ANI_DYING
592
object.animation = GHZEGGANI_IDLE
593
end if
594
end if
595
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
596
break
597
598
case GHZEGGANI_HIT
599
temp0 = object.animationTimer
600
temp0 &= 1
601
temp0 += 2
602
object.animationTimer++
603
if object.animationTimer == 30
604
object.animationTimer = 0
605
object.animation = GHZEGGANI_IDLE
606
end if
607
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
608
break
609
610
case GHZEGGANI_DEFEATED
611
temp0 = object.animationTimer
612
temp0 >>= 5
613
temp0 += 4
614
object.animationTimer++
615
object.animationTimer &= 63
616
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
617
break
618
619
case GHZEGGANI_TOASTED
620
DrawSpriteFX(6, FX_FLIP, object.xpos, object.ypos)
621
break
622
623
case GHZEGGANI_PANIC
624
temp0 = object.animationTimer
625
temp0 >>= 2
626
temp0 += 7
627
object.animationTimer++
628
object.animationTimer %= 7
629
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
630
break
631
632
end switch
633
634
switch object[-1].flameAnim
635
case FLAME_INACTIVE
636
default
637
break
638
639
case FLAME_ACTIVE
640
temp0 = object[-1].flameAnimTimer
641
temp0 >>= 2
642
temp0 += 11
643
object[-1].flameAnimTimer++
644
object[-1].flameAnimTimer &= 7
645
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
646
break
647
648
case FLAME_EXPLODE
649
temp0 = object[-1].flameAnimTimer
650
temp0 /= 3
651
temp0 += 11
652
object[-1].flameAnimTimer++
653
if object[-1].flameAnimTimer > 21
654
object[-1].flameAnimTimer = 18
655
end if
656
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
657
break
658
659
end switch
660
end event
661
662
663
event ObjectStartup
664
LoadSpriteSheet("Global/Eggman.gif")
665
SpriteFrame(-28, -32, 64, 56, 1, 1) // ? - #0
666
SpriteFrame(-28, -32, 64, 56, 66, 1) // ? - #1
667
SpriteFrame(-28, -32, 64, 56, 131, 1) // ? - #2
668
SpriteFrame(-28, -32, 64, 56, 1, 58) // ? - #3
669
SpriteFrame(-28, -32, 64, 56, 1, 1) // ? - #4
670
SpriteFrame(-28, -32, 64, 56, 1, 58) // ? - #5
671
SpriteFrame(-28, -32, 64, 56, 66, 58) // ? - #6
672
SpriteFrame(-28, -32, 64, 56, 131, 58) // ? - #7
673
SpriteFrame(-28, -32, 64, 56, 66, 1) // ? - #8
674
SpriteFrame(-28, -32, 64, 56, 1, 115) // ? - #9
675
SpriteFrame(-28, -32, 64, 56, 66, 115) // ? - #10
676
SpriteFrame(34, 1, 10, 9, 196, 2) // ? - #11
677
SpriteFrame(33, 0, 15, 11, 196, 12) // ? - #12
678
SpriteFrame(34, -1, 22, 14, 213, 1) // ? - #13
679
SpriteFrame(34, -8, 32, 26, 213, 16) // ? - #14
680
SpriteFrame(34, -1, 22, 14, 213, 1) // ? - #15
681
SpriteFrame(34, -8, 32, 26, 213, 16) // ? - #16
682
SpriteFrame(34, 1, 10, 9, 196, 2) // ? - #17
683
SpriteFrame(33, 0, 15, 11, 196, 12) // ? - #18
684
685
foreach (TypeName[Eggman], arrayPos0, ALL_ENTITIES)
686
// Prolly a leftover from this script being much more v3-like, this foreach may have originally been a while loop of all objects
687
if object[arrayPos0].type == TypeName[Eggman]
688
object[arrayPos0].priority = PRIORITY_XBOUNDS
689
690
// Screen Offset
691
temp0 = screen.xcenter
692
temp0 -= 160 //xcenter if screen width was 320 like OG games
693
temp0 -= 8
694
695
if temp0 < 0
696
temp0 = 0
697
end if
698
699
if temp0 > 24
700
temp0 = 24
701
end if
702
703
object[arrayPos0].arenaOffset = temp0
704
object[arrayPos0].arenaOffset += 32
705
object[arrayPos0].arenaOffset *= 0x800
706
temp0 <<= 16
707
708
// Align the left Boss platform
709
arrayPos1 = arrayPos0
710
arrayPos1++
711
object[arrayPos1].xpos -= temp0
712
713
// And then align the right Boss platform
714
arrayPos1++
715
object[arrayPos1].xpos += temp0
716
717
// Still looking at the right Boss platform, make the Boss's base oscillation position be 68 pixels above that
718
object[arrayPos0].oscillatePos = object[arrayPos1].ypos
719
object[arrayPos0].oscillatePos -= 0x440000
720
721
// And then, make the base normal position be 90 pixels above the platform
722
object[arrayPos0].originY = object[arrayPos1].ypos
723
object[arrayPos0].originY -= 0x5A0000
724
725
arrayPos1 = arrayPos0
726
arrayPos1--
727
object[arrayPos0].arenaBorder = object[arrayPos1].xpos
728
object[arrayPos0].arenaBorder += 0x600000
729
730
object[arrayPos0].xpos = object[arrayPos0].arenaBorder
731
object[arrayPos0].ypos = object[arrayPos0].originY
732
object[arrayPos0].ypos -= 0xC00000
733
end if
734
next
735
end event
736
737
738
// ========================
739
// Editor Events
740
// ========================
741
742
event RSDKDraw
743
DrawSprite(0)
744
745
if editor.showGizmos == true
746
editor.drawingOverlay = true
747
748
DrawArrow(object.xpos, object.ypos, object[-6].xpos, object[-6].ypos, 255, 255, 0) // Lights
749
DrawArrow(object.xpos, object.ypos, object[-5].xpos, object[-5].ypos, 255, 255, 0) // Chain 1
750
DrawArrow(object.xpos, object.ypos, object[-4].xpos, object[-4].ypos, 255, 255, 0) // Chain 2
751
DrawArrow(object.xpos, object.ypos, object[-3].xpos, object[-3].ypos, 255, 255, 0) // Chain 3
752
DrawArrow(object.xpos, object.ypos, object[-2].xpos, object[-2].ypos, 255, 255, 0) // Chain 4
753
DrawArrow(object.xpos, object.ypos, object[-1].xpos, object[-1].ypos, 255, 255, 0) // Ball
754
755
DrawArrow(object.xpos, object.ypos, object[+1].xpos, object[+1].ypos, 255, 255, 0) // Platform L
756
DrawArrow(object.xpos, object.ypos, object[+2].xpos, object[+2].ypos, 255, 255, 0) // Platform R
757
758
editor.drawingOverlay = false
759
end if
760
end event
761
762
763
event RSDKLoad
764
LoadSpriteSheet("Global/Eggman.gif")
765
SpriteFrame(-28, -32, 64, 56, 1, 1)
766
767
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
768
end event
769
770