Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/SYZ/BossBarrier.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Boss Barrier Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value0 : object.timer
13
private alias object.value1 : object.blockPos1.y
14
private alias object.value2 : object.blockPos2.y
15
private alias object.value3 : object.blockPos3.y
16
private alias object.value4 : object.blockPos4.y
17
private alias object.value5 : object.blockPos5.y
18
private alias object.value6 : object.blockPos6.y
19
private alias object.value7 : object.blockPos7.y
20
21
private alias 0 : BOSSBARRIER_NOTACTIVE
22
private alias 1 : BOSSBARRIER_RISE
23
private alias 2 : BOSSBARRIER_LOWER
24
private alias 3 : BOSSBARRIER_IDLE
25
26
// Player Aliases
27
private alias object.xpos : player.xpos
28
private alias object.ypos : player.ypos
29
30
31
// ========================
32
// Events
33
// ========================
34
35
event ObjectUpdate
36
switch object.state
37
case BOSSBARRIER_NOTACTIVE
38
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
39
BoxCollisionTest(C_SOLID, object.entityPos, -16, -16, 16, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
40
next
41
break
42
43
case BOSSBARRIER_RISE
44
object.frame = object.animationTimer
45
object.frame >>= 2
46
object.animationTimer++
47
object.animationTimer %= 12
48
object.timer++
49
if object.timer == 64
50
object.state = BOSSBARRIER_IDLE
51
end if
52
53
object.blockPos1.y = object.timer
54
object.blockPos1.y *= -0x8000
55
object.blockPos1.y += object.ypos
56
57
object.blockPos2.y = object.timer
58
object.blockPos2.y *= -0x10000
59
object.blockPos2.y += object.ypos
60
61
object.blockPos3.y = object.timer
62
object.blockPos3.y *= -0x18000
63
object.blockPos3.y += object.ypos
64
65
object.blockPos4.y = object.timer
66
object.blockPos4.y *= -0x20000
67
object.blockPos4.y += object.ypos
68
69
object.blockPos5.y = object.timer
70
object.blockPos5.y *= -0x28000
71
object.blockPos5.y += object.ypos
72
73
object.blockPos6.y = object.timer
74
object.blockPos6.y *= -0x30000
75
object.blockPos6.y += object.ypos
76
77
object.blockPos7.y = object.timer
78
object.blockPos7.y *= -0x38000
79
object.blockPos7.y += object.ypos
80
81
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
82
BoxCollisionTest(C_SOLID, object.entityPos, -16, -320, 16, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
83
next
84
break
85
86
case BOSSBARRIER_LOWER
87
object.frame = object.animationTimer
88
object.frame >>= 2
89
object.frame += 3
90
object.animationTimer++
91
object.animationTimer %= 12
92
93
object.timer--
94
if object.timer == 0
95
object.state = BOSSBARRIER_NOTACTIVE
96
end if
97
98
object.blockPos1.y = object.timer
99
object.blockPos1.y *= -0x4000
100
object.blockPos1.y += object.ypos
101
102
object.blockPos2.y = object.timer
103
object.blockPos2.y *= -0x8000
104
object.blockPos2.y += object.ypos
105
106
object.blockPos3.y = object.timer
107
object.blockPos3.y *= -0xC000
108
object.blockPos3.y += object.ypos
109
110
object.blockPos4.y = object.timer
111
object.blockPos4.y *= -0x10000
112
object.blockPos4.y += object.ypos
113
114
object.blockPos5.y = object.timer
115
object.blockPos5.y *= -0x14000
116
object.blockPos5.y += object.ypos
117
118
object.blockPos6.y = object.timer
119
object.blockPos6.y *= -0x18000
120
object.blockPos6.y += object.ypos
121
122
object.blockPos7.y = object.timer
123
object.blockPos7.y *= -0x1C000
124
object.blockPos7.y += object.ypos
125
126
temp0 = object.timer
127
temp0 *= -192
128
temp0 >>= 7
129
temp0 -= 18
130
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
131
BoxCollisionTest(C_SOLID, object.entityPos, -16, temp0, 16, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
132
if checkResult == COL_TOP
133
player[currentPlayer].ypos += 0x20000
134
end if
135
next
136
break
137
138
case BOSSBARRIER_IDLE
139
object.timer = 128
140
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
141
BoxCollisionTest(C_SOLID, object.entityPos, -16, -320, 16, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
142
next
143
break
144
145
end switch
146
end event
147
148
149
event ObjectDraw
150
switch object.state
151
case BOSSBARRIER_NOTACTIVE
152
DrawSprite(0)
153
break
154
155
case BOSSBARRIER_RISE
156
case BOSSBARRIER_LOWER
157
case BOSSBARRIER_IDLE
158
DrawSpriteXY(6, object.xpos, object.blockPos7.y)
159
DrawSpriteXY(6, object.xpos, object.blockPos6.y)
160
DrawSpriteXY(6, object.xpos, object.blockPos5.y)
161
DrawSpriteXY(6, object.xpos, object.blockPos4.y)
162
DrawSpriteXY(6, object.xpos, object.blockPos3.y)
163
DrawSpriteXY(6, object.xpos, object.blockPos2.y)
164
DrawSpriteXY(6, object.xpos, object.blockPos1.y)
165
DrawSprite(object.frame)
166
break
167
168
end switch
169
end event
170
171
172
event ObjectStartup
173
LoadSpriteSheet("SYZ/Objects.gif")
174
SpriteFrame(-16, -16, 32, 32, 110, 223)
175
SpriteFrame(-16, -16, 32, 32, 176, 223)
176
SpriteFrame(-16, -16, 32, 32, 209, 223)
177
SpriteFrame(-16, -16, 32, 32, 209, 223)
178
SpriteFrame(-16, -16, 32, 32, 176, 223)
179
SpriteFrame(-16, -16, 32, 32, 110, 223)
180
SpriteFrame(-16, -16, 32, 32, 110, 190)
181
182
if screen.xsize == 320
183
foreach (TypeName[Boss Barrier], arrayPos0, ALL_ENTITIES)
184
object[arrayPos0].type = TypeName[Boss Block]
185
next
186
end if
187
end event
188
189
190
// ========================
191
// Editor Events
192
// ========================
193
194
event RSDKDraw
195
temp1 = 64
196
temp1 *= -0x8000
197
temp1 += object.ypos
198
199
temp2 = 64
200
temp2 *= -0x10000
201
temp2 += object.ypos
202
203
temp3 = 64
204
temp3 *= -0x18000
205
temp3 += object.ypos
206
207
temp4 = 64
208
temp4 *= -0x20000
209
temp4 += object.ypos
210
211
temp5 = 64
212
temp5 *= -0x28000
213
temp5 += object.ypos
214
215
temp6 = 64
216
temp6 *= -0x30000
217
temp6 += object.ypos
218
219
temp7 = 64
220
temp7 *= -0x38000
221
temp7 += object.ypos
222
223
DrawSpriteXY(1, object.xpos, temp7)
224
DrawSpriteXY(1, object.xpos, temp6)
225
DrawSpriteXY(1, object.xpos, temp5)
226
DrawSpriteXY(1, object.xpos, temp4)
227
DrawSpriteXY(1, object.xpos, temp3)
228
DrawSpriteXY(1, object.xpos, temp2)
229
DrawSpriteXY(1, object.xpos, temp1)
230
DrawSprite(0)
231
end event
232
233
234
event RSDKLoad
235
LoadSpriteSheet("SYZ/Objects.gif")
236
SpriteFrame(-16, -16, 32, 32, 110, 223)
237
SpriteFrame(-16, -16, 32, 32, 110, 190)
238
239
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
240
end event
241
242