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/Global/YellowSpring.txt
1478 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Yellow Spring 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.value1 : object.active
13
private alias object.value2 : object.stoodPlayers
14
private alias object.value3 : object.timer
15
private alias object.value7 : object.enabledInAir
16
17
// Only used on type 4 (up right)
18
private alias object.value0 : object.overrideVelocity.x
19
private alias object.value1 : object.overrideVelocity.y
20
21
// Player Aliases
22
private alias object.state : player.state
23
private alias object.xpos : player.xpos
24
private alias object.ypos : player.ypos
25
private alias object.iypos : player.iypos
26
private alias object.xvel : player.xvel
27
private alias object.yvel : player.yvel
28
private alias object.speed : player.speed
29
private alias object.direction : player.direction
30
private alias object.gravity : player.gravity
31
private alias object.frame : player.frame
32
private alias object.prevAnimation : player.prevAnimation
33
private alias object.animationSpeed : player.animationSpeed
34
private alias object.animation : player.animation
35
private alias object.pushing : player.pushing
36
private alias object.controlLock : player.controlLock
37
private alias object.collisionMode : player.collisionMode
38
private alias object.collisionTop : player.collisionTop
39
private alias object.collisionBottom : player.collisionBottom
40
private alias object.tileCollisions : player.tileCollisions
41
private alias object.value1 : player.timer
42
private alias object.value10 : player.animationReserve // Used by springs to store what animation will play after the bounce animation
43
private alias object.value17 : debugMode.currentSelection
44
private alias object.value25 : player.gravityStrength
45
46
47
// ========================
48
// Function Declarations
49
// ========================
50
51
reserve function YellowSpring_DebugDraw
52
reserve function YellowSpring_DebugSpawn
53
54
55
// ========================
56
// Static Values
57
// ========================
58
59
private value YellowSpring_startDebugID = 0
60
61
62
// ========================
63
// Tables
64
// ========================
65
66
private table YellowSpring_directionTable
67
0, 0, 0, 0
68
0, 0, 2, 2
69
0, 0, 1, 2
70
0, 1, 2, 3
71
0, 0, 1, 2
72
0, 1, 2, 3
73
end table
74
75
private table YellowSpring_heightsTable
76
16, 16, 16, 16, 16, 16, 14, 12, 10, 8, 6, 4, 2, 0, -2, -4
77
end table
78
79
private table YellowSpring_collisionTypes
80
1 // C_SOLID
81
1 // C_SOLID
82
1 // C_SOLID
83
1 // C_SOLID
84
1 // C_SOLID
85
1 // C_SOLID
86
3 // C_PLATFORM
87
3 // C_PLATFORM
88
3 // C_PLATFORM
89
3 // C_PLATFORM
90
3 // C_PLATFORM
91
3 // C_PLATFORM
92
3 // C_PLATFORM
93
3 // C_PLATFORM
94
1 // C_SOLID
95
1 // C_SOLID
96
end table
97
98
99
// ========================
100
// Function Definitions
101
// ========================
102
103
private function YellowSpring_DebugDraw
104
temp1 = object.direction
105
temp0 = debugMode[0].currentSelection
106
temp0 -= YellowSpring_startDebugID
107
GetTableValue(object.direction, temp0, YellowSpring_directionTable)
108
DrawSpriteFX(temp0, FX_FLIP, object.xpos, object.ypos)
109
object.direction = temp1
110
end function
111
112
113
private function YellowSpring_DebugSpawn
114
temp0 = debugMode[0].currentSelection
115
temp0 -= YellowSpring_startDebugID
116
CreateTempObject(TypeName[Yellow Spring], temp0, object.xpos, object.ypos)
117
end function
118
119
120
// ========================
121
// Events
122
// ========================
123
124
event ObjectUpdate
125
temp2 = 0
126
127
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
128
temp1 = object.propertyValue
129
temp1 &= 0x7F
130
131
switch temp1
132
case 0
133
temp0 = object.active
134
if player[currentPlayer].gravity == GRAVITY_AIR
135
temp0 = true
136
end if
137
138
if player[currentPlayer].collisionMode > CMODE_FLOOR
139
if player[currentPlayer].yvel < 0
140
temp0 = true
141
end if
142
end if
143
144
if temp0 == false
145
BoxCollisionTest(C_SOLID, object.entityPos, -14, -8, 14, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
146
if player[currentPlayer].gravity == GRAVITY_AIR
147
BoxCollisionTest(C_TOUCH, object.entityPos, -14, -10, 14, -6, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
148
else
149
BoxCollisionTest(C_TOUCH, object.entityPos, -14, -12, 14, -6, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
150
end if
151
152
if checkResult == true
153
player[currentPlayer].animationReserve = ANI_WALKING
154
if player[currentPlayer].animation == ANI_RUNNING
155
player[currentPlayer].animationReserve = ANI_RUNNING
156
end if
157
158
if player[currentPlayer].animation == ANI_PEELOUT
159
player[currentPlayer].animationReserve = ANI_PEELOUT
160
end if
161
162
object.timer = 1
163
#platform: USE_STANDALONE
164
player[currentPlayer].state = Player_State_Air
165
#endplatform
166
#platform: USE_ORIGINS
167
player[currentPlayer].state = Player_State_Air_NoDropDash
168
#endplatform
169
player[currentPlayer].tileCollisions = true
170
player[currentPlayer].gravity = GRAVITY_AIR
171
player[currentPlayer].speed = player[currentPlayer].xvel
172
player[currentPlayer].yvel = -0xA0000
173
174
if object.propertyValue >= 0x80
175
player[currentPlayer].animation = ANI_TWIRL
176
player[currentPlayer].prevAnimation = ANI_TWIRL
177
player[currentPlayer].frame = 0
178
player[currentPlayer].animationSpeed = 40
179
else
180
player[currentPlayer].animation = ANI_BOUNCING
181
end if
182
player[currentPlayer].timer = 0
183
184
PlaySfx(SfxName[Spring], false)
185
end if
186
else
187
if player[currentPlayer].yvel >= 0
188
BoxCollisionTest(C_PLATFORM, object.entityPos, -14, -8, 14, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
189
190
BoxCollisionTest(C_TOUCH, object.entityPos, -14, -10, 14, -6, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
191
if checkResult == true
192
player[currentPlayer].animationReserve = ANI_WALKING
193
if player[currentPlayer].animation == ANI_RUNNING
194
player[currentPlayer].animationReserve = ANI_RUNNING
195
end if
196
197
if player[currentPlayer].animation == ANI_PEELOUT
198
player[currentPlayer].animationReserve = ANI_PEELOUT
199
end if
200
201
object.timer = 1
202
#platform: USE_STANDALONE
203
player[currentPlayer].state = Player_State_Air
204
#endplatform
205
#platform: USE_ORIGINS
206
player[currentPlayer].state = Player_State_Air_NoDropDash
207
#endplatform
208
player[currentPlayer].tileCollisions = true
209
player[currentPlayer].gravity = GRAVITY_AIR
210
player[currentPlayer].speed = player[currentPlayer].xvel
211
player[currentPlayer].yvel = -0xA0000
212
player[currentPlayer].yvel -= player[currentPlayer].gravityStrength
213
214
if object.propertyValue >= 0x80
215
player[currentPlayer].animation = ANI_TWIRL
216
player[currentPlayer].prevAnimation = ANI_TWIRL
217
player[currentPlayer].frame = 0
218
player[currentPlayer].animationSpeed = 40
219
else
220
player[currentPlayer].animation = ANI_BOUNCING
221
end if
222
player[currentPlayer].timer = 0
223
224
PlaySfx(SfxName[Spring], false)
225
end if
226
end if
227
end if
228
break
229
230
case 1
231
BoxCollisionTest(C_SOLID, object.entityPos, -8, -14, 8, 14, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
232
if player[currentPlayer].gravity == GRAVITY_GROUND
233
BoxCollisionTest(C_TOUCH, object.entityPos, 6, -14, 10, 14, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
234
if checkResult == true
235
object.timer = 1
236
player[currentPlayer].tileCollisions = true
237
player[currentPlayer].speed = 0xA0000
238
player[currentPlayer].collisionMode = CMODE_FLOOR
239
player[currentPlayer].pushing = 0
240
player[currentPlayer].direction = FACING_RIGHT
241
player[currentPlayer].controlLock = 15
242
PlaySfx(SfxName[Spring], false)
243
244
if player[currentPlayer].state != Player_State_Roll
245
player[currentPlayer].state = Player_State_Ground
246
player[currentPlayer].animation = ANI_RUNNING
247
end if
248
end if
249
else
250
if object.enabledInAir == true
251
BoxCollisionTest(C_TOUCH, object.entityPos, 6, -4, 11, 4, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
252
if checkResult == true
253
object.timer = 1
254
player[currentPlayer].tileCollisions = true
255
player[currentPlayer].speed = 0xA0000
256
player[currentPlayer].yvel = 0
257
player[currentPlayer].collisionMode = CMODE_FLOOR
258
player[currentPlayer].pushing = 0
259
player[currentPlayer].direction = FACING_RIGHT
260
player[currentPlayer].controlLock = 15
261
262
PlaySfx(SfxName[Spring], false)
263
264
if player[currentPlayer].state != Player_State_RollJump
265
player[currentPlayer].animation = ANI_BOUNCING
266
if player[currentPlayer].animation != ANI_JUMPING
267
player[currentPlayer].animation = ANI_RUNNING
268
end if
269
object.animationSpeed = object.speed
270
player[currentPlayer].animationSpeed *= 80
271
player[currentPlayer].animationSpeed /= 0x60000
272
end if
273
end if
274
end if
275
end if
276
break
277
278
case 2
279
BoxCollisionTest(C_SOLID, object.entityPos, -8, -14, 8, 14, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
280
if player[currentPlayer].gravity == GRAVITY_GROUND
281
BoxCollisionTest(C_TOUCH, object.entityPos, -10, -14, -6, 14, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
282
if checkResult == true
283
object.timer = 1
284
player[currentPlayer].tileCollisions = true
285
player[currentPlayer].speed = -0xA0000
286
player[currentPlayer].collisionMode = CMODE_FLOOR
287
player[currentPlayer].pushing = 0
288
player[currentPlayer].direction = FACING_LEFT
289
player[currentPlayer].controlLock = 15
290
291
PlaySfx(SfxName[Spring], false)
292
293
if player[currentPlayer].state != Player_State_Roll
294
player[currentPlayer].state = Player_State_Ground
295
player[currentPlayer].animation = ANI_RUNNING
296
end if
297
end if
298
else
299
if object.enabledInAir == true
300
BoxCollisionTest(C_TOUCH, object.entityPos, -10, -14, -6, 14, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
301
if checkResult == true
302
object.timer = 1
303
player[currentPlayer].tileCollisions = true
304
player[currentPlayer].speed = -0xA0000
305
player[currentPlayer].yvel = 0
306
player[currentPlayer].collisionMode = CMODE_FLOOR
307
player[currentPlayer].pushing = 0
308
player[currentPlayer].direction = FACING_LEFT
309
player[currentPlayer].controlLock = 15
310
311
PlaySfx(SfxName[Spring], false)
312
313
if player[currentPlayer].state != Player_State_RollJump
314
player[currentPlayer].animation = 12 // Yes, it's actually like this
315
if player[currentPlayer].animation != ANI_JUMPING
316
player[currentPlayer].animation = ANI_RUNNING
317
end if
318
319
object.animationSpeed = object.speed
320
FlipSign(player[currentPlayer].animationSpeed)
321
player[currentPlayer].animationSpeed *= 80
322
player[currentPlayer].animationSpeed /= 0x60000
323
end if
324
end if
325
end if
326
end if
327
break
328
329
case 3
330
BoxCollisionTest(C_SOLID, object.entityPos, -14, -8, 14, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
331
BoxCollisionTest(C_TOUCH, object.entityPos, -14, 6, 14, 10, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
332
if checkResult == true
333
object.timer = 1
334
if player[currentPlayer].collisionMode == CMODE_ROOF
335
FlipSign(player[currentPlayer].speed)
336
FlipSign(player[currentPlayer].xvel)
337
end if
338
339
#platform: USE_STANDALONE
340
player[currentPlayer].state = Player_State_Air
341
#endplatform
342
#platform: USE_ORIGINS
343
player[currentPlayer].state = Player_State_Air_NoDropDash
344
#endplatform
345
player[currentPlayer].tileCollisions = true
346
player[currentPlayer].gravity = GRAVITY_AIR
347
player[currentPlayer].speed = player[currentPlayer].xvel
348
player[currentPlayer].yvel = 0xA0000
349
player[currentPlayer].timer = 0
350
351
PlaySfx(SfxName[Spring], false)
352
end if
353
break
354
355
case 4
356
temp0 = player[currentPlayer].xpos
357
temp0 -= object.xpos
358
temp0 += 0x100000
359
temp0 >>= 17
360
if temp0 < 0
361
temp0 = 0
362
end if
363
364
if temp0 > 15
365
temp0 = 15
366
end if
367
368
GetTableValue(temp1, temp0, YellowSpring_heightsTable)
369
FlipSign(temp1)
370
371
GetTableValue(temp4, temp0, YellowSpring_collisionTypes)
372
BoxCollisionTest(temp4, object.entityPos, -16, temp1, 16, 24, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
373
if checkResult != COL_TOP
374
GetBit(temp3, object.stoodPlayers, temp2)
375
if temp3 == true
376
temp3 = player[currentPlayer].xpos
377
temp3 -= object.xpos
378
temp3 >>= 16
379
Abs(temp3)
380
if temp3 < 16
381
if player[currentPlayer].yvel >= 0
382
player[currentPlayer].iypos = player[currentPlayer].collisionBottom
383
FlipSign(player[currentPlayer].ypos)
384
temp1 <<= 16
385
player[currentPlayer].ypos += temp1
386
player[currentPlayer].ypos += object.ypos
387
checkResult = COL_TOP
388
end if
389
end if
390
end if
391
end if
392
393
if checkResult == COL_TOP
394
if temp0 >= 6
395
player[currentPlayer].animationReserve = ANI_WALKING
396
if player[currentPlayer].animation == ANI_RUNNING
397
player[currentPlayer].animationReserve = ANI_RUNNING
398
end if
399
400
if player[currentPlayer].animation == ANI_PEELOUT
401
player[currentPlayer].animationReserve = ANI_PEELOUT
402
end if
403
404
object.timer = 1
405
if player[currentPlayer].collisionMode == CMODE_ROOF
406
FlipSign(player[currentPlayer].speed)
407
FlipSign(player[currentPlayer].xvel)
408
end if
409
410
#platform: USE_STANDALONE
411
player[currentPlayer].state = Player_State_Air
412
#endplatform
413
#platform: USE_ORIGINS
414
player[currentPlayer].state = Player_State_Air_NoDropDash
415
#endplatform
416
player[currentPlayer].tileCollisions = true
417
player[currentPlayer].gravity = GRAVITY_AIR
418
419
if object.overrideVelocity.x == 0
420
player[currentPlayer].xvel = 0xA0000
421
player[currentPlayer].yvel = -0xA0000
422
else
423
player[currentPlayer].xvel = object.overrideVelocity.x
424
player[currentPlayer].xvel <<= 16
425
player[currentPlayer].yvel = object.overrideVelocity.y
426
player[currentPlayer].yvel *= -0x10000
427
end if
428
429
player[currentPlayer].speed = player[currentPlayer].xvel
430
player[currentPlayer].yvel -= player[currentPlayer].gravityStrength
431
player[currentPlayer].timer = 0
432
player[currentPlayer].direction = FACING_RIGHT
433
434
if object.propertyValue >= 0x80
435
player[currentPlayer].animation = ANI_TWIRL
436
else
437
player[currentPlayer].animation = ANI_BOUNCING
438
end if
439
PlaySfx(SfxName[Spring], false)
440
441
SetBit(object.stoodPlayers, temp2, false)
442
else
443
SetBit(object.stoodPlayers, temp2, true)
444
end if
445
else
446
SetBit(object.stoodPlayers, temp2, false)
447
end if
448
break
449
450
case 5
451
temp0 = player[currentPlayer].xpos
452
temp0 -= object.xpos
453
temp0 += 0x100000
454
temp0 >>= 17
455
if temp0 < 0
456
temp0 = 0
457
end if
458
459
if temp0 > 15
460
temp0 = 15
461
end if
462
temp0 -= 15
463
464
Abs(temp0)
465
GetTableValue(temp1, temp0, YellowSpring_heightsTable)
466
FlipSign(temp1)
467
468
GetTableValue(temp4, temp0, YellowSpring_collisionTypes)
469
BoxCollisionTest(temp4, object.entityPos, -16, temp1, 16, 32, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
470
if checkResult != COL_TOP
471
GetBit(temp3, object.stoodPlayers, temp2)
472
if temp3 == true
473
temp3 = player[currentPlayer].xpos
474
temp3 -= object.xpos
475
temp3 >>= 16
476
Abs(temp3)
477
if temp3 < 16
478
if player[currentPlayer].yvel >= 0
479
player[currentPlayer].iypos = player[currentPlayer].collisionBottom
480
FlipSign(player[currentPlayer].ypos)
481
temp1 <<= 16
482
player[currentPlayer].ypos += temp1
483
player[currentPlayer].ypos += object.ypos
484
checkResult = COL_TOP
485
end if
486
end if
487
end if
488
end if
489
490
if checkResult == COL_TOP
491
if temp0 >= 6
492
player[currentPlayer].animationReserve = ANI_WALKING
493
if player[currentPlayer].animation == ANI_RUNNING
494
player[currentPlayer].animationReserve = ANI_RUNNING
495
end if
496
497
if player[currentPlayer].animation == ANI_PEELOUT
498
player[currentPlayer].animationReserve = ANI_PEELOUT
499
end if
500
501
object.timer = 1
502
if player[currentPlayer].collisionMode == CMODE_ROOF
503
FlipSign(player[currentPlayer].speed)
504
FlipSign(player[currentPlayer].xvel)
505
end if
506
507
#platform: USE_STANDALONE
508
player[currentPlayer].state = Player_State_Air
509
#endplatform
510
#platform: USE_ORIGINS
511
player[currentPlayer].state = Player_State_Air_NoDropDash
512
#endplatform
513
player[currentPlayer].tileCollisions = true
514
player[currentPlayer].gravity = GRAVITY_AIR
515
player[currentPlayer].xvel = -0xA0000
516
player[currentPlayer].speed = player[currentPlayer].xvel
517
player[currentPlayer].yvel = -0xA0000
518
player[currentPlayer].yvel -= player[currentPlayer].gravityStrength
519
player[currentPlayer].timer = 0
520
player[currentPlayer].direction = FACING_LEFT
521
522
if object.propertyValue >= 0x80
523
player[currentPlayer].animation = ANI_TWIRL
524
else
525
player[currentPlayer].animation = ANI_BOUNCING
526
end if
527
PlaySfx(SfxName[Spring], false)
528
529
SetBit(object.stoodPlayers, temp2, false)
530
else
531
SetBit(object.stoodPlayers, temp2, true)
532
end if
533
else
534
SetBit(object.stoodPlayers, temp2, false)
535
end if
536
break
537
538
case 6
539
temp0 = player[currentPlayer].xpos
540
temp0 -= object.xpos
541
temp0 += 0x100000
542
temp0 >>= 17
543
if temp0 < 0
544
temp0 = 0
545
end if
546
547
if temp0 > 15
548
temp0 = 15
549
end if
550
551
GetTableValue(temp1, temp0, YellowSpring_heightsTable)
552
BoxCollisionTest(C_SOLID, object.entityPos, -16, -16, 32, temp1, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
553
if checkResult != COL_BOTTOM
554
GetBit(temp3, object.stoodPlayers, temp2)
555
if temp3 == true
556
temp3 = player[currentPlayer].xpos
557
temp3 -= object.xpos
558
temp3 >>= 16
559
Abs(temp3)
560
if temp3 < 16
561
if player[currentPlayer].yvel <= 0
562
player[currentPlayer].iypos = player[currentPlayer].collisionTop
563
FlipSign(player[currentPlayer].ypos)
564
temp1 <<= 16
565
player[currentPlayer].ypos += temp1
566
player[currentPlayer].ypos += object.ypos
567
checkResult = COL_TOP
568
end if
569
end if
570
end if
571
end if
572
573
if checkResult == COL_BOTTOM
574
if temp0 >= 6
575
object.timer = 1
576
if player[currentPlayer].collisionMode == CMODE_ROOF
577
FlipSign(player[currentPlayer].speed)
578
FlipSign(player[currentPlayer].xvel)
579
end if
580
581
#platform: USE_STANDALONE
582
player[currentPlayer].state = Player_State_Air
583
#endplatform
584
#platform: USE_ORIGINS
585
player[currentPlayer].state = Player_State_Air_NoDropDash
586
#endplatform
587
player[currentPlayer].tileCollisions = true
588
player[currentPlayer].gravity = GRAVITY_AIR
589
player[currentPlayer].xvel = 0xA0000
590
player[currentPlayer].speed = player[currentPlayer].xvel
591
player[currentPlayer].yvel = 0xA0000
592
player[currentPlayer].timer = 0
593
player[currentPlayer].direction = FACING_RIGHT
594
PlaySfx(SfxName[Spring], false)
595
596
SetBit(object.stoodPlayers, temp2, false)
597
else
598
SetBit(object.stoodPlayers, temp2, true)
599
end if
600
else
601
SetBit(object.stoodPlayers, temp2, false)
602
end if
603
break
604
605
case 7
606
temp0 = player[currentPlayer].xpos
607
temp0 -= object.xpos
608
temp0 += 0x100000
609
temp0 >>= 17
610
if temp0 < 0
611
temp0 = 0
612
end if
613
614
if temp0 > 15
615
temp0 = 15
616
end if
617
618
temp0 -= 15
619
Abs(temp0)
620
GetTableValue(temp1, temp0, YellowSpring_heightsTable)
621
BoxCollisionTest(C_SOLID, object.entityPos, -16, -16, 16, temp1, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
622
if checkResult != COL_BOTTOM
623
GetBit(temp3, object.stoodPlayers, temp2)
624
if temp3 == true
625
temp3 = player[currentPlayer].xpos
626
temp3 -= object.xpos
627
temp3 >>= 16
628
Abs(temp3)
629
if temp3 < 16
630
if player[currentPlayer].yvel <= 0
631
player[currentPlayer].iypos = player[currentPlayer].collisionTop
632
FlipSign(player[currentPlayer].ypos)
633
temp1 <<= 16
634
player[currentPlayer].ypos += temp1
635
player[currentPlayer].ypos += object.ypos
636
checkResult = COL_TOP
637
end if
638
end if
639
end if
640
end if
641
642
if checkResult == COL_BOTTOM
643
if temp0 >= 6
644
object.timer = 1
645
if player[currentPlayer].collisionMode == CMODE_ROOF
646
FlipSign(player[currentPlayer].speed)
647
FlipSign(player[currentPlayer].xvel)
648
end if
649
650
#platform: USE_STANDALONE
651
player[currentPlayer].state = Player_State_Air
652
#endplatform
653
#platform: USE_ORIGINS
654
player[currentPlayer].state = Player_State_Air_NoDropDash
655
#endplatform
656
player[currentPlayer].tileCollisions = true
657
player[currentPlayer].gravity = GRAVITY_AIR
658
player[currentPlayer].xvel = -0xA0000
659
player[currentPlayer].speed = player[currentPlayer].xvel
660
player[currentPlayer].yvel = 0xA0000
661
player[currentPlayer].timer = 0
662
player[currentPlayer].direction = FACING_LEFT
663
PlaySfx(SfxName[Spring], false)
664
665
SetBit(object.stoodPlayers, temp2, false)
666
else
667
SetBit(object.stoodPlayers, temp2, true)
668
end if
669
else
670
SetBit(object.stoodPlayers, temp2, false)
671
end if
672
break
673
674
end switch
675
temp2++
676
next
677
678
object.frame = object.propertyValue
679
object.frame &= 0x7F
680
681
if object.timer != 0
682
switch object.timer
683
case 2
684
case 3
685
break
686
687
case 1
688
object.frame += 8
689
break
690
691
case 4
692
case 5
693
case 6
694
case 7
695
case 8
696
case 9
697
object.frame += 16
698
break
699
700
end switch
701
702
object.timer++
703
if object.timer >= 10
704
object.timer = 0
705
end if
706
end if
707
end event
708
709
710
event ObjectDraw
711
GetTableValue(object.direction, object.frame, YellowSpring_directionTable)
712
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
713
end event
714
715
716
event ObjectStartup
717
LoadSpriteSheet("Global/Items.gif")
718
SpriteFrame(-16, -8, 32, 16, 52, 17)
719
SpriteFrame(-8, -16, 16, 32, 101, 1)
720
SpriteFrame(-8, -16, 16, 32, 134, 67)
721
SpriteFrame(-16, -8, 32, 16, 157, 132)
722
SpriteFrame(-16, -16, 32, 32, 118, 34)
723
SpriteFrame(-16, -16, 32, 32, 157, 83)
724
SpriteFrame(-16, -16, 32, 32, 118, 34)
725
SpriteFrame(-16, -16, 32, 32, 157, 83)
726
727
SpriteFrame(-16, 0, 32, 8, 52, 17)
728
SpriteFrame(-8, -16, 8, 32, 109, 1)
729
SpriteFrame(0, -16, 8, 32, 134, 67)
730
SpriteFrame(-16, -8, 32, 8, 157, 140)
731
SpriteFrame(-17, -10, 27, 27, 80, 186)
732
SpriteFrame(-17, -10, 27, 27, 80, 186)
733
SpriteFrame(-17, -10, 27, 27, 80, 186)
734
SpriteFrame(-17, -10, 27, 27, 80, 186)
735
736
SpriteFrame(-16, -24, 32, 32, 52, 67)
737
SpriteFrame(-8, -16, 32, 32, 85, 67)
738
SpriteFrame(-8, -16, 32, 32, 85, 67)
739
SpriteFrame(-16, -24, 32, 32, 52, 67)
740
SpriteFrame(-16, -26, 43, 42, 96, 100)
741
SpriteFrame(-16, -26, 43, 42, 96, 100)
742
SpriteFrame(-16, -26, 43, 42, 96, 100)
743
SpriteFrame(-16, -26, 43, 42, 96, 100)
744
745
temp0 = 0
746
YellowSpring_startDebugID = DebugMode_ObjCount
747
while temp0 < 8
748
SetTableValue(TypeName[Yellow Spring], DebugMode_ObjCount, DebugMode_TypesTable)
749
SetTableValue(YellowSpring_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
750
SetTableValue(YellowSpring_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
751
DebugMode_ObjCount++
752
temp0++
753
loop
754
end event
755
756
757
// ========================
758
// Editor Events
759
// ========================
760
761
event RSDKEdit
762
if editor.returnVariable == true
763
switch editor.variableID
764
case EDIT_VAR_PROPVAL // property value
765
checkResult = object.propertyValue
766
break
767
768
case 0 // flipFlags
769
checkResult = object.propertyValue
770
checkResult &= 0x7
771
break
772
773
case 1 // useTwirlAnim
774
checkResult = object.propertyValue
775
checkResult >>= 7
776
checkResult &= 1
777
break
778
779
end switch
780
else
781
switch editor.variableID
782
case EDIT_VAR_PROPVAL // property value
783
object.propertyValue = editor.variableValue
784
break
785
786
case 0 // flipFlags
787
temp0 = editor.variableValue
788
temp0 &= 0x7
789
790
temp1 = 7
791
Not(temp1)
792
793
object.propertyValue &= temp1
794
object.propertyValue |= temp0
795
break
796
797
case 1 // useTwirlAnim
798
temp0 = editor.variableValue
799
temp0 &= 1
800
temp0 <<= 7
801
802
object.propertyValue &= 0x7
803
object.propertyValue |= temp0
804
break
805
806
end switch
807
end if
808
end event
809
810
811
event RSDKDraw
812
object.frame = object.propertyValue
813
object.frame &= 7
814
815
GetTableValue(object.direction, object.frame, YellowSpring_directionTable)
816
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
817
end event
818
819
820
event RSDKLoad
821
LoadSpriteSheet("Global/Items.gif")
822
SpriteFrame(-16, -8, 32, 16, 52, 17)
823
SpriteFrame(-8, -16, 16, 32, 101, 1)
824
SpriteFrame(-8, -16, 16, 32, 134, 67)
825
SpriteFrame(-16, -8, 32, 16, 157, 132)
826
SpriteFrame(-16, -16, 32, 32, 118, 34)
827
SpriteFrame(-16, -16, 32, 32, 157, 83)
828
SpriteFrame(-16, -16, 32, 32, 118, 34)
829
SpriteFrame(-16, -16, 32, 32, 157, 83)
830
SpriteFrame(-16, 0, 32, 8, 52, 17)
831
SpriteFrame(-8, -16, 8, 32, 109, 1)
832
SpriteFrame(0, -16, 8, 32, 134, 67)
833
SpriteFrame(-16, -8, 32, 8, 157, 140)
834
SpriteFrame(-17, -10, 27, 27, 80, 186)
835
SpriteFrame(-17, -10, 27, 27, 80, 186)
836
SpriteFrame(-17, -10, 27, 27, 80, 186)
837
SpriteFrame(-17, -10, 27, 27, 80, 186)
838
SpriteFrame(-16, -24, 32, 32, 52, 67)
839
SpriteFrame(-8, -16, 32, 32, 85, 67)
840
SpriteFrame(-8, -16, 32, 32, 85, 67)
841
SpriteFrame(-16, -24, 32, 32, 52, 67)
842
SpriteFrame(-16, -26, 43, 42, 96, 100)
843
SpriteFrame(-16, -26, 43, 42, 96, 100)
844
SpriteFrame(-16, -26, 43, 42, 96, 100)
845
SpriteFrame(-16, -26, 43, 42, 96, 100)
846
847
AddEditorVariable("flipFlags")
848
SetActiveVariable("flipFlags")
849
AddEnumVariable("Up", 0)
850
AddEnumVariable("Right", 1)
851
AddEnumVariable("Left", 2)
852
AddEnumVariable("Down", 3)
853
AddEnumVariable("Up Right", 4)
854
AddEnumVariable("Up Left", 5)
855
AddEnumVariable("Down Right", 6)
856
AddEnumVariable("Down Left", 7)
857
858
AddEditorVariable("useTwirlAnim")
859
SetActiveVariable("useTwirlAnim")
860
AddEnumVariable("false", false)
861
AddEnumVariable("true", true)
862
863
// only used on type 4 (up right) springs
864
SetVariableAlias(ALIAS_VAR_VAL0, "overrideVelocity.x")
865
SetVariableAlias(ALIAS_VAR_VAL1, "overrideVelocity.y")
866
SetVariableAlias(ALIAS_VAR_VAL2, "unused")
867
SetVariableAlias(ALIAS_VAR_VAL3, "unused")
868
end event
869
870