Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Global/WarpStar.txt
1319 views
1
//-----------------Sonic CD Warp Star 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.RandFadeTimer
8
#alias Object.Value2 : Object.YVelocity
9
10
// States
11
#alias 0 : WARPSTAR_SPAWN
12
#alias 1 : WARPSTAR_FADE_OUT
13
#alias 2 : WARPSTAR_CUTSCENE
14
15
// Ink Effects
16
#alias 2 : INK_ALPHA
17
18
19
sub ObjectMain
20
switch Object.State
21
case WARPSTAR_SPAWN
22
Warp.Count++
23
if Warp.Count > 2
24
Warp.Count = 0
25
end if
26
27
Object.Timer--
28
if Object.Timer < 1
29
30
if Warp.Timer > 0
31
Warp.Frame = Object.Frame
32
Object.State = WARPSTAR_FADE_OUT
33
Object.InkEffect = INK_ALPHA
34
Object.Alpha = 255
35
CreateTempObject(TypeName[Warp Star], 0, Player.XPos, Player.YPos)
36
if Player.Speed < 0
37
Object[TempObjectPos].Timer = Player.Speed
38
FlipSign(Object[TempObjectPos].Timer)
39
else
40
Object[TempObjectPos].Timer = Player.Speed
41
end if
42
Object[TempObjectPos].Timer >>= 19
43
Object[TempObjectPos].Timer += 7
44
Object[TempObjectPos].DrawOrder = 4
45
Object[TempObjectPos].Frame = Object.Frame
46
else
47
Object.Type = TypeName[Blank Object]
48
end if
49
50
else
51
52
if Warp.Timer == 0
53
Object.Type = TypeName[Blank Object]
54
end if
55
56
end if
57
break
58
59
case WARPSTAR_FADE_OUT
60
Object.Timer++
61
Object.Alpha -= 8
62
if Object.Timer == 16
63
Object.Type = TypeName[Blank Object]
64
end if
65
break
66
67
case WARPSTAR_CUTSCENE
68
Object.YVelocity += 0x3000
69
Object.YPos += Object.YVelocity
70
Object.Timer++
71
if Object.Timer == Object.RandFadeTimer
72
Object.Type = TypeName[Blank Object]
73
end if
74
break
75
76
end switch
77
end sub
78
79
80
sub ObjectDraw
81
switch Object.State
82
case WARPSTAR_SPAWN
83
if Warp.Timer > 0
84
DrawSprite(Object.Frame)
85
end if
86
Object.Frame++
87
Object.Frame &= 3
88
break
89
90
case WARPSTAR_FADE_OUT
91
if Warp.Count != 2
92
if Warp.Timer > 0
93
DrawSpriteFX(Warp.Frame, FX_INK, Object.XPos, Object.YPos)
94
end if
95
end if
96
break
97
98
case WARPSTAR_CUTSCENE
99
TempValue0 = Object.Frame
100
TempValue0 >>= 1
101
DrawSprite(TempValue0)
102
103
Object.Frame++
104
Object.Frame &= 7
105
break
106
end switch
107
end sub
108
109
110
sub ObjectStartup
111
LoadSpriteSheet("Global/Items3.gif")
112
113
SpriteFrame(-16, -16, 32, 32, 50, 133) // #0 - Warp Star Frame 0
114
SpriteFrame(-16, -16, 32, 32, 50, 166) // #1 - Warp Star Frame 1
115
SpriteFrame(-24, -24, 48, 48, 1, 197) // #2 - Warp Star Frame 2
116
SpriteFrame(-16, -16, 32, 32, 50, 199) // #3 - Warp Star Frame 3
117
SpriteFrame(-12, -12, 24, 24, 148, 152) // #4 - Warp Star Frame 4
118
end sub
119
120
121
// ========================
122
// Editor Subs
123
// ========================
124
125
sub RSDKDraw
126
DrawSprite(0)
127
end sub
128
129
130
sub RSDKLoad
131
LoadSpriteSheet("Global/Items3.gif")
132
SpriteFrame(-16, -16, 32, 32, 50, 133) // #0 - Warp Star Frame 0
133
134
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
135
end sub
136
137