Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/ElectricWeb.txt
1319 views
1
//---------------Sonic CD Electric Web Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value1 : Object.VWebFrame
7
#alias Object.Value2 : Object.HWebFrame
8
#alias Object.Value3 : Object.DWebFrame
9
10
// R6 Setup Aliases
11
#alias Object[19].Value0 : R6Setup.Timer
12
#alias Object[19].State : R6Setup.State
13
#alias Object[19].Frame : R6Setup.Frame
14
#alias Object[19].Direction : R6Setup.Direction
15
16
// States
17
#alias 0 : R6_SETUP_PREPARE_CHARGE
18
19
// Property Values
20
#alias 0 : WEB_PARENT_OBJECT
21
#alias 1 : WEB_CHILD_OBJECT
22
#alias 2 : WEB_DELAYER
23
24
// Directions
25
#alias 2 : FACING_UPEND_RIGHT
26
27
28
sub ObjectDraw
29
switch Object.PropertyValue
30
case WEB_PARENT_OBJECT
31
DrawSprite(R6Setup.Frame)
32
TempValue0 = Object.XPos
33
TempValue1 = Object.YPos
34
TempValue1 -= 0x800000
35
DrawSpriteXY(R6Setup.Frame, TempValue0, TempValue1)
36
37
TempValue1 += 0x1000000
38
DrawSpriteXY(R6Setup.Frame, TempValue0, TempValue1)
39
40
if R6Setup.State > R6_SETUP_PREPARE_CHARGE
41
switch R6Setup.Direction
42
case 0
43
Object.HWebFrame = 9
44
Object.HWebFrame += R6Setup.Frame
45
DrawSprite(Object.HWebFrame)
46
47
Object.Direction = FACING_UPEND_RIGHT
48
DrawSpriteXY(Object.HWebFrame, Object.XPos, TempValue1)
49
break
50
51
case 1
52
Object.VWebFrame = 18
53
Object.VWebFrame += R6Setup.Frame
54
DrawSprite(Object.VWebFrame)
55
56
Object.Direction = FACING_LEFT
57
TempValue0 += 0x800000
58
DrawSpriteXY(Object.VWebFrame, TempValue0, Object.YPos)
59
break
60
61
case 2
62
TempValue0 += 0x800000
63
64
Object.DWebFrame = 27
65
Object.DWebFrame += R6Setup.Frame
66
Object.Direction = FACING_LEFT
67
68
TempValue2 = Object.XPos
69
TempValue2 -= 0x800000
70
71
DrawSprite(Object.DWebFrame)
72
DrawSpriteFX(Object.DWebFrame, FX_FLIP, Object.XPos, Object.YPos)
73
DrawSpriteXY(Object.DWebFrame, TempValue0, TempValue1)
74
DrawSpriteFX(Object.DWebFrame, FX_FLIP, TempValue2, TempValue1)
75
76
Object.DWebFrame += 9
77
DrawSprite(Object.DWebFrame)
78
DrawSpriteFX(Object.DWebFrame, FX_FLIP, Object.XPos, Object.YPos)
79
DrawSpriteXY(Object.DWebFrame, TempValue0, TempValue1)
80
DrawSpriteFX(Object.DWebFrame, FX_FLIP, TempValue2, TempValue1)
81
82
Object.DWebFrame += 9
83
DrawSprite(Object.DWebFrame)
84
DrawSpriteFX(Object.DWebFrame, FX_FLIP, Object.XPos, Object.YPos)
85
DrawSpriteXY(Object.DWebFrame, TempValue0, TempValue1)
86
DrawSpriteFX(Object.DWebFrame, FX_FLIP, TempValue2, TempValue1)
87
88
Object.DWebFrame += 9
89
DrawSprite(Object.DWebFrame)
90
DrawSpriteFX(Object.DWebFrame, FX_FLIP, Object.XPos, Object.YPos)
91
DrawSpriteXY(Object.DWebFrame, TempValue0, TempValue1)
92
DrawSpriteFX(Object.DWebFrame, FX_FLIP, TempValue2, TempValue1)
93
break
94
end switch
95
end if
96
break
97
98
case WEB_CHILD_OBJECT
99
DrawSprite(R6Setup.Frame)
100
break
101
102
case WEB_DELAYER
103
if R6Setup.State == R6_SETUP_PREPARE_CHARGE
104
R6Setup.Timer = 0
105
end if
106
break
107
end switch
108
end sub
109
110
111
112
sub ObjectStartup
113
LoadSpriteSheet("R6/Objects3.gif")
114
// Web Core Frames
115
SpriteFrame(-24, -24, 48, 48, 73, 34)
116
SpriteFrame(-24, -24, 48, 48, 122, 34)
117
SpriteFrame(-24, -24, 48, 48, 73, 34)
118
SpriteFrame(-24, -24, 48, 48, 73, 83)
119
SpriteFrame(-24, -24, 48, 48, 73, 34)
120
SpriteFrame(-24, -24, 48, 48, 122, 83)
121
SpriteFrame(-24, -24, 48, 48, 73, 34)
122
SpriteFrame(-24, -24, 48, 48, 73, 34)
123
SpriteFrame(-24, -24, 48, 48, 122, 132)
124
125
// Vertical Web Frames
126
SpriteFrame(-8, -104, 16, 80, 171, 119)
127
SpriteFrame(-8, -104, 16, 80, 188, 119)
128
SpriteFrame(-8, -104, 16, 80, 171, 119)
129
SpriteFrame(-8, -104, 16, 80, 205, 119)
130
SpriteFrame(-8, -104, 16, 80, 171, 119)
131
SpriteFrame(-8, -104, 16, 80, 222, 119)
132
SpriteFrame(-8, -104, 16, 80, 171, 119)
133
SpriteFrame(-8, -104, 16, 80, 171, 119)
134
SpriteFrame(-8, -104, 16, 80, 239, 119)
135
136
// Horizontal Web Frames
137
SpriteFrame(-104, -8, 80, 16, 175, 34)
138
SpriteFrame(-104, -8, 80, 16, 175, 51)
139
SpriteFrame(-104, -8, 80, 16, 175, 34)
140
SpriteFrame(-104, -8, 80, 16, 175, 68)
141
SpriteFrame(-104, -8, 80, 16, 175, 34)
142
SpriteFrame(-104, -8, 80, 16, 175, 85)
143
SpriteFrame(-104, -8, 80, 16, 175, 34)
144
SpriteFrame(-104, -8, 80, 16, 175, 34)
145
SpriteFrame(-104, -8, 80, 16, 175, 102)
146
147
// Diagonal Web Frames
148
SpriteFrame(-43, -116, 32, 32, 66, 1)
149
SpriteFrame(-43, -116, 32, 32, 99, 1)
150
SpriteFrame(-43, -116, 32, 32, 66, 1)
151
SpriteFrame(-43, -116, 32, 32, 132, 1)
152
SpriteFrame(-43, -116, 32, 32, 66, 1)
153
SpriteFrame(-43, -116, 32, 32, 165, 1)
154
SpriteFrame(-43, -116, 32, 32, 66, 1)
155
SpriteFrame(-43, -116, 32, 32, 66, 1)
156
SpriteFrame(-43, -116, 32, 32, 198, 1)
157
158
SpriteFrame(-67, -92, 32, 32, 66, 1)
159
SpriteFrame(-67, -92, 32, 32, 99, 1)
160
SpriteFrame(-67, -92, 32, 32, 66, 1)
161
SpriteFrame(-67, -92, 32, 32, 132, 1)
162
SpriteFrame(-67, -92, 32, 32, 66, 1)
163
SpriteFrame(-67, -92, 32, 32, 165, 1)
164
SpriteFrame(-67, -92, 32, 32, 66, 1)
165
SpriteFrame(-67, -92, 32, 32, 66, 1)
166
SpriteFrame(-67, -92, 32, 32, 198, 1)
167
168
SpriteFrame(-91, -68, 32, 32, 66, 1)
169
SpriteFrame(-91, -68, 32, 32, 99, 1)
170
SpriteFrame(-91, -68, 32, 32, 66, 1)
171
SpriteFrame(-91, -68, 32, 32, 132, 1)
172
SpriteFrame(-91, -68, 32, 32, 66, 1)
173
SpriteFrame(-91, -68, 32, 32, 165, 1)
174
SpriteFrame(-91, -68, 32, 32, 66, 1)
175
SpriteFrame(-91, -68, 32, 32, 66, 1)
176
SpriteFrame(-91, -68, 32, 32, 198, 1)
177
178
SpriteFrame(-115, -44, 32, 32, 66, 1)
179
SpriteFrame(-115, -44, 32, 32, 99, 1)
180
SpriteFrame(-115, -44, 32, 32, 66, 1)
181
SpriteFrame(-115, -44, 32, 32, 132, 1)
182
SpriteFrame(-115, -44, 32, 32, 66, 1)
183
SpriteFrame(-115, -44, 32, 32, 165, 1)
184
SpriteFrame(-115, -44, 32, 32, 66, 1)
185
SpriteFrame(-115, -44, 32, 32, 66, 1)
186
SpriteFrame(-115, -44, 32, 32, 198, 1)
187
end sub
188
189
190
// ========================
191
// Editor Subs
192
// ========================
193
194
sub RSDKEdit
195
if Editor.ReturnVariable == true
196
switch Editor.VariableID
197
case EDIT_VAR_PROPVAL // Property Value
198
CheckResult = Object.PropertyValue
199
break
200
case 0 // Type
201
CheckResult = Object.PropertyValue
202
CheckResult %= 3
203
break
204
end switch
205
else
206
switch Editor.VariableID
207
case EDIT_VAR_PROPVAL // Property Value
208
Object.PropertyValue = Editor.VariableValue
209
break
210
case 0 // Type
211
Object.PropertyValue = Editor.VariableValue
212
Object.PropertyValue %= 3
213
break
214
end switch
215
end if
216
end sub
217
218
219
sub RSDKDraw
220
LoadSpriteSheet("R6/Objects3.gif")
221
switch object.PropertyValue
222
case WEB_PARENT_OBJECT
223
DrawSprite(0)
224
TempValue0 = Object.XPos
225
TempValue1 = Object.YPos
226
TempValue1 -= 0x800000
227
DrawSpriteXY(0, TempValue0, TempValue1)
228
229
TempValue1 += 0x1000000
230
DrawSpriteXY(0, TempValue0, TempValue1)
231
DrawSprite(1)
232
Object.Direction = FACING_UPEND_RIGHT
233
DrawSpriteXY(1, Object.XPos, TempValue1)
234
break
235
case WEB_CHILD_OBJECT
236
DrawSprite(0)
237
break
238
case WEB_DELAYER
239
Object.InkEffect = 1
240
DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)
241
RemoveSpriteSheet("R6/Objects3.gif")
242
LoadSpriteSheet("Global/Items.gif")
243
DrawSpriteFX(2, FX_INK, Object.XPos, Object.YPos)
244
break
245
end switch
246
end sub
247
248
249
sub RSDKLoad
250
LoadSpriteSheet("R6/Objects3.gif")
251
// Web Core Frames
252
SpriteFrame(-24, -24, 48, 48, 122, 34)
253
// Web V
254
SpriteFrame(-8, -104, 16, 80, 171, 119)
255
256
LoadSpriteSheet("Global/Items.gif")
257
SpriteFrame(-7, -6, 14, 12, 27, 174)
258
AddEditorVariable("type")
259
SetActiveVariable("type")
260
AddEnumVariable("Parent Object", WEB_PARENT_OBJECT)
261
AddEnumVariable("Child Object", WEB_CHILD_OBJECT)
262
AddEnumVariable("Shock Delayer", WEB_DELAYER)
263
end sub
264
265
266