Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/ElectricArc.txt
1319 views
1
//----------------Sonic CD Electric Arc 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
8
// HUD Alias
9
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
10
11
// States
12
#alias 0 : ELECTRICARC_POWERING
13
#alias 1 : ELECTRICARC_EXTEND_1
14
#alias 2 : ELECTRICARC_EXTEND_2
15
#alias 3 : ELECTRICARC_EXTEND_3
16
#alias 4 : ELECTRICARC_SWAP_TO_TILES
17
18
// Time Periods
19
#alias 2 : TIME_GOOD_FUTURE
20
21
22
sub ObjectMain
23
switch Object.State
24
case ELECTRICARC_POWERING
25
Object.Timer++
26
if Object.Timer == 30
27
Object.Timer = 0
28
Object.State++
29
end if
30
break
31
32
case ELECTRICARC_EXTEND_1
33
case ELECTRICARC_EXTEND_2
34
case ELECTRICARC_EXTEND_3
35
Object.Timer++
36
if Object.Timer == 3
37
Object.Timer = 0
38
Object.State++
39
end if
40
break
41
42
case ELECTRICARC_SWAP_TO_TILES
43
Object.Timer++
44
if Object.Timer == 3
45
Object.Timer = 0
46
Object.Type = TypeName[Blank Object]
47
TempValue1 = Object.XPos
48
TempValue1 >>= 23
49
TempValue1--
50
TempValue2 = Object.YPos
51
TempValue2 >>= 23
52
GetTileLayerEntry(TempValue0, 0, TempValue1, TempValue2)
53
TempValue0 += 3
54
SetTileLayerEntry(TempValue0, 0, TempValue1, TempValue2)
55
TempValue1++
56
GetTileLayerEntry(TempValue0, 0, TempValue1, TempValue2)
57
TempValue0 += 3
58
SetTileLayerEntry(TempValue0, 0, TempValue1, TempValue2)
59
TempValue1++
60
GetTileLayerEntry(TempValue0, 0, TempValue1, TempValue2)
61
TempValue0 += 3
62
SetTileLayerEntry(TempValue0, 0, TempValue1, TempValue2)
63
end if
64
break
65
end switch
66
67
Object.Frame++
68
Object.Frame %= 15
69
end sub
70
71
72
sub ObjectDraw
73
switch Object.State
74
case ELECTRICARC_POWERING
75
TempValue0 = Object.Frame
76
TempValue0 /= 5
77
DrawSprite(TempValue0)
78
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
79
break
80
81
case ELECTRICARC_EXTEND_1
82
TempValue0 = Object.Frame
83
TempValue0 /= 5
84
TempValue0 += 3
85
DrawSprite(TempValue0)
86
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
87
break
88
89
case ELECTRICARC_EXTEND_2
90
TempValue0 = Object.Frame
91
TempValue0 /= 5
92
TempValue0 += 6
93
DrawSprite(TempValue0)
94
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
95
break
96
97
case ELECTRICARC_EXTEND_3
98
TempValue0 = Object.Frame
99
TempValue0 /= 5
100
TempValue0 += 9
101
DrawSprite(TempValue0)
102
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
103
break
104
105
case ELECTRICARC_SWAP_TO_TILES
106
TempValue0 = Object.Frame
107
TempValue0 /= 5
108
TempValue0 += 9
109
DrawSprite(TempValue0)
110
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
111
TempValue0 += 3
112
DrawSprite(TempValue0)
113
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
114
break
115
116
end switch
117
end sub
118
119
120
sub ObjectStartup
121
LoadSpriteSheet("R6/Objects3.gif")
122
123
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
124
SpriteFrame(-176, -8, 16, 16, 1, 1) // #0 - Electric Arc frame 0
125
SpriteFrame(-176, -8, 16, 16, 1, 18) // #1 - Electric Arc frame 1
126
SpriteFrame(-176, -8, 16, 16, 1, 35) // #2 - Electric Arc frame 2
127
128
SpriteFrame(-176, -8, 32, 16, 1, 1) // #3 - Electric Arc frame 0
129
SpriteFrame(-176, -8, 32, 16, 1, 18) // #4 - Electric Arc frame 1
130
SpriteFrame(-176, -8, 32, 16, 1, 35) // #5 - Electric Arc frame 2
131
132
SpriteFrame(-176, -8, 48, 16, 1, 1) // #6 - Electric Arc frame 0
133
SpriteFrame(-176, -8, 48, 16, 1, 18) // #7 - Electric Arc frame 1
134
SpriteFrame(-176, -8, 48, 16, 1, 35) // #8 - Electric Arc frame 2
135
136
SpriteFrame(-176, -8, 64, 16, 1, 1) // #9 - Electric Arc frame 0
137
SpriteFrame(-176, -8, 64, 16, 1, 18) // #10 - Electric Arc frame 1
138
SpriteFrame(-176, -8, 64, 16, 1, 35) // #11 - Electric Arc frame 2
139
140
SpriteFrame(-112, -8, 16, 16, 1, 1) // #12 - Electric Arc frame 0
141
SpriteFrame(-112, -8, 16, 16, 1, 18) // #13 - Electric Arc frame 1
142
SpriteFrame(-112, -8, 16, 16, 1, 35) // #14 - Electric Arc frame 2
143
else
144
SpriteFrame(-176, -8, 16, 16, 1, 150) // #0 - Electric Arc frame 0
145
SpriteFrame(-176, -8, 16, 16, 1, 167) // #1 - Electric Arc frame 1
146
SpriteFrame(-176, -8, 16, 16, 1, 184) // #2 - Electric Arc frame 2
147
148
SpriteFrame(-176, -8, 32, 16, 1, 150) // #3 - Electric Arc frame 3
149
SpriteFrame(-176, -8, 32, 16, 1, 167) // #4 - Electric Arc frame 4
150
SpriteFrame(-176, -8, 32, 16, 1, 184) // #5 - Electric Arc frame 5
151
152
SpriteFrame(-176, -8, 48, 16, 1, 150) // #6 - Electric Arc frame 6
153
SpriteFrame(-176, -8, 48, 16, 1, 167) // #7 - Electric Arc frame 7
154
SpriteFrame(-176, -8, 48, 16, 1, 184) // #8 - Electric Arc frame 8
155
156
SpriteFrame(-176, -8, 64, 16, 1, 150) // #9 - Electric Arc frame 9
157
SpriteFrame(-176, -8, 64, 16, 1, 167) // #10 - Electric Arc frame 10
158
SpriteFrame(-176, -8, 64, 16, 1, 184) // #11 - Electric Arc frame 11
159
160
SpriteFrame(-112, -8, 16, 16, 1, 150) // #12 - Electric Arc frame 12
161
SpriteFrame(-112, -8, 16, 16, 1, 167) // #13 - Electric Arc frame 13
162
SpriteFrame(-112, -8, 16, 16, 1, 184) // #14 - Electric Arc frame 14
163
end if
164
end sub
165
166
167
// ========================
168
// Editor Subs
169
// ========================
170
171
sub RSDKDraw
172
DrawSprite(0)
173
end sub
174
175
176
sub RSDKLoad
177
LoadSpriteSheet("R6/Objects3.gif")
178
CallFunction(EditorHelpers_FindTimePeriod)
179
if CheckResult == TIME_GOOD_FUTURE
180
SpriteFrame(-176, -8, 16, 16, 1, 1) // #0 - Electric Arc frame 0
181
SpriteFrame(-176, -8, 16, 16, 1, 18) // #1 - Electric Arc frame 1
182
SpriteFrame(-176, -8, 16, 16, 1, 35) // #2 - Electric Arc frame 2
183
184
SpriteFrame(-176, -8, 32, 16, 1, 1) // #3 - Electric Arc frame 0
185
SpriteFrame(-176, -8, 32, 16, 1, 18) // #4 - Electric Arc frame 1
186
SpriteFrame(-176, -8, 32, 16, 1, 35) // #5 - Electric Arc frame 2
187
188
SpriteFrame(-176, -8, 48, 16, 1, 1) // #6 - Electric Arc frame 0
189
SpriteFrame(-176, -8, 48, 16, 1, 18) // #7 - Electric Arc frame 1
190
SpriteFrame(-176, -8, 48, 16, 1, 35) // #8 - Electric Arc frame 2
191
192
SpriteFrame(-176, -8, 64, 16, 1, 1) // #9 - Electric Arc frame 0
193
SpriteFrame(-176, -8, 64, 16, 1, 18) // #10 - Electric Arc frame 1
194
SpriteFrame(-176, -8, 64, 16, 1, 35) // #11 - Electric Arc frame 2
195
196
SpriteFrame(-112, -8, 16, 16, 1, 1) // #12 - Electric Arc frame 0
197
SpriteFrame(-112, -8, 16, 16, 1, 18) // #13 - Electric Arc frame 1
198
SpriteFrame(-112, -8, 16, 16, 1, 35) // #14 - Electric Arc frame 2
199
else
200
SpriteFrame(-176, -8, 16, 16, 1, 150) // #0 - Electric Arc frame 0
201
SpriteFrame(-176, -8, 16, 16, 1, 167) // #1 - Electric Arc frame 1
202
SpriteFrame(-176, -8, 16, 16, 1, 184) // #2 - Electric Arc frame 2
203
204
SpriteFrame(-176, -8, 32, 16, 1, 150) // #3 - Electric Arc frame 3
205
SpriteFrame(-176, -8, 32, 16, 1, 167) // #4 - Electric Arc frame 4
206
SpriteFrame(-176, -8, 32, 16, 1, 184) // #5 - Electric Arc frame 5
207
208
SpriteFrame(-176, -8, 48, 16, 1, 150) // #6 - Electric Arc frame 6
209
SpriteFrame(-176, -8, 48, 16, 1, 167) // #7 - Electric Arc frame 7
210
SpriteFrame(-176, -8, 48, 16, 1, 184) // #8 - Electric Arc frame 8
211
212
SpriteFrame(-176, -8, 64, 16, 1, 150) // #9 - Electric Arc frame 9
213
SpriteFrame(-176, -8, 64, 16, 1, 167) // #10 - Electric Arc frame 10
214
SpriteFrame(-176, -8, 64, 16, 1, 184) // #11 - Electric Arc frame 11
215
216
SpriteFrame(-112, -8, 16, 16, 1, 150) // #12 - Electric Arc frame 12
217
SpriteFrame(-112, -8, 16, 16, 1, 167) // #13 - Electric Arc frame 13
218
SpriteFrame(-112, -8, 16, 16, 1, 184) // #14 - Electric Arc frame 14
219
end if
220
221
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
222
end sub
223
224