Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R5/StaticPlatform.txt
1319 views
1
//--------------Sonic CD Static Platform Script---------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// HUD Alias
6
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
7
8
// Time Period Aliases
9
#alias 0 : TIME_PRESENT
10
#alias 1 : TIME_PAST
11
#alias 2 : TIME_GOOD_FUTURE
12
#alias 3 : TIME_BAD_FUTURE
13
14
// Property Values
15
#alias 0 : PLATFORM_SMALL
16
#alias 1 : PLATFORM_MEDIUM
17
#alias 2 : PLATFORM_LARGE
18
#alias 3 : PLATFORM_SMALL_CONVEYOR
19
#alias 4 : PLATFORM_MEDIUM_CONVEYOR
20
#alias 5 : PLATFORM_LARGE_CONVEYOR
21
22
23
sub ObjectPlayerInteraction
24
25
switch Object.PropertyValue
26
case PLATFORM_SMALL
27
PlayerObjectCollision(C_PLATFORM, -16, -16, 16, 12)
28
break
29
30
case PLATFORM_MEDIUM
31
PlayerObjectCollision(C_PLATFORM, -32, -16, 32, 12)
32
break
33
34
case PLATFORM_LARGE
35
PlayerObjectCollision(C_PLATFORM, -48, -16, 48, 12)
36
break
37
38
case PLATFORM_SMALL_CONVEYOR
39
// (with the Conveyor code removed, functionally identical to the normal Small Platform)
40
PlayerObjectCollision(C_PLATFORM, -16, -16, 16, 12)
41
break
42
43
case PLATFORM_MEDIUM_CONVEYOR
44
// (Also with no Conveyor code associated with it... pretty much the same as the normal Medium Platform type)
45
PlayerObjectCollision(C_PLATFORM, -32, -16, 32, 12)
46
break
47
48
case PLATFORM_LARGE_CONVEYOR
49
// (You may notice some corresponding code is missing, that's because the took the Conveyor out of the name!)
50
PlayerObjectCollision(C_PLATFORM, -48, -16, 48, 12)
51
break
52
53
end switch
54
55
end sub
56
57
58
sub ObjectDraw
59
60
switch Object.PropertyValue
61
case PLATFORM_SMALL
62
case PLATFORM_MEDIUM
63
case PLATFORM_LARGE
64
// Standard Platform
65
DrawSprite(Object.PropertyValue)
66
break
67
68
// These next 3 types are for Conveyor Belt types, where the Conveyor Belt Frame is overlayed atop the normal Platform Sprite
69
70
case PLATFORM_SMALL_CONVEYOR
71
DrawSprite(0)
72
DrawSprite(3)
73
break
74
75
case PLATFORM_MEDIUM_CONVEYOR
76
DrawSprite(1)
77
DrawSprite(4)
78
break
79
80
case PLATFORM_LARGE_CONVEYOR
81
DrawSprite(2)
82
DrawSprite(5)
83
break
84
85
end switch
86
87
end sub
88
89
90
sub ObjectStartup
91
92
// So an initial sheet is loaded here...
93
// but then more sheets are loaded down below? Huh?
94
LoadSpriteSheet("R5/Objects.gif")
95
96
// But anyway, this Object's Sprite Frames are the same as Dip Platform's, including Conveyor Frames, so the order is:
97
98
// 0 - Small Platform Frame
99
// 1 - Normal Sized Platform Frame
100
// 2 - Large Platform Frame
101
102
// 3 - Small Conveyor Belt Frame
103
// 4 - Medium Sized Conveyor Belt Frame
104
// 5 - Large Conveyor Belt Frame
105
106
// The essentially unused Conveyor Belt Frames are to be layered on top of the Platform Frames, though they aren't really used from this Object
107
108
switch HUD.CurrentTimePeriod
109
case TIME_PRESENT
110
LoadSpriteSheet("R5/Objects.gif")
111
SpriteFrame(-16, -16, 32, 32, 1, 51)
112
SpriteFrame(-32, -16, 64, 32, 34, 51)
113
SpriteFrame(-48, -16, 96, 32, 1, 84)
114
SpriteFrame(-16, -16, 32, 16, 65, 208)
115
SpriteFrame(-32, -16, 64, 16, 1, 208)
116
SpriteFrame(-48, -16, 96, 16, 1, 191)
117
break
118
119
case TIME_PAST
120
LoadSpriteSheet("R5/Objects3.gif")
121
SpriteFrame(-16, -16, 32, 32, 1, 170)
122
SpriteFrame(-32, -16, 64, 32, 34, 170)
123
SpriteFrame(-48, -16, 96, 32, 1, 203)
124
SpriteFrame(-16, -16, 32, 16, 223, 148)
125
SpriteFrame(-32, -16, 64, 16, 159, 148)
126
SpriteFrame(-48, -16, 96, 16, 159, 131)
127
break
128
129
case TIME_GOOD_FUTURE
130
LoadSpriteSheet("R5/Objects3.gif")
131
SpriteFrame(-16, -16, 32, 32, 1, 170)
132
SpriteFrame(-32, -16, 64, 32, 34, 170)
133
SpriteFrame(-48, -16, 96, 32, 1, 203)
134
SpriteFrame(-16, -16, 32, 16, 223, 182)
135
SpriteFrame(-32, -16, 64, 16, 159, 182)
136
SpriteFrame(-48, -16, 96, 16, 159, 165)
137
break
138
139
case TIME_BAD_FUTURE
140
LoadSpriteSheet("R5/Objects3.gif")
141
SpriteFrame(-16, -16, 32, 32, 1, 170)
142
SpriteFrame(-32, -16, 64, 32, 34, 170)
143
SpriteFrame(-48, -16, 96, 32, 1, 203)
144
SpriteFrame(-16, -16, 32, 16, 223, 216)
145
SpriteFrame(-32, -16, 64, 16, 159, 216)
146
SpriteFrame(-48, -16, 96, 16, 159, 199)
147
break
148
149
end switch
150
151
end sub
152
153
154
// ========================
155
// Editor Subs
156
// ========================
157
158
sub RSDKEdit
159
if Editor.ReturnVariable == true
160
switch Editor.VariableID
161
case EDIT_VAR_PROPVAL // Property Value
162
CheckResult = Object.PropertyValue
163
break
164
case 0 // Type
165
CheckResult = Object.PropertyValue
166
break
167
end switch
168
else
169
switch Editor.VariableID
170
case EDIT_VAR_PROPVAL // Property Value
171
Object.PropertyValue = Editor.VariableValue
172
break
173
case 0 // Type
174
Object.PropertyValue = Editor.VariableValue
175
break
176
end switch
177
end if
178
end sub
179
180
181
sub RSDKDraw
182
if Object.PropertyValue >= 3
183
TempValue0 = -3
184
TempValue0 += Object.PropertyValue
185
DrawSprite(TempValue0)
186
end if
187
188
DrawSprite(Object.PropertyValue)
189
end sub
190
191
192
sub RSDKLoad
193
LoadSpriteSheet("R5/Objects.gif")
194
195
// TODO: support for other time periods, this is just present
196
// certainly there's some better way to do it rather than a bunch of unique and boring checkCurrentStageFolder checks?
197
SpriteFrame(-16, -16, 32, 32, 1, 51)
198
SpriteFrame(-32, -16, 64, 32, 34, 51)
199
SpriteFrame(-48, -16, 96, 32, 1, 84)
200
SpriteFrame(-16, -16, 32, 16, 65, 208)
201
SpriteFrame(-32, -16, 64, 16, 1, 208)
202
SpriteFrame(-48, -16, 96, 16, 1, 191)
203
204
AddEditorVariable("Type")
205
SetActiveVariable("Type")
206
AddEnumVariable("Small", 0)
207
AddEnumVariable("Medium", 1)
208
AddEnumVariable("Large", 2)
209
AddEnumVariable("Small Conveyor", 3)
210
AddEnumVariable("Medium Conveyor", 4)
211
AddEnumVariable("Large Conveyor", 5)
212
end sub
213
214