Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Mission/MissionPastPost.txt
1319 views
1
//-------------Sonic CD Mission Past 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 : MPASTPOST_IDLE
12
#alias 1 : MPASTPOST_ROTATE
13
#alias 2 : MPASTPOST_USED
14
15
// Warp Destination
16
#alias 1 : WARPDEST_PAST
17
18
// Collision Plane
19
#alias 1 : COLLISION_PLANE_B
20
21
// Game Mode Aliases
22
#alias 2 : MODE_TIMEATTACK
23
24
// Global SFX
25
#alias 13 : SFX_G_PAST
26
27
// Priority
28
#alias 0 : PRIORITY_BOUNDS
29
#alias 1 : PRIORITY_ACTIVE
30
31
// Property Values
32
#alias 0 : DRAWING_PLANE_A
33
#alias 1 : DRAWING_PLANE_B
34
35
36
sub ObjectPlayerInteraction
37
switch Object.State
38
case MPASTPOST_IDLE
39
if Player.CollisionPlane == Object.CollisionPlane
40
PlayerObjectCollision(C_TOUCH, -8, -24, 8, 32)
41
if CheckResult == true
42
Warp.Destination = WARPDEST_PAST
43
44
Object.State = MPASTPOST_ROTATE
45
Object.Priority = PRIORITY_ACTIVE
46
Object.Frame = 1
47
48
PlaySfx(SFX_G_PAST, false)
49
end if
50
end if
51
break
52
53
case MPASTPOST_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 = MPASTPOST_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 MPASTPOST_IDLE
79
DrawSprite(0)
80
DrawSprite(1)
81
break
82
83
case MPASTPOST_ROTATE
84
DrawSprite(0)
85
Object.Timer++
86
if Object.Timer == 64
87
Object.Timer = 0
88
Object.State = MPASTPOST_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 MPASTPOST_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
// Past Head
114
SpriteFrame(-16, -40, 32, 16, 118, 239) // #2 - Post Head
115
SpriteFrame(-8, -40, 16, 16, 51, 183) // #3 - Post Head Flip 1
116
SpriteFrame(-3, -40, 8, 16, 68, 183) // #4 - Post Head Flip 2
117
SpriteFrame(-8, -40, 16, 16, 52, 200) // #5 - Post Head Flip 3
118
SpriteFrame(-16, -40, 32, 16, 151, 239) // #6 - Post Head Backwards
119
SpriteFrame(-8, -40, 16, 16, 51, 183) // #7 - Post Head Flip 1
120
SpriteFrame(-3, -40, 8, 16, 68, 183) // #8 - Post Head Flip 2
121
SpriteFrame(-8, -40, 16, 16, 52, 200) // #9 - Post Head Flip 3
122
123
ArrayPos0 = 32
124
while ArrayPos0 < 1056
125
if Object[ArrayPos0].Type == TypeName[Past 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
end sub
138
139
140
// ========================
141
// Editor Subs
142
// ========================
143
144
sub RSDKEdit
145
if Editor.ReturnVariable == true
146
switch Editor.VariableID
147
case EDIT_VAR_PROPVAL // Property Value
148
CheckResult = Object.PropertyValue
149
break
150
case 0 // CollisionPlane
151
CheckResult = Object.PropertyValue
152
CheckResult &= 1
153
break
154
end switch
155
else
156
switch Editor.VariableID
157
case EDIT_VAR_PROPVAL // Property Value
158
Object.PropertyValue = Editor.VariableValue
159
break
160
case 0 // CollisionPlane
161
Object.PropertyValue = Editor.VariableValue
162
Object.PropertyValue &= 1
163
break
164
end switch
165
end if
166
end sub
167
168
sub RSDKDraw
169
DrawSprite(0)
170
DrawSprite(1)
171
end sub
172
173
sub RSDKLoad
174
LoadSpriteSheet("Global/Items.gif")
175
SpriteFrame(-8, -24, 16, 48, 35, 204) // #0 - Post Body
176
SpriteFrame(-16, -40, 32, 16, 118, 239) // #1 - Post Head
177
178
AddEditorVariable("CollisionPlane")
179
SetActiveVariable("CollisionPlane")
180
AddEnumVariable("Plane A", 0)
181
AddEnumVariable("Plane B", 1)
182
end sub
183
184