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/OOZ/OilFall.txt
1479 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Oil Fall 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.startPos.y
13
private alias object.value1 : object.endPos.y
14
15
16
// ========================
17
// Events
18
// ========================
19
20
event ObjectDraw
21
if object.startPos.y == object.endPos.y
22
DrawSprite(object.frame)
23
else
24
temp0 = object.startPos.y
25
temp0 += 0x100000
26
while temp0 < object.endPos.y
27
DrawSpriteXY(object.frame, object.xpos, temp0)
28
temp0 += 0x200000
29
loop
30
end if
31
end event
32
33
34
event ObjectStartup
35
LoadSpriteSheet("OOZ/Objects.gif")
36
SpriteFrame(-2, -16, 6, 32, 182, 51)
37
SpriteFrame(-2, -16, 6, 32, 182, 148)
38
SpriteFrame(-2, -16, 6, 32, 182, 59)
39
SpriteFrame(-2, -16, 6, 32, 182, 156)
40
SpriteFrame(-8, -16, 16, 32, 189, 75)
41
SpriteFrame(-24, -16, 48, 32, 189, 107)
42
43
foreach (TypeName[Oil Fall], arrayPos0, ALL_ENTITIES)
44
object[arrayPos0].startPos.y = object[arrayPos0].propertyValue
45
object[arrayPos0].startPos.y &= 7
46
object[arrayPos0].startPos.y <<= 20
47
object[arrayPos0].endPos.y = object[arrayPos0].startPos.y
48
FlipSign(object[arrayPos0].startPos.y)
49
object[arrayPos0].startPos.y += object[arrayPos0].ypos
50
object[arrayPos0].endPos.y += object[arrayPos0].ypos
51
52
if object[arrayPos0].propertyValue > 0
53
object[arrayPos0].frame = object[arrayPos0].propertyValue
54
object[arrayPos0].frame >>= 3
55
object[arrayPos0].frame += 2
56
else
57
object[arrayPos0].frame = object[arrayPos0].propertyValue
58
object[arrayPos0].frame >>= 3
59
object[arrayPos0].frame &= 1 // if it's 0... does this really matter?
60
end if
61
62
if object[arrayPos0].frame != 4
63
object[arrayPos0].drawOrder = 4
64
end if
65
next
66
end event
67
68
69
// ========================
70
// Editor Events
71
// ========================
72
73
event RSDKEdit
74
if editor.returnVariable == true
75
switch editor.variableID
76
case EDIT_VAR_PROPVAL // property value
77
checkResult = object.propertyValue
78
break
79
80
case 0 // size
81
checkResult = object.propertyValue
82
checkResult &= 7
83
break
84
85
case 1 // frameID
86
checkResult = object.propertyValue
87
checkResult >>= 3
88
checkResult &= 3
89
break
90
91
end switch
92
else
93
switch editor.variableID
94
case EDIT_VAR_PROPVAL // property value
95
object.propertyValue = editor.variableValue
96
break
97
98
case 0 // size
99
temp0 = 7
100
Not(temp0)
101
object.propertyValue &= temp0
102
editor.variableValue &= 7
103
104
object.propertyValue |= editor.variableValue
105
break
106
107
case 1 // frameID
108
temp0 = 3
109
temp0 <<= 3
110
Not(temp0)
111
object.propertyValue &= temp0
112
editor.variableValue &= 3
113
editor.variableValue <<= 3
114
115
object.propertyValue |= editor.variableValue
116
break
117
118
end switch
119
end if
120
end event
121
122
123
event RSDKDraw
124
object.startPos.y = object.propertyValue
125
object.startPos.y &= 7
126
object.startPos.y <<= 20
127
object.endPos.y = object.startPos.y
128
FlipSign(object.startPos.y)
129
object.startPos.y += object.ypos
130
object.endPos.y += object.ypos
131
132
if object.propertyValue > 0
133
object.frame = object.propertyValue
134
object.frame >>= 3
135
object.frame += 2
136
else
137
object.frame = object.propertyValue
138
object.frame >>= 3
139
object.frame &= 1
140
end if
141
142
if object.startPos.y == object.endPos.y
143
DrawSprite(object.frame)
144
else
145
temp0 = object.startPos.y
146
temp0 += 0x100000
147
while temp0 < object.endPos.y
148
DrawSpriteXY(object.frame, object.xpos, temp0)
149
temp0 += 0x200000
150
loop
151
end if
152
end event
153
154
155
event RSDKLoad
156
LoadSpriteSheet("OOZ/Objects.gif")
157
SpriteFrame(-2, -16, 6, 32, 182, 51)
158
SpriteFrame(-2, -16, 6, 32, 182, 148)
159
SpriteFrame(-2, -16, 6, 32, 182, 59)
160
SpriteFrame(-2, -16, 6, 32, 182, 156)
161
SpriteFrame(-8, -16, 16, 32, 189, 75)
162
SpriteFrame(-24, -16, 48, 32, 189, 107)
163
164
AddEditorVariable("size")
165
SetActiveVariable("size")
166
167
AddEditorVariable("frameID")
168
SetActiveVariable("frameID")
169
end event
170
171