Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/Credits/CreditsControl.txt
1478 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Credits Control Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value0 : object.timer
13
private alias object.value3 : object.timer2
14
15
// States
16
private alias 0 : CREDITSCONTROL_SETUP
17
private alias 1 : CREDITSCONTROL_FADEIN
18
private alias 2 : CREDITSCONTROL_SHOWSCREEN
19
private alias 3 : CREDITSCONTROL_FADEOUT
20
private alias 4 : CREDITSCONTROL_FADEINTOEND
21
private alias 5 : CREDITSCONTROL_SHOWEND
22
private alias 6 : CREDITSCONTROL_FADETOMENU
23
24
// Priority
25
public alias 0 : PRIORITY_BOUNDS
26
public alias 1 : PRIORITY_ACTIVE
27
public alias 2 : PRIORITY_ALWAYS
28
public alias 3 : PRIORITY_XBOUNDS
29
public alias 4 : PRIORITY_XBOUNDS_DESTROY
30
public alias 5 : PRIORITY_INACTIVE
31
public alias 6 : PRIORITY_BOUNDS_SMALL
32
public alias 7 : PRIORITY_ACTIVE_SMALL
33
34
// Ink Effects
35
public alias 0 : INK_NONE
36
public alias 1 : INK_BLEND
37
public alias 2 : INK_ALPHA
38
public alias 3 : INK_ADD
39
public alias 4 : INK_SUB
40
41
// Flip Directions
42
public alias 0 : FLIP_NONE
43
public alias 1 : FLIP_X
44
public alias 2 : FLIP_Y
45
public alias 3 : FLIP_XY
46
47
48
// ========================
49
// Events
50
// ========================
51
52
event ObjectUpdate
53
switch object.state
54
case CREDITSCONTROL_SETUP
55
object.timer = 320
56
SetScreenFade(0x00, 0x00, 0x00, object.timer)
57
object.state++
58
if credits.screen == 0
59
PlayMusic(0)
60
end if
61
break
62
63
case CREDITSCONTROL_FADEIN
64
if object.timer > 0
65
object.timer -= 8
66
else
67
object.alpha = 0x80
68
object.state++
69
end if
70
SetScreenFade(0x00, 0x00, 0x00, object.timer)
71
break
72
73
case CREDITSCONTROL_SHOWSCREEN
74
object.timer++
75
if object.timer == 356
76
object.timer = 0
77
object.state++
78
end if
79
break
80
81
case CREDITSCONTROL_FADEOUT
82
if object.timer < 256
83
if object.timer2 == 21
84
object.timer += 4
85
else
86
object.timer += 8
87
end if
88
89
SetScreenFade(0x00, 0x00, 0x00, object.timer)
90
else
91
object.timer2++
92
if object.timer2 == 22
93
object.state = CREDITSCONTROL_FADEINTOEND
94
screen.yoffset += 256
95
else
96
object.state = CREDITSCONTROL_FADEIN
97
if specialStage.emeralds >= 0x7F
98
if object.timer2 == 21
99
screen.yoffset = 5120
100
screen.yoffset += 1036 // strange way to do it, but alright
101
else
102
screen.yoffset += 256
103
end if
104
else
105
screen.yoffset += 256
106
end if
107
end if
108
109
SetScreenFade(0x00, 0x00, 0x00, 255)
110
end if
111
break
112
113
case CREDITSCONTROL_FADEINTOEND
114
if object.timer > 0
115
object.timer -= 8
116
else
117
object.alpha = 0x80
118
object.state++
119
end if
120
SetScreenFade(0x00, 0x00, 0x00, object.timer)
121
break
122
123
case CREDITSCONTROL_SHOWEND
124
object.timer++
125
if object.timer == 0x4B0
126
object.timer = 0
127
object.state++
128
end if
129
130
if keyPress[0].start == true
131
object.timer = 0
132
object.state++
133
end if
134
135
if object.timer > 60
136
CheckTouchRect(0, 0, screen.xsize, screen.ysize)
137
if checkResult > -1
138
object.timer = 0
139
object.state++
140
end if
141
end if
142
break
143
144
case CREDITSCONTROL_FADETOMENU
145
if object.timer < 256
146
object.timer += 8
147
SetScreenFade(0x00, 0x00, 0x00, object.timer)
148
else
149
stage.activeList = PRESENTATION_STAGE
150
stage.listPos = 0
151
StopMusic()
152
options.attractMode = false
153
#platform: USE_STANDALONE
154
engine.state = 7
155
#endplatform
156
#platform: USE_ORIGINS
157
engine.state = 8
158
#endplatform
159
SetScreenFade(0x00, 0x00, 0x00, 0xFF)
160
#platform: USE_ORIGINS
161
CallNativeFunction2(NotifyCallback, NOTIFY_STATS_MOVIE, 1)
162
#endplatform
163
end if
164
break
165
166
end switch
167
168
temp0 = screen.xcenter
169
FlipSign(temp0)
170
temp0 += 256
171
screen.xoffset = temp0
172
end event
173
174
175
event ObjectStartup
176
SetMusicTrack("Credits.ogg", 0, false)
177
options.touchControls = false
178
screen.yoffset = -8
179
foreach (TypeName[Credits Control], arrayPos0, ALL_ENTITIES)
180
object[arrayPos0].priority = PRIORITY_ACTIVE
181
next
182
end event
183
184
185
// ========================
186
// Editor Events
187
// ========================
188
189
event RSDKDraw
190
DrawSprite(0)
191
end event
192
193
194
event RSDKLoad
195
LoadSpriteSheet("Global/Display.gif")
196
SpriteFrame(-16, -16, 32, 32, 1, 143)
197
198
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
199
end event
200
201