Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/GlassBumper.txt
1319 views
1
//------------Sonic CD Glass Bumper Particles 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
// HUD Alias
9
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
10
11
// States
12
#alias 0 : GLASSBUMPER_IDLE
13
#alias 1 : GLASSBUMPER_DESTROYED
14
15
// Gravity
16
#alias 1 : GRAVITY_AIR
17
18
// Stage SFX
19
#alias 8 : SFX_S_CRUMBLE
20
21
// Priority
22
#alias 1 : PRIORITY_ACTIVE
23
24
// Time Periods
25
#alias 0 : TIME_PRESENT
26
#alias 1 : TIME_PAST
27
#alias 2 : TIME_GOOD_FUTURE
28
#alias 3 : TIME_BAD_FUTURE
29
30
// Tile Info
31
#alias 0 : TILEINFO_INDEX
32
33
34
sub ObjectMain
35
if Object.State == GLASSBUMPER_DESTROYED
36
37
Object.Timer++
38
if Object.Timer > 15
39
Object.Type = TypeName[Blank Object]
40
end if
41
42
end if
43
end sub
44
45
46
sub ObjectPlayerInteraction
47
if Player.Animation != ANI_HURT
48
if Object.State == GLASSBUMPER_IDLE
49
PlayerObjectCollision(C_TOUCH, -14, -14, 14, 14)
50
if CheckResult == true
51
#platform: Use_Origins
52
if Player.Animation == ANI_CLIMBING
53
// Before bouncing him away, let's make sure Knuckles is in his normal air state, first
54
CallFunction(Player_CancelClimb)
55
end if
56
#endplatform
57
58
PlayStageSfx(SFX_S_CRUMBLE, false)
59
60
#platform: Use_Haptics
61
HapticEffect(10, 0, 0, 0)
62
#endplatform
63
64
CreateTempObject(TypeName[Object Score], 0, Object.XPos, Object.YPos)
65
Player.Score += 100
66
67
Object.State = GLASSBUMPER_DESTROYED
68
69
Object.Priority = PRIORITY_ACTIVE
70
71
TempValue0 = Player.XPos
72
TempValue0 -= Object.XPos
73
74
TempValue1 = Player.YPos
75
TempValue1 -= Object.YPos
76
77
ATan2(TempValue2, TempValue0, TempValue1)
78
Cos256(TempValue0, TempValue2)
79
Sin256(TempValue1, TempValue2)
80
81
TempValue0 *= 0x700
82
TempValue1 *= 0x700
83
84
Player.XVelocity = TempValue0
85
Player.YVelocity = TempValue1
86
Player.Speed = Player.XVelocity
87
88
Player.Gravity = GRAVITY_AIR
89
90
Player.Timer = 0
91
92
TempValue0 = Object.iXPos
93
TempValue1 = Object.iYPos
94
95
// Replace the bumper tiles with blank tiles
96
TempValue0 -= 8
97
TempValue1 -= 8
98
Set16x16TileInfo(0, TempValue0, TempValue1, TILEINFO_INDEX)
99
100
TempValue0 += 16
101
Set16x16TileInfo(0, TempValue0, TempValue1, TILEINFO_INDEX)
102
103
TempValue0 -= 16
104
TempValue1 += 16
105
Set16x16TileInfo(0, TempValue0, TempValue1, TILEINFO_INDEX)
106
107
TempValue0 += 16
108
Set16x16TileInfo(0, TempValue0, TempValue1, TILEINFO_INDEX)
109
110
end if
111
end if
112
end if
113
end sub
114
115
116
sub ObjectDraw
117
if Object.State == GLASSBUMPER_DESTROYED
118
TempValue0 = Object.Timer
119
TempValue0 >>= 3
120
DrawSprite(TempValue0)
121
end if
122
end sub
123
124
125
sub ObjectStartup
126
LoadSpriteSheet("R3/Objects3.gif")
127
128
switch HUD.CurrentTimePeriod
129
case TIME_PRESENT
130
SpriteFrame(-16, -16, 32, 32, 66, 1)
131
SpriteFrame(-16, -16, 32, 32, 99, 1)
132
break
133
case TIME_PAST
134
SpriteFrame(-16, -16, 32, 32, 66, 34)
135
SpriteFrame(-16, -16, 32, 32, 99, 34)
136
break
137
case TIME_GOOD_FUTURE
138
SpriteFrame(-16, -16, 32, 32, 66, 67)
139
SpriteFrame(-16, -16, 32, 32, 99, 67)
140
break
141
case TIME_BAD_FUTURE
142
SpriteFrame(-16, -16, 32, 32, 66, 100)
143
SpriteFrame(-16, -16, 32, 32, 99, 100)
144
break
145
end switch
146
end sub
147
148
149
// ========================
150
// Editor Subs
151
// ========================
152
153
sub RSDKDraw
154
Object.InkEffect = 1
155
DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)
156
end sub
157
158
159
sub RSDKLoad
160
LoadSpriteSheet("R3/Objects3.gif")
161
CallFunction(EditorHelpers_FindTimePeriod)
162
switch CheckResult
163
case TIME_PRESENT
164
SpriteFrame(-16, -16, 32, 32, 66, 1)
165
break
166
case TIME_PAST
167
SpriteFrame(-16, -16, 32, 32, 66, 34)
168
break
169
case TIME_GOOD_FUTURE
170
SpriteFrame(-16, -16, 32, 32, 66, 67)
171
break
172
case TIME_BAD_FUTURE
173
SpriteFrame(-16, -16, 32, 32, 66, 100)
174
break
175
end switch
176
end sub
177
178