Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Global/WarpSonic.txt
1319 views
1
//----------------Sonic CD Warp Sonic Script------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.FrameTimer
7
#alias Object.Value1 : Object.Timer
8
#alias Object.Value2 : Object.WarpStarTimer
9
10
// Afterimage 1 Aliases
11
#alias Object[1].Value0 : AfterImage1.Delay
12
#alias Object[1].Value1 : AfterImage1.Delay2
13
#alias Object[1].Value2 : AfterImage1.Delay3
14
#alias Object[1].Value3 : AfterImage1.YPos
15
16
// Afterimage 2 Aliases
17
#alias Object[1].Value4 : AfterImage2.Delay
18
#alias Object[1].Value5 : AfterImage2.Delay2
19
#alias Object[1].Value6 : AfterImage2.Delay3
20
#alias Object[1].Value7 : AfterImage2.YPos
21
22
// Afterimage 3 Aliases
23
#alias Object[2].Value0 : AfterImage3.Delay
24
#alias Object[2].Value1 : AfterImage3.Delay2
25
#alias Object[2].Value2 : AfterImage3.Delay3
26
#alias Object[2].Value3 : AfterImage3.YPos
27
28
// Time Warp Aliases
29
#alias Object[0].State : TimeWarp.State
30
31
// Warp Star Aliases
32
#alias Object.Value1 : WarpStar.RandFadeTimer
33
#alias Object.State : WarpStar.State
34
35
// States
36
#alias 0 : WARPSONIC_REACH_CENTER
37
#alias 1 : WARPSONIC_IDLE
38
#alias 2 : WARPSONIC_LEAVE
39
40
// WarpStar States
41
#alias 2 : WARPSTAR_CUTSCENE
42
43
// TimeWarp States
44
#alias 4 : TIMEWARP_LEAVING
45
46
// Player
47
#alias 0 : PLAYER_SONIC_A
48
#alias 1 : PLAYER_TAILS_A
49
50
// Ink
51
#alias 2 : INK_ALPHA
52
53
54
sub ObjectMain
55
// tldr;
56
// this gets the ypos for the afterimages
57
AfterImage3.YPos = AfterImage3.Delay3
58
AfterImage3.Delay3 = AfterImage3.Delay2
59
AfterImage3.Delay2 = AfterImage3.Delay
60
AfterImage3.Delay = AfterImage2.YPos
61
62
AfterImage2.YPos = AfterImage2.Delay3
63
AfterImage2.Delay3 = AfterImage2.Delay2
64
AfterImage2.Delay2 = AfterImage2.Delay
65
AfterImage2.Delay = AfterImage1.YPos
66
67
AfterImage1.YPos = AfterImage1.Delay3
68
AfterImage1.Delay3 = AfterImage1.Delay2
69
AfterImage1.Delay2 = AfterImage1.Delay
70
AfterImage1.Delay = Object.YPos
71
72
switch Object.State
73
case WARPSONIC_REACH_CENTER
74
Object.YPos -= 0x80000
75
if Object.YPos < 0x780000
76
Object.YPos = 0x780000
77
Object.State = WARPSONIC_IDLE
78
Object.Timer = 0
79
end if
80
break
81
82
case WARPSONIC_IDLE
83
Object.Timer++
84
85
#platform: Use_Haptics
86
if Object.Timer == 60
87
HapticEffect(9, 0, 0, 0)
88
end if
89
#endplatform
90
91
if Object.Timer == 120
92
Object.Timer = 0
93
Object.State = WARPSONIC_LEAVE
94
TimeWarp.State = TIMEWARP_LEAVING
95
end if
96
break
97
98
case WARPSONIC_LEAVE
99
Object.YPos -= 0x80000
100
if Object.OutOfBounds == true
101
Object.Type = TypeName[Blank Object]
102
end if
103
break
104
105
end switch
106
107
Object.WarpStarTimer++
108
if Object.WarpStarTimer == 4
109
Object.WarpStarTimer = 0
110
Rand(TempValue0, 32)
111
TempValue0 -= 16
112
TempValue0 <<= 16
113
TempValue0 += Object.XPos
114
115
Rand(TempValue1, 32)
116
TempValue1 -= 16
117
TempValue1 <<= 16
118
TempValue1 += Object.YPos
119
120
CreateTempObject(TypeName[Warp Star], 0, TempValue0, TempValue1)
121
WarpStar[TempObjectPos].State = WARPSTAR_CUTSCENE
122
123
Rand(WarpStar[TempObjectPos].RandFadeTimer, 32)
124
WarpStar[TempObjectPos].RandFadeTimer += 16
125
end if
126
end sub
127
128
129
sub ObjectDraw
130
// Afterimages Frames
131
TempValue0 = Object.Frame
132
TempValue0++
133
if TempValue0 > 4
134
TempValue0 = 0
135
end if
136
137
// Afterimages
138
if Object.YPos < 0x1040000
139
Object.InkEffect = INK_ALPHA
140
Object.Alpha = 160
141
DrawSpriteFX(TempValue0, FX_INK, Object.XPos, AfterImage1.YPos)
142
Object.Alpha = 128
143
DrawSpriteFX(TempValue0, FX_INK, Object.XPos, AfterImage2.YPos)
144
Object.Alpha = 96
145
DrawSpriteFX(TempValue0, FX_INK, Object.XPos, AfterImage3.YPos)
146
end if
147
148
DrawSprite(Object.Frame)
149
Object.FrameTimer++
150
if Object.FrameTimer > 2
151
Object.FrameTimer = 0
152
Object.Frame++
153
if Object.Frame > 4
154
Object.Frame = 0
155
end if
156
end if
157
end sub
158
159
160
sub ObjectStartup
161
// #0 - Bouncing Frame 0
162
// #1 - Bouncing Frame 1
163
// #2 - Bouncing Frame 2
164
// #3 - Bouncing Frame 3
165
// #4 - Bouncing Frame 4
166
167
if Stage.PlayerListPos == PLAYER_SONIC_A
168
LoadSpriteSheet("Global/Items3.gif")
169
SpriteFrame(-14, -22, 29, 44, 116, 211)
170
SpriteFrame(-11, -22, 20, 44, 146, 211)
171
SpriteFrame(-11, -22, 25, 44, 167, 211)
172
SpriteFrame(-13, -22, 25, 44, 193, 211)
173
SpriteFrame(-8, -22, 20, 44, 219, 211)
174
end if
175
176
if Stage.PlayerListPos == PLAYER_TAILS_A
177
LoadSpriteSheet("Players/Tails2.gif")
178
SpriteFrame(-17, -22, 24, 48, 1, 1)
179
SpriteFrame(-11, -22, 24, 48, 26, 1)
180
SpriteFrame(-13, -22, 24, 48, 51, 1)
181
SpriteFrame(-7, -22, 24, 48, 76, 1)
182
SpriteFrame(-10, -22, 21, 48, 101, 1)
183
end if
184
185
#platform: Use_Origins
186
if Stage.PlayerListPos == PLAYER_KNUCKLES
187
LoadSpriteSheet("Players/KTE5.gif")
188
SpriteFrame(-14, -21, 29, 45, 1, 70)
189
SpriteFrame(-13, -21, 24, 45, 31, 70)
190
SpriteFrame(-11, -21, 30, 45, 56, 70)
191
SpriteFrame(-18, -21, 30, 45, 87, 66)
192
SpriteFrame(-10, -21, 24, 45, 118, 66)
193
end if
194
195
if Stage.PlayerListPos == PLAYER_AMY
196
LoadSpriteSheet("Players/Amy3.gif")
197
SpriteFrame(-12, -21, 24, 39, 1, 1)
198
SpriteFrame(-13, -21, 21, 39, 26, 1)
199
SpriteFrame(-14, -21, 28, 39, 48, 1)
200
SpriteFrame(-13, -21, 28, 39, 77, 1)
201
SpriteFrame(-7, -21, 21, 39, 1, 41)
202
end if
203
#endplatform
204
205
end sub
206
207
208
// ========================
209
// Editor Subs
210
// ========================
211
212
sub RSDKDraw
213
DrawSprite(0)
214
end sub
215
216
217
sub RSDKLoad
218
LoadSpriteSheet("Global/Items3.gif")
219
SpriteFrame(-14, -22, 29, 44, 116, 211) // #0 - Bouncing Frame 0
220
221
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
222
end sub
223
224