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/BeltPlatform.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Belt Platform 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.stoodPlayers
14
15
// States
16
private alias 0 : BELTPLATFORM_INACTIVE
17
private alias 1 : BELTPLATFORM_APPEARING
18
private alias 2 : BELTPLATFORM_MOVING
19
private alias 3 : BELTPLATFORM_DISAPPEARING
20
21
// Player Aliases
22
private alias object.ypos : player.ypos
23
24
25
// ========================
26
// Events
27
// ========================
28
29
event ObjectUpdate
30
switch object.state
31
case BELTPLATFORM_INACTIVE
32
break
33
34
case BELTPLATFORM_APPEARING
35
object.animationTimer++
36
if object.animationTimer == 4
37
object.animationTimer = 0
38
object.frame--
39
if object.frame == 0
40
object.state = BELTPLATFORM_MOVING
41
end if
42
end if
43
break
44
45
case BELTPLATFORM_MOVING
46
object.ypos += object.yvel
47
48
object.timer--
49
if object.timer == 0
50
object.state = BELTPLATFORM_DISAPPEARING
51
end if
52
53
temp2 = 0
54
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
55
GetBit(temp0, object.stoodPlayers, temp2)
56
if temp0 == true
57
player[currentPlayer].ypos += object.yvel
58
end if
59
60
SetBit(object.stoodPlayers, temp2, false)
61
BoxCollisionTest(C_PLATFORM, object.entityPos, -24, -4, 24, 4, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
62
if checkResult == true
63
SetBit(object.stoodPlayers, temp2, true)
64
end if
65
temp2++
66
next
67
break
68
69
case BELTPLATFORM_DISAPPEARING
70
object.animationTimer++
71
if object.animationTimer == 4
72
object.animationTimer = 0
73
object.frame++
74
if object.frame == 3
75
object.state = BELTPLATFORM_INACTIVE
76
end if
77
end if
78
break
79
80
end switch
81
82
temp0 = object.xpos
83
temp0 >>= 16
84
temp0 -= camera[0].xpos
85
Abs(temp0)
86
temp0 -= 128
87
if temp0 > screen.xcenter
88
object.state = BELTPLATFORM_INACTIVE
89
object.priority = PRIORITY_BOUNDS
90
end if
91
end event
92
93
94
event ObjectDraw
95
if object.state > BELTPLATFORM_INACTIVE
96
DrawSprite(object.frame)
97
end if
98
end event
99
100
101
event ObjectStartup
102
LoadSpriteSheet("SCZ/Objects.gif")
103
SpriteFrame(-24, -4, 48, 8, 80, 177)
104
SpriteFrame(-24, -3, 48, 6, 80, 186)
105
SpriteFrame(-24, -2, 48, 4, 80, 193)
106
end event
107
108
109
// ========================
110
// Editor Events
111
// ========================
112
113
event RSDKDraw
114
DrawSprite(0)
115
end event
116
117
118
event RSDKLoad
119
LoadSpriteSheet("SCZ/Objects.gif")
120
SpriteFrame(-24, -4, 48, 8, 80, 177)
121
122
// In the scene it's normally set to 1, it doesn't seem to do anything though?
123
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
124
end event
125
126