Path: blob/main/Scripts/Upsell/UpsellDL.txt
1319 views
//-----------------Sonic CD Upsell DL Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Fade6#alias Object.Value1 : Object.Selection78// States9#alias 0 : UPSELLDL_SETUP_INFADE10#alias 1 : UPSELLDL_FADEIN11#alias 2 : UPSELLDL_CONTROLS12#alias 3 : UPSELLDL_EXIT1314// Presentation List Stages15#alias 1 : STAGE_P_MENU1617// Global SFX18#alias 23 : SFX_G_MENUBUTTON1920// Languages21#alias 0 : LANG_ENGLISH22#alias 1 : LANG_FRENCH23#alias 2 : LANG_ITALIAN24#alias 3 : LANG_DEUTSCH25#alias 4 : LANG_SPANISH26#alias 5 : LANG_JAPANESE2728// Engine & Callbacks29#alias 8 : CALLBACK_BUY_FULL_GAME_SELECTED3031#alias 5 : ENGINE_ENTER_HIRESMODE32#alias 6 : ENGINE_EXIT_HIRESMODE333435sub ObjectMain36switch Object.State37case UPSELLDL_SETUP_INFADE38if Options.PhysicalControls == false39Object.Selection = -140else41Object.Selection = 042end if4344if Object.Fade < 1645Object.Fade++46else47Object.Fade = 28848Object.State++49end if50SetScreenFade(0, 0, 0, 255)51break5253case UPSELLDL_FADEIN54if Object.Fade > 055Object.Fade -= 856else57Object.State++58end if59SetScreenFade(0, 0, 0, Object.Fade)60break6162case UPSELLDL_CONTROLS63if Options.PhysicalControls == true64if KeyPress[0].Up == true65Object.Selection--66if Object.Selection < 067Object.Selection = 168end if69PlaySfx(SFX_G_MENUBUTTON, false)70end if7172if KeyPress[0].Down == true73Object.Selection++74if Object.Selection > 175Object.Selection = 076end if77PlaySfx(SFX_G_MENUBUTTON, false)78end if7980if KeyPress[0].Start == true81switch Object.Selection82case 083EngineCallback(CALLBACK_BUY_FULL_GAME_SELECTED)84break85case 186Object.State = UPSELLDL_EXIT87break88end switch89end if9091if KeyPress[0].ButtonA == true92switch Object.Selection93case 094EngineCallback(CALLBACK_BUY_FULL_GAME_SELECTED)95break96case 197Object.State = UPSELLDL_EXIT98break99end switch100end if101102CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)103if CheckResult > -1104Options.PhysicalControls = false105Object.Selection = -1106end if107else108CheckTouchRect(0, 0, Screen.XSize, Screen.YSize)109TempValue3 = CheckResult110TempValue0 = Screen.CenterX111TempValue0 -= 80112TempValue1 = Screen.CenterX113TempValue1 += 80114CheckTouchRect(TempValue0, 168, TempValue1, 200)115if CheckResult > -1116Object.Selection = 0117else118if TempValue3 < 0119if Object.Selection == 0120EngineCallback(CALLBACK_BUY_FULL_GAME_SELECTED)121Object.Selection = -1122end if123else124if Object.Selection == 0125Object.Selection = -1126end if127end if128end if129130TempValue0 = Screen.CenterX131TempValue0 -= 64132TempValue1 = Screen.CenterX133TempValue1 += 64134CheckTouchRect(TempValue0, 208, TempValue1, 236)135if CheckResult > -1136Object.Selection = 1137else138if TempValue3 < 0139if Object.Selection == 1140Object.State = UPSELLDL_EXIT141Object.Selection = -1142end if143else144if Object.Selection == 1145Object.Selection = -1146end if147end if148end if149150if KeyPress[0].Up == true151Object.Selection = 1152Options.PhysicalControls = true153end if154155if KeyPress[0].Down == true156Object.Selection = 0157Options.PhysicalControls = true158end if159end if160break161162case UPSELLDL_EXIT163if Object.Fade < 288164Object.Fade += 8165else166Engine.State = ENGINE_EXIT_HIRESMODE167168Stage.ActiveList = PRESENTATION_STAGE169Stage.ListPos = STAGE_P_MENU170LoadStage()171end if172173TempValue0 = Object.Fade174if TempValue0 > 255175TempValue0 = 255176end if177SetScreenFade(0, 0, 0, TempValue0)178break179end switch180end sub181182183sub ObjectDraw184Object.Scale = 216185DrawSpriteScreenFX(0, FX_SCALE, Screen.CenterX, Screen.CenterY)186187if Object.Selection == 0 // Buy full game188DrawSpriteScreenFX(1, FX_SCALE, Screen.CenterX, 186)189end if190191if Object.Selection == 1 // Play again192DrawSpriteScreenFX(2, FX_SCALE, Screen.CenterX, 222)193end if194end sub195196197sub ObjectStartup198// Cycle through all scene objects and find if there are any Upsell DL Objects199TempValue0 = false200ArrayPos0 = 32201while ArrayPos0 < 1056202if Object[ArrayPos0].Type == TypeName[Upsell DL]203// If there are, then set the load sheet flag to true204TempValue0 = true205end if206207ArrayPos0++208loop209210// Only if there's an Upsell DL object in the scene, load the sheet211// (It's a really large sheet! Loading it unnecessarily can heavily increase loading times!)212if TempValue0 == true213switch Engine.Language214case LANG_ENGLISH215// LoadSpriteSheet("Upsell/UpsellDL_EN.pvr") // Sonic CD Lite used PVRs, but the latest releases use gif instead216LoadSpriteSheet("Upsell/UpsellDL_EN.gif")217break218case LANG_FRENCH219LoadSpriteSheet("Upsell/UpsellDL_FR.gif")220break221case LANG_ITALIAN222LoadSpriteSheet("Upsell/UpsellDL_IT.gif")223break224case LANG_DEUTSCH225LoadSpriteSheet("Upsell/UpsellDL_DE.gif")226break227case LANG_SPANISH228LoadSpriteSheet("Upsell/UpsellDL_ES.gif")229break230case LANG_JAPANESE231// LoadSpriteSheet("Upsell/UpsellDL_JP.pvr") // Sonic CD Lite used PVRs, but the latest releases use gif instead232LoadSpriteSheet("Upsell/UpsellDL_JP.gif")233break234end switch235236// Load the entire palette file, notably overriding the global section of the palette as well237LoadPalette("UpsellDL.act", 0, 0, 0, 256)238end if239240Engine.State = ENGINE_ENTER_HIRESMODE241242SpriteFrame(-512, -288, 1024, 576, 0, 0) // Entire BG sprite243244// The LANG_JAPANESE version of the selected frames are just a tad bit taller245if Engine.Language != LANG_JAPANESE246SpriteFrame(-128, -35, 260, 69, 381, 580) // "Buy full game" (or some equivalent in the chosen language)247SpriteFrame(-91, -24, 182, 49, 420, 673) // "Try again" (or some equivalent in the chosen language)248else249SpriteFrame(-128, -36, 260, 69, 381, 580) // "完全版の購入"250SpriteFrame(-91, -24, 183, 49, 420, 677) // "もう一度遊ぶ"251end if252end sub253254255// ========================256// Editor Subs257// ========================258259sub RSDKDraw260DrawSprite(0)261end sub262263264sub RSDKLoad265LoadSpriteSheet("Upsell/UpsellDL_EN.gif")266SpriteFrame(-512, -288, 1024, 576, 0, 0)267268SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")269end sub270271272