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/Enemies/Caterkiller.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Caterkiller Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value0 : object.bodyPosition1.x
13
private alias object.value1 : object.bodyPosition1.y
14
private alias object.value2 : object.bodyDirection1
15
private alias object.value3 : object.bodyFrame1
16
17
private alias object.value4 : object.bodyPosition2.x
18
private alias object.value5 : object.bodyPosition2.y
19
private alias object.value6 : object.bodyDirection2
20
private alias object.value7 : object.bodyFrame2
21
22
private alias object.value8 : object.bodyPosition3.x
23
private alias object.value9 : object.bodyPosition3.y
24
private alias object.value10 : object.bodyDirection3
25
private alias object.value11 : object.bodyFrame3
26
27
private alias object.value12 : object.startPos.x
28
private alias object.value13 : object.startPos.y
29
30
private alias object.value14 : object.timer
31
32
private alias 0 : CATERKILLER_SETUP
33
private alias 1 : CATERKILLER_CONTRACT
34
private alias 2 : CATERKILLER_LIFTHEAD
35
private alias 3 : CATERKILLER_UNCONTRACT
36
private alias 4 : CATERKILLER_LOWERHEAD
37
private alias 5 : CATERKILLER_SPLITBODYPART
38
39
// Player Aliases
40
private alias object.value40 : player.hitboxLeft
41
private alias object.value38 : player.hitboxTop
42
private alias object.value41 : player.hitboxRight
43
private alias object.value39 : player.hitboxBottom
44
45
// Mission Number Aliases
46
private alias 8 : MISSIONNO_MERCY
47
48
// Tile Info ID Aliases
49
private alias 1 : TILEINFO_DIRECTION
50
private alias 6 : TILEINFO_ANGLEA
51
52
// Path ID Aliases
53
private alias 0 : PATH_A
54
55
56
// ========================
57
// Function Declarations
58
// ========================
59
60
reserve function Caterkiller_SetupBody
61
reserve function Caterkiller_DebugDraw
62
reserve function Caterkiller_DebugSpawn
63
reserve function Caterkiller_CheckPlayerCollisions
64
reserve function Caterkiller_CheckTileAngle
65
reserve function Caterkiller_CheckTileCollisions
66
67
68
// ========================
69
// Function Definitions
70
// ========================
71
72
private function Caterkiller_SetupBody
73
object[arrayPos0].startPos.x = object[arrayPos0].xpos
74
object[arrayPos0].startPos.y = object[arrayPos0].ypos
75
76
temp0 = object[arrayPos0].xpos
77
temp1 = 0xC0000
78
if temp7 == FLIP_X
79
FlipSign(temp1)
80
end if
81
object[arrayPos0].direction = temp7
82
object[arrayPos0].frame = 0
83
temp0 += temp1
84
85
object[arrayPos0].bodyPosition1.x = temp0
86
object[arrayPos0].bodyPosition1.y = object[arrayPos0].ypos
87
object[arrayPos0].bodyDirection1 = object[arrayPos0].direction
88
object[arrayPos0].bodyFrame1 = 0
89
temp0 += temp1
90
91
object[arrayPos0].bodyPosition2.x = temp0
92
object[arrayPos0].bodyPosition2.y = object[arrayPos0].ypos
93
object[arrayPos0].bodyDirection2 = object[arrayPos0].direction
94
object[arrayPos0].bodyFrame2 = 0
95
temp0 += temp1
96
97
object[arrayPos0].bodyPosition3.x = temp0
98
object[arrayPos0].bodyPosition3.y = object[arrayPos0].ypos
99
object[arrayPos0].bodyDirection3 = object[arrayPos0].direction
100
object[arrayPos0].bodyFrame3 = 0
101
102
object[arrayPos0].state = CATERKILLER_SETUP
103
object[arrayPos0].timer = 0
104
end function
105
106
107
private function Caterkiller_DebugDraw
108
temp0 = object.xpos
109
GetBit(temp1, object.direction, 0)
110
if temp1 == FLIP_NONE
111
temp0 += 0x240000
112
temp1 = -0xC0000
113
else
114
temp0 -= 0x240000
115
temp1 = 0xC0000
116
end if
117
118
temp2 = 0
119
while temp2 < 3
120
DrawSpriteFX(16, FX_FLIP, temp0, object.ypos)
121
temp0 += temp1
122
temp2++
123
loop
124
125
DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
126
end function
127
128
129
private function Caterkiller_DebugSpawn
130
temp0 = object.ixpos
131
temp0 <<= 16
132
temp1 = object.iypos
133
temp1 <<= 16
134
135
CreateTempObject(TypeName[Caterkiller], 0, temp0, temp1)
136
arrayPos0 = object[tempObjectPos].entityPos
137
temp7 = object.direction
138
139
CallFunction(Caterkiller_SetupBody)
140
end function
141
142
143
private function Caterkiller_CheckPlayerCollisions
144
temp7 = false
145
temp5 = object.xpos
146
temp6 = object.ypos
147
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
148
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)
149
if checkResult == true
150
CallFunction(Player_BadnikBreak)
151
else
152
object.xpos = object.bodyPosition1.x
153
object.ypos = object.bodyPosition1.y
154
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
155
if checkResult == true
156
CallFunction(Player_Hit)
157
temp7 = true
158
else
159
object.xpos = object.bodyPosition2.x
160
object.ypos = object.bodyPosition2.y
161
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
162
if checkResult == true
163
CallFunction(Player_Hit)
164
temp7 = true
165
else
166
object.xpos = object.bodyPosition3.x
167
object.ypos = object.bodyPosition3.y
168
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
169
if checkResult == true
170
CallFunction(Player_Hit)
171
temp7 = true
172
end if
173
end if
174
end if
175
end if
176
177
object.xpos = temp5
178
object.ypos = temp6
179
next
180
181
// Uh oh! we hit the body! time to explode!
182
if temp7 == true
183
temp0 = object.frame
184
temp0 <<= 15
185
object.ypos -= temp0
186
187
CreateTempObject(TypeName[Caterkiller], 0, object.xpos, object.ypos)
188
if object.direction == FLIP_NONE
189
object[tempObjectPos].xvel = -0x20000
190
else
191
object[tempObjectPos].xvel = 0x20000
192
end if
193
object[tempObjectPos].yvel = -0x40000
194
object[tempObjectPos].direction = object.direction
195
object[tempObjectPos].frame = object.frame
196
object[tempObjectPos].frame &= 8
197
object[tempObjectPos].state = CATERKILLER_SPLITBODYPART
198
object[tempObjectPos].priority = PRIORITY_ACTIVE_SMALL
199
200
CreateTempObject(TypeName[Caterkiller], 0, object.bodyPosition1.x, object.bodyPosition1.y)
201
if object.bodyDirection1 == FLIP_NONE
202
object[tempObjectPos].xvel = -0x18000
203
else
204
object[tempObjectPos].xvel = 0x18000
205
end if
206
object[tempObjectPos].yvel = -0x40000
207
object[tempObjectPos].direction = object.bodyDirection1
208
object[tempObjectPos].frame = 16
209
object[tempObjectPos].state = CATERKILLER_SPLITBODYPART
210
object[tempObjectPos].priority = PRIORITY_ACTIVE_SMALL
211
temp0 = object.bodyFrame2
212
temp0 <<= 15
213
object.bodyPosition2.y -= temp0
214
object.frame -= temp0
215
216
CreateTempObject(TypeName[Caterkiller], 0, object.bodyPosition2.x, object.bodyPosition2.y)
217
if object.bodyDirection2 == FLIP_NONE
218
object[tempObjectPos].xvel = 0x18000
219
else
220
object[tempObjectPos].xvel = -0x18000
221
end if
222
object[tempObjectPos].yvel = -0x40000
223
object[tempObjectPos].direction = object.bodyDirection2
224
object[tempObjectPos].frame = 16
225
object[tempObjectPos].state = CATERKILLER_SPLITBODYPART
226
object[tempObjectPos].priority = PRIORITY_ACTIVE_SMALL
227
228
CreateTempObject(TypeName[Caterkiller], 0, object.bodyPosition3.x, object.bodyPosition3.y)
229
if object.bodyDirection3 == FLIP_NONE
230
object[tempObjectPos].xvel = 0x20000
231
else
232
object[tempObjectPos].xvel = -0x20000
233
end if
234
object[tempObjectPos].yvel = -0x40000
235
object[tempObjectPos].direction = object.bodyDirection3
236
object[tempObjectPos].frame = 16
237
object[tempObjectPos].state = CATERKILLER_SPLITBODYPART
238
object[tempObjectPos].priority = PRIORITY_ACTIVE_SMALL
239
240
ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, object.xpos, object.ypos)
241
242
#platform: USE_ORIGINS
243
if game.playMode == BOOT_PLAYMODE_MISSION
244
CallNativeFunction2(NotifyCallback, NOTIFY_KILL_ENEMY, temp0)
245
if game.missionFunctionNo == MISSIONNO_MERCY
246
game.missionValue = 1
247
end if
248
end if
249
#endplatform
250
end if
251
end function
252
253
254
private function Caterkiller_CheckTileAngle
255
temp2 >>= 16
256
temp3 >>= 16
257
temp3 += 8
258
Get16x16TileInfo(temp5, temp2, temp3, TILEINFO_ANGLEA)
259
Get16x16TileInfo(temp6, temp2, temp3, TILEINFO_DIRECTION)
260
switch temp6
261
case FLIP_NONE
262
temp5 &= 255
263
break
264
265
case FLIP_X
266
temp5 &= 255
267
temp6 = temp5
268
temp5 = 256
269
temp5 -= temp6
270
temp5 &= 255
271
break
272
273
case FLIP_Y
274
temp5 >>= 24
275
temp5 += 128
276
temp6 = temp5
277
temp5 = 256
278
temp5 -= temp6
279
temp5 &= 255
280
break
281
282
case FLIP_XY
283
temp5 >>= 24
284
temp5 += 128
285
temp5 &= 255
286
break
287
288
end switch
289
290
checkResult = false
291
if temp4 == FLIP_NONE
292
if temp5 < 128
293
if temp5 > 24
294
checkResult = true
295
end if
296
end if
297
else
298
if temp5 > 128
299
if temp5 < 232
300
checkResult = true
301
end if
302
end if
303
end if
304
end function
305
306
307
private function Caterkiller_CheckTileCollisions
308
if object.state != CATERKILLER_LIFTHEAD
309
ObjectTileGrip(CSIDE_FLOOR, 0, 8, PATH_A)
310
if checkResult == false
311
object.direction ^= FLIP_X
312
end if
313
temp0 = object.xpos
314
temp1 = object.ypos
315
temp2 = temp0
316
temp3 = temp1
317
temp4 = object.direction
318
CallFunction(Caterkiller_CheckTileAngle)
319
if checkResult == true
320
object.direction ^= FLIP_X
321
end if
322
else
323
temp0 = object.xpos
324
temp1 = object.ypos
325
end if
326
327
object.xpos = object.bodyPosition1.x
328
object.ypos = object.bodyPosition1.y
329
ObjectTileGrip(CSIDE_FLOOR, 0, 8, PATH_A)
330
if checkResult == false
331
object.bodyDirection1 = object.direction
332
end if
333
object.bodyPosition1.y = object.ypos
334
temp2 = object.bodyPosition1.x
335
temp3 = object.bodyPosition1.y
336
temp4 = object.bodyDirection1
337
CallFunction(Caterkiller_CheckTileAngle)
338
if checkResult == true
339
object.bodyDirection1 = object.direction
340
end if
341
342
object.xpos = object.bodyPosition2.x
343
object.ypos = object.bodyPosition2.y
344
ObjectTileGrip(CSIDE_FLOOR, 0, 8, PATH_A)
345
if checkResult == false
346
object.bodyDirection2 = object.direction
347
end if
348
object.bodyPosition2.y = object.ypos
349
temp2 = object.bodyPosition2.x
350
temp3 = object.bodyPosition2.y
351
temp4 = object.bodyDirection2
352
CallFunction(Caterkiller_CheckTileAngle)
353
if checkResult == true
354
object.bodyDirection2 = object.direction
355
end if
356
357
if object.state != CATERKILLER_LOWERHEAD
358
object.xpos = object.bodyPosition3.x
359
object.ypos = object.bodyPosition3.y
360
ObjectTileGrip(CSIDE_FLOOR, 0, 8, PATH_A)
361
if checkResult == false
362
object.bodyDirection3 = object.direction
363
end if
364
object.bodyPosition3.y = object.ypos
365
temp2 = object.bodyPosition3.x
366
temp3 = object.bodyPosition3.y
367
temp4 = object.bodyDirection3
368
CallFunction(Caterkiller_CheckTileAngle)
369
if checkResult == true
370
object.bodyDirection3 = object.direction
371
end if
372
end if
373
374
object.xpos = temp0
375
object.ypos = temp1
376
end function
377
378
379
// ========================
380
// Events
381
// ========================
382
383
event ObjectUpdate
384
switch object.state
385
case CATERKILLER_SETUP
386
object.priority = PRIORITY_ACTIVE
387
// [Fallthrough]
388
case CATERKILLER_CONTRACT
389
if object.timer == 0
390
object.timer = 15
391
object.state++
392
object.frame = -1
393
object.bodyFrame2 = -1
394
// fallthrough....right.?
395
else
396
object.timer--
397
CallFunction(Caterkiller_CheckPlayerCollisions)
398
break //whats this doin here
399
end if
400
// [Fallthrough, I think]
401
case CATERKILLER_LIFTHEAD
402
if object.timer == 0
403
object.timer = 7
404
object.state++
405
else
406
object.timer--
407
408
if object.bodyDirection1 == FLIP_NONE
409
object.bodyPosition1.x -= 0x4000
410
else
411
object.bodyPosition1.x += 0x4000
412
end if
413
414
if object.bodyDirection2 == FLIP_NONE
415
object.bodyPosition2.x -= 0x8000
416
else
417
object.bodyPosition2.x += 0x8000
418
end if
419
420
if object.bodyDirection3 == FLIP_NONE
421
object.bodyPosition3.x -= 0xC000
422
else
423
object.bodyPosition3.x += 0xC000
424
end if
425
426
object.frame++
427
object.bodyFrame2++
428
CallFunction(Caterkiller_CheckTileCollisions)
429
CallFunction(Caterkiller_CheckPlayerCollisions)
430
end if
431
break
432
433
case CATERKILLER_UNCONTRACT
434
if object.timer == 0
435
object.timer = 15
436
object.state++
437
object.frame = 16
438
object.bodyFrame2 = 16
439
else
440
object.timer--
441
CallFunction(Caterkiller_CheckPlayerCollisions)
442
break
443
end if
444
// [Fallthrough]
445
case CATERKILLER_LOWERHEAD
446
if object.timer == 0
447
object.timer = 7
448
object.state = CATERKILLER_CONTRACT
449
450
#platform: USE_ORIGINS
451
if object.direction == object.bodyDirection1
452
object.bodyPosition1.x = object.xpos
453
if object.bodyDirection1 == FLIP_NONE
454
object.bodyPosition1.x += 0xC0000
455
else
456
object.bodyPosition1.x -= 0xC0000
457
end if
458
end if
459
460
if object.direction == object.bodyDirection2
461
object.bodyPosition2.x = object.bodyPosition1.x
462
if object.bodyDirection2 == FLIP_NONE
463
object.bodyPosition2.x += 0xC0000
464
else
465
object.bodyPosition2.x -= 0xC0000
466
end if
467
end if
468
#endplatform
469
else
470
object.timer--
471
if object.direction == FLIP_NONE
472
object.xpos -= 0xC000
473
else
474
object.xpos += 0xC000
475
end if
476
477
if object.bodyDirection1 == FLIP_NONE
478
object.bodyPosition1.x -= 0x8000
479
else
480
object.bodyPosition1.x += 0x8000
481
end if
482
483
if object.bodyDirection2 == FLIP_NONE
484
object.bodyPosition2.x -= 0x4000
485
else
486
object.bodyPosition2.x += 0x4000
487
end if
488
489
object.frame--
490
object.bodyFrame2--
491
CallFunction(Caterkiller_CheckTileCollisions)
492
CallFunction(Caterkiller_CheckPlayerCollisions)
493
end if
494
break
495
496
case CATERKILLER_SPLITBODYPART
497
object.xpos += object.xvel
498
object.ypos += object.yvel
499
object.yvel += 0x3800
500
501
if object.yvel > 0
502
ObjectTileCollision(CSIDE_FLOOR, 0, 8, PATH_A)
503
if checkResult == true
504
object.yvel = -0x40000
505
end if
506
end if
507
508
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
509
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)
510
if checkResult == true
511
if object.frame < 16
512
CallFunction(Player_BadnikBreak)
513
else
514
CallFunction(Player_Hit)
515
end if
516
end if
517
next
518
519
if object.outOfBounds == true
520
object.type = TypeName[Blank Object]
521
end if
522
break
523
524
end switch
525
526
if object.state != CATERKILLER_SPLITBODYPART
527
if object.outOfBounds == true
528
temp0 = object.xpos
529
temp1 = object.ypos
530
object.xpos = object.startPos.x
531
object.ypos = object.startPos.y
532
if object.outOfBounds == true
533
arrayPos0 = object.entityPos
534
temp7 = object[arrayPos0].propertyValue
535
CallFunction(Caterkiller_SetupBody)
536
else
537
object.xpos = temp0
538
object.ypos = temp1
539
end if
540
end if
541
end if
542
end event
543
544
545
event ObjectDraw
546
if object.state < CATERKILLER_SPLITBODYPART
547
temp0 = object.direction
548
549
object.direction = object.bodyDirection3
550
temp1 = object.bodyFrame3
551
temp1 >>= 1
552
temp1 += 16
553
DrawSpriteFX(temp1, FX_FLIP, object.bodyPosition3.x, object.bodyPosition3.y)
554
555
object.direction = object.bodyDirection2
556
temp1 = object.bodyFrame2
557
temp1 >>= 1
558
temp1 += 16
559
DrawSpriteFX(temp1, FX_FLIP, object.bodyPosition2.x, object.bodyPosition2.y)
560
561
object.direction = object.bodyDirection1
562
temp1 = object.bodyFrame1
563
temp1 >>= 1
564
temp1 += 16
565
DrawSpriteFX(temp1, FX_FLIP, object.bodyPosition1.x, object.bodyPosition1.y)
566
567
object.direction = temp0
568
569
temp0 = object.frame
570
temp0 >>= 1
571
CheckEqual(object.state, CATERKILLER_LIFTHEAD)
572
temp1 = checkResult
573
CheckEqual(object.state, CATERKILLER_UNCONTRACT)
574
temp1 |= checkResult
575
if temp1 == true
576
temp0 += 8
577
end if
578
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
579
else
580
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
581
end if
582
end event
583
584
585
event ObjectStartup
586
CheckCurrentStageFolder("Zone02")
587
if checkResult == true
588
LoadSpriteSheet("MZ/Objects.gif")
589
SpriteFrame(-8, -14, 16, 22, 18, 81)
590
SpriteFrame(-8, -15, 16, 22, 18, 81)
591
SpriteFrame(-8, -16, 16, 22, 18, 81)
592
SpriteFrame(-8, -17, 16, 22, 18, 81)
593
SpriteFrame(-8, -18, 16, 22, 18, 81)
594
SpriteFrame(-8, -19, 16, 22, 18, 81)
595
SpriteFrame(-8, -20, 16, 22, 18, 81)
596
SpriteFrame(-8, -21, 16, 22, 18, 81)
597
SpriteFrame(-8, -14, 16, 24, 1, 81)
598
SpriteFrame(-8, -15, 16, 24, 1, 81)
599
SpriteFrame(-8, -16, 16, 24, 1, 81)
600
SpriteFrame(-8, -17, 16, 24, 1, 81)
601
SpriteFrame(-8, -18, 16, 24, 1, 81)
602
SpriteFrame(-8, -19, 16, 24, 1, 81)
603
SpriteFrame(-8, -20, 16, 24, 1, 81)
604
SpriteFrame(-8, -21, 16, 24, 1, 81)
605
SpriteFrame(-8, -8, 16, 16, 35, 81)
606
SpriteFrame(-8, -9, 16, 16, 35, 81)
607
SpriteFrame(-8, -10, 16, 16, 35, 81)
608
SpriteFrame(-8, -11, 16, 16, 35, 81)
609
SpriteFrame(-8, -12, 16, 16, 35, 81)
610
SpriteFrame(-8, -13, 16, 16, 35, 81)
611
SpriteFrame(-8, -14, 16, 16, 35, 81)
612
SpriteFrame(-8, -15, 16, 16, 35, 81)
613
end if
614
615
CheckCurrentStageFolder("Zone03")
616
if checkResult == true
617
LoadSpriteSheet("SYZ/Objects.gif")
618
SpriteFrame(-8, -14, 16, 22, 98, 98)
619
SpriteFrame(-8, -15, 16, 22, 98, 98)
620
SpriteFrame(-8, -16, 16, 22, 98, 98)
621
SpriteFrame(-8, -17, 16, 22, 98, 98)
622
SpriteFrame(-8, -18, 16, 22, 98, 98)
623
SpriteFrame(-8, -19, 16, 22, 98, 98)
624
SpriteFrame(-8, -20, 16, 22, 98, 98)
625
SpriteFrame(-8, -21, 16, 22, 98, 98)
626
SpriteFrame(-8, -14, 16, 24, 81, 98)
627
SpriteFrame(-8, -15, 16, 24, 81, 98)
628
SpriteFrame(-8, -16, 16, 24, 81, 98)
629
SpriteFrame(-8, -17, 16, 24, 81, 98)
630
SpriteFrame(-8, -18, 16, 24, 81, 98)
631
SpriteFrame(-8, -19, 16, 24, 81, 98)
632
SpriteFrame(-8, -20, 16, 24, 81, 98)
633
SpriteFrame(-8, -21, 16, 24, 81, 98)
634
SpriteFrame(-8, -8, 16, 16, 98, 121)
635
SpriteFrame(-8, -9, 16, 16, 98, 121)
636
SpriteFrame(-8, -10, 16, 16, 98, 121)
637
SpriteFrame(-8, -11, 16, 16, 98, 121)
638
SpriteFrame(-8, -12, 16, 16, 98, 121)
639
SpriteFrame(-8, -13, 16, 16, 98, 121)
640
SpriteFrame(-8, -14, 16, 16, 98, 121)
641
SpriteFrame(-8, -15, 16, 16, 98, 121)
642
end if
643
644
CheckCurrentStageFolder("Zone06")
645
if checkResult == true
646
LoadSpriteSheet("SBZ/Objects.gif")
647
SpriteFrame(-8, -14, 16, 22, 75, 26)
648
SpriteFrame(-8, -15, 16, 22, 75, 26)
649
SpriteFrame(-8, -16, 16, 22, 75, 26)
650
SpriteFrame(-8, -17, 16, 22, 75, 26)
651
SpriteFrame(-8, -18, 16, 22, 75, 26)
652
SpriteFrame(-8, -19, 16, 22, 75, 26)
653
SpriteFrame(-8, -20, 16, 22, 75, 26)
654
SpriteFrame(-8, -21, 16, 22, 75, 26)
655
SpriteFrame(-8, -14, 16, 24, 75, 1)
656
SpriteFrame(-8, -15, 16, 24, 75, 1)
657
SpriteFrame(-8, -16, 16, 24, 75, 1)
658
SpriteFrame(-8, -17, 16, 24, 75, 1)
659
SpriteFrame(-8, -18, 16, 24, 75, 1)
660
SpriteFrame(-8, -19, 16, 24, 75, 1)
661
SpriteFrame(-8, -20, 16, 24, 75, 1)
662
SpriteFrame(-8, -21, 16, 24, 75, 1)
663
SpriteFrame(-8, -8, 16, 16, 75, 49)
664
SpriteFrame(-8, -9, 16, 16, 75, 49)
665
SpriteFrame(-8, -10, 16, 16, 75, 49)
666
SpriteFrame(-8, -11, 16, 16, 75, 49)
667
SpriteFrame(-8, -12, 16, 16, 75, 49)
668
SpriteFrame(-8, -13, 16, 16, 75, 49)
669
SpriteFrame(-8, -14, 16, 16, 75, 49)
670
SpriteFrame(-8, -15, 16, 16, 75, 49)
671
end if
672
673
CheckCurrentStageFolder("Zone07")
674
if checkResult == true
675
LoadSpriteSheet("MBZ/Objects.gif")
676
SpriteFrame(-8, -14, 16, 22, 1, 68)
677
SpriteFrame(-8, -15, 16, 22, 1, 68)
678
SpriteFrame(-8, -16, 16, 22, 1, 68)
679
SpriteFrame(-8, -17, 16, 22, 1, 68)
680
SpriteFrame(-8, -18, 16, 22, 1, 68)
681
SpriteFrame(-8, -19, 16, 22, 1, 68)
682
SpriteFrame(-8, -20, 16, 22, 1, 68)
683
SpriteFrame(-8, -21, 16, 22, 1, 68)
684
SpriteFrame(-8, -14, 16, 24, 18, 68)
685
SpriteFrame(-8, -15, 16, 24, 18, 68)
686
SpriteFrame(-8, -16, 16, 24, 18, 68)
687
SpriteFrame(-8, -17, 16, 24, 18, 68)
688
SpriteFrame(-8, -18, 16, 24, 18, 68)
689
SpriteFrame(-8, -19, 16, 24, 18, 68)
690
SpriteFrame(-8, -20, 16, 24, 18, 68)
691
SpriteFrame(-8, -21, 16, 24, 18, 68)
692
SpriteFrame(-8, -8, 16, 16, 35, 68)
693
SpriteFrame(-8, -9, 16, 16, 35, 68)
694
SpriteFrame(-8, -10, 16, 16, 35, 68)
695
SpriteFrame(-8, -11, 16, 16, 35, 68)
696
SpriteFrame(-8, -12, 16, 16, 35, 68)
697
SpriteFrame(-8, -13, 16, 16, 35, 68)
698
SpriteFrame(-8, -14, 16, 16, 35, 68)
699
SpriteFrame(-8, -15, 16, 16, 35, 68)
700
end if
701
702
foreach (TypeName[Caterkiller], arrayPos0, ALL_ENTITIES)
703
temp7 = object[arrayPos0].propertyValue
704
CallFunction(Caterkiller_SetupBody)
705
next
706
707
SetTableValue(TypeName[Caterkiller], DebugMode_ObjCount, DebugMode_TypesTable)
708
SetTableValue(Caterkiller_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
709
SetTableValue(Caterkiller_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
710
DebugMode_ObjCount++
711
end event
712
713
714
// ========================
715
// Editor Events
716
// ========================
717
718
event RSDKEdit
719
if editor.returnVariable == true
720
switch editor.variableID
721
case EDIT_VAR_PROPVAL // property value
722
checkResult = object.propertyValue
723
break
724
725
case 0 // direction
726
checkResult = object.propertyValue
727
break
728
729
end switch
730
else
731
switch editor.variableID
732
case EDIT_VAR_PROPVAL // property value
733
object.propertyValue = editor.variableValue
734
break
735
736
case 0 // direction
737
object.propertyValue = editor.variableValue
738
break
739
740
end switch
741
end if
742
end event
743
744
745
event RSDKDraw
746
arrayPos0 = object.entityPos
747
temp7 = object.propertyValue
748
CallFunction(Caterkiller_SetupBody)
749
750
temp0 = object.direction
751
object.direction = object.bodyDirection3
752
temp1 = object.bodyFrame3
753
temp1 >>= 1
754
temp1 += 16
755
DrawSpriteFX(temp1, FX_FLIP, object.bodyPosition3.x, object.bodyPosition3.y)
756
757
object.direction = object.bodyDirection2
758
temp1 = object.bodyFrame2
759
temp1 >>= 1
760
temp1 += 16
761
DrawSpriteFX(temp1, FX_FLIP, object.bodyPosition2.x, object.bodyPosition2.y)
762
763
object.direction = object.bodyDirection1
764
temp1 = object.bodyFrame1
765
temp1 >>= 1
766
temp1 += 16
767
DrawSpriteFX(temp1, FX_FLIP, object.bodyPosition1.x, object.bodyPosition1.y)
768
769
object.direction = temp0
770
temp0 = object.frame
771
temp0 >>= 1
772
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
773
end event
774
775
776
event RSDKLoad
777
// Make sure we have a fall-back, in case the current folder isn't actually a valid one
778
temp0 = false
779
780
CheckCurrentStageFolder("Zone03")
781
temp0 |= checkResult
782
if checkResult == true
783
LoadSpriteSheet("SYZ/Objects.gif")
784
SpriteFrame(-8, -14, 16, 22, 98, 98) // Head (Mouth Closed) - #0
785
SpriteFrame(-8, -15, 16, 22, 98, 98) // Head (Mouth Closed) - #1
786
SpriteFrame(-8, -16, 16, 22, 98, 98) // Head (Mouth Closed) - #2
787
SpriteFrame(-8, -17, 16, 22, 98, 98) // Head (Mouth Closed) - #3
788
SpriteFrame(-8, -18, 16, 22, 98, 98) // Head (Mouth Closed) - #4
789
SpriteFrame(-8, -19, 16, 22, 98, 98) // Head (Mouth Closed) - #5
790
SpriteFrame(-8, -20, 16, 22, 98, 98) // Head (Mouth Closed) - #6
791
SpriteFrame(-8, -21, 16, 22, 98, 98) // Head (Mouth Closed) - #7
792
SpriteFrame(-8, -14, 16, 24, 81, 98) // Head (Mouth Open) - #8
793
SpriteFrame(-8, -15, 16, 24, 81, 98) // Head (Mouth Open) - #9
794
SpriteFrame(-8, -16, 16, 24, 81, 98) // Head (Mouth Open) - #10
795
SpriteFrame(-8, -17, 16, 24, 81, 98) // Head (Mouth Open) - #11
796
SpriteFrame(-8, -18, 16, 24, 81, 98) // Head (Mouth Open) - #12
797
SpriteFrame(-8, -19, 16, 24, 81, 98) // Head (Mouth Open) - #13
798
SpriteFrame(-8, -20, 16, 24, 81, 98) // Head (Mouth Open) - #14
799
SpriteFrame(-8, -21, 16, 24, 81, 98) // Head (Mouth Open) - #15
800
SpriteFrame(-8, -8, 16, 16, 98, 121) // Body - #16
801
SpriteFrame(-8, -9, 16, 16, 98, 121) // Body - #17
802
SpriteFrame(-8, -10, 16, 16, 98, 121) // Body - #18
803
SpriteFrame(-8, -11, 16, 16, 98, 121) // Body - #19
804
SpriteFrame(-8, -12, 16, 16, 98, 121) // Body - #20
805
SpriteFrame(-8, -13, 16, 16, 98, 121) // Body - #21
806
SpriteFrame(-8, -14, 16, 16, 98, 121) // Body - #22
807
SpriteFrame(-8, -15, 16, 16, 98, 121) // Body - #23
808
end if
809
810
CheckCurrentStageFolder("Zone06")
811
temp0 |= checkResult
812
if checkResult == true
813
LoadSpriteSheet("SBZ/Objects.gif")
814
SpriteFrame(-8, -14, 16, 22, 75, 26) // Head (Mouth Closed) - #0
815
SpriteFrame(-8, -15, 16, 22, 75, 26) // Head (Mouth Closed) - #1
816
SpriteFrame(-8, -16, 16, 22, 75, 26) // Head (Mouth Closed) - #2
817
SpriteFrame(-8, -17, 16, 22, 75, 26) // Head (Mouth Closed) - #3
818
SpriteFrame(-8, -18, 16, 22, 75, 26) // Head (Mouth Closed) - #4
819
SpriteFrame(-8, -19, 16, 22, 75, 26) // Head (Mouth Closed) - #5
820
SpriteFrame(-8, -20, 16, 22, 75, 26) // Head (Mouth Closed) - #6
821
SpriteFrame(-8, -21, 16, 22, 75, 26) // Head (Mouth Closed) - #7
822
SpriteFrame(-8, -14, 16, 24, 75, 1) // Head (Mouth Open) - #8
823
SpriteFrame(-8, -15, 16, 24, 75, 1) // Head (Mouth Open) - #9
824
SpriteFrame(-8, -16, 16, 24, 75, 1) // Head (Mouth Open) - #10
825
SpriteFrame(-8, -17, 16, 24, 75, 1) // Head (Mouth Open) - #11
826
SpriteFrame(-8, -18, 16, 24, 75, 1) // Head (Mouth Open) - #12
827
SpriteFrame(-8, -19, 16, 24, 75, 1) // Head (Mouth Open) - #13
828
SpriteFrame(-8, -20, 16, 24, 75, 1) // Head (Mouth Open) - #14
829
SpriteFrame(-8, -21, 16, 24, 75, 1) // Head (Mouth Open) - #15
830
SpriteFrame(-8, -8, 16, 16, 75, 49) // Body - #16
831
SpriteFrame(-8, -9, 16, 16, 75, 49) // Body - #17
832
SpriteFrame(-8, -10, 16, 16, 75, 49) // Body - #18
833
SpriteFrame(-8, -11, 16, 16, 75, 49) // Body - #19
834
SpriteFrame(-8, -12, 16, 16, 75, 49) // Body - #20
835
SpriteFrame(-8, -13, 16, 16, 75, 49) // Body - #21
836
SpriteFrame(-8, -14, 16, 16, 75, 49) // Body - #22
837
SpriteFrame(-8, -15, 16, 16, 75, 49) // Body - #23
838
end if
839
840
CheckCurrentStageFolder("Zone07")
841
temp0 |= checkResult
842
if checkResult == true
843
LoadSpriteSheet("MBZ/Objects.gif")
844
SpriteFrame(-8, -14, 16, 22, 1, 68) // Head (Mouth Closed) - #0
845
SpriteFrame(-8, -15, 16, 22, 1, 68) // Head (Mouth Closed) - #1
846
SpriteFrame(-8, -16, 16, 22, 1, 68) // Head (Mouth Closed) - #2
847
SpriteFrame(-8, -17, 16, 22, 1, 68) // Head (Mouth Closed) - #3
848
SpriteFrame(-8, -18, 16, 22, 1, 68) // Head (Mouth Closed) - #4
849
SpriteFrame(-8, -19, 16, 22, 1, 68) // Head (Mouth Closed) - #5
850
SpriteFrame(-8, -20, 16, 22, 1, 68) // Head (Mouth Closed) - #6
851
SpriteFrame(-8, -21, 16, 22, 1, 68) // Head (Mouth Closed) - #7
852
SpriteFrame(-8, -14, 16, 24, 18, 68) // Head (Mouth Open) - #8
853
SpriteFrame(-8, -15, 16, 24, 18, 68) // Head (Mouth Open) - #9
854
SpriteFrame(-8, -16, 16, 24, 18, 68) // Head (Mouth Open) - #10
855
SpriteFrame(-8, -17, 16, 24, 18, 68) // Head (Mouth Open) - #11
856
SpriteFrame(-8, -18, 16, 24, 18, 68) // Head (Mouth Open) - #12
857
SpriteFrame(-8, -19, 16, 24, 18, 68) // Head (Mouth Open) - #13
858
SpriteFrame(-8, -20, 16, 24, 18, 68) // Head (Mouth Open) - #14
859
SpriteFrame(-8, -21, 16, 24, 18, 68) // Head (Mouth Open) - #15
860
SpriteFrame(-8, -8, 16, 16, 35, 68) // Body - #16
861
SpriteFrame(-8, -9, 16, 16, 35, 68) // Body - #17
862
SpriteFrame(-8, -10, 16, 16, 35, 68) // Body - #18
863
SpriteFrame(-8, -11, 16, 16, 35, 68) // Body - #19
864
SpriteFrame(-8, -12, 16, 16, 35, 68) // Body - #20
865
SpriteFrame(-8, -13, 16, 16, 35, 68) // Body - #21
866
SpriteFrame(-8, -14, 16, 16, 35, 68) // Body - #22
867
SpriteFrame(-8, -15, 16, 16, 35, 68) // Body - #23
868
end if
869
870
if temp0 == false
871
// We use MZ's sprites as the fallback, "Zone02" (MZ's folder) will come here too
872
LoadSpriteSheet("MZ/Objects.gif")
873
SpriteFrame(-8, -14, 16, 22, 18, 81) // Head (Mouth Closed) - #0
874
SpriteFrame(-8, -15, 16, 22, 18, 81) // Head (Mouth Closed) - #1
875
SpriteFrame(-8, -16, 16, 22, 18, 81) // Head (Mouth Closed) - #2
876
SpriteFrame(-8, -17, 16, 22, 18, 81) // Head (Mouth Closed) - #3
877
SpriteFrame(-8, -18, 16, 22, 18, 81) // Head (Mouth Closed) - #4
878
SpriteFrame(-8, -19, 16, 22, 18, 81) // Head (Mouth Closed) - #5
879
SpriteFrame(-8, -20, 16, 22, 18, 81) // Head (Mouth Closed) - #6
880
SpriteFrame(-8, -21, 16, 22, 18, 81) // Head (Mouth Closed) - #7
881
SpriteFrame(-8, -14, 16, 24, 1, 81) // Head (Mouth Open) - #8
882
SpriteFrame(-8, -15, 16, 24, 1, 81) // Head (Mouth Open) - #9
883
SpriteFrame(-8, -16, 16, 24, 1, 81) // Head (Mouth Open) - #10
884
SpriteFrame(-8, -17, 16, 24, 1, 81) // Head (Mouth Open) - #11
885
SpriteFrame(-8, -18, 16, 24, 1, 81) // Head (Mouth Open) - #12
886
SpriteFrame(-8, -19, 16, 24, 1, 81) // Head (Mouth Open) - #13
887
SpriteFrame(-8, -20, 16, 24, 1, 81) // Head (Mouth Open) - #14
888
SpriteFrame(-8, -21, 16, 24, 1, 81) // Head (Mouth Open) - #15
889
SpriteFrame(-8, -8, 16, 16, 35, 81) // Body - #16
890
SpriteFrame(-8, -9, 16, 16, 35, 81) // Body - #17
891
SpriteFrame(-8, -10, 16, 16, 35, 81) // Body - #18
892
SpriteFrame(-8, -11, 16, 16, 35, 81) // Body - #19
893
SpriteFrame(-8, -12, 16, 16, 35, 81) // Body - #20
894
SpriteFrame(-8, -13, 16, 16, 35, 81) // Body - #21
895
SpriteFrame(-8, -14, 16, 16, 35, 81) // Body - #22
896
SpriteFrame(-8, -15, 16, 16, 35, 81) // Body - #23
897
end if
898
899
AddEditorVariable("direction")
900
SetActiveVariable("direction")
901
AddEnumVariable("Left", 0)
902
AddEnumVariable("Right", 1)
903
end event
904
905