Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/Launcher.txt
1319 views
1
//------------------Sonic CD Launcher 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.Value1 : Object.XOriginPos
8
9
// States
10
#alias 0 : LAUNCHER_IDLE
11
#alias 1 : LAUNCHER_DASH
12
#alias 2 : LAUNCHER_EJECT_PLAYER
13
#alias 3 : LAUNCHER_RECOIL
14
#alias 4 : LAUNCHER_RESET
15
16
// Collision Sides
17
#alias 0 : CSIDE_FLOOR
18
19
// Priority
20
#alias 0 : PRIORITY_BOUNDS
21
#alias 1 : PRIORITY_ACTIVE
22
23
// Gravity
24
#alias 1 : GRAVITY_AIR
25
26
// Stage SFX
27
#alias 6 : SFX_S_LAUNCHER
28
29
30
sub ObjectMain
31
if Player.State != Player_State_Static
32
Object.State = LAUNCHER_IDLE
33
Object.Timer = 0
34
end if
35
36
switch Object.State
37
case LAUNCHER_DASH
38
Object.XPos += 0xC0000
39
Player.XPos = Object.XPos
40
41
Player.iYPos = Player.CollisionBottom
42
FlipSign(Player.YPos)
43
Player.YPos -= 0x30000
44
Player.YPos += Object.YPos
45
46
ObjectTileGrip(CSIDE_FLOOR, 32, 4, 0)
47
if CheckResult == false
48
Object.State++
49
end if
50
break
51
52
case LAUNCHER_EJECT_PLAYER
53
Player.XPos += 0xC0000
54
55
Player.iYPos = Player.CollisionBottom
56
FlipSign(Player.YPos)
57
Player.YPos -= 0x30000
58
Player.YPos += Object.YPos
59
Object.State++
60
break
61
62
case LAUNCHER_RECOIL
63
if Object.Timer == 0
64
Player.XPos += 0xC0000
65
end if
66
67
#platform: Use_Origins
68
Player.State = Player_State_Air_NoDropDash
69
#endplatform
70
71
#platform: Use_Standalone
72
Player.State = Player_State_Air
73
#endplatform
74
75
Player.Animation = ANI_WALKING
76
77
Player.Speed = 0xC2000
78
Player.XVelocity = 0xC2000
79
80
Player.iYPos = Player.CollisionBottom
81
FlipSign(Player.YPos)
82
Player.YPos -= 0x30000
83
Player.YPos += Object.YPos
84
85
if Object.Timer < 2
86
Object.Timer++
87
else
88
Object.State++
89
end if
90
91
Object.XPos -= 0x40000
92
if Object.XPos < Object.XOriginPos
93
Object.XPos = Object.XOriginPos
94
Object.Priority = PRIORITY_BOUNDS
95
Object.State = LAUNCHER_IDLE
96
end if
97
98
if Object.OutOfBounds == true
99
Object.XPos = Object.XOriginPos
100
Object.Priority = PRIORITY_BOUNDS
101
Object.State = LAUNCHER_IDLE
102
end if
103
break
104
105
case LAUNCHER_RESET
106
Object.XPos -= 0x40000
107
if Object.XPos < Object.XOriginPos
108
Object.XPos = Object.XOriginPos
109
Object.Priority = PRIORITY_BOUNDS
110
Object.State = LAUNCHER_IDLE
111
end if
112
113
if Object.OutOfBounds == true
114
Object.XPos = Object.XOriginPos
115
Object.Priority = PRIORITY_BOUNDS
116
Object.State = LAUNCHER_IDLE
117
end if
118
break
119
end switch
120
end sub
121
122
123
sub ObjectPlayerInteraction
124
if Object.State == LAUNCHER_IDLE
125
PlayerObjectCollision(C_BOX, -24, -26, -18, 4)
126
PlayerObjectCollision(C_TOUCH, -20, -16, 20, 4)
127
if CheckResult == true
128
Object.State = LAUNCHER_DASH
129
Player.State = Player_State_Static
130
131
Player.Animation = ANI_LAUNCHER
132
Player.Direction = FACING_RIGHT
133
134
Player.XPos = Object.XPos
135
Player.iYPos = Player.CollisionBottom
136
FlipSign(Player.YPos)
137
Player.YPos -= 0x30000
138
Player.YPos += Object.YPos
139
140
Player.YVelocity = 0
141
142
Object.Priority = PRIORITY_ACTIVE
143
144
Player.TrackScroll = false
145
Player.Gravity = GRAVITY_AIR
146
147
PlayStageSfx(SFX_S_LAUNCHER, false)
148
149
#platform: Use_Haptics
150
HapticEffect(30, 0, 0, 0)
151
#endplatform
152
153
end if
154
end if
155
end sub
156
157
158
sub ObjectDraw
159
DrawSprite(0)
160
end sub
161
162
163
sub ObjectStartup
164
LoadSpriteSheet("R6/Objects.gif")
165
166
SpriteFrame(-28, -28, 56, 32, 83, 1) // #0 - Launcher
167
168
ArrayPos0 = 32
169
while ArrayPos0 < 1056
170
if Object[ArrayPos0].Type == TypeName[Launcher]
171
Object[ArrayPos0].XOriginPos = Object[ArrayPos0].XPos
172
Object[ArrayPos0].DrawOrder = 4
173
end if
174
ArrayPos0++
175
loop
176
end sub
177
178
179
// ========================
180
// Editor Subs
181
// ========================
182
183
sub RSDKDraw
184
DrawSprite(0)
185
end sub
186
187
188
sub RSDKLoad
189
LoadSpriteSheet("R6/Objects.gif")
190
191
SpriteFrame(-28, -28, 56, 32, 83, 1) // #0 - Launcher
192
193
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
194
end sub
195
196