Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/RecoveryBarrier.txt
1319 views
1
//--------------Sonic CD Recovery Barrier Script--------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
#alias Object[-4].Value2 : SpinGate.CurrentLight
8
9
// States
10
#alias 0 : RBARRIER_INACTIVE
11
#alias 1 : RBARRIER_TURNING
12
#alias 2 : RBARRIER_ACTIVE
13
#alias 3 : RBARRIER_TURNING_BACK
14
15
16
sub ObjectMain
17
switch Object.State
18
case RBARRIER_INACTIVE
19
Object.Frame = 0
20
if SpinGate.CurrentLight == 3
21
Object.State = RBARRIER_TURNING
22
end if
23
break
24
25
case RBARRIER_TURNING
26
Object.Frame = 1
27
if Object.Timer < 30
28
Object.Timer++
29
else
30
Object.State = RBARRIER_ACTIVE
31
end if
32
break
33
34
case RBARRIER_ACTIVE
35
Object.Frame = 2
36
if SpinGate.CurrentLight == 0
37
Object.State = RBARRIER_TURNING_BACK
38
end if
39
break
40
41
case RBARRIER_TURNING_BACK
42
Object.Frame = 3 // Pretty sure this should be 1, or we are missing a frame, either goes
43
if Object.Timer < 30
44
Object.Timer++
45
else
46
Object.State = RBARRIER_INACTIVE
47
end if
48
break
49
50
end switch
51
end sub
52
53
54
sub ObjectPlayerInteraction
55
// Bouncy Player
56
if Object.State == RBARRIER_ACTIVE
57
PlayerObjectCollision(C_TOUCH, -16, -8, 16, 8)
58
if CheckResult == true
59
Player.YVelocity = -0x40000
60
end if
61
end if
62
end sub
63
64
65
sub ObjectDraw
66
DrawSprite(Object.Frame)
67
end sub
68
69
70
sub ObjectStartup
71
LoadSpriteSheet("R3/Objects2.gif")
72
73
SpriteFrame(-16, -8, 32, 16, 51, 33) // #0 - Recoverty Barrier Inactive
74
SpriteFrame(-16, -8, 32, 16, 84, 33) // #1 - Recoverty Barrier Turning
75
SpriteFrame(-16, -8, 32, 16, 51, 50) // #2 - Recoverty Barrier Active
76
end sub
77
78
79
// ========================
80
// Editor Subs
81
// ========================
82
83
sub RSDKDraw
84
DrawSprite(0)
85
end sub
86
87
88
sub RSDKLoad
89
LoadSpriteSheet("R3/Objects2.gif")
90
SpriteFrame(-16, -8, 32, 16, 51, 50) // #2 - Recoverty Barrier Active
91
92
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
93
end sub
94
95