Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/StarBush.txt
1319 views
1
//----------------Sonic CD Star Bush Script-------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.XOriginPos // Set by Ramp3D
7
8
// Property Values
9
#alias 0 : FOREGROUND_BUSH // technically a lie since the draworder is bugged
10
#alias 1 : SMALL_BUSH
11
#alias 2 : BACKGROUND_BUSH
12
13
14
sub ObjectDraw
15
if Object.PropertyValue == FOREGROUND_BUSH
16
DrawSpriteXY(0, Object.XOriginPos, Object.YPos)
17
else
18
DrawSprite(Object.PropertyValue)
19
end if
20
end sub
21
22
23
sub ObjectStartup
24
LoadSpriteSheet("R1/Objects2.gif")
25
26
SpriteFrame(-24, -20, 48, 40, 115, 131) // #0 - Big StarBush
27
SpriteFrame(-12, -12, 24, 24, 1, 229) // #1 - Small StarBush
28
SpriteFrame(-24, -20, 48, 40, 115, 131) // #2 - Big StarBush (Background)
29
30
// Used to be below LoadSpriteSheet, moved down for consistency
31
ArrayPos0 = 32
32
while ArrayPos0 < 1056
33
if Object[ArrayPos0].Type == TypeName[Star Bush]
34
if Object[ArrayPos0].PropertyValue == FOREGROUND_BUSH
35
Object[ArrayPos0].DrawOrder = 4 // this should be 5
36
end if
37
38
if Object[ArrayPos0].PropertyValue == BACKGROUND_BUSH
39
Object[ArrayPos0].DrawOrder = 4
40
end if
41
end if
42
ArrayPos0++
43
loop
44
end sub
45
46
47
// ========================
48
// Editor Subs
49
// ========================
50
51
sub RSDKEdit
52
if Editor.ReturnVariable == true
53
switch Editor.VariableID
54
case EDIT_VAR_PROPVAL // Property Value
55
CheckResult = Object.PropertyValue
56
break
57
case 0 // type
58
CheckResult = Object.PropertyValue
59
break
60
end switch
61
else
62
switch Editor.VariableID
63
case EDIT_VAR_PROPVAL // Property Value
64
Object.PropertyValue = Editor.VariableValue
65
break
66
case 0 // type
67
Object.PropertyValue = Editor.VariableValue
68
break
69
end switch
70
end if
71
end sub
72
73
74
sub RSDKDraw
75
DrawSprite(0)
76
end sub
77
78
79
sub RSDKLoad
80
LoadSpriteSheet("R1/Objects2.gif")
81
82
SpriteFrame(-24, -20, 48, 40, 115, 131) // #0 - Big StarBush
83
SpriteFrame(-12, -12, 24, 24, 1, 229) // #1 - Small StarBush
84
SpriteFrame(-24, -20, 48, 40, 115, 131) // #2 - Big StarBush (Background)
85
86
87
AddEditorVariable("type")
88
SetActiveVariable("type")
89
AddEnumVariable("Big Bush (3D Ramp)", 0)
90
AddEnumVariable("Small Bush", 1)
91
AddEnumVariable("Big Bush (Background)", 2)
92
end sub
93
94