Path: blob/main/Scripts/TitleCards/R2_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 -= 8123else124if Object.BarPos == 0125Object.State = TITLECARD_DISPLAY126end if127end if128129if Object.BarPos < 0130// Move the Bar down131Object.BarPos += 8132end if133break134135case TITLECARD_DISPLAY136// Hold for a moment to let the Player see what a nice Title Card this is137138if Object.Timer == 90139// Time's up, start sliding out!140Object.State = TITLECARD_SLIDEOUT141else142Object.Timer++143end if144break145146case TITLECARD_SLIDEOUT147if Object.TextPos < 408148149// Move the text to the right, and...150Object.TextPos += 16151152// ...move the bar upwards as well153Object.BarPos -= 16154155else156// Free Sonic's control, and enable the stage timer.157Player.ControlMode = CONTROLMODE_NORMAL158Stage.TimeEnabled = true159160// The Title Card's job is done, despawn it161ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)162Warp.XPos = 0163end if164break165166end switch167168// Before drawing, make sure this object hasn't been blanked already169// (Under certain circumstances, this can otherwise cause major graphical issues!!)170if Object.Type > TypeName[Blank Object]171TempValue0 = 136172TempValue0 += Object.CharPos173174// Draw the Red Bar175DrawSpriteScreenXY(0, TempValue0, Object.BarPos)176177// And then, draw the act number178DrawSpriteScreenXY(Stage.ActNo, Object.TextPos, 80)179180// And then draw the Zone text, the Sonic CD bar, and the weird three lines181DrawSpriteScreenXY(4, Object.TextPos, 80)182DrawSpriteScreenXY(5, Object.TextPos, 80)183DrawSpriteScreenXY(6, Object.TextPos, 80)184DrawSpriteScreenXY(7, Object.TextPos, 80)185186#platform: Use_Decomp // Creates a black rectangle that fills the empty space on wider resolutions187Tempvalue0 = Object.TextPos188TempValue0 += 220189DrawRect(TempValue0, 163, Screen.XSize, 9, 0, 0, 0, 255)190#endplatform191192// And then Draw the Round Name193// (Letters start at Sprite Frame 8)194TempValue0 = 8195while TempValue0 < Object.TextSize196DrawSpriteScreenXY(TempValue0, Object.TextPos, 80)197TempValue0++198loop199end if200201end sub202203204sub ObjectStartup205// Load the Display sheet for the current Player206if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins207LoadSpriteSheet("Global/Display.gif")208end if209if Stage.PlayerListPos == PLAYER_TAILS_A // PLAYER_TAILS in origins210LoadSpriteSheet("Global/Display_t.gif")211end if212#platform: Use_Origins213if Stage.PlayerListPos == PLAYER_KNUCKLES214LoadSpriteSheet("Global/Display_k.gif")215end if216if Stage.PlayerListPos == PLAYER_AMY217LoadSpriteSheet("Global/Display_a.gif")218end if219#endplatform220221SetMusicTrack("JP/DAGarden.ogg", 0, true)222223Flower_TypeNo = TypeName[Flower]224Object[20].Type = TypeName[Title Card]225226// Different Fade-In times depending on if this is a new level load or if the Player is warping in227if Warp.XPos > 0228// If the Player is warping in, have a shorter fade-in time229Object[20].Timer = 256230else231Object[20].Timer = 384232end if233234// In the... Desert Dazzle boss Zone, set a Roof to be active...?235if Stage.ActNo == 3236Player.RoofBarrier = true237end if238239// Make the Title Card always active, and have it draw above everything240Object[20].Priority = PRIORITY_ACTIVE241Object[20].DrawOrder = 6242243// Set initial Bar & Text Positions244Object[20].BarPos = -216245Object[20].TextPos = 336246247248Object[20].CharPos = Screen.CenterX249Object[20].CharPos -= 160250251if Object[20].CharPos > 3252Object[20].CharPos -= 4253end if254255Object[20].CharPos &= 248256257Object[20].TextPos += Object[20].CharPos258Object[20].TextPos += Object[20].CharPos259260// "Desert Dazzle" is 12 letters long261Object[20].TextSize = 12262263// Bump the value by 8 to correspond with the order of the Sprite Frames264Object[20].TextSize += 8265266// Preserve the color used from the last fade. Fade_Colour is stored as RRGGBB, in hex267268Object[20].FadeR = Fade_Colour269Object[20].FadeR >>= 16270271Object[20].FadeG = Fade_Colour272Object[20].FadeG &= 0x00FF00273Object[20].FadeG >>= 8274275Object[20].FadeB = Fade_Colour276Object[20].FadeB &= 0x0000FF277278// 0 - Red Bar Frame279SpriteFrame(0, 0, 32, 200, 223, 1)280281// 1-3 - Act Bubbles282SpriteFrame(96, 96, 48, 48, 41, 1)283SpriteFrame(96, 96, 48, 48, 90, 1)284SpriteFrame(96, 96, 48, 48, 139, 1)285286// 4 - "Zone" text287SpriteFrame(64, 97, 48, 16, 41, 67)288289// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar290291// Workaround for steam datafile to show this sprite correctly292#platform: Use_Origins293SpriteFrame(72, 81, 160, 16, 49, 50) // #5 - Sonic The Hedgehog CD294#endplatform295296#platform: Use_Standalone297#platform: Standard298SpriteFrame(64, 81, 160, 16, 41, 50)// #5 - Sonic The Hedgehog CD299#endplatform300#endplatform301302#platform: Use_Standalone303#platform: Mobile304SpriteFrame(72, 81, 160, 16, 49, 50)// #5 - Sonic The Hedgehog CD305#endplatform306#endplatform307308// 6 - Continuation of the Sonic CD bar309SpriteFrame(16, 81, 160, 16, 41, 50)310311// 7 - Set of three lines312SpriteFrame(100, 32, 24, 48, 188, 1)313314// 8-19 - Individual letters spelling out Desert Dazzle315SpriteFrame(0, 0, 17, 55, 180, 133) // #8 - D316SpriteFrame(18, 32, 9, 23, 88, 84) // #9 - E317SpriteFrame(28, 32, 10, 23, 70, 108) // #10 - S318SpriteFrame(39, 32, 9, 23, 88, 84) // #11 - E319SpriteFrame(49, 32, 12, 23, 57, 108) // #12 - R320SpriteFrame(62, 32, 10, 23, 81, 108) // #13 - T321322SpriteFrame(0, 56, 17, 55, 180, 133) // #14 - D323SpriteFrame(18, 56, 11, 23, 43, 84) // #15 - A324SpriteFrame(30, 56, 10, 23, 158, 108) // #16 - Z325SpriteFrame(41, 56, 10, 23, 158, 108) // #17 - Z326SpriteFrame(52, 56, 9, 23, 159, 84) // #18 - L327SpriteFrame(62, 56, 9, 23, 88, 84) // #19 - E328329#platform: Use_Origins330// They copy pasted this through all the title cards. This script isn't even used and yet it's Mission-ready LOL331332if game.playMode == BOOT_PLAYMODE_MISSION333TempValue0 = true334else335if game.playMode == BOOT_PLAYMODE_BOSSRUSH336TempValue0 = true337else338TempValue0 = false339end if340end if341342if TempValue0 != false343PlayMusic(0)344345game.missionCondition = 0346game.missionEnd = false347348Player.ControlMode = CONTROLMODE_NORMAL349Stage.TimeEnabled = true350351ResetObjectEntity(20, TypeName[Blank Object], 0, 0, 0)352Warp.XPos = 0353end if354#endplatform355end sub356357358// ========================359// Editor Subs360// ========================361362sub RSDKDraw363Object.TextSize = 12364Object.TextSize += 8365366TempValue0 = 136367TempValue0 += Object.CharPos368TempValue0 <<= 16369370TempValue1 = 0x500000371TempValue1 += Object.YPos372373DrawSpriteXY(0, Object.XPos, Object.YPos)374DrawSpriteXY(Stage.ActNo, Object.XPos, TempValue1)375DrawSpriteXY(4, Object.XPos, TempValue1)376DrawSpriteXY(5, Object.XPos, TempValue1)377DrawSpriteXY(6, Object.XPos, TempValue1)378DrawSpriteXY(7, Object.XPos, TempValue1)379380TempValue0 = 8381while TempValue0 < Object.TextSize382DrawSpriteXY(TempValue0, Object.XPos, TempValue1)383TempValue0++384loop385end sub386387388sub RSDKLoad389LoadSpriteSheet("Global/Display.gif")390// 0 - Red Bar Frame391SpriteFrame(0, 0, 32, 200, 223, 1)392393// 1-3 - Act Bubbles394SpriteFrame(96, 96, 48, 48, 41, 1)395SpriteFrame(96, 96, 48, 48, 90, 1)396SpriteFrame(96, 96, 48, 48, 139, 1)397398// 4 - "Zone" text399SpriteFrame(64, 97, 48, 16, 41, 67)400401// 5 - Main part of the "SONIC THE HEGDEHOG CD" bar402SpriteFrame(64, 81, 160, 16, 41, 50)403404// 6 - Continuation of the Sonic CD bar405SpriteFrame(16, 81, 160, 16, 41, 50)406407// 7 - Set of three lines408SpriteFrame(100, 32, 24, 48, 188, 1)409410// 8-19 - Individual letters spelling out Desert Dazzle411SpriteFrame(0, 0, 17, 55, 180, 133) // #8 - D412SpriteFrame(18, 32, 9, 23, 88, 84) // #9 - E413SpriteFrame(28, 32, 10, 23, 70, 108) // #10 - S414SpriteFrame(39, 32, 9, 23, 88, 84) // #11 - E415SpriteFrame(49, 32, 12, 23, 57, 108) // #12 - R416SpriteFrame(62, 32, 10, 23, 81, 108) // #13 - T417418SpriteFrame(0, 56, 17, 55, 180, 133) // #14 - D419SpriteFrame(18, 56, 11, 23, 43, 84) // #15 - A420SpriteFrame(30, 56, 10, 23, 158, 108) // #16 - Z421SpriteFrame(41, 56, 10, 23, 158, 108) // #17 - Z422SpriteFrame(52, 56, 9, 23, 159, 84) // #18 - L423SpriteFrame(62, 56, 9, 23, 88, 84) // #19 - E424425SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")426end sub427428429