Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/Boss_Bumper.txt
1319 views
1
//----------------Sonic CD Boss Bumper Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.ArmEntity
7
#alias Object.Value2 : Object.XOffSet
8
#alias Object.Value5 : Object.YOffSet
9
10
// Arm Aliases
11
#alias Object.Frame : Arm.Frame
12
#alias Object.XPos : Arm.XPos
13
#alias Object.YPos : Arm.YPos
14
15
// States
16
#alias 0 : BOSSBUMPER_SETUP
17
#alias 1 : BOSSBUMPER_IDLE
18
#alias 2 : BOSSBUMPER_DESTROYED
19
20
// Global SFX
21
#alias 11 : SFX_G_SPRING
22
23
// Priority
24
#alias 0 : PRIORITY_BOUNDS
25
26
27
sub ObjectMain
28
switch Object.State
29
case BOSSBUMPER_SETUP
30
Object.State = BOSSBUMPER_IDLE
31
// Fall-Through
32
case BOSSBUMPER_IDLE
33
ArrayPos0 = Object.ArmEntity
34
35
Object.XPos = Arm[ArrayPos0].XPos
36
Object.XPos -= 0x130000
37
Object.YPos = Arm[ArrayPos0].YPos
38
39
if Arm[ArrayPos0].Frame != 0
40
if Arm[ArrayPos0].Frame == 1
41
Object.XPos += 0x80000
42
else
43
Object.XPos += 0x100000
44
end if
45
end if
46
break
47
48
case BOSSBUMPER_DESTROYED
49
Object.XOffSet -= 0x500
50
Object.XPos += Object.XOffSet
51
52
Object.YOffSet += 0x1800
53
Object.YPos += Object.YOffSet
54
55
if Object.OutOfBounds == true
56
Object.Type = TypeName[Blank Object]
57
Object.Priority = PRIORITY_BOUNDS
58
end if
59
break
60
end switch
61
end sub
62
63
64
sub ObjectPlayerInteraction
65
if Object.State < BOSSBUMPER_DESTROYED
66
if Player.Animation != ANI_HURT
67
ArrayPos0 = Object.ArmEntity
68
69
if Arm[ArrayPos0].Frame == 0
70
PlayerObjectCollision(C_TOUCH, -10, -16, 14, 16)
71
if CheckResult == true
72
73
Player.Speed = -0x40000
74
Player.XVelocity = -0x40000
75
76
if Object.Frame == 0
77
PlaySfx(SFX_G_SPRING, false)
78
end if
79
Object.Frame = 2
80
81
#platform: Use_Origins
82
if Stage.PlayerListPos == PLAYER_KNUCKLES
83
if Player.Animation == ANI_GLIDING
84
Player.Animation = ANI_GLIDING_DROP
85
Player.State = Player_State_GlideDrop
86
end if
87
end if
88
#endplatform
89
90
#platform: Use_Haptics
91
HapticEffect(10, 0, 0, 0)
92
#endplatform
93
end if
94
end if
95
end if
96
end if
97
end sub
98
99
100
sub ObjectDraw
101
DrawSprite(Object.Frame)
102
103
if Object.Frame > 0
104
Object.Frame--
105
end if
106
end sub
107
108
109
sub ObjectStartup
110
LoadSpriteSheet("R1/Objects3.gif")
111
112
SpriteFrame(-14, -16, 24, 32, 99, 26) // #0 - EGG-HVC-001 Bumper
113
SpriteFrame(-18, -16, 24, 32, 99, 26) // #1 - EGG-HVC-001 Bumper (different offset)
114
SpriteFrame(-18, -16, 24, 32, 99, 26) // #2 - EGG-HVC-001 Bumper (same offset as frame 1, here to pad out animation length)
115
end sub
116
117
118
// ========================
119
// Editor Subs
120
// ========================
121
122
sub RSDKDraw
123
DrawSprite(0)
124
end sub
125
126
127
sub RSDKLoad
128
LoadSpriteSheet("R1/Objects3.gif")
129
SpriteFrame(-14, -16, 24, 32, 99, 26) // #0 - EGG-HVC-001 Bumper
130
131
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
132
end sub
133
134