Path: blob/master/Sonic 2/Scripts/2PVS/2PVSMenu1.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: 2P VS Menu 1 Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value1 : object.iconSheet13private alias object.value2 : object.textSheet14private alias object.value3 : object.selection15private alias object.value4 : object.buttonOption16private alias object.value5 : object.selectionTimer1718private alias object.value6 : object.prevGameLenSelected19private alias object.value7 : object.prevItemModeSelected20private alias object.value8 : object.nextGameLenSelected21private alias object.value9 : object.nextItemModeSelected22private alias object.value10 : object.okSelected23private alias object.value11 : object.backSelected2425// States26private alias 0 : 2PVSMENU1_SETUP27private alias 1 : 2PVSMENU1_SELECTING28private alias 2 : 2PVSMENU1_SELECTEDOPTION29private alias 3 : 2PVSMENU1_TOVSMENU230private alias 4 : 2PVSMENU1_EXITTOMENU3132// Selections33private alias 0 : 2PVSMENU1_SEL_NONE34private alias 1 : 2PVSMENU1_SEL_GAMELEN35private alias 2 : 2PVSMENU1_SEL_ITEMMODE36private alias 3 : 2PVSMENU1_SEL_OKBACK3738// Button Selections39private alias 0 : 2PVSMENU1_BTN_OK40private alias 1 : 2PVSMENU1_BTN_BACK4142// 2PVSMenu2 Aliases43private alias object.value0 : 2PVSMenu2.timer4445// 2PVSMenu2 States46private alias 1 : 2PVSMENU2_SELECTING4748// Item Mode Aliases49private alias 0 : ITEMMODE_NOPREFERENCE50private alias 1 : ITEMMODE_RANDOM51private alias 2 : ITEMMODE_TELEPORTONLY52private alias 3 : ITEMMODE_FIXED535455// ========================56// Function Declarations57// ========================5859reserve function 2PVSMenu1_SetupMatchLenText60reserve function 2PVSMenu1_SetupItemsText616263// ========================64// Function Definitions65// ========================6667private function 2PVSMenu1_SetupMatchLenText68switch vs.gameLength69case 070EditMenuEntry(MENU_1, "GAME: NO PREFERENCE", 0, true)71break7273case 174EditMenuEntry(MENU_1, "GAME: 1 MATCH ", 0, true)75break7677case 278EditMenuEntry(MENU_1, "GAME: 2 MATCHES", 0, true)79break8081case 382EditMenuEntry(MENU_1, "GAME: 3 MATCHES", 0, true)83break8485case 486EditMenuEntry(MENU_1, "GAME: 4 MATCHES", 0, true)87break8889case 590EditMenuEntry(MENU_1, "GAME: 5 MATCHES", 0, true)91break9293case 694EditMenuEntry(MENU_1, "GAME: 6 MATCHES", 0, true)95break9697case 798EditMenuEntry(MENU_1, "GAME: 7 MATCHES", 0, true)99break100101case 8102EditMenuEntry(MENU_1, "GAME: 8 MATCHES", 0, true)103break104105end switch106end function107108109private function 2PVSMenu1_SetupItemsText110switch vs.itemMode111case ITEMMODE_NOPREFERENCE112EditMenuEntry(MENU_1, "ITEMS: NO PREFERENCE", 8, true)113break114115case ITEMMODE_RANDOM116EditMenuEntry(MENU_1, "ITEMS: RANDOM", 8, true)117break118119case ITEMMODE_TELEPORTONLY120EditMenuEntry(MENU_1, "ITEMS: TELEPORT ONLY", 8, true)121break122123case ITEMMODE_FIXED124EditMenuEntry(MENU_1, "ITEMS: FIXED", 8, true)125break126127end switch128end function129130131// ========================132// Events133// ========================134135event ObjectUpdate136switch object.state137case 2PVSMENU1_SETUP138SetupMenu(MENU_1, 0, 3, 2)139LoadSpriteSheet("LevelSelect/Icons.gif")140object.iconSheet = object.spriteSheet141LoadSpriteSheet("LevelSelect/Text.gif")142object.textSheet = object.spriteSheet143144if engine.deviceType == STANDARD145options.physicalControls = true146end if147148if options.physicalControls == false149menu1.selection = -1150object.selection = 2PVSMENU1_SEL_NONE151else152menu1.selection = 0153object.selection = 2PVSMENU1_SEL_GAMELEN154end if155156#platform: USE_ORIGINS157// It's local multiplayer, you choose or you lose.158if vs.gameLength == 0159vs.gameLength = 1160end if161162if vs.itemMode == ITEMMODE_NOPREFERENCE163vs.itemMode = ITEMMODE_RANDOM164end if165#endplatform166167AddMenuEntry(MENU_1, "GAME: NO PREFERENCE", true)168CallFunction(2PVSMenu1_SetupMatchLenText)169AddMenuEntry(MENU_1, "@", true)170AddMenuEntry(MENU_1, "@", true)171AddMenuEntry(MENU_1, "@", true)172AddMenuEntry(MENU_1, "@", true)173AddMenuEntry(MENU_1, "@", true)174AddMenuEntry(MENU_1, "@", true)175AddMenuEntry(MENU_1, "@", true)176AddMenuEntry(MENU_1, "ITEMS: NO PREFERENCE", true)177178CallFunction(2PVSMenu1_SetupItemsText)179180object.state++181break182183case 2PVSMENU1_SELECTING184if options.physicalControls == false185CheckTouchRect(0, 0, screen.xsize, screen.ysize)186if checkResult > -1187// Prev Game Length/Item Mode188temp0 = screen.xcenter189temp0 -= 152190temp1 = temp0191temp1 += 38192CheckTouchRect(temp0, 72, temp1, 104)193if checkResult > -1194object.prevGameLenSelected = true195else196object.prevGameLenSelected = false197end if198CheckTouchRect(temp0, 136, temp1, 168)199if checkResult > -1200object.prevItemModeSelected = true201else202object.prevItemModeSelected = false203end if204205// Next Game Length/Item Mode206temp0 = screen.xcenter207temp0 += 116208temp1 = temp0209temp1 += 38210CheckTouchRect(temp0, 72, temp1, 104)211if checkResult > -1212object.nextGameLenSelected = true213else214object.nextGameLenSelected = false215end if216CheckTouchRect(temp0, 136, temp1, 168)217if checkResult > -1218object.nextItemModeSelected = true219else220object.nextItemModeSelected = false221end if222223// OK button224temp0 = screen.xcenter225temp0 += 8226temp1 = temp0227temp1 += 64228CheckTouchRect(temp0, 192, temp1, 224)229if checkResult > -1230object.okSelected = true231else232object.okSelected = false233end if234235// Back button236temp1 = screen.xcenter237temp1 -= 8238temp0 = temp1239temp0 -= 64240CheckTouchRect(temp0, 192, temp1, 224)241if checkResult > -1242object.backSelected = true243else244object.backSelected = false245end if246else247if object.prevGameLenSelected == true248object.prevGameLenSelected = false249vs.gameLength--250if vs.gameLength < 0251vs.gameLength = 8252end if253254CallFunction(2PVSMenu1_SetupMatchLenText)255PlaySfx(SfxName[Menu Move], false)256end if257258if object.prevItemModeSelected == true259object.prevItemModeSelected = false260vs.itemMode--261if vs.itemMode < ITEMMODE_NOPREFERENCE262vs.itemMode = ITEMMODE_FIXED263end if264265CallFunction(2PVSMenu1_SetupItemsText)266PlaySfx(SfxName[Menu Move], false)267end if268269if object.nextGameLenSelected == true270object.nextGameLenSelected = false271vs.gameLength++272if vs.gameLength > 8273vs.gameLength = 0274end if275276CallFunction(2PVSMenu1_SetupMatchLenText)277PlaySfx(SfxName[Menu Move], false)278end if279280if object.nextItemModeSelected == true281object.nextItemModeSelected = false282vs.itemMode++283if vs.itemMode > ITEMMODE_FIXED284vs.itemMode = ITEMMODE_NOPREFERENCE285end if286287CallFunction(2PVSMenu1_SetupItemsText)288PlaySfx(SfxName[Menu Move], false)289end if290291if object.okSelected == true292object.okSelected = false293object.state = 2PVSMENU1_SELECTEDOPTION294object.buttonOption = 2PVSMENU1_BTN_OK295PlaySfx(SfxName[Menu Select], false)296end if297298if object.backSelected == true299object.backSelected = false300object.state = 2PVSMENU1_SELECTEDOPTION301object.buttonOption = 2PVSMENU1_BTN_BACK302PlaySfx(SfxName[Menu Back], false)303end if304end if305306if object.state != 2PVSMENU1_SELECTEDOPTION307if keyPress[0].up == true308options.physicalControls = true309object.selection = 2PVSMENU1_SEL_OKBACK310end if311312if keyPress[0].down == true313options.physicalControls = true314object.selection = 2PVSMENU1_SEL_GAMELEN315end if316end if317else318if keyPress[0].up == true319object.selection--320if object.selection < 2PVSMENU1_SEL_GAMELEN321object.selection = 2PVSMENU1_SEL_OKBACK322end if323324PlaySfx(SfxName[Menu Move], false)325end if326327if keyPress[0].down == true328object.selection++329if object.selection > 2PVSMENU1_SEL_OKBACK330object.selection = 2PVSMENU1_SEL_GAMELEN331end if332333PlaySfx(SfxName[Menu Move], false)334end if335336switch object.selection337default338case 2PVSMENU1_SEL_NONE339break340341case 2PVSMENU1_SEL_GAMELEN342menu1.selection = 0343if keyPress[0].left == true344vs.gameLength--345// (Origins removes the No Preference setting)346#platform: USE_STANDALONE347if vs.gameLength < 0348#endplatform349#platform: USE_ORIGINS350if vs.gameLength < 1351#endplatform352vs.gameLength = 8353end if354355CallFunction(2PVSMenu1_SetupMatchLenText)356PlaySfx(SfxName[Menu Move], false)357end if358359if keyPress[0].right == true360vs.gameLength++361if vs.gameLength > 8362// (Origins removes the No Preference setting)363#platform: USE_STANDALONE364vs.gameLength = 0365#endplatform366#platform: USE_ORIGINS367vs.gameLength = 1368#endplatform369end if370371CallFunction(2PVSMenu1_SetupMatchLenText)372PlaySfx(SfxName[Menu Move], false)373end if374375if keyPress[0].buttonB == true376menu1.selection = -1377object.buttonOption = 2PVSMENU1_BTN_BACK378object.state = 2PVSMENU1_SELECTEDOPTION379PlaySfx(SfxName[Menu Back], false)380end if381break382383case 2PVSMENU1_SEL_ITEMMODE384menu1.selection = 8385if keyPress[0].left == true386vs.itemMode--387#platform: USE_STANDALONE388if vs.itemMode < ITEMMODE_NOPREFERENCE389#endplatform390#platform: USE_ORIGINS391if vs.itemMode < ITEMMODE_RANDOM392#endplatform393vs.itemMode = ITEMMODE_FIXED394end if395396CallFunction(2PVSMenu1_SetupItemsText)397PlaySfx(SfxName[Menu Move], false)398end if399400if keyPress[0].right == true401vs.itemMode++402if vs.itemMode > ITEMMODE_FIXED403#platform: USE_STANDALONE404vs.itemMode = ITEMMODE_NOPREFERENCE405#endplatform406#platform: USE_ORIGINS407vs.itemMode = ITEMMODE_RANDOM408#endplatform409end if410411CallFunction(2PVSMenu1_SetupItemsText)412PlaySfx(SfxName[Menu Move], false)413end if414415if keyPress[0].buttonB == true416menu1.selection = -1417object.buttonOption = 2PVSMENU1_BTN_BACK418object.state = 2PVSMENU1_SELECTEDOPTION419PlaySfx(SfxName[Menu Back], false)420end if421break422423case 2PVSMENU1_SEL_OKBACK424menu1.selection = -1425if keyPress[0].left == true426object.buttonOption ^= 1427PlaySfx(SfxName[Menu Move], false)428end if429430if keyPress[0].right == true431object.buttonOption ^= 1432PlaySfx(SfxName[Menu Move], false)433end if434435if keyPress[0].start == true436object.state = 2PVSMENU1_SELECTEDOPTION437PlaySfx(SfxName[Menu Select], false)438end if439440if keyPress[0].buttonA == true441object.state = 2PVSMENU1_SELECTEDOPTION442PlaySfx(SfxName[Menu Select], false)443end if444445if keyPress[0].buttonB == true446object.buttonOption = 2PVSMENU1_BTN_BACK447object.state = 2PVSMENU1_SELECTEDOPTION448PlaySfx(SfxName[Menu Back], false)449end if450break451452end switch453454if object.state != 2PVSMENU1_SELECTEDOPTION455CheckTouchRect(0, 0, screen.xsize, screen.ysize)456if checkResult > -1457options.physicalControls = false458object.selection = 2PVSMENU1_SEL_NONE459menu1.selection = -1460end if461end if462end if463break464465case 2PVSMENU1_SELECTEDOPTION466if object.selectionTimer < 32467object.selectionTimer++468else469object.selectionTimer = 0470if object.buttonOption == 2PVSMENU1_BTN_OK471object.state = 2PVSMENU1_TOVSMENU2472else473object.state = 2PVSMENU1_EXITTOMENU474end if475end if476break477478case 2PVSMENU1_TOVSMENU2 // Goes to 2P VS Menu 4 in Origins479if object.timer < 256480object.timer += 16481SetScreenFade(0x00, 0x00, 0x00, object.timer)482else483#platform: USE_STANDALONE484// In networking mode we have only a single, online multiplayer menu485ResetObjectEntity(1, TypeName[2P VS Menu 2], 0, 0, 0)486object[1].priority = PRIORITY_ACTIVE487#endplatform488#platform: USE_ORIGINS489// In local multiplayer mode we have two menus, one for each player present490ResetObjectEntity(1, TypeName[2P VS Menu 4], 1, 0, 88)491object[1].priority = PRIORITY_ACTIVE492ResetObjectEntity(2, TypeName[2P VS Menu 4], 2, 0, 168)493object[2].priority = PRIORITY_ACTIVE494#endplatform495object[0].state = 2PVSMENU2_SELECTING4962PVSMenu2[0].timer = 384497SetScreenFade(0x00, 0x00, 0x00, 0xFF)498end if499break500501case 2PVSMENU1_EXITTOMENU502if object.timer < 256503music.volume -= 10504object.timer += 16505SetScreenFade(0x00, 0x00, 0x00, object.timer)506else507StopMusic()508options.vsMode = false509#platform: USE_STANDALONE510engine.state = 8511#endplatform512#platform: USE_ORIGINS513game.titleMode = true514stage.activeList = PRESENTATION_STAGE515stage.listPos = 0516LoadStage()517#endplatform518SetScreenFade(0x00, 0x00, 0x00, 0xFF)519end if520break521522end switch523end event524525526event ObjectDraw527object.spriteSheet = object.iconSheet528DrawSpriteScreenXY(0, screen.xcenter, 17)529DrawSpriteScreenXY(1, screen.xcenter, 17)530531if object.selection == 2PVSMENU1_SEL_GAMELEN532DrawSpriteScreenXY(3, screen.xcenter, 64)533else534DrawSpriteScreenXY(2, screen.xcenter, 64)535end if536537if object.selection == 2PVSMENU1_SEL_ITEMMODE538DrawSpriteScreenXY(3, screen.xcenter, 128)539else540DrawSpriteScreenXY(2, screen.xcenter, 128)541end if542543switch object.selection544case 2PVSMENU1_SEL_NONE545if object.prevGameLenSelected == true546DrawSpriteScreenXY(5, screen.xcenter, 88)547else548DrawSpriteScreenXY(4, screen.xcenter, 88)549end if550551if object.nextGameLenSelected == true552DrawSpriteScreenXY(7, screen.xcenter, 88)553else554DrawSpriteScreenXY(6, screen.xcenter, 88)555end if556557if object.prevItemModeSelected == true558DrawSpriteScreenXY(5, screen.xcenter, 152)559else560DrawSpriteScreenXY(4, screen.xcenter, 152)561end if562563if object.nextItemModeSelected == true564DrawSpriteScreenXY(7, screen.xcenter, 152)565else566DrawSpriteScreenXY(6, screen.xcenter, 152)567end if568break569570case 2PVSMENU1_SEL_GAMELEN571if keyDown[0].left == true572DrawSpriteScreenXY(5, screen.xcenter, 88)573else574DrawSpriteScreenXY(4, screen.xcenter, 88)575end if576577if keyDown[0].right == true578DrawSpriteScreenXY(7, screen.xcenter, 88)579else580DrawSpriteScreenXY(6, screen.xcenter, 88)581end if582break583584case 2PVSMENU1_SEL_ITEMMODE585if keyDown[0].left == true586DrawSpriteScreenXY(5, screen.xcenter, 152)587else588DrawSpriteScreenXY(4, screen.xcenter, 152)589end if590591if keyDown[0].right == true592DrawSpriteScreenXY(7, screen.xcenter, 152)593else594DrawSpriteScreenXY(6, screen.xcenter, 152)595end if596break597598end switch599600temp0 = object.selectionTimer601temp0 >>= 1602temp0 &= 1603if temp0 == 0604if object.okSelected == true605DrawSpriteScreenXY(9, screen.xcenter, 210)606else607DrawSpriteScreenXY(8, screen.xcenter, 210)608end if609610if object.backSelected == true611DrawSpriteScreenXY(11, screen.xcenter, 210)612else613DrawSpriteScreenXY(10, screen.xcenter, 210)614end if615else616if object.buttonOption == 2PVSMENU1_BTN_OK617DrawSpriteScreenXY(9, screen.xcenter, 210)618DrawSpriteScreenXY(10, screen.xcenter, 210)619else620DrawSpriteScreenXY(8, screen.xcenter, 210)621DrawSpriteScreenXY(11, screen.xcenter, 210)622end if623end if624625if object.state < 2PVSMENU1_SELECTEDOPTION626if object.selection == 2PVSMENU1_SEL_OKBACK627if object.buttonOption == 2PVSMENU1_BTN_OK628DrawSpriteScreenXY(12, screen.xcenter, 210)629else630DrawSpriteScreenXY(13, screen.xcenter, 210)631end if632end if633end if634635object.spriteSheet = object.textSheet636temp0 = screen.xcenter637temp0 -= 8638DrawMenu(MENU_1, screen.xcenter, 84)639end event640641642event ObjectStartup643LoadSpriteSheet("LevelSelect/Icons.gif")644LoadSpriteSheet("LevelSelect/Text.gif")645SpriteFrame(-56, 0, 32, 14, 185, 124) // VS text - #0646SpriteFrame(-8, 0, 64, 14, 185, 109) // MODE text - #1647SpriteFrame(-112, 0, 224, 48, 1, 151) // Details Border - #2648SpriteFrame(-112, 0, 224, 48, 1, 200) // Details Border (Selected) - #3649SpriteFrame(-142, -10, 20, 20, 138, 22) // Left - #4650SpriteFrame(-142, -10, 20, 20, 138, 64) // Left (Selected) - #5651SpriteFrame(122, -10, 20, 20, 159, 22) // Right - #6652SpriteFrame(122, -10, 20, 20, 159, 64) // Right (Selected) - #7653SpriteFrame(20, -10, 40, 20, 1, 320) // OK - #8654SpriteFrame(20, -10, 40, 20, 42, 320) // OK (Selected) - #9655SpriteFrame(-60, -10, 40, 20, 1, 341) // Back - #10656SpriteFrame(-60, -10, 40, 20, 42, 341) // Back (Selected) - #11657SpriteFrame(18, -12, 42, 22, 1, 362) // Selection Box (OK) - #12658SpriteFrame(-62, -12, 42, 22, 1, 362) // Selection Box (Back) - #13659660foreach (TypeName[2P VS Menu 1], arrayPos0, ALL_ENTITIES)661object[arrayPos0].priority = PRIORITY_ACTIVE662next663end event664665666// ========================667// Editor Events668// ========================669670event RSDKDraw671DrawSprite(0)672DrawSprite(1)673end event674675676event RSDKLoad677LoadSpriteSheet("LevelSelect/Icons.gif")678SpriteFrame(-56, 0, 32, 14, 185, 124) // VS text - #0679SpriteFrame(-8, 0, 64, 14, 185, 109) // MODE text - #1680681SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")682end event683684685