Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Mission/EggmanSignPost.txt
1319 views
1
//--------------Sonic CD Eggman Sign Post Script--------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
//-------Intended for Mission "M099 - Eggman: Speed Up"-------//
5
6
// Aliases
7
#alias Object.Value0 : Object.Timer
8
#alias Object.Value1 : Object.FrameTimer
9
#alias Object.Value2 : Object.YVelocity
10
#alias Object.Value3 : Object.JetpackEntity
11
12
// States
13
#alias 0 : EGGSIGNPOST_CHECK_JETPACK
14
#alias 1 : EGGSIGNPOST_CHECK_BOSS_LEAVE
15
#alias 2 : EGGSIGNPOST_SET_SPAWN
16
#alias 3 : EGGSIGNPOST_AIR_FLIP
17
#alias 4 : EGGSIGNPOST_FLIP
18
#alias 5 : EGGSIGNPOST_RESET
19
#alias 6 : EGGSIGNPOST_TRIGGER_ACTFINISH
20
#alias 7 : EGGSIGNPOST_STOP_PLAYER
21
22
// Eggman Jetpack States
23
#alias 2 : R1_EGGMAN_ESCAPE
24
25
// Priority
26
#alias 1 : PRIORITY_ACTIVE
27
#alias 3 : PRIORITY_XBOUNDS
28
29
// Collision Sides
30
#alias 0 : CSIDE_FLOOR
31
32
// Control Mode
33
#alias -1 : CONTROLMODE_NONE
34
35
36
sub ObjectMain
37
38
switch Object.State
39
case EGGSIGNPOST_CHECK_JETPACK
40
ArrayPos0 = 32
41
while ArrayPos0 < 1056
42
if Object[ArrayPos0].Type == TypeName[Eggman Jetpack]
43
Object.JetpackEntity = ArrayPos0
44
Object.State = EGGSIGNPOST_CHECK_BOSS_LEAVE
45
46
ArrayPos0 = 2000
47
end if
48
49
ArrayPos0++
50
loop
51
break
52
53
case EGGSIGNPOST_CHECK_BOSS_LEAVE
54
ArrayPos0 = Object.JetpackEntity
55
if Object[ArrayPos0].Type == TypeName[Blank Object]
56
Object.Frame = 1
57
Object.Timer = 16
58
Object.State = EGGSIGNPOST_SET_SPAWN
59
Object.Priority = PRIORITY_XBOUNDS
60
end if
61
break
62
63
case EGGSIGNPOST_SET_SPAWN
64
Object.XPos = Screen.XOffset
65
Object.XPos += Screen.CenterX
66
Object.XPos <<= 16
67
Object.YPos = Screen.YOffset
68
Object.YPos <<= 16
69
Object.State = EGGSIGNPOST_AIR_FLIP
70
break
71
72
case EGGSIGNPOST_AIR_FLIP
73
Object.YPos += Object.YVelocity
74
Object.YVelocity += 0xC00
75
ObjectTileCollision(CSIDE_FLOOR,0,8,0)
76
if CheckResult == true
77
Object.Timer = 4
78
Object.State = EGGSIGNPOST_FLIP
79
end if
80
81
Object.FrameTimer++
82
if Object.FrameTimer == 2
83
Object.FrameTimer = 0
84
Object.Frame++
85
if Object.Frame == 5
86
Rand(TempValue0, 48)
87
TempValue0 <<= 16
88
TempValue0 += Object.XPos
89
TempValue0 -= 0x180000
90
Rand(TempValue1, 32)
91
TempValue1 <<= 16
92
TempValue1 += Object.YPos
93
TempValue1 -= 0x140000
94
CreateTempObject(TypeName[Ring Sparkle], 0, TempValue0, TempValue1)
95
end if
96
97
if Object.Frame == 9
98
Object.Frame = 1
99
Rand(TempValue0, 48)
100
TempValue0 <<= 16
101
TempValue0 += Object.XPos
102
TempValue0 -= 0x180000
103
Rand(TempValue1, 32)
104
TempValue1 <<= 16
105
TempValue1 += Object.YPos
106
TempValue1 -= 0x140000
107
CreateTempObject(TypeName[Ring Sparkle], 0, TempValue0, TempValue1)
108
end if
109
end if
110
break
111
112
case EGGSIGNPOST_FLIP
113
Music.Volume -= 2
114
Object.FrameTimer++
115
if Object.FrameTimer == 2
116
Object.FrameTimer = 0
117
Object.Frame++
118
if Object.Frame == 5
119
Rand(TempValue0, 48)
120
TempValue0 <<= 16
121
TempValue0 += Object.XPos
122
TempValue0 -= 0x180000
123
Rand(TempValue1, 32)
124
TempValue1 <<= 16
125
TempValue1 += Object.YPos
126
TempValue1 -= 0x140000
127
CreateTempObject(TypeName[Ring Sparkle], 0, TempValue0, TempValue1)
128
end if
129
130
if Object.Frame == 9
131
Rand(TempValue0, 48)
132
TempValue0 <<= 16
133
TempValue0 += Object.XPos
134
TempValue0 -= 0x180000
135
Rand(TempValue1, 32)
136
TempValue1 <<= 16
137
TempValue1 += Object.YPos
138
TempValue1 -= 0x140000
139
CreateTempObject(TypeName[Ring Sparkle], 0, TempValue0, TempValue1)
140
Object.Timer--
141
if Object.Timer == 0
142
Object.Frame = 5
143
Object.State = EGGSIGNPOST_RESET
144
else
145
Object.Frame = 1
146
end if
147
end if
148
end if
149
break
150
151
case EGGSIGNPOST_RESET
152
ResetObjectEntity(Object.JetpackEntity,TypeName[Sign Post], 0, Object.XPos, Object.YPos)
153
Object.YVelocity = 1
154
Object.Frame = 1
155
Object.Timer = 16
156
Object.Priority = PRIORITY_XBOUNDS
157
Object.State = EGGSIGNPOST_TRIGGER_ACTFINISH
158
break
159
160
case EGGSIGNPOST_TRIGGER_ACTFINISH
161
if Object[ArrayPos0].State == R1_EGGMAN_ESCAPE
162
PlayMusic(1)
163
Object.State = EGGSIGNPOST_FLIP
164
Object[30].Type = TypeName[ActFinish]
165
Object[30].DrawOrder = 6
166
Object[30].Priority = PRIORITY_ACTIVE
167
Object.State = EGGSIGNPOST_STOP_PLAYER
168
end if
169
break
170
171
case EGGSIGNPOST_STOP_PLAYER
172
CheckEqual(Player.State, Player_State_Ground)
173
TempValue0 = CheckResult
174
CheckEqual(Player.OutOfBounds, true)
175
TempValue0 |= CheckResult
176
177
TempValue1 = Screen.XOffset
178
TempValue1 += Screen.XSize
179
TempValue1 += 32
180
CheckGreater(Player.iXPos, TempValue1)
181
TempValue0 |= CheckResult
182
if TempValue0 == true
183
Player.ControlMode = CONTROLMODE_NONE
184
Player.JumpHold = false
185
Player.Right = false
186
Player.Left = false
187
Player.Up = false
188
Player.Down = false
189
190
if Player.State == Player_State_Ground
191
Player.XVelocity = 0
192
Player.YVelocity = 0
193
end if
194
Player.Speed = 0
195
196
Screen.CameraEnabled = false
197
end if
198
break
199
200
end switch
201
end sub
202
203
204
sub ObjectDraw
205
if Object.State > EGGSIGNPOST_SET_SPAWN
206
if Object.State < EGGSIGNPOST_RESET
207
DrawSprite(0)
208
DrawSprite(Object.Frame)
209
end if
210
end if
211
end sub
212
213
214
sub ObjectStartup
215
216
LoadSpriteSheet("Global/Items2.gif")
217
218
SpriteFrame(-12, -12, 24, 24, 0, 150) // #0 - Sign Post
219
SpriteFrame(-24, -44, 48, 32, 34, 99) // #1 - Sign Post Head (Eggman)
220
SpriteFrame(-16, -44, 32, 32, 1, 183) // #2 - Sign Post Head (Flip 1)
221
SpriteFrame(-4, -44, 8, 32, 25, 150) // #3 - Sign Post Head (Flip 2)
222
SpriteFrame(-16, -44, 32, 32, 1, 216) // #4 - Sign Post Head (Flip 3)
223
SpriteFrame(-24, -44, 48, 32, 34, 132) // #5 - Sign Post Head (Player)
224
SpriteFrame(-16, -44, 32, 32, 1, 183) // #6 - Sign Post Head (Flip 1)
225
SpriteFrame(-4, -44, 8, 32, 25, 150) // #7 - Sign Post Head (Flip 2)
226
SpriteFrame(-16, -44, 32, 32, 1, 216) // #8 - Sign Post Head (Flip 3)
227
228
end sub
229
230
231
// ========================
232
// Editor Subs
233
// ========================
234
235
sub RSDKDraw
236
DrawSprite(0)
237
DrawSprite(1)
238
end sub
239
240
241
sub RSDKLoad
242
243
LoadSpriteSheet("Global/Items2.gif")
244
245
SpriteFrame(-12, -12, 24, 24, 0, 150) // #0 - Sign Post
246
SpriteFrame(-24, -44, 48, 32, 34, 99) // #1 - Sign Post Head (Eggman)
247
248
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
249
end sub
250
251
252
253