Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/SpinTop.txt
1319 views
1
//----------------Sonic CD Spinning Top Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Rotation
7
#alias Object.Value1 : Object.OnObject
8
9
// Player Alias
10
#alias Player.Value6 : Player.MinRollSpeed
11
12
// Gravity
13
#alias 0 : GRAVITY_GROUND
14
#alias 1 : GRAVITY_AIR
15
16
// Stage SFX
17
#alias 1 : SFX_S_SHOT
18
19
20
sub ObjectPlayerInteraction
21
PlayerObjectCollision(C_BOX, -16, -8, 16, 24)
22
TempValue1 = Object.Rotation // This doesn't do anything...
23
if CheckResult == true
24
if Player.State != Player_State_SpinningTop
25
Player.Speed = 0
26
Object.OnObject = true
27
Player.MinRollSpeed = 0x1000
28
29
if Player.XPos > Object.XPos
30
Player.Timer = Player.XPos
31
Player.Timer -= Object.XPos
32
33
Object.Rotation = 128
34
else
35
Player.Timer = Object.XPos
36
Player.Timer -= Player.XPos
37
38
Object.Rotation = 384
39
end if
40
41
end if
42
43
if Player.XPos > Object.XPos
44
if Player.Left == true
45
Player.Timer -= 0x1000
46
end if
47
48
if Player.Right == true
49
Player.Timer += 0x1000
50
end if
51
else
52
if Player.Left == true
53
Player.Timer += 0x1000
54
end if
55
56
if Player.Right == true
57
Player.Timer -= 0x1000
58
end if
59
end if
60
61
Player.State = Player_State_SpinningTop
62
63
Player.Animation = ANI_SPINNING_TOP
64
65
Sin(Player.XPos, Object.Rotation)
66
Player.XPos *= Player.Timer
67
Player.XPos >>= 9
68
Player.XPos += Object.XPos
69
70
TempValue0 = Object.Rotation
71
TempValue0 -= 128
72
TempValue0 /= 86
73
Player.Frame = TempValue0
74
75
Object.Rotation += 16
76
if Object.Rotation > 639
77
Object.Rotation -= 512
78
end if
79
80
if Player.JumpPress == true
81
CallFunction(Player_Action_Jump)
82
Player.Speed = Player.XPos
83
Player.Speed -= Object.XPos
84
Player.Speed >>= 2
85
86
#platform: Use_Origins
87
Player.State = Player_State_Air_NoDropDash
88
#endplatform
89
90
#platform: Use_Standalone
91
Player.State = Player_State_Air
92
#endplatform
93
94
Player.Timer = 0
95
PlayStageSfx(SFX_S_SHOT, false)
96
end if
97
else
98
if Object.OnObject == true
99
if Player.State == Player_State_SpinningTop
100
if Player.Gravity == GRAVITY_GROUND
101
Player.State = Player_State_Ground
102
Object.OnObject = false
103
Player.Timer = 0
104
end if
105
end if
106
end if
107
end if
108
end sub
109
110
111
sub ObjectDraw
112
DrawSprite(Object.Frame)
113
114
TempValue0 = Ring.AniCount
115
TempValue0 &= 1
116
117
if TempValue0 == 0
118
Object.Frame++
119
if Object.Frame > 2
120
Object.Frame = 0
121
end if
122
end if
123
end sub
124
125
126
sub ObjectStartup
127
LoadSpriteSheet("R1/Objects.gif")
128
129
SpriteFrame(-16, -8, 32, 16, 101, 76) // #0 - Spin Top Frame 0
130
SpriteFrame(-16, -8, 32, 16, 101, 76) // #1 - Spin Top Frame 1
131
SpriteFrame(-16, -8, 32, 16, 134, 76) // #2 - Spin Top Frame 2
132
end sub
133
134
135
// ========================
136
// Editor Subs
137
// ========================
138
139
sub RSDKDraw
140
DrawSprite(0)
141
end sub
142
143
144
sub RSDKLoad
145
LoadSpriteSheet("R1/Objects.gif")
146
147
SpriteFrame(-16, -8, 32, 16, 101, 76) // #0 - Spin Top Frame 0
148
149
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
150
end sub
151
152