Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Global/TimeWarpFix.txt
1319 views
1
//---------------Sonic CD Time Warp Fix 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
8
// Property Values
9
#alias 0 : TIMEWARPFIX_ERASE_TOUCH // Touch this while trying to warp, no more time travel for you
10
#alias 1 : TIMEWARPFIX_ERASE_AREA // Get past this, no more warp for you
11
#alias 2 : TIMEWARPFIX_SAVE_POINT // Sets your position to the next object after time-travelling
12
#alias 3 : TIMEWARPFIX_SAVE_POINT_AIR // Sets your position to the next object after time-travelling, but in the air
13
#alias 4 : TIMEWARPFIX_FORCE_ERASE_TOUCH // Touch this, no more time travel for you (introduced in Origins Plus)
14
15
// Gravity
16
#alias 1 : GRAVITY_AIR
17
18
// Warp Destination
19
#alias 0 : WARP_NONE
20
21
22
sub ObjectMain
23
switch Object.PropertyValue
24
case TIMEWARPFIX_ERASE_TOUCH
25
PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)
26
if CheckResult == true
27
if Warp.Destination > WARP_NONE
28
if Warp.Timer > 99
29
if Warp.Timer < 220 // They forgot to fix the warp timer here
30
Warp.Destination = WARP_NONE
31
end if
32
end if
33
34
Warp.Timer = 0
35
end if
36
end if
37
break
38
39
case TIMEWARPFIX_ERASE_AREA
40
if Player.XPos < Object.XPos
41
Warp.Destination = WARP_NONE
42
Warp.Timer = 0
43
end if
44
break
45
46
case TIMEWARPFIX_SAVE_POINT
47
PlayerObjectCollision(C_TOUCH, -48, -48, 48, 48)
48
if CheckResult == true
49
Object.Type = TypeName[Blank Object]
50
Player.XPos = Object[+1].XPos
51
Player.YPos = Object[+1].YPos
52
end if
53
54
Object.Timer++
55
if Object.Timer == 2
56
Object.Type = TypeName[Blank Object]
57
end if
58
break
59
60
case TIMEWARPFIX_SAVE_POINT_AIR
61
PlayerObjectCollision(C_TOUCH, -96, -96, 96, 96)
62
if CheckResult == true
63
Object.Type = TypeName[Blank Object]
64
Player.XPos = Object[+1].XPos
65
Player.YPos = Object[+1].YPos
66
Player.Gravity = GRAVITY_AIR
67
end if
68
69
Object.Timer++
70
if Object.Timer == 2
71
Object.Type = TypeName[Blank Object]
72
end if
73
break
74
75
case TIMEWARPFIX_FORCE_ERASE_TOUCH
76
#platform: Use_Origins
77
PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)
78
if CheckResult == true
79
if Warp.Destination > WARP_NONE
80
Warp.Destination = WARP_NONE
81
Warp.Timer = 0
82
end if
83
end if
84
#endplatform
85
break
86
87
end switch
88
end sub
89
90
91
sub ObjectPlayerInteraction
92
93
// Check some interaction with the Player... but don't do anything with it
94
PlayerObjectCollision(C_TOUCH, -14, -15, 14, 16)
95
96
// All the actual interaction is handled in ObjectMain instead, which is certainly quite the risky business..
97
98
end sub
99
100
101
sub ObjectStartup
102
103
// Well this event exists in the object's ByteCode, but there's not actually any code within it...
104
105
end sub
106
107
108
// ========================
109
// Editor Subs
110
// ========================
111
112
sub RSDKEdit
113
if Editor.ReturnVariable == true
114
switch Editor.VariableID
115
case EDIT_VAR_PROPVAL // Property Value
116
CheckResult = Object.PropertyValue
117
break
118
case 0 // Type
119
CheckResult = Object.PropertyValue
120
CheckResult &= 3
121
break
122
end switch
123
else
124
switch Editor.VariableID
125
case EDIT_VAR_PROPVAL // Property Value
126
Object.PropertyValue = Editor.VariableValue
127
break
128
case 0 // Type
129
Object.PropertyValue = Editor.VariableValue
130
Object.PropertyValue &= 3
131
break
132
end switch
133
end if
134
end sub
135
136
137
sub RSDKDraw
138
DrawSprite(0)
139
140
if Editor.ShowGizmos == true
141
Editor.DrawingOverlay = true
142
143
TempValue0 = -1
144
145
switch Object.PropertyValue
146
case TIMEWARPFIX_ERASE_TOUCH
147
case TIMEWARPFIX_FORCE_ERASE_TOUCH
148
TempValue0 = 16; TempValue1 = 16; TempValue2 = 16; TempValue3 = 16;
149
break
150
151
case TIMEWARPFIX_ERASE_AREA
152
// Draw a rightward arrow, should convey what this object does well enough
153
TempValue1 = Object.XPos
154
TempValue1 += 0x380000
155
DrawArrow(Object.XPos, Object.YPos, TempValue1, Object.YPos, 0, 0, 255)
156
break
157
158
case TIMEWARPFIX_SAVE_POINT
159
TempValue0 = 48; TempValue1 = 48; TempValue2 = 48; TempValue3 = 48;
160
161
// Draw an arrow to where the player will be sent
162
DrawArrow(Object.XPos, Object.YPos, Object[+1].XPos, Object[+1].YPos, 255, 255, 0)
163
break
164
165
case TIMEWARPFIX_SAVE_POINT_AIR
166
TempValue0 = 96; TempValue1 = 96; TempValue2 = 96; TempValue3 = 96;
167
168
// Draw an arrow to where the player will be sent
169
DrawArrow(Object.XPos, Object.YPos, Object[+1].XPos, Object[+1].YPos, 255, 255, 0)
170
break
171
172
end switch
173
174
if TempValue0 != -1
175
CallFunction(EditorHelpers_DrawHitbox)
176
end if
177
178
Editor.DrawingOverlay = false
179
end if
180
end sub
181
182
183
sub RSDKLoad
184
LoadSpriteSheet("Global/Display.gif")
185
SpriteFrame(-8, -8, 16, 16, 173, 67) // "T" (rigger) Icon
186
187
AddEditorVariable("Type")
188
SetActiveVariable("Type")
189
AddEnumVariable("Erase Time Warp on Touch", 0)
190
AddEnumVariable("Erase Time Warp on Pass", 1)
191
AddEnumVariable("Set Time Warp Pos (Ground)", 2)
192
AddEnumVariable("Set Time Warp Pos (Air)", 3)
193
AddEnumVariable("Erase Time Warp on Touch", 4)
194
end sub
195
196