Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/VPlatform.txt
1319 views
1
//-------------Sonic CD Vertical Platform Script--------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value1 : Object.YCollisionOffset
7
#alias Object.Value2 : Object.YVelocity
8
#alias Object.Value3 : Object.Angle
9
10
// Property Values
11
#alias 0 : START_MOVING_DOWN
12
#alias 1 : START_MOVING_UP
13
14
// Collision
15
#alias 1 : PLAYER_COL_FLOOR
16
17
18
sub ObjectMain
19
Object.Angle = Oscillation
20
Object.Angle *= 3
21
if Object.PropertyValue == START_MOVING_UP
22
Object.Angle += 256
23
end if
24
25
Sin(Object.YVelocity, Object.Angle)
26
Object.YVelocity *= 0x2700
27
Object.YVelocity += Object.YPos
28
Object.YVelocity &= 0xFFFF0000 // Truncate the value
29
Object.YVelocity -= Object.YCollisionOffset
30
end sub
31
32
33
sub ObjectPlayerInteraction
34
TempValue0 = Object.YPos
35
Object.YPos = Object.YCollisionOffset
36
PlayerObjectCollision(C_PLATFORM, -32, -16, 32, 12)
37
if CheckResult == PLAYER_COL_FLOOR
38
Player.YPos += Object.YVelocity
39
end if
40
Object.YPos = TempValue0
41
end sub
42
43
44
sub ObjectDraw
45
Sin(Object.YCollisionOffset, Object.Angle)
46
Object.YCollisionOffset *= 0x2700
47
Object.YCollisionOffset += Object.YPos
48
Object.YCollisionOffset &= 0xFFFF0000 // Truncate the value
49
DrawSpriteXY(0, Object.XPos, Object.YCollisionOffset)
50
end sub
51
52
53
sub ObjectStartup
54
LoadSpriteSheet("R3/Objects.gif")
55
56
SpriteFrame(-32, -16, 64, 32, 100, 1) // #0 - Vertical Platform
57
end sub
58
59
60
// ========================
61
// Editor Subs
62
// ========================
63
64
sub RSDKEdit
65
if Editor.ReturnVariable == true
66
switch Editor.VariableID
67
case EDIT_VAR_PROPVAL // Property Value
68
CheckResult = Object.PropertyValue
69
CheckResult &= 1
70
break
71
case 0 // Type
72
CheckResult = Object.PropertyValue
73
CheckResult &= 1
74
break
75
end switch
76
else
77
switch Editor.VariableID
78
case EDIT_VAR_PROPVAL // Property Value
79
Object.PropertyValue = Editor.VariableValue
80
Object.PropertyValue &= 1
81
break
82
case 0 // Type
83
Object.PropertyValue = Editor.VariableValue
84
Object.PropertyValue &= 1
85
break
86
end switch
87
end if
88
end sub
89
90
sub RSDKDraw
91
92
DrawSprite(0)
93
94
switch Object.PropertyValue
95
case START_MOVING_DOWN
96
TempValue1 = 255
97
TempValue2 = 255
98
TempValue3 = 128
99
TempValue4 = 0
100
break
101
case START_MOVING_UP
102
TempValue1 = 128
103
TempValue2 = 0
104
TempValue3 = 255
105
TempValue4 = 255
106
break
107
end switch
108
109
TempValue0 = Object.YPos
110
TempValue0 -= 0x620000
111
TempValue5 = Object.XPos
112
TempValue5 -= 0x200000
113
if object.PropertyValue == START_MOVING_DOWN
114
if Editor.ShowGizmos == true
115
Editor.DrawingOverlay = true
116
DrawRectOutline(TempValue5, TempValue0, 0x40, 0xC4, 255, 255, 255, 255)
117
DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, TempValue1, TempValue2, 0)
118
Editor.DrawingOverlay = false
119
end if
120
else
121
DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, TempValue1, TempValue2, 0)
122
end if
123
124
TempValue0 = Object.YPos
125
TempValue0 += 0x620000
126
if object.PropertyValue == START_MOVING_UP
127
if Editor.ShowGizmos == true
128
Editor.DrawingOverlay = true
129
DrawRectOutline(TempValue5, TempValue0, 0x40, 0xC4, 255, 255, 255, 255)
130
DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, TempValue3, TempValue4, 0)
131
Editor.DrawingOverlay = false
132
end if
133
else
134
DrawArrow(Object.XPos, Object.YPos, Object.XPos, TempValue0, 255, TempValue3, TempValue4, 0)
135
end if
136
end sub
137
138
139
sub RSDKLoad
140
LoadSpriteSheet("R3/Objects.gif")
141
142
SpriteFrame(-32, -16, 64, 32, 100, 1) // #0 - Vertical Platform
143
144
AddEditorVariable("startDir")
145
SetActiveVariable("startDir")
146
147
AddEnumVariable("Down", START_MOVING_DOWN)
148
AddEnumVariable("Up", START_MOVING_UP)
149
end sub
150
151