Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/LBoards/MenuControl.txt
1319 views
1
//-----------------Sonic CD Menu Control Script---------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
//------------------Only exist in WP7 Versions----------------//
5
6
// Aliases
7
#alias Object.Value0 : Object.Timer // Also used for fading
8
#alias Object[32].State : LEntry.State
9
10
// States
11
#alias 0 : MENUCONTROL_SETUP
12
#alias 1 : MENUCONTROL_FADEIN
13
#alias 2 : MENUCONTROL_CONTROLS
14
#alias 3 : MENUCONTROL_BLANK
15
#alias 4 : MENUCONTROL_EXIT
16
17
// LEntry States
18
#alias 1 : LENTRY_MOVE_RIGHT
19
#alias 4 : LENTRY_MOVE_LEFT
20
#alias 7 : LENTRY_MOVE_DOWN
21
#alias 10 : LENTRY_MOVE_UP
22
23
// Presentation Stages
24
#alias 1 : STAGE_P_MENU
25
26
// Soundtrack
27
#alias 0 : OST_JP
28
29
// Global SFX
30
#alias 23 : SFX_G_MENUBUTTON
31
#alias 27 : SFX_G_SELECT
32
33
// Engine & Callbacks
34
#alias 3 : CALLBACK_TATTACK_NOTIFY_EXIT
35
36
37
sub ObjectMain
38
switch Object.State
39
case MENUCONTROL_SETUP
40
Object.State = MENUCONTROL_FADEIN
41
Object.Timer = 384
42
SetScreenFade(0, 0, 0, 255)
43
PlayMusic(0)
44
break
45
46
case MENUCONTROL_FADEIN
47
if Object.Timer > 0
48
Object.Timer -= 8
49
Object.Scale -= 4096
50
else
51
Object.State = MENUCONTROL_CONTROLS
52
end if
53
SetScreenFade(0, 0, 0, Object.Timer)
54
break
55
56
case MENUCONTROL_CONTROLS
57
if KeyPress[0].Left == true
58
Object.State = MENUCONTROL_BLANK
59
LEntry.State = LENTRY_MOVE_LEFT
60
PlaySfx(SFX_G_MENUBUTTON, false)
61
end if
62
63
if KeyPress[0].Right == true
64
Object.State = MENUCONTROL_BLANK
65
LEntry.State = LENTRY_MOVE_RIGHT
66
PlaySfx(SFX_G_MENUBUTTON, false)
67
end if
68
69
if KeyPress[0].Up == true
70
Object.State = MENUCONTROL_BLANK
71
LEntry.State = LENTRY_MOVE_UP
72
PlaySfx(SFX_G_MENUBUTTON, false)
73
end if
74
75
if KeyPress[0].Down == true
76
Object.State = MENUCONTROL_BLANK
77
LEntry.State = LENTRY_MOVE_DOWN
78
PlaySfx(SFX_G_MENUBUTTON, false)
79
end if
80
81
if KeyPress[0].ButtonB == true
82
Object.State = MENUCONTROL_EXIT
83
StopMusic()
84
PlaySfx(SFX_G_SELECT, false)
85
end if
86
break
87
88
case MENUCONTROL_BLANK
89
break
90
91
case MENUCONTROL_EXIT
92
if Object.Timer < 384
93
Object.Timer += 8
94
Object.Scale += 4096
95
else
96
Stage.ListPos = STAGE_P_MENU
97
LoadStage()
98
end if
99
SetScreenFade(0, 0, 0, Object.Timer)
100
EngineCallback(CALLBACK_TATTACK_NOTIFY_EXIT)
101
break
102
103
end switch
104
end sub
105
106
107
sub ObjectStartup
108
if Options.Soundtrack == OST_JP
109
SetMusicTrack("JP/TimeAttack.ogg", 0, 100512)
110
else
111
SetMusicTrack("US/DAGarden.ogg", 0, 117382)
112
end if
113
Object[0].Type = TypeName[Menu Control]
114
Object[0].DrawOrder = 1
115
Options.PhysicalControls = false
116
end sub
117
118
119
// ========================
120
// Editor Subs
121
// ========================
122
123
sub RSDKDraw
124
DrawSprite(0)
125
end sub
126
127
128
sub RSDKLoad
129
LoadSpriteSheet("Global/Display.gif")
130
SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon
131
132
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
133
end sub
134
135