Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/FloorRubble.txt
1319 views
1
//---------------Sonic CD Floor Rubble Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.RubbleType
7
#alias Object.Value1 : Object.XVelocity
8
#alias Object.Value2 : Object.YVelocity
9
#alias Object.Value3 : Object.FallSpeed
10
11
// Property Values
12
#alias 0 : BIG_RUBBLE
13
#alias 1 : BIG_RUBBLE_ALT
14
#alias 2 : RUBBLE_CHUNK_1
15
#alias 3 : RUBBLE_CHUNK_2
16
#alias 4 : RUBBLE_CHUNK_3
17
#alias 5 : RUBBLE_CHUNK_4
18
19
// Collision Sides
20
#alias 0 : CSIDE_FLOOR
21
22
23
sub ObjectMain
24
Object.XPos += Object.XVelocity
25
Object.YVelocity += Object.FallSpeed
26
Object.YPos += Object.YVelocity
27
28
if Object.PropertyValue == BIG_RUBBLE
29
ObjectTileCollision(CSIDE_FLOOR, 0, 8, 0)
30
if CheckResult == true
31
Object.Type = TypeName[Blank Object]
32
CreateTempObject(TypeName[Floor Rubble], RUBBLE_CHUNK_1, Object.XPos, Object.YPos)
33
Object[TempObjectPos].XPos -= 0x40000
34
Object[TempObjectPos].YPos -= 0x40000
35
Object[TempObjectPos].XVelocity = -0x10000
36
Object[TempObjectPos].YVelocity = -0x28000
37
Object[TempObjectPos].FallSpeed = 0x3000
38
39
CreateTempObject(TypeName[Floor Rubble], RUBBLE_CHUNK_2, Object.XPos, Object.YPos)
40
Object[TempObjectPos].XPos += 0x40000
41
Object[TempObjectPos].YPos -= 0x40000
42
Object[TempObjectPos].XVelocity = 0x10000
43
Object[TempObjectPos].YVelocity = -0x28000
44
Object[TempObjectPos].FallSpeed = 0x3000
45
46
CreateTempObject(TypeName[Floor Rubble], RUBBLE_CHUNK_3, Object.XPos, Object.YPos)
47
Object[TempObjectPos].XPos -= 0x40000
48
Object[TempObjectPos].YPos += 0x40000
49
Object[TempObjectPos].XVelocity = -0x20000
50
Object[TempObjectPos].YVelocity = -0x1C000
51
Object[TempObjectPos].FallSpeed = 0x3000
52
53
CreateTempObject(TypeName[Floor Rubble], RUBBLE_CHUNK_4, Object.XPos, Object.YPos)
54
Object[TempObjectPos].XPos += 0x40000
55
Object[TempObjectPos].YPos += 0x40000
56
Object[TempObjectPos].XVelocity = 0x20000
57
Object[TempObjectPos].YVelocity = -0x1C000
58
Object[TempObjectPos].FallSpeed = 0x3000
59
end if
60
else
61
if Object.OutOfBounds == true
62
Object.Type = TypeName[Blank Object]
63
end if
64
end if
65
end sub
66
67
68
sub ObjectDraw
69
if Object.PropertyValue == BIG_RUBBLE
70
TempValue0 = Object.RubbleType
71
TempValue0 /= 10
72
DrawSprite(TempValue0)
73
74
Object.RubbleType++
75
Object.RubbleType %= 20
76
else
77
DrawSprite(Object.PropertyValue)
78
end if
79
end sub
80
81
82
sub ObjectStartup
83
LoadSpriteSheet("R6/Objects2.gif")
84
85
SpriteFrame(-8, -8, 16, 16, 165, 191) // #0 - Big rubble
86
SpriteFrame(-8, -8, 16, 16, 181, 191) // #1 - Big rubble alt
87
88
SpriteFrame(-4, -4, 8, 8, 165, 191) // #2 - Rubble chunk 1
89
SpriteFrame(-4, -4, 8, 8, 173, 191) // #3 - Rubble chunk 2
90
SpriteFrame(-4, -4, 8, 8, 165, 199) // #4 - Rubble chunk alt 1
91
SpriteFrame(-4, -4, 8, 8, 173, 199) // #5 - Rubble chunk alt 2
92
end sub
93
94
95
// ========================
96
// Editor Subs
97
// ========================
98
99
sub RSDKDraw
100
DrawSprite(object.PropertyValue)
101
end sub
102
103
104
sub RSDKLoad
105
LoadSpriteSheet("R6/Objects2.gif")
106
SpriteFrame(-8, -8, 16, 16, 165, 191) // #0 - Big rubble
107
SpriteFrame(-8, -8, 16, 16, 181, 191) // #1 - Big rubble alt
108
109
SpriteFrame(-4, -4, 8, 8, 165, 191) // #2 - Rubble chunk 1
110
SpriteFrame(-4, -4, 8, 8, 173, 191) // #3 - Rubble chunk 2
111
SpriteFrame(-4, -4, 8, 8, 165, 199) // #4 - Rubble chunk alt 1
112
SpriteFrame(-4, -4, 8, 8, 173, 199) // #5 - Rubble chunk alt 2
113
SetVariableAlias(ALIAS_VAR_PROPVAL, "type")
114
end sub
115
116