Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Global/LoseRing.txt
1319 views
1
//----------------Sonic CD Lose Ring Script-------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.XVelocity
7
#alias Object.Value1 : Object.YVelocity
8
#alias Object.Value2 : Object.Timer
9
#alias Object.PropertyValue : Object.CollisionPlane
10
11
// Player Aliases
12
#alias Player.Value0 : Player.Rings
13
14
// Panning
15
#alias 0 : PAN_RIGHT
16
#alias 1 : PAN_LEFT
17
18
// Collision Sides
19
#alias 0 : CSIDE_FLOOR
20
21
// Property Values
22
#alias 0 : DRAWING_PLANE_A
23
#alias 1 : DRAWING_PLANE_B
24
25
// Players
26
#alias 0 : PLAYER_SONIC_A
27
28
// Game Mode Aliases
29
#alias 2 : MODE_TIMEATTACK
30
31
32
sub ObjectMain
33
Object.YVelocity += 0x1800
34
Object.XPos += Object.XVelocity
35
Object.YPos += Object.YVelocity
36
37
if Object.YVelocity >= 0
38
ObjectTileCollision(CSIDE_FLOOR, 0, 8, 0)
39
40
if CheckResult == true
41
TempValue0 = Object.YVelocity
42
TempValue0 >>= 2
43
Object.YVelocity -= TempValue0
44
FlipSign(Object.YVelocity)
45
if Object.YVelocity > -0x10000
46
Object.YVelocity = -0x10000
47
end if
48
end if
49
end if
50
51
Object.Timer++
52
if Object.Timer == 256
53
Object.Type = TypeName[Blank Object]
54
55
Object.XVelocity = 0
56
Object.YVelocity = 0
57
Object.Timer = 0
58
else
59
Object.AnimationTimer += Object.AnimationSpeed
60
if Object.AnimationTimer > 255
61
62
Object.AnimationTimer -= 256
63
Object.Frame++
64
if Object.Frame == 8
65
66
Object.Frame = 0
67
if Object.AnimationSpeed > 16
68
Object.AnimationSpeed -= 16
69
end if
70
end if
71
end if
72
end if
73
end sub
74
75
76
sub ObjectPlayerInteraction
77
if Player.State != Player_State_Hurt
78
if Player.CollisionPlane == Object.CollisionPlane
79
PlayerObjectCollision(C_TOUCH, -8, -8, 8, 8)
80
if CheckResult == true
81
Object.Type = TypeName[Ring Sparkle]
82
if Object.CollisionPlane == DRAWING_PLANE_A
83
Object.DrawOrder = 4
84
else
85
Object.DrawOrder = 2
86
end if
87
88
Object.XVelocity = 0
89
Object.YVelocity = 0
90
91
Object.Timer = 0
92
Object.Frame = 0
93
94
Player.Rings++
95
if Player.Rings > 999
96
Player.Rings = 999
97
end if
98
99
if Player.Rings >= Ring.ExtraLife
100
if Options.GameMode != MODE_TIMEATTACK
101
102
#platform: Use_Origins
103
if game.coinMode == false
104
Player.Lives++
105
else
106
game.callbackParam0 = 1 // Set the amount of coins to add
107
EngineCallback(NOTIFY_ADD_COIN)
108
end if
109
#endplatform
110
111
#platform: Use_Standalone
112
Player.Lives++
113
#endplatform
114
115
Ring.ExtraLife += 100
116
if Ring.ExtraLife > 300
117
Ring.ExtraLife = 1000
118
end if
119
end if
120
121
// King of the Rings Unlock Criteria
122
if Player.Rings >= 200
123
if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins
124
if Stage.DebugMode == false
125
SetAchievement(4, 100)
126
end if
127
end if
128
end if
129
end if
130
131
if Ring.Pan == PAN_RIGHT
132
SetSfxAttributes(1, -1, -100)
133
Ring.Pan = PAN_LEFT
134
else
135
SetSfxAttributes(2, -1, 100)
136
Ring.Pan = PAN_RIGHT
137
end if
138
139
end if
140
end if
141
end if
142
end sub
143
144
145
sub ObjectDraw
146
DrawSprite(Object.Frame)
147
end sub
148
149
150
sub ObjectStartup
151
LoadSpriteSheet("Global/Items.gif")
152
153
SpriteFrame(-8, -8, 16, 16, 1, 1) // #0 - Ring Frame 0
154
SpriteFrame(-8, -8, 16, 16, 1, 18) // #1 - Ring Frame 1
155
SpriteFrame(-8, -8, 16, 16, 1, 35) // #2 - Ring Frame 2
156
SpriteFrame(-8, -8, 16, 16, 1, 52) // #3 - Ring Frame 3
157
SpriteFrame(-8, -8, 16, 16, 1, 69) // #4 - Ring Frame 4
158
SpriteFrame(-8, -8, 16, 16, 1, 86) // #5 - Ring Frame 5
159
SpriteFrame(-8, -8, 16, 16, 1, 103) // #6 - Ring Frame 6
160
SpriteFrame(-8, -8, 16, 16, 1, 120) // #7 - Ring Frame 7
161
end sub
162
163
164
// ========================
165
// Editor Subs
166
// ========================
167
168
sub RSDKDraw
169
DrawSprite(0)
170
end sub
171
172
173
sub RSDKLoad
174
LoadSpriteSheet("Global/Items.gif")
175
SpriteFrame(-8, -8, 16, 16, 1, 1) // #0 - Ring Frame 0
176
177
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
178
end sub
179
180