Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R6/BouncePlatform.txt
1319 views
1
//---------------Sonic CD Bounce Platform Script--------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value1 : Object.YOriginPos
7
#alias Object.Value2 : Object.YVelocity
8
#alias Object.Value3 : Object.FloorYPos
9
#alias Object.Value4 : Object.FallSpeed
10
11
// R6 Setup alias
12
#alias Object[19].Scale : R6Setup.BounceFloorFlag
13
14
// Collision Sides
15
#alias 0 : CSIDE_FLOOR
16
17
// Stage SFX
18
#alias 3 : SFX_S_IMPACT1
19
20
21
sub ObjectMain
22
Object.YOriginPos = Object.YPos
23
24
Object.YVelocity += Object.FallSpeed
25
Object.YPos += Object.YVelocity
26
27
ObjectTileCollision(CSIDE_FLOOR, 0, 16, 0)
28
if CheckResult == true
29
if Object.FallSpeed == 0x1000
30
PlayStageSfx(SFX_S_IMPACT1, false)
31
end if
32
if R6Setup.BounceFloorFlag == true
33
Object.YVelocity = -0x60000
34
Object.FallSpeed = 0x1000
35
else
36
Object.YVelocity = -0x20000
37
Object.FallSpeed = 0x1488
38
end if
39
end if
40
41
Object.FloorYPos = Object.YPos
42
Object.FloorYPos -= Object.YOriginPos
43
end sub
44
45
46
sub ObjectPlayerInteraction
47
TempValue0 = Object.YPos
48
Object.YPos = Object.YOriginPos
49
50
TempValue1 = Object.XPos
51
TempValue1 -= Player.XPos
52
if TempValue1 < 0
53
FlipSign(TempValue1)
54
end if
55
if TempValue1 > 0x280000
56
PlayerObjectCollision(C_BOX, -32, -16, 32, 16)
57
end if
58
59
PlayerObjectCollision(C_PLATFORM, -32, -18, 32, 16)
60
if CheckResult == true
61
Player.YPos += Object.FloorYPos
62
Player.YPos += 0x20000
63
end if
64
65
Object.YPos = TempValue0
66
end sub
67
68
69
sub ObjectDraw
70
DrawSprite(0)
71
end sub
72
73
74
sub ObjectStartup
75
LoadSpriteSheet("R6/Objects.gif")
76
77
SpriteFrame(-32, -16, 64, 32, 132, 43) // #0 - Bounce Platform
78
79
ArrayPos0 = 32
80
while ArrayPos0 < 1056
81
if Object[ArrayPos0].Type == TypeName[Bounce Platform]
82
Object[ArrayPos0].FallSpeed = 0x1000
83
end if
84
ArrayPos0++
85
loop
86
end sub
87
88
89
// ========================
90
// Editor Subs
91
// ========================
92
93
sub RSDKDraw
94
DrawSprite(0)
95
if Editor.ShowGizmos == true
96
Editor.DrawingOverlay = true
97
TempValue1 = Object.XPos
98
TempValue1 -= 0x100000
99
TempValue0 = Object.YPos
100
TempValue0 -= 0x200000
101
DrawArrow(TempValue1, Object.YPos, TempValue1, TempValue0, 255, 255, 0)
102
TempValue1 = Object.XPos
103
TempValue1 += 0x100000
104
TempValue0 = Object.YPos
105
TempValue0 -= 0x600000
106
DrawArrow(TempValue1, Object.YPos, TempValue1, TempValue0, 255, 255, 0)
107
Editor.DrawingOverlay = false
108
end if
109
end sub
110
111
112
sub RSDKLoad
113
LoadSpriteSheet("R6/Objects.gif")
114
115
SpriteFrame(-32, -16, 64, 32, 132, 43) // #0 - Bounce Platform
116
117
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
118
end sub
119
120