Path: blob/master/Sonic 2/Scripts/Global/MusicEvent.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Music Event Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer1213private alias 0 : MUSICEVENT_FADETOBOSS14private alias 1 : MUSICEVENT_FADETOSTAGE15private alias 2 : MUSICEVENT_TRANSITION16private alias 3 : MUSICEVENT_FADETOBOSS_ACTION // This one and the next are the same as the actual ones in S1, the actual ones this time just do a check for vs.bossAttack to disable music transitions there17private alias 4 : MUSICEVENT_FADETOSTAGE_ACTION18private alias 5 : MUSICEVENT_FADEOUT1920private alias 0 : MUSICEVENT_FLAG_NOCHANGE21private alias 1 : MUSICEVENT_FLAG_SPEEDUP22private alias 2 : MUSICEVENT_FLAG_SLOWDOWN2324private alias 25 : SLOT_MUSICEVENT_CHANGE25private alias 26 : SLOT_MUSICEVENT_BOSS2627// Track Aliases28private alias 0 : TRACK_STAGE29private alias 2 : TRACK_INVINCIBLE30private alias 4 : TRACK_BOSS313233// ========================34// Events35// ========================3637event ObjectUpdate38switch object.propertyValue39case MUSICEVENT_FADETOBOSS40if vs.bossAttack == false41object.propertyValue = MUSICEVENT_FADETOBOSS_ACTION42else43object.type = TypeName[Blank Object]44end if45break4647case MUSICEVENT_FADETOSTAGE48#platform: USE_ORIGINS49if game.playMode == BOOT_PLAYMODE_BOSSRUSH50object.propertyValue = MUSICEVENT_FADEOUT51else52#endplatform53if vs.bossAttack == false54object.propertyValue = MUSICEVENT_FADETOSTAGE_ACTION55if stage.activeList == BONUS_STAGE56if stage.listPos > 0 // Checking to see if we're in a non-MBZ Boss Rush stage, this is intended for the 2013 Boss Rush but could work for the Origins Boss Rush too if the above game.playMode check was removed57vs.bossAttack = true58object.type = TypeName[Blank Object]59end if60end if61else62object.type = TypeName[Blank Object]63end if64#platform: USE_ORIGINS65end if66#endplatform67break6869case MUSICEVENT_TRANSITION70if object.timer < 24071if music.volume > 072PauseMusic()73music.volume = 074end if75object.timer++76else77if music.volume == 078ResumeMusic()79switch stage.musicFlag80case MUSICEVENT_FLAG_NOCHANGE81break8283case MUSICEVENT_FLAG_SPEEDUP84CallFunction(SpeedUpMusic)85stage.musicFlag = MUSICEVENT_FLAG_NOCHANGE86break8788case MUSICEVENT_FLAG_SLOWDOWN89CallFunction(SlowDownMusic)90stage.musicFlag = MUSICEVENT_FLAG_NOCHANGE91break9293end switch9495music.volume = 596else97if music.volume < 10098music.volume += 599else100object.type = TypeName[Blank Object]101end if102end if103end if104break105106case MUSICEVENT_FADETOBOSS_ACTION107if object.timer < 50108object.timer++109music.volume -= 2110else111PlayMusic(TRACK_BOSS)112object.type = TypeName[Blank Object]113end if114break115116case MUSICEVENT_FADETOSTAGE_ACTION117if object.timer < 50118object.timer++119music.volume -= 2120else121PlayMusic(TRACK_STAGE)122object.type = TypeName[Blank Object]123end if124break125126#platform: USE_ORIGINS127case MUSICEVENT_FADEOUT128if object.timer < 50129object.timer++130music.volume -= 2131else132StopMusic()133object.type = TypeName[Blank Object]134end if135break136#endplatform137end switch138end event139140141// ========================142// Editor Events143// ========================144145event RSDKDraw146DrawSprite(0)147end event148149150event RSDKLoad151LoadSpriteSheet("Global/Display.gif")152SpriteFrame(-16, -16, 32, 32, 1, 143)153154// While used by the object, it shouldn't be set by the editor155SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")156end event157158159