Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R8/R81DSetup.txt
1319 views
1
//---------------Sonic CD R8 1 D 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
13
// Priority
14
#alias 1 : PRIORITY_ACTIVE
15
16
17
sub ObjectMain
18
Object.Rotation++
19
Object.Rotation %= 144
20
21
TempValue0 = Object.VGearFrame
22
TempValue0 %= 7
23
if TempValue0 == 0
24
TempValue0 = Object.VGearFrame
25
TempValue0 /= 7
26
TempValue0 <<= 1
27
TempValue0 += 600
28
Copy16x16Tile(444, TempValue0)
29
TempValue0++
30
Copy16x16Tile(445, TempValue0)
31
end if
32
Object.VGearFrame++
33
Object.VGearFrame %= 28
34
35
TempValue0 = Object.HCylinderFrame
36
TempValue0 &= 3
37
if TempValue0 == 0
38
TempValue0 = Object.HCylinderFrame
39
TempValue0 >>= 2
40
TempValue0 <<= 1
41
TempValue0 += 608
42
Copy16x16Tile(446, TempValue0)
43
TempValue0++
44
Copy16x16Tile(447, TempValue0)
45
end if
46
Object.HCylinderFrame++
47
Object.HCylinderFrame &= 15
48
49
TempValue0 = Object.VCylinderFrame
50
TempValue0 %= 5
51
if TempValue0 == 0
52
TempValue0 = Object.VCylinderFrame
53
TempValue0 /= 5
54
TempValue0 <<= 2
55
TempValue0 += 616
56
Copy16x16Tile(448, TempValue0)
57
TempValue0++
58
Copy16x16Tile(449, TempValue0)
59
TempValue0++
60
Copy16x16Tile(450, TempValue0)
61
TempValue0++
62
Copy16x16Tile(451, TempValue0)
63
end if
64
Object.VCylinderFrame++
65
Object.VCylinderFrame %= 20
66
67
TempValue0 = Object.LightsFrame
68
TempValue0 &= 7
69
if TempValue0 == 0
70
TempValue0 = Object.LightsFrame
71
TempValue0 >>= 3
72
TempValue0 += 632
73
Copy16x16Tile(452, TempValue0)
74
end if
75
Object.LightsFrame++
76
Object.LightsFrame %= 56
77
78
Object.PaletteTimer++
79
if Object.PaletteTimer == 5
80
Object.PaletteTimer = 0
81
if Object.CurrentPalette > 2
82
Object.CurrentPalette = 1
83
else
84
Object.CurrentPalette++
85
end if
86
Object.CurrentPalette %= 3
87
if Object.CurrentPalette == 0
88
switch Object.AnimationTimer
89
case 3
90
Object.CurrentPalette += 3
91
break
92
case 4
93
Object.CurrentPalette += 4
94
break
95
case 5
96
Object.CurrentPalette += 5
97
break
98
end switch
99
Object.AnimationTimer++
100
Object.AnimationTimer %= 6
101
end if
102
end if
103
SetActivePalette(Object.CurrentPalette, 0, Screen.YSize)
104
end sub
105
106
107
sub ObjectStartup
108
Object[19].Type = TypeName[R8 Setup]
109
Object[19].Priority = PRIORITY_ACTIVE
110
111
CopyPalette(0, 1)
112
CopyPalette(0, 2)
113
CopyPalette(0, 3)
114
CopyPalette(0, 4)
115
CopyPalette(0, 5)
116
117
TempValue0 = 0
118
TempValue1 = 0
119
TempValue2 = 32
120
while TempValue0 < 6
121
LoadPalette("R81D_PalCycle.act", TempValue0, 160, TempValue1, TempValue2)
122
TempValue0++
123
TempValue1 += 32
124
TempValue2 += 32
125
loop
126
end sub
127
128
129
// ========================
130
// Editor Subs
131
// ========================
132
133
sub RSDKDraw
134
DrawSprite(0)
135
end sub
136
137
138
sub RSDKLoad
139
LoadSpriteSheet("Global/Display.gif")
140
SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon
141
142
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
143
end sub
144
145