Path: blob/main/Scripts/TitleCards/R6_TitleCard.txt
1319 views
//-----------------Sonic CD Title Card Script-----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.BarPos6#alias Object.Value1 : Object.TextPos7#alias Object.Value2 : Object.TextSize8#alias Object.Value3 : Object.Timer9#alias Object.Value4 : Object.FadeR10#alias Object.Value5 : Object.FadeG11#alias Object.Value6 : Object.FadeB12#alias Object.Value7 : Object.CharPos1314// Player Aliases15#alias Object[0].Value4 : Player.InvincibleTimer1617// HUD Alias18#alias Object[24].PropertyValue : HUD.CurrentTimePeriod1920// States21#alias 0 : TITLECARD_FADEIN22#alias 1 : TITLECARD_SLIDEIN23#alias 2 : TITLECARD_DISPLAY24#alias 3 : TITLECARD_SLIDEOUT2526// Soundtrack27#alias 0 : OST_JP2829// Players30#alias 0 : PLAYER_SONIC_A31#alias 1 : PLAYER_TAILS_A3233// Time Period Aliases34#alias 0 : TIME_PRESENT35#alias 1 : TIME_PAST36#alias 2 : TIME_GOOD_FUTURE37#alias 3 : TIME_BAD_FUTURE383940// ControlMode Aliases41#alias -1 : CONTROLMODE_NONE42#alias 0 : CONTROLMODE_NORMAL4344// Priority45#alias 1 : PRIORITY_ACTIVE464748sub ObjectPlayerInteraction49Player.Timer = 050end sub515253sub ObjectDraw54switch Object.State55case TITLECARD_FADEIN56Player.ControlMode = CONTROLMODE_NONE57Player.Up = false58Player.Down = false59Player.Left = false60Player.Right = false61Player.JumpPress = false62Player.JumpHold = false6364// Check if the player comes from warping, if not, blank speed65if Warp.XPos < 166Player.Speed = 067end if6869if Object.Timer > 070if Object.Timer == 25671PlayMusic(0)72if Warp.XPos > 073// Restore values post-warp74Player.XPos = Warp.XPos75Player.YPos = Warp.YPos7677Player.XVelocity = Warp.XVelocity78Player.YVelocity = Warp.YVelocity79Player.Speed = Warp.XVelocity8081Player.State = Warp.State8283Stage.MilliSeconds = Rec_Milliseconds84Stage.Seconds = Rec_Seconds85Stage.Minutes = Rec_Minutes8687Player.InvincibleTimer = 800088end if89Warp.Timer = 090Warp.Frame = 091end if9293SetScreenFade(Object.FadeR, Object.FadeG, Object.FadeB, Object.Timer)94Object.Timer -= 895else96Fade_Colour = 09798// the title card animation doesn't play out if you come from a warp or restarted from a checkpoint99CheckEqual(Warp.XPos, 0)100TempValue0 = CheckResult101CheckLower(LampPost.Check, 32)102TempValue0 &= CheckResult103if TempValue0 == true104Object.State = TITLECARD_SLIDEIN105Object.Timer = 0106else107Player.ControlMode = CONTROLMODE_NORMAL108Stage.TimeEnabled = true109110ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)111Warp.XPos = 0112end if113end if114break115116case TITLECARD_SLIDEIN117TempValue0 = 144118TempValue0 += Object.CharPos119120if Object.TextPos > TempValue0121// Slide the text to the left122Object.TextPos -= 8123124// Now, this part got changed in an update125126else127// -> Updated version - both the text AND the bar have to be on screen for the title card to progress128129if Object.BarPos == 0130Object.State = TITLECARD_DISPLAY131end if132end if133134if Object.BarPos < 0135// Move the Bar down136Object.BarPos += 8137138// There used to be code here in older versions, but not anymore...139// -> Initial version - only the bar needed to be in the proper position for the title card to continue140// This had text get incorrectly often141142end if143break144145case TITLECARD_DISPLAY146// Hold for a moment to let the Player see what a nice Title Card this is147148if Object.Timer == 90149// Time's up, start sliding out!150Object.State = TITLECARD_SLIDEOUT151else152Object.Timer++153end if154break155156case TITLECARD_SLIDEOUT157if Object.TextPos < 408158159// Move the text to the right, and...160Object.TextPos += 16161162// ...move the bar upwards as well163Object.BarPos -= 16164165else166// Free Sonic's control, and enable the stage timer.167Player.ControlMode = CONTROLMODE_NORMAL168Stage.TimeEnabled = true169170// The Title Card's job is done, despawn it171ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)172Warp.XPos = 0173end if174break175176end switch177178// Before drawing, make sure this object hasn't been blanked already179// (Under certain circumstances, this can otherwise cause major graphical issues!!)180if Object.Type > TypeName[Blank Object]181TempValue0 = 136182TempValue0 += Object.CharPos183184// Draw the Red Bar185DrawSpriteScreenXY(0, TempValue0, Object.BarPos)186187// And then, draw the act number188DrawSpriteScreenXY(Stage.ActNo, Object.TextPos, 80)189190// And then draw the Zone text, the Sonic CD bar, and the weird three lines191DrawSpriteScreenXY(4, Object.TextPos, 80)192DrawSpriteScreenXY(5, Object.TextPos, 80)193DrawSpriteScreenXY(6, Object.TextPos, 80)194DrawSpriteScreenXY(7, Object.TextPos, 80)195196#platform: Use_Decomp // Creates a black rectangle that fills the empty space on wider resolutions197Tempvalue0 = Object.TextPos198TempValue0 += 220199DrawRect(TempValue0, 163, Screen.XSize, 9, 0, 0, 0, 255)200#endplatform201202// And then Draw the Round Name203// (Letters start at Sprite Frame 8)204TempValue0 = 8205while TempValue0 < Object.TextSize206DrawSpriteScreenXY(TempValue0, Object.TextPos, 80)207TempValue0++208loop209end if210211end sub212213214sub ObjectStartup215// Load the Display sheet for the current Player216if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins217LoadSpriteSheet("Global/Display.gif")218end if219if Stage.PlayerListPos == PLAYER_TAILS_A // PLAYER_TAILS in origins220LoadSpriteSheet("Global/Display_t.gif")221end if222#platform: Use_Origins223if Stage.PlayerListPos == PLAYER_KNUCKLES224LoadSpriteSheet("Global/Display_k.gif")225end if226if Stage.PlayerListPos == PLAYER_AMY227LoadSpriteSheet("Global/Display_a.gif")228end if229#endplatform230231// Set the music for the Stage232if Options.Soundtrack == OST_JP233switch HUD.CurrentTimePeriod234case TIME_PRESENT235SetMusicTrack("JP/R6A.ogg", 0, 1)236break237case TIME_PAST238SetMusicTrack("R6B.ogg", 0, 1)239break240case TIME_GOOD_FUTURE241SetMusicTrack("JP/R6C.ogg", 0, 1)242break243case TIME_BAD_FUTURE244SetMusicTrack("JP/R6D.ogg", 0, 1)245break246end switch247else248switch HUD.CurrentTimePeriod249case TIME_PRESENT250SetMusicTrack("US/R6A.ogg", 0, 926048)251break252case TIME_PAST253SetMusicTrack("R6B.ogg", 0, 1)254break255case TIME_GOOD_FUTURE256SetMusicTrack("US/R6C.ogg", 0, 181704)257break258case TIME_BAD_FUTURE259SetMusicTrack("US/R6D.ogg", 0, 45355)260break261end switch262end if263264Flower_TypeNo = TypeName[Flower]265Object[20].Type = TypeName[Title Card]266267// Different Fade-In times depending on if this is a new level load or if the Player is warping in268if Warp.XPos > 0269// If the Player is warping in, have a shorter fade-in time270Object[20].Timer = 256271else272Object[20].Timer = 384273end if274275// Make the Title Card always active, and have it draw above everything276Object[20].Priority = PRIORITY_ACTIVE277Object[20].DrawOrder = 6278279// Set initial Bar & Text Positions280Object[20].BarPos = -216281Object[20].TextPos = 336282283284Object[20].CharPos = Screen.CenterX285Object[20].CharPos -= 160286287if Object[20].CharPos > 3288Object[20].CharPos -= 4289end if290291Object[20].CharPos &= 248292293Object[20].TextPos += Object[20].CharPos294Object[20].TextPos += Object[20].CharPos295296// "Wacky Workbench" is 14 letters long297Object[20].TextSize = 14298299// Bump the value by 8 to correspond with the order of the Sprite Frames300Object[20].TextSize += 8301302// Preserve the color used from the last fade. Fade_Colour is stored as RRGGBB, in hex303304Object[20].FadeR = Fade_Colour305Object[20].FadeR >>= 16306307Object[20].FadeG = Fade_Colour308Object[20].FadeG &= 0x00FF00309Object[20].FadeG >>= 8310311Object[20].FadeB = Fade_Colour312Object[20].FadeB &= 0x0000FF313314// 0 - Red Bar Frame315SpriteFrame(0, 0, 32, 200, 223, 1)316317// 1-3 - Act Bubbles318SpriteFrame(96, 96, 48, 48, 41, 1)319SpriteFrame(96, 96, 48, 48, 90, 1)320SpriteFrame(96, 96, 48, 48, 139, 1)321322// 4 - "Zone" text323SpriteFrame(64, 97, 48, 16, 41, 67)324325// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar326327// Workaround for steam datafile to show this sprite correctly328#platform: Use_Origins329SpriteFrame(72, 81, 160, 16, 49, 50) // #5 - Sonic The Hedgehog CD330#endplatform331332#platform: Use_Standalone333#platform: Standard334SpriteFrame(64, 81, 160, 16, 41, 50)// #5 - Sonic The Hedgehog CD335#endplatform336#endplatform337338#platform: Use_Standalone339#platform: Mobile340SpriteFrame(72, 81, 160, 16, 49, 50)// #5 - Sonic The Hedgehog CD341#endplatform342#endplatform343344// 6 - Continuation of the Sonic CD bar345SpriteFrame(16, 81, 160, 16, 41, 50)346347// 7 - Set of three lines348SpriteFrame(108, 32, 24, 48, 188, 1)349350// 8-21 - Individual letters spelling out Wacky Workbench351SpriteFrame(0, 0, 20, 55, 121, 133) // #8 - W352SpriteFrame(20, 32, 11, 23, 43, 84) // #9 - A353SpriteFrame(32, 32, 9, 23, 176, 108) // #10 - C354SpriteFrame(41, 32, 11, 23, 147, 84) // #11 - K355SpriteFrame(53, 32, 11, 23, 146, 108) // #12 - Y356357SpriteFrame(0, 56, 20, 55, 121, 133) // #13 - W358SpriteFrame(20, 56, 11, 23, 199, 84) // #14 - O359SpriteFrame(32, 56, 12, 23, 57, 108) // #15 - R360SpriteFrame(44, 56, 11, 23, 147, 84) // #16 - K361SpriteFrame(56, 56, 11, 23, 55, 84) // #17 - B362SpriteFrame(67, 56, 9, 23, 88, 84) // #18 - E363SpriteFrame(76, 56, 11, 23, 187, 84) // #19 - N364SpriteFrame(88, 56, 9, 23, 176, 108) // #20 - C365SpriteFrame(97, 56, 11, 23, 119, 84) // #21 - H366367#platform: Use_Origins368if game.playMode == BOOT_PLAYMODE_MISSION369TempValue0 = true370else371if game.playMode == BOOT_PLAYMODE_BOSSRUSH372TempValue0 = true373else374TempValue0 = false375end if376end if377378if TempValue0 != false379PlayMusic(0)380381game.missionCondition = 0382game.missionEnd = false383384Player.ControlMode = CONTROLMODE_NORMAL385Stage.TimeEnabled = true386387ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)388Warp.XPos = 0389end if390#endplatform391end sub392393394// ========================395// Editor Subs396// ========================397398sub RSDKDraw399Object.TextSize = 14400Object.TextSize += 8401402TempValue0 = 136403TempValue0 += Object.CharPos404TempValue0 <<= 16405406TempValue1 = 0x500000407TempValue1 += Object.YPos408409DrawSpriteXY(0, Object.XPos, Object.YPos)410DrawSpriteXY(Stage.ActNo, Object.XPos, TempValue1)411DrawSpriteXY(4, Object.XPos, TempValue1)412DrawSpriteXY(5, Object.XPos, TempValue1)413DrawSpriteXY(6, Object.XPos, TempValue1)414DrawSpriteXY(7, Object.XPos, TempValue1)415416TempValue0 = 8417while TempValue0 < Object.TextSize418DrawSpriteXY(TempValue0, Object.XPos, TempValue1)419TempValue0++420loop421end sub422423424sub RSDKLoad425LoadSpriteSheet("Global/Display.gif")426// 0 - Bar Frame427SpriteFrame(0, 0, 32, 200, 223, 1)428429// 1-3 - Act Bubbles430SpriteFrame(96, 96, 48, 48, 41, 1)431SpriteFrame(96, 96, 48, 48, 90, 1)432SpriteFrame(96, 96, 48, 48, 139, 1)433434// 4 - "Zone" text435SpriteFrame(64, 97, 48, 16, 41, 67)436437// 5 - "Sonic the Hedgehog CD" bar438SpriteFrame(64, 81, 160, 16, 41, 50)439440// 6 - Continuation of the Sonic CD bar441SpriteFrame(16, 81, 160, 16, 41, 50)442443// 7 - Set of three lines444SpriteFrame(108, 32, 24, 48, 188, 1)445446// 8-21 - Individual letters spelling out Wacky Workbench447SpriteFrame(0, 0, 20, 55, 121, 133) // #8 - W448SpriteFrame(20, 32, 11, 23, 43, 84) // #9 - A449SpriteFrame(32, 32, 9, 23, 176, 108) // #10 - C450SpriteFrame(41, 32, 11, 23, 147, 84) // #11 - K451SpriteFrame(53, 32, 11, 23, 146, 108) // #12 - Y452453SpriteFrame(0, 56, 20, 55, 121, 133) // #13 - W454SpriteFrame(20, 56, 11, 23, 199, 84) // #14 - O455SpriteFrame(32, 56, 12, 23, 57, 108) // #15 - R456SpriteFrame(44, 56, 11, 23, 147, 84) // #16 - K457SpriteFrame(56, 56, 11, 23, 55, 84) // #17 - B458SpriteFrame(67, 56, 9, 23, 88, 84) // #18 - E459SpriteFrame(76, 56, 11, 23, 187, 84) // #19 - N460SpriteFrame(88, 56, 9, 23, 176, 108) // #20 - C461SpriteFrame(97, 56, 11, 23, 119, 84) // #21 - H462463SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")464end sub465466467