Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/SpinGate.txt
1319 views
1
//-----------------Sonic CD Spin Gate 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.Turning
8
#alias Object.Value2 : Object.CurrentLight
9
10
// Gate Light Aliases
11
#alias Object[+1].Type : GateLight1.Type
12
#alias Object[+2].Type : GateLight2.Type
13
#alias Object[+3].Type : GateLight3.Type
14
15
// States
16
#alias 0 : SPINGATE_IDLE
17
#alias 1 : SPINGATE_TURNING
18
19
// Directions
20
#alias 2 : FACING_UPEND_RIGHT
21
22
23
sub ObjectMain
24
if Object.State == SPINGATE_TURNING
25
if Object.Timer < 96
26
Object.Timer++
27
else
28
Object.Timer = 0
29
Object.State = SPINGATE_IDLE
30
end if
31
end if
32
end sub
33
34
35
sub ObjectPlayerInteraction
36
if Object.State == SPINGATE_IDLE
37
38
PlayerObjectCollision(C_TOUCH, -8, -8, 8, 8)
39
if CheckResult == true
40
41
if Object.Turning == false
42
43
Object.State = SPINGATE_TURNING
44
45
Object.CurrentLight++
46
Object.CurrentLight &= 3
47
48
Object.Turning = true
49
50
switch Object.CurrentLight
51
case 0
52
GateLight1.Type = TypeName[Blank Object]
53
GateLight2.Type = TypeName[Blank Object]
54
GateLight3.Type = TypeName[Blank Object]
55
break
56
57
case 1
58
Object[+1].Type = TypeName[Gate Light]
59
break
60
61
case 2
62
Object[+2].Type = TypeName[Gate Light]
63
break
64
65
case 3
66
Object[+3].Type = TypeName[Gate Light]
67
break
68
69
end switch
70
71
end if
72
73
else
74
Object.Turning = false
75
end if
76
77
end if
78
end sub
79
80
81
sub ObjectDraw
82
TempValue0 = Object.Timer
83
TempValue0 >>= 2
84
TempValue0 &= 3
85
86
switch TempValue0
87
case 0
88
case 1
89
case 2
90
DrawSprite(TempValue0)
91
break
92
93
case 3
94
Object.Direction = FACING_UPEND_RIGHT
95
DrawSpriteFX(3, FX_FLIP, Object.XPos, Object.YPos)
96
break
97
98
end switch
99
end sub
100
101
102
sub ObjectStartup
103
LoadSpriteSheet("R3/Objects2.gif")
104
105
SpriteFrame(-16, -8, 32, 16, 18, 50) // #0 - Spin Gate
106
SpriteFrame(-16, -16, 32, 32, 51, 0) // #1 - Spin Gate Rotate Frame 0
107
SpriteFrame(-16, -16, 32, 32, 84, 0) // #2 - Spin Gate Rotate Frame 1
108
SpriteFrame(-16, -16, 32, 32, 51, 0) // #3 - Spin Gate Rotate Frame 2
109
end sub
110
111
112
// ========================
113
// Editor Subs
114
// ========================
115
116
sub RSDKDraw
117
DrawSprite(0)
118
end sub
119
120
121
sub RSDKLoad
122
LoadSpriteSheet("R3/Objects2.gif")
123
124
SpriteFrame(-16, -8, 32, 16, 18, 50) // #0 - Spin Gate
125
126
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
127
end sub
128
129