Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/BossPlatform.txt
1319 views
1
//---------------Sonic CD Boss Platform Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value1 : Object.YOriginPos
7
#alias Object.Value2 : Object.YVelocity
8
#alias Object.Value3 : Object.FallSpeed
9
#alias Object.Value4 : Object.FloorYPos
10
#alias Object.Value5 : Object.FCEntityNo
11
#alias Object.Value6 : Object.IntangibleTime
12
13
#alias Object.State : FloorControl.State
14
#alias Object.Value0 : FloorControl.Timer
15
16
// HUD Alias
17
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
18
19
// Floor Control aliases
20
#alias 4 : FLOORCONTROL_TILE_SWAP
21
22
// Collision Sides
23
#alias 0 : CSIDE_FLOOR
24
25
// Player Collision
26
#alias 1 : PLAYER_COL_FLOOR
27
#alias 4 : PLAYER_COL_ROOF
28
29
// Stage SFX
30
#alias 3 : SFX_S_IMPACT1
31
32
// Time Periods
33
#alias 2 : TIME_GOOD_FUTURE
34
35
36
sub ObjectMain
37
Object.YOriginPos = Object.YPos
38
39
if Object.FallSpeed > 0
40
Object.YVelocity += Object.FallSpeed
41
Object.YPos += Object.YVelocity
42
43
ObjectTileCollision(CSIDE_FLOOR, -16, 16, 0)
44
TempValue0 = CheckResult
45
ObjectTileCollision(CSIDE_FLOOR, 16, 16, 0)
46
TempValue0 |= CheckResult
47
if TempValue0 == true
48
PlayStageSfx(SFX_S_IMPACT1, false)
49
Object.FallSpeed = 0
50
Object.YVelocity = 0
51
52
#platform: Use_Haptics
53
HapticEffect(96, 0, 0, 0)
54
#endplatform
55
56
end if
57
else
58
ArrayPos0 = Object.FCEntityNo
59
if FloorControl[ArrayPos0].State == FLOORCONTROL_TILE_SWAP
60
if FloorControl[ArrayPos0].Timer > 29
61
PlayerObjectCollision(C_TOUCH, -16, -512, 16, 512)
62
if CheckResult == true
63
Object.FallSpeed = 3584
64
65
#platform: Use_Haptics
66
HapticEffect(44, 0, 0, 0)
67
#endplatform
68
69
else
70
Object.FallSpeed = 2816
71
end if
72
Object.YVelocity = -0x60000
73
end if
74
end if
75
76
end if
77
78
Object.FloorYPos = Object.YPos
79
Object.FloorYPos -= Object.YOriginPos
80
81
if Object.IntangibleTime > 0
82
Object.IntangibleTime--
83
end if
84
end sub
85
86
87
sub ObjectPlayerInteraction
88
if Object.IntangibleTime == 0
89
TempValue0 = Object.YPos
90
Object.YPos = Object.YOriginPos
91
92
PlayerObjectCollision(C_BOX, -16, -18, 16, 16)
93
if CheckResult == PLAYER_COL_FLOOR
94
Player.YPos += Object.FloorYPos
95
Player.YPos += 0x20000
96
else
97
if Object.FallSpeed > 0
98
if CheckResult == PLAYER_COL_ROOF
99
CallFunction(Player_Hit)
100
if Player.State == Player_State_GotHit
101
Object.IntangibleTime = 20
102
end if
103
end if
104
end if
105
106
PlayerObjectCollision(C_TOUCH, -16, -32, 16, 16)
107
if CheckResult == true
108
if Player.YVelocity < -0x40000
109
if Player.JumpPress == true
110
TempValue1 = Object.YVelocity
111
TempValue1 >>= 1
112
Player.YVelocity += TempValue1
113
end if
114
end if
115
end if
116
end if
117
Object.YPos = TempValue0
118
end if
119
end sub
120
121
122
sub ObjectDraw
123
DrawSprite(0)
124
end sub
125
126
127
sub ObjectStartup
128
LoadSpriteSheet("R6/Objects3.gif")
129
130
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
131
SpriteFrame(-16, -16, 32, 32, 223, 200) // #0 - Boss Platform
132
else
133
SpriteFrame(-16, -16, 32, 32, 141, 220) // #0 - Boss Platform
134
end if
135
end sub
136
137
138
// ========================
139
// Editor Subs
140
// ========================
141
142
sub RSDKDraw
143
DrawSprite(0)
144
end sub
145
146
147
sub RSDKLoad
148
LoadSpriteSheet("R6/Objects3.gif")
149
CallFunction(EditorHelpers_FindTimePeriod)
150
// #0 - Boss Platform
151
if CheckResult == TIME_GOOD_FUTURE
152
SpriteFrame(-16, -16, 32, 32, 223, 200)
153
else
154
SpriteFrame(-16, -16, 32, 32, 141, 220)
155
end if
156
157
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
158
end sub
159
160