Path: blob/main/Scripts/Title/Sega.txt
1319 views
//--------------------Sonic CD Sega Script--------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.RectAlpha7#alias Object.Value3 : Object.Unused89// There is an Object.Value7 used by the decomp in Logo10// to figure out what version of the mountains display11// since this is the only object loaded at the start1213// States14#alias 0 : SEGA_SETUP15#alias 1 : SEGA_FADEIN16#alias 2 : SEGA_JINGLE17#alias 3 : SEGA_FADEOUT18#alias 4 : SEGA_END1920// Ink Effect Aliases21#alias 2 : INK_ALPHA2223// Stage SFX24#alias 0 : SFX_S_SEGA2526// Callbacks & Engine States27#alias 0 : CALLBACK_DISPLAYLOGOS28#alias 7 : CALLBACK_EXIT_SELECTED2930#alias 5 : ENGINE_ENTER_HIRESMODE3132// game.titleMode Aliases33#alias 0 : DONT_SKIP_LOGOS34#alias 1 : SKIP_LOGOS // this is set by HE23536// game.mainMenuMode Aliases37#alias 0 : MAINMENUMODE_NONE // Starts with this, but gets swapped on MenuButton383940sub ObjectMain41switch Object.State42case SEGA_SETUP43// Setup not only the Object, but some other useful game values as well4445ReadSaveRAM()46// First, restore the Soundtrack setting to what it should be47Options.Soundtrack = SaveRAM[38]4849// Some more initialisation code follows, varies between platforms5051#platform: Use_Origins52if game.titleMode != DONT_SKIP_LOGOS5354game.titleMode = DONT_SKIP_LOGOS55Object.State = SEGA_END5657else58if game.mainMenuMode != MAINMENUMODE_NONE5960// If returning from another Menu (ie Soundtrack) then just skip to the end61// and don't play the Sega screen again62// -> This value isn't reset here though, it's reset a few lines down6364Object.State = SEGA_END6566else6768// Nope, nothing special is needed, so let's just show the normal Sega splash!6970Object.State = SEGA_FADEIN7172end if73end if7475Object.Timer = 48076#endplatform7778#platform: Use_Standalone79// Origins has all these settings on the wrapper side of things,80// so this isn't needed there81if SaveRAM[32] == true82Engine.BGMVolume = SaveRAM[33]83Engine.SFXVolume = SaveRAM[34]84end if85Options.Soundtrack = SaveRAM[38]86Object.State = SEGA_FADEIN87Object.Timer = 3848889Engine.State = ENGINE_ENTER_HIRESMODE90#endplatform9192Object.Alpha = 25593Object.InkEffect = INK_ALPHA9495// Start the screen off all black96SetScreenFade(0, 0, 0, 255)9798// And move the Object to the centre of the screen99Object.iXPos = Screen.CenterX100101#platform: Use_Origins102game.mainMenuMode = MAINMENUMODE_NONE103#endplatform104break105106case SEGA_FADEIN107if Object.Timer > 0108// Fade in, 8 by 8109Object.Timer -= 8110else111if Engine.OnlineActive < 2112// Make sure the Engine's ready to go too before moving on just yet!113Object.State = SEGA_JINGLE114end if115end if116117SetScreenFade(0, 0, 0, Object.Timer)118break119120case SEGA_JINGLE121// Hold for a moment, to let the player bask in this wonderful screen122123Object.Timer++124125if Object.Timer == 160126// Nope that's over, off we go again127128Object.Timer = 0129Object.State = SEGA_FADEOUT130end if131132if Object.Timer == 2133// Play the SFX almost immediatly after entering this state134PlayStageSfx(SFX_S_SEGA, false)135end if136break137138case SEGA_FADEOUT139// Do note - this state is kinda messed up, they forget a break at the end so140// this state doesn't reallly fade out141142#platform: Use_Standalone143if Object.RectAlpha < 256144Object.RectAlpha += 8145endif146#endplatform147148if Object.Alpha > 7149Object.Alpha -= 8150else151if Object.Timer == 16152153#platform: Use_Standalone154ResetObjectEntity(Object.EntityNo, TypeName[CWLogo], 0, Object.XPos, Object.YPos)155Object.Unused = 96156#endplatform157158#platform: Use_Origins159// this never even hits in origins and yet they changed it anyway lol160161ResetObjectEntity(Object.EntityNo, TypeName[Sonic], 0, Object.XPos, Object.YPos)162#endplatform163164Object.InkEffect = INK_ALPHA165Object.Alpha = 0166Object.Timer = 0167else168Object.Timer++169end if170end if171172// No break used here so it falls through173// On Origins, this means the Fade Out doesn't really happen...174// Standalone doesn't have the following state at all though so it doesn't need to worry about the missing break175176case SEGA_END177#platform: Use_Origins178// The name's a bit odd - this Object is used to skip the sequence,179// but it's also how the sequence ends, thanks to the missing break from above180181// For simplicity here, I've just chosen to stick with "End"182183// But anyway, this state just moves on with the title sequence, nothing too special184185ResetObjectEntity(Object.EntityNo, TypeName[Sonic], 0, Object.XPos, Object.YPos)186Object.InkEffect = INK_ALPHA187Object.Alpha = 0188Object.Timer = 0189190// There's even a break here, isn't that cool?191break192#endplatform193194end switch195196// If you really wanna i guess197if Engine.PlatformID == RETRO_WP7198if KeyPress[0].ButtonB == true199EngineCallback(CALLBACK_EXIT_SELECTED)200end if201end if202203end sub204205206207sub ObjectDraw208// First, draw the background209DrawRect(0, 0, Screen.XSize, Screen.YSize, 0, 0, 96, 255)210211#platform: Use_Origins212// Using the pixel art version of the sprite213214if Object.Alpha > 8215DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)216end if217#endplatform218219#platform: Use_Standalone220// Using the High-Quality version of the sprite221222Object.Scale = 128223DrawSpriteFX(0, FX_SCALE, Object.XPos, Object.YPos)224225// Draw another blue layer on top of it, to give it a blue fade226DrawRect(0, 0, Screen.XSize, Screen.YSize, 0, 0, 96, Object.RectAlpha)227#endplatform228229end sub230231232sub ObjectStartup233234#platform: Use_Origins235// Using the pixel version of the sprite236237LoadSpriteSheet("Title/Title.gif")238SpriteFrame(-49, -16, 98, 31, 106, 1)239240#endplatform241242#platform: Use_Standalone243// Using the High-Quality version of the sprite244245LoadSpriteSheet("Title/Sega.gif")246SpriteFrame(-255, -87, 510, 174, 1, 1)247#endplatform248249end sub250251252// ========================253// Editor Subs254// ========================255256sub RSDKDraw257DrawSprite(0)258end sub259260261sub RSDKLoad262LoadSpriteSheet("Title/Title.gif")263SpriteFrame(-49,-16,98,31,106,1)264265SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")266end sub267268269