Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R5/StaticRock.txt
1319 views
1
//----------------Sonic CD Static Rock Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Collision Modes
6
#alias 1 : CMODE_LWALL
7
#alias 3 : CMODE_RWALL
8
9
10
sub ObjectPlayerInteraction
11
12
switch Object.PropertyValue
13
case 0
14
PlayerObjectCollision(C_BOX, -16, -16, 16, 16)
15
break
16
17
case 1
18
PlayerObjectCollision(C_TOUCH, -16, -14, 16, 16)
19
if CheckResult == true
20
if Player.XPos < Object.XPos
21
// Move the player to be 16 pixels to the left of the object
22
23
Player.XPos = Player.CollisionLeft
24
Player.XPos <<= 16
25
Player.XPos += Object.XPos
26
Player.XPos -= 0x100000
27
else
28
// Move the player to be 16 pixels to the right of the object
29
30
Player.XPos = Player.CollisionRight
31
Player.XPos <<= 16
32
Player.XPos += Object.XPos
33
Player.XPos += 0x100000
34
end if
35
end if
36
break
37
38
case 2
39
// Some cases for Wall Collision Modes
40
if Player.CollisionMode == CMODE_LWALL
41
PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)
42
if CheckResult == true
43
Player.YPos = Player.CollisionBottom
44
Player.YPos <<= 16
45
Player.YPos += Object.YPos
46
Player.YPos += 0x100000
47
Player.Speed = 0
48
end if
49
end if
50
51
if Player.CollisionMode == CMODE_RWALL
52
PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)
53
if CheckResult == true
54
Player.YPos = Player.CollisionBottom
55
Player.YPos <<= 16
56
Player.YPos += Object.YPos
57
Player.YPos += 0x100000
58
Player.Speed = 0
59
end if
60
end if
61
break
62
63
end switch
64
65
// pardon?
66
// What is this even supposed to be, there's not even an if statement that'd need these...
67
// else
68
// ???
69
// These have been uncommented since they'd would cause a crash if function count was ever changed,
70
// but they do exist in the original code for whatever reason
71
// end if
72
73
end sub
74
75
76
sub ObjectDraw
77
DrawSprite(Object.PropertyValue)
78
end sub
79
80
81
sub ObjectStartup
82
LoadSpriteSheet("R5/Objects.gif")
83
84
// 0 - Rock Frame
85
SpriteFrame(-16, -16, 32, 32, 92, 18)
86
87
// 1-2 - Invisible Frames
88
// (here for ease in drawing)
89
SpriteFrame(0, 0, 0, 0, 1, 1)
90
SpriteFrame(0, 0, 0, 0, 1, 1)
91
92
end sub
93
94
95
// ========================
96
// Editor Subs
97
// ========================
98
99
sub RSDKEdit
100
if Editor.ReturnVariable == true
101
switch Editor.VariableID
102
case EDIT_VAR_PROPVAL // Property Value
103
CheckResult = Object.PropertyValue
104
break
105
case 0 // Type
106
CheckResult = Object.PropertyValue
107
break
108
end switch
109
else
110
switch Editor.VariableID
111
case EDIT_VAR_PROPVAL // Property Value
112
Object.PropertyValue = Editor.VariableValue
113
break
114
case 0 // Type
115
Object.PropertyValue = Editor.VariableValue
116
break
117
end switch
118
end if
119
end sub
120
121
122
sub RSDKDraw
123
CheckGreater(Object.PropertyValue, 0)
124
Object.InkEffect = CheckResult
125
DrawSprite(Object.PropertyValue, FX_INK, Object.XPos, Object.YPos)
126
127
TempValue0 = 16
128
switch Object.PropertyValue
129
case 1
130
// Slightly different box size makes everything wonky - can't draw a blend version of the box since then it'd technically be representing the wrong size...
131
TempValue0 = 14
132
case 2
133
TempValue1 = TempValue0
134
TempValue1 += 16
135
TempValue2 = Object.iXPos
136
TempValue2 -= TempValue0
137
TempValue3 = Object.iYPos
138
TempValue3 -= 16
139
DrawRectOutline(TempValue2, TempValue3, 32, TempValue1, 255, 255, 255, 255)
140
break
141
end switch
142
end sub
143
144
145
sub RSDKLoad
146
LoadSpriteSheet("R5/Objects.gif")
147
SpriteFrame(-16, -16, 32, 32, 92, 18)
148
SpriteFrame(-16, -14, 32, 30, 94, 18)
149
SpriteFrame(-16, -16, 32, 32, 92, 18)
150
151
AddEditorVariable("Type")
152
SetActiveVariable("Type")
153
AddEnumVariable("Normal Block", 0)
154
AddEnumVariable("Invsible (Floor)", 1)
155
AddEnumVariable("Invisible (Roof)", 2)
156
end sub
157
158