Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/IceBlock.txt
1319 views
1
//-----------------Sonic CD Ice Block 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
10
// States
11
#alias 0 : ICEBLOCK_FALLING
12
#alias 1 : ICEBLOCK_BREAKICE
13
14
// Stage SFX
15
#alias 4 : SFX_S_GLASSSMASH
16
17
// Property Values
18
#alias 0 : CHARACTER_ICEBLOCK
19
#alias 1 : BIG_CHUNK_ICEBLOCK
20
#alias 2 : MEDIUM_CHUNK_ICEBLOCK
21
#alias 3 : CENTRAL_CHUNK_ICEBLOCK // Used, but it doesn't do anything
22
#alias 4 : SMALL_CHUNK_ICEBLOCK
23
24
// Collision Sides
25
#alias 0 : CSIDE_FLOOR
26
27
// Players
28
#alias 0 : PLAYER_SONIC_A
29
#alias 1 : PLAYER_TAILS_A
30
31
// Directions
32
#alias 2 : FACING_UPEND_RIGHT
33
#alias 3 : FACING_UPEND_LEFT
34
35
// Function declarations
36
#function IceBlock_CreateIceChunks
37
38
39
function IceBlock_CreateIceChunks
40
CreateTempObject(TypeName[Ice Block], BIG_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
41
Object[TempObjectPos].DrawOrder = 4
42
Object[TempObjectPos].XPos -= 0x110000
43
Object[TempObjectPos].YPos -= 0xD0000
44
Object[TempObjectPos].XVelocity = -0x10000
45
Object[TempObjectPos].YVelocity = -0x10000
46
Object[TempObjectPos].Direction = FACING_RIGHT
47
48
CreateTempObject(TypeName[Ice Block], BIG_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
49
Object[TempObjectPos].DrawOrder = 4
50
Object[TempObjectPos].XPos += 0x110000
51
Object[TempObjectPos].YPos -= 0xD0000
52
Object[TempObjectPos].XVelocity = 0x10000
53
Object[TempObjectPos].YVelocity = -0x10000
54
Object[TempObjectPos].Direction = FACING_LEFT
55
56
CreateTempObject(TypeName[Ice Block], BIG_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
57
Object[TempObjectPos].DrawOrder = 4
58
Object[TempObjectPos].XPos -= 0x110000
59
Object[TempObjectPos].YPos += 0xD0000
60
Object[TempObjectPos].XVelocity = -0x10000
61
Object[TempObjectPos].YVelocity = 0x10000
62
Object[TempObjectPos].Direction = FACING_UPEND_RIGHT
63
64
CreateTempObject(TypeName[Ice Block], BIG_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
65
Object[TempObjectPos].DrawOrder = 4
66
Object[TempObjectPos].XPos += 0x110000
67
Object[TempObjectPos].YPos += 0xD0000
68
Object[TempObjectPos].XVelocity = 0x10000
69
Object[TempObjectPos].YVelocity = 0x10000
70
Object[TempObjectPos].Direction = FACING_UPEND_LEFT
71
72
CreateTempObject(TypeName[Ice Block], CENTRAL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
73
Object[TempObjectPos].DrawOrder = 4
74
Object[TempObjectPos].Direction = FACING_RIGHT
75
76
CreateTempObject(TypeName[Ice Block], MEDIUM_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
77
Object[TempObjectPos].DrawOrder = 4
78
Object[TempObjectPos].YPos -= 0x110000
79
Object[TempObjectPos].YVelocity = -0x10000
80
Object[TempObjectPos].Direction = FACING_LEFT
81
82
CreateTempObject(TypeName[Ice Block], MEDIUM_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
83
Object[TempObjectPos].DrawOrder = 4
84
Object[TempObjectPos].YPos += 0x110000
85
Object[TempObjectPos].YVelocity = 0x10000
86
Object[TempObjectPos].Direction = FACING_UPEND_LEFT
87
88
89
#platform: Use_Haptics
90
HapticEffect(11, 0, 0, 0)
91
#endplatform
92
93
end function
94
95
96
sub ObjectMain
97
switch Object.PropertyValue
98
case CHARACTER_ICEBLOCK
99
if Object.State == ICEBLOCK_FALLING
100
Object.YPos += Object.YVelocity
101
Object.YVelocity += Player.GravityStrength
102
if Object.YVelocity > 0x140000
103
Object.YVelocity = 0x140000
104
end if
105
106
ObjectTileCollision(CSIDE_FLOOR, 0, 24, 0)
107
if CheckResult == true
108
Object.State = ICEBLOCK_BREAKICE
109
Object.YVelocity = 0
110
PlayStageSfx(SFX_S_GLASSSMASH, false)
111
end if
112
113
#platform: Use_Origins
114
if CheckResult == false
115
ObjectTileCollision(CSIDE_FLOOR, 0, 22, 0)
116
if CheckResult == true
117
Object.State = ICEBLOCK_BREAKICE
118
Object.YVelocity = 0
119
PlayStageSfx(SFX_S_GLASSSMASH, 0)
120
end if
121
end if
122
#endplatform
123
Player.XPos = Object.XPos
124
Player.YPos = Object.YPos
125
else
126
if Object.Timer < 16
127
Object.Timer++
128
if Object[0].Type == TypeName[PlayerObject]
129
if Player.JumpPress == true
130
CallFunction(IceBlock_CreateIceChunks)
131
Object.Type = TypeName[Blank Object]
132
133
CallFunction(Player_Action_Jump)
134
135
Player.Visible = true
136
Player.ObjectInteraction = true
137
end if
138
end if
139
else
140
CallFunction(IceBlock_CreateIceChunks)
141
Object.Type = TypeName[Blank Object]
142
143
#platform: Use_Origins
144
Player.State = Player_State_Air_NoDropDash
145
#endplatform
146
147
#platform: Use_Standalone
148
Player.State = Player_State_Air
149
#endplatform
150
CallFunction(Player_Hit)
151
152
Player.Visible = true
153
Player.ObjectInteraction = true
154
end if
155
end if
156
break
157
158
case BIG_CHUNK_ICEBLOCK
159
if Object.Timer < 10
160
Object.Timer++
161
Object.XPos += Object.XVelocity
162
Object.YPos += Object.YVelocity
163
else
164
Object.Type = TypeName[Blank Object]
165
CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
166
Object[TempObjectPos].DrawOrder = 4
167
Object[TempObjectPos].XVelocity = 0
168
Object[TempObjectPos].YVelocity = -0x10000
169
170
CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
171
Object[TempObjectPos].DrawOrder = 4
172
Object[TempObjectPos].XVelocity = -0x10000
173
Object[TempObjectPos].YVelocity = 0
174
175
CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
176
Object[TempObjectPos].DrawOrder = 4
177
Object[TempObjectPos].XVelocity = 0x10000
178
Object[TempObjectPos].YVelocity = 0
179
180
CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
181
Object[TempObjectPos].DrawOrder = 4
182
Object[TempObjectPos].XVelocity = 0
183
Object[TempObjectPos].YVelocity = 0x10000
184
end if
185
break
186
187
case MEDIUM_CHUNK_ICEBLOCK
188
if Object.Timer < 16
189
Object.Timer++
190
Object.XPos += Object.XVelocity
191
Object.YPos += Object.YVelocity
192
else
193
Object.Type = TypeName[Blank Object]
194
CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
195
Object[TempObjectPos].DrawOrder = 4
196
Object[TempObjectPos].XVelocity = 0
197
Object[TempObjectPos].YVelocity = -0x10000
198
199
CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
200
Object[TempObjectPos].DrawOrder = 4
201
Object[TempObjectPos].XVelocity = -0x10000
202
Object[TempObjectPos].YVelocity = 0x10000
203
204
CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)
205
Object[TempObjectPos].DrawOrder = 4
206
Object[TempObjectPos].XVelocity = 0x10000
207
Object[TempObjectPos].YVelocity = 0x10000
208
end if
209
break
210
211
case CENTRAL_CHUNK_ICEBLOCK
212
if Object.Timer < 1
213
Object.Timer++
214
else
215
Object.Type = TypeName[Blank Object]
216
end if
217
break
218
219
case SMALL_CHUNK_ICEBLOCK
220
if Object.Timer < 12
221
Object.Timer++
222
Object.XPos += Object.XVelocity
223
Object.YPos += Object.YVelocity
224
else
225
Object.Type = TypeName[Blank Object]
226
end if
227
break
228
end switch
229
end sub
230
231
232
sub ObjectDraw
233
DrawSpriteFX(Object.PropertyValue, FX_FLIP, Object.XPos, Object.YPos)
234
end sub
235
236
237
sub ObjectStartup
238
// #0 - Character Ice Block
239
// #1 - Ice Chunk (Big)
240
// #2 - Ice Chunk (Medium)
241
// #3 - Ice Chunk (Medium)
242
// #4 - Ice Chunk (Small)
243
244
if Stage.PlayerListPos == PLAYER_SONIC_A
245
LoadSpriteSheet("R6/Objects.gif")
246
SpriteFrame(-24, -24, 48, 48, 34, 18)
247
SpriteFrame(-8, -12, 16, 24, 206, 1)
248
SpriteFrame(-8, -8, 16, 16, 66, 1)
249
SpriteFrame(-8, -8, 16, 16, 66, 1)
250
SpriteFrame(-4, -4, 8, 8, 34, 67)
251
end if
252
253
if Stage.PlayerListPos == PLAYER_TAILS_A
254
LoadSpriteSheet("R6/Objects3.gif")
255
SpriteFrame(-24, -24, 48, 48, 1, 101)
256
SpriteFrame(-8, -12, 16, 24, 50, 86)
257
SpriteFrame(-8, -8, 16, 16, 50, 111)
258
SpriteFrame(-8, -8, 16, 16, 50, 111)
259
SpriteFrame(-4, -4, 8, 8, 50, 128)
260
end if
261
#platform: Use_Origins
262
if Stage.PlayerListPos == PLAYER_KNUCKLES
263
LoadSpriteSheet("R6/Objects4.gif")
264
SpriteFrame(-24, -24, 48, 48, 1, 194)
265
SpriteFrame(-8, -12, 16, 24, 99, 194)
266
SpriteFrame(-8, -8, 16, 16, 99, 219)
267
SpriteFrame(-8, -8, 16, 16, 99, 219)
268
SpriteFrame(-4, -4, 8, 8, 99, 236)
269
end if
270
271
if Stage.PlayerListPos == PLAYER_AMY
272
LoadSpriteSheet("R6/Objects4.gif")
273
SpriteFrame(-24, -24, 48, 48, 50, 194)
274
SpriteFrame(-8, -12, 16, 24, 99, 194)
275
SpriteFrame(-8, -8, 16, 16, 99, 219)
276
SpriteFrame(-8, -8, 16, 16, 99, 219)
277
SpriteFrame(-4, -4, 8, 8, 99, 236)
278
end if
279
#endplatform
280
end sub
281
282
283
// ========================
284
// Editor Subs
285
// ========================
286
287
sub RSDKDraw
288
DrawSprite(0)
289
end sub
290
291
292
sub RSDKLoad
293
LoadSpriteSheet("R6/Objects.gif")
294
295
SpriteFrame(-24, -24, 48, 48, 34, 18) // #0 - Sonic Ice Block
296
297
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
298
end sub
299
300