Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Mission/Boss_Arm2.txt
1319 views
1
//----------------Sonic CD Boss Arm 2 Script------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
//---------Used on Mission "M099 - Eggman: Speed Up"----------//
5
6
// Aliases
7
#alias Object.Value0 : Object.ArmJointEntity
8
#alias Object.Value2 : Object.XOffSet
9
#alias Object.Value3 : Object.Timer
10
#alias Object.Value4 : Object.Charging
11
#alias Object.Value5 : Object.YOffSet
12
#alias Object.Value6 : Object.XVelocity
13
#alias Object.Value7 : Object.YVelocity
14
15
// Arm Joint Aliases
16
#alias Object.Xpos : ArmJoint.XPos
17
#alias Object.YPos : ArmJoint.YPos
18
19
// States
20
#alias 0 : BOSSARM2_SETUP
21
#alias 1 : BOSSARM2_IDLE
22
#alias 2 : BOSSARM2_DESTROYED
23
#alias 3 : BOSSARM2_MOVE_TO_FRONT
24
#alias 4 : BOSSARM2_MOVE_TO_BACK
25
#alias 5 : BOSSARM2_START_CHARGE
26
27
// Global SFX
28
#alias 22 : SFX_G_EXPLOSION
29
30
// Priority
31
#alias 0 : PRIORITY_BOUNDS
32
33
34
// Function declarations
35
#function BossArm2_HandleArmMovement
36
37
38
function BossArm2_HandleArmMovement
39
ArrayPos0 = Object.ArmJointEntity
40
41
Object.XPos = ArmJoint[ArrayPos0].XPos
42
Object.XPos -= 0x240000
43
Object.XPos += Object.XVelocity
44
45
Object.YPos = ArmJoint[ArrayPos0].YPos
46
47
TempValue1 = true
48
GetBit(TempValue0, Object.Charging, 7)
49
50
if TempValue0 == false
51
if Player.YPos < Object.YPos
52
if Object.YVelocity > -0x80000
53
Object.YVelocity -= 0x10000
54
end if
55
TempValue1 = false
56
end if
57
end if
58
59
if TempValue1 == true
60
if Object.YVelocity < 0x80000
61
Object.YVelocity += 0x10000
62
end if
63
end if
64
Object.YPos += Object.YVelocity
65
end function
66
67
68
sub ObjectMain
69
switch Object.State
70
case BOSSARM2_SETUP
71
Object.State=BOSSARM2_IDLE
72
// Fall Through
73
case BOSSARM2_IDLE
74
CallFunction(BossArm2_HandleArmMovement)
75
break
76
77
case BOSSARM2_DESTROYED
78
Object.XOffSet -= 0x620
79
Object.YOffSet += 0x1220
80
81
Object.XPos += Object.XOffSet
82
Object.YPos += Object.YOffSet
83
84
Object.Timer++
85
if Object.Timer == 7
86
Object.Timer = 0
87
CreateTempObject(TypeName[Explosion], 0, Object.XPos, Object.YPos)
88
PlaySfx(SFX_G_EXPLOSION, false)
89
end if
90
91
if Object.OutOfBounds == true
92
Object.Type = TypeName[Blank Object]
93
Object.Priority = PRIORITY_BOUNDS
94
end if
95
break
96
97
case BOSSARM2_MOVE_TO_FRONT
98
if Object.XVelocity > 0
99
TempValue0 = 0x8000
100
TempValue0 *= Object.PropertyValue // Set the XVelocity decrease value based on it's property value
101
TempValue0 /= 10
102
Object.XVelocity -= TempValue0
103
end if
104
CallFunction(BossArm2_HandleArmMovement)
105
break
106
107
case BOSSARM2_MOVE_TO_BACK
108
if Object.XVelocity < 0x100000
109
TempValue0 = 0x8000
110
TempValue0 *= Object.PropertyValue
111
TempValue0 /= 10
112
Object.XVelocity += TempValue0
113
end if
114
CallFunction(BossArm2_HandleArmMovement)
115
break
116
117
case BOSSARM2_START_CHARGE
118
if Object.XVelocity < 0x80000
119
TempValue0 = 0x8000
120
TempValue0 *= Object.PropertyValue // Set the XVelocity increase value based on it's property value
121
TempValue0 /= 10
122
Object.XVelocity += TempValue0
123
else
124
// Set the arm to its retracted frame
125
// -> However, because of an oversight when drawing, this change can't be seen anyway so it's unused
126
Object.Frame = 1
127
end if
128
129
ArrayPos0 = Object.ArmJointEntity
130
131
Object.XPos = ArmJoint[ArrayPos0].XPos
132
Object.XPos -= 0x240000
133
Object.XPos += Object.XVelocity
134
135
if Object.YVelocity < 0x80000
136
TempValue0 = 0x10000
137
TempValue0 *= Object.PropertyValue
138
TempValue0 /= 10
139
Object.YVelocity += TempValue0
140
end if
141
142
Object.YPos = ArmJoint[ArrayPos0].YPos
143
Object.YPos += Object.YVelocity
144
break
145
end switch
146
end sub
147
148
149
sub ObjectDraw
150
DrawSprite(3)
151
152
// This should actually be Object.Frame
153
// Since it isn't, the arm just shows as extended all the time
154
DrawSprite(0)
155
end sub
156
157
158
sub ObjectStartup
159
LoadSpriteSheet("R1/Objects3.gif")
160
161
SpriteFrame(-15, -8, 32, 16, 141, 34) // #0 - Arm Extend
162
SpriteFrame(-6, -8, 24, 16, 174, 34) // #1 - Arm Retract Frame 0 (Unused by code mistake)
163
SpriteFrame(2, -8, 16, 16, 124, 51) // #2 - Arm Retract Frame 1 (Unused)
164
SpriteFrame(9, -8, 24, 16, 141, 51) // #3 - Arm Elbow
165
end sub
166
167
168
// ========================
169
// Editor Subs
170
// ========================
171
172
sub RSDKDraw
173
DrawSprite(1)
174
DrawSprite(0)
175
end sub
176
177
178
sub RSDKLoad
179
LoadSpriteSheet("R1/Objects3.gif")
180
SpriteFrame(-15, -8, 32, 16, 141, 34) // Arm Extend
181
SpriteFrame(9, -8, 24, 16, 141, 51) // Elbow
182
183
184
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
185
end sub
186
187
188
189