Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/RotatingSpikes.txt
1319 views
1
//--------------Sonic CD Rotating Spikes 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
9
sub ObjectMain
10
Object.Angle += 2
11
Object.Angle &= 511
12
end sub
13
14
15
sub ObjectPlayerInteraction
16
TempValue0 = 0
17
18
TempValue1 = Object.PropertyValue
19
TempValue1--
20
TempValue1 <<= 4
21
22
TempValue2 = Object.XPos
23
TempValue3 = Object.YPos
24
25
Cos(Object.XPos, Object.Angle)
26
Object.XPos *= TempValue1
27
Object.XPos <<= 7
28
Object.XPos += TempValue2
29
30
Sin(Object.YPos, Object.Angle)
31
Object.YPos *= TempValue1
32
Object.YPos <<= 7
33
Object.YPos += TempValue3
34
35
PlayerObjectCollision(C_TOUCH, -12, -12, 12, 12)
36
if CheckResult == true
37
CallFunction(Player_Hit)
38
end if
39
40
Object.XPos = TempValue2
41
Object.YPos = TempValue3
42
end sub
43
44
45
sub ObjectDraw
46
DrawSprite(0)
47
TempValue0 = 0
48
TempValue1 = 16
49
50
TempValue4 = Object.PropertyValue
51
TempValue4--
52
while TempValue0 < TempValue4
53
Cos(TempValue2, Object.Angle)
54
TempValue2 *= TempValue1
55
TempValue2 <<= 7
56
TempValue2 += Object.XPos
57
58
Sin(TempValue3, Object.Angle)
59
TempValue3 *= TempValue1
60
TempValue3 <<= 7
61
TempValue3 += Object.YPos
62
DrawSpriteXY(1, TempValue2, TempValue3)
63
64
TempValue0++
65
TempValue1 += 16
66
loop
67
68
Cos(TempValue2, Object.Angle)
69
TempValue2 *= TempValue1
70
TempValue2 <<= 7
71
TempValue2 += Object.XPos
72
73
Sin(TempValue3, Object.Angle)
74
TempValue3 *= TempValue1
75
TempValue3 <<= 7
76
TempValue3 += Object.YPos
77
DrawSpriteXY(2, TempValue2, TempValue3)
78
end sub
79
80
81
sub ObjectStartup
82
LoadSpriteSheet("R4/Objects.gif")
83
84
SpriteFrame(-8, -8, 16, 16, 163, 52) // #0 - Spike Joint
85
SpriteFrame(-8, -8, 16, 16, 180, 52) // #1 - Chain
86
SpriteFrame(-16, -16, 32, 32, 221, 53) // #2 - Spike Ball
87
end sub
88
89
90
// ========================
91
// Editor Subs
92
// ========================
93
94
sub RSDKDraw
95
DrawSprite(0)
96
TempValue0 = 0
97
TempValue1 = 16
98
99
TempValue4 = Object.PropertyValue
100
TempValue4--
101
while TempValue0 < TempValue4
102
Cos(TempValue2, Object.Angle)
103
TempValue2 *= TempValue1
104
TempValue2 <<= 7
105
TempValue2 += Object.XPos
106
107
Sin(TempValue3, Object.Angle)
108
TempValue3 *= TempValue1
109
TempValue3 <<= 7
110
TempValue3 += Object.YPos
111
DrawSpriteXY(1, TempValue2, TempValue3)
112
113
TempValue0++
114
TempValue1 += 16
115
loop
116
117
Cos(TempValue2, Object.Angle)
118
TempValue2 *= TempValue1
119
TempValue2 <<= 7
120
TempValue2 += Object.XPos
121
122
Sin(TempValue3, Object.Angle)
123
TempValue3 *= TempValue1
124
TempValue3 <<= 7
125
TempValue3 += Object.YPos
126
DrawSpriteXY(2, TempValue2, TempValue3)
127
end sub
128
129
130
sub RSDKLoad
131
LoadSpriteSheet("R4/Objects.gif")
132
133
SpriteFrame(-8, -8, 16, 16, 163, 52) // #0 - Spike Joint
134
SpriteFrame(-8, -8, 16, 16, 180, 52) // #1 - Chain
135
SpriteFrame(-16, -16, 32, 32, 221, 53) // #2 - Spike Ball
136
137
SetVariableAlias(ALIAS_VAR_PROPVAL, "chainAmount")
138
end sub
139
140