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/BeltPlatformS.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Belt Platform S 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.beltID
14
15
// BeltPlatform Aliases
16
private alias object.value0 : beltPlatform.timer
17
18
// BeltPlatform States
19
private alias 1 : BELTPLATFORM_APPEARING
20
21
22
// ========================
23
// Events
24
// ========================
25
26
event ObjectUpdate
27
if object.timer == 0
28
object.priority = PRIORITY_ACTIVE
29
object.timer = 64
30
31
arrayPos0 = object.entityPos
32
arrayPos0 += object.beltID
33
arrayPos0++
34
object[arrayPos0].xpos = object.xpos
35
object[arrayPos0].ypos = object.ypos
36
object[arrayPos0].state = BELTPLATFORM_APPEARING
37
object[arrayPos0].priority = PRIORITY_ACTIVE
38
object[arrayPos0].frame = 2
39
40
GetBit(temp0, object.propertyValue, 1)
41
if temp0 == false
42
object[arrayPos0].yvel = -0x10000
43
else
44
object[arrayPos0].yvel = 0x10000
45
end if
46
47
object.beltID++
48
GetBit(temp0, object.propertyValue, 0)
49
if temp0 == false
50
beltPlatform[arrayPos0].timer = 199
51
object.beltID &= 3
52
else
53
beltPlatform[arrayPos0].timer = 455
54
object.beltID &= 7
55
end if
56
else
57
object.timer--
58
end if
59
60
temp0 = object.xpos
61
temp0 >>= 16
62
temp0 -= camera[0].xpos
63
Abs(temp0)
64
temp0 -= 128
65
if temp0 > screen.xcenter
66
object.timer = 0
67
object.beltID = 0
68
object.priority = PRIORITY_XBOUNDS
69
end if
70
end event
71
72
73
event ObjectDraw
74
// Did this Draw Something at one point??
75
end event
76
77
78
event ObjectStartup
79
foreach (TypeName[Belt Platform S], arrayPos0, ALL_ENTITIES)
80
object[arrayPos0].priority = PRIORITY_XBOUNDS
81
next
82
end event
83
84
85
// ========================
86
// Editor Events
87
// ========================
88
89
event RSDKEdit
90
if editor.returnVariable == true
91
switch editor.variableID
92
case EDIT_VAR_PROPVAL // property value
93
checkResult = object.propertyValue
94
break
95
96
case 0 // type
97
GetBit(checkResult, object.propertyValue, 0)
98
break
99
100
case 1 // direction
101
GetBit(checkResult, object.propertyValue, 1)
102
break
103
104
end switch
105
else
106
switch editor.variableID
107
case EDIT_VAR_PROPVAL // property value
108
object.propertyValue = editor.variableValue
109
break
110
111
case 0 // type
112
CheckNotEqual(editor.variableValue, false)
113
SetBit(object.propertyValue, 0, checkResult)
114
break
115
116
case 1 // direction
117
CheckNotEqual(editor.variableValue, false)
118
SetBit(object.propertyValue, 1, checkResult)
119
break
120
121
end switch
122
end if
123
end event
124
125
126
event RSDKDraw
127
DrawSprite(0)
128
end event
129
130
131
event RSDKLoad
132
LoadSpriteSheet("Global/Display.gif")
133
SpriteFrame(-16, -16, 32, 32, 1, 143)
134
135
AddEditorVariable("type")
136
SetActiveVariable("type")
137
AddEnumVariable("Quick Interval", 0)
138
AddEnumVariable("Slow Interval", 1)
139
140
AddEditorVariable("direction")
141
SetActiveVariable("direction")
142
AddEnumVariable("Up", 0)
143
AddEnumVariable("Down", 1)
144
end event
145
146