Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R8/R81ASetup.txt
1319 views
1
//---------------Sonic CD R8 1 A Setup Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.PaletteTimer
7
#alias Object.Value1 : Object.CurrentPalette
8
#alias Object.Value2 : Object.VGearFrame
9
#alias Object.Value3 : Object.HCylinderFrame
10
#alias Object.Value4 : Object.VCylinderFrame
11
#alias Object.Value5 : Object.LightsFrame
12
#alias Object.Value6 : Object.BGSphereTimer
13
#alias Object.Value7 : Object.BGSphereCoolDown
14
15
// Priority
16
#alias 1 : PRIORITY_ACTIVE
17
18
19
sub ObjectMain
20
Object.Rotation++
21
Object.Rotation %= 144
22
23
TempValue0 = Object.VGearFrame
24
TempValue0 %= 7
25
if TempValue0 == 0
26
TempValue0 = Object.VGearFrame
27
TempValue0 /= 7
28
TempValue0 <<= 1
29
TempValue0 += 600
30
Copy16x16Tile(444, TempValue0)
31
TempValue0++
32
Copy16x16Tile(445, TempValue0)
33
end if
34
Object.VGearFrame++
35
Object.VGearFrame %= 28
36
37
TempValue0 = Object.HCylinderFrame
38
TempValue0 &= 3
39
if TempValue0 == 0
40
TempValue0 = Object.HCylinderFrame
41
TempValue0 >>= 2
42
TempValue0 <<= 1
43
TempValue0 += 608
44
Copy16x16Tile(446, TempValue0)
45
TempValue0++
46
Copy16x16Tile(447, TempValue0)
47
end if
48
49
Object.HCylinderFrame++
50
Object.HCylinderFrame &= 15
51
52
TempValue0 = Object.VCylinderFrame
53
TempValue0 %= 5
54
if TempValue0 == 0
55
TempValue0 = Object.VCylinderFrame
56
TempValue0 /= 5
57
TempValue0 <<= 2
58
TempValue0 += 616
59
Copy16x16Tile(448, TempValue0)
60
TempValue0++
61
Copy16x16Tile(449, TempValue0)
62
TempValue0++
63
Copy16x16Tile(450, TempValue0)
64
TempValue0++
65
Copy16x16Tile(451, TempValue0)
66
end if
67
Object.VCylinderFrame++
68
Object.VCylinderFrame %= 20
69
70
TempValue0 = Object.LightsFrame
71
TempValue0 &= 7
72
if TempValue0 == 0
73
TempValue0 = Object.LightsFrame
74
TempValue0 >>= 3
75
TempValue0 += 632
76
Copy16x16Tile(452, TempValue0)
77
end if
78
Object.LightsFrame++
79
Object.LightsFrame %= 56
80
81
if Object.BGSphereTimer == 0
82
switch Object.Frame
83
case 0
84
Object.BGSphereTimer = 44
85
Object.Frame++
86
Copy16x16Tile(440, 484)
87
Copy16x16Tile(441, 485)
88
Copy16x16Tile(442, 486)
89
Copy16x16Tile(443, 487)
90
break
91
case 1
92
Object.BGSphereTimer = 4
93
Object.Frame++
94
Copy16x16Tile(440, 488)
95
Copy16x16Tile(441, 489)
96
Copy16x16Tile(442, 490)
97
Copy16x16Tile(443, 491)
98
break
99
case 2
100
Object.BGSphereTimer = 13
101
Object.Frame++
102
Copy16x16Tile(440, 492)
103
Copy16x16Tile(441, 493)
104
Copy16x16Tile(442, 494)
105
Copy16x16Tile(443, 495)
106
break
107
case 3
108
Object.BGSphereTimer = 4
109
Object.Frame++
110
Copy16x16Tile(440, 496)
111
Copy16x16Tile(441, 497)
112
Copy16x16Tile(442, 498)
113
Copy16x16Tile(443, 499)
114
break
115
case 4
116
Object.BGSphereTimer = 4
117
if Object.BGSphereCoolDown < 4
118
Object.Frame = 1
119
Object.BGSphereCoolDown++
120
else
121
Object.BGSphereCoolDown = 0
122
Object.Frame = 0
123
end if
124
Copy16x16Tile(440, 484)
125
Copy16x16Tile(441, 485)
126
Copy16x16Tile(442, 486)
127
Copy16x16Tile(443, 487)
128
break
129
end switch
130
Object.BGSphereTimer--
131
else
132
Object.BGSphereTimer--
133
end if
134
135
Object.PaletteTimer++
136
if Object.PaletteTimer == 5
137
Object.PaletteTimer = 0
138
if Object.CurrentPalette > 2
139
Object.CurrentPalette = 1
140
else
141
Object.CurrentPalette++
142
end if
143
Object.CurrentPalette %= 3
144
if Object.CurrentPalette == 0
145
switch Object.AnimationTimer
146
case 3
147
Object.CurrentPalette += 3
148
break
149
case 4
150
Object.CurrentPalette += 4
151
break
152
case 5
153
Object.CurrentPalette += 5
154
break
155
end switch
156
Object.AnimationTimer++
157
Object.AnimationTimer %= 6
158
end if
159
end if
160
SetActivePalette(Object.CurrentPalette, 0, Screen.YSize)
161
end sub
162
163
164
sub ObjectStartup
165
Object[19].Type = TypeName[R8 Setup]
166
Object[19].Priority = PRIORITY_ACTIVE
167
168
CopyPalette(0, 1)
169
CopyPalette(0, 2)
170
CopyPalette(0, 3)
171
CopyPalette(0, 4)
172
CopyPalette(0, 5)
173
174
TempValue0 = 0
175
TempValue1 = 0
176
TempValue2 = 32
177
while TempValue0 < 6
178
LoadPalette("R81A_PalCycle.act", TempValue0, 160, TempValue1, TempValue2)
179
TempValue0++
180
TempValue1 += 32
181
TempValue2 += 32
182
loop
183
end sub
184
185
186
// ========================
187
// Editor Subs
188
// ========================
189
190
sub RSDKDraw
191
DrawSprite(0)
192
end sub
193
194
195
sub RSDKLoad
196
LoadSpriteSheet("Global/Display.gif")
197
SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon
198
199
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
200
end sub
201
202