Path: blob/master/Sonic 2/Scripts/Mission/SuperSonic.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: SuperSonic Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// This Object is used in Mission "Super Sonic Finish" - M045 - Mission_Zone098// This Object is also used in its follow-up DLC Mission, "Extreme! Super Sonic Finish" - M104 - DLC_Zone069// It's to be paired with the SetRingCount object, or else Sonic will detransform immediately since he has no rings and all1011// ========================12// Aliases13// ========================1415// States16private alias 0 : SUPERSONIC_TRANSFORM17private alias 1 : SUPERSONIC_NOSUPERCHECK18private alias 2 : SUPERSONIC_STATIC19private alias 3 : SUPERSONIC_PLAYMUSIC20private alias 4 : SUPERSONIC_FACERIGHT2122// Player Aliases23private alias object.type : player.type24private alias object.state : player.state25private alias object.visible : player.visible26private alias object.xpos : player.xpos27private alias object.ypos : player.ypos28private alias object.direction : player.direction29private alias object.value1 : player.timer30private alias object.value7 : player.invincibleTimer31private alias object.value8 : player.blinkTimer32private alias object.value34 : player.collisionDisabled3334// Super State Aliases35private alias 0 : SUPERSTATE_NONE36private alias 1 : SUPERSTATE_SUPER37private alias 2 : SUPERSTATE_FADEOUT38private alias 3 : SUPERSTATE_END3940// Track Aliases41private alias 7 : TRACK_SUPER424344// ========================45// Events46// ========================4748event ObjectUpdate49switch object.state50case SUPERSONIC_TRANSFORM51currentPlayer = 052object.type = player[0].type // Set ourselves to Player Object for the function we're about to call53CallFunction(Player_TryTransform)54object.type = TypeName[SuperSonic] // We're done pretending to be Sonic, set ourselves back55object.state = SUPERSONIC_NOSUPERCHECK56break5758case SUPERSONIC_NOSUPERCHECK59if Player_superState == SUPERSTATE_NONE60if stage.timeEnabled == true61// You turned back into regular Sonic. Test failed.62game.forceKillPlayer = true63object.state = SUPERSONIC_STATIC64end if65end if66break6768case SUPERSONIC_STATIC69break7071// These following two states are pretty much unused72case SUPERSONIC_PLAYMUSIC73PlayMusic(TRACK_SUPER)74object.state = SUPERSONIC_FACERIGHT75break7677case SUPERSONIC_FACERIGHT // Why is this a separate state???78player[0].direction = FACING_RIGHT79object.state = SUPERSONIC_NOSUPERCHECK80break8182end switch83end event848586event ObjectStartup87temp0 = false88foreach (TypeName[SuperSonic], arrayPos0, ALL_ENTITIES)89object[arrayPos0].priority = PRIORITY_ACTIVE9091if object[arrayPos0].propertyValue != 092// Do note - every instance of a SuperSonic object in the game has a property value of 09394player[arrayPos0].state = SUPERSONIC_PLAYMUSIC95temp0 = true96end if97next9899if temp0 != false100// This is another stubbed out/unused method of making the Player start as Super Sonic101// It doesn't work quite as it should, the version used in ObjectUpdate is used instead102103currentPlayer = 0104arrayPos0 = currentPlayer105arrayPos0 += playerCount106ResetObjectEntity(arrayPos0, TypeName[Super Spark], 0, player[0].xpos, player[0].ypos)107object[arrayPos0].priority = PRIORITY_ACTIVE108109Player_superState = SUPERSTATE_SUPER110player[currentPlayer].invincibleTimer = 60111player[currentPlayer].blinkTimer = 0112player[currentPlayer].visible = true113CallFunction(Player_UpdatePhysicsState)114115if stage.playerListPos == PLAYER_SONIC_A116// This animation file is being loaded to the [SuperSonic] object type, it's supposed to be117// for the [Player Object] type though118LoadAnimation("SuperSonic.ani")119end if120121player[currentPlayer].state = Player_State_Air_NoDropDash122player[currentPlayer].collisionDisabled = true123player[currentPlayer].timer = 0124end if125end event126127128// ========================129// Editor Events130// ========================131132event RSDKDraw133DrawSprite(0)134end event135136137event RSDKLoad138LoadSpriteSheet("Global/Items.gif")139SpriteFrame(-24, -24, 48, 48, 207, 149)140141// Well technically it does something, but even if it is set, the ObjectUpdate version of the routine will run the right after anyway, so...142// May as well keep its label as "unused"143SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")144end event145146147