Path: blob/main/Scripts/TAttack/MenuControl.txt
1319 views
//----------------Sonic CD Menu Control Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer // Also used for fading6#alias Object.Value2 : Object.SelectedButton // Only used for Mobile7#alias Object.Value3 : Object.SavedRound // This is used AFTER you play in time attack8#alias Object.Value4 : Object.SMYPos // Also used for the XPos of the zone portrait9#alias Object.Value5 : Object.SMCurrentButton10#alias Object.Value6 : Object.BeatedRecord11#alias Object.Value7 : Object.SSUnlocked12#alias Object.Scale : Object.OffSet1314// Large Icon / Special Large Icon Aliases15#alias Object[40].State : LargeIcon.State16#alias Object[40].XPos : LargeIcon.XPos17#alias Object[40].PropertyValue : LargeIcon.Portrait1819// Time Stuff20#alias Object.Value1 : Object.Minutes21#alias Object.Value2 : Object.Seconds22#alias Object.Value3 : Object.Milliseconds23#alias Object.Value4 : Object.ZoneLocked2425// States26// *SM = Sub Menu27#alias 0 : MENUCONTROL_SETUP28#alias 1 : MENUCONTROL_FADEIN29#alias 2 : MENUCONTROL_CONTROLS30#alias 3 : MENUCONTROL_BLANK31#alias 4 : MENUCONTROL_RETURN_TO_MENU32#alias 5 : MENUCONTROL_ENTER_SM33#alias 6 : MENUCONTROL_CALL_RECORD_MENU34#alias 7 : MENUCONTROL_SM_CONTROLS35#alias 8 : MENUCONTROL_SM_SCROLL_DOWN36#alias 9 : MENUCONTROL_SM_SCROLL_UP37#alias 10 : MENUCONTROL_SM_CONFIRMED38#alias 11 : MENUCONTROL_SM_LOAD_LEVEL39#alias 12 : MENUCONTROL_SM_LEVEL_RETURN40#alias 13 : MENUCONTROL_SM_COMFIRMED_LEAVE41#alias 14 : MENUCONTROL_SM_EXIT42#alias 15 : MENUCONTROL_SM_RECORD_BEATED43#alias 16 : MENUCONTROL_SCROLL_DOWN44#alias 17 : MENUCONTROL_SCROLLING_145#alias 18 : MENUCONTROL_SCROLL_UP46#alias 19 : MENUCONTROL_SCROLLING_24748// Large Icon State49#alias 1 : LARGEICON_ENTER_SCREEN50#alias 2 : LARGEICON_LEAVE_SCREEN5152// Round Icon States53#alias 1 : ROUNDICON_SELECTED_ZONE5455// Presentation Stages56#alias 0 : STAGE_P_TITLE57#alias 1 : STAGE_P_MENU5859// Players60#alias 0 : PLAYER_SONIC_A6162// Soundtrack63#alias 0 : OST_JP6465// Global SFX66#alias 21 : SFX_G_ACHIEVEMENT67#alias 23 : SFX_G_MENUBUTTON68#alias 27 : SFX_G_SELECT6970// Stage SFX71#alias 0 : SFX_S_BACKBUTTON7273// Engine & Callbacks74#alias 2 : CALLBACK_TATTACK_NOTIFY_ENTER75#alias 3 : CALLBACK_TATTACK_NOTIFY_EXIT7677// Engine Messages78#alias 2 : MESSAGE_LOSTFOCUS7980// Device Type81#alias 1 : RETRO_MOBILE8283// Game Mode Aliases84#alias 2 : MODE_TIMEATTACK8586// SaveRAM[39] is how many zones are unlocked for Time Attack8788// Function declarations89#function MenuControl_IconTransitions90#function MenuControl_DefaultRecord91#function MenuControl_ZoneUnlockCheck92#function MenuControl_TotalRegularRecord93#function MenuControl_TotalSpecialRecord949596function MenuControl_IconTransitions97ArrayPos0 = 329899//Top Half100TempValue2 = Screen.CenterX101TempValue2 <<= 16102103TempValue0 = -210104TempValue1 = -46105while ArrayPos0 < 36106// Horizontal Movement107Object[ArrayPos0].XPos = TempValue0108Object[ArrayPos0].XPos *= Object.OffSet109Object[ArrayPos0].XPos >>= 1110Object[ArrayPos0].XPos += TempValue2111// Vertical Movement112Object[ArrayPos0].YPos = TempValue1113Object[ArrayPos0].YPos *= Object.OffSet114Object[ArrayPos0].YPos += 0x640000115TempValue0 += 140116ArrayPos0++117loop118119//Bottom Half120TempValue0 = -210121TempValue1 = 46122while ArrayPos0 < 40123// Horizontal Movement124Object[ArrayPos0].XPos = TempValue0125Object[ArrayPos0].XPos *= Object.OffSet126Object[ArrayPos0].XPos >>= 1127Object[ArrayPos0].XPos += TempValue2128// Vertical Movement129Object[ArrayPos0].YPos = TempValue1130Object[ArrayPos0].YPos *= Object.OffSet131Object[ArrayPos0].YPos += 0x640000132TempValue0 += 140133ArrayPos0++134loop135end function136137138function MenuControl_DefaultRecord139ArrayPos0 = 48 //Act 1 Time Attack Result140TempValue0 = 0141TempValue1 = 0142// Checks in all Time Attack levels if there is a record saved143while TempValue0 < 21144TempValue1 += SaveRAM[ArrayPos0]145ArrayPos0 += 6146TempValue0++147loop148149// if there are no records, set the default times (5 Minutes per round)150if TempValue1 == 0151ArrayPos0 = 48152TempValue0 = 0153while TempValue0 < 21154SaveRAM[ArrayPos0] = 30000155ArrayPos0++156SaveRAM[ArrayPos0] = 30000157ArrayPos0++158SaveRAM[ArrayPos0] = 30000159ArrayPos0++160SaveRAM[ArrayPos0] = 30000161ArrayPos0++162SaveRAM[ArrayPos0] = 30000163ArrayPos0++164SaveRAM[ArrayPos0] = 30000165ArrayPos0++166TempValue0++167loop168end if169end function170171172function MenuControl_ZoneUnlockCheck173#platform: Use_Origins174TempValue0 = TimeAttackUnlockCount // Origins seems to save this somewhere, probably in HE2175#endplatform176177#platform: Use_Standalone178TempValue0 = -1179ArrayPos0 = 3 // Save 0 Stage.ListPos180while ArrayPos0 < 40181TempValue1 = SaveRAM[ArrayPos0]182// In this order, check if your save is post PPZ 3, post MMZ 2 or if it's on a special stage183if TempValue1 > 10184if TempValue1 > 67185if TempValue1 < 80186TempValue1 = 7187else188TempValue1 -= 80189TempValue1 /= 10190end if191else192TempValue1 /= 10193end if194else195TempValue1 = 0196end if197if TempValue1 > TempValue0198TempValue0 = TempValue1 // Sets the amount of unlocked zones199end if200ArrayPos0 += 8 // Jump to next save201loop202#endplatform203204if TempValue0 > SaveRAM[39]205SaveRAM[39] = TempValue0 // Set the new value if there are new unlocked zones206else207TempValue0 = SaveRAM[39] // Otherwise just use the saved value208end if209210// Unlocks the playable zones211ArrayPos0 = 32212while TempValue0 > 0213Object[ArrayPos0].ZoneLocked = false214ArrayPos0++ // Skips the locking of this zone215TempValue0--216loop217218// Locks the rest of zones219while ArrayPos0 < 39220Object[ArrayPos0].ZoneLocked = true221ArrayPos0++222loop223end function224225226function MenuControl_TotalRegularRecord227228// Get the times of all zones229ArrayPos0 = 32230ArrayPos1 = 48231TempValue1 = 0232while ArrayPos0 < 39233TempValue0 = SaveRAM[ArrayPos1]234ArrayPos1 += 6235TempValue0 += SaveRAM[ArrayPos1]236ArrayPos1 += 6237TempValue0 += SaveRAM[ArrayPos1]238ArrayPos1 += 6239TempValue1 += TempValue0240Object[ArrayPos0].Minutes = TempValue0241Object[ArrayPos0].Minutes /= 6000242243Object[ArrayPos0].Seconds = TempValue0244Object[ArrayPos0].Seconds /= 100245Object[ArrayPos0].Seconds %= 60246247Object[ArrayPos0].MilliSeconds = TempValue0248Object[ArrayPos0].MilliSeconds %= 100249ArrayPos0++250loop251252// Calculate the total time253Object[ArrayPos0].Minutes = TempValue1254Object[ArrayPos0].Minutes /= 6000255256Object[ArrayPos0].Seconds = TempValue1257Object[ArrayPos0].Seconds /= 100258Object[ArrayPos0].Seconds %= 60259260Object[ArrayPos0].MilliSeconds = TempValue1261Object[ArrayPos0].MilliSeconds %= 100262263if Object[ArrayPos0].Minutes < 25264SetAchievement(10, 100)265end if266267if Object[ArrayPos0].Minutes < 30268Object.SSUnlocked = true269end if270271end function272273274function MenuControl_TotalSpecialRecord275276// Get the times of all zones277ArrayPos0 = 32278ArrayPos1 = 49279TempValue1 = 0280while ArrayPos0 < 39281TempValue0 = SaveRAM[ArrayPos1]282ArrayPos1 += 18283TempValue1 += TempValue0284Object[ArrayPos0].Minutes = TempValue0285Object[ArrayPos0].Minutes /= 6000286287Object[ArrayPos0].Seconds = TempValue0288Object[ArrayPos0].Seconds /= 100289Object[ArrayPos0].Seconds %= 60290291Object[ArrayPos0].MilliSeconds = TempValue0292Object[ArrayPos0].MilliSeconds %= 100293ArrayPos0++294loop295296// Calculate the total time297Object[ArrayPos0].Minutes = TempValue1298Object[ArrayPos0].Minutes /= 6000299300Object[ArrayPos0].Seconds = TempValue1301Object[ArrayPos0].Seconds /= 100302Object[ArrayPos0].Seconds %= 60303304Object[ArrayPos0].MilliSeconds = TempValue1305Object[ArrayPos0].MilliSeconds %= 100306307Object.SSUnlocked = true308309end function310311312sub ObjectMain313switch Object.State314case MENUCONTROL_SETUP315#platform: Use_Origins316game.callbackParam0 = false317EngineCallback(NOTIFY_TIMEATTACK_MODE)318#endplatform319// Makes sure nothing gets carried away from the saves320Stage.DebugMode = false321Stage.PlayerListPos = PLAYER_SONIC_A // PLAYER_SONIC in origins322LampPost.Check = 0323Good_Future = false324Good_Future_Count = 0325Good_Future_List = 0326SpecialStage.TimeStones = 0327ReadSaveRAM()328329Object.State = MENUCONTROL_FADEIN330Object.Timer = 384331Object.OffSet = 0x40000332SetScreenFade(0, 0, 0, 255)333334#platform: Use_Origins335if Engine.DeviceType == RETRO_MOBILE336Object.SavedRound = -1337Object.SelectedButton = -1338Object.SMCurrentButton = -1339end if340#endplatform341342#platform: Mobile343Object.SavedRound = -1344Object.SelectedButton = -1345Object.SMCurrentButton = -1346#endplatform347348CallFunction(MenuControl_ZoneUnlockCheck)349if TimeAttack.Round > -1 // Check if you come from playing time attack350Object.State = MENUCONTROL_SM_LEVEL_RETURN351352LargeIcon.Portrait = TimeAttack.Round353Object.SavedRound = TimeAttack.Round354355LargeIcon.XPos = Screen.CenterX356LargeIcon.XPos -= 72357LargeIcon.XPos <<= 16358359Object.SMYPos = TimeAttack.Zone360Object.SMYPos *= 192361Object.SMYPos += 192362363if TimeAttack.Result > 0364ArrayPos0 = TimeAttack.Round365ArrayPos0 *= 18366367TempValue0 = TimeAttack.Zone368TempValue0 *= 6369370ArrayPos0 += TempValue0371ArrayPos0 += 48372ArrayPos0 += TimeAttack.MenuSection373if TimeAttack.Result < SaveRAM[ArrayPos0]374// 1st Record Beated375ArrayPos1 = ArrayPos0376ArrayPos1 += 4377ArrayPos0 += 2378SaveRAM[ArrayPos1] = SaveRAM[ArrayPos0]379ArrayPos1 -= 2380ArrayPos0 -= 2381SaveRAM[ArrayPos1] = SaveRAM[ArrayPos0]382SaveRAM[ArrayPos0] = TimeAttack.Result383Object.BeatedRecord = 1384else385ArrayPos0 += 2386if TimeAttack.Result < SaveRAM[ArrayPos0]387// 2st Record Beated388ArrayPos1 = ArrayPos0389ArrayPos1 += 2390SaveRAM[ArrayPos1] = SaveRAM[ArrayPos0]391SaveRAM[ArrayPos0] = TimeAttack.Result392Object.BeatedRecord = 2393else394ArrayPos0 += 2395if TimeAttack.Result < SaveRAM[ArrayPos0]396// 3st Record Beated397SaveRAM[ArrayPos0] = TimeAttack.Result398Object.BeatedRecord = 3399end if400end if401end if402end if403Object.OffSet = 0x50000404else405TimeAttack.MenuSection = 0406end if407408CallFunction(MenuControl_DefaultRecord)409410if TimeAttack.MenuSection == 0411CallFunction(MenuControl_TotalRegularRecord)412else413CallFunction(MenuControl_TotalSpecialRecord)414Object[40].Type = TypeName[S Large Icon]415Object[41].Type = TypeName[S Records]416ArrayPos0 = 32417while ArrayPos0 < 40418Object[ArrayPos0].Type = TypeName[Special Icon]419ArrayPos0++420loop421end if422WriteSaveRAM()423424CallFunction(MenuControl_IconTransitions)425EngineCallback(CALLBACK_TATTACK_NOTIFY_ENTER)426PlayMusic(0)427break428429case MENUCONTROL_FADEIN430if Object.Timer > 0431Object.Timer -= 8432Object.OffSet -= 0x1000433else434Object.State = MENUCONTROL_CONTROLS435end if436SetScreenFade(0, 0, 0, Object.Timer)437CallFunction(MenuControl_IconTransitions)438break439440case MENUCONTROL_CONTROLS441#platform: Standard442CheckResult = true443#endplatform444445#platform: Mobile446CheckEqual(Options.PhysicalControls, true)447#endplatform448449450if CheckResult == true451ArrayPos0 = 32452ArrayPos0 += Object.SavedRound453CheckResult = false454if Object[ArrayPos0].State != ROUNDICON_SELECTED_ZONE455if KeyPress[0].Left == true456Object.SavedRound--457if Object.SavedRound < 0458Object.SavedRound = 7459end if460PlaySfx(SFX_G_MENUBUTTON, false)461end if462463if KeyPress[0].Right == true464Object.SavedRound++465if Object.SavedRound > 7466Object.SavedRound = 0467end if468PlaySfx(SFX_G_MENUBUTTON, false)469end if470471if KeyPress[0].Up == true472Object.SavedRound -= 4473if Object.SavedRound < 0474Object.SavedRound += 8475if Object.SSUnlocked == true476Object.State = MENUCONTROL_SCROLL_UP477end if478end if479PlaySfx(SFX_G_MENUBUTTON, false)480end if481482if KeyPress[0].Down == true483Object.SavedRound += 4484if Object.SavedRound > 7485Object.SavedRound -= 8486if Object.SSUnlocked == true487Object.State = MENUCONTROL_SCROLL_DOWN488end if489end if490PlaySfx(SFX_G_MENUBUTTON, false)491end if492493if KeyPress[0].Start == true494CheckResult = true495end if496497if KeyPress[0].ButtonA == true498CheckResult = true499end if500end if501502if CheckResult == true503ArrayPos0 = 32504ArrayPos0 += Object.SavedRound505if Object[ArrayPos0].ZoneLocked == 0506Object[ArrayPos0].State = ROUNDICON_SELECTED_ZONE507Object.SMCurrentButton = 0508switch Object.SavedRound509case -1510break511case 0512PlaySfx(SFX_G_SELECT, false)513break514case 1515PlaySfx(SFX_G_SELECT, false)516break517case 2518PlaySfx(SFX_G_SELECT, false)519break520case 3521PlaySfx(SFX_G_SELECT, false)522break523case 4524PlaySfx(SFX_G_SELECT, false)525break526case 5527PlaySfx(SFX_G_SELECT, false)528break529case 6530PlaySfx(SFX_G_SELECT, false)531break532case 7533PlaySfx(SFX_G_SELECT, false)534Object.State++535StopMusic()536break537end switch538end if539end if540end if541542#platform: Mobile543if Options.PhysicalControls == true544CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)545if CheckResult > -1546Options.PhysicalControls = false547Object.SavedRound = -1548end if549else550if Engine.Message == MESSAGE_LOSTFOCUS551Object.SelectedButton = -1552end if553554if Object.SSUnlocked == true555TempValue0 = Screen.XSize556TempValue0 -= 72557CheckTouchRect(TempValue0, 192, Screen.XSize, Screen.YSize)558if CheckResult > -1559Object.SelectedButton = 8560else561CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)562if CheckResult < 0563if Object.SelectedButton == 8564PlaySfx(SFX_G_MENUBUTTON, false)565Object.State = MENUCONTROL_SCROLL_DOWN566Object.SelectedButton = -1567end if568else569if Object.SelectedButton == 8570Object.SelectedButton = -1571end if572end if573end if574end if575576if Object.SelectedButton > -1577Object.SavedRound = Object.SelectedButton578else579Object.SavedRound = -1580end if581582if KeyPress[0].Left == true583Object.SavedRound = 7584Object.SelectedButton = -1585586Options.PhysicalControls = true587end if588589if KeyPress[0].Right == true590Object.SavedRound = 0591Object.SelectedButton = -1592593Options.PhysicalControls = true594end if595596if KeyPress[0].Up == true597Object.SavedRound = 7598Object.SelectedButton = -1599600Options.PhysicalControls = true601end if602603if KeyPress[0].Down == true604Object.SavedRound = 0605Object.SelectedButton = -1606607Options.PhysicalControls = true608end if609end if610#endplatform611612if KeyPress[0].ButtonB == true613Object.SavedRound = 7614ArrayPos0 = 32615ArrayPos0 += Object.SavedRound616//Telling to RoundIcon that we want to leave617Object[ArrayPos0].State = ROUNDICON_SELECTED_ZONE618Object.State++619620StopMusic()621PlaySfx(SFX_G_SELECT, false)622end if623break624625case MENUCONTROL_BLANK626break627628case MENUCONTROL_RETURN_TO_MENU629if Object.Timer < 384630Object.Timer += 8631Object.OffSet += 0x1000632else633#platform: Use_Origins634Stage.ListPos = STAGE_P_TITLE635StopMusic()636#endplatform637638#platform: Use_Standalone639Stage.ListPos = STAGE_P_MENU640#endplatform641642LoadStage()643end if644SetScreenFade(0, 0, 0, Object.Timer)645646CallFunction(MenuControl_IconTransitions)647EngineCallback(CALLBACK_TATTACK_NOTIFY_EXIT)648break649650case MENUCONTROL_ENTER_SM651if Object.Timer < 256652Object.Timer += 8653Object.OffSet += 0x2000654else655if TimeAttack.MenuSection == 0656Object[40].Type = TypeName[Large Icon]657Object[41].Type = TypeName[Records]658else659Object[40].Type = TypeName[S Large Icon]660Object[41].Type = TypeName[S Records]661end if662LargeIcon.Portrait = Object.SavedRound663LargeIcon.State = LARGEICON_ENTER_SCREEN664665Object[41].DrawOrder = 2666Object[42].DrawOrder = 2667Object[43].DrawOrder = 2668669Object.Timer = 0670Object.SMYPos = 0671672Object.State++673end if674CallFunction(MenuControl_IconTransitions)675break676case MENUCONTROL_CALL_RECORD_MENU677if Object.SMYPos < 192678Object.SMYPos += 8679else680Object.State++681end if682683#platform: Standard684Object.SMCurrentButton = 0685#endplatform686687#platform: Mobile688if Options.PhysicalControls == true689Object.SMCurrentButton = 0690else691Object.SMCurrentButton = -1692end if693#endplatform694break695696case MENUCONTROL_SM_CONTROLS697#platform: Standard698CheckResult = true699#endplatform700701#platform: Mobile702CheckEqual(Options.PhysicalControls, true)703#endplatform704705if CheckResult == true706if TimeAttack.MenuSection == 0707if KeyPress[0].Up == true708Object.State = MENUCONTROL_SM_SCROLL_UP709end if710711if KeyPress[0].Down == true712Object.State = MENUCONTROL_SM_SCROLL_DOWN713end if714715if KeyPress[0].Left == true716Object.SMCurrentButton--717if Object.SMCurrentButton < 0718Object.SMCurrentButton = 2719end if720end if721722if KeyPress[0].Right == true723Object.SMCurrentButton++724if Object.SMCurrentButton > 2725Object.SMCurrentButton = 0726end if727end if728else729if KeyPress[0].Left == true730Object.SMCurrentButton -= 2731if Object.SMCurrentButton < 0732Object.SMCurrentButton = 2733end if734end if735736if KeyPress[0].Right == true737Object.SMCurrentButton += 2738if Object.SMCurrentButton > 2739Object.SMCurrentButton = 0740end if741end if742end if743744CheckResult = false745if KeyPress[0].Start == true746CheckResult = true747end if748749if KeyPress[0].ButtonA == true750CheckResult = true751end if752753if KeyPress[0].ButtonB == true754PlayStageSfx(SFX_S_BACKBUTTON, false)755LargeIcon.State = LARGEICON_LEAVE_SCREEN756Object.State = MENUCONTROL_SM_COMFIRMED_LEAVE757758Object[41].DrawOrder = 8759Object[42].DrawOrder = 8760Object[43].DrawOrder = 8761762ArrayPos0 = Object.SMYPos763ArrayPos0 /= 192764ArrayPos0 += 40765Object[ArrayPos0].DrawOrder = 2766end if767768if CheckResult == true769switch Object.SMCurrentButton770case 0771PlayStageSfx(SFX_S_BACKBUTTON, false)772LargeIcon.State = LARGEICON_LEAVE_SCREEN773Object.State = MENUCONTROL_SM_COMFIRMED_LEAVE774775Object[41].DrawOrder = 8776Object[42].DrawOrder = 8777Object[43].DrawOrder = 8778779ArrayPos0 = Object.SMYPos780ArrayPos0 /= 192781ArrayPos0 += 40782Object[ArrayPos0].DrawOrder = 2783break784785case 1786PlaySfx(SFX_G_MENUBUTTON, false)787Object.State = MENUCONTROL_SM_SCROLL_UP788break789790case 2791PlaySfx(SFX_G_SELECT, false)792Object.State = MENUCONTROL_SM_CONFIRMED793StopMusic()794break795796end switch797end if798end if799800#platform: Mobile801if Options.PhysicalControls == true802CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)803if CheckResult > -1804Options.PhysicalControls = false805Object.SMCurrentButton = -1806end if807else808if Engine.Message == MESSAGE_LOSTFOCUS809Object.SMCurrentButton = -1810end if811812TempValue0 = Screen.CenterX813TempValue0 -= 140814TempValue1 = TempValue0815TempValue1 += 66816CheckTouchRect(TempValue0, 0, TempValue1, 40)817if CheckResult > -1818Object.SMCurrentButton = 0819else820CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)821if CheckResult < 0822if Object.SMCurrentButton == 0823PlayStageSfx(SFX_S_BACKBUTTON, false)824LargeIcon.State = LARGEICON_LEAVE_SCREEN825Object.State = MENUCONTROL_SM_COMFIRMED_LEAVE826827Object[41].DrawOrder = 8828Object[42].DrawOrder = 8829Object[43].DrawOrder = 8830831ArrayPos0 = Object.SMYPos832ArrayPos0 /= 192833ArrayPos0 += 40834Object[ArrayPos0].DrawOrder = 2835end if836else837if Object.SMCurrentButton == 0838Object.SMCurrentButton = -1839end if840end if841end if842843if KeyPress[0].ButtonB == true844PlayStageSfx(SFX_S_BACKBUTTON, false)845LargeIcon.State = LARGEICON_LEAVE_SCREEN846Object.State = MENUCONTROL_SM_COMFIRMED_LEAVE847848Object[41].DrawOrder = 8849Object[42].DrawOrder = 8850Object[43].DrawOrder = 8851852ArrayPos0 = Object.SMYPos853ArrayPos0 /= 192854ArrayPos0 += 40855Object[ArrayPos0].DrawOrder = 2856end if857858TempValue0 += 159859TempValue1 += 159860if TimeAttack.MenuSection == 0861CheckTouchRect(TempValue0, 0, TempValue1, 40)862if CheckResult > -1863Object.SMCurrentButton = 1864else865CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)866if CheckResult < 0867if Object.SMCurrentButton == 1868PlaySfx(SFX_G_MENUBUTTON, false)869Object.State = MENUCONTROL_SM_SCROLL_DOWN870end if871else872if Object.SMCurrentButton == 1873Object.SMCurrentButton = -1874end if875end if876end if877end if878879TempValue0 += 68880TempValue1 += 68881CheckTouchRect(TempValue0, 0, TempValue1, 40)882if CheckResult > -1883Object.SMCurrentButton = 2884else885CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)886if CheckResult < 0887if Object.SMCurrentButton == 2888PlaySfx(SFX_G_SELECT, false)889Object.State = MENUCONTROL_SM_CONFIRMED890StopMusic()891end if892else893if Object.SMCurrentButton == 2894Object.SMCurrentButton = -1895end if896end if897end if898899if KeyPress[0].Left == true900Object.SMCurrentButton = 2901Options.PhysicalControls = true902end if903904if KeyPress[0].Right == true905Object.SMCurrentButton = 0906Options.PhysicalControls = true907end if908end if909#endplatform910break911912case MENUCONTROL_SM_SCROLL_UP913if Object.Timer < 192914Object.Timer += 8915Object.SMYPos += 8916if Object.SMYPos > 767917Object.SMYPos -= 576918end if919else920Object.Timer = 0921Object.State = MENUCONTROL_SM_CONTROLS922#platform: Mobile923if Options.PhysicalControls == false924Object.SMCurrentButton = -1925end if926#endplatform927end if928929break930931case MENUCONTROL_SM_SCROLL_DOWN932if Object.Timer < 192933Object.Timer += 8934Object.SMYPos -= 8935if Object.SMYPos < 192936Object.SMYPos += 576937end if938else939Object.Timer = 0940Object.State = MENUCONTROL_SM_CONTROLS941#platform: Mobile942if Options.PhysicalControls == false943Object.SMCurrentButton = -1944end if945#endplatform946end if947break948949case MENUCONTROL_SM_CONFIRMED950if Object.Timer < 30951Object.Timer++952else953Object.Timer = 0954Object.State++955end if956break957958case MENUCONTROL_SM_LOAD_LEVEL959if Object.Timer < 320960Object.Timer += 8961else962if TimeAttack.MenuSection == 0963Stage.ActiveList = REGULAR_STAGE964Stage.ListPos = LargeIcon.Portrait965TimeAttack.Round = LargeIcon.Portrait966Stage.ListPos *= 10967968TempValue0 = Object.SMYPos969TempValue0 -= 192970TempValue0 /= 192971972TimeAttack.Zone = TempValue0973TempValue0 <<= 2974Stage.ListPos += TempValue0975if TempValue0 == 8976Stage.ListPos++977end if978else979Stage.ActiveList = SPECIAL_STAGE980#platform: Use_Origins981Stage.ActiveList = 3982#endplatform983Stage.ListPos = LargeIcon.Portrait984TimeAttack.Round = LargeIcon.Portrait985TimeAttack.Zone = 0986end if987988#platform: Use_Origins989game.callbackParam0 = true990EngineCallback(NOTIFY_TIMEATTACK_MODE)991#endplatform992993Player.Lives = 1994Player.Score = 0995Options.GameMode = MODE_TIMEATTACK996997LoadStage()998end if999SetScreenFade(0, 0, 0, Object.Timer)1000break10011002case MENUCONTROL_SM_LEVEL_RETURN1003if Object.Timer > 01004Object.Timer -= 81005else1006TimeAttack.Round = -11007if Object.BeatedRecord > 01008PlaySfx(SFX_G_ACHIEVEMENT, false)1009Object.State = MENUCONTROL_SM_RECORD_BEATED1010Object[0].DrawOrder = 41011else1012Object.State = MENUCONTROL_SM_CONTROLS1013end if1014end if1015SetScreenFade(0, 0, 0, Object.Timer)1016break10171018case MENUCONTROL_SM_COMFIRMED_LEAVE1019if Object.Timer < 301020Object.Timer++1021else1022Object.OffSet = 0x500001023Object.Timer = 01024Object.State++1025end if10261027if Object.SMYPos > 01028Object.SMYPos -= 81029end if1030break10311032case MENUCONTROL_SM_EXIT1033if Object.Timer < 2561034Object.Timer += 81035Object.OffSet -= 0x20001036else1037Object.Timer = 01038Object.State = MENUCONTROL_CONTROLS1039end if1040CallFunction(MenuControl_IconTransitions)1041break10421043case MENUCONTROL_SM_RECORD_BEATED1044if Object.Timer < 1201045Object.Timer++1046else1047Object.Timer = 01048Object.State = MENUCONTROL_SM_CONTROLS10491050Object.BeatedRecord = 01051Object[0].DrawOrder = 11052end if1053break10541055case MENUCONTROL_SCROLL_DOWN1056if Object.Timer < 201057Object.Timer++10581059ArrayPos0 = 321060while ArrayPos0 < 401061Object[ArrayPos0].YPos -= 0xC00001062ArrayPos0++1063loop1064else1065Object.Timer = 010661067ArrayPos0 = 321068if TimeAttack.MenuSection == 01069while ArrayPos0 < 401070Object[ArrayPos0].YPos += 0x1E000001071Object[ArrayPos0].Type = TypeName[Special Icon]1072ArrayPos0++1073loop1074TimeAttack.MenuSection = 11075CallFunction(MenuControl_TotalSpecialRecord)1076else1077while ArrayPos0 < 401078Object[ArrayPos0].YPos += 0x1E000001079Object[ArrayPos0].Type = TypeName[Round Icon]1080ArrayPos0++1081loop1082TimeAttack.MenuSection = 01083CallFunction(MenuControl_TotalRegularRecord)1084end if1085Object.State++1086end if1087break10881089case MENUCONTROL_SCROLLING_1 // Follow-up to MENUCONTROL_SCROLL_DOWN1090if Object.Timer < 201091Object.Timer++10921093ArrayPos0 = 321094while ArrayPos0 < 401095Object[ArrayPos0].YPos -= 0xC00001096ArrayPos0++1097loop1098else1099Object.Timer = 01100Object.State = MENUCONTROL_CONTROLS1101end if1102break11031104case MENUCONTROL_SCROLL_UP1105if Object.Timer < 201106Object.Timer++11071108ArrayPos0 = 321109while ArrayPos0 < 401110Object[ArrayPos0].YPos += 0xC00001111ArrayPos0++1112loop1113else1114Object.Timer = 011151116ArrayPos0 = 321117if TimeAttack.MenuSection == 01118while ArrayPos0 < 401119Object[ArrayPos0].YPos -= 0x1E000001120Object[ArrayPos0].Type = TypeName[Special Icon]1121ArrayPos0++1122loop1123TimeAttack.MenuSection = 11124CallFunction(MenuControl_TotalSpecialRecord)1125else1126while ArrayPos0 < 401127Object[ArrayPos0].YPos -= 0x1E000001128Object[ArrayPos0].Type = TypeName[Round Icon]1129ArrayPos0++1130loop1131TimeAttack.MenuSection = 01132CallFunction(MenuControl_TotalRegularRecord)1133end if1134Object.State++1135end if1136break11371138case MENUCONTROL_SCROLLING_2 // Follow-up to MENUCONTROL_SCROLL_UP1139if Object.Timer < 201140Object.Timer++11411142ArrayPos0 = 321143while ArrayPos0 < 401144Object[ArrayPos0].YPos += 0xC00001145ArrayPos0++1146loop1147else1148Object.Timer = 01149Object.State = MENUCONTROL_CONTROLS1150end if1151break11521153end switch1154end sub115511561157sub ObjectDraw1158switch Object.State1159case MENUCONTROL_SM_COMFIRMED_LEAVE1160TempValue0 = Screen.CenterX1161TempValue0 += 161162DrawRect(TempValue0, 31, Screen.CenterX, 9, 0, 0, 0, 255)1163DrawRect(TempValue0, 40, Screen.CenterX, 135, 224, 0, 0, 255)1164DrawRect(TempValue0, 175, Screen.CenterX, 38, 0, 0, 96, 255)1165break11661167case MENUCONTROL_SM_RECORD_BEATED1168TempValue0 = Object.Timer1169TempValue0 >>= 21170TempValue0 &= 11171if TempValue0 == 01172TempValue0 = Screen.CenterX1173TempValue0 += 161174TempValue1 = Object.BeatedRecord1175TempValue1 *= 241176TempValue1 += 1051177DrawRect(TempValue0, TempValue1, 34, 24, 8, 0, 104, 255)1178end if1179break11801181end switch1182end sub118311841185sub ObjectStartup1186#platform: Use_Origins1187game.callbackParam0 = true1188EngineCallback(NOTIFY_LEVEL_SELECT_MENU)11891190game.callbackParam0 = 01191EngineCallback(NOTIFY_PLAYER_SET)1192#endplatform11931194if Options.Soundtrack == OST_JP1195SetMusicTrack("JP/TimeAttack.ogg", 0, 100512)1196else1197SetMusicTrack("US/DAGarden.ogg", 0, 117382)1198end if11991200Object[0].Type = TypeName[Menu Control]1201Object[0].DrawOrder = 112021203#platform: Use_Origins1204if Engine.DeviceType == RETRO_MOBILE1205Options.PhysicalControls = true1206end if1207#endplatform12081209#platform: Mobile1210Options.PhysicalControls = false1211#endplatform1212end sub121312141215// ========================1216// Editor Subs1217// ========================12181219sub RSDKDraw1220DrawSprite(0)1221end sub122212231224sub RSDKLoad1225LoadSpriteSheet("Global/Display.gif")1226SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon12271228SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")1229end sub123012311232