Path: blob/main/Scripts/TitleCards/R7_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/R7A.ogg", 0, true)236break237case TIME_PAST238SetMusicTrack("R7B.ogg", 0, 730678)239break240case TIME_GOOD_FUTURE241SetMusicTrack("JP/R7C.ogg", 0, 103060)242break243case TIME_BAD_FUTURE244SetMusicTrack("JP/R7D.ogg", 0, true)245break246end switch247else248switch HUD.CurrentTimePeriod249case TIME_PRESENT250SetMusicTrack("US/R7A.ogg", 0, 617728)251break252case TIME_PAST253SetMusicTrack("R7B.ogg", 0, 730678)254break255case TIME_GOOD_FUTURE256SetMusicTrack("US/R7C.ogg", 0, 136670)257break258case TIME_BAD_FUTURE259SetMusicTrack("US/R7D.ogg", 0, 92324)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// In the Metal Sonic race Zone, set a Roof to be active276if Stage.ActNo == 3277Player.RoofBarrier = true278end if279280// Make the Title Card always active, and have it draw above everything281Object[20].Priority = PRIORITY_ACTIVE282Object[20].DrawOrder = 6283284// Set initial Bar & Text Positions285Object[20].BarPos = -216286Object[20].TextPos = 336287288289Object[20].CharPos = Screen.CenterX290Object[20].CharPos -= 160291292if Object[20].CharPos > 3293Object[20].CharPos -= 4294end if295296Object[20].CharPos &= 248297298Object[20].TextPos += Object[20].CharPos299Object[20].TextPos += Object[20].CharPos300301// "Stardust Speedway" is 16 letters long302Object[20].TextSize = 16303304// Bump the value by 8 to correspond with the order of the Sprite Frames305Object[20].TextSize += 8306307// Preserve the color used from the last fade. Fade_Colour is stored as RRGGBB, in hex308309Object[20].FadeR = Fade_Colour310Object[20].FadeR >>= 16311312Object[20].FadeG = Fade_Colour313Object[20].FadeG &= 0x00FF00314Object[20].FadeG >>= 8315316Object[20].FadeB = Fade_Colour317Object[20].FadeB &= 0x0000FF318319// 0 - Red Bar Frame320SpriteFrame(0, 0, 32, 200, 223, 1)321322// 1-3 - Act Bubbles323SpriteFrame(96, 96, 48, 48, 41, 1)324SpriteFrame(96, 96, 48, 48, 90, 1)325SpriteFrame(96, 96, 48, 48, 139, 1)326327// 4 - "Zone" text328SpriteFrame(64, 97, 48, 16, 41, 67)329330// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar331332// Workaround for steam datafile to show this sprite correctly333#platform: Use_Origins334SpriteFrame(72, 81, 160, 16, 49, 50) // #5 - Sonic The Hedgehog CD335#endplatform336337#platform: Use_Standalone338#platform: Standard339SpriteFrame(64, 81, 160, 16, 41, 50)// #5 - Sonic The Hedgehog CD340#endplatform341#endplatform342343#platform: Use_Standalone344#platform: Mobile345SpriteFrame(72, 81, 160, 16, 49, 50)// #5 - Sonic The Hedgehog CD346#endplatform347#endplatform348349// 6 - Continuation of the Sonic CD bar350SpriteFrame(16, 81, 160, 16, 41, 50)351352// 7 - Set of three lines353SpriteFrame(100, 32, 24, 48, 188, 1)354355// 8-23 - Individual letters spelling out Stardust Speedway356SpriteFrame(0, 0, 16, 55, 142, 133) // #8 - S357SpriteFrame(16, 32, 10, 23, 81, 108) // #9 - T358SpriteFrame(26, 32, 11, 23, 43, 84) // #10 - A359SpriteFrame(38, 32, 12, 23, 57, 108) // #11 - R360SpriteFrame(51, 32, 11, 23, 76, 84) // #12 - D361SpriteFrame(63, 32, 11, 23, 92, 108) // #13 - U362SpriteFrame(75, 32, 10, 23, 70, 108) // #14 - S363SpriteFrame(85, 32, 10, 23, 81, 108) // #15 - T364365SpriteFrame(0, 56, 16, 55, 142, 133) // #16 - S366SpriteFrame(16, 56, 10, 23, 211, 84) // #17 - P367SpriteFrame(26, 56, 9, 23, 88, 84) // #18 - E368SpriteFrame(35, 56, 9, 23, 88, 84) // #19 - E369SpriteFrame(44, 56, 11, 23, 76, 84) // #20 - D370SpriteFrame(55, 56, 17, 23, 116, 108) // #21 - W371SpriteFrame(73, 56, 11, 23, 43, 84) // #22 - A372SpriteFrame(84, 56, 11, 23, 146, 108) // #23 - Y373374#platform: Use_Origins375if game.playMode == BOOT_PLAYMODE_MISSION376TempValue0 = true377else378if game.playMode == BOOT_PLAYMODE_BOSSRUSH379TempValue0 = true380else381TempValue0 = false382end if383end if384385if TempValue0 != false386PlayMusic(0)387388game.missionCondition = 0389game.missionEnd = false390391Player.ControlMode = CONTROLMODE_NORMAL392Stage.TimeEnabled = true393394ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)395Warp.XPos = 0396end if397#endplatform398end sub399400401// ========================402// Editor Subs403// ========================404405sub RSDKDraw406Object.TextSize = 16407Object.TextSize += 8408409TempValue0 = 136410TempValue0 += Object.CharPos411TempValue0 <<= 16412413TempValue1 = 0x500000414TempValue1 += Object.YPos415416DrawSpriteXY(0, Object.XPos, Object.YPos)417DrawSpriteXY(Stage.ActNo, Object.XPos, TempValue1)418DrawSpriteXY(4, Object.XPos, TempValue1)419DrawSpriteXY(5, Object.XPos, TempValue1)420DrawSpriteXY(6, Object.XPos, TempValue1)421DrawSpriteXY(7, Object.XPos, TempValue1)422423TempValue0 = 8424while TempValue0 < Object.TextSize425DrawSpriteXY(TempValue0, Object.XPos, TempValue1)426TempValue0++427loop428end sub429430431sub RSDKLoad432LoadSpriteSheet("Global/Display.gif")433// 0 - Red Bar Frame434SpriteFrame(0, 0, 32, 200, 223, 1)435436// 1-3 - Act Bubbles437SpriteFrame(96, 96, 48, 48, 41, 1)438SpriteFrame(96, 96, 48, 48, 90, 1)439SpriteFrame(96, 96, 48, 48, 139, 1)440441// 4 - "Zone" text442SpriteFrame(64, 97, 48, 16, 41, 67)443444// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar445SpriteFrame(64, 81, 160, 16, 41, 50)446447// 6 - Continuation of the Sonic CD bar448SpriteFrame(16, 81, 160, 16, 41, 50)449450// 7 - Set of three lines451SpriteFrame(100, 32, 24, 48, 188, 1)452453// 8-23 - Individual letters spelling out Stardust Speedway454SpriteFrame(0, 0, 16, 55, 142, 133) // #8 - S455SpriteFrame(16, 32, 10, 23, 81, 108) // #9 - T456SpriteFrame(26, 32, 11, 23, 43, 84) // #10 - A457SpriteFrame(38, 32, 12, 23, 57, 108) // #11 - R458SpriteFrame(51, 32, 11, 23, 76, 84) // #12 - D459SpriteFrame(63, 32, 11, 23, 92, 108) // #13 - U460SpriteFrame(75, 32, 10, 23, 70, 108) // #14 - S461SpriteFrame(85, 32, 10, 23, 81, 108) // #15 - T462463SpriteFrame(0, 56, 16, 55, 142, 133) // #16 - S464SpriteFrame(16, 56, 10, 23, 211, 84) // #17 - P465SpriteFrame(26, 56, 9, 23, 88, 84) // #18 - E466SpriteFrame(35, 56, 9, 23, 88, 84) // #19 - E467SpriteFrame(44, 56, 11, 23, 76, 84) // #20 - D468SpriteFrame(55, 56, 17, 23, 116, 108) // #21 - W469SpriteFrame(73, 56, 11, 23, 43, 84) // #22 - A470SpriteFrame(84, 56, 11, 23, 146, 108) // #23 - Y471472473SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")474end sub475476477