Path: blob/master/Sonic 2/Scripts/Title/Start.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Start Message Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value4 : object.attractTimer13private alias object.value5 : object.menuSelection1415// States16private alias 0 : START_AWAITACTION17private alias 1 : START_NEWGAME // State 1 is this in Standalone..18private alias 1 : START_FLASHPRESSBUTTON // ..but it's this in Origins19private alias 2 : START_LEVELSELECT20private alias 3 : START_CONTINUESCREEN21private alias 4 : START_ATTRACTMODE22private alias 5 : START_ORIGINSMENU23private alias 6 : START_FLASHOPTION24private alias 7 : START_1PSENDCALLBACK25private alias 8 : START_1PWAITFORCHARSELECT26private alias 9 : START_ORIGINSSTARTGAME27private alias 10 : START_2PSENDCALLBACK2829// Player List Pos Aliases30private alias 3 : PLAYER_SONIC_TAILS_A31private alias 5 : PLAYER_AMY_A32private alias 6 : PLAYER_AMY_TAILS_A3334// Origins Menu Selection Aliases35// (The in-game menu on the title screen, to clarify)36private alias 0 : MENU_1PLAYER37private alias 1 : MENU_2PLAYERVS383940// ========================41// Events42// ========================4344event ObjectUpdate45// In Origins there's a whole new menu on the title screen and that's done in here but there's also the old Standalone script46// here with a lot of changes between the two, so do pardon the dust...47#platform: USE_ORIGINS48CheckTouchRect(0, 0, screen.xsize, screen.ysize) // Funny this is here since mouse input is mapped to buttonA in Origins49if keyPress[0].buttonB == true50checkResult = 151end if5253if keyPress[0].start == true54checkResult = 255end if5657if keyPress[0].buttonA == true58checkResult = 259end if6061if input.pressButton == true62checkResult = 263end if64#endplatform6566switch object.state67case START_AWAITACTION68#platform: USE_STANDALONE69CheckTouchRect(0, 0, screen.xsize, screen.ysize)70if keyPress[0].start == true71checkResult = true72end if7374if keyPress[0].buttonA == true75checkResult = true76end if7778if keyPress[0].buttonB == true79checkResult = true80end if8182if keyPress[0].buttonC == true83checkResult = true84end if85#endplatform8687#platform: USE_ORIGINS88game.continueFlag = false89#endplatform9091if checkResult > -192#platform: USE_STANDALONE93if options.stageSelectFlag == true94if checkResult > 095object.state = START_LEVELSELECT96else97object.state = START_NEWGAME98end if99else100object.state = START_NEWGAME101end if102103PlaySfx(SfxName[Menu Select], false)104StopMusic()105#endplatform106107#platform: USE_ORIGINS108if options.stageSelectFlag == true109object.state = START_LEVELSELECT110StopMusic()111PlaySfx(SfxName[Menu Select], false)112else113if keyPress[0].buttonB == true114CallNativeFunction2(NotifyCallback, NOTIFY_BACK_TO_MAINMENU, 0)115else116object.state = START_FLASHPRESSBUTTON117end if118end if119#endplatform120else121object.attractTimer++122if object.attractTimer == 420123#platform: USE_ORIGINS124object.timer = 0125#endplatform126object.state = START_ATTRACTMODE127end if128end if129break130131#platform: USE_STANDALONE132case START_NEWGAME133object.timer += 8134if object.timer == 320135options.attractMode = false136player.lives = 3137player.continues = 0138player.score = 0139player.scoreBonus = 50000140starPostID = 0141specialStage.listPos = 0142specialStage.emeralds = 0143specialStage.nextZone = 0144145// New Game - to EHZ1 you go!146stage.activeList = REGULAR_STAGE147stage.listPos = 0148LoadStage()149end if150SetScreenFade(0x00, 0x00, 0x00, object.timer)151break152#endplatform153154#platform: USE_ORIGINS155case START_FLASHPRESSBUTTON156object.animationTimer += 10157object.timer++158if object.timer >= 30159object.animationTimer = 0160object.menuSelection = MENU_1PLAYER161object.state = START_ORIGINSMENU162end if163break164#endplatform165166case START_LEVELSELECT167object.timer += 8168if object.timer == 320169options.attractMode = false170player.lives = 3171player.continues = 0172player.score = 0173player.scoreBonus = 50000174starPostID = 0175specialStage.listPos = 0176specialStage.emeralds = 0177specialStage.nextZone = 0178179// Level Select180stage.activeList = PRESENTATION_STAGE181stage.listPos = 5182LoadStage()183end if184SetScreenFade(0x00, 0x00, 0x00, object.timer)185break186187case START_CONTINUESCREEN188object.timer += 8189if object.timer == 320190// Continue Screen...?191options.attractMode = false192stage.listPos = 4193LoadStage()194end if195SetScreenFade(0x00, 0x00, 0x00, object.timer)196break197198case START_ATTRACTMODE199object.timer += 8200if object.timer >= 320201player.lives = 3202player.continues = 0203player.score = 0204player.scoreBonus = 50000205starPostID = 0206specialStage.listPos = 0207specialStage.emeralds = 0208specialStage.nextZone = 0209210// Attract Mode time211stage.activeList = REGULAR_STAGE212stage.listPos = attract.stage213stage.listPos <<= 1214215attract.stage++216attract.stage &= 3217options.attractMode = true218credits.screen = 0219220#platform: USE_ORIGINS221// Amy isn't allowed to be in the demos, apparently222switch stage.playerListPos223case PLAYER_AMY_A224stage.playerListPos = PLAYER_SONIC225break226227case PLAYER_AMY_TAILS_A228stage.playerListPos = PLAYER_SONIC_TAILS229break230end switch231#endplatform232233LoadStage()234end if235SetScreenFade(0x00, 0x00, 0x00, object.timer)236break237238#platform: USE_ORIGINS239case START_ORIGINSMENU240temp0 = false241242if keyPress[0].up == true243temp0 = true244end if245if keyPress[0].down == true246temp0 = true247end if248249if checkResult > 0250object.animationTimer = 0251object.timer = 0252253if checkResult > 1254object.state = START_FLASHOPTION255else256object.state = START_AWAITACTION257end if258259temp0 = false260end if261262if temp0 != false263if object.menuSelection == MENU_1PLAYER264object.menuSelection = MENU_2PLAYERVS265else266object.menuSelection = MENU_1PLAYER267end if268end if269break270271case START_FLASHOPTION272object.animationTimer += 11273if object.animationTimer > 59274object.animationTimer = 0275end if276277object.timer++278if object.timer >= 30279object.timer = 0280object.animationTimer = 0281282if object.menuSelection == MENU_1PLAYER283object.state = START_1PSENDCALLBACK284else285game.callbackResult = -1286CallNativeFunction2(NotifyCallback, NOTIFY_CONTROLLER_SUPPORT, 0) // Opens the controller setup screen on Switch287object.state = START_2PSENDCALLBACK288end if289end if290break291292case START_1PSENDCALLBACK293game.continueFlag = false294game.callbackResult = -1295CallNativeFunction2(NotifyCallback, NOTIFY_CHARACTER_SELECT, 0)296object.state = START_1PWAITFORCHARSELECT297break298299case START_1PWAITFORCHARSELECT300if game.callbackResult > 0301object.state = START_ORIGINSSTARTGAME302if stage.playerListPos > PLAYER_SONIC_TAILS_A // Not really sure what this check is for303CallNativeFunction2(NotifyCallback, NOTIFY_1P_VS_SELECT, 0)304end if305StopMusic()306else307if game.callbackResult == 0308object.state = START_AWAITACTION309end if310end if311// Fall-through312313case START_ORIGINSSTARTGAME314object.timer += 8315if object.timer >= 320316if game.continueFlag != false317game.continueFlag = false318engine.state = RESET_GAME319else320options.attractMode = false321player.lives = 3322player.continues = 0323player.score = 0324player.scoreBonus = 50000325starPostID = 0326specialStage.listPos = 0327specialStage.emeralds = 0328specialStage.nextZone = 0329recWaterState = 0330recWaterLevel = 0331recMilliSeconds = 0332recRing = 0333recScore = 0334335if object.menuSelection == MENU_1PLAYER336// EHZ1337stage.activeList = REGULAR_STAGE338stage.listPos = 0339else340// 2P VS menu341stage.activeList = PRESENTATION_STAGE342stage.listPos = 3343end if344LoadStage()345end if346end if347SetScreenFade(0, 0, 0, object.timer)348break349350case START_2PSENDCALLBACK351if game.callbackResult > 0352object.state = START_ORIGINSSTARTGAME353else354if game.callbackResult == 0355object.state = START_ORIGINSMENU356end if357end if358break359#endplatform360end switch361end event362363364event ObjectDraw365#platform: USE_STANDALONE366object.animationTimer++367if object.animationTimer > 59368object.animationTimer = 0369end if370371if object.animationTimer > 29372DrawSpriteScreenXY(0, screen.xcenter, object.ypos)373end if374#endplatform375376#platform: USE_ORIGINS377switch object.state378case START_AWAITACTION379case START_FLASHPRESSBUTTON380case START_LEVELSELECT381case START_CONTINUESCREEN382case START_ATTRACTMODE383object.animationTimer++384if object.animationTimer > 59385object.animationTimer = 0386end if387388if object.animationTimer > 29389DrawSpriteScreenXY(0, screen.xcenter, object.ypos)390end if391break392393case START_ORIGINSMENU394case START_FLASHOPTION395case START_1PSENDCALLBACK396temp0 = object.ypos // temp0: "1 Player" line ypos397temp1 = object.ypos // temp1: "2 Player VS" line ypos398temp1 += 12399if object.menuSelection == MENU_1PLAYER400if object.animationTimer < 29401DrawSpriteScreenXY(2, screen.xcenter, temp0)402end if403DrawSpriteScreenXY(3, screen.xcenter, temp1)404DrawSpriteScreenXY(5, screen.xcenter, temp0)405else406DrawSpriteScreenXY(1, screen.xcenter, temp0)407if object.animationTimer < 29408DrawSpriteScreenXY(4, screen.xcenter, temp1)409end if410DrawSpriteScreenXY(5, screen.xcenter, temp1)411end if412break413414case START_1PWAITFORCHARSELECT415case START_ORIGINSSTARTGAME416case START_2PSENDCALLBACK417break418end switch419#endplatform420end event421422423event ObjectStartup424#platform: USE_ORIGINS425CallNativeFunction2(NotifyCallback, NOTIFY_LEVEL_SELECT_MENU, false)426#endplatform427428LoadSpriteSheet("Title/Title.gif")429switch engine.deviceType430case STANDARD431SpriteFrame(-49, -1, 98, 9, 1, 380) // Press Button - #0432break433434case MOBILE435SpriteFrame(-57, -1, 114, 9, 1, 390) // Touch To Start - #0436break437end switch438439#platform: USE_ORIGINS440SpriteFrame(-40, -1, 66, 9, 1, 400) // 1 PLAYER - #1441SpriteFrame(-40, -1, 66, 9, 92, 400) // 1 PLAYER (Highlighted) - #2442SpriteFrame(-40, -1, 90, 9, 1, 410) // 2 PLAYER VS - #3443SpriteFrame(-40, -1, 90, 9, 92, 410) // 2 PLAYER VS (Highlighted) - #4444SpriteFrame(-60, -5, 16, 16, 104, 370) // Sonic Icon - #5445#endplatform446end event447448449// ========================450// Editor Events451// ========================452453event RSDKDraw454DrawSprite(0)455end event456457458event RSDKLoad459LoadSpriteSheet("Title/Title.gif")460SpriteFrame(-49, -1, 98, 9, 1, 380) // Press Button - #0461462SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")463end event464465466