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/ReviveCaterkiller.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
// ========================
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 object.value15 : object.xBoundary1
33
private alias object.value16 : object.xBoundary2
34
35
private alias object.value17 : object.bodyPositionRevive.x
36
private alias object.value18 : object.bodyPositionRevive.y
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
private alias 6 : CATERKILLER_REVIVE
45
46
// Player aliases
47
private alias object.value40 : player.hitboxLeft
48
private alias object.value38 : player.hitboxTop
49
private alias object.value41 : player.hitboxRight
50
private alias object.value39 : player.hitboxBottom
51
52
// Revive Enemy Aliases
53
private alias object.value47 : object.backupType
54
private alias object.value46 : object.backupState
55
private alias object.value44 : object.backupvalueA
56
private alias object.value43 : object.backupvalueB
57
private alias object.value0 : object.target
58
59
// Mission Number Aliases
60
private alias 8 : MISSIONNO_MERCY
61
62
// Tile Info ID Aliases
63
private alias 1 : TILEINFO_DIRECTION
64
private alias 6 : TILEINFO_ANGLEA
65
66
// Path ID Aliases
67
private alias 0 : PATH_A
68
69
70
// ========================
71
// Function Declarations
72
// ========================
73
74
reserve function Caterkiller_SetupBody
75
reserve function Caterkiller_DebugDraw
76
reserve function Caterkiller_DebugSpawn
77
reserve function Caterkiller_CheckPlayerCollisions
78
reserve function Caterkiller_CheckTileAngle
79
reserve function Caterkiller_CheckTileCollisions
80
81
82
// ========================
83
// Function Definitions
84
// ========================
85
86
private function Caterkiller_SetupBody
87
object[arrayPos0].bodyPositionRevive.x = object[arrayPos0].bodyPosition1.x
88
object[arrayPos0].bodyPositionRevive.y = object[arrayPos0].bodyPosition1.y
89
90
object[arrayPos0].startPos.x = object[arrayPos0].xpos
91
object[arrayPos0].startPos.y = object[arrayPos0].ypos
92
93
temp0 = object[arrayPos0].xpos
94
temp1 = 0xC0000
95
if temp7 == FLIP_X
96
FlipSign(temp1)
97
end if
98
object[arrayPos0].direction = temp7
99
object[arrayPos0].frame = 0
100
temp0 += temp1
101
102
object[arrayPos0].bodyPosition1.x = temp0
103
object[arrayPos0].bodyPosition1.y = object[arrayPos0].ypos
104
object[arrayPos0].bodyDirection1 = object[arrayPos0].direction
105
object[arrayPos0].bodyFrame1 = 0
106
temp0 += temp1
107
108
object[arrayPos0].bodyPosition2.x = temp0
109
object[arrayPos0].bodyPosition2.y = object[arrayPos0].ypos
110
object[arrayPos0].bodyDirection2 = object[arrayPos0].direction
111
object[arrayPos0].bodyFrame2 = 0
112
temp0 += temp1
113
114
object[arrayPos0].bodyPosition3.x = temp0
115
object[arrayPos0].bodyPosition3.y = object[arrayPos0].ypos
116
object[arrayPos0].bodyDirection3 = object[arrayPos0].direction
117
object[arrayPos0].bodyFrame3 = 0
118
119
object[arrayPos0].state = CATERKILLER_SETUP
120
object[arrayPos0].timer = 0
121
122
object[arrayPos0].xBoundary1 = object[arrayPos0].xpos
123
object[arrayPos0].xBoundary1 &= -0x200000
124
object[arrayPos0].xBoundary2 = object[arrayPos0].xBoundary1
125
if object[arrayPos0].bodyPositionRevive.y > 2
126
temp0 = object[arrayPos0].bodyPositionRevive.y
127
temp0 *= 0x200000
128
object[arrayPos0].xBoundary2 += temp0
129
else
130
object[arrayPos0].xBoundary2 += 0x400000
131
end if
132
temp0 = object[arrayPos0].bodyPositionRevive.x
133
temp0 *= 0x200000
134
object[arrayPos0].xBoundary1 -= temp0
135
end function
136
137
138
private function Caterkiller_DebugDraw
139
temp0 = object.xpos
140
GetBit(temp1, object.direction, 0)
141
if temp1 == FLIP_NONE
142
temp0 += 0x240000
143
temp1 = -0xC0000
144
else
145
temp0 -= 0x240000
146
temp1 = 0xC0000
147
end if
148
149
temp2 = 0
150
while temp2 < 3
151
DrawSpriteFX(16, FX_FLIP, temp0, object.ypos)
152
temp0 += temp1
153
temp2++
154
loop
155
156
DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)
157
end function
158
159
160
private function Caterkiller_DebugSpawn
161
temp0 = object.ixpos
162
temp0 <<= 16
163
temp1 = object.iypos
164
temp1 <<= 16
165
166
CreateTempObject(TypeName[Caterkiller], 0, temp0, temp1)
167
arrayPos0 = object[tempObjectPos].entityPos
168
temp7 = object.direction
169
170
CallFunction(Caterkiller_SetupBody)
171
end function
172
173
174
private function Caterkiller_CheckPlayerCollisions
175
temp7 = false
176
temp5 = object.xpos
177
temp6 = object.ypos
178
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
179
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)
180
if checkResult == true
181
CreateTempObject(TypeName[Revive Enemy], object.propertyValue, object.startPos.x, object.startPos.y)
182
object[tempObjectPos].priority = PRIORITY_ACTIVE
183
object[tempObjectPos].target = object.entityPos
184
object[tempObjectPos].backupType = object.type
185
object[tempObjectPos].backupState = CATERKILLER_REVIVE
186
object[tempObjectPos].backupvalueA = object.bodyPositionRevive.x
187
object[tempObjectPos].backupvalueB = object.bodyPositionRevive.y
188
CallFunction(Player_BadnikBreak)
189
else
190
object.xpos = object.bodyPosition1.x
191
object.ypos = object.bodyPosition1.y
192
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
193
if checkResult == true
194
CallFunction(Player_Hit)
195
temp7 = true
196
else
197
object.xpos = object.bodyPosition2.x
198
object.ypos = object.bodyPosition2.y
199
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
200
if checkResult == true
201
CallFunction(Player_Hit)
202
temp7 = true
203
else
204
object.xpos = object.bodyPosition3.x
205
object.ypos = object.bodyPosition3.y
206
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
207
if checkResult == true
208
CallFunction(Player_Hit)
209
temp7 = true
210
end if
211
end if
212
end if
213
end if
214
215
object.xpos = temp5
216
object.ypos = temp6
217
next
218
219
// Uh oh! we hit the body! time to explode!
220
if temp7 == true
221
temp0 = object.frame
222
temp0 <<= 15
223
object.ypos -= temp0
224
225
CreateTempObject(TypeName[Caterkiller], 0, object.xpos, object.ypos)
226
if object.direction == FLIP_NONE
227
object[tempObjectPos].xvel = -0x20000
228
else
229
object[tempObjectPos].xvel = 0x20000
230
end if
231
object[tempObjectPos].yvel = -0x40000
232
object[tempObjectPos].direction = object.direction
233
object[tempObjectPos].frame = object.frame
234
object[tempObjectPos].frame &= 8
235
object[tempObjectPos].state = CATERKILLER_SPLITBODYPART
236
object[tempObjectPos].priority = PRIORITY_ACTIVE_SMALL
237
238
CreateTempObject(TypeName[Caterkiller], 0, object.bodyPosition1.x, object.bodyPosition1.y)
239
if object.bodyDirection1 == FLIP_NONE
240
object[tempObjectPos].xvel = -0x18000
241
else
242
object[tempObjectPos].xvel = 0x18000
243
end if
244
object[tempObjectPos].yvel = -0x40000
245
object[tempObjectPos].direction = object.bodyDirection1
246
object[tempObjectPos].frame = 16
247
object[tempObjectPos].state = CATERKILLER_SPLITBODYPART
248
object[tempObjectPos].priority = PRIORITY_ACTIVE_SMALL
249
temp0 = object.bodyFrame2
250
temp0 <<= 15
251
object.bodyPosition2.y -= temp0
252
object.frame -= temp0
253
254
CreateTempObject(TypeName[Caterkiller], 0, object.bodyPosition2.x, object.bodyPosition2.y)
255
if object.bodyDirection2 == FLIP_NONE
256
object[tempObjectPos].xvel = 0x18000
257
else
258
object[tempObjectPos].xvel = -0x18000
259
end if
260
object[tempObjectPos].yvel = -0x40000
261
object[tempObjectPos].direction = object.bodyDirection2
262
object[tempObjectPos].frame = 16
263
object[tempObjectPos].state = CATERKILLER_SPLITBODYPART
264
object[tempObjectPos].priority = PRIORITY_ACTIVE_SMALL
265
266
CreateTempObject(TypeName[Caterkiller], 0, object.bodyPosition3.x, object.bodyPosition3.y)
267
if object.bodyDirection3 == FLIP_NONE
268
object[tempObjectPos].xvel = 0x20000
269
else
270
object[tempObjectPos].xvel = -0x20000
271
end if
272
object[tempObjectPos].yvel = -0x40000
273
object[tempObjectPos].direction = object.bodyDirection3
274
object[tempObjectPos].frame = 16
275
object[tempObjectPos].state = CATERKILLER_SPLITBODYPART
276
object[tempObjectPos].priority = PRIORITY_ACTIVE_SMALL
277
278
CreateTempObject(TypeName[Revive Enemy], object.propertyValue, object.startPos.x, object.startPos.y)
279
object[tempObjectPos].priority = PRIORITY_ACTIVE
280
object[tempObjectPos].target = object.entityPos
281
object[tempObjectPos].backupType = object.type
282
object[tempObjectPos].backupState = CATERKILLER_REVIVE
283
object[tempObjectPos].backupvalueA = object.bodyPositionRevive.x
284
object[tempObjectPos].backupvalueB = object.bodyPositionRevive.y
285
286
ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, object.xpos, object.ypos)
287
288
if game.playMode == BOOT_PLAYMODE_MISSION
289
CallNativeFunction2(NotifyCallback, NOTIFY_KILL_ENEMY, temp0)
290
end if
291
end if
292
end function
293
294
295
private function Caterkiller_CheckTileAngle
296
temp2 >>= 16
297
temp3 >>= 16
298
temp3 += 8
299
Get16x16TileInfo(temp5, temp2, temp3, TILEINFO_ANGLEA)
300
Get16x16TileInfo(temp6, temp2, temp3, TILEINFO_DIRECTION)
301
switch temp6
302
case FLIP_NONE
303
temp5 &= 255
304
break
305
306
case FLIP_X
307
temp5 &= 255
308
temp6 = temp5
309
temp5 = 256
310
temp5 -= temp6
311
temp5 &= 255
312
break
313
314
case FLIP_Y
315
temp5 >>= 24
316
temp5 += 128
317
temp6 = temp5
318
temp5 = 256
319
temp5 -= temp6
320
temp5 &= 255
321
break
322
323
case FLIP_XY
324
temp5 >>= 24
325
temp5 += 128
326
temp5 &= 255
327
break
328
329
end switch
330
331
checkResult = false
332
if temp4 == FLIP_NONE
333
if temp5 < 128
334
if temp5 > 24
335
checkResult = true
336
end if
337
end if
338
else
339
if temp5 > 128
340
if temp5 < 232
341
checkResult = true
342
end if
343
end if
344
end if
345
end function
346
347
348
private function Caterkiller_CheckTileCollisions
349
if object.state != CATERKILLER_LIFTHEAD
350
CheckLower(object.xpos, object.xBoundary1)
351
temp2 = checkResult
352
CheckGreater(object.xpos, object.xBoundary2)
353
checkResult |= temp2
354
if checkResult == true
355
object.direction ^= 1
356
end if
357
end if
358
359
CheckLower(object.bodyPosition1.x, object.xBoundary1)
360
temp2 = checkResult
361
CheckGreater(object.bodyPosition1.x, object.xBoundary2)
362
checkResult |= temp2
363
if checkResult == true
364
object.bodyDirection1 = object.direction
365
end if
366
367
CheckLower(object.bodyPosition2.x, object.xBoundary1)
368
temp2 = checkResult
369
CheckGreater(object.bodyPosition2.x, object.xBoundary2)
370
checkResult |= temp2
371
if checkResult == true
372
object.bodyDirection2 = object.direction
373
end if
374
375
if object.state != CATERKILLER_LOWERHEAD
376
CheckLower(object.bodyPosition3.x, object.xBoundary1)
377
temp2 = checkResult
378
CheckGreater(object.bodyPosition3.x, object.xBoundary2)
379
checkResult |= temp2
380
if checkResult == true
381
object.bodyDirection3 = object.direction
382
end if
383
end if
384
end function
385
386
387
// ========================
388
// Events
389
// ========================
390
391
event ObjectUpdate
392
switch object.state
393
case CATERKILLER_SETUP
394
object.priority = PRIORITY_ACTIVE
395
// [Fallthrough]
396
397
case CATERKILLER_CONTRACT
398
if object.timer == 0
399
object.timer = 15
400
object.state++
401
object.frame = -1
402
object.bodyFrame2 = -1
403
// fallthrough....right.?
404
else
405
object.timer--
406
CallFunction(Caterkiller_CheckPlayerCollisions)
407
break //whats this doin here
408
end if
409
// [Fallthrough, I think]
410
case CATERKILLER_LIFTHEAD
411
if object.timer == 0
412
object.timer = 7
413
object.state++
414
else
415
object.timer--
416
417
if object.bodyDirection1 == FLIP_NONE
418
object.bodyPosition1.x -= 0x4000
419
else
420
object.bodyPosition1.x += 0x4000
421
end if
422
423
if object.bodyDirection2 == FLIP_NONE
424
object.bodyPosition2.x -= 0x8000
425
else
426
object.bodyPosition2.x += 0x8000
427
end if
428
429
if object.bodyDirection3 == FLIP_NONE
430
object.bodyPosition3.x -= 0xC000
431
else
432
object.bodyPosition3.x += 0xC000
433
end if
434
435
object.frame++
436
object.bodyFrame2++
437
CallFunction(Caterkiller_CheckTileCollisions)
438
CallFunction(Caterkiller_CheckPlayerCollisions)
439
end if
440
break
441
442
case CATERKILLER_UNCONTRACT
443
if object.timer == 0
444
object.timer = 15
445
object.state++
446
object.frame = 16
447
object.bodyFrame2 = 16
448
else
449
object.timer--
450
CallFunction(Caterkiller_CheckPlayerCollisions)
451
break
452
end if
453
// [Fallthrough]
454
case CATERKILLER_LOWERHEAD
455
if object.timer == 0
456
object.timer = 7
457
object.state = CATERKILLER_CONTRACT
458
else
459
object.timer--
460
if object.direction == FLIP_NONE
461
object.xpos -= 0xC000
462
else
463
object.xpos += 0xC000
464
end if
465
466
if object.bodyDirection1 == FLIP_NONE
467
object.bodyPosition1.x -= 0x8000
468
else
469
object.bodyPosition1.x += 0x8000
470
end if
471
472
if object.bodyDirection2 == FLIP_NONE
473
object.bodyPosition2.x -= 0x4000
474
else
475
object.bodyPosition2.x += 0x4000
476
end if
477
478
object.frame--
479
object.bodyFrame2--
480
CallFunction(Caterkiller_CheckTileCollisions)
481
CallFunction(Caterkiller_CheckPlayerCollisions)
482
end if
483
break
484
485
case CATERKILLER_SPLITBODYPART
486
object.xpos += object.xvel
487
object.ypos += object.yvel
488
object.yvel += 0x3800
489
490
if object.yvel > 0
491
ObjectTileCollision(CSIDE_FLOOR, 0, 8, PATH_A)
492
if checkResult == true
493
object.yvel = -0x40000
494
end if
495
end if
496
497
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
498
BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)
499
if checkResult == true
500
if object.frame < 16
501
CallFunction(Player_BadnikBreak)
502
else
503
CallFunction(Player_Hit)
504
end if
505
end if
506
next
507
508
if object.outOfBounds == true
509
object.type = TypeName[Blank Object]
510
end if
511
break
512
513
case CATERKILLER_REVIVE
514
object.startPos.x = object.xpos
515
object.startPos.y = object.ypos
516
object.bodyPosition1.x = object.backupvalueA
517
object.bodyPosition1.y = object.backupvalueB
518
arrayPos0 = object.entityPos
519
temp7 = object.propertyValue
520
CallFunction(Caterkiller_SetupBody)
521
object.state = CATERKILLER_SETUP
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
object.bodyPosition1.x = object.bodyPositionRevive.x
536
object.bodyPosition1.y = object.bodyPositionRevive.y
537
CallFunction(Caterkiller_SetupBody)
538
else
539
object.xpos = temp0
540
object.ypos = temp1
541
end if
542
end if
543
end if
544
end event
545
546
547
event ObjectDraw
548
if object.state < CATERKILLER_SPLITBODYPART
549
temp0 = object.direction
550
object.direction = object.bodyDirection3
551
temp1 = object.bodyFrame3
552
temp1 >>= 1
553
temp1 += 16
554
DrawSpriteFX(temp1, FX_FLIP, object.bodyPosition3.x, object.bodyPosition3.y)
555
556
object.direction = object.bodyDirection2
557
temp1 = object.bodyFrame2
558
temp1 >>= 1
559
temp1 += 16
560
DrawSpriteFX(temp1, FX_FLIP, object.bodyPosition2.x, object.bodyPosition2.y)
561
562
object.direction = object.bodyDirection1
563
temp1 = object.bodyFrame1
564
temp1 >>= 1
565
temp1 += 16
566
DrawSpriteFX(temp1, FX_FLIP, object.bodyPosition1.x, object.bodyPosition1.y)
567
568
object.direction = temp0
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
CheckCurrentStageFolder("Zone02")
778
if checkResult == true
779
LoadSpriteSheet("MZ/Objects.gif")
780
SpriteFrame(-8, -14, 16, 22, 18, 81)
781
SpriteFrame(-8, -15, 16, 22, 18, 81)
782
SpriteFrame(-8, -16, 16, 22, 18, 81)
783
SpriteFrame(-8, -17, 16, 22, 18, 81)
784
SpriteFrame(-8, -18, 16, 22, 18, 81)
785
SpriteFrame(-8, -19, 16, 22, 18, 81)
786
SpriteFrame(-8, -20, 16, 22, 18, 81)
787
SpriteFrame(-8, -21, 16, 22, 18, 81)
788
SpriteFrame(-8, -14, 16, 24, 1, 81)
789
SpriteFrame(-8, -15, 16, 24, 1, 81)
790
SpriteFrame(-8, -16, 16, 24, 1, 81)
791
SpriteFrame(-8, -17, 16, 24, 1, 81)
792
SpriteFrame(-8, -18, 16, 24, 1, 81)
793
SpriteFrame(-8, -19, 16, 24, 1, 81)
794
SpriteFrame(-8, -20, 16, 24, 1, 81)
795
SpriteFrame(-8, -21, 16, 24, 1, 81)
796
SpriteFrame(-8, -8, 16, 16, 35, 81)
797
SpriteFrame(-8, -9, 16, 16, 35, 81)
798
SpriteFrame(-8, -10, 16, 16, 35, 81)
799
SpriteFrame(-8, -11, 16, 16, 35, 81)
800
SpriteFrame(-8, -12, 16, 16, 35, 81)
801
SpriteFrame(-8, -13, 16, 16, 35, 81)
802
SpriteFrame(-8, -14, 16, 16, 35, 81)
803
SpriteFrame(-8, -15, 16, 16, 35, 81)
804
end if
805
CheckCurrentStageFolder("Zone03")
806
if checkResult == true
807
LoadSpriteSheet("SYZ/Objects.gif")
808
SpriteFrame(-8, -14, 16, 22, 98, 98)
809
SpriteFrame(-8, -15, 16, 22, 98, 98)
810
SpriteFrame(-8, -16, 16, 22, 98, 98)
811
SpriteFrame(-8, -17, 16, 22, 98, 98)
812
SpriteFrame(-8, -18, 16, 22, 98, 98)
813
SpriteFrame(-8, -19, 16, 22, 98, 98)
814
SpriteFrame(-8, -20, 16, 22, 98, 98)
815
SpriteFrame(-8, -21, 16, 22, 98, 98)
816
SpriteFrame(-8, -14, 16, 24, 81, 98)
817
SpriteFrame(-8, -15, 16, 24, 81, 98)
818
SpriteFrame(-8, -16, 16, 24, 81, 98)
819
SpriteFrame(-8, -17, 16, 24, 81, 98)
820
SpriteFrame(-8, -18, 16, 24, 81, 98)
821
SpriteFrame(-8, -19, 16, 24, 81, 98)
822
SpriteFrame(-8, -20, 16, 24, 81, 98)
823
SpriteFrame(-8, -21, 16, 24, 81, 98)
824
SpriteFrame(-8, -8, 16, 16, 98, 121)
825
SpriteFrame(-8, -9, 16, 16, 98, 121)
826
SpriteFrame(-8, -10, 16, 16, 98, 121)
827
SpriteFrame(-8, -11, 16, 16, 98, 121)
828
SpriteFrame(-8, -12, 16, 16, 98, 121)
829
SpriteFrame(-8, -13, 16, 16, 98, 121)
830
SpriteFrame(-8, -14, 16, 16, 98, 121)
831
SpriteFrame(-8, -15, 16, 16, 98, 121)
832
end if
833
CheckCurrentStageFolder("Zone06")
834
if checkResult == true
835
LoadSpriteSheet("SBZ/Objects.gif")
836
SpriteFrame(-8, -14, 16, 22, 75, 26)
837
SpriteFrame(-8, -15, 16, 22, 75, 26)
838
SpriteFrame(-8, -16, 16, 22, 75, 26)
839
SpriteFrame(-8, -17, 16, 22, 75, 26)
840
SpriteFrame(-8, -18, 16, 22, 75, 26)
841
SpriteFrame(-8, -19, 16, 22, 75, 26)
842
SpriteFrame(-8, -20, 16, 22, 75, 26)
843
SpriteFrame(-8, -21, 16, 22, 75, 26)
844
SpriteFrame(-8, -14, 16, 24, 75, 1)
845
SpriteFrame(-8, -15, 16, 24, 75, 1)
846
SpriteFrame(-8, -16, 16, 24, 75, 1)
847
SpriteFrame(-8, -17, 16, 24, 75, 1)
848
SpriteFrame(-8, -18, 16, 24, 75, 1)
849
SpriteFrame(-8, -19, 16, 24, 75, 1)
850
SpriteFrame(-8, -20, 16, 24, 75, 1)
851
SpriteFrame(-8, -21, 16, 24, 75, 1)
852
SpriteFrame(-8, -8, 16, 16, 75, 49)
853
SpriteFrame(-8, -9, 16, 16, 75, 49)
854
SpriteFrame(-8, -10, 16, 16, 75, 49)
855
SpriteFrame(-8, -11, 16, 16, 75, 49)
856
SpriteFrame(-8, -12, 16, 16, 75, 49)
857
SpriteFrame(-8, -13, 16, 16, 75, 49)
858
SpriteFrame(-8, -14, 16, 16, 75, 49)
859
SpriteFrame(-8, -15, 16, 16, 75, 49)
860
end if
861
CheckCurrentStageFolder("Zone07")
862
if checkResult == true
863
LoadSpriteSheet("MBZ/Objects.gif")
864
SpriteFrame(-8, -14, 16, 22, 1, 68)
865
SpriteFrame(-8, -15, 16, 22, 1, 68)
866
SpriteFrame(-8, -16, 16, 22, 1, 68)
867
SpriteFrame(-8, -17, 16, 22, 1, 68)
868
SpriteFrame(-8, -18, 16, 22, 1, 68)
869
SpriteFrame(-8, -19, 16, 22, 1, 68)
870
SpriteFrame(-8, -20, 16, 22, 1, 68)
871
SpriteFrame(-8, -21, 16, 22, 1, 68)
872
SpriteFrame(-8, -14, 16, 24, 18, 68)
873
SpriteFrame(-8, -15, 16, 24, 18, 68)
874
SpriteFrame(-8, -16, 16, 24, 18, 68)
875
SpriteFrame(-8, -17, 16, 24, 18, 68)
876
SpriteFrame(-8, -18, 16, 24, 18, 68)
877
SpriteFrame(-8, -19, 16, 24, 18, 68)
878
SpriteFrame(-8, -20, 16, 24, 18, 68)
879
SpriteFrame(-8, -21, 16, 24, 18, 68)
880
SpriteFrame(-8, -8, 16, 16, 35, 68)
881
SpriteFrame(-8, -9, 16, 16, 35, 68)
882
SpriteFrame(-8, -10, 16, 16, 35, 68)
883
SpriteFrame(-8, -11, 16, 16, 35, 68)
884
SpriteFrame(-8, -12, 16, 16, 35, 68)
885
SpriteFrame(-8, -13, 16, 16, 35, 68)
886
SpriteFrame(-8, -14, 16, 16, 35, 68)
887
SpriteFrame(-8, -15, 16, 16, 35, 68)
888
end if
889
890
AddEditorVariable("direction")
891
SetActiveVariable("direction")
892
AddEnumVariable("Left", 0)
893
AddEnumVariable("Right", 1)
894
895
// TODO: val1 is set from editor?? bodyPosition1.y??? huh? (M102)
896
end event
897
898