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