Path: blob/main/Scripts/Title/Start.txt
1319 views
//---------------------Sonic CD Start Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Fade6#alias Object.Value1 : Object.StageSelectCheatPos7#alias Object.Value2 : Object.SoundTestCheatPos8#alias Object.Value3 : Object.DemoTimer910// States11#alias 0 : START_SETUP12#alias 1 : START_GOTO_MENU13#alias 2 : START_GOTO_STAGESELECT // Unused14#alias 3 : START_GOTO_SOUNDTEST // Unused15#alias 4 : START_GOTO_DEMO1617// Cheat Input Aliases18#alias 0 : CHEATINPUT_NONE19#alias 1 : CHEATINPUT_UP20#alias 2 : CHEATINPUT_DOWN21#alias 3 : CHEATINPUT_LEFT22#alias 4 : CHEATINPUT_RIGHT23#alias 5 : CHEATINPUT_BUTTONA24#alias 6 : CHEATINPUT_BUTTONB25#alias 7 : CHEATINPUT_BUTTONC2627// DemoNumber Aliases28#alias 0 : DEMO_R11A29#alias 1 : DEMO_SS130#alias 2 : DEMO_R43C31#alias 3 : DEMO_SS632#alias 4 : DEMO_R82A33#alias 5 : DEMO_MAX3435// Select Aliases36#alias 0 : SELECT_INIT3738// Global SFX39#alias 1 : SFX_G_RING40#alias 27 : SFX_G_SELECT4142// Callbacks & Engine States43#alias 1 : CALLBACK_PRESS_START44#alias 7 : CALLBACK_EXIT_SELECTED45#alias 16 : CALLBACK_MOREGAMES4647// Game Mode Aliases48#alias 0 : MODE_NOSAVE4950// Language Aliases51#alias 0 : LANG_ENGLISH52#alias 1 : LANG_FRENCH53#alias 2 : LANG_ITALIAN54#alias 3 : LANG_DEUTSCH55#alias 4 : LANG_SPANISH56#alias 5 : LANG_JAPANESE5758// Presentation Stages59#alias 1 : STAGE_P_MENU60#alias 3 : STAGE_P_STAGESELECT61#alias 4 : STAGE_P_SOUNDTEST6263// Regular Stages64#alias 0 : STAGE_R_R11A65#alias 28 : STAGE_R_R43C66#alias 64 : STAGE_R_R82A6768// Special Stages69#alias 0 : STAGE_S_SS170#alias 5 : STAGE_S_SS67172// Device Type73#alias 0 : RETRO_STANDARD7475// Entirely functional, yet unused76// Perhaps it was removed because it would devalue unlocking things in Time Attack?77// No way to say for sure78#function TouchStart_HandleCheatCodes798081function TouchStart_HandleCheatCodes82TempValue0 = CHEATINPUT_NONE8384if KeyPress[0].Up == true85TempValue0 = CHEATINPUT_UP86end if8788if KeyPress[0].Down == true89TempValue0 = CHEATINPUT_DOWN90end if9192if KeyPress[0].Left == true93TempValue0 = CHEATINPUT_LEFT94end if9596if KeyPress[0].Right == true97TempValue0 = CHEATINPUT_RIGHT98end if99100if KeyPress[0].ButtonA == true101TempValue0 = CHEATINPUT_BUTTONA102end if103104if KeyPress[0].ButtonB == true105TempValue0 = CHEATINPUT_BUTTONB106end if107108if KeyPress[0].ButtonC == true109TempValue0 = CHEATINPUT_BUTTONC110end if111112// Up, Down, Down, Left, Right, B113switch Object.StageSelectCheatPos114case 0115if TempValue0 == CHEATINPUT_UP116Object.StageSelectCheatPos++117else118if TempValue0 != CHEATINPUT_NONE119Object.StageSelectCheatPos = 0120end if121end if122break123124case 1125if TempValue0 == CHEATINPUT_DOWN126Object.StageSelectCheatPos++127else128if TempValue0 != CHEATINPUT_NONE129Object.StageSelectCheatPos = 0130end if131end if132break133134case 2135if TempValue0 == CHEATINPUT_DOWN136Object.StageSelectCheatPos++137else138if TempValue0 != CHEATINPUT_NONE139Object.StageSelectCheatPos = 0140end if141end if142break143144case 3145if TempValue0 == CHEATINPUT_LEFT146Object.StageSelectCheatPos++147else148if TempValue0 != CHEATINPUT_NONE149Object.StageSelectCheatPos = 0150end if151end if152break153154case 4155if TempValue0 == CHEATINPUT_RIGHT156Object.StageSelectCheatPos++157else158if TempValue0 != CHEATINPUT_NONE159Object.StageSelectCheatPos = 0160end if161end if162break163164case 5165if TempValue0 == CHEATINPUT_BUTTONB166Object.StageSelectCheatPos = 0167168// Go to the Stage Select169Object.State = START_GOTO_STAGESELECT170StopMusic()171172// Just a cool lil' jingle :)173PlaySfx(SFX_G_RING, false)174else175if TempValue0 != CHEATINPUT_NONE176Object.StageSelectCheatPos = 0177end if178end if179break180end switch181182// Down, Down, Down, Left, Right, A183switch Object.SoundTestCheatPos184case 0185if TempValue0 == CHEATINPUT_DOWN186Object.SoundTestCheatPos++187else188if TempValue0 != CHEATINPUT_NONE189Object.SoundTestCheatPos = 0190end if191end if192break193194case 1195if TempValue0 == CHEATINPUT_DOWN196Object.SoundTestCheatPos++197else198if TempValue0 != CHEATINPUT_NONE199Object.SoundTestCheatPos = 0200end if201end if202break203204case 2205if TempValue0 == CHEATINPUT_DOWN206Object.SoundTestCheatPos++207else208if TempValue0 != CHEATINPUT_NONE209Object.SoundTestCheatPos = 0210end if211end if212break213214case 3215if TempValue0 == CHEATINPUT_LEFT216Object.SoundTestCheatPos++217else218if TempValue0 != CHEATINPUT_NONE219Object.SoundTestCheatPos = 0220end if221end if222break223224case 4225if TempValue0 == CHEATINPUT_RIGHT226Object.SoundTestCheatPos++227else228if TempValue0 != CHEATINPUT_NONE229Object.SoundTestCheatPos = 0230end if231end if232break233234case 5235if TempValue0 == CHEATINPUT_BUTTONA236Object.SoundTestCheatPos = 0237238// Go to the Sound Test239Object.State = START_GOTO_SOUNDTEST240StopMusic()241242PlaySfx(SFX_G_RING, false)243else244if TempValue0 != CHEATINPUT_NONE245Object.SoundTestCheatPos = 0246end if247end if248break249end switch250end function251252253sub ObjectMain254#platform: Use_Origins255Menu.ExitFlag = true256#endplatform257258switch Object.State259case START_SETUP260CheckTouchRect(0, 0, Screen.XSize, 240)261262#platform: Use_Origins263// On Origins, you can back out if you really want to264if KeyPress[0].ButtonB == true265EngineCallback(NOTIFY_BACK_TO_MAINMENU)266end if267268if KeyPress[0].Start == true269CheckResult = false270end if271272if KeyPress[0].ButtonA == true273CheckResult = false274end if275276if input.pressButton == true277CheckResult = false278end if279#endplatform280281#platform: Use_Standalone282if KeyPress[0].Start == true283CheckResult = false284end if285#endplatform286287if CheckResult > -1 // Check if you used the touch input, or if what's above is true288// The Player's (reportedly) interacted with the game in some form, so start the Select sequence289Object.State = START_GOTO_MENU // Select Menu290291#platform: Use_Origins292Object[+1].Type = TypeName[Select]293Object[+1].iXPos = Screen.CenterX294Object[+1].iYPos = 200295Object[+1].State = SELECT_INIT296#endplatform297298#platform: Use_Standalone299StopMusic()300PlaySfx(SFX_G_SELECT, false)301302#endplatform303304#platform: Use_Haptics305HapticEffect(31, 0, 0, 0)306#endplatform307else308Object.DemoTimer++309310if Object.DemoTimer == 1550311Object.State = START_GOTO_DEMO312end if313end if314315// I mean, if you want to I guess?316if Engine.PlatformID == RETRO_WP7317if KeyPress[0].ButtonB == true318EngineCallback(CALLBACK_EXIT_SELECTED)319end if320end if321break322323case START_GOTO_MENU324// In Origins, this state does nothing and all the stuff in handled by the Select object instead325#platform: Use_Standalone326Object.Fade += 4327if Object.Fade == 384328Stage.ListPos = STAGE_P_MENU329LoadStage()330end if331332SetScreenFade(0, 0, 0, Object.Fade)333#endplatform334break335336case START_GOTO_STAGESELECT // This state is unused337Object.Fade += 4338339if Object.Fade == 384340Options.GameMode = MODE_NOSAVE341Stage.ListPos = STAGE_P_STAGESELECT342LoadStage()343end if344345SetScreenFade(0, 0, 0, Object.Fade)346break347348case START_GOTO_SOUNDTEST // This state is also unused349Object.Fade += 4350351if Object.Fade == 384352Options.GameMode = MODE_NOSAVE353Stage.ListPos = STAGE_P_SOUNDTEST354LoadStage()355end if356357SetScreenFade(0, 0, 0, Object.Fade)358break359360case START_GOTO_DEMO361Object.Fade += 4362363if Object.Fade == 384364Engine.HapticsEnabled = false365366Fade_Colour = 0x000000367368// Reset loads of stuff369Player.Score = 0370Player.Lives = 3371Player.ScoreBonus = 50000372Transporter_Destroyed = false373MetalSonic_Destroyed = false374Good_Future = false375Options.GameMode = MODE_NOSAVE376Options.AttractMode = true377378if Engine.PlatformID == RETRO_ANDROID379if Engine.TrialMode == true380Options.DemoNumber = 0381end if382end if383384switch Options.DemoNumber385case DEMO_R11A386// R11A - Palmtree Panic Act 1, Present387Stage.ActiveList = REGULAR_STAGE388Stage.ListPos = STAGE_R_R11A389break390391case DEMO_SS1392// SS1 - Special Stage 1393Stage.ActiveList = SPECIAL_STAGE394#platform: Use_Origins395Stage.ActiveList = 3396#endplatform397Stage.ListPos = STAGE_S_SS1398break399400case DEMO_R43C401// R43C - Tidal Tempest 3, Good Future402Stage.ActiveList = REGULAR_STAGE403Stage.ListPos = STAGE_R_R43C404break405406case DEMO_SS6407// SS6 - Special Stage 6408Stage.ActiveList = SPECIAL_STAGE409#platform: Use_Origins410Stage.ActiveList = 3411#endplatform412Stage.ListPos = STAGE_S_SS6413break414415case DEMO_R82A416// R82A - Metallic Madness 2 Present417Stage.ActiveList = REGULAR_STAGE418Stage.ListPos = STAGE_R_R82A419break420end switch421422// Cycle through the same 6 demos423Options.DemoNumber++424Options.DemoNumber %= 5425426#platform: Use_Origins427// Sonic Team REALLY hates the concept of Amy being in attract demos428// The Sonic object already sets the player to him, so this is pretty redundant429if Stage.PlayerListPos == PLAYER_AMY430Stage.PlayerListPos = PLAYER_SONIC431end if432#endplatform433434LoadStage()435end if436437SetScreenFade(0, 0, 0, Object.Fade)438break439440end switch441442end sub443444445sub ObjectDraw446#platform: Use_Origins447// Don't display the following if the Select menu is open448if Object.State != START_GOTO_MENU449Object.AnimationTimer++450if Object.AnimationTimer > 59451Object.AnimationTimer = 0452end if453454// If in the upper half of a second, then455if Object.AnimationTimer > 29456if Engine.DeviceType == RETRO_STANDARD457// On standard Platforms, display the "Press Button" text458DrawSprite(2)459else460// On mobile Platforms, display the corresponding language text for461// telling the player to tap the screen462DrawSprite(1)463end if464end if465end if466467// Get the cordinates for the bottom right of the screen468TempValue0 = Screen.XSize469TempValue0 -= 22470471TempValue1 = Screen.YSize472TempValue1 -= 12473474// Draw the Sega copyright sprite there475DrawSpriteScreenXY(3, TempValue0, TempValue1)476#endplatform477478#platform: Use_Standalone479Object.AnimationTimer++480if Object.AnimationTimer > 59481Object.AnimationTimer = 0482end if483#endplatform484485#platform: Use_Standalone486#platform: Standard487if Object.AnimationTimer > 29488DrawSprite(0)489end if490#endplatform491#endplatform492493#platform: Use_Standalone494#platform: Mobile495if Object.AnimationTimer > 29496DrawSprite(1)497end if498#endplatform499#endplatform500end sub501502503sub ObjectStartup504#platform: Use_Origins505game.callbackParam0 = false506EngineCallback(NOTIFY_LEVEL_SELECT_MENU)507#endplatform508LoadSpriteSheet("Title/Title.gif")509510// The following Sprites differ between languages511512// They follow the order of513// 0 - Press to Start514// 1 - Touch to Start!515516// But of course in the language they correspond to517518switch Engine.Language519case LANG_ENGLISH520case LANG_JAPANESE521SpriteFrame(-43, 0, 87, 11, 106, 103) // Press Start522SpriteFrame(-56, 0, 117, 11, 106, 91) // Touch to Start!523break524525case LANG_FRENCH526SpriteFrame(-60, 0, 120, 11, 391, 387) // Appui sur Start527SpriteFrame(-94, 0, 189, 11, 322, 399) // Touche pour Commencer !528break529530case LANG_ITALIAN531SpriteFrame(-44, 0, 88, 11, 270, 411) // Premi Start532SpriteFrame(-76, 0, 152, 11, 359, 411) // Tocca Per Iniziare!533break534535case LANG_DEUTSCH536SpriteFrame(-52, -2, 106, 13, 405, 373) // Start Drücken537SpriteFrame(-87, 0, 175, 11, 336, 423) // Zum Starten Antippen!538break539540case LANG_SPANISH541SpriteFrame(-43, 0, 87, 11, 274, 435) // Pulsa Start542SpriteFrame(-74, 0, 149, 11, 362, 435) // ¡Toca para Empezar!543break544end switch545546SpriteFrame(-48, 0, 97, 11, 414, 361) // Press Button (Same sprite regardless of language)547SpriteFrame(-88, -8, 88, 8, 423, 311) // Sega Copyright text548end sub549550551// ========================552// Editor Subs553// ========================554555sub RSDKDraw556DrawSprite(0)557end sub558559560sub RSDKLoad561LoadSpriteSheet("Title/Title.gif")562SpriteFrame(-43, 0, 87, 11, 106, 103) // LANG_ENGLISH "Press Start"563564SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")565end sub566567568