Path: blob/main/Scripts/TitleCards/R5_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/R5A.ogg", 0, true)236break237case TIME_PAST238SetMusicTrack("R5B.ogg", 0, 619562)239break240case TIME_GOOD_FUTURE241SetMusicTrack("JP/R5C.ogg", 0, 367046)242break243case TIME_BAD_FUTURE244SetMusicTrack("JP/R5D.ogg", 0, true)245break246end switch247else248switch HUD.CurrentTimePeriod249case TIME_PRESENT250SetMusicTrack("US/R5A.ogg", 0, true)251break252case TIME_PAST253SetMusicTrack("R5B.ogg", 0, 619562)254break255case TIME_GOOD_FUTURE256SetMusicTrack("US/R5C.ogg", 0, 705830)257break258case TIME_BAD_FUTURE259SetMusicTrack("US/R5D.ogg", 0, 93672)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// Enforce a roof, though the upper bounds should never be reachable by the Player anyway276Player.RoofBarrier = true277278// Make the Title Card always active, and have it draw above everything279Object[20].Priority = PRIORITY_ACTIVE280Object[20].DrawOrder = 6281282// Set initial Bar & Text Positions283Object[20].BarPos = -216284Object[20].TextPos = 336285286287Object[20].CharPos = Screen.CenterX288Object[20].CharPos -= 160289290if Object[20].CharPos > 3291Object[20].CharPos -= 4292end if293294Object[20].CharPos &= 248295296Object[20].TextPos += Object[20].CharPos297Object[20].TextPos += Object[20].CharPos298299// "Quartz Quadrant" is 14 letters long300Object[20].TextSize = 14301302// Bump the value by 8 to correspond with the order of the Sprite Frames303Object[20].TextSize += 8304305// Preserve the color used from the last fade. Fade_Colour is stored as RRGGBB, in hex306307Object[20].FadeR = Fade_Colour308Object[20].FadeR >>= 16309310Object[20].FadeG = Fade_Colour311Object[20].FadeG &= 0x00FF00312Object[20].FadeG >>= 8313314Object[20].FadeB = Fade_Colour315Object[20].FadeB &= 0x0000FF316317// 0 - Red Bar Frame318SpriteFrame(0, 0, 32, 200, 223, 1)319320// 1-3 - Act Bubbles321SpriteFrame(96, 96, 48, 48, 41, 1)322SpriteFrame(96, 96, 48, 48, 90, 1)323SpriteFrame(96, 96, 48, 48, 139, 1)324325// 4 - "Zone" text326SpriteFrame(64, 97, 48, 16, 41, 67)327328// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar329330// Workaround for steam datafile to show this sprite correctly331#platform: Use_Origins332SpriteFrame(72, 81, 160, 16, 49, 50) // #5 - Sonic The Hedgehog CD333#endplatform334335#platform: Use_Standalone336#platform: Standard337SpriteFrame(64, 81, 160, 16, 41, 50)// #5 - Sonic The Hedgehog CD338#endplatform339#endplatform340341#platform: Use_Standalone342#platform: Mobile343SpriteFrame(72, 81, 160, 16, 49, 50)// #5 - Sonic The Hedgehog CD344#endplatform345#endplatform346347// 6 - Continuation of the Sonic CD bar348SpriteFrame(16, 81, 160, 16, 41, 50)349350// 7 - Set of three lines351SpriteFrame(100, 32, 24, 48, 188, 1)352353// 8-21 - Individual letters spelling out Quartz Quadrant354355SpriteFrame(0, 0, 20, 55, 100, 133) // #8 - "Q"356SpriteFrame(20, 32, 11, 23, 92, 108) // #9 - "U"357SpriteFrame(32, 32, 11, 23, 43, 84) // #10 - "A"358SpriteFrame(44, 32, 12, 23, 57, 108) // #11 - "R"359SpriteFrame(56, 32, 10, 23, 81, 108) // #12 - "T"360SpriteFrame(66, 32, 10, 23, 158, 108) // #13 - "Z"361362SpriteFrame(0, 56, 20, 55, 100, 133) // #14 - "Q"363SpriteFrame(20, 56, 11, 23, 92, 108) // #15 - "U"364SpriteFrame(32, 56, 11, 23, 43, 84) // #16 - "A"365SpriteFrame(44, 56, 11, 23, 76, 84) // #17 - "D"366SpriteFrame(56, 56, 12, 23, 57, 108) // #18 - "R"367SpriteFrame(69, 56, 11, 23, 43, 84) // #19 - "A"368SpriteFrame(81, 56, 11, 23, 187, 84) // #20 - "N"369SpriteFrame(92, 56, 10, 23, 81, 108) // #21 - "T"370371#platform: Use_Origins372if game.playMode == BOOT_PLAYMODE_MISSION373TempValue0 = true374else375if game.playMode == BOOT_PLAYMODE_BOSSRUSH376TempValue0 = true377else378TempValue0 = false379end if380end if381382if TempValue0 != false383PlayMusic(0)384385game.missionCondition = 0386game.missionEnd = false387388Player.ControlMode = CONTROLMODE_NORMAL389Stage.TimeEnabled = true390391ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)392Warp.XPos = 0393end if394#endplatform395end sub396397398// ========================399// Editor Subs400// ========================401402sub RSDKDraw403Object.TextSize = 14404Object.TextSize += 8405406TempValue0 = 136407TempValue0 += Object.CharPos408TempValue0 <<= 16409410TempValue1 = 0x500000411TempValue1 += Object.YPos412413DrawSpriteXY(0, Object.XPos, Object.YPos)414DrawSpriteXY(Stage.ActNo, Object.XPos, TempValue1)415DrawSpriteXY(4, Object.XPos, TempValue1)416DrawSpriteXY(5, Object.XPos, TempValue1)417DrawSpriteXY(6, Object.XPos, TempValue1)418DrawSpriteXY(7, Object.XPos, TempValue1)419420TempValue0 = 8421while TempValue0 < Object.TextSize422DrawSpriteXY(TempValue0, Object.XPos, TempValue1)423TempValue0++424loop425end sub426427428sub RSDKLoad429LoadSpriteSheet("Global/Display.gif")430// 0 - Red Bar Frame431SpriteFrame(0, 0, 32, 200, 223, 1)432433// 1-3 - Act Bubbles434SpriteFrame(96, 96, 48, 48, 41, 1)435SpriteFrame(96, 96, 48, 48, 90, 1)436SpriteFrame(96, 96, 48, 48, 139, 1)437438// 4 - "Zone" text439SpriteFrame(64, 97, 48, 16, 41, 67)440441// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar442SpriteFrame(64, 81, 160, 16, 41, 50)443444// 6 - Continuation of the Sonic CD bar445SpriteFrame(16, 81, 160, 16, 41, 50)446447// 7 - Set of three lines448SpriteFrame(100, 32, 24, 48, 188, 1)449450// 8-21 - Individual letters spelling out Quartz Quadrant451SpriteFrame(0, 0, 20, 55, 100, 133) // #8 - "Q"452SpriteFrame(20, 32, 11, 23, 92, 108) // #9 - "U"453SpriteFrame(32, 32, 11, 23, 43, 84) // #10 - "A"454SpriteFrame(44, 32, 12, 23, 57, 108) // #11 - "R"455SpriteFrame(56, 32, 10, 23, 81, 108) // #12 - "T"456SpriteFrame(66, 32, 10, 23, 158, 108) // #13 - "Z"457458SpriteFrame(0, 56, 20, 55, 100, 133) // #14 - "Q"459SpriteFrame(20, 56, 11, 23, 92, 108) // #15 - "U"460SpriteFrame(32, 56, 11, 23, 43, 84) // #16 - "A"461SpriteFrame(44, 56, 11, 23, 76, 84) // #17 - "D"462SpriteFrame(56, 56, 12, 23, 57, 108) // #18 - "R"463SpriteFrame(69, 56, 11, 23, 43, 84) // #19 - "A"464SpriteFrame(81, 56, 11, 23, 187, 84) // #20 - "N"465SpriteFrame(92, 56, 10, 23, 81, 108) // #21 - "T"466467SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")468end sub469470471