Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R8/PushButton.txt
1319 views
1
//---------------Sonic CD Push Button Script------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.PropertyValue : Object.Pressed
7
8
// Gravity
9
#alias 0 : GRAVITY_GROUND
10
11
// Collision
12
#alias 1 : PLAYER_COL_FLOOR
13
14
// Stage SFX
15
#alias 2 : SFX_S_SWITCH
16
17
18
sub ObjectPlayerInteraction
19
if Object.Pressed == false
20
if Player.YVelocity >= 0
21
PlayerObjectCollision(C_BOX, -16, -8, 16, 8)
22
if CheckResult == PLAYER_COL_FLOOR
23
Object.Pressed = true
24
Player.YPos += 0x80000
25
PlayStageSfx(SFX_S_SWITCH, false)
26
else
27
Object.Pressed = false
28
end if
29
else
30
Object.Pressed = false
31
end if
32
else
33
PlayerObjectCollision(C_TOUCH, -16, -1, 16, 8)
34
if CheckResult == true
35
Object.Pressed = true
36
Player.Gravity = GRAVITY_GROUND
37
Player.YVelocity = 0
38
Player.YPos = Player.CollisionBottom
39
FlipSign(Player.YPos)
40
Player.YPos <<= 16
41
Player.YPos += Object.YPos
42
else
43
Object.Pressed = false
44
45
if Player.YVelocity > -1
46
Player.Gravity = GRAVITY_GROUND
47
Player.YVelocity = 0
48
Player.YPos = Player.CollisionBottom
49
FlipSign(Player.YPos)
50
Player.YPos -= 8
51
Player.YPos <<= 16
52
Player.YPos += Object.YPos
53
end if
54
end if
55
end if
56
end sub
57
58
59
sub ObjectDraw
60
DrawSprite(Object.Pressed)
61
end sub
62
63
64
sub ObjectStartup
65
LoadSpriteSheet("R8/Objects.gif")
66
67
SpriteFrame(-16, -8, 32, 16, 142, 98) // #0 - Push Button inactive
68
SpriteFrame(-16, 0, 32, 8, 142, 114) // #1 - Push Button active
69
end sub
70
71
72
// ========================
73
// Editor Subs
74
// ========================
75
76
sub RSDKDraw
77
DrawSprite(Object.PropertyValue)
78
end sub
79
80
81
sub RSDKLoad
82
LoadSpriteSheet("R8/Objects.gif")
83
84
SpriteFrame(-16, -8, 32, 16, 142, 98) // #0 - Push Button inactive
85
SpriteFrame(-16, 0, 32, 8, 142, 114) // #1 - Push Button active
86
87
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
88
end sub
89
90