Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/Amy.txt
1319 views
1
//-----------------Sonic CD Amy Rose Script-------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.FrameTimer
7
#alias Object.Value1 : Object.XVelocity
8
#alias Object.Value2 : Object.YVelocity
9
#alias Object.Value3 : Object.LeftLimit
10
#alias Object.Value4 : Object.RightLimit
11
#alias Object.Value5 : Object.Gravity
12
#alias Object.Value7 : Object.HeartTimer
13
14
// Metal Sonic Aliases
15
#alias Object[+1].Value0 : Metal.Timer
16
#alias Object[+1].State : Metal.State
17
#alias Object[+1].Priority : Metal.Priority
18
19
// States
20
#alias 0 : AMY_IDLE
21
#alias 1 : AMY_CHASE
22
#alias 2 : AMY_AWAIT_RIGHT
23
#alias 3 : AMY_AWAIT_LEFT
24
#alias 4 : AMY_KIDNAP // Set by MetalSonic
25
26
// Metal Sonic States
27
#alias 0 : METALSONIC_WAIT
28
#alias 1 : METALSONIC_APPROACH
29
30
// Gravity
31
#alias 0 : GRAVITY_GROUND
32
#alias 1 : GRAVITY_AIR
33
34
// Players
35
#alias 0 : PLAYER_SONIC_A
36
37
// Collision Sides
38
#alias 0 : CSIDE_FLOOR
39
40
// Ink
41
#alias 2 : INK_ALPHA
42
43
// Game Mode Aliases
44
#alias 2 : MODE_TIMEATTACK
45
46
// Priority
47
#alias 1 : PRIORITY_ACTIVE
48
49
50
sub ObjectMain
51
Object.Priority = PRIORITY_ACTIVE
52
if Player.XPos < Object.XPos
53
Object.Direction = FACING_LEFT
54
else
55
Object.Direction = FACING_RIGHT
56
end if
57
58
switch Object.State
59
case AMY_IDLE
60
TempValue0 = Object.FrameTimer
61
TempValue0 /= 10
62
TempValue0 += 11
63
Object.Frame = TempValue0
64
65
Object.FrameTimer++
66
if Object.FrameTimer > 139
67
Object.FrameTimer = 0
68
end if
69
70
PlayerObjectCollision(C_TOUCH, -96, -360, 96, 360)
71
if CheckResult == true
72
Object.XVelocity = 0
73
Object.State = AMY_CHASE
74
Object.Frame = 4
75
Object.FrameTimer = 0
76
end if
77
break
78
79
case AMY_CHASE
80
Object.FrameTimer++
81
switch Object.Frame
82
case 4
83
case 6
84
if Object.FrameTimer == 4
85
Object.FrameTimer = 0
86
Object.Frame++
87
end if
88
break
89
90
case 5
91
case 7
92
if Object.FrameTimer == 3
93
Object.FrameTimer = 0
94
Object.Frame++
95
end if
96
break
97
98
end switch
99
100
if Object.Frame > 7
101
Object.Frame = 4
102
end if
103
104
if Object.Direction == FACING_RIGHT
105
if Object.XVelocity < 0x20000
106
Object.XVelocity += 0x2000
107
end if
108
109
if Object.XPos < Object.RightLimit
110
Object.XPos += Object.XVelocity
111
else
112
Object.XVelocity = 0
113
Object.XPos = Object.RightLimit
114
Object.State = AMY_AWAIT_RIGHT
115
Object.Frame = 0
116
Object.FrameTimer = 0
117
end if
118
else
119
if Object.XVelocity > -0x20000
120
Object.XVelocity -= 0x2000
121
end if
122
123
if Object.XPos > Object.LeftLimit
124
Object.XPos += Object.XVelocity
125
else
126
Object.XVelocity = 0
127
Object.XPos = Object.LeftLimit
128
Object.State = AMY_AWAIT_LEFT
129
Object.Frame = 0
130
Object.FrameTimer = 0
131
end if
132
end if
133
break
134
135
case AMY_AWAIT_RIGHT
136
Object.FrameTimer++
137
if Object.FrameTimer == 12
138
Object.FrameTimer = 0
139
Object.Frame++
140
end if
141
142
if Object.Frame > 3
143
Object.Frame = 0
144
end if
145
146
if Metal.State == METALSONIC_WAIT
147
if Metal.Timer < 60
148
Metal.Timer++
149
else
150
Metal.Timer = 0
151
Metal.State = METALSONIC_APPROACH
152
Metal.Priority = PRIORITY_ACTIVE
153
end if
154
end if
155
break
156
157
case AMY_AWAIT_LEFT
158
Object.FrameTimer++
159
if Object.FrameTimer == 12
160
Object.FrameTimer = 0
161
Object.Frame++
162
end if
163
164
if Object.Frame > 3
165
Object.Frame = 0
166
end if
167
168
if Object.Direction == FACING_RIGHT
169
Object.State = AMY_CHASE
170
Object.Frame = 4
171
Object.FrameTimer = 0
172
end if
173
break
174
175
case AMY_KIDNAP
176
Object.FrameTimer++
177
if Object.FrameTimer > 13
178
Object.FrameTimer = 0
179
Object.Frame++
180
if Object.Frame > 9
181
Object.Frame = 8
182
end if
183
end if
184
break
185
186
end switch
187
188
Object.HeartTimer++
189
if Object.State < 4
190
if Object.HeartTimer > 41
191
CreateTempObject(TypeName[Love Heart], 0, Object.XPos, Object.YPos)
192
Object[TempObjectPos].iYPos -= 6
193
Object[TempObjectPos].InkEffect = INK_ALPHA
194
Object[TempObjectPos].Alpha = 255
195
Object.HeartTimer = 0
196
end if
197
198
end if
199
200
if Object.Gravity == GRAVITY_GROUND
201
ObjectTileGrip(CSIDE_FLOOR, 0, 19, 0)
202
else
203
Object.YVelocity += 0x4000
204
Object.YPos += Object.YVelocity
205
ObjectTileCollision(CSIDE_FLOOR, 0, 19, 0)
206
if CheckResult == true
207
Object.YVelocity = 0
208
Object.Gravity = GRAVITY_GROUND
209
end if
210
211
end if
212
end sub
213
214
215
sub ObjectDraw
216
DrawSpriteFX(Object.Frame, FX_FLIP, Object.XPos, Object.YPos)
217
end sub
218
219
220
sub ObjectStartup
221
LoadSpriteSheet("R3/Objects3.gif")
222
223
// Idle
224
SpriteFrame(-11, -20, 22, 40, 34, 208) // #0 - Amy Idle Frame 0
225
SpriteFrame(-11, -20, 22, 40, 57, 208) // #1 - Amy Idle Frame 1
226
SpriteFrame(-11, -20, 22, 40, 34, 208) // #2 - Amy Idle Frame 2
227
SpriteFrame(-11, -20, 22, 40, 126, 167) // #3 - Amy Idle Frame 3
228
229
// Walking
230
SpriteFrame(-15, -20, 30, 40, 68, 167) // #4 - Amy Walking Frame 0
231
SpriteFrame(-10, -20, 21, 40, 206, 208) // #5 - Amy Walking Frame 1
232
SpriteFrame(-13, -20, 26, 40, 99, 167) // #6 - Amy Walking Frame 2
233
SpriteFrame(-10, -20, 21, 40, 206, 208) // #7 - Amy Walking Frame 3
234
235
// Kidnapped
236
SpriteFrame(0, -16, 24, 40, 1, 170) // #8 - Amy Kidnap Frame 0
237
SpriteFrame(0, -16, 24, 40, 1, 211) // #9 - Amy Kidnap Frame 1
238
239
// Jumping
240
SpriteFrame(-12, -20, 24, 40, 107, 208) // #10 - Amy Jumping Frame 1
241
242
// Looking for Sonic
243
// Amy Looking Frame "0"
244
SpriteFrame(-12, -20, 22, 40, 158, 208) // #11
245
SpriteFrame(-12, -20, 22, 40, 158, 208) // #12
246
SpriteFrame(-12, -20, 22, 40, 158, 208) // #13
247
SpriteFrame(-12, -20, 22, 40, 158, 208) // #14
248
SpriteFrame(-12, -20, 22, 40, 158, 208) // #15
249
250
// Amy Looking Frame "1"
251
SpriteFrame(-14, -20, 25, 40, 132, 208) // #16
252
SpriteFrame(-14, -20, 25, 40, 132, 208) // #17
253
SpriteFrame(-14, -20, 25, 40, 132, 208) // #18
254
255
// Amy Looking Frame "2"
256
SpriteFrame(-12, -20, 22, 40, 158, 208) // #19
257
SpriteFrame(-12, -20, 22, 40, 158, 208) // #20
258
SpriteFrame(-12, -20, 22, 40, 158, 208) // #21
259
260
// Amy Looking Frame "3"
261
SpriteFrame(-14, -20, 25, 40, 132, 208) // #22
262
SpriteFrame(-14, -20, 25, 40, 132, 208) // #23
263
SpriteFrame(-14, -20, 25, 40, 132, 208) // #24
264
265
// Used to be below LoadSpriteSheet, moved here for consistency
266
ArrayPos0 = 32
267
while ArrayPos0 < 1056
268
269
if Object[ArrayPos0].Type == TypeName[Amy Rose]
270
271
if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC on origins
272
273
if Options.GameMode == MODE_TIMEATTACK
274
Object[ArrayPos0].Type = TypeName[Blank Object]
275
ArrayPos0++
276
Object[ArrayPos0].Type = TypeName[Blank Object]
277
ArrayPos0++
278
Object[ArrayPos0].Type = TypeName[Blank Object]
279
ArrayPos0++
280
Object[ArrayPos0].Type = TypeName[Blank Object]
281
ArrayPos0++
282
Object[ArrayPos0].Type = TypeName[Blank Object]
283
else
284
Object[ArrayPos0].State = AMY_AWAIT_LEFT
285
Object[ArrayPos0].LeftLimit = 0x780000
286
Object[ArrayPos0].RightLimit = 0x3BC0000
287
Object[ArrayPos0].DrawOrder = 4
288
end if
289
290
else
291
// Remove Amy
292
Object[ArrayPos0].Type = TypeName[Blank Object]
293
ArrayPos0++
294
// Remove Metal
295
Object[ArrayPos0].Type = TypeName[Blank Object]
296
ArrayPos0++
297
// Remove Spikes
298
Object[ArrayPos0].Type = TypeName[Blank Object]
299
ArrayPos0++
300
Object[ArrayPos0].Type = TypeName[Blank Object]
301
ArrayPos0++
302
Object[ArrayPos0].Type = TypeName[Blank Object]
303
end if
304
305
end if
306
ArrayPos0++
307
loop
308
end sub
309
310
311
// ========================
312
// Editor Subs
313
// ========================
314
315
sub RSDKDraw
316
Object.Direction = FACING_LEFT
317
DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)
318
end sub
319
320
321
sub RSDKLoad
322
LoadSpriteSheet("R3/Objects3.gif")
323
324
// Idle
325
SpriteFrame(-11, -20, 22, 40, 34, 208) // #0 - Amy Idle Frame 0
326
327
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
328
end sub
329
330