Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/HPZ/WaterGeyser.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Water Geyser 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.value1 : object.startPos.y
13
private alias object.value2 : object.maxHeight
14
private alias object.value3 : object.eggmanHeight
15
private alias object.value4 : object.parent
16
17
// States
18
private alias 0 : WATERGEYSER_SETUP
19
private alias 1 : WATERGEYSER_RISE
20
private alias 2 : WATERGEYSER_FALL
21
private alias 3 : WATERGEYSER_RISE_BOSS
22
private alias 4 : WATERGEYSER_FALL_BOSS
23
24
// EggmanAliases
25
private alias object.value13 : B08Eggman.flameAnimation
26
27
// Eggman States
28
private alias 10 : HPZEGGMAN_GEYSERHIT
29
private alias 11 : HPZEGGMAN_GEYSERFALL
30
private alias 13 : HPZEGGMAN_EXPLODE
31
32
33
// ========================
34
// Events
35
// ========================
36
37
event ObjectUpdate
38
switch object.state
39
case WATERGEYSER_SETUP
40
object.startPos.y = object.ypos
41
object.maxHeight = object.ypos
42
object.maxHeight -= 0x1000000
43
object.eggmanHeight = object.ypos
44
object.eggmanHeight -= 0x900000
45
if object.propertyValue == 0
46
object.state++
47
else
48
object.parent = 0xFFFFFF
49
object.state = WATERGEYSER_RISE_BOSS
50
end if
51
object.yvel = -0x100000
52
break
53
54
case WATERGEYSER_RISE
55
object.yvel += 0x3800
56
object.ypos += object.yvel
57
58
if object.ypos <= object.maxHeight
59
object.ypos = object.maxHeight
60
object.state++
61
end if
62
break
63
64
case WATERGEYSER_FALL
65
object.yvel += 0x3800
66
if object.yvel > 0
67
object.ypos += object.yvel
68
end if
69
70
if object.ypos >= object.startPos.y
71
object.type = TypeName[Blank Object]
72
end if
73
break
74
75
case WATERGEYSER_RISE_BOSS
76
object.yvel += 0x3800
77
object.ypos += object.yvel
78
79
foreach (TypeName[B08 Eggman], arrayPos0, ACTIVE_ENTITIES)
80
BoxCollisionTest(C_TOUCH, object.entityPos, -14, -18, 14, 18, arrayPos0, -12, -24, 12, 24)
81
if checkResult == true
82
object.maxHeight = object.eggmanHeight
83
object.parent = arrayPos0
84
// Bug Details:
85
// This check is faulty, it allows geysers to hit Eggman during his escape sequence
86
// The check should probably be `< HPZEGGMAN_EXPLODE`, rather than `!=`
87
if object[arrayPos0].state != HPZEGGMAN_EXPLODE
88
object[arrayPos0].state = HPZEGGMAN_GEYSERHIT
89
end if
90
end if
91
next
92
93
if object.ypos <= object.maxHeight
94
object.ypos = object.maxHeight
95
object.state++
96
end if
97
break
98
99
case WATERGEYSER_FALL_BOSS
100
object.yvel += 0x3800
101
102
if object.yvel > 0
103
object.ypos += object.yvel
104
if object.parent != 0xFFFFFF
105
arrayPos0 = object.parent
106
if object[arrayPos0].state != HPZEGGMAN_EXPLODE
107
object[arrayPos0].state = HPZEGGMAN_GEYSERFALL
108
end if
109
object[arrayPos0].yvel = 0
110
B08Eggman[arrayPos0].flameAnimation = 0
111
object.parent = 0xFFFFFF
112
end if
113
else
114
if object.parent != 0xFFFFFF
115
foreach (TypeName[B08 Eggman], arrayPos0, ACTIVE_ENTITIES)
116
BoxCollisionTest(C_TOUCH, object.entityPos, -14, -18, 14, 18, arrayPos0, -12, -24, 12, 24)
117
if checkResult == true
118
object.maxHeight = object.eggmanHeight
119
object.parent = arrayPos0
120
// Bug Details: See above
121
if object[arrayPos0].state != HPZEGGMAN_EXPLODE
122
object[arrayPos0].state = HPZEGGMAN_GEYSERHIT
123
end if
124
end if
125
next
126
end if
127
end if
128
129
if object.ypos >= object.startPos.y
130
object.type = TypeName[Blank Object]
131
end if
132
break
133
134
end switch
135
end event
136
137
138
event ObjectDraw
139
temp0 = object.startPos.y
140
temp0 -= object.ypos
141
temp0 >>= 16
142
EditFrame(0, -14, 0, 28, temp0, 484, 0)
143
144
DrawSprite(0)
145
DrawSprite(1)
146
end event
147
148
149
event ObjectStartup
150
LoadSpriteSheet("HPZ/Objects.gif")
151
SpriteFrame(-14, 0, 28, 256, 484, 256)
152
SpriteFrame(-24, -20, 48, 24, 174, 231)
153
end event
154
155
156
// ========================
157
// Editor Events
158
// ========================
159
160
event RSDKDraw
161
object.maxHeight = object.ypos
162
object.maxHeight -= 0x1000000
163
164
temp0 = object.ypos
165
temp0 -= object.maxHeight
166
temp0 >>= 16
167
EditFrame(0, -14, 0, 28, temp0, 484, 0)
168
169
DrawSprite(0)
170
DrawSprite(1)
171
end event
172
173
174
event RSDKLoad
175
LoadSpriteSheet("HPZ/Objects.gif")
176
SpriteFrame(-14, 0, 28, 256, 484, 256)
177
SpriteFrame(-24, -20, 48, 24, 174, 231)
178
179
// used for the boss, not in the editor
180
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
181
end event
182
183