Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/RisingFloat.txt
1319 views
1
//----------------Sonic CD Rising Float Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value1 : Object.XOriginPos
7
#alias Object.Value2 : Object.YOriginPos
8
9
// States
10
#alias 0 : RISINGFLOAT_INACTIVE
11
#alias 1 : RISINGFLOAT_RISE
12
13
// Priority
14
#alias 0 : PRIORITY_BOUNDS
15
#alias 1 : PRIORITY_ACTIVE
16
17
// Collision Sides
18
#alias 1 : CSIDE_LWALL
19
#alias 2 : CSIDE_RWALL
20
21
22
sub ObjectMain
23
Object.YPos = Stage.WaterLevel
24
Object.YPos <<= 16
25
26
if Object.State == RISINGFLOAT_RISE
27
Object.XPos = Player.XPos
28
29
if Object.XPos < 0x10100000
30
Object.XPos = 0x10100000
31
end if
32
33
if Object.XPos > 0x10F20000
34
Object.XPos = 0x10F20000
35
else
36
if Player.YPos > 0x5BE0000
37
if Player.YPos < Object.YPos
38
ObjectTileCollision(CSIDE_LWALL, 16, 6, 0)
39
if CheckResult == true
40
if Player.Speed > 0x10000
41
Player.Speed = 0x10000
42
Player.XVelocity = 0x10000
43
end if
44
end if
45
ObjectTileCollision(CSIDE_RWALL, -16, 6, 0)
46
if CheckResult == true
47
if Player.Speed < -0x10000
48
Player.Speed = -0x10000
49
Player.XVelocity = -0x10000
50
end if
51
end if
52
Player.XPos = Object.XPos
53
end if
54
else
55
ObjectTileCollision(CSIDE_LWALL, 16, 0, 0)
56
ObjectTileCollision(CSIDE_RWALL, -16, 0, 0)
57
end if
58
end if
59
end if
60
61
if Object.OutOfBounds == true
62
TempValue0 = Object.XPos
63
TempValue1 = Object.YPos
64
65
Object.XPos = Object.XOriginPos
66
Object.YPos = Object.YOriginPos
67
68
if Object.OutOfBounds == true
69
Object.State = RISINGFLOAT_INACTIVE
70
Object.Priority = PRIORITY_BOUNDS
71
else
72
Object.XPos = TempValue0
73
Object.YPos = TempValue1
74
end if
75
end if
76
end sub
77
78
79
sub ObjectPlayerInteraction
80
PlayerObjectCollision(C_PLATFORM, -16, -10, 16, 8)
81
if CheckResult == true
82
Player.YPos += 0x20000
83
if Object.State == RISINGFLOAT_INACTIVE
84
Player.Speed = 0
85
Player.XVelocity = 0
86
87
Stage.NewWaterLevel = 0x5E40000 // Y - 1508 in map coords
88
89
Object.State = RISINGFLOAT_RISE
90
Object.Priority = PRIORITY_ACTIVE
91
end if
92
end if
93
end sub
94
95
96
sub ObjectDraw
97
DrawSprite(0)
98
end sub
99
100
101
sub ObjectStartup
102
LoadSpriteSheet("R4/Objects2.gif")
103
104
SpriteFrame(-16, -8, 32, 16, 67, 235) // Wood Log
105
106
ArrayPos0 = 32
107
while ArrayPos0 < 1056
108
if Object[ArrayPos0].Type == TypeName[Rising Float]
109
Object[ArrayPos0].XOriginPos = Object[ArrayPos0].XPos
110
Object[ArrayPos0].YOriginPos = Object[ArrayPos0].YPos
111
end if
112
ArrayPos0++
113
loop
114
end sub
115
116
117
// ========================
118
// Editor Subs
119
// ========================
120
121
sub RSDKDraw
122
DrawSprite(0)
123
end sub
124
125
126
sub RSDKLoad
127
LoadSpriteSheet("R4/Objects2.gif")
128
129
SpriteFrame(-16, -8, 32, 16, 67, 235) // Wood Log
130
131
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
132
end sub
133
134