Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Mission/MissionFuturePost.txt
1319 views
1
//------------Sonic CD Mission Future Post Script-------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
//----Used on Mission "M100 - Reverse Time Traveler Redux"----//
5
6
// Aliases
7
#alias Object.Value0 : Object.Timer
8
#alias Object.Value1 : Object.CollisionPlane
9
10
// States
11
#alias 0 : MFUTUREPOST_IDLE
12
#alias 1 : MFUTUREPOST_ROTATE
13
#alias 2 : MFUTUREPOST_USED
14
15
// Warp Destination
16
#alias 2 : WARPDEST_FUTURE
17
18
// Collision Plane
19
#alias 1 : COLLISION_PLANE_B
20
21
// Property Values
22
#alias 0 : DRAWING_PLANE_A
23
#alias 1 : DRAWING_PLANE_B
24
25
// Game Mode Aliases
26
#alias 2 : MODE_TIMEATTACK
27
28
// Global SFX
29
#alias 12 : SFX_G_FUTURE
30
31
// Priority
32
#alias 0 : PRIORITY_BOUNDS
33
#alias 1 : PRIORITY_ACTIVE
34
35
36
sub ObjectPlayerInteraction
37
switch Object.State
38
case MFUTUREPOST_IDLE
39
if Player.CollisionPlane == Object.CollisionPlane
40
PlayerObjectCollision(C_TOUCH,-8,-24,8,32)
41
if CheckResult == true
42
Warp.Destination = WARPDEST_FUTURE
43
44
Object.State = MFUTUREPOST_ROTATE
45
Object.Priority = PRIORITY_ACTIVE
46
Object.Frame = 1
47
48
PlaySfx(SFX_G_FUTURE, false)
49
end if
50
end if
51
break
52
53
case MFUTUREPOST_USED
54
if Object.OutOfBounds == true
55
TempValue0 = Stage.Minutes
56
TempValue0 *= 60
57
TempValue0 += Stage.Seconds
58
59
if Object.Timer == 0
60
Object.Timer = TempValue0
61
Object.Timer += 10
62
else
63
if TempValue0 >= Object.Timer
64
// Reset the post
65
Object.State = MFUTUREPOST_IDLE
66
Object.Timer = 0
67
Object.Priority = PRIORITY_BOUNDS
68
end if
69
end if
70
end if
71
break
72
end switch
73
end sub
74
75
76
sub ObjectDraw
77
switch Object.State
78
case MFUTUREPOST_IDLE
79
DrawSprite(0)
80
DrawSprite(1)
81
break
82
83
case MFUTUREPOST_ROTATE
84
DrawSprite(0)
85
Object.Timer++
86
if Object.Timer == 64
87
Object.Timer = 0
88
Object.State = MFUTUREPOST_USED
89
end if
90
DrawSprite(Object.Frame)
91
92
TempValue0 = Object.Timer
93
TempValue0 &= 1
94
95
Object.Frame += TempValue0
96
if Object.Frame > 8
97
Object.Frame = 1
98
end if
99
break
100
101
case MFUTUREPOST_USED
102
DrawSprite(0)
103
DrawSprite(5)
104
break
105
end switch
106
end sub
107
108
109
sub ObjectStartup
110
LoadSpriteSheet("Global/Items.gif")
111
112
SpriteFrame(-8, -24, 16, 48, 35, 204) // #0 - Post Body
113
// Future Post Head
114
SpriteFrame(-16, -40, 32, 16, 52, 239) // #1 - Post Head
115
SpriteFrame(-8, -40, 16, 16, 51, 183) // #2 - Post Head Flip 1
116
SpriteFrame(-3, -40, 8, 16, 68, 183) // #3 - Post Head Flip 2
117
SpriteFrame(-8, -40, 16, 16, 52, 200) // #4 - Post Head Flip 3
118
SpriteFrame(-16, -40, 32, 16, 85, 239) // #5 - Post Head Backwards
119
SpriteFrame(-8, -40, 16, 16, 51, 183) // #6 - Post Head Flip 1
120
SpriteFrame(-3, -40, 8, 16, 68, 183) // #7 - Post Head Flip 2
121
SpriteFrame(-8, -40, 16, 16, 52, 200) // #8 - Post Head Flip 3
122
123
ArrayPos0 = 32
124
while ArrayPos0 < 1056
125
if Object[ArrayPos0].Type == TypeName[Future Post]
126
if Object[ArrayPos0].PropertyValue == DRAWING_PLANE_B
127
Object[ArrayPos0].DrawOrder = 1
128
Object[ArrayPos0].CollisionPlane = COLLISION_PLANE_B
129
end if
130
131
if Options.GameMode == MODE_TIMEATTACK
132
Object[ArrayPos0].Type = TypeName[Blank Object]
133
end if
134
end if
135
ArrayPos0++
136
loop
137
138
Transporter_Destroyed = true
139
end sub
140
141
142
// ========================
143
// Editor Subs
144
// ========================
145
146
sub RSDKEdit
147
if Editor.ReturnVariable == true
148
switch Editor.VariableID
149
case EDIT_VAR_PROPVAL // Property Value
150
CheckResult = Object.PropertyValue
151
break
152
case 0 // CollisionPlane
153
CheckResult = Object.PropertyValue
154
CheckResult &= 1
155
break
156
end switch
157
else
158
switch Editor.VariableID
159
case EDIT_VAR_PROPVAL // Property Value
160
Object.PropertyValue = Editor.VariableValue
161
break
162
case 0 // CollisionPlane
163
Object.PropertyValue = Editor.VariableValue
164
Object.PropertyValue &= 1
165
break
166
end switch
167
end if
168
end sub
169
170
171
sub RSDKDraw
172
DrawSprite(0)
173
DrawSprite(1)
174
end sub
175
176
177
sub RSDKLoad
178
LoadSpriteSheet("Global/Items.gif")
179
SpriteFrame(-8, -24, 16, 48, 35, 204) // #0 - Post Body
180
SpriteFrame(-16, -40, 32, 16, 52, 239) // #1 - Post Head
181
182
AddEditorVariable("CollisionPlane")
183
SetActiveVariable("CollisionPlane")
184
AddEnumVariable("Plane A", 0)
185
AddEnumVariable("Plane B", 1)
186
end sub
187
188
189
190
191