Path: blob/main/Scripts/TitleCards/R9_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_A3132// Time Period Aliases33#alias 0 : TIME_PRESENT34#alias 1 : TIME_PAST35#alias 2 : TIME_GOOD_FUTURE36#alias 3 : TIME_BAD_FUTURE373839// ControlMode Aliases40#alias -1 : CONTROLMODE_NONE41#alias 0 : CONTROLMODE_NORMAL4243// Priority44#alias 1 : PRIORITY_ACTIVE454647sub ObjectPlayerInteraction48Player.Timer = 049end sub505152sub ObjectDraw53switch Object.State54case TITLECARD_FADEIN55Player.ControlMode = CONTROLMODE_NONE56Player.Up = false57Player.Down = false58Player.Left = false59Player.Right = false60Player.JumpPress = false61Player.JumpHold = false6263// Check if the player comes from warping, if not, blank speed64if Warp.XPos < 165Player.Speed = 066end if6768if Object.Timer > 069if Object.Timer == 25670PlayMusic(0)71if Warp.XPos > 072// Restore values post-warp73Player.XPos = Warp.XPos74Player.YPos = Warp.YPos7576Player.XVelocity = Warp.XVelocity77Player.YVelocity = Warp.YVelocity78Player.Speed = Warp.XVelocity7980Player.State = Warp.State8182Stage.MilliSeconds = Rec_Milliseconds83Stage.Seconds = Rec_Seconds84Stage.Minutes = Rec_Minutes8586Player.InvincibleTimer = 800087end if88Warp.Timer = 089Warp.Frame = 090end if9192SetScreenFade(Object.FadeR, Object.FadeG, Object.FadeB, Object.Timer)93Object.Timer -= 894else95Fade_Colour = 09697// the title card animation doesn't play out if you come from a warp or restarted from a checkpoint98CheckEqual(Warp.XPos, 0)99TempValue0 = CheckResult100CheckLower(LampPost.Check, 32)101TempValue0 &= CheckResult102if TempValue0 == true103Object.State = TITLECARD_SLIDEIN104Object.Timer = 0105else106Player.ControlMode = CONTROLMODE_NORMAL107Stage.TimeEnabled = true108109ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)110Warp.XPos = 0111end if112end if113break114115case TITLECARD_SLIDEIN116TempValue0 = 144117TempValue0 += Object.CharPos118119if Object.TextPos > TempValue0120// Slide the text to the left121Object.TextPos -= 8122else123if Object.BarPos == 0124Object.State = TITLECARD_DISPLAY125end if126end if127128if Object.BarPos < 0129// Move the Bar down130Object.BarPos += 8131end if132break133134case TITLECARD_DISPLAY135// Hold for a moment to let the Player see what a nice Title Card this is136137if Object.Timer == 90138// Time's up, start sliding out!139Object.State = TITLECARD_SLIDEOUT140else141Object.Timer++142end if143break144145case TITLECARD_SLIDEOUT146if Object.TextPos < 408147148// Move the text to the right, and...149Object.TextPos += 16150151// ...move the bar upwards as well152Object.BarPos -= 16153154else155// Free Sonic's control, and enable the stage timer.156Player.ControlMode = CONTROLMODE_NORMAL157Stage.TimeEnabled = true158159// The Title Card's job is done, despawn it160ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)161Warp.XPos = 0162end if163break164165end switch166167// Before drawing, make sure this object hasn't been blanked already168// (Under certain circumstances, this can otherwise cause major graphical issues!!)169if Object.Type > TypeName[Blank Object]170TempValue0 = 136171TempValue0 += Object.CharPos172173// Draw the Red Bar174DrawSpriteScreenXY(0, TempValue0, Object.BarPos)175176// And then, draw the act number177DrawSpriteScreenXY(Stage.ActNo, Object.TextPos, 80)178179// And then draw the Zone text, the Sonic CD bar, and the weird three lines180DrawSpriteScreenXY(4, Object.TextPos, 80)181DrawSpriteScreenXY(5, Object.TextPos, 80)182DrawSpriteScreenXY(6, Object.TextPos, 80)183DrawSpriteScreenXY(7, Object.TextPos, 80)184185#platform: Use_Decomp // Creates a black rectangle that fills the empty space on wider resolutions186Tempvalue0 = Object.TextPos187TempValue0 += 220188DrawRect(TempValue0, 163, Screen.XSize, 9, 0, 0, 0, 255)189#endplatform190191// And then Draw the Round Name192// (Letters start at Sprite Frame 8)193TempValue0 = 8194while TempValue0 < Object.TextSize195DrawSpriteScreenXY(TempValue0, Object.TextPos, 80)196TempValue0++197loop198end if199200end sub201202203sub ObjectStartup204205// Load the Display sheet for the current Player206if Stage.PlayerListPos == PLAYER_SONIC_A207LoadSpriteSheet("Global/Display.gif")208else209LoadSpriteSheet("Global/Display_t.gif")210end if211212// Set the music for the Stage213if Options.Soundtrack == OST_JP214SetMusicTrack("JP/FinalBoss.ogg", 0, 1)215else216SetMusicTrack("US/FinalBoss.ogg", 1, 1)217end if218219Flower_TypeNo = TypeName[Flower]220Object[20].Type = TypeName[Title Card]221222// Different Fade-In times depending on if this is a new level load or if the Player is warping in223if Warp.XPos > 0224// If the Player is warping in, have a shorter fade-in time225Object[20].Timer = 256226else227Object[20].Timer = 384228end if229230// In the Final Fever Zone, set a Roof to be active231if Stage.ActNo == 3232Player.RoofBarrier = true233end if234235// Make the Title Card always active, and have it draw above everything236Object[20].Priority = PRIORITY_ACTIVE237Object[20].DrawOrder = 6238239// Set initial Bar & Text Positions240Object[20].BarPos = -216241Object[20].TextPos = 336242243244Object[20].CharPos = Screen.CenterX245Object[20].CharPos -= 160246247if Object[20].CharPos > 3248Object[20].CharPos -= 4249end if250251Object[20].CharPos &= 248252253Object[20].TextPos += Object[20].CharPos254Object[20].TextPos += Object[20].CharPos255256// "Final Fever" is 10 letters long257Object[20].TextSize = 10258259// Bump the value by 8 to correspond with the order of the Sprite Frames260Object[20].TextSize += 8261262// Preserve the color used from the last fade. Fade_Colour is stored as RRGGBB, in hex263264Object[20].FadeR = Fade_Colour265Object[20].FadeR >>= 16266267Object[20].FadeG = Fade_Colour268Object[20].FadeG &= 0x00FF00269Object[20].FadeG >>= 8270271Object[20].FadeB = Fade_Colour272Object[20].FadeB &= 0x0000FF273274// 0 - Red Bar Frame275SpriteFrame(0, 0, 32, 200, 223, 1)276277// 1-3 - Act Bubbles278SpriteFrame(96, 96, 48, 48, 41, 1)279SpriteFrame(96, 96, 48, 48, 90, 1)280SpriteFrame(96, 96, 48, 48, 139, 1)281282// 4 - "Zone" text283SpriteFrame(64, 97, 48, 16, 41, 67)284285// This script has only been included in updated mobile versions, so we don't need to do any of the usual compatability shenanigans here :)286// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar287SpriteFrame(72, 81, 160, 16, 49, 50)288289// 6 - Continuation of the Sonic CD bar290SpriteFrame(16, 81, 160, 16, 41, 50)291292// 7 - Set of three lines293SpriteFrame(100, 32, 24, 48, 188, 1)294295// 8-17 - Individual letters spelling out Final Fever296SpriteFrame(0, 0, 16, 55, 198, 133) // #8 - F297SpriteFrame(17, 32, 6, 23, 169, 108) // #9 - I298SpriteFrame(24, 32, 11, 23, 187, 84) // #10 - N299SpriteFrame(36, 32, 11, 23, 43, 84) // #11 - A300SpriteFrame(48, 32, 9, 23, 159, 84) // #12 - L301302SpriteFrame(0, 56, 16, 55, 198, 133) // #13 - F303SpriteFrame(17, 56, 9, 23, 88, 84) // #14 - E304SpriteFrame(27, 56, 11, 23, 104, 108) // #15 - V305SpriteFrame(39, 56, 9, 23, 88, 84) // #16 - E306SpriteFrame(49, 56, 12, 23, 57, 108) // #17 - R307308// This script doesn't have the Origins Mission/Boss Rush code since this file doesn't even exist in that version309// (It's likely that it's there in the original source though, given R2 and SS have it too, but we can't really verify that since they didn't include any R91C folder in Origins...)310end sub311312313// ========================314// Editor Subs315// ========================316317sub RSDKDraw318Object.TextSize = 10319Object.TextSize += 8320321TempValue0 = 136322TempValue0 += Object.CharPos323TempValue0 <<= 16324325TempValue1 = 0x500000326TempValue1 += Object.YPos327328DrawSpriteXY(0, Object.XPos, Object.YPos)329DrawSpriteXY(Stage.ActNo, Object.XPos, TempValue1)330DrawSpriteXY(4, Object.XPos, TempValue1)331DrawSpriteXY(5, Object.XPos, TempValue1)332DrawSpriteXY(6, Object.XPos, TempValue1)333DrawSpriteXY(7, Object.XPos, TempValue1)334335TempValue0 = 8336while TempValue0 < Object.TextSize337DrawSpriteXY(TempValue0, Object.XPos, TempValue1)338TempValue0++339loop340end sub341342343sub RSDKLoad344LoadSpriteSheet("Global/Display.gif")345// 0 - Red Bar Frame346SpriteFrame(0, 0, 32, 200, 223, 1)347348// 1-3 - Act Bubbles349SpriteFrame(96, 96, 48, 48, 41, 1)350SpriteFrame(96, 96, 48, 48, 90, 1)351SpriteFrame(96, 96, 48, 48, 139, 1)352353// 4 - "Zone" text354SpriteFrame(64, 97, 48, 16, 41, 67)355356// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar357SpriteFrame(64, 81, 160, 16, 41, 50)358359// 6 - Continuation of the Sonic CD bar360SpriteFrame(16, 81, 160, 16, 41, 50)361362// 7 - Set of three lines363SpriteFrame(100, 32, 24, 48, 188, 1)364365// 8-17 - Individual letters spelling out Final Fever366SpriteFrame(0, 0, 16, 55, 198, 133) // #8 - F367SpriteFrame(17, 32, 6, 23, 169, 108) // #9 - I368SpriteFrame(24, 32, 11, 23, 187, 84) // #10 - N369SpriteFrame(36, 32, 11, 23, 43, 84) // #11 - A370SpriteFrame(48, 32, 9, 23, 159, 84) // #12 - L371372SpriteFrame(0, 56, 16, 55, 198, 133) // #13 - F373SpriteFrame(17, 56, 9, 23, 88, 84) // #14 - E374SpriteFrame(27, 56, 11, 23, 104, 108) // #15 - V375SpriteFrame(39, 56, 9, 23, 88, 84) // #16 - E376SpriteFrame(49, 56, 12, 23, 57, 108) // #17 - R377378379SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")380end sub381382383