Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/PoleTrigger.txt
1319 views
1
//---------------Sonic CD Pole Trigger Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.CollisionTop
7
#alias Object.Value1 : Object.CollisionBottom
8
#alias Object.Value2 : Object.Angle
9
#alias Object.Value3 : Object.JumpCheck
10
11
// States
12
#alias 0 : POLETRIGGER_IDLE
13
#alias 1 : POLETRIGGER_PLAYER_ROT
14
15
16
sub ObjectPlayerInteraction
17
if Object.State == POLETRIGGER_IDLE
18
PlayerObjectCollision(C_TOUCH, -4, Object.CollisionTop, 4, Object.CollisionBottom)
19
if CheckResult == true
20
if Player.State != Player_State_Hurt
21
Object.State = POLETRIGGER_PLAYER_ROT
22
Object.JumpCheck = false
23
24
Player.State = Player_State_Static
25
Player.Animation = ANI_JUMPING
26
Player.XPos = Object.XPos
27
Player.XVelocity = 0
28
Player.Speed = 0
29
Player.DrawOrder = 5
30
31
if Player.YVelocity > 0
32
Player.YVelocity = 0x20000
33
else
34
Player.YVelocity = -0x20000
35
end if
36
end if
37
end if
38
else
39
if Player.State == Player_State_Static
40
if Player.JumpPress == true
41
Object.JumpCheck = true
42
end if
43
44
Object.Angle += 16
45
Object.Angle &= 511
46
Sin(Player.XPos, Object.Angle)
47
Player.XPos *= -0xC00
48
Player.XPos += Object.XPos
49
50
Player.DrawOrder = 4
51
if Object.Angle < 129
52
Player.DrawOrder = 5
53
end if
54
if Object.Angle > 383
55
Player.DrawOrder = 5
56
end if
57
58
TempValue0 = Player.YPos
59
TempValue0 -= Object.YPos
60
TempValue0 >>= 16
61
if TempValue0 < 0
62
if TempValue0 < Object.CollisionTop
63
Player.YVelocity = 0x20000
64
end if
65
else
66
if TempValue0 > Object.CollisionBottom
67
Player.YVelocity = -0x20000
68
end if
69
end if
70
71
if Object.JumpCheck == true
72
if Object.Angle == 128
73
Player.DrawOrder = 4
74
75
#platform: Use_Origins
76
Player.State = Player_State_Air_NoDropDash
77
#endplatform
78
79
#platform: Use_Standalone
80
Player.State = Player_State_Air
81
#endplatform
82
83
Player.Speed = -0xC0000
84
Player.XVelocity = -0xC0000
85
Object.State = POLETRIGGER_IDLE
86
end if
87
88
if Object.Angle == 384
89
Player.DrawOrder = 4
90
91
#platform: Use_Origins
92
Player.State = Player_State_Air_NoDropDash
93
#endplatform
94
95
#platform: Use_Standalone
96
Player.State = Player_State_Air
97
#endplatform
98
99
Player.Speed = 0xC0000
100
Player.XVelocity = 0xC0000
101
Object.State = POLETRIGGER_IDLE
102
end if
103
end if
104
else
105
if Player.DrawOrder == 5
106
Player.DrawOrder = 4
107
end if
108
Object.State = POLETRIGGER_IDLE
109
end if
110
end if
111
end sub
112
113
114
sub ObjectStartup
115
ArrayPos0 = 32
116
while ArrayPos0 < 1056
117
if Object[ArrayPos0].Type == TypeName[Pole Trigger]
118
ArrayPos1 = ArrayPos0
119
ArrayPos1++
120
Object[ArrayPos0].CollisionTop = Object[ArrayPos0].PropertyValue
121
Object[ArrayPos0].CollisionTop <<= 3
122
Object[ArrayPos0].CollisionBottom = Object[ArrayPos0].CollisionTop
123
FlipSign(Object[ArrayPos0].CollisionTop)
124
Object[ArrayPos0].CollisionTop -= 8
125
Object[ArrayPos0].CollisionBottom += 8
126
end if
127
ArrayPos0++
128
loop
129
end sub
130
131
132
// ========================
133
// Editor Subs
134
// ========================
135
136
sub RSDKDraw
137
DrawSprite(0)
138
if Editor.ShowGizmos == true
139
Editor.DrawingOverlay = true
140
TempValue0 = Object.XPos
141
TempValue0 -= 0x40000
142
TempValue1 = Object.PropertyValue
143
TempValue1 <<= 3
144
TempValue2 = TempValue1
145
FlipSign(TempValue1)
146
TempValue1 -= 8
147
TempValue2 += 8
148
TempValue2 *= 2
149
TempValue1 <<= 16
150
TempValue1 += Object.YPos
151
DrawRectOutline(TempValue0, TempValue1, 8, TempValue2, 255, 255, 0, 255)
152
Editor.DrawingOverlay = false
153
end if
154
end sub
155
156
157
sub RSDKLoad
158
LoadSpriteSheet("Players/Sonic1.gif")
159
SpriteFrame(-16, -16, 32, 32, 75, 118) // #0 - Sonic spin
160
161
SetVariableAlias(ALIAS_VAR_PROPVAL, "verticalLength")
162
end sub
163
164