Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/RotatingSpikes2.txt
1319 views
1
//-------------Sonic CD Rotating Spikes 2 Script--------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Angle
7
8
// Property Value
9
#alias 0 : CLOCKWISE_ROTATION
10
#alias 128 : COUNTERCLOCKWISE_ROTATION
11
12
sub ObjectMain
13
if Object.PropertyValue < 128
14
Object.Angle += 2
15
Object.Angle &= 511
16
else
17
Object.Angle -= 2
18
if Object.Angle < 0
19
Object.Angle += 512
20
end if
21
end if
22
end sub
23
24
25
sub ObjectPlayerInteraction
26
TempValue0 = Object.XPos
27
TempValue1 = Object.YPos
28
29
TempValue2 = Object.Angle
30
31
TempValue3 = 0
32
33
if Object.PropertyValue < 128
34
while TempValue3 < 4
35
Cos(Object.XPos, TempValue2)
36
Object.XPos <<= 13
37
Object.XPos += TempValue0
38
39
Sin(Object.YPos, TempValue2)
40
Object.YPos <<= 13
41
Object.YPos += TempValue1
42
43
PlayerObjectCollision(C_TOUCH, -12, -12, 12, 12)
44
if CheckResult == true
45
CallFunction(Player_Hit)
46
end if
47
48
TempValue2 += 16
49
TempValue3++
50
loop
51
else
52
TempValue2 += 64
53
while TempValue3 < 4
54
Cos(Object.XPos, TempValue2)
55
Object.XPos <<= 13
56
Object.XPos += TempValue0
57
Sin(Object.YPos, TempValue2)
58
Object.YPos <<= 13
59
Object.YPos += TempValue1
60
PlayerObjectCollision(C_TOUCH, -12, -12, 12, 12)
61
if CheckResult == true
62
CallFunction(Player_Hit)
63
end if
64
TempValue2 -= 16
65
TempValue3++
66
loop
67
end if
68
Object.XPos = TempValue0
69
Object.YPos = TempValue1
70
end sub
71
72
73
sub ObjectDraw
74
TempValue2 = Object.Angle
75
TempValue3 = 0
76
if Object.PropertyValue < 128
77
while TempValue3 < 4
78
Cos(TempValue0, TempValue2)
79
TempValue0 <<= 13
80
TempValue0 += Object.XPos
81
82
Sin(TempValue1, TempValue2)
83
TempValue1 <<= 13
84
TempValue1 += Object.YPos
85
86
DrawSpriteXY(0, TempValue0, TempValue1)
87
TempValue2 += 16
88
TempValue3++
89
loop
90
else
91
TempValue2 += 64
92
while TempValue3 < 4
93
Cos(TempValue0, TempValue2)
94
TempValue0 <<= 13
95
TempValue0 += Object.XPos
96
97
Sin(TempValue1, TempValue2)
98
TempValue1 <<= 13
99
TempValue1 += Object.YPos
100
101
DrawSpriteXY(0, TempValue0, TempValue1)
102
TempValue2 -= 16
103
TempValue3++
104
loop
105
end if
106
end sub
107
108
109
sub ObjectStartup
110
LoadSpriteSheet("R4/Objects.gif")
111
112
SpriteFrame(-16, -16, 32, 32, 221, 53) // #0 - Spike Ball
113
end sub
114
115
116
// ========================
117
// Editor Subs
118
// ========================
119
120
sub RSDKEdit
121
if Editor.ReturnVariable == true
122
switch Editor.VariableID
123
case EDIT_VAR_PROPVAL // Property Value
124
CheckResult = Object.PropertyValue
125
break
126
case 0 // rotatingDir
127
CheckResult = Object.PropertyValue
128
break
129
end switch
130
else
131
switch Editor.VariableID
132
case EDIT_VAR_PROPVAL // Property Value
133
Object.PropertyValue = Editor.VariableValue
134
break
135
case 0 // rotatingDir
136
Object.PropertyValue = Editor.VariableValue
137
break
138
end switch
139
end if
140
end sub
141
142
143
sub RSDKDraw
144
TempValue2 = Object.Angle
145
TempValue3 = 0
146
if Object.PropertyValue < 128
147
while TempValue3 < 4
148
Cos(TempValue0, TempValue2)
149
TempValue0 <<= 13
150
TempValue0 += Object.XPos
151
152
Sin(TempValue1, TempValue2)
153
TempValue1 <<= 13
154
TempValue1 += Object.YPos
155
156
DrawSpriteXY(0, TempValue0, TempValue1)
157
TempValue2 += 16
158
TempValue3++
159
loop
160
else
161
TempValue2 += 64
162
while TempValue3 < 4
163
Cos(TempValue0, TempValue2)
164
TempValue0 <<= 13
165
TempValue0 += Object.XPos
166
167
Sin(TempValue1, TempValue2)
168
TempValue1 <<= 13
169
TempValue1 += Object.YPos
170
171
DrawSpriteXY(0, TempValue0, TempValue1)
172
TempValue2 -= 16
173
TempValue3++
174
loop
175
end if
176
end sub
177
178
179
sub RSDKLoad
180
LoadSpriteSheet("R4/Objects.gif")
181
182
SpriteFrame(-16, -16, 32, 32, 221, 53) // #0 - Spike Ball
183
184
AddEditorVariable("rotationDir")
185
SetActiveVariable("rotationDir")
186
AddEnumVariable("Clockwise", CLOCKWISE_ROTATION)
187
AddEnumVariable("Counter-clockwise", COUNTERCLOCKWISE_ROTATION)
188
end sub
189
190