Path: blob/master/Sonic 1/Scripts/Ending/EndingPose.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Ending Pose 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.logoPos // Not set in this script, but set by the [Ending Control] that spawns this object13private alias object.value2 : object.tailFrame1415// This object's states are pretty complex, a single object won't cycle through them all but instead each of the states appear under different scenarios16// I tried to note how each state plays into others, sorry if the explanation isn't any good though...1718// These first two states are only encountered in the bad ending, when the player didn't get all emeralds19private alias 0 : ENDINGPOSE_INIT20private alias 1 : ENDINGPOSE_WAITING2122// These next three states are when P1 poses, each pose frame is its own state23// These states are seen in both types of the ending24private alias 2 : ENDINGPOSE_POSE_START25private alias 3 : ENDINGPOSE_POSE_MID26private alias 4 : ENDINGPOSE_POSE_END2728private alias 5 : ENDINGPOSE_HOLDEMERALDS29private alias 6 : ENDINGPOSE_EMERALDSSHINE30private alias 7 : ENDINGPOSE_LOOKUP31private alias 8 : ENDINGPOSE_EMERALDSFLASH_A // Fade-out32private alias 9 : ENDINGPOSE_EMERALDSFLASH_B // Fade-in33private alias 10 : ENDINGPOSE_LOOKAROUND34private alias 11 : ENDINGPOSE_LOOKLEFT35// (And then after looking left, P1 goes over to ENDINGPOSE_POSE_START)3637// P2 Tails gets his own little states too, though they aren't as grand as P1's giant poses are38private alias 12 : ENDINGPOSE_P2_LOOKAROUND39private alias 13 : ENDINGPOSE_P2_LOOKLEFT40private alias 14 : ENDINGPOSE_P2_POSE_141private alias 15 : ENDINGPOSE_P2_POSE_2424344// Player Aliases45private alias object.state : player.state46private alias object.xpos : player.xpos47private alias object.ypos : player.ypos48private alias object.speed : player.speed49private alias object.frame : player.frame50private alias object.direction : player.direction51private alias object.up : player.up52private alias object.drawOrder : player.drawOrder53private alias object.controlMode : player.controlMode5455// Reserved Object Slot Aliases56private alias 1 : SLOT_PLAYER2575859// ========================60// Function Declarations61// ========================6263reserve function EndingPose_UpdateLogo646566// ========================67// Function Definitions68// ========================6970private function EndingPose_UpdateLogo71if object.logoPos > 072object.logoPos -= 1673end if74end function757677// ========================78// Events79// ========================8081event ObjectUpdate82switch object.state83case ENDINGPOSE_INIT84object.state++85if stage.playerListPos == PLAYER_TAILS_A86// A little extra setup for Tails's tails87object.tailFrame = 3688end if89// Fall-through9091case ENDINGPOSE_WAITING92object.timer++93if stage.playerListPos == PLAYER_TAILS_A94// Animate Tails's tails95object.tailFrame = object.timer96object.tailFrame >>= 397object.tailFrame %= 598object.tailFrame += 3699end if100101if object.timer == 240102currentPlayer = SLOT_PLAYER2103while currentPlayer < playerCount104ResetObjectEntity(currentPlayer, TypeName[Ending Pose], 0, player[currentPlayer].xpos, player[currentPlayer].ypos)105player[currentPlayer].drawOrder = 6106player[currentPlayer].state = ENDINGPOSE_P2_POSE_1107player[currentPlayer].frame = 43108player[currentPlayer].direction = FACING_LEFT109110currentPlayer++111loop112113object.timer = 0114switch stage.playerListPos115case PLAYER_SONIC_A116case PLAYER_SONIC_TAILS_A117object.frame = 1118break119120case PLAYER_TAILS_A121object.frame = 14122break123124case PLAYER_KNUCKLES_A125object.frame = 25126break127128#platform: USE_ORIGINS129case PLAYER_AMY_A130object.frame = 45131object.frame += 1132break133#endplatform134end switch135136object.state++137object.tailFrame = 0138else139currentPlayer = SLOT_PLAYER2140while currentPlayer < playerCount141if player[currentPlayer].speed == 0142player[currentPlayer].direction = FACING_LEFT143end if144145currentPlayer++146loop147end if148break149150case ENDINGPOSE_POSE_START151CallFunction(EndingPose_UpdateLogo)152object.timer++153if object.timer == 12154object.timer = 0155switch stage.playerListPos156case PLAYER_SONIC_A157case PLAYER_SONIC_TAILS_A158object.frame = 2159object.ixpos = camera[0].xpos160object.iypos = camera[0].ypos161break162163case PLAYER_TAILS_A164case PLAYER_KNUCKLES_A165break166167#platform: USE_ORIGINS168case PLAYER_AMY_A169object.frame++170object.ixpos = camera[0].xpos171object.iypos = camera[0].ypos172break173#endplatform174end switch175176object.state++177end if178break179180case ENDINGPOSE_POSE_MID181CallFunction(EndingPose_UpdateLogo)182object.timer++183if object.timer == 4184object.timer = -1560185switch stage.playerListPos186case PLAYER_SONIC_A187case PLAYER_SONIC_TAILS_A188object.frame = 3189break190191case PLAYER_TAILS_A192object.frame = 15193object.ixpos = camera[0].xpos194object.iypos = camera[0].ypos195break196197case PLAYER_KNUCKLES_A198object.frame = 26199object.ixpos = camera[0].xpos200object.iypos = camera[0].ypos201break202203#platform: USE_ORIGINS204case PLAYER_AMY_A205object.frame = 45206object.frame += 3207break208#endplatform209end switch210211object.state++212end if213break214215case ENDINGPOSE_POSE_END216if object.timer < 320217object.timer += 12218else219// Roll the credits!220stage.activeList = PRESENTATION_STAGE221stage.listPos = 2222223lampPostID = 0224recMilliSeconds = 0225recSeconds = 0226recMinutes = 0227LoadStage()228end if229230if object.timer > 0231temp0 = object.timer232else233temp0 = 0234end if235SetScreenFade(0, 0, 0, temp0)236break237238// In the good ending, the character starts on this state, skipping all the ones before239case ENDINGPOSE_HOLDEMERALDS240object.timer++241if object.timer == 80242object.timer = 0243object.state++244else245switch stage.playerListPos246case PLAYER_SONIC_A247case PLAYER_SONIC_TAILS_A248object.frame = 4249break250251case PLAYER_TAILS_A252object.frame = 16253break254255case PLAYER_KNUCKLES_A256object.frame = 27257break258259#platform: USE_ORIGINS260case PLAYER_AMY_A261object.frame = 45262object.frame += 4263break264#endplatform265end switch266267currentPlayer = SLOT_PLAYER2268while currentPlayer < playerCount269if player[currentPlayer].speed == 0270player[currentPlayer].direction = FACING_LEFT271end if272273currentPlayer++274loop275end if276break277278case ENDINGPOSE_EMERALDSSHINE279object.frame = object.timer280object.frame >>= 2281object.frame &= 1282283switch stage.playerListPos284case PLAYER_SONIC_A285case PLAYER_SONIC_TAILS_A286object.frame += 5287break288289case PLAYER_TAILS_A290object.frame += 17291break292293case PLAYER_KNUCKLES_A294object.frame += 27295break296297#platform: USE_ORIGINS298case PLAYER_AMY_A299object.frame += 45300object.frame += 5301break302#endplatform303end switch304305object.timer++306if object.timer == 80307object.timer = 0308switch stage.playerListPos309case PLAYER_SONIC_A310case PLAYER_SONIC_TAILS_A311object.frame = 7312break313314case PLAYER_TAILS_A315object.frame = 19316break317318case PLAYER_KNUCKLES_A319object.frame = 29320break321322#platform: USE_ORIGINS323case PLAYER_AMY_A324object.frame = 45325object.frame += 7326break327#endplatform328end switch329330currentPlayer = SLOT_PLAYER2331while currentPlayer < playerCount332player[currentPlayer].up = true333player[currentPlayer].controlMode = CONTROLMODE_NONE334335currentPlayer++336loop337338CreateTempObject(TypeName[Emeralds], 0, object.xpos, object.ypos)339object[tempObjectPos].drawOrder = 6340341object.state++342else343currentPlayer = SLOT_PLAYER2344while currentPlayer < playerCount345if player[currentPlayer].speed == 0346player[currentPlayer].direction = FACING_LEFT347end if348349currentPlayer++350loop351end if352break353354case ENDINGPOSE_LOOKUP355// In this state, we wait for the Emeralds to increase our state356break357358case ENDINGPOSE_EMERALDSFLASH_A359if object.timer < 384360object.timer += 6361else362object.timer = 256363364// Set all FG chunks to use their flowered versions365SetTileLayerEntry(184, 0, 2, 2)366SetTileLayerEntry(185, 0, 3, 2)367SetTileLayerEntry(186, 0, 2, 3)368SetTileLayerEntry(187, 0, 3, 3)369SetTileLayerEntry(188, 0, 4, 2)370SetTileLayerEntry(189, 0, 5, 2)371SetTileLayerEntry(190, 0, 4, 3)372SetTileLayerEntry(191, 0, 5, 3)373374object.state++375end if376377SetScreenFade(208, 255, 224, object.timer)378break379380case ENDINGPOSE_EMERALDSFLASH_B381if object.timer > 0382object.timer -= 16383SetScreenFade(208, 255, 224, object.timer)384else385switch stage.playerListPos386case PLAYER_SONIC_A387case PLAYER_SONIC_TAILS_A388object.frame = 8389break390391case PLAYER_TAILS_A392object.frame = 20393break394395case PLAYER_KNUCKLES_A396object.frame = 30397break398399#platform: USE_ORIGINS400case PLAYER_AMY_A401object.frame = 45402object.frame += 8403break404#endplatform405end switch406407object.state++408currentPlayer = SLOT_PLAYER2409while currentPlayer < playerCount410ResetObjectEntity(currentPlayer, TypeName[Ending Pose], 0, player[currentPlayer].xpos, player[currentPlayer].ypos)411player[currentPlayer].drawOrder = 6412player[currentPlayer].state = ENDINGPOSE_P2_LOOKAROUND413player[currentPlayer].frame = 43414player[currentPlayer].direction = FACING_LEFT415416currentPlayer++417loop418end if419break420421case ENDINGPOSE_LOOKAROUND422switch stage.playerListPos423case PLAYER_SONIC_A424case PLAYER_SONIC_TAILS_A425object.frame = object.timer426object.frame /= 6427object.frame &= 1428object.frame += 8429break430431case PLAYER_TAILS_A432object.frame = object.timer433object.frame /= 10434object.frame &= 3435object.frame += 20436if object.timer >= 40437object.frame = 23438end if439break440441case PLAYER_KNUCKLES_A442object.frame = object.timer443object.frame /= 10444object.frame &= 3445object.frame += 30446if object.timer >= 40447object.frame = 34448end if449break450451#platform: USE_ORIGINS452case PLAYER_AMY_A453object.frame = object.timer454object.frame /= 6455object.frame &= 1456object.frame += 8457object.frame += 45458break459#endplatform460end switch461462object.timer++463if object.timer == 42464object.timer = 0465object.state++466end if467break468469case ENDINGPOSE_LOOKLEFT470object.timer++471if object.timer == 60472object.timer = 0473switch stage.playerListPos474case PLAYER_SONIC_A475case PLAYER_SONIC_TAILS_A476object.frame = 1477break478479case PLAYER_TAILS_A480object.frame = 14481break482483case PLAYER_KNUCKLES_A484object.frame = 25485break486487#platform: USE_ORIGINS488case PLAYER_AMY_A489object.frame = 45490object.frame += 1491break492#endplatform493end switch494495object.state = ENDINGPOSE_POSE_START496end if497break498499// These remaining three states are for P2 Tails, looking busy while P1 (as a separate Ending Pose Object) gets to do the proper big poses front and center500501case ENDINGPOSE_P2_LOOKAROUND502object.frame = object.timer503object.frame /= 10504object.frame &= 3505object.frame += 20506if object.timer >= 40507object.frame = 23508end if509510object.timer++511if object.timer == 42512object.timer = 0513object.state++514end if515break516517case ENDINGPOSE_P2_LOOKLEFT518object.timer++519if object.timer == 60520object.timer = 0521object.frame = 43522object.state++523end if524break525526case ENDINGPOSE_P2_POSE_1527object.timer++528if object.timer == 8529object.frame++530object.timer = 0531object.state++532end if533break534535// ENDINGPOSE_P2_POSE_2 doesn't have a case since it doesn't do anything, its frame is set when exiting ENDINGPOSE_P2_POSE_1536537end switch538end event539540541event ObjectDraw542if object.tailFrame != 0543// Tails should have one of his tails sprites in tow544DrawSprite(object.tailFrame)545end if546547// The main player sprite548DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)549550// P1 should draw the logo, as well551if object.entityPos == 0552if object.state > 0553temp0 = screen.xcenter554temp0 -= 96555temp0 -= object.logoPos556if stage.player2Enabled == true557if options.region == true558// "Sonic the Hedgehog and Miles"559temp1 = 42560else561// "Sonic the Hedgehog and Tails"562temp1 = 41563end if564else565temp1 = 10566#platform: USE_STANDALONE567if stage.playerListPos < PLAYER_SONIC_TAILS_A568temp1 += stage.playerListPos569end if570#endplatform571572#platform: USE_ORIGINS573if stage.playerListPos < PLAYER_SONIC_TAILS574temp1 += stage.playerListPos575else576if stage.playerListPos == PLAYER_AMY577temp1 = 45578temp1 += 10579end if580end if581#endplatform582end if583584DrawSpriteScreenXY(temp1, temp0, 80)585end if586end if587end event588589590event ObjectStartup591LoadSpriteSheet("Ending/Objects.gif")592593// 0 - Sonic Idle Frame594SpriteFrame(-14, -20, 30, 39, 28, 16)595596// 1-3 - Sonic's Final Pose Animation Frames597SpriteFrame(-16, -16, 32, 35, 3, 220)598SpriteFrame(-18, -27, 44, 71, 36, 184)599SpriteFrame(-56, -68, 174, 134, 81, 121)600601// 4-9 - Sonic's Good Ending Animation Frames602SpriteFrame(-10, -21, 24, 40, 3, 16)603SpriteFrame(-10, -21, 24, 40, 3, 16)604SpriteFrame(-14, -21, 28, 40, 3, 57)605SpriteFrame(-16, -20, 29, 39, 3, 98)606SpriteFrame(-16, -21, 32, 40, 3, 138)607SpriteFrame(-16, -21, 32, 40, 3, 179)608609// 10 - "Sonic the Hedgehog"610SpriteFrame(-48, 0, 96, 31, 256, 141)611612// 11 - "Miles 'Tails' Prower In Sonic the Hedgehog"613SpriteFrame(-48, -17, 96, 48, 256, 182)614615// 12 - "Knuckles the Echidna in Sonic the Hedgehog"616SpriteFrame(-48, -17, 96, 48, 256, 124)617618// 13-15 - Tails's Final Pose Animation Frames619SpriteFrame(-10, -13, 24, 31, 288, 16)620SpriteFrame(-19, -12, 33, 31, 254, 16)621SpriteFrame(-55, -48, 111, 96, 400, 1)622623// 16-23 - Tails's Good Ending Animation Frames624// (The two medium-sized transition frames next to the big sprite are unused)625SpriteFrame(-12, -16, 27, 34, 313, 16)626SpriteFrame(-12, -16, 27, 34, 59, 16)627SpriteFrame(-15, -16, 30, 34, 87, 16)628SpriteFrame(-15, -14, 31, 32, 118, 16)629630SpriteFrame(-12, -16, 25, 34, 150, 16)631SpriteFrame(-12, -16, 25, 34, 176, 16)632SpriteFrame(-12, -16, 25, 34, 202, 16)633SpriteFrame(-12, -16, 25, 34, 228, 16)634635// 24-26 - Knuckles's Final Pose Animation Frames636SpriteFrame(-14, -23, 27, 41, 325, 57)637SpriteFrame(-16, -21, 28, 39, 296, 57)638SpriteFrame(-32, -52, 64, 104, 448, 98)639640// 27-35 - Knuckles's Good Ending Animation Frames641// (The two medium-sized transition frames next to the big sprite are unused)642SpriteFrame(-12, -23, 24, 41, 32, 57)643SpriteFrame(-16, -23, 28, 41, 57, 57)644SpriteFrame(-18, -22, 45, 40, 86, 57)645SpriteFrame(-16, -23, 33, 41, 132, 57)646SpriteFrame(-16, -23, 33, 41, 166, 57)647SpriteFrame(-16, -23, 33, 41, 200, 57)648SpriteFrame(-16, -23, 33, 41, 200, 57)649SpriteFrame(-16, -23, 27, 41, 268, 57)650SpriteFrame(-16, -23, 33, 41, 234, 57)651652// 36-40 - Tails's Tails' Frames653// Drawn using object.tailFrame, rather than the base object.frame654SpriteFrame(-21, -6, 16, 24, 256, 99)655SpriteFrame(-25, -6, 20, 24, 273, 99)656SpriteFrame(-25, -6, 20, 24, 294, 99)657SpriteFrame(-25, -6, 20, 24, 315, 99)658SpriteFrame(-25, -6, 20, 24, 336, 99)659660// 41 - "Sonic the Hedgehog and Tails"661SpriteFrame(-48, 0, 96, 40, 256, 141)662663// 42 - "Sonic the Hedgehog and Miles"664SpriteFrame(-48, 0, 96, 40, 256, 199)665666// 43-44 - P2 Tails Pose Frames667SpriteFrame(-10, -13, 22, 31, 58, 99)668SpriteFrame(-20, -17, 36, 35, 44, 131)669670#platform: USE_ORIGINS671// 45 - Amy's Normal Ending Animation Frame672SpriteFrame(-10, -16, 21, 35, 421, 211)673674// 46-48 - Amy's Final Pose Animation Frames675SpriteFrame(-12, -15, 28, 34, 407, 175)676SpriteFrame(-30, -42, 67, 67, 353, 211)677SpriteFrame(-31, -73, 124, 144, 3, 256)678679// 49-54 - Amy's Good Ending Animation Frames680SpriteFrame(-8, -16, 21, 35, 353, 139)681SpriteFrame(-8, -16, 21, 35, 353, 139)682SpriteFrame(-12, -16, 25, 35, 375, 139)683SpriteFrame(-13, -17, 25, 36, 401, 138)684SpriteFrame(-13, -16, 26, 35, 353, 175)685SpriteFrame(-13, -16, 26, 35, 380, 175)686687// 55 - "Amy Rose in Sonic the Hedgehog"688SpriteFrame(-48, -17, 96, 48, 256, 240)689#endplatform690end event691692693// ========================694// Editor Events695// ========================696697event RSDKDraw698DrawSprite(0)699end event700701702event RSDKLoad703LoadSpriteSheet("Ending/Objects.gif")704SpriteFrame(-56, -68, 174, 134, 81, 121)705706SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")707end event708709710