Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/CPZ/TransportTube.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Transport Tube 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.targetPlayer
13
private alias object.value1 : object.newPos.x
14
private alias object.value2 : object.newPos.y
15
private alias object.value3 : object.timer
16
private alias object.value7 : object.hitboxRight
17
private alias object.value8 : object.tubeType
18
private alias object.value9 : object.transportPath
19
private alias object.value10 : object.transportTable
20
private alias object.value11 : object.tablePos
21
private alias object.value12 : object.transportDelay
22
23
private alias 0 : TRANSPORTTUBE_AWAITPLAYER
24
private alias 1 : TRANSPORTTUBE_BLANK
25
private alias 2 : TRANSPORTTUBE_HASPLAYER
26
private alias 3 : TRANSPORTTUBE_TRANSPORTING
27
private alias 4 : TRANSPORTTUBE_EXITNODE
28
29
// Player Aliases
30
private alias object.type : player.type
31
private alias object.state : player.state
32
private alias object.xpos : player.xpos
33
private alias object.ypos : player.ypos
34
private alias object.xvel : player.xvel
35
private alias object.yvel : player.yvel
36
private alias object.speed : player.speed
37
private alias object.gravity : player.gravity
38
private alias object.animationSpeed : player.animationSpeed
39
private alias object.animation : player.animation
40
private alias object.interaction : player.interaction
41
private alias object.scrollTracking : player.scrollTracking
42
private alias object.tileCollisions : player.tileCollisions
43
private alias object.value1 : player.timer
44
private alias object.value5 : player.rollAnimationSpeed
45
private alias object.value18 : player.sortedDrawOrder
46
47
// ========================
48
// Function Declarations
49
// ========================
50
51
reserve function TransportTube_HandleVelChange
52
53
// ========================
54
// Tables
55
// ========================
56
57
private table TransportTube_sizeTable
58
160, 256, 288
59
end table
60
61
private table TransportTube_pathsTable
62
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 0, 1, 2, 1
63
end table
64
65
private table TransportTube_transportDelays1
66
29, 23, 29, 23, 28, 23, 28, 23, 29, 23, 29, 23
67
end table
68
69
private table TransportTube_transportDelays2
70
5, 5, 10, 5, 5, 5, 4, 6, 6, 4, 4, 6, 5, 3, 7
71
end table
72
73
private table TransportTube_nodeFlagsTable
74
2, 1, 0, 0
75
-1, 3, 0, 0
76
4, -2, 0, 0
77
-3, -4, 0, 0
78
-5, -5, 0, 0
79
7, 6, 0, 0
80
-7, -6, 0, 0
81
8, 9, 0, 0
82
-8, -9, 0, 0
83
11, 10, 0, 0
84
12, 0, 0, 0
85
-11, -10, 0, 0
86
-12, 0, 0, 0
87
0, 13, 0, 0
88
-13, 14, 0, 0
89
0, -14, 0, 0
90
end table
91
92
private table TransportTube_transportTables1[12]
93
94
private table TransportTube_transportTables2[15]
95
96
// Lots of large tables here...
97
// They store all
98
99
private table TransportTube_transportPath1_0
100
0x900000, 0x100000
101
0x900000, 0x700000
102
0x400000, 0x700000
103
0x350000, 0x6F0000
104
0x280000, 0x6A0000
105
0x1E0000, 0x620000
106
0x150000, 0x580000
107
0x110000, 0x4A0000
108
0x100000, 0x400000
109
0x110000, 0x350000
110
0x150000, 0x270000
111
0x1E0000, 0x1E0000
112
0x280000, 0x150000
113
0x350000, 0x110000
114
0x400000, 0x100000
115
0x500000, 0x100000
116
0x5E0000, 0x120000
117
0x680000, 0x180000
118
0x6D0000, 0x240000
119
0x700000, 0x300000
120
0x6D0000, 0x3D0000
121
0x680000, 0x480000
122
0x5E0000, 0x4E0000
123
0x500000, 0x500000
124
0x300000, 0x500000
125
0x220000, 0x520000
126
0x170000, 0x5A0000
127
0x110000, 0x630000
128
0x100000, 0x700000
129
end table
130
131
private table TransportTube_transportPath1_1
132
0x900000, 0x100000
133
0x900000, 0x700000
134
0x400000, 0x700000
135
0x2E0000, 0x6E0000
136
0x1D0000, 0x620000
137
0x130000, 0x530000
138
0x100000, 0x400000
139
0x130000, 0x2D0000
140
0x1D0000, 0x1E0000
141
0x2E0000, 0x130000
142
0x400000, 0x100000
143
0x580000, 0x100000
144
0x640000, 0x140000
145
0x6C0000, 0x1A0000
146
0x700000, 0x280000
147
0x6C0000, 0x360000
148
0x640000, 0x3C0000
149
0x580000, 0x400000
150
0x4B0000, 0x3D0000
151
0x400000, 0x380000
152
0x360000, 0x320000
153
0x280000, 0x300000
154
0x100000, 0x300000
155
end table
156
157
private table TransportTube_transportPath1_2
158
0x100000, 0x700000
159
0x110000, 0x630000
160
0x170000, 0x5A0000
161
0x220000, 0x520000
162
0x300000, 0x500000
163
0x500000, 0x500000
164
0x5E0000, 0x4E0000
165
0x680000, 0x480000
166
0x6D0000, 0x3D0000
167
0x700000, 0x300000
168
0x6D0000, 0x240000
169
0x680000, 0x180000
170
0x5E0000, 0x120000
171
0x500000, 0x100000
172
0x400000, 0x100000
173
0x350000, 0x110000
174
0x280000, 0x150000
175
0x1E0000, 0x1E0000
176
0x150000, 0x270000
177
0x110000, 0x350000
178
0x100000, 0x400000
179
0x110000, 0x4A0000
180
0x150000, 0x580000
181
0x1E0000, 0x620000
182
0x280000, 0x6A0000
183
0x350000, 0x6F0000
184
0x400000, 0x700000
185
0x900000, 0x700000
186
0x900000, 0x100000
187
end table
188
189
private table TransportTube_transportPath1_3
190
0x100000, 0x300000
191
0x280000, 0x300000
192
0x360000, 0x320000
193
0x400000, 0x380000
194
0x4B0000, 0x3D0000
195
0x580000, 0x400000
196
0x640000, 0x3C0000
197
0x6C0000, 0x360000
198
0x700000, 0x280000
199
0x6C0000, 0x1A0000
200
0x640000, 0x140000
201
0x580000, 0x100000
202
0x400000, 0x100000
203
0x2E0000, 0x130000
204
0x1D0000, 0x1E0000
205
0x130000, 0x2D0000
206
0x100000, 0x400000
207
0x130000, 0x530000
208
0x1D0000, 0x620000
209
0x2E0000, 0x6E0000
210
0x400000, 0x700000
211
0x900000, 0x700000
212
0x900000, 0x100000
213
end table
214
215
private table TransportTube_transportPath1_4
216
0x100000, 0x100000
217
0x100000, 0x700000
218
0xC00000, 0x700000
219
0xCA0000, 0x6F0000
220
0xD40000, 0x6C0000
221
0xDB0000, 0x680000
222
0xE30000, 0x620000
223
0xE80000, 0x5A0000
224
0xED0000, 0x520000
225
0xEF0000, 0x480000
226
0xF00000, 0x400000
227
0xEF0000, 0x360000
228
0xED0000, 0x2E0000
229
0xE80000, 0x260000
230
0xE30000, 0x1E0000
231
0xDB0000, 0x170000
232
0xD40000, 0x140000
233
0xCA0000, 0x120000
234
0xC00000, 0x100000
235
0xB70000, 0x110000
236
0xAF0000, 0x120000
237
0xA60000, 0x170000
238
0x9E0000, 0x1E0000
239
0x970000, 0x260000
240
0x930000, 0x2E0000
241
0x910000, 0x360000
242
0x900000, 0x400000
243
0x900000, 0x700000
244
end table
245
246
private table TransportTube_transportPath1_5
247
0x100000, 0x100000
248
0x100000, 0x700000
249
0xC00000, 0x700000
250
0xD20000, 0x6E0000
251
0xE30000, 0x620000
252
0xED0000, 0x530000
253
0xF00000, 0x400000
254
0xED0000, 0x2D0000
255
0xE30000, 0x1E0000
256
0xD20000, 0x130000
257
0xC00000, 0x100000
258
0xA80000, 0x100000
259
0x9C0000, 0x140000
260
0x940000, 0x1A0000
261
0x900000, 0x280000
262
0x940000, 0x360000
263
0x9C0000, 0x3C0000
264
0xA80000, 0x400000
265
0xB50000, 0x3D0000
266
0xC00000, 0x380000
267
0xCA0000, 0x320000
268
0xD80000, 0x300000
269
0xF00000, 0x300000
270
end table
271
272
private table TransportTube_transportPath1_6
273
0x900000, 0x700000
274
0x900000, 0x400000
275
0x910000, 0x360000
276
0x930000, 0x2E0000
277
0x970000, 0x260000
278
0x9E0000, 0x1E0000
279
0xA60000, 0x170000
280
0xAF0000, 0x120000
281
0xB70000, 0x110000
282
0xC00000, 0x100000
283
0xCA0000, 0x120000
284
0xD40000, 0x140000
285
0xDB0000, 0x170000
286
0xE30000, 0x1E0000
287
0xE80000, 0x260000
288
0xED0000, 0x2E0000
289
0xEF0000, 0x360000
290
0xF00000, 0x400000
291
0xEF0000, 0x480000
292
0xED0000, 0x520000
293
0xE80000, 0x5A0000
294
0xE30000, 0x620000
295
0xDB0000, 0x680000
296
0xD40000, 0x6C0000
297
0xCA0000, 0x6F0000
298
0xC00000, 0x700000
299
0x100000, 0x700000
300
0x100000, 0x100000
301
end table
302
303
private table TransportTube_transportPath1_7
304
0xF00000, 0x300000
305
0xD80000, 0x300000
306
0xCA0000, 0x320000
307
0xC00000, 0x380000
308
0xB50000, 0x3D0000
309
0xA80000, 0x400000
310
0x9C0000, 0x3C0000
311
0x940000, 0x360000
312
0x900000, 0x280000
313
0x940000, 0x1A0000
314
0x9C0000, 0x140000
315
0xA80000, 0x100000
316
0xC00000, 0x100000
317
0xD20000, 0x130000
318
0xE30000, 0x1E0000
319
0xED0000, 0x2D0000
320
0xF00000, 0x400000
321
0xED0000, 0x530000
322
0xE30000, 0x620000
323
0xD20000, 0x6E0000
324
0xC00000, 0x700000
325
0x100000, 0x700000
326
0x100000, 0x100000
327
end table
328
329
private table TransportTube_transportPath1_8
330
0x1100000, 0x100000
331
0x1100000, 0x700000
332
0x400000, 0x700000
333
0x350000, 0x6F0000
334
0x280000, 0x6A0000
335
0x1E0000, 0x620000
336
0x150000, 0x580000
337
0x110000, 0x4A0000
338
0x100000, 0x400000
339
0x110000, 0x350000
340
0x150000, 0x270000
341
0x1E0000, 0x1E0000
342
0x280000, 0x150000
343
0x350000, 0x110000
344
0x400000, 0x100000
345
0x500000, 0x100000
346
0x5E0000, 0x120000
347
0x680000, 0x180000
348
0x6D0000, 0x240000
349
0x700000, 0x300000
350
0x6D0000, 0x3D0000
351
0x680000, 0x480000
352
0x5E0000, 0x4E0000
353
0x500000, 0x500000
354
0x300000, 0x500000
355
0x220000, 0x520000
356
0x170000, 0x5A0000
357
0x110000, 0x630000
358
0x100000, 0x700000
359
end table
360
361
private table TransportTube_transportPath1_9
362
0x1100000, 0x100000
363
0x1100000, 0x700000
364
0x400000, 0x700000
365
0x2E0000, 0x6E0000
366
0x1D0000, 0x620000
367
0x130000, 0x530000
368
0x100000, 0x400000
369
0x130000, 0x2D0000
370
0x1D0000, 0x1E0000
371
0x2E0000, 0x130000
372
0x400000, 0x100000
373
0x580000, 0x100000
374
0x640000, 0x140000
375
0x6C0000, 0x1A0000
376
0x700000, 0x280000
377
0x6C0000, 0x360000
378
0x640000, 0x3C0000
379
0x580000, 0x400000
380
0x4B0000, 0x3D0000
381
0x400000, 0x380000
382
0x360000, 0x320000
383
0x280000, 0x300000
384
0x100000, 0x300000
385
end table
386
387
private table TransportTube_transportPath1_10
388
0x100000, 0x700000
389
0x110000, 0x630000
390
0x170000, 0x5A0000
391
0x220000, 0x520000
392
0x300000, 0x500000
393
0x500000, 0x500000
394
0x5E0000, 0x4E0000
395
0x680000, 0x480000
396
0x6D0000, 0x3D0000
397
0x700000, 0x300000
398
0x6D0000, 0x240000
399
0x680000, 0x180000
400
0x5E0000, 0x120000
401
0x500000, 0x100000
402
0x400000, 0x100000
403
0x350000, 0x110000
404
0x280000, 0x150000
405
0x1E0000, 0x1E0000
406
0x150000, 0x270000
407
0x110000, 0x350000
408
0x100000, 0x400000
409
0x110000, 0x4A0000
410
0x150000, 0x580000
411
0x1E0000, 0x620000
412
0x280000, 0x6A0000
413
0x350000, 0x6F0000
414
0x400000, 0x700000
415
0x1100000, 0x700000
416
0x1100000, 0x100000
417
end table
418
419
private table TransportTube_transportPath1_11
420
0x100000, 0x300000
421
0x280000, 0x300000
422
0x360000, 0x320000
423
0x400000, 0x380000
424
0x4B0000, 0x3D0000
425
0x580000, 0x400000
426
0x640000, 0x3C0000
427
0x6C0000, 0x360000
428
0x700000, 0x280000
429
0x6C0000, 0x1A0000
430
0x640000, 0x140000
431
0x580000, 0x100000
432
0x400000, 0x100000
433
0x2E0000, 0x130000
434
0x1D0000, 0x1E0000
435
0x130000, 0x2D0000
436
0x100000, 0x400000
437
0x130000, 0x530000
438
0x1D0000, 0x620000
439
0x2E0000, 0x6E0000
440
0x400000, 0x700000
441
0x1100000, 0x700000
442
0x1100000, 0x100000
443
end table
444
445
private table TransportTube_transportPath2_0
446
0x7900000, 0x3B00000
447
0x7100000, 0x3B00000
448
0x7100000, 0x6B00000
449
0xA900000, 0x6B00000
450
0xA900000, 0x6700000
451
end table
452
453
private table TransportTube_transportPath2_1
454
0x7900000, 0x3F00000
455
0x7900000, 0x4B00000
456
0xA000000, 0x4B00000
457
0xC100000, 0x4B00000
458
0xC100000, 0x3300000
459
0xD900000, 0x3300000
460
0xD900000, 0x1B00000
461
0xF100000, 0x1B00000
462
0xF100000, 0x2B00000
463
0xF900000, 0x2B00000
464
end table
465
466
private table TransportTube_transportPath2_2
467
0xAF00000, 0x6300000
468
0xE900000, 0x6300000
469
0xE900000, 0x6B00000
470
0xF900000, 0x6B00000
471
0xF900000, 0x6700000
472
end table
473
474
private table TransportTube_transportPath2_3
475
0xF900000, 0x2F00000
476
0xF900000, 0x4B00000
477
0xF100000, 0x4B00000
478
0xF100000, 0x6300000
479
0xF900000, 0x6300000
480
end table
481
482
private table TransportTube_transportPath2_4
483
0x14100000, 0x5300000
484
0x11900000, 0x5300000
485
0x11900000, 0x6B00000
486
0x14100000, 0x6B00000
487
0x14100000, 0x5700000
488
end table
489
490
private table TransportTube_transportPath2_5
491
0x1AF00000, 0x5300000
492
0x1B900000, 0x5300000
493
0x1B900000, 0x3300000
494
0x1E100000, 0x3300000
495
end table
496
497
private table TransportTube_transportPath2_6
498
0x1A900000, 0x5700000
499
0x1A900000, 0x5B00000
500
0x1C100000, 0x5B00000
501
0x1C100000, 0x4300000
502
0x1E100000, 0x4300000
503
0x1E100000, 0x3700000
504
end table
505
506
private table TransportTube_transportPath2_7
507
0x24900000, 0x3700000
508
0x24900000, 0x3D00000
509
0x23900000, 0x3D00000
510
0x23900000, 0x5D00000
511
0x25100000, 0x5D00000
512
0x25100000, 0x5700000
513
end table
514
515
private table TransportTube_transportPath2_8
516
0x24F00000, 0x3300000
517
0x25900000, 0x3300000
518
0x25900000, 0x5300000
519
0x25700000, 0x5300000
520
end table
521
522
private table TransportTube_transportPath2_9
523
0x3100000, 0x3300000
524
0x2900000, 0x3300000
525
0x2900000, 0x2300000
526
0x4900000, 0x2300000
527
end table
528
529
private table TransportTube_transportPath2_10
530
0x3100000, 0x3700000
531
0x3100000, 0x3B00000
532
0x4100000, 0x3B00000
533
0x4100000, 0x2B00000
534
0x4900000, 0x2B00000
535
0x4900000, 0x2700000
536
end table
537
538
private table TransportTube_transportPath2_11
539
0x4900000, 0x6F00000
540
0x4900000, 0x7300000
541
0x6900000, 0x7300000
542
0x8900000, 0x7300000
543
0x8900000, 0x6F00000
544
end table
545
546
private table TransportTube_transportPath2_12
547
0xBF00000, 0x3300000
548
0xD900000, 0x3300000
549
0xD900000, 0x2F00000
550
end table
551
552
private table TransportTube_transportPath2_13
553
0xD900000, 0x2B00000
554
0xC900000, 0x2B00000
555
0xC900000, 0xB00000
556
0xE800000, 0xB00000
557
0x11100000, 0xB00000
558
0x11100000, 0x2300000
559
0x10F00000, 0x2300000
560
end table
561
562
563
// ========================
564
// Function Definitions
565
// ========================
566
567
private function TransportTube_HandleVelChange
568
temp0 = object.newPos.x
569
temp2 = 0x800
570
temp0 -= player[currentPlayer].xpos
571
if temp0 < 0
572
FlipSign(temp0)
573
FlipSign(temp2)
574
end if
575
temp0 >>= 16
576
577
temp1 = object.newPos.y
578
temp3 = 0x800
579
temp1 -= player[currentPlayer].ypos
580
if temp1 < 0
581
FlipSign(temp1)
582
FlipSign(temp3)
583
end if
584
temp1 >>= 16
585
586
if temp1 >= temp0
587
temp1 = object.newPos.y
588
temp1 -= player[currentPlayer].ypos
589
temp1 &= 0xFFFF0000
590
temp1 /= temp3
591
temp0 = object.newPos.x
592
temp0 -= player[currentPlayer].xpos
593
if temp0 != 0
594
temp0 &= 0xFFFF0000
595
temp0 /= temp1
596
end if
597
temp0 <<= 8
598
temp3 <<= 8
599
temp1 >>= 8
600
player[currentPlayer].xvel = temp0
601
player[currentPlayer].yvel = temp3
602
Abs(temp1)
603
object.timer = temp1
604
else
605
temp0 = object.newPos.x
606
temp0 -= player[currentPlayer].xpos
607
temp0 &= 0xFFFF0000
608
temp0 /= temp2
609
temp1 = object.newPos.y
610
temp1 -= player[currentPlayer].ypos
611
if temp1 != 0
612
temp1 &= 0xFFFF0000
613
temp1 /= temp0
614
end if
615
temp1 <<= 8
616
temp2 <<= 8
617
temp0 >>= 8
618
player[currentPlayer].xvel = temp2
619
player[currentPlayer].yvel = temp1
620
Abs(temp0)
621
object.timer = temp0
622
end if
623
end function
624
625
626
// ========================
627
// Events
628
// ========================
629
630
event ObjectUpdate
631
switch object.state
632
case TRANSPORTTUBE_AWAITPLAYER
633
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
634
arrayPos0 = object.entityPos
635
arrayPos0 += currentPlayer
636
arrayPos0++
637
if player[currentPlayer].state != Player_State_Static
638
if player[currentPlayer].yvel > -0x40000
639
temp0 = object.hitboxright
640
BoxCollisionTest(C_TOUCH, object.entityPos, 0, 0, object.hitboxRight, 128, currentPlayer, 0, 0, 0, 0)
641
if checkResult == true
642
if object[arrayPos0].state == Player_State_Static
643
temp0 = player[currentPlayer].xpos
644
temp0 -= object.xpos
645
if object.hitboxRight == 256
646
FlipSign(temp0)
647
temp0 += 0x1000000
648
end if
649
650
if temp0 >= 0x800000
651
// We're entering the tube
652
if object.transportPath != 2
653
temp3 = object.transportPath
654
else
655
temp3 = stage.seconds
656
temp3 &= 1
657
end if
658
else
659
// We're about to exit the tube
660
temp1 = player[currentPlayer].ypos
661
temp1 -= object.ypos
662
if temp1 >= 0x400000
663
temp3 = 2
664
else
665
temp3 = 3
666
end if
667
end if
668
669
object[arrayPos0].transportPath = temp3
670
671
temp3 += object.tubetype
672
GetTableValue(object[arrayPos0].transportTable, temp3, TransportTube_transportTables1)
673
GetTableValue(object[arrayPos0].transportDelay, temp3, TransportTube_transportDelays1)
674
object[arrayPos0].transportDelay--
675
676
object[arrayPos0].tablePos = 0
677
GetTableValue(player[currentPlayer].xpos, object[arrayPos0].tablePos, object[arrayPos0].transportTable)
678
player[currentPlayer].xpos += object.xpos
679
680
object[arrayPos0].tablePos++
681
GetTableValue(player[currentPlayer].ypos, object[arrayPos0].tablePos, object[arrayPos0].transportTable)
682
player[currentPlayer].ypos += object.ypos
683
684
object[arrayPos0].tablePos++
685
temp0 = object[arrayPos0].tablePos
686
GetTableValue(object.newPos.x, temp0, object[arrayPos0].transportTable)
687
object.newPos.x += object.xpos
688
temp0++
689
690
GetTableValue(object.newPos.y, temp0, object[arrayPos0].transportTable)
691
object.newPos.y += object.ypos
692
693
CallFunction(TransportTube_HandleVelChange)
694
object[arrayPos0].timer = object.timer
695
object[arrayPos0].state = TRANSPORTTUBE_HASPLAYER
696
object[arrayPos0].propertyValue = object.propertyValue
697
object[arrayPos0].priority = PRIORITY_ACTIVE
698
object[arrayPos0].hitboxRight = object.hitboxRight
699
object[arrayPos0].targetPlayer = currentPlayer
700
701
player[currentPlayer].speed = 0
702
player[currentPlayer].timer = 0
703
player[currentPlayer].state = Player_State_Static
704
player[currentPlayer].tileCollisions = false
705
player[currentPlayer].interaction = false
706
player[currentPlayer].animation = ANI_JUMPING
707
player[currentPlayer].rollAnimationSpeed = 0
708
player[currentPlayer].animationSpeed = 0
709
player[currentPlayer].gravity = GRAVITY_AIR
710
player[currentPlayer].scrollTracking = true
711
player[currentPlayer].sortedDrawOrder = 4
712
PlaySfx(SfxName[Rolling], false)
713
end if
714
end if
715
end if
716
end if
717
next
718
break
719
720
case TRANSPORTTUBE_BLANK
721
break
722
723
case TRANSPORTTUBE_HASPLAYER
724
currentPlayer = object.targetPlayer
725
object.timer--
726
if object.timer >= 0
727
// waiting... (I think)
728
else
729
GetTableValue(player[currentPlayer].xpos, object.tablePos, object.transportTable)
730
player[currentPlayer].xpos += object.xpos
731
object.tablePos++
732
GetTableValue(player[currentPlayer].ypos, object.tablePos, object.transportTable)
733
player[currentPlayer].ypos += object.ypos
734
object.tablePos++
735
if object.transportPath < 0
736
object.tablePos -= 4
737
end if
738
739
object.transportDelay--
740
if object.transportDelay == 0
741
if object.transportPath >= 4
742
object.state = TRANSPORTTUBE_EXITNODE
743
player[currentPlayer].ypos &= 0x7FF0000
744
#platform: USE_STANDALONE
745
player[currentPlayer].state = Player_State_Air
746
#endplatform
747
#platform: USE_ORIGINS
748
player[currentPlayer].state = Player_State_Air_NoDropDash
749
#endplatform
750
player[currentPlayer].tileCollisions = true
751
player[currentPlayer].interaction = true
752
player[currentPlayer].xvel = 0
753
player[currentPlayer].yvel = -0x80000
754
755
PlaySfx(SfxName[Release], false)
756
else
757
temp0 = object.propertyValue
758
temp0 &= 0xFC // (~3)
759
temp0 += object.transportPath
760
object.transportPath = 4
761
762
GetTableValue(temp1, temp0, TransportTube_nodeFlagsTable)
763
if temp1 == 0
764
object.state = TRANSPORTTUBE_EXITNODE
765
player[currentPlayer].ypos &= 0x7FF0000
766
#platform: USE_STANDALONE
767
player[currentPlayer].state = Player_State_Air
768
#endplatform
769
#platform: USE_ORIGINS
770
player[currentPlayer].state = Player_State_Air_NoDropDash
771
#endplatform
772
player[currentPlayer].tileCollisions = true
773
player[currentPlayer].interaction = true
774
player[currentPlayer].xvel = 0
775
player[currentPlayer].yvel = -0x80000
776
777
PlaySfx(SfxName[Release], false)
778
else
779
if temp1 < 0
780
FlipSign(temp1)
781
object.transportPath = -4
782
GetTableValue(object.transportTable, temp1, TransportTube_transportTables2)
783
GetTableValue(object.transportDelay, temp1, TransportTube_transportDelays2)
784
object.transportDelay--
785
object.tablePos = object.transportDelay
786
object.tablePos <<= 1
787
else
788
GetTableValue(object.transportTable, temp1, TransportTube_transportTables2)
789
GetTableValue(object.transportDelay, temp1, TransportTube_transportDelays2)
790
object.transportDelay--
791
object.tablePos = 0
792
end if
793
794
GetTableValue(player[currentPlayer].xpos, object.tablePos, object.transportTable)
795
object.tablePos++
796
797
GetTableValue(player[currentPlayer].ypos, object.tablePos, object.transportTable)
798
object.tablePos++
799
800
if object.transportPath < 0
801
object.tablePos -= 4
802
end if
803
804
temp0 = object.tablePos
805
GetTableValue(object.newPos.x, temp0, object.transportTable)
806
temp0++
807
GetTableValue(object.newPos.y, temp0, object.transportTable)
808
CallFunction(TransportTube_HandleVelChange)
809
PlaySfx(SfxName[Rolling], false)
810
object.state = TRANSPORTTUBE_TRANSPORTING
811
end if
812
end if
813
else
814
temp0 = object.tablePos
815
GetTableValue(object.newPos.x, temp0, object.transportTable)
816
object.newPos.x += object.xpos
817
temp0++
818
819
GetTableValue(object.newPos.y, temp0, object.transportTable)
820
object.newPos.y += object.ypos
821
CallFunction(TransportTube_HandleVelChange)
822
end if
823
end if
824
825
if player[currentPlayer].state != Player_State_Static
826
object.state = TRANSPORTTUBE_BLANK
827
object.priority = PRIORITY_BOUNDS
828
end if
829
830
if player[currentPlayer].type == TypeName[Debug Mode]
831
object.state = TRANSPORTTUBE_BLANK
832
object.priority = PRIORITY_BOUNDS
833
end if
834
break
835
836
case TRANSPORTTUBE_TRANSPORTING
837
currentPlayer = object.targetPlayer
838
839
object.timer--
840
if object.timer >= 0
841
// waiting... (I think)
842
else
843
GetTableValue(player[currentPlayer].xpos, object.tablePos, object.transportTable)
844
object.tablePos++
845
846
GetTableValue(player[currentPlayer].ypos, object.tablePos, object.transportTable)
847
object.tablePos++
848
if object.transportPath < 0
849
object.tablePos -= 4
850
end if
851
852
object.transportDelay--
853
if object.transportDelay == 0
854
object.state = TRANSPORTTUBE_EXITNODE
855
player[currentPlayer].ypos &= 0x7FF0000
856
#platform: USE_STANDALONE
857
player[currentPlayer].state = Player_State_Air
858
#endplatform
859
#platform: USE_ORIGINS
860
player[currentPlayer].state = Player_State_Air_NoDropDash
861
#endplatform
862
player[currentPlayer].tileCollisions = true
863
player[currentPlayer].interaction = true
864
player[currentPlayer].xvel = 0
865
player[currentPlayer].yvel = -0x80000
866
867
PlaySfx(SfxName[Release], false)
868
else
869
temp0 = object.tablePos
870
GetTableValue(object.newPos.x, temp0, object.transportTable)
871
temp0++
872
873
GetTableValue(object.newPos.y, temp0, object.transportTable)
874
CallFunction(TransportTube_HandleVelChange)
875
end if
876
end if
877
878
if player[currentPlayer].state != TRANSPORTTUBE_BLANK
879
object.state = TRANSPORTTUBE_BLANK
880
object.priority = PRIORITY_BOUNDS
881
end if
882
883
if player[currentPlayer].type == TypeName[Debug Mode]
884
object.state = TRANSPORTTUBE_BLANK
885
object.priority = PRIORITY_BOUNDS
886
end if
887
break
888
889
case TRANSPORTTUBE_EXITNODE
890
BoxCollisionTest(C_TOUCH, object.entityPos, 0, 0, object.hitboxRight, 128, currentPlayer, 0, 0, 0, 0)
891
if checkResult == false
892
object.state = TRANSPORTTUBE_BLANK
893
object.priority = PRIORITY_BOUNDS
894
end if
895
break
896
897
end switch
898
end event
899
900
901
event ObjectStartup
902
// That's neat, you don't see many in-game objects that use the script box
903
// Well I suppose "use" would be a strech since the object doesn't ever actually draw anything, but
904
LoadSpriteSheet("Global/Display.gif")
905
SpriteFrame(-16, -16, 32, 32, 1, 143)
906
907
SetTableValue(TransportTube_transportPath1_0, 0, TransportTube_transportTables1)
908
SetTableValue(TransportTube_transportPath1_1, 1, TransportTube_transportTables1)
909
SetTableValue(TransportTube_transportPath1_2, 2, TransportTube_transportTables1)
910
SetTableValue(TransportTube_transportPath1_3, 3, TransportTube_transportTables1)
911
SetTableValue(TransportTube_transportPath1_4, 4, TransportTube_transportTables1)
912
SetTableValue(TransportTube_transportPath1_5, 5, TransportTube_transportTables1)
913
SetTableValue(TransportTube_transportPath1_6, 6, TransportTube_transportTables1)
914
SetTableValue(TransportTube_transportPath1_7, 7, TransportTube_transportTables1)
915
SetTableValue(TransportTube_transportPath1_8, 8, TransportTube_transportTables1)
916
SetTableValue(TransportTube_transportPath1_9, 9, TransportTube_transportTables1)
917
SetTableValue(TransportTube_transportPath1_10, 10, TransportTube_transportTables1)
918
SetTableValue(TransportTube_transportPath1_11, 11, TransportTube_transportTables1)
919
920
SetTableValue(TransportTube_transportPath2_0, 0, TransportTube_transportTables2)
921
SetTableValue(TransportTube_transportPath2_0, 1, TransportTube_transportTables2)
922
SetTableValue(TransportTube_transportPath2_1, 2, TransportTube_transportTables2)
923
SetTableValue(TransportTube_transportPath2_2, 3, TransportTube_transportTables2)
924
SetTableValue(TransportTube_transportPath2_3, 4, TransportTube_transportTables2)
925
SetTableValue(TransportTube_transportPath2_4, 5, TransportTube_transportTables2)
926
SetTableValue(TransportTube_transportPath2_5, 6, TransportTube_transportTables2)
927
SetTableValue(TransportTube_transportPath2_6, 7, TransportTube_transportTables2)
928
SetTableValue(TransportTube_transportPath2_7, 8, TransportTube_transportTables2)
929
SetTableValue(TransportTube_transportPath2_8, 9, TransportTube_transportTables2)
930
SetTableValue(TransportTube_transportPath2_9, 10, TransportTube_transportTables2)
931
SetTableValue(TransportTube_transportPath2_10, 11, TransportTube_transportTables2)
932
SetTableValue(TransportTube_transportPath2_11, 12, TransportTube_transportTables2)
933
SetTableValue(TransportTube_transportPath2_12, 13, TransportTube_transportTables2)
934
SetTableValue(TransportTube_transportPath2_13, 14, TransportTube_transportTables2)
935
936
foreach (TypeName[Transport Tube], arrayPos0, ALL_ENTITIES)
937
if object[arrayPos0].propertyValue == 0xFF
938
object[arrayPos0].state = TRANSPORTTUBE_BLANK
939
object[arrayPos0].propertyValue = 0
940
else
941
object[arrayPos0].tubetype = object[arrayPos0].propertyValue
942
object[arrayPos0].tubetype &= 3
943
GetTableValue(object[arrayPos0].hitboxRight, object[arrayPos0].tubetype, TransportTube_sizeTable)
944
object[arrayPos0].tubetype <<= 2
945
946
temp0 = object[arrayPos0].propertyValue
947
temp0 >>= 2
948
temp0 &= 15
949
GetTableValue(object[arrayPos0].transportPath, temp0, TransportTube_pathsTable)
950
end if
951
next
952
end event
953
954
955
// ========================
956
// Editor Events
957
// ========================
958
959
event RSDKEdit
960
if editor.returnVariable == true
961
switch editor.variableID
962
case EDIT_VAR_PROPVAL // property value
963
checkResult = object.propertyValue
964
break
965
966
case 0 // type
967
checkResult = object.propertyValue
968
if object.propertyValue != 0xFF
969
checkResult &= 3
970
end if
971
break
972
973
case 1 // path
974
checkResult = 0
975
if object.propertyValue != 0xFF
976
checkResult = object.propertyValue
977
checkResult >>= 2
978
checkResult &= 0x0F
979
end if
980
break
981
982
end switch
983
else
984
switch editor.variableID
985
case EDIT_VAR_PROPVAL // property value
986
object.propertyValue = editor.variableValue
987
break
988
989
case 0 // type
990
if editor.variableValue == 0xFF
991
object.propertyValue = editor.variableValue
992
else
993
if object.propertyValue != 0xFF
994
// Not Transporter, keep our path value
995
temp0 = 3
996
Not(temp0)
997
object.propertyValue &= temp0
998
else
999
// was Transporter, reset property value
1000
object.propertyValue = 0
1001
end if
1002
1003
editor.variableValue &= 3
1004
object.propertyValue |= editor.variableValue
1005
end if
1006
break
1007
1008
case 1 // path
1009
if object.propertyValue != 0xFF
1010
temp0 = 0x0F
1011
temp0 <<= 2
1012
Not(temp0)
1013
object.propertyValue &= temp0
1014
1015
editor.variableValue &= 0x0F
1016
editor.variableValue <<= 2
1017
object.propertyValue |= editor.variableValue
1018
end if
1019
break
1020
1021
end switch
1022
end if
1023
end event
1024
1025
1026
event RSDKDraw
1027
DrawSprite(0)
1028
end event
1029
1030
1031
event RSDKLoad
1032
LoadSpriteSheet("Global/Display.gif")
1033
SpriteFrame(-16, -16, 32, 32, 1, 143)
1034
1035
AddEditorVariable("type")
1036
SetActiveVariable("type")
1037
AddEnumVariable("Entry", 0)
1038
AddEnumVariable("Entry1", 1)
1039
AddEnumVariable("Entry2", 2)
1040
AddEnumVariable("Entry3", 3)
1041
AddEnumVariable("Transporter", 0xFF)
1042
1043
AddEditorVariable("path")
1044
SetActiveVariable("path")
1045
end event
1046
1047