Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Players/TailsObject.txt
1319 views
1
//----------------Sonic CD Tails Object Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value1 : Object.TailAnimation
7
#alias Object[1].DrawOrder : TailsObject.DrawOrder
8
#alias Object[1].Priority : TailsObject.Priority
9
10
#alias 1 : PRIORITY_ACTIVE
11
12
// Animation Aliases
13
// Because the ANI_* variables are, well, variables, we can't use them as cases in a switch-case statement, so let's make our own version of them here so that we can do that
14
#alias 0 : TAILS_STOPPED
15
#alias 1 : TAILS_WAITING
16
#alias 3 : TAILS_LOOKING_UP
17
#alias 4 : TAILS_LOOKING_DOWN
18
#alias 7 : TAILS_SKIDDING
19
#alias 9 : TAILS_SPIN_DASH
20
#alias 10 : TAILS_JUMPING
21
#alias 17 : TAILS_PUSHING
22
#alias 43 : TAILS_ROLL3D
23
24
// Player aliases
25
#alias 1 : PLAYER_TAILS_A
26
27
28
sub ObjectMain
29
ArrayPos0 = Player.DrawOrder
30
Screen[ArrayPos0].DrawListSize = 2
31
GetDrawListEntityRef(TempValue0, ArrayPos0, 0)
32
SetDrawListEntityRef(Object.EntityNo, ArrayPos0, 0)
33
SetDrawListEntityRef(TempValue0, ArrayPos0, 1)
34
end sub
35
36
37
sub ObjectDraw
38
if Object.TailAnimation != Player.Animation
39
if Player.Animation > 4
40
Object.Frame = 0
41
end if
42
43
if Object.TailAnimation > 4
44
Object.Frame = 0
45
end if
46
47
Object.TailAnimation = Player.Animation
48
end if
49
50
Object.Direction = Player.Direction
51
switch Object.TailAnimation
52
case TAILS_STOPPED
53
if Player.Frame == 0
54
TempValue0 = Object.Frame
55
TempValue0 >>= 3
56
57
if Player.Visible == true
58
DrawSpriteFX(TempValue0, FX_FLIP, Player.XPos, Player.YPos)
59
end if
60
61
Object.Frame++
62
Object.Frame %= 40
63
end if
64
break
65
66
case TAILS_WAITING
67
case TAILS_LOOKING_UP
68
case TAILS_LOOKING_DOWN
69
TempValue0 = Object.Frame
70
TempValue0 >>= 3
71
72
if Player.Visible == true
73
DrawSpriteFX(TempValue0, FX_FLIP, Player.XPos, Player.YPos)
74
end if
75
76
Object.Frame++
77
Object.Frame %= 40
78
break
79
80
case TAILS_SKIDDING
81
case TAILS_SPIN_DASH
82
TempValue0 = Object.Frame
83
TempValue0 >>= 2
84
TempValue0 += 11
85
86
if Player.Visible == true
87
DrawSpriteFX(TempValue0, FX_FLIP, Player.XPos, Player.YPos)
88
end if
89
90
Object.Frame++
91
Object.Frame %= 12
92
break
93
94
case TAILS_JUMPING
95
case TAILS_ROLL3D
96
TempValue0 = Object.Frame
97
TempValue0 >>= 2
98
99
CheckEqual(Player.XVelocity, 0)
100
TempValue1 = CheckResult
101
CheckEqual(Player.YVelocity, 0)
102
TempValue1 &= CheckResult
103
if TempValue1 == false
104
ATan2(Object.Rotation, Player.XVelocity, Player.YVelocity)
105
Object.Rotation += 16
106
Object.Rotation &= 255
107
Object.Rotation >>= 5
108
// Rotates the tails according to Tails's rotation
109
switch Object.Rotation
110
case 0
111
case 8
112
TempValue0 += 5
113
Object.Rotation = 0
114
break
115
116
case 1
117
TempValue0 += 8
118
if Object.Direction == FACING_RIGHT
119
Object.Rotation = 64
120
else
121
Object.Rotation = 0
122
end if
123
break
124
125
case 2
126
TempValue0 += 5
127
Object.Rotation = 64
128
break
129
130
case 3
131
TempValue0 += 8
132
if Object.Direction == FACING_RIGHT
133
Object.Rotation = 128
134
else
135
Object.Rotation = 64
136
end if
137
break
138
139
case 4
140
TempValue0 += 5
141
Object.Rotation = 128
142
break
143
144
case 5
145
TempValue0 += 8
146
if Object.Direction == FACING_RIGHT
147
Object.Rotation = 192
148
else
149
Object.Rotation = 128
150
end if
151
break
152
153
case 6
154
TempValue0 += 5
155
Object.Rotation = 192
156
break
157
158
case 7
159
TempValue0 += 8
160
if Object.Direction == FACING_RIGHT
161
Object.Rotation = 0
162
else
163
Object.Rotation = 192
164
end if
165
break
166
end switch
167
168
if Object.Direction == FACING_LEFT
169
Object.Rotation += 128
170
end if
171
else
172
TempValue0 += 5
173
Object.Rotation = 0
174
end if
175
176
Object.Rotation <<= 1
177
178
if Player.Visible == true
179
DrawSpriteFX(TempValue0, FX_ROTATE, Player.XPos, Player.YPos)
180
end if
181
182
Object.Frame++
183
Object.Frame %= 12
184
break
185
186
case TAILS_PUSHING
187
TempValue0 = Object.Frame
188
TempValue0 /= 10
189
TempValue0 += 11
190
191
if Player.Visible == true
192
DrawSpriteFX(TempValue0, FX_FLIP, Player.XPos, Player.YPos)
193
end if
194
195
Object.Frame++
196
Object.Frame %= 30
197
break
198
end switch
199
end sub
200
201
202
sub ObjectStartup
203
if Stage.PlayerListPos == PLAYER_TAILS_A // PLAYER_TAILS in origins
204
LoadSpriteSheet("Players/Tails1.gif")
205
206
Object[1].Type = TypeName[Tails Object]
207
TailsObject.DrawOrder = 8
208
TailsObject.Priority = PRIORITY_ACTIVE
209
210
// Idle Frames
211
SpriteFrame(-22, -8, 16, 24, 82, 199) // #0 - Tail Idle Frame 0
212
SpriteFrame(-26, -8, 20, 24, 99, 199) // #1 - Tail Idle Frame 1
213
SpriteFrame(-26, -8, 20, 24, 120, 199) // #2 - Tail Idle Frame 2
214
SpriteFrame(-26, -8, 20, 24, 141, 199) // #3 - Tail Idle Frame 3
215
SpriteFrame(-26, -8, 20, 24, 162, 199) // #4 - Tail Idle Frame 4
216
217
// Rolling Frames
218
SpriteFrame(-35, -8, 24, 16, 231, 166) // #5 - Tail Rolling Frame 0
219
SpriteFrame(-35, -8, 24, 16, 231, 183) // #6 - Tail Rolling Frame 1
220
SpriteFrame(-35, -8, 24, 16, 231, 200) // #7 - Tail Rolling Frame 2
221
222
// Jumping Frames
223
SpriteFrame(-25, 9, 20, 16, 235, 217) // #8 - Tail Jumping Frame 0
224
SpriteFrame(-25, 9, 18, 16, 237, 234) // #9 - Tail Jumping Frame 1
225
SpriteFrame(-25, 9, 20, 16, 216, 234) // #10 - Tail Jumping Frame 2
226
SpriteFrame(-30, -6, 24, 16, 231, 166) // #11 - Tail Jumping Frame 3
227
SpriteFrame(-30, -6, 24, 16, 231, 183) // #12 - Tail Jumping Frame 4
228
SpriteFrame(-30, -6, 24, 16, 231, 200) // #13 - Tail Jumping Frame 5
229
end if
230
end sub
231
232
233
// ========================
234
// Editor Subs
235
// ========================
236
237
sub RSDKDraw
238
DrawSprite(0)
239
end sub
240
241
242
sub RSDKLoad
243
LoadSpriteSheet("Players/Tails1.gif")
244
SpriteFrame(-22, -8, 16, 24, 82, 199) // Tail Idle Frame 0
245
246
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
247
end sub
248
249