Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/RPlatform.txt
1319 views
1
//---------------Sonic CD Rise Platform Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Raising
7
#alias Object.Value1 : Object.Timer
8
#alias Object.Value2 : Object.YPlayerFloor
9
#alias Object.Value3 : Object.RiseTimer
10
#alias Object.Value4 : Object.YVelocity
11
#alias Object.Value5 : Object.YOriginPos
12
13
// States
14
#alias 0 : RISEPLATFORM_IDLE
15
#alias 1 : RISEPLATFORM_CRUMBLE
16
#alias 2 : RISEPLATFORM_RISE
17
#alias 3 : RISEPLATFORM_FLOAT
18
19
// Priority
20
#alias 0 : PRIORITY_BOUNDS
21
#alias 1 : PRIORITY_ACTIVE
22
23
24
sub ObjectMain
25
switch Object.State
26
case RISEPLATFORM_IDLE
27
Object.YPlayerFloor = 0
28
if Object.Raising == true
29
Object.State = RISEPLATFORM_CRUMBLE
30
Object.Priority = PRIORITY_ACTIVE
31
Object.YVelocity = -0x40000
32
Object.RiseTimer = 0
33
end if
34
break
35
36
case RISEPLATFORM_CRUMBLE
37
Object.YPlayerFloor = Object.YVelocity
38
if Object.RiseTimer < 8
39
Object.RiseTimer++
40
else
41
Object.RiseTimer = 0
42
Object.State = RISEPLATFORM_RISE
43
end if
44
if Object.OutOfBounds == true
45
Object.YPos = Object.YOriginPos
46
Object.State = RISEPLATFORM_IDLE
47
Object.Timer = 0
48
end if
49
break
50
51
case RISEPLATFORM_RISE
52
if Object.YVelocity < 0
53
Object.YVelocity += 0x2000
54
else
55
Object.State = RISEPLATFORM_FLOAT
56
end if
57
Object.YPlayerFloor = Object.YVelocity
58
if Object.OutOfBounds == true
59
Object.YPos = Object.YOriginPos
60
Object.State = RISEPLATFORM_IDLE
61
Object.Timer = 0
62
end if
63
break
64
65
case RISEPLATFORM_FLOAT
66
if Object.Raising == true
67
if Object.Timer < 16
68
Object.Timer++
69
TempValue0 = Object.Timer
70
TempValue0 &= 3
71
if TempValue0 == 3
72
Object.YPlayerFloor = 0x10000
73
else
74
Object.YPlayerFloor = 0
75
end if
76
else
77
Object.YPlayerFloor = 0
78
end if
79
else
80
if Object.Timer > 0
81
Object.Timer--
82
TempValue0 = Object.Timer
83
TempValue0 &= 3
84
if TempValue0 == 3
85
Object.YPlayerFloor = -0x10000
86
else
87
Object.YPlayerFloor = 0
88
end if
89
else
90
Object.YPlayerFloor = 0
91
end if
92
end if
93
94
if Object.OutOfBounds == true
95
Object.YPos = Object.YOriginPos
96
Object.State = RISEPLATFORM_IDLE
97
Object.Timer = 0
98
end if
99
break
100
101
end switch
102
Object.Raising = false
103
end sub
104
105
106
sub ObjectPlayerInteraction
107
PlayerObjectCollision(C_PLATFORM, -32, -9, 32, 12)
108
if CheckResult == true
109
Object.Raising = true
110
Player.YPos += Object.YPlayerFloor
111
end if
112
end sub
113
114
115
sub ObjectDraw
116
Object.YPos += Object.YPlayerFloor
117
DrawSprite(0)
118
end sub
119
120
121
sub ObjectStartup
122
LoadSpriteSheet("R1/Objects.gif")
123
124
SpriteFrame(-32, -16, 64, 32, 101, 109) // #0 - Rise Platform
125
126
ArrayPos0 = 32
127
while ArrayPos0 < 1056
128
if Object[ArrayPos0].Type == TypeName[Rise Platform]
129
Object[ArrayPos0].YOriginPos = Object[ArrayPos0].YPos
130
end if
131
ArrayPos0++
132
loop
133
end sub
134
135
136
// ========================
137
// Editor Subs
138
// ========================
139
140
sub RSDKDraw
141
DrawSprite(0)
142
end sub
143
144
145
sub RSDKLoad
146
LoadSpriteSheet("R1/Objects.gif")
147
148
SpriteFrame(-32, -16, 64, 32, 101, 109) // #0 - Rise Platform
149
150
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
151
end sub
152
153