Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/BossBullet.txt
1319 views
1
//----------------Sonic CD Boss Bullet Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
#alias Object.Value1 : Object.XVelocity
8
#alias Object.Value2 : Object.YVelocity
9
#alias Object.Value5 : Object.BossEntity
10
#alias Object.Value7 : Object.Animation
11
12
// R4 Eggman aliases
13
#alias Object.Value7 : Boss.Animation
14
#alias Object.XPos : Boss.XPos
15
#alias Object.YPos : Boss.YPos
16
#alias Object.State : Boss.State
17
18
// States
19
#alias 0 : BOSS_BULLET_SETUP
20
#alias 1 : BOSS_BULLET_CHARGE
21
#alias 2 : BOSS_BULLET_SHOT
22
23
// R4 Eggman states
24
#alias 13 : R4_EGG_BUBBLE_MOVE_TO_L
25
26
// R4 Eggman animations
27
#alias 1 : EGGANI_LAUGH
28
29
30
sub ObjectMain
31
switch Object.State
32
case BOSS_BULLET_SETUP
33
if Object.Timer < 56
34
Object.Timer++
35
else
36
switch Object.PropertyValue
37
case 0
38
Object.XVelocity = -0x14000
39
Object.YVelocity = 0x14000
40
break
41
42
case 1
43
Object.XVelocity = 0
44
Object.YVelocity = 0x1C000
45
break
46
47
case 2
48
Object.XVelocity = 0x10000
49
Object.YVelocity = 0x18000
50
break
51
52
case 3
53
Object.XVelocity = 0x14000
54
Object.YVelocity = 0x14000
55
break
56
57
case 4
58
Object.XVelocity = 0x14000
59
Object.YVelocity = 0x14000
60
break
61
62
case 5
63
Object.XVelocity = 0
64
Object.YVelocity = 0x1C000
65
break
66
67
case 6
68
Object.XVelocity = -0x10000
69
Object.YVelocity = 0x18000
70
break
71
72
case 7
73
Object.XVelocity = -0x14000
74
Object.YVelocity = 0x14000
75
break
76
77
end switch
78
79
Object.Timer = 0
80
Object.State++
81
end if
82
83
ArrayPos0 = Object.BossEntity
84
85
Object.XPos = Boss[ArrayPos0].XPos
86
Object.YPos = Boss[ArrayPos0].YPos
87
88
switch Object.PropertyValue
89
case 0
90
Object.XPos -= 0x1D0000
91
Object.YPos += 0x170000
92
break
93
94
case 1
95
Object.XPos -= 0x60000
96
Object.YPos += 0x200000
97
break
98
99
case 2
100
Object.XPos += 0x110000
101
Object.YPos += 0x1D0000
102
break
103
104
case 3
105
Object.XPos += 0x1D0000
106
Object.YPos += 0x110000
107
break
108
109
case 4
110
Object.XPos += 0x1D0000
111
Object.YPos += 0x170000
112
break
113
114
case 5
115
Object.XPos += 0x60000
116
Object.YPos += 0x200000
117
break
118
119
case 6
120
Object.XPos -= 0x110000
121
Object.YPos += 0x1D0000
122
break
123
124
case 7
125
Object.XPos -= 0x1D0000
126
Object.YPos += 0x110000
127
break
128
129
end switch
130
break
131
132
case BOSS_BULLET_CHARGE
133
Object.XPos += Object.XVelocity
134
Object.YPos += Object.YVelocity
135
if Object.Timer < 60
136
Object.Timer++
137
else
138
Object.Timer = 0
139
Object.DrawOrder = 3
140
Object.State++
141
end if
142
break
143
144
case BOSS_BULLET_SHOT
145
Object.XPos += Object.XVelocity
146
Object.YPos += Object.YVelocity
147
break
148
149
end switch
150
151
if Object.OutOfBounds == true
152
Object.Type = TypeName[Blank Object]
153
end if
154
155
ArrayPos0 = Object.BossEntity
156
if Boss[ArrayPos0].State > R4_EGG_BUBBLE_MOVE_TO_L
157
Object.Type = TypeName[Blank Object]
158
end if
159
end sub
160
161
162
sub ObjectPlayerInteraction
163
if Object.State > BOSS_BULLET_SETUP
164
PlayerObjectCollision(C_TOUCH, -4, -4, 4, 4)
165
if CheckResult == true
166
CallFunction(Player_Hit)
167
if Player.State == Player_State_GotHit
168
ArrayPos0 = Object.BossEntity
169
Boss[ArrayPos0].Animation = EGGANI_LAUGH
170
end if
171
end if
172
end if
173
end sub
174
175
176
sub ObjectDraw
177
TempValue0 = Object.Frame
178
TempValue0 >>= 1
179
DrawSprite(TempValue0)
180
181
Object.Frame++
182
Object.Frame &= 3
183
end sub
184
185
186
sub ObjectStartup
187
LoadSpriteSheet("R4/Objects2.gif")
188
189
SpriteFrame(-4, -4, 8, 8, 52, 35) // #0 - Boss Bullet frame 0
190
SpriteFrame(-4, -4, 8, 8, 52, 44) // #1 - Boss Bullet frame 1
191
end sub
192
193
194
// ========================
195
// Editor Subs
196
// ========================
197
198
sub RSDKDraw
199
DrawSprite(0)
200
end sub
201
202
203
sub RSDKLoad
204
LoadSpriteSheet("R4/Objects2.gif")
205
206
SpriteFrame(-4, -4, 8, 8, 52, 35) // #0 - Boss Bullet
207
208
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
209
end sub
210
211