Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R8/BossWing.txt
1319 views
1
//----------------Sonic CD Boss Wing 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.XVelocity
8
#alias Object.Value2 : Object.YVelocity
9
#alias Object.Value3 : Object.RotDrawXPos
10
#alias Object.Value4 : Object.RotDrawYPos
11
#alias Object.Value5 : Object.Attached // Used by Egg Mobile
12
#alias Object.Value6 : Object.VisibleFrame
13
#alias Object.Value7 : Object.EggMobileEntity
14
15
// States
16
#alias 0 : BOSSWING_BLANK // State used while attached on the Egg Mobile
17
#alias 1 : BOSSWING_DETACH
18
#alias 2 : BOSSWING_FALL_VERTICAL
19
#alias 3 : BOSSWING_DROP_GROUNDED
20
#alias 4 : BOSSWING_VANISH
21
#alias 5 : BOSSWING_FALL_DIAGONAL
22
23
// Eggman Animations
24
#alias 2 : EGGANI_LAUGH
25
26
// Collision Sides
27
#alias 0 : CSIDE_FLOOR
28
29
// Stage SFX
30
#alias 8 : SFX_S_IMPACT1
31
32
// Priority
33
#alias 0 : PRIORITY_BOUNDS
34
35
36
sub ObjectMain
37
switch Object.State
38
case BOSSWING_DETACH
39
Object.YPos -= Object.YVelocity
40
break
41
42
case BOSSWING_FALL_VERTICAL
43
Object.YPos += Object.YVelocity
44
if Object.Timer < 30
45
Object.Timer++
46
Object.XPos += Object.XVelocity
47
else
48
if Object.Rotation == 0
49
ObjectTileCollision(CSIDE_FLOOR, 0, 32, 0)
50
else
51
ObjectTileCollision(CSIDE_FLOOR, 0, 16, 0)
52
end if
53
if CheckResult == true
54
Object.State = BOSSWING_DROP_GROUNDED
55
Object.Timer = 0
56
PlayStageSfx(SFX_S_IMPACT1, false)
57
58
#platform: Use_Haptics
59
HapticEffect(100, 0, 0, 0)
60
#endplatform
61
62
else
63
Object.XPos += Object.XVelocity
64
end if
65
end if
66
break
67
68
case BOSSWING_DROP_GROUNDED
69
if Object.Timer < 30
70
Object.Timer++
71
else
72
Object.Timer = 0
73
Object.VisibleFrame = Object.Frame
74
Object.State++
75
end if
76
break
77
78
case BOSSWING_VANISH
79
if Object.Timer < 60
80
Object.Timer++
81
else
82
Object.Timer = 0
83
Object.State = BOSSWING_BLANK
84
Object.Type = TypeName[Blank Object]
85
end if
86
TempValue0 = Object.Timer
87
TempValue0 &= 1
88
if TempValue0 == 0
89
Object.Frame = 5
90
else
91
Object.Frame = Object.VisibleFrame
92
end if
93
break
94
95
case BOSSWING_FALL_DIAGONAL
96
Object.XPos += Object.XVelocity
97
Object.YPos += Object.YVelocity
98
99
Object.Rotation += 508
100
Object.Rotation &= 511
101
102
Object.YVelocity += 0x3000
103
104
if Object.Timer < 120
105
Object.Timer++
106
else
107
Object.Priority = PRIORITY_BOUNDS
108
Object.Timer = 0
109
Object.State = BOSSWING_BLANK
110
Object.Type = TypeName[Blank Object]
111
end if
112
113
TempValue0 = Object.Timer
114
TempValue0 &= 1
115
if TempValue0 == 0
116
Object.Frame = 5
117
else
118
Object.Frame = 0
119
end if
120
break
121
end switch
122
end sub
123
124
125
sub ObjectPlayerInteraction
126
if Object.State < BOSSWING_VANISH
127
TempValue0 = 0
128
TempValue1 = Object.XPos
129
TempValue2 = Object.YPos
130
PlayerObjectCollision(C_TOUCH, -12, -12, 12, 12)
131
TempValue0 = CheckResult
132
133
Sin(Object.XPos, Object.Rotation)
134
Object.XPos *= -0x100000
135
Object.XPos >>= 9
136
Object.XPos += TempValue1
137
138
Cos(Object.YPos, Object.Rotation)
139
Object.YPos *= 0x100000
140
Object.YPos >>= 9
141
Object.YPos += TempValue2
142
143
PlayerObjectCollision(C_TOUCH, -10, -10, 10, 10)
144
TempValue0 |= CheckResult
145
146
Sin(Object.XPos, Object.Rotation)
147
Object.XPos *= 0x100000
148
Object.XPos >>= 9
149
Object.XPos += TempValue1
150
151
Cos(Object.YPos, Object.Rotation)
152
Object.YPos *= -0x100000
153
Object.YPos >>= 9
154
Object.YPos += TempValue2
155
156
PlayerObjectCollision(C_TOUCH, -15, -15, 15, 15)
157
TempValue0 |= CheckResult
158
159
Object.XPos = TempValue1
160
Object.YPos = TempValue2
161
162
if TempValue0 == true
163
CallFunction(Player_Hit)
164
if Player.State == Player_State_GotHit
165
ArrayPos0 = Object.EggMobileEntity
166
Object[ArrayPos0].Animation = EGGANI_LAUGH
167
end if
168
end if
169
end if
170
end sub
171
172
173
sub ObjectDraw
174
TempValue6 = Object.XPos
175
TempValue7 = Object.YPos
176
177
if Object.Rotation == 256
178
TempValue6 -= 0x10000
179
end if
180
181
if Object.Rotation == 384
182
TempValue7 -= 0x10000
183
end if
184
185
switch Object.Frame
186
case 0
187
case 1
188
case 2
189
DrawSpriteFX(Object.Frame, FX_ROTATE, TempValue6, TempValue7)
190
191
Sin(Object.RotDrawXPos, Object.Rotation)
192
Object.RotDrawXPos *= -0x200000
193
Object.RotDrawXPos >>= 9
194
Object.RotDrawXPos += Object.XPos
195
196
Cos(Object.RotDrawYPos, Object.Rotation)
197
Object.RotDrawYPos *= 0x200000
198
Object.RotDrawYPos >>= 9
199
Object.RotDrawYPos += Object.YPos
200
201
DrawSpriteXY(3, Object.RotDrawXPos, Object.RotDrawYPos)
202
break
203
204
case 3 // Set by EggMobile
205
DrawSpriteFX(0, FX_ROTATE, TempValue6, TempValue7)
206
break
207
208
case 4 // Set by EggMobile
209
DrawSpriteFX(2, FX_ROTATE, TempValue6, TempValue7)
210
break
211
212
end switch
213
end sub
214
215
216
sub ObjectStartup
217
LoadSpriteSheet("R8/Objects3.gif")
218
219
SpriteFrame(-24, -32, 48, 64, 156, 1) // #0 - Boss Wing facing front
220
SpriteFrame(-16, -32, 32, 64, 205, 1) // #1 - Boss Wing facing 45°
221
SpriteFrame(-8, -32, 16, 64, 238, 1) // #2 - Boss Wing facing side
222
223
SpriteFrame(-8, -8, 16, 16, 90, 18) // #3 - Boss Wing body attachment
224
end sub
225
226
227
// ========================
228
// Editor Subs
229
// ========================
230
231
sub RSDKDraw
232
TempValue6 = Object.XPos
233
TempValue7 = Object.YPos
234
235
if Object.Rotation == 256
236
TempValue6 -= 0x10000
237
end if
238
239
if Object.Rotation == 384
240
TempValue7 -= 0x10000
241
end if
242
DrawSpriteXY(0, Object.XPos, Object.YPos)
243
244
Sin(TempValue0, 0)
245
TempValue0 *= -0x200000
246
TempValue0 >>= 9
247
TempValue0 += Object.XPos
248
249
Cos(TempValue1, 0)
250
TempValue1 *= 0x200000
251
TempValue1 >>= 9
252
TempValue1 += Object.YPos
253
254
DrawSpriteXY(1, Object.XPos, Object.YPos)
255
end sub
256
257
258
sub RSDKLoad
259
LoadSpriteSheet("R8/Objects3.gif")
260
261
SpriteFrame(-24, -32, 48, 64, 156, 1) // #0 - Boss Wing facing front
262
SpriteFrame(-8, -8, 16, 16, 90, 18) // #1 - Boss Wing body attachment
263
264
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
265
end sub
266
267