Path: blob/master/Sonic 1/Scripts/Continue/ContinueSetup.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Continue Setup Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer1213private alias 0 : CONTINUESETUP_SETUP14private alias 1 : CONTINUESETUP_FADEIN15private alias 2 : CONTINUESETUP_PLAYERFALL16private alias 3 : CONTINUESETUP_WAITING17private alias 4 : CONTINUESETUP_CHARGEUP18private alias 5 : CONTINUESETUP_RUNOFFSCREEN19private alias 6 : CONTINUESETUP_RETURNTOSTAGE20private alias 7 : CONTINUESETUP_FADETOMENU2122// Continue Aliases23private alias 1 : CONTINUE_COUNTDOWN2425// Player Aliases26private alias object.state : player.state27private alias object.type : player.type28private alias object.speed : player.speed29private alias object.xpos : player.xpos30private alias object.ypos : player.ypos31private alias object.yvel : player.yvel32private alias object.xvel : player.xvel33private alias object.animation : player.animation34private alias object.animationSpeed : player.animationSpeed35private alias object.controlMode : player.controlMode36private alias object.propertyValue : player.character3738// ========================39// Events40// ========================4142event ObjectUpdate43switch object.state44case CONTINUESETUP_SETUP45object.timer = 32046SetScreenFade(0, 0, 0, object.timer)47object.state++48break4950case CONTINUESETUP_FADEIN51if object.timer > 052object.timer -= 853else54player[0].yvel = 0x3000055if player[1].type != TypeName[Blank Object]56player[1].yvel = 0x3000057end if5859PlayMusic(0)60object.state++61end if6263SetScreenFade(0, 0, 0, object.timer)64break6566case CONTINUESETUP_PLAYERFALL67temp0 = 06869// Every character has a unique target position70switch stage.playerListPos71case PLAYER_SONIC_A72case PLAYER_SONIC_TAILS_A73// 172 pixels74temp1 = 0xAC000075break7677case PLAYER_TAILS_A78// 177 pixels79temp1 = 0xB1000080break8182case PLAYER_KNUCKLES_A83// 168 pixels84temp1 = 0xA8000085break86#platform: USE_ORIGINS87case PLAYER_AMY_A88case PLAYER_AMY_TAILS_A89// 172 pixels90temp1 = 0xAC000091break92#endplatform9394end switch9596temp2 = temp197temp2 += 0x8000098player[0].animationSpeed = 6099if player[0].ypos >= temp2100player[0].ypos = temp1101player[0].yvel = 0102player[0].animation = ANI_CONTINUE103104temp0++105end if106107if player[1].type == TypeName[Blank Object]108// If there's no P2, then just skip over them109temp0++110else111player[1].animationSpeed = 60112113// We're assuming Tails values for P2 here114if player[1].ypos >= 0xB90000115player[1].ypos = 0xB10000116player[1].yvel = 0117player[1].animation = ANI_CONTINUE118119temp0++120end if121end if122123// Are both players ready?124if temp0 == 2125object.state++126object[+2].state++ // state should become CONTINUE_COUNTDOWN127end if128break129130case CONTINUESETUP_WAITING131#platform: USE_STANDALONE132CheckTouchRect(0, 0, screen.xsize, screen.ysize)133if checkResult > -1134keyPress[0].start = true135end if136137if keyPress[0].start == true138#endplatform139140#platform: USE_ORIGINS141checkResult = false142checkResult |= keyPress[0].start143checkResult |= keyPress[0].buttonA144checkResult |= keyPress[0].buttonC145if checkResult == true146#endplatform147148player[0].animation = ANI_CONTINUE_UP149player[0].speed = 0150#platform: USE_STANDALONE151if stage.playerListPos == PLAYER_KNUCKLES_A152player[0].ypos -= 0x20000153else154player[0].ypos -= 0x60000155end if156#endplatform157158#platform: USE_ORIGINS159switch player[0].character160case PLAYER_KNUCKLES_A161case PLAYER_AMY_A162player[0].ypos -= 0x20000163break164default165player[0].ypos -= 0x60000166end switch167#endplatform168169PlaySfx(SfxName[Charge], false)170171object.state++172object[+2].state++ // state should become CONTINUE_COUNTDOWN173end if174break175176case CONTINUESETUP_CHARGEUP177if music.volume > 0178music.volume--179end if180181player[0].speed += 0x2000182if player[0].speed == 0x90000183player[0].xvel = 0x100000184if player[1].type == TypeName[Blank Object]185object.state++186end if187end if188189if player[1].type != TypeName[Blank Object]190if player[0].speed == 0x20000191player[1].animation = ANI_CONTINUE_UP192player[1].speed = 0193player[1].ypos -= 0x60000194PlaySfx(SfxName[Charge], false)195end if196197if player[0].speed > 0x20000198player[1].speed += 0x2000199if player[1].speed == 0x90000200player[1].xvel = 0x100000201object.state++202end if203end if204end if205break206207case CONTINUESETUP_RUNOFFSCREEN208if music.volume > 0209music.volume--210end if211212temp0 = screen.xsize213temp0 += 32214if player[1].type == TypeName[Blank Object]215temp1 = player[0].xpos216else217temp1 = player[1].xpos218end if219220temp1 >>= 16221if temp1 >= temp0222object.state++223end if224break225226case CONTINUESETUP_RETURNTOSTAGE227if music.volume > 0228music.volume--229end if230231object.timer += 4232SetScreenFade(0, 0, 0, object.timer)233234if object.timer == 384235player.continues--236player.lives = 3237fadeColor = 0238object.timer = 0239lampPostID = 0240object.direction = FLIP_NONE // huh?241stage.activeList = recStageList242stage.listPos = recStage243LoadStage()244end if245break246247case CONTINUESETUP_FADETOMENU248object.timer += 4249SetScreenFade(0, 0, 0, object.timer)250251if object.timer == 384252fadeColor = 0253object.timer = 0254lampPostID = 0255object.direction = FLIP_NONE // what does direction even matter here...256257#platform: USE_STANDALONE258engine.state = 8259#endplatform260261#platform: USE_ORIGINS262stage.activeList = PRESENTATION_STAGE // Origins sends you back to the title screen.263stage.listPos = 0264LoadStage()265#endplatform266267end if268break269270end switch271272// Hide touch controls273options.touchControls = false274end event275276277event ObjectDraw278// Fill the screen with black279// -> Needed to prevent frame smear, since this level doesn't have a background280ClearScreen(1)281end event282283284event ObjectStartup285foreach (TypeName[Continue Setup], arrayPos0, ALL_ENTITIES)286object[arrayPos0].drawOrder = 0287next288289player[0].xpos = screen.xcenter290player[0].xpos <<= 16291player[0].animation = ANI_FANROTATE292player[0].state = Player_State_ContinueRun293player[0].yvel = 0x30000294295// Is P2 there?296if player[1].type != TypeName[Blank Object]297// Adjust the scene to make room for P2298299player[1].xpos = screen.xcenter300player[1].xpos <<= 16301player[1].animation = ANI_FANROTATE302player[1].state = Player_State_ContinueRun303player[1].yvel = 0x30000304player[0].xpos += 0x200000305player[1].xpos -= 0x200000306player[1].ypos += 0x50000307end if308309// Make minor position corrections based on the main character310switch stage.playerListPos311case PLAYER_SONIC_A312case PLAYER_SONIC_TAILS_A313// Sonic doesn't need any corrections314break315316case PLAYER_TAILS_A317player[0].ypos += 0x50000318break319320case PLAYER_KNUCKLES_A321#platform: USE_ORIGINS322case PLAYER_KNUCKLES_TAILS_A // Again...? This isn't a combo in Origins Plus...323#endplatform324player[0].ypos -= 0x40000325break326#platform: USE_ORIGINS327case PLAYER_AMY_A328case PLAYER_AMY_TAILS_A329// Amy (and Tails) don't need any corrections?330break331#endplatform332333end switch334335stage.newXBoundary2 = screen.xsize336stage.newYBoundary2 = screen.ysize337338SetMusicTrack("Continue.ogg", 0, false)339340// This is meant to disable pausing, but the Player Object doesn't check if pause is enabled,341// and start is the only button you can press, so it pauses when you want to continue342stage.pauseEnabled = false343344if player.continues == 0345// If the player has no continues they were likely brought here from the Dev Menu, so give them 3 continues346347player.continues = 3348end if349350options.touchControls = false351352#platform: USE_DECOMP353// Not in the original game, but this fixes an issue where354// pressing start to continue also pauses the entire game355player[0].controlMode = CONTROLMODE_NONE356#endplatform357358end event359360361// ========================362// Editor Events363// ========================364365event RSDKDraw366DrawSprite(0)367end event368369370event RSDKLoad371LoadSpriteSheet("Global/Display.gif")372SpriteFrame(-16, -16, 32, 32, 1, 143)373374SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")375end event376377378