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