Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/BossBubble1.txt
1319 views
1
//----------------Sonic CD Boss Bubble 1 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.Oscillation
8
#alias Object.Value2 : Object.XOffSet
9
#alias Object.Value3 : Object.YOffSet
10
#alias Object.Value4 : Object.XShift
11
#alias Object.Value5 : Object.BossEntity
12
#alias Object.Value6 : Object.RadiusSize
13
#alias Object.Value7 : Object.Rotation
14
15
// States
16
#alias 0 : BOSSBUBBLE1_SETUP
17
#alias 1 : BOSSBUBBLE1_FLOAT
18
19
// R4 Eggman States
20
#alias 4 : R4_EGG_BUBBLE_EXPAND_SHIELD
21
22
23
sub ObjectMain
24
if Object.State == BOSSBUBBLE1_SETUP
25
if Object.Frame < 4
26
Object.Timer++
27
if Object.Timer > 9
28
if Object.Frame < 3
29
Object.Timer = 0
30
end if
31
Object.Frame++
32
end if
33
end if
34
35
Object.YPos -= 0x18000
36
37
Sin(Object.XPos, Object.Oscillation)
38
Object.XPos <<= Object.XShift
39
Object.XPos += Object.XOffSet
40
41
Object.Oscillation += 4
42
Object.Oscillation &= 511
43
44
if Object.RadiusSize != 0
45
ArrayPos0 = Object.BossEntity
46
47
TempValue0 = Object[ArrayPos0].YPos
48
TempValue0 += Object.RadiusSize
49
50
if Object.YPos < TempValue0
51
TempValue0 = Object.XPos
52
TempValue0 -= Object[ArrayPos0].XPos
53
if TempValue0 < 0
54
FlipSign(TempValue0)
55
end if
56
TempValue0 >>= 19
57
switch TempValue0
58
case 0
59
Object.Rotation = 4
60
break
61
62
case 1
63
Object.Rotation = 5
64
break
65
66
case 2
67
Object.Rotation = 6
68
break
69
70
case 3
71
Object.Rotation = 7
72
break
73
74
case 4
75
case 5
76
case 6
77
Object.Rotation = 8
78
break
79
80
end switch
81
82
Object.State = BOSSBUBBLE1_FLOAT
83
84
Object.Oscillation = 0
85
86
Object.XOffSet = Object.XPos
87
Object.YOffSet = Object.YPos
88
end if
89
90
end if
91
92
if Object.OutOfBounds == true
93
Object.Type = TypeName[Blank Object]
94
end if
95
else
96
ArrayPos0 = Object.BossEntity
97
98
TempValue0 = Object.XOffSet
99
TempValue0 -= Object[ArrayPos0].XPos
100
if TempValue0 < -0x1A0000
101
TempValue0 += 0x10000
102
Object.XOffSet += 0x10000
103
end if
104
if TempValue0 > 0x1A0000
105
TempValue0 -= 0x10000
106
Object.XOffSet -= 0x10000
107
end if
108
TempValue0 >>= 8
109
110
TempValue1 = Object.YOffSet
111
TempValue1 -= Object[ArrayPos0].YPos
112
if TempValue1 < -0x1A0000
113
TempValue1 += 0x10000
114
Object.YOffSet += 0x10000
115
end if
116
if TempValue1 > 0x1A0000
117
TempValue1 -= 0x10000
118
Object.YOffSet -= 0x10000
119
end if
120
TempValue1 >>= 8
121
122
Sin(TempValue2, Object.Oscillation)
123
TempValue2 *= TempValue1
124
125
Cos(TempValue3, Object.Oscillation)
126
TempValue3 *= TempValue0
127
128
Object.XPos = TempValue2
129
Object.XPos += TempValue3
130
Object.XPos >>= 1
131
Object.XPos += Object[ArrayPos0].XPos
132
133
Cos(TempValue2, Object.Oscillation)
134
TempValue2 *= TempValue1
135
136
Sin(TempValue3, Object.Oscillation)
137
TempValue3 *= TempValue0
138
139
Object.YPos = TempValue2
140
Object.YPos -= TempValue3
141
Object.YPos >>= 1
142
Object.YPos += Object[ArrayPos0].YPos
143
144
Object.Oscillation += Object.Rotation
145
Object.Oscillation &= 511
146
147
if Object[ArrayPos0].State == R4_EGG_BUBBLE_EXPAND_SHIELD
148
Object.Type = TypeName[Blank Object]
149
end if
150
end if
151
end sub
152
153
154
sub ObjectDraw
155
DrawSprite(Object.Frame)
156
end sub
157
158
159
sub ObjectStartup
160
LoadSpriteSheet("R4/Objects.gif")
161
162
SpriteFrame(-4, -4, 8, 8, 212, 61) // #0 - Small Bubble 1
163
SpriteFrame(-4, -4, 8, 8, 212, 70) // #1 - Small Bubble 2
164
SpriteFrame(-4, -4, 8, 8, 246, 18) // #2 - Small Bubble 3
165
166
SpriteFrame(-8, -8, 16, 16, 116, 181) // #3 - Medium Bubble 1
167
SpriteFrame(-8, -8, 16, 16, 116, 198) // #4 - Medium Bubble 2
168
end sub
169
170
171
// ========================
172
// Editor Subs
173
// ========================
174
175
sub RSDKDraw
176
DrawSprite(0)
177
end sub
178
179
180
sub RSDKLoad
181
LoadSpriteSheet("R4/Objects.gif")
182
183
SpriteFrame(-4, -4, 8, 8, 212, 61) // #0 - Small Bubble 1
184
185
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
186
end sub
187
188