Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Global/GoalPost.txt
1319 views
1
//-----------------Sonic CD Goal Post Script------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// States
6
#alias 0 : GOALPOST_IDLE
7
#alias 1 : GOALPOST_BLANK
8
9
// Warp Destination
10
#alias 0 : WARPDEST_NONE
11
12
// Property Values
13
#alias 1 : UPPERGOAL
14
15
// Player
16
#alias 0 : PLAYER_SONIC_A
17
#alias 1 : PLAYER_TAILS_A
18
19
20
sub ObjectMain
21
if Object.State == GOALPOST_IDLE
22
TempValue0 = Object.YPos
23
TempValue0 += 0x600000
24
25
if Player.YPos < TempValue0
26
if Player.XPos > Object.XPos
27
// Block the player from going back into the stage, reset time warps
28
Stage.NewXBoundary1 = Object.XPos
29
Stage.NewXBoundary1 >>= 16
30
Stage.NewXBoundary1 -= 160
31
32
Warp.Destination = WARPDEST_NONE
33
Warp.Timer = 0
34
35
Object.State = GOALPOST_BLANK
36
37
if Object.PropertyValue == UPPERGOAL
38
PlayerObjectCollision(C_TOUCH, -32, -256, 32, 16)
39
if CheckResult == true
40
// Take The High Road Unlock Criteria
41
if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in Origins
42
if Stage.DebugMode == false
43
SetAchievement(3, 100)
44
end if
45
end if
46
end if
47
end if
48
end if
49
end if
50
end if
51
end sub
52
53
54
sub ObjectDraw
55
DrawSprite(0)
56
end sub
57
58
59
sub ObjectStartup
60
if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins
61
LoadSpriteSheet("Global/Items2.gif")
62
end if
63
if Stage.PlayerListPos == PLAYER_TAILS_A // PLAYER_TAILS in origins
64
LoadSpriteSheet("Global/Items2_t.gif")
65
end if
66
#platform: Use_Origins
67
if Stage.PlayerListPos == PLAYER_KNUCKLES
68
LoadSpriteSheet("Global/Items2_k.gif")
69
end if
70
if Stage.PlayerListPos == PLAYER_AMY
71
LoadSpriteSheet("Global/Items2_a.gif")
72
end if
73
#endplatform
74
SpriteFrame(-20, -44, 40, 56, 34, 165) // #0 - Goal Post
75
end sub
76
77
78
// ========================
79
// Editor Subs
80
// ========================
81
82
sub RSDKEdit
83
if Editor.ReturnVariable == true
84
switch Editor.VariableID
85
case EDIT_VAR_PROPVAL // Property Value
86
CheckResult = Object.PropertyValue
87
break
88
case 0 // AwardAchievement
89
CheckResult = Object.PropertyValue
90
break
91
end switch
92
else
93
switch Editor.VariableID
94
case EDIT_VAR_PROPVAL // Property Value
95
Object.PropertyValue = Editor.VariableValue
96
break
97
case 0 // AwardAchievement
98
Object.PropertyValue = Editor.VariableValue
99
break
100
end switch
101
end if
102
end sub
103
104
105
sub RSDKDraw
106
DrawSprite(0)
107
end sub
108
109
110
sub RSDKLoad
111
LoadSpriteSheet("Global/Items2.gif")
112
SpriteFrame(-20, -44, 40, 56, 34, 165) // #0 - Goal Post
113
114
AddEditorVariable("AwardAchievement")
115
SetActiveVariable("AwardAchievement")
116
AddEnumVariable("false", false)
117
AddEnumVariable("true", true)
118
end sub
119
120