Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/GrabPole.txt
1319 views
1
//----------------Sonic CD Grab Pole Script-------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.BreakTimer
7
8
// HUD alias
9
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
10
11
// States
12
#alias 0 : GRABPOLE_IDLE
13
#alias 1 : GRABPOLE_HANGING
14
#alias 2 : GRABPOLE_BROKEN
15
16
// Players
17
#alias 0 : PLAYER_SONIC_A
18
19
// Time Periods
20
#alias 0 : TIME_PRESENT
21
#alias 1 : TIME_PAST
22
#alias 2 : TIME_GOOD_FUTURE
23
#alias 3 : TIME_BAD_FUTURE
24
25
26
sub ObjectMain
27
if Object.State == GRABPOLE_HANGING
28
if Player.State == Player_State_Death
29
Object.State = GRABPOLE_IDLE
30
end if
31
if Player.State == Player_State_Drown
32
Object.State = GRABPOLE_IDLE
33
end if
34
35
if Object.State > GRABPOLE_IDLE
36
if Object.BreakTimer < 180
37
Object.BreakTimer++
38
Player.XPos = Object.XPos
39
Player.Direction = FACING_RIGHT
40
if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins
41
Player.XPos += 0x140000
42
else
43
Player.XPos += 0x100000
44
end if
45
else
46
Object.Frame = 1
47
Object.State = GRABPOLE_BROKEN
48
49
#platform: Use_Origins
50
Player.State = Player_State_Air_NoDropDash
51
#endplatform
52
53
#platform: Use_Standalone
54
Player.State = Player_State_Air
55
#endplatform
56
57
end if
58
end if
59
end if
60
end sub
61
62
63
sub ObjectPlayerInteraction
64
switch Object.State
65
case GRABPOLE_IDLE
66
PlayerObjectCollision(C_TOUCH, 16, -28, 32, 28)
67
if CheckResult == true
68
Object.State = GRABPOLE_HANGING
69
Player.State = Player_State_Static
70
71
Player.Animation = ANI_CLINGING
72
Player.Direction = FACING_RIGHT
73
74
Player.Speed = 0
75
Player.XVelocity = 0
76
Player.YVelocity = 0
77
end if
78
break
79
80
case GRABPOLE_HANGING
81
if Player.Up == true
82
Player.YPos -= 0x10000
83
end if
84
85
if Player.Down == true
86
Player.YPos += 0x10000
87
end if
88
89
if Player.JumpPress == true
90
Object.Frame = 1
91
Object.State = GRABPOLE_BROKEN
92
93
#platform: Use_Origins
94
Player.State = Player_State_Air_NoDropDash
95
#endplatform
96
97
#platform: Use_Standalone
98
Player.State = Player_State_Air
99
#endplatform
100
101
end if
102
103
PlayerObjectCollision(C_BOX, 0, -64, 32, -46)
104
PlayerObjectCollision(C_BOX, 0, 46, 32, 64)
105
break
106
end switch
107
end sub
108
109
110
sub ObjectDraw
111
DrawSprite(Object.Frame)
112
end sub
113
114
115
sub ObjectStartup
116
LoadSpriteSheet("R4/Objects3.gif")
117
118
if HUD.CurrentTimePeriod < 3 // Present Past or Good Future
119
SpriteFrame(-4, -46, 8, 92, 134, 46) // #0 - Pole
120
SpriteFrame(-4, -46, 16, 92, 117, 46) // #1 - Broken Pole
121
else
122
SpriteFrame(-4, -46, 8, 92, 51, 163) // #0 - Pole
123
SpriteFrame(-4, -46, 16, 92, 34, 163) // #1 - Broken Pole
124
end if
125
end sub
126
127
128
// ========================
129
// Editor Subs
130
// ========================
131
132
sub RSDKDraw
133
DrawSprite(0)
134
end sub
135
136
137
sub RSDKLoad
138
LoadSpriteSheet("R4/Objects3.gif")
139
140
CallFunction(EditorHelpers_FindTimePeriod)
141
if CheckResult < 3 // Present Past or Good Future
142
SpriteFrame(-4, -46, 8, 92, 134, 46) // #0 - Pole
143
SpriteFrame(-4, -46, 16, 92, 117, 46) // #1 - Broken Pole
144
else
145
SpriteFrame(-4, -46, 8, 92, 51, 163) // #0 - Pole
146
SpriteFrame(-4, -46, 16, 92, 34, 163) // #1 - Broken Pole
147
end if
148
149
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
150
end sub
151
152