Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/R6BossCSetup.txt
1319 views
1
//---------------Sonic CD R6 Boss C Setup Script--------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value1 : Object.PaletteBank
7
#alias Object.Value4 : Object.LightTile
8
#alias Object.Value5 : Object.ElectricTile
9
#alias Object.Value6 : Object.BounceFloorAnim
10
#alias Object.Value7 : Object.BounceFloorTile
11
#alias Object.Scale : Object.BounceFloorFlag
12
#alias Object.Direction : Object.WebDirection
13
14
// Player Aliases
15
#alias Player.Value4 : Player.InvincibleTimer
16
17
// States
18
#alias 2 : R6C_SETUP_WEB_SHOCK // Unused in boss stages
19
20
// Web Directions
21
#alias 0 : VERTICAL_WEB
22
#alias 1 : HORIZONTAL_WEB
23
#alias 2 : DIAGONAL_WEB
24
25
// Gravity
26
#alias 1 : GRAVITY_AIR
27
28
// Stage SFX
29
#alias 0 : SFX_S_BOUNCEFLOOR
30
#alias 2 : SFX_S_CATCH
31
32
// Priority
33
#alias 1 : PRIORITY_ACTIVE
34
35
// Tile Info
36
#alias 8 : TILEINFO_ANGLEB
37
38
39
sub ObjectMain
40
TempValue0 = Object.LightTile
41
TempValue0 &= 1
42
if TempValue0 == 0
43
TempValue0 = Object.LightTile
44
TempValue0 >>= 1
45
TempValue0 += 808
46
Copy16x16Tile(579, TempValue0)
47
end if
48
Object.LightTile++
49
Object.LightTile %= 24
50
51
TempValue0 = Object.ElectricTile
52
TempValue0 %= 5
53
if TempValue0 == 0
54
TempValue0 = Object.ElectricTile
55
TempValue0 /= 5
56
TempValue0 += 820
57
Copy16x16Tile(580, TempValue0)
58
TempValue0 += 3
59
Copy16x16Tile(581, TempValue0)
60
end if
61
Object.ElectricTile++
62
Object.ElectricTile %= 15
63
64
TempValue0 = Object.BounceFloorAnim
65
TempValue0 &= 1
66
if TempValue0 == 0
67
TempValue0 = Object.BounceFloorTile
68
TempValue0 += 826
69
Object.BounceFloorTile++
70
Object.BounceFloorTile %= 6
71
Copy16x16Tile(543, TempValue0)
72
end if
73
Object.BounceFloorAnim++
74
Object.BounceFloorAnim &= 511
75
76
Object.BounceFloorFlag = true
77
78
TempValue0 = Object.PaletteBank
79
TempValue0 >>= 1
80
SetActivePalette(TempValue0, 0, Screen.YSize)
81
Object.PaletteBank++
82
Object.PaletteBank %= 6
83
end sub
84
85
86
sub ObjectPlayerInteraction
87
TempValue2 = Player.XPos
88
TempValue2 >>= 16
89
TempValue2 += Player.CollisionRight
90
91
TempValue3 = Player.YPos
92
TempValue3 >>= 16
93
TempValue3 += Player.CollisionBottom
94
TempValue3 += 2
95
Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)
96
97
TempValue2 = Player.XPos
98
TempValue2 >>= 16
99
TempValue2 += Player.CollisionLeft
100
Get16x16TileInfo(TempValue1, TempValue2, TempValue3, TILEINFO_ANGLEB)
101
// Bug Details:
102
// Sonic Team updated the normal bounce floor (which is R6BounceFloor in Origins for the Past and Present)
103
// to prevent Knuckles from disabling his collisions when climbing onto the floor (they knew about this bug)
104
// However, they didn't update it here and in R6BossDSetup.
105
TempValue0 |= TempValue1
106
if TempValue0 == true
107
if Object.BounceFloorFlag == true
108
if Player.YVelocity > -1
109
Player.Animation = ANI_JUMPING
110
Player.Gravity = GRAVITY_AIR
111
Player.Timer = 0
112
Player.YVelocity = -0x160000
113
114
#platform: Use_Origins
115
Player.State = Player_State_Air_NoDropDash
116
#endplatform
117
118
#platform: Use_Standalone
119
Player.State = Player_State_Air
120
#endplatform
121
PlayStageSfx(SFX_S_BOUNCEFLOOR, false)
122
123
#platform: Use_Haptics
124
HapticEffect(60, 0, 0, 0)
125
#endplatform
126
127
end if
128
end if
129
end if
130
131
TempValue2 -= Player.CollisionLeft
132
TempValue3 -= Player.CollisionBottom
133
TempValue3 -= 2
134
// You will see constant checks for R6C_SETUP_WEB_SHOCK state
135
// but the code to reach that state is removed, since there are no shock webs on the boss stage
136
Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)
137
switch TempValue0
138
case 2
139
if Player.InvincibleTimer == 0
140
Player.State = Player_State_GotHit
141
if Player.Direction == FACING_LEFT
142
Player.Speed = 0x20000
143
else
144
Player.Speed = -0x20000
145
end if
146
end if
147
break
148
case 5
149
if Object.State == R6C_SETUP_WEB_SHOCK
150
if Player.InvincibleTimer == 0
151
Player.State = Player_State_GotHit
152
if Player.Direction == FACING_LEFT
153
Player.Speed = 0x20000
154
else
155
Player.Speed = -0x20000
156
end if
157
end if
158
end if
159
break
160
case 6
161
if Object.State == R6C_SETUP_WEB_SHOCK
162
if Object.WebDirection == VERTICAL_WEB
163
if Player.InvincibleTimer == 0
164
Player.State = Player_State_GotHit
165
if Player.Direction == FACING_LEFT
166
Player.Speed = 0x20000
167
else
168
Player.Speed = -0x20000
169
end if
170
end if
171
end if
172
end if
173
break
174
case 7
175
if Object.State == R6C_SETUP_WEB_SHOCK
176
if Object.WebDirection == HORIZONTAL_WEB
177
if Player.InvincibleTimer == 0
178
Player.State = Player_State_GotHit
179
if Player.Direction == FACING_LEFT
180
Player.Speed = 0x20000
181
else
182
Player.Speed = -0x20000
183
end if
184
end if
185
end if
186
end if
187
break
188
case 8
189
if Object.State == R6C_SETUP_WEB_SHOCK
190
if Object.WebDirection == DIAGONAL_WEB
191
if Player.InvincibleTimer == 0
192
Player.State = Player_State_GotHit
193
if Player.Direction == FACING_LEFT
194
Player.Speed = 0x20000
195
else
196
Player.Speed = -0x20000
197
end if
198
end if
199
end if
200
end if
201
break
202
end switch
203
TempValue3 -= 4
204
Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)
205
switch TempValue0
206
case 2
207
if Player.InvincibleTimer == 0
208
Player.State = Player_State_GotHit
209
if Player.Direction == FACING_LEFT
210
Player.Speed = 0x20000
211
else
212
Player.Speed = -0x20000
213
end if
214
end if
215
break
216
case 5
217
if Object.State == R6C_SETUP_WEB_SHOCK
218
if Player.InvincibleTimer == 0
219
Player.State = Player_State_GotHit
220
if Player.Direction == FACING_LEFT
221
Player.Speed = 0x20000
222
else
223
Player.Speed = -0x20000
224
end if
225
end if
226
end if
227
break
228
case 6
229
if Object.State == R6C_SETUP_WEB_SHOCK
230
if Object.WebDirection == VERTICAL_WEB
231
if Player.InvincibleTimer == 0
232
Player.State = Player_State_GotHit
233
if Player.Direction == FACING_LEFT
234
Player.Speed = 0x20000
235
else
236
Player.Speed = -0x20000
237
end if
238
end if
239
end if
240
end if
241
break
242
case 7
243
if Object.State == R6C_SETUP_WEB_SHOCK
244
if Object.WebDirection == HORIZONTAL_WEB
245
if Player.InvincibleTimer == 0
246
Player.State = Player_State_GotHit
247
if Player.Direction == FACING_LEFT
248
Player.Speed = 0x20000
249
else
250
Player.Speed = -0x20000
251
end if
252
end if
253
end if
254
end if
255
break
256
case 8
257
if Object.State == R6C_SETUP_WEB_SHOCK
258
if Object.WebDirection == DIAGONAL_WEB
259
if Player.InvincibleTimer == 0
260
Player.State = Player_State_GotHit
261
if Player.Direction == FACING_LEFT
262
Player.Speed = 0x20000
263
else
264
Player.Speed = -0x20000
265
end if
266
end if
267
end if
268
end if
269
break
270
end switch
271
TempValue3 += 4
272
TempValue3 += Player.CollisionTop
273
Get16x16TileInfo(TempValue0, TempValue2, TempValue3, TILEINFO_ANGLEB)
274
if TempValue0 == 3
275
TempValue4 = TempValue3
276
TempValue4 &= 15
277
if TempValue4 < 8
278
if Player.State != Player_State_HangBar
279
Player.State = Player_State_HangBar
280
Player.YVelocity = 0
281
Player.Animation = ANI_HANGING
282
TempValue3 &= 0x7FF0
283
TempValue3 += 4
284
TempValue3 -= Player.CollisionTop
285
Player.iYPos = TempValue3
286
PlayStageSfx(SFX_S_CATCH, false)
287
Screen.AdjustCameraY = 0
288
end if
289
end if
290
end if
291
end sub
292
293
294
sub ObjectStartup
295
Object[19].Type = TypeName[R6 Setup]
296
Object[19].Priority = PRIORITY_ACTIVE
297
Object[19].DrawOrder = 2
298
299
TempValue0 = 1
300
while TempValue0 < 3
301
RotatePalette(161, 163, 0)
302
CopyPalette(0, TempValue0)
303
TempValue0++
304
loop
305
RotatePalette(161, 163, 0)
306
end sub
307
308
309
// ========================
310
// Editor Subs
311
// ========================
312
313
sub RSDKDraw
314
DrawSprite(0)
315
end sub
316
317
318
sub RSDKLoad
319
LoadSpriteSheet("Global/Display.gif")
320
SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon
321
322
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
323
end sub
324
325