Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/Anton.txt
1319 views
1
//-------------------Sonic CD Anton Script--------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// ========================
6
// Aliases
7
// ========================
8
9
#alias Object.PropertyValue : Object.Quality
10
11
#alias Object.Value0 : Object.Timer
12
13
// States
14
#alias 0 : ANTON_MOVING_LEFT
15
#alias 1 : ANTON_MOVING_RIGHT
16
17
// Direction Aliases
18
#alias 0 : FLIP_NONE
19
#alias 1 : FLIP_X
20
21
// Collision Side Aliases
22
#alias 0 : CSIDE_FLOOR
23
24
// Badnik Quality (Property Value) Aliases
25
#alias 0 : QUALITY_GOOD
26
#alias 1 : QUALITY_BAD
27
28
29
// ========================
30
// Events
31
// ========================
32
33
sub ObjectMain
34
if Object.Quality == QUALITY_GOOD
35
Object.Frame += 2
36
37
switch Object.State
38
case ANTON_MOVING_LEFT
39
Object.XPos -= 0x10000
40
41
Object.Timer--
42
if Object.Timer == -128
43
Object.State = ANTON_MOVING_RIGHT
44
Object.Direction = FLIP_X
45
end if
46
47
ObjectTileGrip(CSIDE_FLOOR, 0, 20, 0)
48
if CheckResult == false
49
Object.State = ANTON_MOVING_RIGHT
50
Object.Timer = -128
51
Object.Direction = FLIP_X
52
end if
53
break
54
55
case ANTON_MOVING_RIGHT
56
Object.XPos += 0x10000
57
58
Object.Timer++
59
if Object.Timer == 128
60
Object.State = ANTON_MOVING_LEFT
61
Object.Direction = FLIP_NONE
62
end if
63
64
ObjectTileGrip(CSIDE_FLOOR, 0, 20, 0)
65
if CheckResult == false
66
Object.State = ANTON_MOVING_LEFT
67
Object.Timer = 128
68
Object.Direction = FLIP_NONE
69
end if
70
break
71
72
end switch
73
else
74
Object.Frame++
75
76
switch Object.State
77
case ANTON_MOVING_LEFT
78
Object.XPos -= 0x8000
79
80
Object.Timer--
81
if Object.Timer == -256
82
Object.State = ANTON_MOVING_RIGHT
83
Object.Direction = FLIP_X
84
end if
85
86
ObjectTileGrip(CSIDE_FLOOR, 0, 20, 0)
87
if CheckResult == false
88
Object.State = ANTON_MOVING_RIGHT
89
Object.Timer = -256
90
Object.Direction = FLIP_X
91
end if
92
break
93
94
case ANTON_MOVING_RIGHT
95
Object.XPos += 0x8000
96
97
Object.Timer++
98
if Object.Timer == 256
99
Object.State = ANTON_MOVING_LEFT
100
Object.Direction = FLIP_NONE
101
end if
102
103
ObjectTileGrip(CSIDE_FLOOR, 0, 20, 0)
104
if CheckResult == false
105
Object.State = ANTON_MOVING_LEFT
106
Object.Timer = 256
107
Object.Direction = FLIP_NONE
108
end if
109
break
110
111
end switch
112
113
end if
114
115
Object.Frame &= 15
116
CallFunction(StageSetup_CheckGoodFuture) // Check if it should be a flower
117
end sub
118
119
120
sub ObjectPlayerInteraction
121
#platform: Use_Origins
122
PlayerObjectCollision(C_ENEMY, -12, -18, 12, 20)
123
#endplatform
124
#platform: Use_Standalone
125
PlayerObjectCollision(C_TOUCH, -12, -18, 12, 20)
126
#endplatform
127
if CheckResult == true
128
CallFunction(Player_BadnikBreak)
129
end if
130
end sub
131
132
133
sub ObjectDraw
134
TempValue0 = Object.Frame
135
TempValue0 >>= 3
136
if Object.Quality == QUALITY_GOOD
137
TempValue0 += 4
138
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos) // Wheel
139
TempValue0 -= 4
140
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos) // Anton
141
TempValue0 += 6
142
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos) // Smoke Puff
143
else
144
TempValue0 += 4
145
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos) // Wheel
146
TempValue0 -= 2
147
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos) // Anton
148
TempValue0 += 4
149
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos) // Smoke Puff
150
end if
151
end sub
152
153
154
sub ObjectStartup
155
LoadSpriteSheet("R1/Objects.gif")
156
157
SpriteFrame(-12, -19, 24, 32, 1, 1) // #0 - Anton Frame 0
158
SpriteFrame(-12, -20, 24, 32, 1, 1) // #1 - Anton Frame 1
159
SpriteFrame(-12, -19, 24, 32, 26, 1) // #2 - Old Anton Frame 0
160
SpriteFrame(-12, -20, 24, 32, 26, 1) // #3 - Old Anton Frame 1
161
162
SpriteFrame(-8, 4, 16, 16, 1, 34) // #4 - Anton Wheel Frame 0
163
SpriteFrame(-8, 4, 16, 16, 18, 34) // #5 - Anton Wheel Frame 1
164
165
SpriteFrame(14, -4, 8, 8, 35, 34) // #6 - Anton Smoke Puff Frame 0
166
SpriteFrame(18, -5, 8, 8, 35, 34) // #7 - Anton Smoke Puff Frame 1
167
end sub
168
169
170
// ========================
171
// Editor Subs
172
// ========================
173
174
sub RSDKEdit
175
if Editor.ReturnVariable == true
176
switch Editor.VariableID
177
case EDIT_VAR_PROPVAL // Property Value
178
case 0 // quality
179
GetBit(CheckResult, Object.Quality, 0)
180
break
181
end switch
182
else
183
switch Editor.VariableID
184
case EDIT_VAR_PROPVAL // Property Value
185
case 0 // quality
186
Object.Quality = Editor.VariableValue
187
Object.Quality &= QUALITY_BAD
188
break
189
end switch
190
end if
191
end sub
192
193
194
sub RSDKDraw
195
// Wheel
196
Object.Frame = Object.Quality
197
Object.Frame += 2
198
DrawSprite(Object.Frame)
199
200
// Anton
201
DrawSprite(Object.Quality)
202
end sub
203
204
205
sub RSDKLoad
206
LoadSpriteSheet("R1/Objects.gif")
207
208
SpriteFrame(-12, -19, 24, 32, 1, 1) // #0 - Anton
209
SpriteFrame(-12, -19, 24, 32, 26, 1) // #1 - Old Anton
210
211
SpriteFrame(-8, 4, 16, 16, 1, 34) // #2 - Anton Wheel
212
SpriteFrame(-8, 4, 16, 16, 18, 34) // #3 - Old Anton Wheel
213
214
AddEditorVariable("quality")
215
SetActiveVariable("quality")
216
AddEnumVariable("Good", QUALITY_GOOD)
217
AddEnumVariable("Bad", QUALITY_BAD)
218
end sub
219
220