Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/BossBarrier.txt
1319 views
1
//---------------Sonic CD Boss Barrier Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.BarrierHeight
7
8
// Boss Camera Aliases
9
#alias Object[+1].Priority : BossCamera.Priority
10
#alias Object[+1].Value0 : BossCamera.CameraHeight
11
12
// Eggman Mobile Aliases
13
#alias Object[+7].Priority : EggMobile.Priority
14
#alias Object[+7].State : EggMobile.State
15
16
// Floor Control Aliases
17
#alias Object[+8].Priority : FloorControl.Priority
18
#alias Object[+8].Value6 : FloorControl.CurrentFloor
19
20
// States
21
#alias 0 : BOSSBARRIER_IDLE
22
#alias 1 : BOSSBARRIER_SETUP_BOSS
23
#alias 2 : BOSSBARRIER_CLOSE_DOOR
24
#alias 3 : BOSSBARRIER_CLOSED
25
26
// Eggman Mobile States
27
#alias 1 : R6_EGG_START
28
29
// Fade Music Property Values
30
#alias 0 : FADEMUSIC_TO_BOSS
31
32
// Priority
33
#alias 1 : PRIORITY_ACTIVE
34
35
36
sub ObjectMain
37
switch Object.State
38
case BOSSBARRIER_IDLE
39
TempValue0 = Player.XPos
40
TempValue0 -= Object.XPos
41
if TempValue0 > 0x600000
42
Object.State = BOSSBARRIER_SETUP_BOSS
43
end if
44
break
45
46
case BOSSBARRIER_SETUP_BOSS
47
if Object.BarrierHeight < 0x400000
48
Object.BarrierHeight += 0x20000
49
Object.YPos += 0x20000
50
end if
51
52
TempValue0 = Player.XPos
53
TempValue0 -= Object.XPos
54
if TempValue0 > 0x800000
55
Object.State = BOSSBARRIER_CLOSE_DOOR
56
57
CreateTempObject(TypeName[Fade Music], FADEMUSIC_TO_BOSS, Object.XPos, Object.YPos)
58
Stage.NewXBoundary1 = Object.iXPos
59
Stage.NewXBoundary1 -= 16
60
61
Stage.NewXBoundary2 = Stage.NewXBoundary1
62
Stage.NewXBoundary2 += 448
63
64
Object[+1].Type = TypeName[Boss Camera]
65
BossCamera.Priority = PRIORITY_ACTIVE
66
BossCamera.CameraHeight = -1
67
68
EggMobile.State = R6_EGG_START
69
EggMobile.Priority = PRIORITY_ACTIVE
70
71
Object[+8].Type = TypeName[Floor Control]
72
FloorControl.Priority = PRIORITY_ACTIVE
73
FloorControl.CurrentFloor = -1
74
end if
75
break
76
77
case BOSSBARRIER_CLOSE_DOOR
78
if Object.BarrierHeight < 0x400000
79
Object.BarrierHeight += 0x20000
80
Object.YPos += 0x20000
81
else
82
Object.State = BOSSBARRIER_CLOSED
83
end if
84
break
85
86
end switch
87
end sub
88
89
90
sub ObjectPlayerInteraction
91
if Object.BarrierHeight < 0x400000
92
PlayerObjectCollision(C_BOX, -16, -32, 16, 32)
93
else
94
PlayerObjectCollision(C_BOX, -16, -32, 16, 64)
95
end if
96
end sub
97
98
99
sub ObjectDraw
100
DrawSprite(0)
101
DrawSprite(1)
102
DrawSprite(2)
103
end sub
104
105
106
sub ObjectStartup
107
LoadSpriteSheet("R6/Objects2.gif")
108
109
SpriteFrame(-16, -32, 32, 32, 173, 223) // #0 - Barrier Top
110
SpriteFrame(-16, 0, 32, 32, 173, 223) // #1 - Barrier Bottom
111
SpriteFrame(16, -6, 16, 32, 239, 183) // #2 - Boss Electrode
112
end sub
113
114
115
// ========================
116
// Editor Subs
117
// ========================
118
119
sub RSDKDraw
120
DrawSprite(0)
121
DrawSprite(1)
122
DrawSprite(2)
123
end sub
124
125
126
sub RSDKLoad
127
LoadSpriteSheet("R6/Objects2.gif")
128
129
SpriteFrame(-16, -32, 32, 32, 173, 223) // #0 - Barrier Top
130
SpriteFrame(-16, 0, 32, 32, 173, 223) // #1 - Barrier Bottom
131
SpriteFrame(16, -6, 16, 32, 239, 183) // #2 - Boss Electrode
132
133
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
134
end sub
135
136