Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/EPlatform.txt
1319 views
1
//---------------Sonic CD Eggman Platform Script--------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.HitboxLeft
7
#alias Object.Value1 : Object.HitboxRight
8
#alias Object.Value2 : Object.Length
9
#alias Object.Value3 : Object.MusicFade
10
11
// States
12
#alias 0 : EPLATFORM_IDLE
13
#alias 1 : EPLATFORM_EXTEND_LARGE
14
#alias 2 : EPLATFORM_EXTEND_SHORT
15
#alias 3 : EPLATFORM_BLANK
16
17
// Property Values
18
#alias 6 : EPLATFORM_SHORT
19
#alias 8 : EPLATFORM_LARGE
20
21
// Priority
22
#alias 0 : PRIORITY_BOUNDS
23
#alias 1 : PRIORITY_ACTIVE
24
25
26
sub ObjectMain
27
switch Object.State
28
case EPLATFORM_IDLE
29
if Object.PropertyValue == EPLATFORM_LARGE // check if it's the platform used by Eggman
30
31
PlayerObjectCollision(C_TOUCH, -64, -64, 64, -48)
32
if CheckResult == true
33
Object.State = EPLATFORM_EXTEND_LARGE
34
Stage.NewYBoundary2 = Object.iYPos
35
Stage.NewYBoundary2 += 24
36
end if
37
38
else
39
40
TempValue0 = Object.HitboxRight
41
TempValue0 += 32
42
TempValue0 <<= 16
43
TempValue0 += Object.XPos
44
if Player.XPos > TempValue0
45
Object.State = EPLATFORM_EXTEND_SHORT
46
Object.Priority = PRIORITY_ACTIVE
47
end if
48
49
end if
50
break
51
52
case EPLATFORM_EXTEND_LARGE
53
if Object.Length < Object.PropertyValue
54
Object.Length++
55
Object.HitboxLeft -= 16
56
else
57
Object.State = EPLATFORM_BLANK
58
end if
59
break
60
61
case EPLATFORM_EXTEND_SHORT
62
if Object.Length < Object.PropertyValue
63
Object.Length++
64
Object.HitboxLeft -= 16
65
end if
66
// Start the boss music
67
if Object.MusicFade < 100
68
Object.MusicFade++
69
Music.Volume--
70
else
71
PlayMusic(4)
72
Object.State = EPLATFORM_BLANK
73
Object.Priority = PRIORITY_BOUNDS
74
end if
75
break
76
77
case EPLATFORM_BLANK
78
break
79
end switch
80
end sub
81
82
83
sub ObjectPlayerInteraction
84
PlayerObjectCollision(C_PLATFORM, Object.HitboxLeft, -16, Object.HitBoxRight, 16)
85
end sub
86
87
88
sub ObjectDraw
89
TempValue0 = 0
90
TempValue1 = Object.HitBoxRight
91
TempValue1 <<= 16
92
TempValue1 -= 0x80000
93
TempValue1 += Object.XPos
94
while TempValue0 < Object.Length
95
DrawSpriteXY(0, TempValue1, Object.YPos)
96
TempValue0++
97
TempValue1 -= 0x100000
98
loop
99
end sub
100
101
102
sub ObjectStartup
103
LoadSpriteSheet("R3/Objects2.gif")
104
105
SpriteFrame(-8, -16, 16, 32, 117, 0) // #0 - Eggman Platform
106
107
// Used to be below LoadSpriteSheet, moved here for consistency
108
ArrayPos0 = 32
109
while ArrayPos0 < 1056
110
if Object[ArrayPos0].Type == TypeName[EPlatform]
111
Object[ArrayPos0].HitBoxRight = Object[ArrayPos0].PropertyValue
112
Object[ArrayPos0].HitBoxRight <<= 3
113
Object[ArrayPos0].HitboxLeft = Object[ArrayPos0].HitBoxRight
114
end if
115
ArrayPos0++
116
loop
117
end sub
118
119
120
// ========================
121
// Editor Subs
122
// ========================
123
124
sub RSDKDraw
125
DrawSprite(0)
126
TempValue0 = Object.PropertyValue
127
TempValue0 <<= 3
128
TempValue1 = TempValue0
129
130
TempValue2 = 0
131
TempValue3 = TempValue0
132
TempValue3 <<= 16
133
TempValue3 -= 0x80000
134
TempValue3 += Object.XPos
135
while TempValue2 < Object.PropertyValue
136
DrawSpriteXY(0, TempValue3, Object.YPos)
137
TempValue2++
138
TempValue3 -= 0x100000
139
loop
140
end sub
141
142
143
sub RSDKLoad
144
LoadSpriteSheet("R3/Objects2.gif")
145
146
SpriteFrame(-8, -16, 16, 32, 117, 0) // #0 - Eggman Platform
147
148
SetVariableAlias(ALIAS_VAR_PROPVAL, "Length")
149
end sub
150
151