Path: blob/main/Scripts/Menu/LoadSaveMenu.txt
1319 views
//---------------Sonic CD Load Save Menu Script---------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.FadeValue6#alias Object.Value1 : Object.SelectedOption7#alias Object.Direction : Object.ShowDeleteButton8#alias Object[+4].Rotation : Object.SaveMode9#alias Object[+4].Value1 : DeleteConfirm.Highlight1011// Menu Heading Aliases12#alias Object[33].State : MenuHeading.State13#alias Object[33].PropertyValue : MenuHeading.Header1415// Menu Window Aliases16#alias Object[-1].State : MenuWindow.State1718// Back Touch19#alias Object[1].Value4 : Object.BackTouchPress2021// Save File State22#alias Object.Rotation : Object.SaveStatus // Meant to be used with [+ArrayPos0]23#alias Object.Rotation : Object.SaveOneStatus24#alias Object[+1].Rotation : Object.SaveTwoStatus25#alias Object[+2].Rotation : Object.SaveThreeStatus26#alias Object[+3].Rotation : Object.SaveFourStatus2728// Save File Info29#alias Object.Value3 : Object.PlayerListPos30#alias Object.Value6 : Object.Lives31#alias Object.Value5 : Object.Score32#alias Object.Value2 : Object.StageListPos33#alias Object.Value4 : Object.TimeStones34#alias Object.PropertyValue : Object.SpecialListPos35#alias Object.Scale : Object.ScoreBonus36#alias Object.Value7 : Object.GoodFutureList3738// Delete Button39#alias Object[+1].XPos : Delete.XPos40#alias Object[+1].YPos : Delete.YPos4142// States43#alias 0 : STATE_INITIALIZE44#alias 1 : STATE_MAIN_SAVE_MENU45#alias 2 : STATE_SAVE_SELECTED46#alias 3 : STATE_LOAD_SAVE47#alias 4 : STATE_NEW_GAME_SELECTED48#alias 5 : STATE_FADEIN_CHARACTERSELECT49#alias 6 : STATE_CHARACTER_SELECT50#alias 7 : STATE_CHARACTER_SELECTED51#alias 8 : STATE_LOAD_NEW_GAME52#alias 9 : STATE_FADEOUT_CHARACTERSELECT53#alias 10 : STATE_RETURN_TO_SAVESEL54#alias 11 : STATE_EXIT55#alias 12 : STATE_TOGGLE_DELETE_MODE56#alias 13 : STATE_SAVE_SELECTED_DELETE57#alias 14 : STATE_SLIDE_DELETE_SAVE58#alias 15 : STATE_FADEIN_DELETECONFIRM59#alias 16 : STATE_DELETE_CONFIRM60#alias 17 : STATE_DELETECONFIRM_SELECTED61#alias 18 : STATE_FADEOUT_DELETECONFIRM6263// Menu Heading States64#alias 1 : MENUHEADING_LEAVE_SCREEN65#alias 2 : MENUHEADING_ENTER_SCREEN66#alias 3 : MENUHEADING_BLANK // used by some external scripts6768// Menu Heading Property Values69#alias 5 : MAINMENU_HEADER7071// Menu Window States72#alias 3 : MENUWINDOW_SHRINK7374// Menu Button States75#alias 1 : MENUBUTTON_BUTTONS_IN7677// Soundtrack78#alias 0 : OST_JP7980// Game Mode Aliases81#alias 1 : MODE_SAVEGAME8283// Save Modes84#alias 0 : SAVEMODE_NORMAL85#alias 1 : SAVEMODE_NORMAL_SELECTED86#alias 2 : SAVEMODE_DELETE87#alias 3 : SAVEMODE_DELETE_SELECTED8889// Buttons90#alias -1 : BUTTON_NONE // Touching nothing on mobile91#alias 0 : BUTTON_SAVE_ONE92#alias 1 : BUTTON_SAVE_TWO93#alias 2 : BUTTON_SAVE_THREE94#alias 3 : BUTTON_SAVE_FOUR95#alias 4 : BUTTON_DELETE9697// Save Statuses98#alias 0 : SAVE_NORMAL99#alias 1 : SAVE_NORMAL_SELECTED100#alias 2 : SAVE_DELETE101#alias 3 : SAVE_DELETE_SELECTED102103// Character Select Options104#alias -1 : PLAYER_NONE // Touching nothing on mobile105#alias 0 : PLAYER_SONIC_A106#alias 1 : PLAYER_TAILS_A107#alias 2 : PLAYER_BACK108109// Delete Confirm Options110#alias -1 : DELETE_NONE // Touching nothing on mobile111#alias 0 : DELETE_YES112#alias 1 : DELETE_NO113#alias 2 : DELETE_BACK114115// Presentation Stage116#alias 0 : STAGE_R_PPZ1A117118// Special Stage119#alias 0 : STAGE_S_SS1120121// Global SFX122#alias 9 : SFX_G_LAMPPOST123#alias 23 : SFX_G_MENUBUTTON124#alias 27 : SFX_G_SELECT125126// Stage SFX127#alias 0 : SFX_S_EVENT128#alias 1 : SFX_S_BACKBUTTON129130// Engine & Callbacks131#alias 2 : MESSAGE_LOSTFOCUS132133// Languages134#alias 0 : LANG_ENGLISH135#alias 1 : LANG_FRENCH136#alias 2 : LANG_ITALIAN137#alias 3 : LANG_DEUTSCH138#alias 4 : LANG_SPANISH139#alias 5 : LANG_JAPANESE140141// Function declarations142#function LoadSaveMenu_DrawSaveFiles143#function LoadSaveMenu_DrawDeleteNoSave144#function LoadSaveMenu_CheckTouchSave145#function LoadSaveMenu_SetShowDelete146147148function LoadSaveMenu_DrawSaveFiles149switch Object[+ArrayPos0].SaveStatus150case SAVE_DELETE151if Object[+ArrayPos0].StageListPos > 0152Object.Alpha = 64153DrawSpriteScreenFX(56, FX_INK, Object.XPos, Object.YPos)154Object.Alpha = 255155end if156// FallThrough157case SAVE_NORMAL158if ArrayPos0 == Object.SelectedOption159DrawSpriteScreenFX(9, FX_INK, Object.XPos, Object.YPos)160TempValue0 = Object[+ArrayPos0].StageListPos161if Object[+ArrayPos0].StageListPos > 0 // Is this save used?162TempValue0--163TempValue0 /= 10164if TempValue0 >= 8165TempValue0 = 8166TempValue1 = Object[+ArrayPos0].SpecialListPos167else168TempValue2 = TempValue0169TempValue2 *= 10170171TempValue1 = Object[+ArrayPos0].StageListPos172TempValue1--173TempValue1 -= TempValue2174TempValue1 >>= 2175end if176TempValue0 += 21177TempValue1 += 67178DrawSpriteScreenFX(TempValue1, FX_INK, Object.XPos, Object.YPos)179else180TempValue0 += 20181end if182DrawSpriteScreenFX(TempValue0, FX_INK, Object.XPos, Object.YPos)183else184TempValue0 = Object[+ArrayPos0].StageListPos185if Object[+ArrayPos0].StageListPos > 0186TempValue0--187TempValue0 /= 10188if TempValue0 >= 8189TempValue0 = 8190TempValue1 = Object[+ArrayPos0].SpecialListPos191else192TempValue2 = TempValue0193TempValue2 *= 10194195TempValue1 = Object[+ArrayPos0].StageListPos196TempValue1--197TempValue1 -= TempValue2198TempValue1 >>= 2199end if200TempValue0 += 11201TempValue1 += 59202DrawSpriteScreenFX(TempValue1, FX_INK, Object.XPos, Object.YPos)203else204TempValue0 += 10205end if206DrawSpriteScreenFX(TempValue0, FX_INK, Object.XPos, Object.YPos)207end if208break209210case SAVE_DELETE_SELECTED211Object.Alpha = 64212DrawSpriteScreenFX(56, FX_INK, Object.XPos, Object.YPos)213Object.Alpha = 255214// FallThrough215case SAVE_NORMAL_SELECTED216TempValue0 = Object.FadeValue217TempValue0 &= 3218TempValue0 >>= 1219220DrawSpriteScreenFX(9, FX_INK, Object.XPos, Object.YPos)221222if TempValue0 == 0223TempValue0 = Object[+ArrayPos0].StageListPos // Is this save used?224if Object[+ArrayPos0].StageListPos > 0225TempValue0--226TempValue0 /= 10227if TempValue0 >= 8 // Is this a special stage?228TempValue0 = 8229230TempValue1 = Object[+ArrayPos0].SpecialListPos231else232TempValue2 = TempValue0233TempValue2 *= 10234235TempValue1 = Object[+ArrayPos0].StageListPos236TempValue1--237TempValue1 -= TempValue2238TempValue1 >>= 2239end if240TempValue0 += 21241242TempValue1 += 67243DrawSpriteScreenFX(TempValue1, FX_INK, Object.XPos, Object.YPos)244else245TempValue0 += 20 // New Game246end if247DrawSpriteScreenFX(TempValue0, FX_INK, Object.XPos, Object.YPos)248end if249break250end switch251252DrawSpriteScreenFX(8, FX_INK, Object.XPos, Object.YPos)253254if Object[+ArrayPos0].StageListPos > 0 // Is this save used?255TempValue0 = Object[+ArrayPos0].PlayerListPos256TempValue0 <<= 1257TempValue0 += 4258259TempValue1 = Object.AnimationTimer260TempValue1 >>= 5261TempValue0 += TempValue1262DrawSpriteScreenFX(TempValue0, FX_INK, Object.XPos, Object.YPos)263264TempValue0 = 0265TempValue1 = 38266while TempValue0 < 7267TempValue2 = TempValue1268GetBit(CheckResult, Object[+ArrayPos0].TimeStones, TempValue0)269if CheckResult == false270TempValue2 += 7271end if272DrawSpriteScreenFX(TempValue2, FX_INK, Object.XPos, Object.YPos)273TempValue1++274TempValue0++275loop276else277DrawSpriteScreenFX(ArrayPos0, FX_INK, Object.XPos, Object.YPos)278end if279end function280281282function LoadSaveMenu_DrawDeleteNoSave283// Draw the Delete button284if Object.SaveMode >= SAVEMODE_DELETE285if Object.SelectedOption == BUTTON_DELETE286DrawSpriteScreenXY(55, Delete.XPos, Delete.YPos)287else288DrawSpriteScreenXY(54, Delete.XPos, Delete.YPos)289end if290else291if Object.SelectedOption == BUTTON_DELETE292DrawSpriteScreenXY(53, Delete.XPos, Delete.YPos)293else294DrawSpriteScreenXY(52, Delete.XPos, Delete.YPos)295end if296end if297298// Slide the Delete button in or out299if Object.ShowDeleteButton == true300if Delete.YPos > 14301Delete.YPos -= 2302DrawRect(Delete.XPos, 32, 64, 18, 96, 96, 128, 255)303end if304else305if Delete.YPos < 32306Delete.YPos += 2307end if308DrawRect(Delete.XPos, 32, 64, 18, 96, 96, 128, 255)309end if310end function311312313// This function is shared by other scripts314function LoadSaveMenu_CheckTouchSave315TempValue0 *= 40316TempValue0 += Screen.CenterY317TempValue0 -= 87318TempValue1 = TempValue0319TempValue1 += 37320TempValue2 = Object.XPos321TempValue2 += 250322CheckTouchRect(Object.XPos, TempValue0, TempValue2, TempValue1)323end function324325326function LoadSaveMenu_SetShowDelete327Object.ShowDeleteButton = false328329// Read save files330ArrayPos0 = 0331while ArrayPos0 < 4332if Object[+ArrayPos0].StageListPos > 0 // Is this save used?333Object.ShowDeleteButton = true334end if335ArrayPos0++336loop337end function338339340sub ObjectMain341switch Object.State342case STATE_INITIALIZE343#platform: Use_Origins344if Options.PhysicalControls == false345Object.SelectedOption = BUTTON_NONE346end if347#endplatform348349#platform: Mobile350if Options.PhysicalControls == false351Object.SelectedOption = BUTTON_NONE352end if353#endplatform354355Object.XPos = Screen.CenterX356Object.XPos -= 126357358if Object.FadeValue == 0359CallFunction(LoadSaveMenu_SetShowDelete)360361// Read save files362ArrayPos0 = 0363ArrayPos1 = 0364while ArrayPos0 < 4365Object[+ArrayPos0].PlayerListPos = SaveRAM[ArrayPos1]366ArrayPos1++367Object[+ArrayPos0].Lives = SaveRAM[ArrayPos1]368ArrayPos1++369Object[+ArrayPos0].Score = SaveRAM[ArrayPos1]370ArrayPos1++371Object[+ArrayPos0].StageListPos = SaveRAM[ArrayPos1]372ArrayPos1++373Object[+ArrayPos0].TimeStones = SaveRAM[ArrayPos1]374ArrayPos1++375Object[+ArrayPos0].SpecialListPos = SaveRAM[ArrayPos1]376ArrayPos1++377Object[+ArrayPos0].ScoreBonus = SaveRAM[ArrayPos1]378ArrayPos1++379Object[+ArrayPos0].GoodFutureList = SaveRAM[ArrayPos1]380ArrayPos1++381382if Object[+ArrayPos0].StageListPos > 0 // Is this save used?383Object.ShowDeleteButton = true384end if385ArrayPos0++386loop387end if388389Delete.XPos = Screen.CenterX390Delete.XPos -= 120391Delete.YPos = 32392393if Object.FadeValue < 256394Object.Alpha = Object.FadeValue395Object.FadeValue += 6396else397Object.FadeValue = 0398Object.Alpha = 255399Object.State = STATE_MAIN_SAVE_MENU400end if401break402403case STATE_MAIN_SAVE_MENU404// Flash a button when selected in delete mode405if Object.SaveMode == SAVE_DELETE_SELECTED406Object.AnimationTimer++407Object.AnimationTimer &= 63408else409Object.AnimationTimer = 0410end if411412#platform: Standard413CheckResult = true414#endplatform415416#platform: Mobile417CheckEqual(Options.PhysicalControls, true)418#endplatform419420#platform: Use_Origins421CheckEqual(Options.PhysicalControls, true)422#endplatform423424425// 2011 Steam lacks Options.PhysicalControls, so we force it here first and the other platforms can override it426if CheckResult == true427if Object.ShowDeleteButton == false428if KeyPress[0].Up == true429Object.SelectedOption--430PlaySfx(SFX_G_MENUBUTTON, false)431if Object.SelectedOption < BUTTON_SAVE_ONE432Object.SelectedOption = BUTTON_SAVE_FOUR433end if434end if435if KeyPress[0].Down == true436Object.SelectedOption++437PlaySfx(SFX_G_MENUBUTTON, false)438if Object.SelectedOption > BUTTON_SAVE_FOUR439Object.SelectedOption = BUTTON_SAVE_ONE440end if441end if442else443if KeyPress[0].Up == true444Object.SelectedOption--445PlaySfx(SFX_G_MENUBUTTON, false)446if Object.SelectedOption < BUTTON_SAVE_ONE447Object.SelectedOption = BUTTON_DELETE448end if449end if450if KeyPress[0].Down == true451Object.SelectedOption++452PlaySfx(SFX_G_MENUBUTTON, false)453if Object.SelectedOption > BUTTON_DELETE454Object.SelectedOption = BUTTON_SAVE_ONE455end if456end if457end if458// Enable touch controls if the screen is touched459CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)460if CheckResult > -1461#platform: Mobile462Options.PhysicalControls = false463Object.SelectedOption = BUTTON_NONE464#endplatform465466#platform: Use_Origins467Options.PhysicalControls = false468Object.SelectedOption = BUTTON_NONE469#endplatform470end if471else472// Touch Controls473474// Check if the screen is touched (used to check if a touch was released)475CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)476TempValue3 = CheckResult477478// Check if the delete button is touched479if Object.ShowDeleteButton == true480TempValue0 = Delete.XPos481TempValue0 -= 4482TempValue1 = TempValue0483TempValue1 += 72484CheckTouchRect(TempValue0, 0, TempValue1, 32)485else486CheckResult = -1487end if488489if CheckResult > -1490Object.SelectedOption = BUTTON_DELETE491else492if TempValue3 < 0493if Object.SelectedOption == BUTTON_DELETE494KeyPress[0].Start = true495end if496else497if Object.SelectedOption == BUTTON_DELETE498Object.SelectedOption = BUTTON_NONE499end if500end if501end if502503// Check if save file 1 is touched504TempValue0 = BUTTON_SAVE_ONE505CallFunction(LoadSaveMenu_CheckTouchSave)506if CheckResult > -1507Object.SelectedOption = BUTTON_SAVE_ONE508else509if TempValue3 < 0510if Object.SelectedOption == BUTTON_SAVE_ONE511KeyPress[0].Start = true512end if513else514if Object.SelectedOption == BUTTON_SAVE_ONE515Object.SelectedOption = BUTTON_NONE516end if517end if518end if519520// Check if save file 2 is touched521TempValue0 = BUTTON_SAVE_TWO522CallFunction(LoadSaveMenu_CheckTouchSave)523if CheckResult > -1524Object.SelectedOption = BUTTON_SAVE_TWO525else526if TempValue3 < 0527if Object.SelectedOption == BUTTON_SAVE_TWO528KeyPress[0].Start = true529end if530else531if Object.SelectedOption == BUTTON_SAVE_TWO532Object.SelectedOption = BUTTON_NONE533end if534end if535end if536537// Check if save file 3 is touched538TempValue0 = BUTTON_SAVE_THREE539CallFunction(LoadSaveMenu_CheckTouchSave)540if CheckResult > -1541Object.SelectedOption = BUTTON_SAVE_THREE542else543if TempValue3 < 0544if Object.SelectedOption == BUTTON_SAVE_THREE545KeyPress[0].Start = true546end if547else548if Object.SelectedOption == BUTTON_SAVE_THREE549Object.SelectedOption = BUTTON_NONE550end if551end if552end if553554// Check if save file 4 is touched555TempValue0 = BUTTON_SAVE_FOUR556CallFunction(LoadSaveMenu_CheckTouchSave)557if CheckResult > -1558Object.SelectedOption = BUTTON_SAVE_FOUR559else560if TempValue3 < 0561if Object.SelectedOption == BUTTON_SAVE_FOUR562KeyPress[0].Start = true563end if564else565if Object.SelectedOption == BUTTON_SAVE_FOUR566Object.SelectedOption = BUTTON_NONE567end if568end if569end if570571CallFunction(MenuHeading_CheckTouchBack)572573// Enable physical controls if a button is pressed574if KeyPress[0].Up == true575Object.SelectedOption = BUTTON_SAVE_FOUR576#platform: Mobile577Options.PhysicalControls = true578#endplatform579580#platform: Use_Origins581Options.PhysicalControls = true582#endplatform583end if584585if KeyPress[0].Down == true586if Object.ShowDeleteButton == false587Object.SelectedOption = BUTTON_SAVE_ONE588else589Object.SelectedOption = BUTTON_DELETE590end if591#platform: Mobile592Options.PhysicalControls = true593#endplatform594595#platform: Use_Origins596Options.PhysicalControls = true597#endplatform598end if599end if600601CheckResult = false602603if Object.SelectedOption > BUTTON_NONE // If a button was touched604if KeyPress[0].Start == true605CheckResult = true606end if607if KeyPress[0].ButtonA == true608CheckResult = true609end if610end if611612if CheckResult == true613if Object.SelectedOption < BUTTON_DELETE // If a save file was selected614#platform: Use_Origins615// this object isn't used in the final version of Origins, but it looks like they had plans to use it at first?616if game.continueFlag != false617ArrayPos0 = Object.SelectedOption618if Object[+ArrayPos0].StageListPos == 0619break // break STATE_MAIN_SAVE_MENU620end if621end if622#endplatform623switch Object.SaveMode624case SAVEMODE_NORMAL625Object.ShowDeleteButton = false626ArrayPos0 = Object.SelectedOption627Object[+ArrayPos0].SaveStatus = SAVE_NORMAL_SELECTED628Object.State = STATE_SAVE_SELECTED629PlaySfx(SFX_G_SELECT, false)630if Object[+ArrayPos0].StageListPos > 0 // Is this save used?631StopMusic()632else633if Options.TailsUnlocked == 2 // I have no idea what this means, this will always be false634StopMusic()635end if636end if637break638639case SAVEMODE_DELETE640ArrayPos0 = Object.SelectedOption641if Object[+ArrayPos0].StageListPos > 0 // Is this save used?642Object.ShowDeleteButton = false643Object.State = STATE_SAVE_SELECTED_DELETE644Object.SaveOneStatus = SAVE_NORMAL645Object.SaveTwoStatus = SAVE_NORMAL646Object.SaveThreeStatus = SAVE_NORMAL647Object.SaveFourStatus = SAVE_NORMAL648Object[+ArrayPos0].SaveStatus = SAVE_DELETE_SELECTED649650Object.SaveMode = SAVEMODE_NORMAL651PlaySfx(SFX_G_LAMPPOST, false)652else653Object.SaveOneStatus = SAVE_NORMAL654Object.SaveTwoStatus = SAVE_NORMAL655Object.SaveThreeStatus = SAVE_NORMAL656Object.SaveFourStatus = SAVE_NORMAL657Object.SaveMode = SAVEMODE_NORMAL658#platform: Use_Origins659if Options.PhysicalControls == false660Object.SelectedOption = BUTTON_NONE661end if662#endplatform663664#platform: Mobile665if Options.PhysicalControls == false666Object.SelectedOption = BUTTON_NONE667end if668#endplatform669end if670break671end switch672end if673674if Object.SelectedOption == BUTTON_DELETE675PlaySfx(SFX_G_LAMPPOST, false)676Object.State = STATE_TOGGLE_DELETE_MODE677end if678end if679680if KeyPress[0].ButtonB == true681Object.ShowDeleteButton = false682Object.FadeValue = 248683684Object.State = STATE_EXIT685PlayStageSfx(SFX_S_BACKBUTTON, false)686end if687break688689case STATE_SAVE_SELECTED690if Object.FadeValue < 30691Object.FadeValue++692else693Object.FadeValue = 0694ArrayPos0 = Object.SelectedOption695Object[+ArrayPos0].SaveStatus = SAVE_NORMAL696if Object[+ArrayPos0].StageListPos > 0 // Is this save used?697Object.State = STATE_LOAD_SAVE698else699if Options.TailsUnlocked < 2 // I have no idea what this means, this will always be true700Object.State = STATE_NEW_GAME_SELECTED701702Object.YPos = 40703Object.YPos *= Object.SelectedOption704Object.YPos += Screen.CenterY705Object.YPos -= 87706else707Object.State = STATE_LOAD_NEW_GAME708end if709end if710end if711break712713case STATE_LOAD_SAVE714if Object.FadeValue < 256715Object.FadeValue += 8716else717ArrayPos0 = Object.SelectedOption718719Options.GameMode = MODE_SAVEGAME720Options.SaveSlot = Object.SelectedOption721722Player.Lives = Object[+ArrayPos0].Lives723Player.Score = Object[+ArrayPos0].Score724Player.ScoreBonus = Object[+ArrayPos0].ScoreBonus725726Good_Future_List = Object[+ArrayPos0].GoodFutureList727Good_Future_List &= 0xFFFF // 0b1111111111111111728Good_Future_Count = 0729Good_Future = false730731MetalSonic_List = Object[+ArrayPos0].GoodFutureList732MetalSonic_List >>= 16733734SpecialStage.TimeStones = Object[+ArrayPos0].TimeStones735SpecialStage.ListPos = Object[+ArrayPos0].SpecialListPos736737LampPost.Check = 0738739Stage.ActiveList = REGULAR_STAGE740Stage.ListPos = Object[+ArrayPos0].StageListPos741Stage.ListPos--742if Stage.ListPos < 0743Stage.ListPos = 0744Player.Lives = 3745Player.Score = 0746end if747748if Stage.ListPos >= 80 // Check if the save is on a special stage749SpecialStage.NextZone = Stage.ListPos750SpecialStage.NextZone -= 80751Stage.ActiveList = SPECIAL_STAGE752753#platform: Use_Origins754Stage.ActiveList = 3755#endplatform756757Stage.ListPos = SpecialStage.ListPos758759TempValue0 = SpecialStage.NextZone760TempValue0 %= 10761TempValue0 >>= 2762if TempValue0 == 1763TempValue1 = SpecialStage.NextZone764TempValue1 /= 10765TempValue1 <<= 1766GetBit(TempValue0, Good_Future_List, TempValue1)767Good_Future_Count += TempValue0768end if769else770TempValue0 = Stage.ListPos771TempValue0 %= 10772TempValue0 >>= 2773if TempValue0 == 1774TempValue1 = Stage.ListPos775TempValue1 /= 10776TempValue1 <<= 1777GetBit(TempValue0, Good_Future_List, TempValue1)778Good_Future_Count += TempValue0779end if780end if781Stage.PlayerListPos = Object[+ArrayPos0].PlayerListPos782783#platform: Use_Origins784// normally saveSlot is just forced to 0 on the title screen, but it looks like they were planning to do a bit more than that initially? not like it matters anyways though, cause this object's unused in origins and all785game.callbackParam0 = Object.SelectedOption786EngineCallback(NOTIFY_SAVESLOT_SELECT)787#endplatform788789LoadStage()790end if791SetScreenFade(0, 0, 0, Object.FadeValue)792break793794case STATE_NEW_GAME_SELECTED795TempValue0 = Screen.CenterY796TempValue0 -= 87797if Object.YPos > TempValue0798Object.YPos -= 8799if Object.YPos < TempValue0800Object.YPos = TempValue0801end if802else803Object.State = STATE_FADEIN_CHARACTERSELECT804Object.Alpha = 0805806#platform: Use_Origins807if Options.PhysicalControls == false808ArrayPos0 = Object.SelectedOption809Object[+ArrayPos0].PlayerListPos = PLAYER_NONE810end if811#endplatform812813#platform: Mobile814if Options.PhysicalControls == false815ArrayPos0 = Object.SelectedOption816Object[+ArrayPos0].PlayerListPos = PLAYER_NONE817end if818#endplatform819820end if821break822823case STATE_FADEIN_CHARACTERSELECT824if Object.FadeValue < 256825Object.Alpha = Object.FadeValue826Object.FadeValue += 8827else828Object.FadeValue = 0829Object.Alpha = 255830Object.State = STATE_CHARACTER_SELECT831end if832break833834case STATE_CHARACTER_SELECT835ArrayPos0 = Object.SelectedOption836837#platform: Standard838CheckResult = true839#endplatform840841#platform: Mobile842CheckEqual(Options.PhysicalControls, true)843#endplatform844845#platform: Use_Origins846CheckEqual(Options.PhysicalControls, true)847#endplatform848849// 2011 Steam lacks Options.PhysicalControls, so we force it here first and the other platforms can override it850if CheckResult == true851if KeyPress[0].Left == true852Object[+ArrayPos0].PlayerListPos--853PlaySfx(SFX_G_MENUBUTTON, false)854if Object[+ArrayPos0].PlayerListPos < PLAYER_SONIC_A855Object[+ArrayPos0].PlayerListPos = PLAYER_TAILS_A856end if857end if858if KeyPress[0].Right == true859Object[+ArrayPos0].PlayerListPos++860PlaySfx(SFX_G_MENUBUTTON, false)861if Object[+ArrayPos0].PlayerListPos > PLAYER_TAILS_A862Object[+ArrayPos0].PlayerListPos = PLAYER_SONIC_A863end if864end if865866// Enable touch controls if the screen is touched867CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)868if CheckResult > -1869#platform: Mobile870Options.PhysicalControls = false871Object[+ArrayPos0].PlayerListPos = PLAYER_NONE872#endplatform873874#platform: Use_Origins875Options.PhysicalControls = false876Object[+ArrayPos0].PlayerListPos = PLAYER_NONE877#endplatform878end if879else880// Touch Controls881882if Engine.Message == MESSAGE_LOSTFOCUS883Object[+ArrayPos0].PlayerListPos = PLAYER_NONE884end if885886// Check if Sonic is pressed887CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)888TempValue3 = CheckResult889890TempValue0 = Screen.CenterX891TempValue0 -= 56892893TempValue1 = Screen.CenterX894TempValue1 -= 8895CheckTouchRect(TempValue0, 126, TempValue1, 184)896if CheckResult > -1897Object[+ArrayPos0].PlayerListPos = PLAYER_SONIC_A898else899if TempValue3 < 0900if Object[+ArrayPos0].PlayerListPos == PLAYER_SONIC_A901KeyPress[0].Start = true902end if903else904if Object[+ArrayPos0].PlayerListPos == PLAYER_SONIC_A905Object[+ArrayPos0].PlayerListPos = PLAYER_NONE906end if907end if908end if909910// Check if Tails is pressed911TempValue0 = Screen.CenterX912TempValue0 += 8913TempValue1 = Screen.CenterX914TempValue1 += 56915CheckTouchRect(TempValue0, 126, TempValue1, 184)916if CheckResult > -1917Object[+ArrayPos0].PlayerListPos = PLAYER_TAILS_A918else919if TempValue3 < 0920if Object[+ArrayPos0].PlayerListPos == PLAYER_TAILS_A921KeyPress[0].Start = true922end if923else924if Object[+ArrayPos0].PlayerListPos == PLAYER_TAILS_A925Object[+ArrayPos0].PlayerListPos = PLAYER_NONE926end if927end if928end if929930// Check if the back button is pressed931TempValue0 = Screen.XSize932TempValue0 -= 76933CheckTouchRect(TempValue0, 192, Screen.XSize, Screen.YSize)934if CheckResult > -1935Object[+ArrayPos0].PlayerListPos = PLAYER_BACK936Object.BackTouchPress = true937else938Object.BackTouchPress = false939if TempValue3 < 0940if Object[+ArrayPos0].PlayerListPos == PLAYER_BACK941KeyPress[0].ButtonB = true942end if943else944if Object[+ArrayPos0].PlayerListPos == PLAYER_BACK945Object[+ArrayPos0].PlayerListPos = PLAYER_NONE946end if947end if948end if949950// Enable physical controls if a button is pressed951if KeyPress[0].Left == true952Object[+ArrayPos0].PlayerListPos = PLAYER_TAILS_A953#platform: Mobile954Options.PhysicalControls = true955#endplatform956957#platform: Use_Origins958Options.PhysicalControls = true959#endplatform960end if961962if KeyPress[0].Right == true963Object[+ArrayPos0].PlayerListPos = PLAYER_SONIC_A964#platform: Mobile965Options.PhysicalControls = true966#endplatform967968#platform: Use_Origins969Options.PhysicalControls = true970#endplatform971end if972end if973974CheckResult = false975if KeyPress[0].Start == true976CheckResult = true977end if978if KeyPress[0].ButtonA == true979CheckResult = true980end if981if CheckResult == true982if Options.TailsUnlocked == true983PlaySfx(SFX_G_SELECT, false)984StopMusic()985Object.State = STATE_CHARACTER_SELECTED986else987if Object[+ArrayPos0].PlayerListPos == PLAYER_SONIC_A988PlaySfx(SFX_G_SELECT, false)989StopMusic()990Object.State = STATE_CHARACTER_SELECTED991else992#platform: Mobile993Object[+ArrayPos0].PlayerListPos = PLAYER_NONE994#endplatform995end if996end if997end if998999if KeyPress[0].ButtonB == true1000Object.State = STATE_FADEOUT_CHARACTERSELECT1001Object.FadeValue = 2481002PlayStageSfx(SFX_S_BACKBUTTON, false)1003end if1004break10051006case STATE_CHARACTER_SELECTED1007if Object.FadeValue < 301008Object.FadeValue++1009else1010Object.FadeValue = 01011Object.State = STATE_LOAD_NEW_GAME1012end if1013break10141015case STATE_LOAD_NEW_GAME1016if Object.FadeValue < 2561017Object.FadeValue += 81018else1019ArrayPos0 = Object.SelectedOption1020ArrayPos1 = Object.SelectedOption1021ArrayPos1 <<= 31022SaveRAM[ArrayPos1] = Object[+ArrayPos0].PlayerListPos // Character1023ArrayPos1++1024SaveRAM[ArrayPos1] = 3 // Lives1025ArrayPos1++1026SaveRAM[ArrayPos1] = 0 // Score1027ArrayPos1++1028SaveRAM[ArrayPos1] = 1 // Stage List Pos, gets down by one below this1029ArrayPos1++1030SaveRAM[ArrayPos1] = 0 // Time Stones1031ArrayPos1++1032SaveRAM[ArrayPos1] = 0 // Special Stage Pos1033ArrayPos1++1034SaveRAM[ArrayPos1] = 50000 // Score Bonus1035ArrayPos1++1036SaveRAM[ArrayPos1] = 0 // Destroyed Metal Sonic Projectors1037WriteSaveRAM()10381039Options.GameMode = MODE_SAVEGAME1040Options.SaveSlot = Object.SelectedOption10411042Player.Lives = 31043Player.Score = 01044Player.ScoreBonus = 5000010451046Good_Future_List = 01047Good_Future_Count = 01048Good_Future = false10491050Transporter_Destroyed = false1051MetalSonic_Destroyed = false1052MetalSonic_List = 010531054SpecialStage.TimeStones = 01055SpecialStage.ListPos = STAGE_S_SS110561057LampPost.Check = 01058Stage.ActiveList = REGULAR_STAGE10591060ArrayPos0 = Object.SelectedOption10611062Stage.ListPos = Object[+ArrayPos0].StageListPos1063Stage.ListPos--1064if Stage.ListPos < 01065Stage.ListPos = STAGE_R_PPZ1A1066end if10671068Stage.PlayerListPos = Object[+ArrayPos0].PlayerListPos10691070#platform: Use_Origins1071// normally saveSlot is just forced to 0 on the title screen, but it looks like they were planning to do a bit more than that initially? not like it matters anyways though, cause this object's unused in origins and all1072game.callbackParam0 = Object.SelectedOption1073EngineCallback(NOTIFY_SAVESLOT_SELECT)1074#endplatform10751076LoadStage()10771078if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins plus - why did they update this object in plus even if it's unused in origins? wish i knew..1079LoadVideo("Opening")10801081// #platform: Mobile1082// if Options.Soundtrack == OST_JP1083// LoadVideo("Opening")1084// else1085// LoadVideo("OpeningUS")1086// end if1087// #endplatform10881089end if1090end if1091SetScreenFade(0, 0, 0, Object.FadeValue)1092break10931094case STATE_FADEOUT_CHARACTERSELECT1095if Object.FadeValue > 01096Object.Alpha = Object.FadeValue1097Object.FadeValue -= 81098else1099Object.Alpha = 01100Object.State = STATE_RETURN_TO_SAVESEL1101end if1102break11031104case STATE_RETURN_TO_SAVESEL1105TempValue0 = Object.SelectedOption1106TempValue0 *= 401107TempValue0 += Screen.CenterY1108TempValue0 -= 871109if Object.YPos < TempValue01110Object.YPos += 81111if Object.YPos > TempValue01112Object.YPos = TempValue01113end if1114Object.Alpha = 01115else11161117#platform: Use_Origins1118if Options.PhysicalControls == false1119Object.SelectedOption = BUTTON_NONE1120end if1121#endplatform11221123#platform: Mobile1124if Options.PhysicalControls == false1125Object.SelectedOption = BUTTON_NONE1126end if1127#endplatform11281129Object.State = STATE_MAIN_SAVE_MENU1130Object.Alpha = 2551131Object.SaveOneStatus = SAVE_NORMAL1132Object.SaveTwoStatus = SAVE_NORMAL1133Object.SaveThreeStatus = SAVE_NORMAL1134Object.SaveFourStatus = SAVE_NORMAL1135Object.SaveMode = SAVEMODE_NORMAL1136CallFunction(LoadSaveMenu_SetShowDelete)1137end if1138break11391140case STATE_EXIT1141if Object.FadeValue > 01142Object.Alpha = Object.FadeValue1143Object.FadeValue -= 81144else1145// Tell the other objects that you're leaving the menu1146Object.Type = TypeName[Blank Object]1147MenuWindow.State = MENUWINDOW_SHRINK // Reset the window1148//All of this is MenuButton Objects1149Object[34].State = MENUBUTTON_BUTTONS_IN1150Object[35].State = MENUBUTTON_BUTTONS_IN1151Object[36].State = MENUBUTTON_BUTTONS_IN1152Object[37].State = MENUBUTTON_BUTTONS_IN1153Object[38].State = MENUBUTTON_BUTTONS_IN1154Object[39].State = MENUBUTTON_BUTTONS_IN1155Object[40].State = MENUBUTTON_BUTTONS_IN1156Object[41].State = MENUBUTTON_BUTTONS_IN1157Object[42].State = MENUBUTTON_BUTTONS_IN11581159MenuHeading.State = MENUHEADING_LEAVE_SCREEN1160MenuHeading.Header = MAINMENU_HEADER1161end if1162break11631164case STATE_TOGGLE_DELETE_MODE1165if Object.FadeValue < 301166Object.FadeValue++1167else1168Object.FadeValue = 01169Object.State = STATE_MAIN_SAVE_MENU11701171#platform: Standard1172Object.SelectedOption = BUTTON_SAVE_ONE1173#endplatform11741175#platform: Use_Origins1176if Options.PhysicalControls == true1177Object.SelectedOption = BUTTON_SAVE_ONE1178else1179Object.SelectedOption = BUTTON_NONE1180end if1181#endplatform11821183#platform: Mobile1184if Options.PhysicalControls == true1185Object.SelectedOption = BUTTON_SAVE_ONE1186else1187Object.SelectedOption = BUTTON_NONE1188end if1189#endplatform11901191if Object.SaveMode >= SAVE_DELETE1192Object.SaveOneStatus = SAVE_NORMAL1193Object.SaveTwoStatus = SAVE_NORMAL1194Object.SaveThreeStatus = SAVE_NORMAL1195Object.SaveFourStatus = SAVE_NORMAL1196Object.SaveMode = SAVEMODE_NORMAL1197else1198Object.SaveOneStatus = SAVE_DELETE1199Object.SaveTwoStatus = SAVE_DELETE1200Object.SaveThreeStatus = SAVE_DELETE1201Object.SaveFourStatus = SAVE_DELETE1202Object.SaveMode = SAVEMODE_DELETE1203end if1204end if1205break12061207case STATE_SAVE_SELECTED_DELETE1208if Object.FadeValue < 301209Object.FadeValue++1210else1211Object.FadeValue = 01212ArrayPos0 = Object.SelectedOption1213Object[+ArrayPos0].SaveStatus = SAVE_DELETE12141215Object.State = STATE_SLIDE_DELETE_SAVE12161217Object.YPos = 401218Object.YPos *= Object.SelectedOption1219Object.YPos += Screen.CenterY1220Object.YPos -= 871221end if1222break12231224case STATE_SLIDE_DELETE_SAVE1225TempValue0 = Screen.CenterY1226TempValue0 -= 871227if Object.YPos > TempValue01228Object.YPos -= 81229if Object.YPos < TempValue01230Object.YPos = TempValue01231end if1232else1233Object.State = STATE_FADEIN_DELETECONFIRM1234Object.Alpha = 012351236#platform: Standard1237DeleteConfirm.Highlight = DELETE_YES1238#endplatform12391240#platform: Use_Origins1241if Options.PhysicalControls == true1242DeleteConfirm.Highlight = DELETE_YES1243else1244DeleteConfirm.Highlight = DELETE_NONE1245end if1246#endplatform12471248#platform: Mobile1249if Options.PhysicalControls == true1250DeleteConfirm.Highlight = DELETE_YES1251else1252DeleteConfirm.Highlight = DELETE_NONE1253end if1254#endplatform12551256end if1257break12581259case STATE_FADEIN_DELETECONFIRM1260if Object.FadeValue < 2561261Object.Alpha = Object.FadeValue1262Object.FadeValue += 81263else1264Object.FadeValue = 01265Object.Alpha = 2551266Object.State = STATE_DELETE_CONFIRM1267end if1268break12691270case STATE_DELETE_CONFIRM1271ArrayPos0 = Object.SelectedOption1272Object.AnimationTimer++1273Object.AnimationTimer &= 6312741275#platform: Standard1276CheckResult = true1277#endplatform12781279#platform: Mobile1280CheckEqual(Options.PhysicalControls, true)1281#endplatform12821283#platform: Use_Origins1284CheckEqual(Options.PhysicalControls, true)1285#endplatform128612871288// 2011 Steam lacks Options.PhysicalControls, so we force it here first and the other platforms can override it1289if CheckResult == true1290if KeyPress[0].Up == true1291DeleteConfirm.Highlight--1292PlaySfx(SFX_G_MENUBUTTON, false)1293if DeleteConfirm.Highlight < DELETE_YES1294DeleteConfirm.Highlight = DELETE_NO1295end if1296end if12971298if KeyPress[0].Down == true1299DeleteConfirm.Highlight++1300PlaySfx(SFX_G_MENUBUTTON, false)1301if DeleteConfirm.Highlight > DELETE_NO1302DeleteConfirm.Highlight = DELETE_YES1303end if1304end if13051306// Enable touch controls if the screen is touched1307CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)1308if CheckResult > -113091310#platform: Mobile1311Options.PhysicalControls = false1312DeleteConfirm.Highlight = DELETE_NONE1313#endplatform13141315#platform: Use_Origins1316Options.PhysicalControls = false1317DeleteConfirm.Highlight = DELETE_NONE1318#endplatform1319end if1320else1321// Touch Controls13221323if Engine.Message == MESSAGE_LOSTFOCUS1324DeleteConfirm.Highlight = DELETE_NONE1325end if13261327// Check if YES is touched1328CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)1329TempValue3 = CheckResult1330TempValue0 = Screen.CenterX1331TempValue0 -= 341332TempValue1 = Screen.CenterX1333TempValue1 += 341334CheckTouchRect(TempValue0, 110, TempValue1, 135)1335if CheckResult > -11336DeleteConfirm.Highlight = DELETE_YES1337else1338if TempValue3 < 01339if DeleteConfirm.Highlight == DELETE_YES1340KeyPress[0].Start = true1341end if1342else1343if DeleteConfirm.Highlight == DELETE_YES1344DeleteConfirm.Highlight = DELETE_NONE1345end if1346end if1347end if13481349// Check if NO is touched1350CheckTouchRect(TempValue0, 144, TempValue1, 169)1351if CheckResult > -11352DeleteConfirm.Highlight = DELETE_NO1353else1354if TempValue3 < 01355if DeleteConfirm.Highlight == DELETE_NO1356KeyPress[0].Start = true1357end if1358else1359if DeleteConfirm.Highlight == DELETE_NO1360DeleteConfirm.Highlight = DELETE_NONE1361end if1362end if1363end if13641365// Check if the back button is touched1366TempValue0 = Screen.XSize1367TempValue0 -= 761368CheckTouchRect(TempValue0, 192, Screen.XSize, Screen.YSize)1369if CheckResult > -11370DeleteConfirm.Highlight = DELETE_BACK1371Object.BackTouchPress = true1372else1373Object.BackTouchPress = false1374if TempValue3 < 01375if DeleteConfirm.Highlight == DELETE_BACK1376KeyPress[0].ButtonB = true1377end if1378else1379if DeleteConfirm.Highlight == DELETE_BACK1380DeleteConfirm.Highlight = DELETE_NONE1381end if1382end if1383end if13841385// Enable physical controls if a button is pressed1386if KeyPress[0].Up == true1387DeleteConfirm.Highlight = DELETE_NO1388#platform: Mobile1389Options.PhysicalControls = true1390#endplatform1391#platform: Use_Origins1392Options.PhysicalControls = true1393#endplatform1394end if13951396if KeyPress[0].Down == true1397DeleteConfirm.Highlight = DELETE_YES1398#platform: Mobile1399Options.PhysicalControls = true1400#endplatform1401#platform: Use_Origins1402Options.PhysicalControls = true1403#endplatform1404end if1405end if14061407CheckResult = false14081409if DeleteConfirm.Highlight > DELETE_NONE // If a button was touched1410if KeyPress[0].Start == true1411CheckResult = true1412end if1413if KeyPress[0].ButtonA == true1414CheckResult = true1415end if1416end if14171418if CheckResult == true1419if DeleteConfirm.Highlight == DELETE_YES1420PlayStageSfx(SFX_S_EVENT, false)1421else1422PlaySfx(SFX_G_SELECT, false)1423end if1424Object.AnimationTimer = 014251426Object.State = STATE_DELETECONFIRM_SELECTED1427end if14281429if KeyPress[0].ButtonB == true1430ArrayPos0 = Object.SelectedOption1431Object[+ArrayPos0].SaveStatus = SAVE_NORMAL14321433Object.State = STATE_FADEOUT_DELETECONFIRM14341435Object.FadeValue = 2481436Object.AnimationTimer = 014371438PlayStageSfx(SFX_S_BACKBUTTON, false)1439end if1440break14411442case STATE_DELETECONFIRM_SELECTED1443if Object.FadeValue < 301444Object.FadeValue++1445else1446Object.State = STATE_FADEOUT_DELETECONFIRM1447Object.FadeValue = 24814481449ArrayPos0 = Object.SelectedOption1450Object[+ArrayPos0].SaveStatus = SAVE_NORMAL14511452if DeleteConfirm.Highlight == DELETE_YES1453// Delete this save in the menu1454Object[+ArrayPos0].PlayerListPos = 01455Object[+ArrayPos0].Lives = 31456Object[+ArrayPos0].Score = 01457Object[+ArrayPos0].StageListPos = 01458Object[+ArrayPos0].TimeStones = 01459Object[+ArrayPos0].SpecialListPos = 01460Object[+ArrayPos0].ScoreBonus = 500001461Object[+ArrayPos0].GoodFutureList = 014621463// Now delete it in SaveRAM1464ArrayPos1 = Object.SelectedOption1465ArrayPos1 <<= 31466SaveRAM[ArrayPos1] = 01467ArrayPos1++1468SaveRAM[ArrayPos1] = 31469ArrayPos1++1470SaveRAM[ArrayPos1] = 01471ArrayPos1++1472SaveRAM[ArrayPos1] = 01473ArrayPos1++1474SaveRAM[ArrayPos1] = 01475ArrayPos1++1476SaveRAM[ArrayPos1] = 01477ArrayPos1++1478SaveRAM[ArrayPos1] = 01479ArrayPos1++1480SaveRAM[ArrayPos1] = 01481end if14821483WriteSaveRAM()1484end if1485break14861487case STATE_FADEOUT_DELETECONFIRM1488if Object.FadeValue > 01489Object.Alpha = Object.FadeValue1490Object.FadeValue -= 81491else1492Object.Alpha = 01493Object.State = STATE_RETURN_TO_SAVESEL1494end if1495break1496end switch1497end sub149814991500sub ObjectDraw1501switch Object.State1502case STATE_INITIALIZE1503case STATE_MAIN_SAVE_MENU1504case STATE_SAVE_SELECTED1505case STATE_LOAD_SAVE1506case STATE_EXIT1507case STATE_SAVE_SELECTED_DELETE1508if Object.State != STATE_INITIALIZE1509CallFunction(LoadSaveMenu_DrawDeleteNoSave)1510end if15111512Object.YPos = Screen.CenterY1513Object.YPos -= 871514ArrayPos0 = 01515CallFunction(LoadSaveMenu_DrawSaveFiles)1516Object.YPos += 401517ArrayPos0++1518CallFunction(LoadSaveMenu_DrawSaveFiles)1519Object.YPos += 401520ArrayPos0++1521CallFunction(LoadSaveMenu_DrawSaveFiles)1522Object.YPos += 401523ArrayPos0++1524CallFunction(LoadSaveMenu_DrawSaveFiles)1525break15261527case STATE_NEW_GAME_SELECTED1528case STATE_SLIDE_DELETE_SAVE1529CallFunction(LoadSaveMenu_DrawDeleteNoSave)1530ArrayPos0 = Object.SelectedOption1531CallFunction(LoadSaveMenu_DrawSaveFiles)1532break15331534case STATE_FADEIN_CHARACTERSELECT1535case STATE_CHARACTER_SELECT1536case STATE_LOAD_NEW_GAME1537case STATE_FADEOUT_CHARACTERSELECT1538case STATE_RETURN_TO_SAVESEL1539DrawSpriteScreenFX(30, FX_INK, Screen.CenterX, 84)1540TempValue0 = Screen.CenterX1541TempValue0 -= 321542ArrayPos0 = Object.SelectedOption1543if Object[+ArrayPos0].PlayerListPos == PLAYER_SONIC_A1544DrawSpriteScreenFX(31, FX_INK, TempValue0, 136)1545DrawSpriteScreenFX(36, FX_INK, TempValue0, 164)1546DrawSpriteScreenFX(33, FX_INK, TempValue0, 136)1547else1548DrawSpriteScreenFX(31, FX_INK, TempValue0, 136)1549DrawSpriteScreenFX(34, FX_INK, TempValue0, 164)1550end if1551TempValue0 += 641552if Object[+ArrayPos0].PlayerListPos == PLAYER_TAILS_A1553DrawSpriteScreenFX(32, FX_INK, TempValue0, 136)1554DrawSpriteScreenFX(37, FX_INK, TempValue0, 164)1555DrawSpriteScreenFX(33, FX_INK, TempValue0, 136)1556else1557DrawSpriteScreenFX(32, FX_INK, TempValue0, 136)1558DrawSpriteScreenFX(35, FX_INK, TempValue0, 164)1559end if1560Object.Alpha = 2551561CallFunction(LoadSaveMenu_DrawSaveFiles)1562break15631564case STATE_CHARACTER_SELECTED1565DrawSpriteScreenFX(30, FX_INK, Screen.CenterX, 84)1566TempValue0 = Screen.CenterX1567TempValue0 -= 321568ArrayPos0 = Object.SelectedOption15691570// Flash the border for the selected character1571TempValue1 = Object.FadeValue1572TempValue1 &= 31573TempValue1 >>= 115741575if Object[+ArrayPos0].PlayerListPos == PLAYER_SONIC_A1576if TempValue1 == 01577DrawSpriteScreenFX(31, FX_INK, TempValue0, 136)1578end if1579DrawSpriteScreenFX(36, FX_INK, TempValue0, 164)1580DrawSpriteScreenFX(33, FX_INK, TempValue0, 136)1581else1582DrawSpriteScreenFX(31, FX_INK, TempValue0, 136)1583DrawSpriteScreenFX(34, FX_INK, TempValue0, 164)1584end if1585TempValue0 += 641586if Object[+ArrayPos0].PlayerListPos == PLAYER_TAILS_A1587if TempValue1 == 01588DrawSpriteScreenFX(32, FX_INK, TempValue0, 136)1589end if1590DrawSpriteScreenFX(37, FX_INK, TempValue0, 164)1591DrawSpriteScreenFX(33, FX_INK, TempValue0, 136)1592else1593DrawSpriteScreenFX(32, FX_INK, TempValue0, 136)1594DrawSpriteScreenFX(35, FX_INK, TempValue0, 164)1595end if1596Object.Alpha = 2551597CallFunction(LoadSaveMenu_DrawSaveFiles)1598break15991600case STATE_TOGGLE_DELETE_MODE1601// Flash the delete button1602TempValue0 = Object.FadeValue1603TempValue0 &= 31604TempValue0 >>= 116051606if Object.SaveOneStatus == SAVE_DELETE1607if TempValue0 == 01608DrawSpriteScreenXY(55, Delete.XPos, Delete.YPos)1609else1610DrawSpriteScreenXY(54, Delete.XPos, Delete.YPos)1611end if1612else1613if TempValue0 == 01614DrawSpriteScreenXY(53, Delete.XPos, Delete.YPos)1615else1616DrawSpriteScreenXY(52, Delete.XPos, Delete.YPos)1617end if1618end if16191620Object.YPos = Screen.CenterY1621Object.YPos -= 871622ArrayPos0 = 01623CallFunction(LoadSaveMenu_DrawSaveFiles)1624Object.YPos += 401625ArrayPos0++1626CallFunction(LoadSaveMenu_DrawSaveFiles)1627Object.YPos += 401628ArrayPos0++1629CallFunction(LoadSaveMenu_DrawSaveFiles)1630Object.YPos += 401631ArrayPos0++1632CallFunction(LoadSaveMenu_DrawSaveFiles)1633break16341635case STATE_FADEIN_DELETECONFIRM1636case STATE_DELETE_CONFIRM1637case STATE_FADEOUT_DELETECONFIRM1638DrawSpriteScreenFX(57, FX_INK, Screen.CenterX, 84)1639if DeleteConfirm.Highlight == DELETE_YES1640DrawSpriteScreenFX(76, FX_INK, Screen.CenterX, 112)1641else1642DrawSpriteScreenFX(75, FX_INK, Screen.CenterX, 112)1643end if1644if DeleteConfirm.Highlight == DELETE_NO1645DrawSpriteScreenFX(78, FX_INK, Screen.CenterX, 146)1646else1647DrawSpriteScreenFX(77, FX_INK, Screen.CenterX, 146)1648end if1649ArrayPos0 = Object.SelectedOption1650Object.Alpha = 2551651CallFunction(LoadSaveMenu_DrawSaveFiles)1652break16531654case STATE_DELETECONFIRM_SELECTED1655// Flash the selected button1656TempValue0 = Object.FadeValue1657TempValue0 &= 31658TempValue0 >>= 116591660DrawSpriteScreenFX(57, FX_INK, Screen.CenterX, 84)1661if DeleteConfirm.Highlight == DELETE_YES1662if TempValue0 == 01663DrawSpriteScreenFX(76, FX_INK, Screen.CenterX, 112)1664else1665DrawSpriteScreenFX(75, FX_INK, Screen.CenterX, 112)1666end if1667else1668DrawSpriteScreenFX(75, FX_INK, Screen.CenterX, 112)1669end if1670if DeleteConfirm.Highlight == DELETE_NO1671if TempValue0 == 01672DrawSpriteScreenFX(78, FX_INK, Screen.CenterX, 146)1673else1674DrawSpriteScreenFX(77, FX_INK, Screen.CenterX, 146)1675end if1676else1677DrawSpriteScreenFX(77, FX_INK, Screen.CenterX, 146)1678end if1679ArrayPos0 = Object.SelectedOption1680Object.Alpha = 2551681CallFunction(LoadSaveMenu_DrawSaveFiles)1682break1683end switch1684end sub168516861687sub ObjectStartup1688switch Engine.Language1689case LANG_ENGLISH1690LoadSpriteSheet("Menu/MenuGfx2_EN.gif")1691break1692case LANG_FRENCH1693LoadSpriteSheet("Menu/MenuGfx2_FR.gif")1694break1695case LANG_ITALIAN1696LoadSpriteSheet("Menu/MenuGfx2_IT.gif")1697break1698case LANG_DEUTSCH1699LoadSpriteSheet("Menu/MenuGfx2_DE.gif")1700break1701case LANG_SPANISH1702LoadSpriteSheet("Menu/MenuGfx2_ES.gif")1703break1704case LANG_JAPANESE1705LoadSpriteSheet("Menu/MenuGfx2_JP.gif")1706break1707end switch17081709SpriteFrame(4, 2, 32, 32, 389, 1) // #0 - Save 1 Gear1710SpriteFrame(4, 2, 32, 32, 422, 1) // #1 - Save 2 Gear1711SpriteFrame(4, 2, 32, 32, 455, 1) // #2 - Save 3 Gear1712SpriteFrame(4, 2, 32, 32, 446, 34) // #3 - Save 4 Gear1713SpriteFrame(3, 2, 40, 32, 259, 1) // #4 - Mini Sonic Gear1714SpriteFrame(3, 2, 64, 32, 259, 1) // #5 - Mini Sonic + Hey1715SpriteFrame(3, 2, 40, 32, 324, 1) // #6 - Mini Tails Gear1716SpriteFrame(3, 2, 64, 32, 324, 1) // #7 - Mini Tails + Hey1717SpriteFrame(45, 12, 13, 13, 488, 1) // #8 - Triangle Detail1718SpriteFrame(0, 0, 250, 37, 259, 421) // #9 - Select Border1719SpriteFrame(64, 12, 128, 16, 1, 1) // #10 - New Game1720SpriteFrame(64, 12, 144, 16, 259, 93) // #11 - Palmtree Panic1721SpriteFrame(64, 12, 144, 16, 259, 110) // #12 - Collision Chaos1722SpriteFrame(64, 12, 144, 16, 259, 127) // #13 - Tidal Tempest1723SpriteFrame(64, 12, 144, 16, 259, 144) // #14 - Quartz Quadrant1724SpriteFrame(64, 12, 144, 16, 259, 161) // #15 - Wacky Workbench1725SpriteFrame(64, 12, 144, 16, 259, 178) // #16 - Stardust Speedway1726SpriteFrame(64, 12, 144, 16, 259, 195) // #17 - Metallic Madness1727SpriteFrame(64, 12, 144, 16, 259, 212) // #18 - Final Fever1728SpriteFrame(64, 12, 144, 16, 259, 229) // #19 - Special Stage1729//Highlights1730SpriteFrame(64, 12, 128, 16, 130, 1) // #20 - New Game1731SpriteFrame(64, 12, 144, 16, 259, 268) // #21 - Palmtree Panic1732SpriteFrame(64, 12, 144, 16, 259, 285) // #22 - Collision Chaos1733SpriteFrame(64, 12, 144, 16, 259, 302) // #23 - Tidal Tempest1734SpriteFrame(64, 12, 144, 16, 259, 319) // #24 - Quartz Quadrant1735SpriteFrame(64, 12, 144, 16, 259, 336) // #25 - Wacky Workbench1736SpriteFrame(64, 12, 144, 16, 259, 353) // #26 - Stardust Speedway1737SpriteFrame(64, 12, 144, 16, 259, 370) // #27 - Metallic Madness1738SpriteFrame(64, 12, 144, 16, 259, 387) // #28 - Final Fever1739SpriteFrame(64, 12, 144, 16, 259, 404) // #29 - Special Stage17401741ReadSaveRAM()1742Options.Soundtrack = SaveRAM[38]1743if SaveRAM[36] == true1744Options.TailsUnlocked = true1745end if17461747SpriteFrame(-112, 0, 224, 16, 1, 477) // #30 - Player Select17481749SpriteFrame(-16, -20, 32, 40, 26, 357) // #31 - Sonic1750if Options.TailsUnlocked == true1751SpriteFrame(-16, -12, 32, 32, 59, 365) // #32 - Tails1752else1753SpriteFrame(-16, -12, 32, 32, 72, 332) // #32 - Locked Tails1754end if17551756SpriteFrame(-24, -24, 48, 48, 405, 88) // #33 - Character Border17571758SpriteFrame(-14, 0, 27, 8, 454, 88) // #34 - Sonic Name1759if Options.TailsUnlocked == true1760// Bug Details:1761// This works fine everywhere else, but in the Blit releases of the game, this sprite was1762// extended in the JP spritesheet to match the width of (unused) Japanese text sprites1763// This difference wasn't taken into account here, causing Tails' name to be cut off in-game1764SpriteFrame(-12, 0, 24, 8, 482, 88) // #35 - Tails Name1765else1766SpriteFrame(-12, 0, 24, 8, 92, 365) // #35 - Tails Name Locked1767end if17681769SpriteFrame(-14, 0, 27, 8, 454, 97) // #36 - Sonic Name Highlight1770if Options.TailsUnlocked == true1771// Bug Details: Same as above1772SpriteFrame(-12, 0, 24, 8, 482, 97) // #37 - Tails Name Highlight1773else1774SpriteFrame(-12, 0, 24, 8, 92, 374) // #37 - Tails Name Locked1775end if17761777SpriteFrame(224, 7, 8, 8, 404, 137) // #38 - Green Time Stone1778SpriteFrame(232, 7, 8, 8, 413, 137) // #39 - Orange Time Stone1779SpriteFrame(220, 15, 8, 8, 422, 137) // #40 - Yellow Time Stone1780SpriteFrame(228, 15, 8, 8, 431, 137) // #41 - Blue Time Stone1781SpriteFrame(236, 15, 8, 8, 440, 137) // #42 - Cyan Time Stone1782SpriteFrame(224, 23, 8, 8, 449, 137) // #43 - Purple Time Stone1783SpriteFrame(232, 23, 8, 8, 458, 137) // #44 - Red Time Stone17841785// (#45 - #51) - Time Stone Socket1786SpriteFrame(224, 7, 8, 8, 467, 137)1787SpriteFrame(232, 7, 8, 8, 467, 137)1788SpriteFrame(220, 15, 8, 8, 467, 137)1789SpriteFrame(228, 15, 8, 8, 467, 137)1790SpriteFrame(236, 15, 8, 8, 467, 137)1791SpriteFrame(224, 23, 8, 8, 467, 137)1792SpriteFrame(232, 23, 8, 8, 467, 137)17931794SpriteFrame(0, 0, 64, 18, 404, 196) // #52 - Delete1795SpriteFrame(0, 0, 64, 18, 404, 215) // #53 - Delete Highlight1796SpriteFrame(0, 0, 64, 18, 404, 234) // #54 - Cancel1797SpriteFrame(0, 0, 64, 18, 404, 253) // #55 - Cancel Highlight1798SpriteFrame(0, 0, 250, 37, 259, 459) // #56 - Orange Alpha1799SpriteFrame(-112, 0, 224, 16, 1, 443) // #57 - "Delete Save Game?"1800SpriteFrame(-112, 0, 224, 16, 1, 460) // #58 - Unused1801SpriteFrame(208, 12, 8, 16, 478, 183) // #59 - 11802SpriteFrame(208, 12, 8, 16, 487, 183) // #60 - 21803SpriteFrame(208, 12, 8, 16, 496, 183) // #61 - 31804SpriteFrame(208, 12, 8, 16, 469, 200) // #62 - 41805SpriteFrame(208, 12, 8, 16, 478, 200) // #63 - 51806SpriteFrame(208, 12, 8, 16, 487, 200) // #64 - 61807SpriteFrame(208, 12, 8, 16, 496, 200) // #65 - 71808SpriteFrame(208, 12, 8, 16, 469, 217) // #66 - 8 (Unused)1809// Highlights1810SpriteFrame(208, 12, 8, 16, 478, 234) // #67 - 11811SpriteFrame(208, 12, 8, 16, 487, 234) // #68 - 21812SpriteFrame(208, 12, 8, 16, 496, 234) // #69 - 31813SpriteFrame(208, 12, 8, 16, 469, 251) // #70 - 41814SpriteFrame(208, 12, 8, 16, 478, 251) // #71 - 51815SpriteFrame(208, 12, 8, 16, 487, 251) // #72 - 61816SpriteFrame(208, 12, 8, 16, 496, 251) // #73 - 71817SpriteFrame(208, 12, 8, 16, 469, 268) // #74 - 8 (Unused)18181819SpriteFrame(-32, 0, 64, 21, 404, 319) // #75 - Yes1820SpriteFrame(-32, 0, 64, 21, 404, 341) // #76 - Yes Highlight1821SpriteFrame(-32, 0, 64, 21, 404, 363) // #77 - No1822SpriteFrame(-32, 0, 64, 21, 404, 385) // #78 - No Highlight1823end sub182418251826// ========================1827// Editor Subs1828// ========================18291830sub RSDKDraw1831DrawSprite(0)1832end sub183318341835sub RSDKLoad1836LoadSpriteSheet("Global/Display.gif")1837SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon18381839SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")1840end sub184118421843