Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/Global/MusicEvent.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Music Event 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
14
// Tracks
15
private alias 0 : TRACK_STAGE
16
private alias 2 : TRACK_INVINCIBLE
17
private alias 4 : TRACK_BOSS
18
19
private alias 0 : MUSICEVENT_FADETOBOSS
20
private alias 1 : MUSICEVENT_FADETOSTAGE
21
private alias 2 : MUSICEVENT_TRANSITION
22
private alias 3 : MUSICEVENT_FADEOUT // New to Origins
23
24
private alias 0 : MUSICEVENT_FLAG_NOCHANGE
25
private alias 1 : MUSICEVENT_FLAG_SPEEDUP
26
private alias 2 : MUSICEVENT_FLAG_SLOWDOWN
27
28
29
// ========================
30
// Events
31
// ========================
32
33
event ObjectUpdate
34
#platform: USE_ORIGINS
35
CallNativeFunction4(NotifyCallback, NOTIFY_DEBUGPRINT, 100, object.propertyValue, object.timer) // LOL
36
#endplatform
37
38
switch object.propertyValue
39
#platform: USE_ORIGINS
40
case MUSICEVENT_FADEOUT // yeah despite being numerically the final variant, the Origins devs just stuffed it up above at the top...
41
if object.timer < 50
42
object.timer++
43
music.volume -= 2
44
else
45
StopMusic()
46
music.volume = 100
47
object.type = TypeName[Blank Object]
48
end if
49
break
50
#endplatform
51
52
case MUSICEVENT_FADETOBOSS
53
if object.timer < 50
54
object.timer++
55
music.volume -= 2
56
else
57
PlayMusic(TRACK_BOSS)
58
object.type = TypeName[Blank Object]
59
end if
60
break
61
62
case MUSICEVENT_FADETOSTAGE
63
#platform: USE_ORIGINS
64
if game.playMode == BOOT_PLAYMODE_BOSSRUSH
65
// In Boss Rush we don't wanna resume normal music afterwards, become a simple fade-out variant instead
66
67
object.propertyValue = MUSICEVENT_FADEOUT
68
else
69
#endplatform
70
if object.timer < 50
71
object.timer++
72
music.volume += 2
73
else
74
PlayMusic(0)
75
object.type = TypeName[Blank Object]
76
end if
77
#platform: USE_ORIGINS
78
end if
79
#endplatform
80
break
81
82
case MUSICEVENT_TRANSITION
83
if object.timer < 240
84
if music.volume > 0
85
PauseMusic()
86
music.volume = 0
87
end if
88
89
object.timer++
90
else
91
if music.volume == 0
92
ResumeMusic()
93
switch stage.musicFlag
94
case MUSICEVENT_FLAG_NOCHANGE
95
break
96
97
case MUSICEVENT_FLAG_SPEEDUP
98
CallFunction(SpeedUpMusic)
99
stage.musicFlag = MUSICEVENT_FLAG_NOCHANGE
100
break
101
102
case MUSICEVENT_FLAG_SLOWDOWN
103
CallFunction(SlowDownMusic)
104
stage.musicFlag = MUSICEVENT_FLAG_NOCHANGE
105
break
106
107
end switch
108
109
music.volume = 5
110
else
111
if music.volume < 100
112
music.volume += 5
113
else
114
object.type = TypeName[Blank Object]
115
end if
116
end if
117
end if
118
break
119
120
end switch
121
end event
122
123
124
// ========================
125
// Editor Events
126
// ========================
127
128
event RSDKDraw
129
DrawSprite(0)
130
end event
131
132
133
event RSDKLoad
134
LoadSpriteSheet("Global/Display.gif")
135
SpriteFrame(-16, -16, 32, 32, 1, 143)
136
137
// Although used by the object, it shouldn't be set here
138
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
139
end event
140
141