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/WindCurrent.txt
1479 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Wind Current 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.minPos.x
13
private alias object.value1 : object.minPos.y
14
private alias object.value2 : object.maxPos.x
15
private alias object.value3 : object.maxPos.y
16
17
// Player Aliases
18
private alias object.state : player.state
19
private alias object.animation : player.animation
20
private alias object.xpos : player.xpos
21
private alias object.ypos : player.ypos
22
private alias object.xvel : player.xvel
23
private alias object.yvel : player.yvel
24
private alias object.speed : player.speed
25
private alias object.tileCollisions : player.tileCollisions
26
27
28
// ========================
29
// Events
30
// ========================
31
32
event ObjectUpdate
33
temp6 = PRIORITY_XBOUNDS
34
35
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
36
CheckLower(player[currentPlayer].xpos, object.minPos.x)
37
temp0 = checkResult
38
CheckGreater(player[currentPlayer].xpos, object.minPos.y)
39
temp0 |= checkResult
40
CheckLower(player[currentPlayer].ypos, object.maxPos.x)
41
temp0 |= checkResult
42
CheckGreater(player[currentPlayer].ypos, object.maxPos.y)
43
temp0 |= checkResult
44
if temp0 == false
45
temp6 = PRIORITY_ACTIVE
46
47
CheckEqual(player[currentPlayer].state, Player_State_GotHit)
48
temp0 = checkResult
49
CheckEqual(player[currentPlayer].state, Player_State_Hurt)
50
temp0 |= checkResult
51
CheckEqual(player[currentPlayer].state, Player_State_Death)
52
temp0 |= checkResult
53
CheckEqual(player[currentPlayer].state, Player_State_Drown)
54
temp0 |= checkResult
55
CheckEqual(player[currentPlayer].state, WFZSetup_State_Clinging)
56
temp0 |= checkResult
57
if temp0 == false
58
player[currentPlayer].state = WFZSetup_State_Clinging
59
player[currentPlayer].animation = ANI_FANROTATE
60
player[currentPlayer].tileCollisions = true
61
end if
62
63
if player[currentPlayer].animation == ANI_FANROTATE
64
if player[currentPlayer].xvel == 0
65
temp1 = object.maxPos.y
66
temp1 -= object.maxPos.x
67
temp1 >>= 1
68
temp1 += object.maxPos.x
69
if player[currentPlayer].ypos < temp1
70
player[currentPlayer].ypos += 0x40000
71
else
72
player[currentPlayer].ypos -= 0x40000
73
end if
74
end if
75
end if
76
else
77
if player[currentPlayer].state == WFZSetup_State_Clinging
78
#platform: USE_STANDALONE
79
player[currentPlayer].state = Player_State_Air
80
#endplatform
81
#platform: USE_ORIGINS
82
player[currentPlayer].state = Player_State_Air_NoDropDash
83
#endplatform
84
player[currentPlayer].xvel = -0x40000
85
player[currentPlayer].speed = -0x40000
86
end if
87
end if
88
next
89
90
object.priority = temp6
91
if object.propertyValue == 0
92
object[+1].priority = temp6
93
else
94
object[-1].priority = temp6
95
end if
96
end event
97
98
99
event ObjectStartup
100
foreach (TypeName[Wind Current], arrayPos0, ALL_ENTITIES)
101
if object[arrayPos0].propertyValue == 0
102
arrayPos1 = arrayPos0
103
arrayPos1++
104
object[arrayPos0].minPos.x = object[arrayPos0].xpos
105
object[arrayPos0].minPos.y = object[arrayPos1].xpos
106
temp1 = object[arrayPos0].ypos
107
temp2 = object[arrayPos1].ypos
108
else
109
arrayPos1 = arrayPos0
110
arrayPos1--
111
object[arrayPos0].minPos.x = object[arrayPos1].xpos
112
object[arrayPos0].minPos.y = object[arrayPos0].xpos
113
temp1 = object[arrayPos1].ypos
114
temp2 = object[arrayPos0].ypos
115
end if
116
117
if temp1 < temp2
118
object[arrayPos0].maxPos.x = temp1
119
object[arrayPos0].maxPos.y = temp2
120
else
121
object[arrayPos0].maxPos.x = temp2
122
object[arrayPos0].maxPos.y = temp1
123
end if
124
125
object[arrayPos0].priority = PRIORITY_XBOUNDS
126
next
127
end event
128
129
130
// ========================
131
// Editor Events
132
// ========================
133
134
event RSDKEdit
135
if editor.returnVariable == true
136
switch editor.variableID
137
case EDIT_VAR_PROPVAL // property value
138
checkResult = object.propertyValue
139
break
140
141
case 0 // childType
142
checkResult = object.propertyValue
143
break
144
145
end switch
146
else
147
switch editor.variableID
148
case EDIT_VAR_PROPVAL // property value
149
object.propertyValue = editor.variableValue
150
break
151
152
case 0 // childType
153
object.propertyValue = editor.variableValue
154
break
155
156
end switch
157
end if
158
end event
159
160
161
event RSDKDraw
162
DrawSprite(0)
163
end event
164
165
166
event RSDKLoad
167
LoadSpriteSheet("Global/Display.gif")
168
SpriteFrame(-16, -16, 32, 32, 1, 143)
169
170
AddEditorVariable("childType")
171
SetActiveVariable("childType")
172
AddEnumVariable("Next Slot", 0)
173
AddEnumVariable("Previous Slot", 1)
174
end event
175
176