Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/SwingPlat.txt
1319 views
1
//---------------Sonic CD Swing Platform 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
#alias Object.Value1 : Object.XDrawPos
8
#alias Object.Value2 : Object.YDrawPos
9
#alias Object.Value3 : Object.XVelocity
10
#alias Object.Value4 : Object.YVelocity
11
#alias Object.Value5 : Object.SwingAngle
12
13
#alias Object.PropertyValue : Object.ChainLength
14
15
16
sub ObjectMain
17
Object.SwingAngle += 2
18
Object.SwingAngle &= 511
19
20
Sin(Object.Angle, Object.SwingAngle)
21
Object.Angle >>= 2
22
Object.Angle += 128
23
24
TempValue1 = Object.PropertyValue
25
TempValue1++
26
TempValue1 <<= 4
27
28
Cos(Object.XVelocity, Object.Angle)
29
Object.XVelocity *= TempValue1
30
Object.XVelocity <<= 7
31
Object.XVelocity += Object.XPos
32
Object.XVelocity &= 0xFFFF0000 // Truncate the value
33
Object.XVelocity -= Object.XDrawPos
34
35
Sin(Object.YVelocity, Object.Angle)
36
Object.YVelocity *= TempValue1
37
Object.YVelocity <<= 7
38
Object.YVelocity += Object.YPos
39
Object.YVelocity &= 0xFFFF0000 // Truncate the value
40
Object.YVelocity -= Object.YDrawPos
41
end sub
42
43
44
sub ObjectPlayerInteraction
45
TempValue0 = Object.XPos
46
TempValue1 = Object.YPos
47
48
Object.XPos = Object.XDrawPos
49
Object.YPos = Object.YDrawPos
50
51
PlayerObjectCollision(C_PLATFORM, -24, -6, 24, 8)
52
if CheckResult == true
53
Player.XPos += Object.XVelocity
54
Player.YPos += Object.YVelocity
55
end if
56
57
Object.XPos = TempValue0
58
Object.YPos = TempValue1
59
end sub
60
61
62
sub ObjectDraw
63
DrawSprite(0)
64
TempValue0 = 0
65
TempValue1 = 16
66
while TempValue0 < Object.PropertyValue
67
Cos(TempValue2, Object.Angle)
68
TempValue2 *= TempValue1
69
TempValue2 <<= 7
70
TempValue2 += Object.XPos
71
72
Sin(TempValue3, Object.Angle)
73
TempValue3 *= TempValue1
74
TempValue3 <<= 7
75
TempValue3 += Object.YPos
76
77
DrawSpriteXY(1, TempValue2, TempValue3)
78
79
TempValue0++
80
81
TempValue1 += 16
82
loop
83
84
Cos(Object.XDrawPos, Object.Angle)
85
Object.XDrawPos *= TempValue1
86
Object.XDrawPos <<= 7
87
Object.XDrawPos += Object.XPos
88
Object.XDrawPos &= 0xFFFF0000 // Truncate the value
89
90
Sin(Object.YDrawPos, Object.Angle)
91
Object.YDrawPos *= TempValue1
92
Object.YDrawPos <<= 7
93
Object.YDrawPos += Object.YPos
94
Object.YDrawPos &= 0xFFFF0000 // Truncate the value
95
96
DrawSpriteXY(2, Object.XDrawPos, Object.YDrawPos)
97
end sub
98
99
100
sub ObjectStartup
101
LoadSpriteSheet("R1/Objects2.gif")
102
103
SpriteFrame(-8, -8, 16, 16, 173, 230) // #0 - Connection Joint
104
SpriteFrame(-8, -8, 16, 16, 190, 230) // #1 - Chain
105
SpriteFrame(-24, -8, 48, 16, 207, 230) // #2 - Platform
106
end sub
107
108
109
// ========================
110
// Editor Subs
111
// ========================
112
113
sub RSDKDraw
114
Object.Angle = 0
115
116
DrawSprite(0)
117
118
TempValue0 = 0
119
TempValue1 = 16
120
while TempValue0 < Object.PropertyValue
121
Cos(TempValue2, Object.Angle)
122
TempValue2 *= TempValue1
123
TempValue2 <<= 7
124
TempValue2 += Object.XPos
125
126
Sin(TempValue3, Object.Angle)
127
TempValue3 *= TempValue1
128
TempValue3 <<= 7
129
TempValue3 += Object.YPos
130
131
DrawSpriteXY(1, TempValue2, TempValue3)
132
133
TempValue0++
134
135
TempValue1 += 16
136
loop
137
138
Cos(Object.XDrawPos, Object.Angle)
139
Object.XDrawPos *= TempValue1
140
Object.XDrawPos <<= 7
141
Object.XDrawPos += Object.XPos
142
Object.XDrawPos &= 0xFFFF0000 // Truncate the value
143
144
Sin(Object.YDrawPos, Object.Angle)
145
Object.YDrawPos *= TempValue1
146
Object.YDrawPos <<= 7
147
Object.YDrawPos += Object.YPos
148
Object.YDrawPos &= 0xFFFF0000 // Truncate the value
149
150
DrawSpriteXY(2, Object.XDrawPos, Object.YDrawPos)
151
end sub
152
153
154
sub RSDKLoad
155
LoadSpriteSheet("R1/Objects2.gif")
156
157
SpriteFrame(-8, -8, 16, 16, 173, 230) // #0 - Connection Joint
158
SpriteFrame(-8, -8, 16, 16, 190, 230) // #1 - Chain
159
SpriteFrame(-24, -8, 48, 16, 207, 230) // #2 - Platform
160
161
SetVariableAlias(ALIAS_VAR_PROPVAL, "length")
162
end sub
163
164