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/WFZ/WFZInvBlock.txt
1478 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: WFZ Inv Block 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.timeAttackOnly
13
14
private alias object.value0 : object.width
15
private alias object.value1 : object.height
16
17
// Player Aliases
18
private alias object.type : player.type
19
private alias object.state : player.state
20
private alias object.gravity : player.gravity
21
private alias object.animation : player.animation
22
23
// Modes
24
private alias 2 : MODE_TIMEATTACK
25
26
27
// ========================
28
// Events
29
// ========================
30
31
event ObjectUpdate
32
temp0 = object.width
33
FlipSign(temp0)
34
temp1 = object.height
35
FlipSign(temp1)
36
37
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
38
if player[currentPlayer].state != Player_State_LedgePullUp
39
if player[currentPlayer].animation != ANI_FANROTATE
40
BoxCollisionTest(C_SOLID, object.entityPos, temp0, temp1, object.width, object.height, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
41
switch checkResult
42
case COL_NONE
43
temp0 += 2
44
temp1 += 2
45
temp2 = object.width
46
temp3 = object.height
47
temp2 -= 2
48
temp3 -= 2
49
BoxCollisionTest(C_TOUCH, object.entityPos, temp0, temp1, temp2, temp3, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
50
if checkResult == true
51
player[currentPlayer].gravity = GRAVITY_GROUND
52
end if
53
break
54
55
case COL_BOTTOM
56
if player[currentPlayer].gravity == GRAVITY_GROUND
57
CallFunction(Player_Kill)
58
end if
59
break
60
end switch
61
end if
62
end if
63
next
64
end event
65
66
67
event ObjectDraw
68
if player[0].type == TypeName[Debug Mode]
69
temp0 = object.xpos
70
temp1 = object.ypos
71
72
temp2 = object.propertyValue
73
temp4 = temp2
74
temp4 &= 0xF0
75
temp4 <<= 15
76
temp2 >>= 4
77
temp2++
78
temp6 = temp2
79
80
temp3 = object.propertyValue
81
temp3 &= 0x0F
82
temp5 = temp3
83
temp5 <<= 19
84
temp3++
85
86
temp0 -= temp4
87
temp4 = temp0
88
temp1 -= temp5
89
while temp3 > 0
90
while temp2 > 0
91
DrawSpriteXY(0, temp0, temp1)
92
temp0 += 0x100000
93
temp2--
94
loop
95
temp2 = temp6
96
temp0 = temp4
97
temp1 += 0x100000
98
temp3--
99
loop
100
end if
101
end event
102
103
104
event ObjectStartup
105
LoadSpriteSheet("Global/Display.gif")
106
SpriteFrame(-8, -7, 16, 14, 1, 176)
107
108
foreach (TypeName[WFZ Inv Block], arrayPos0, ALL_ENTITIES)
109
if object[arrayPos0].timeAttackOnly == true
110
if options.gameMode != MODE_TIMEATTACK
111
object[arrayPos0].type = TypeName[Blank Object]
112
end if
113
end if
114
115
// Do note that these don't draw anything normally, they only display in Debug Mode
116
object[arrayPos0].drawOrder = 5
117
118
object[arrayPos0].width = object[arrayPos0].propertyValue
119
object[arrayPos0].width &= 0xF0
120
object[arrayPos0].width += 16
121
object[arrayPos0].width >>= 1
122
123
object[arrayPos0].height = object[arrayPos0].propertyValue
124
object[arrayPos0].height &= 0xF
125
object[arrayPos0].height++
126
object[arrayPos0].height <<= 3
127
next
128
end event
129
130
131
// ========================
132
// Editor Events
133
// ========================
134
135
event RSDKEdit
136
if editor.returnVariable == true
137
switch editor.variableID
138
case EDIT_VAR_PROPVAL // property value
139
checkResult = object.propertyValue
140
break
141
142
case 0 // width
143
checkResult = object.propertyValue
144
checkResult >>= 4
145
checkResult &= 0xF
146
break
147
148
case 1 // height
149
checkResult = object.propertyValue
150
checkResult &= 0xF
151
break
152
153
end switch
154
else
155
switch editor.variableID
156
case EDIT_VAR_PROPVAL // property value
157
object.propertyValue = editor.variableValue
158
break
159
160
case 0 // width
161
temp0 = editor.variableValue
162
temp0 &= 0xF
163
temp0 <<= 4
164
165
object.propertyValue &= 0x0F
166
object.propertyValue |= temp0
167
break
168
169
case 1 // height
170
temp0 = editor.variableValue
171
temp0 &= 0xF
172
173
object.propertyValue &= 0xF0
174
object.propertyValue |= temp0
175
break
176
177
end switch
178
end if
179
end event
180
181
182
event RSDKDraw
183
temp0 = object.xpos
184
temp1 = object.ypos
185
186
temp2 = object.propertyValue
187
temp4 = temp2
188
temp4 &= 0xF0
189
temp4 <<= 15
190
temp2 >>= 4
191
temp2++
192
temp6 = temp2
193
194
temp3 = object.propertyValue
195
temp3 &= 0x0F
196
temp5 = temp3
197
temp5 <<= 19
198
temp3++
199
200
temp0 -= temp4
201
temp4 = temp0
202
temp1 -= temp5
203
while temp3 > 0
204
while temp2 > 0
205
DrawSpriteXY(0, temp0, temp1)
206
temp0 += 0x100000
207
temp2--
208
loop
209
temp2 = temp6
210
temp0 = temp4
211
temp1 += 0x100000
212
temp3--
213
loop
214
end event
215
216
217
event RSDKLoad
218
LoadSpriteSheet("Global/Display.gif")
219
SpriteFrame(-8, -7, 16, 14, 1, 176)
220
221
AddEditorVariable("width")
222
AddEditorVariable("height")
223
224
SetVariableAlias(ALIAS_VAR_VAL0, "timeAttackOnly")
225
end event
226
227