0% found this document useful (0 votes)
20 views94 pages

Sonic Player Object Script Details

Txt

Uploaded by

gbiel.fcardoso
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views94 pages

Sonic Player Object Script Details

Txt

Uploaded by

gbiel.fcardoso
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

// ----------------------------------

// RSDK Project: Sonic 1/Sonic 2


// Script Description: Player Object Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 1 : TYPE_PLAYEROBJECT
public alias 256 : GROUP_PLAYERS
public alias 65536 : HITBOX_AUTO
public alias arrayPos6 : currentPlayer
public alias arrayPos7 : playerCount
private alias object[8].value14 : TimeOverFlag
private alias 20 : [Link]

public alias saveRAM[257] : [Link]


public alias saveRAM[258] : [Link]
public alias saveRAM[259] : [Link]
public alias saveRAM[260] : [Link]
public alias saveRAM[261] : [Link]
public alias saveRAM[262] : [Link]
public alias saveRAM[263] : [Link]
public alias saveRAM[264] : [Link]
public alias saveRAM[265] : [Link]
public alias saveRAM[266] : [Link]
public alias saveRAM[267] : [Link]
public alias saveRAM[268] : [Link]
public alias saveRAM[269] : [Link]
public alias saveRAM[270] : [Link]
public alias saveRAM[271] : [Link]
public alias saveRAM[272] : [Link]
public alias saveRAM[273] : [Link]
public alias saveRAM[274] : [Link]
public alias saveRAM[275] : [Link]
public alias saveRAM[276] : [Link]
public alias saveRAM[277] : [Link]
public alias saveRAM[280] : [Link]
public alias saveRAM[281] : [Link]
public alias saveRAM[282] : [Link]
public alias saveRAM[283] : [Link]
public alias saveRAM[284] : [Link]
public alias saveRAM[285] : [Link]
public alias saveRAM[286] : [Link]
public alias saveRAM[287] : [Link]
public alias saveRAM[295]: [Link]
public alias saveRAM[297] : [Link]
public alias saveRAM[298] : [Link]
public alias saveRAM[299] : [Link]
public alias saveRAM[300] : [Link]
public alias saveRAM[301] : [Link]

private alias object.value0 : [Link]


private alias object.value3 : [Link] // Countdown before player moves
to next drown "level"
private alias object.value4 : [Link]
private alias object.value5 : [Link]
private alias object.value6 : [Link]
private alias object.value7 : [Link]
private alias object.value8 : [Link]
private alias object.value9 : [Link]
private alias object.value10 : [Link] // Used by springs to store
what animation will play after the bounce animation
private alias object.value11 : [Link] // A timer of how long the camera
will stay locked for
private alias object.value12 : [Link]
private alias object.value13 : [Link]
private alias object.value14 : [Link]
private alias object.value15 : [Link]
private alias object.value16 : player.isPlayer2 // 0/false is player 1, 1/true if
player 2
private alias object.value17 : [Link]
private alias object.value18 : [Link]
private alias object.value19 : [Link] // How many enemies the
player has bounced on in a row
private alias object.value20 : [Link] // Not to be confused with
[Link]
private alias object.value21 : [Link]
private alias object.value22 : [Link]
private alias object.value23 : [Link]
private alias object.value24 : [Link]
private alias object.value25 : [Link] // Also used in underwater
checks , 0x1000 if underwater, otherwise 0x3800. Not to be confused with
[Link]
private alias object.value26 : [Link] // Used by Tails only
private alias object.value27 : [Link]
private alias object.value28 : [Link]
private alias object.value29 : [Link] // Active rolling
deceleration - With the player holding the opposite direction
private alias object.value30 : [Link] // Added to the player's position
when jumping/rolling. Normally -5 for S&K, and -1 for Tails
private alias object.value31 : [Link] // Passive rolling
deceleration - Without the player holding the opposite direction
private alias object.value32 : [Link] // Used to store whatever
function this player has for its jump ability
private alias object.value33 : [Link] // Used to store whatever
function this player has for its spindash ability
private alias object.value34 : [Link]
private alias object.value35 : [Link]
private alias object.value36 : [Link] // Tails assist lockout
timer
private alias object.value37 : [Link] // Current shield the player has, see
above constants for what is what
private alias object.value38 : [Link]
private alias object.value39 : [Link]
private alias object.value40 : [Link]
private alias object.value41 : [Link]
private alias object.value42 : [Link]
private alias object.value43 : [Link]
private alias object.value44 : player.p2InputFunction
private alias object.value45 : [Link]
private alias object.value46 : [Link].x
private alias object.value47 : [Link].y

// Function declarations
reserve function PlayerObject_ProcessPlayer
reserve function PlayerObject_Blank
reserve function PlayerObject_HandleMovement
reserve function PlayerObject_HandleAirAcceleration
reserve function PlayerObject_HandleAirMovement
reserve function PlayerObject_ResetOnFloor
reserve function PlayerObject_StartJump
reserve function PlayerObject_StartSpindash
reserve function PlayerObject_StartTailsFlight
reserve function PlayerObject_StartKnuxGlide
reserve function PlayerObject_HandleGround
reserve function PlayerObject_HandleAir
reserve function PlayerObject_AirCtrlLock
reserve function PlayerObject_HandleRoll
reserve function PlayerObject_RollingJump
reserve function PlayerObject_LookingUp
reserve function PlayerObject_Crouching
reserve function PlayerObject_HandleSpindash
reserve function PlayerObject_HandleTailsFlight
reserve function PlayerObject_KnuxGlideLeft
reserve function PlayerObject_KnuxGlideRight
reserve function PlayerObject_KnuxGlideDrop
reserve function PlayerObject_KnuxGlideSlide
reserve function PlayerObject_KnuxWallClimb
reserve function PlayerObject_KnuxLedgePullUp
reserve function PlayerObject_Hurt
reserve function PlayerObject_Knockback
reserve function PlayerObject_Death
reserve function PlayerObject_Drown
reserve function PlayerObject_CheckTile
reserve function PlayerObject_Unknown1
reserve function PlayerObject_RollUnknown
reserve function PlayerObject_Unknown2
reserve function PlayerObject_Clinging
reserve function PlayerObject_WaterSlide
reserve function PlayerObject_FlyCarry
reserve function PlayerObject_HandleRunSpd2
reserve function PlayerObject_InitReplay
reserve function PlayerObject_RestorePowerup
reserve function PlayerObject_HandleSuperPalSonic
reserve function PlayerObject_HandleSuperPalTails
reserve function PlayerObject_HandleSuperPalKnux
reserve function PlayerObject_SwapPhysics
reserve function PlayerObject_ProcessSuperForms
reserve function PlayerObject_CheckHit
reserve function PlayerObject_BadnikBreak
reserve function PlayerObject_Hit
reserve function PlayerObject_FireHit
reserve function PlayerObject_LightningHit
reserve function PlayerObject_ProjectileHit
reserve function PlayerObject_SpikeHit
reserve function PlayerObject_Kill
reserve function PlayerObject_HandleRollAnimSpd
reserve function PlayerObject_HandleWalkAnimSpd
reserve function PlayerObject_HandleRunAnimSpd
reserve function PlayerObject_HandleRolling
reserve function PlayerObject_Transforming
reserve function PlayerObject_SuperTransform
reserve function PlayerObject_BubbleBounce
reserve function PlayerObject_HandleShieldAbilities
reserve function PlayerObject_StartFlyCarry
reserve function PlayerObject_DropDash
reserve function PlayerObject_HandleSuperPeel
reserve function PlayerObject_StartSuperPeel
reserve function PlayerObject_StartSpindashCD
reserve function PlayerObject_HandleSpindashCD
reserve function PlayerObject_HandleSuperPalAmy
reserve function PlayerObject_StartHammerSwing
reserve function PlayerObject_HandleHammerSwing
reserve function PlayerObject_StartHammerSpin
reserve function PlayerObject_HandleHammerSpin
reserve function PlayerObject_StartHop
reserve function PlayerObject_OuttaHere
reserve function PlayerObject_Force45
reserve function PlayerObject_MoveAnimate
reserve function PlayerObject_StartSecondJump
reserve function PlayerObject_ManiaRotate
reserve function PlayerObject_TopGlide
reserve function PlayerObject_EndSuper

// doublejumpstate for Amy


//0 = Not jumped
//1 = Jumped
//2 = DOne both abilities
//3 = Done Hammer Jump
//4 = done hop

// Static Values
public value PlayerObject_LeaderX = 0;
public value PlayerObject_LeaderY = 0;
public value PlayerObject_SidekickX = 0;
public value PlayerObject_SidekickY = 0;
public value PlayerObject_SuperState = 0;
public value PlayerObject_value1 = 0;
public value PlayerObject_value2 = 0;
public value PlayerObject_value3 = 0;
public value PlayerObject_value4 = 0;
public value PlayerObject_value5 = 0;
public value PlayerObject_ReplayTable = 0;
public value PlayerObject_ReplayTablePos = 0;
public value PlayerObject_ReplaySize = 0;
public value PlayerObject_ReplayFrameCnt = 0;
public value PlayerObject_ReplayLength = 0;
public value PlayerObject_value13 = 0;
public value PlayerObject_value14 = 0;
public value PlayerObject_value15 = 0;
public value PlayerObject_value16 = 0;
public value PlayerObject_value17 = 0;
public value PlayerObject_value18 = 0;
public value PlayerObject_value19 = 0;
public value [Link] = 0;

// Tables
public table PlayerObject_SonicSuperPal
0x2020A0, 0x2040C0, 0x4040E0, 0x6060E0
0x404080, 0x4060A0, 0x6060E0, 0x8080E0
0x606060, 0x6080A0, 0x8080E0, 0xA0A0E0
0x808040, 0x80A0A0, 0xA0A0E0, 0xC0C0E0
0xA0A040, 0xA0C0A0, 0xC0C0E0, 0xE0E0E0
0xC0C040, 0xC0E0A0, 0xE0E0E0, 0xE0E0E0
0xE0E040, 0xE0E0A0, 0xE0E0E0, 0xE0E0E0
0xE0E060, 0xE0E0E0, 0xE0E0E0, 0xE0E0E0
0xE0E080, 0xE0E0E0, 0xE0E0E0, 0xE0E0E0
0xE0E060, 0xE0E0C0, 0xE0E0E0, 0xE0E0E0
0xE0E040, 0xE0E0A0, 0xE0E0E0, 0xE0E0E0
0xE0E020, 0xE0E080, 0xE0E0C0, 0xE0E0E0
0xE0E000, 0xE0E060, 0xE0E0A0, 0xE0E0E0
0xE0E000, 0xE0E040, 0xE0E080, 0xE0E0C0
0xE0E000, 0xE0E060, 0xE0E0A0, 0xE0E0E0
0xE0E000, 0xE0E080, 0xE0E0C0, 0xE0E0E0

end table

public table PlayerObject_SonicSuperAltPal


0x202080, 0x4040A0, 0x6060C0, 0x8080E0
0x404060, 0x6060A0, 0x8080E0, 0xA0A0E0
0x606040, 0x8080A0, 0xA0A0E0, 0xC0C0E0
0x808040, 0xA0A0A0, 0xC0C0E0, 0xE0E0E0
0xA0A040, 0xC0C0A0, 0xE0E0E0, 0xE0E0E0
0xC0C040, 0xE0E0A0, 0xE0E0E0, 0xE0E0E0
0xE0E040, 0xE0E0A0, 0xE0E0E0, 0xE0E0E0
0xE0E060, 0xE0E0E0, 0xE0E0E0, 0xE0E0E0
0xE0E080, 0xE0E0E0, 0xE0E0E0, 0xE0E0E0
0xE0E060, 0xE0E0C0, 0xE0E0E0, 0xE0E0E0
0xE0E040, 0xE0E0A0, 0xE0E0E0, 0xE0E0E0
0xE0E020, 0xE0E080, 0xE0E0C0, 0xE0E0E0
0xE0E000, 0xE0E060, 0xE0E0A0, 0xE0E0E0
0xE0E000, 0xE0E040, 0xE0E080, 0xE0E0C0
0xE0E000, 0xE0E060, 0xE0E0A0, 0xE0E0E0
0xE0E000, 0xE0E080, 0xE0E0C0, 0xE0E0E0
end table

public table PlayerObject_TailsSuperPal


0x800000, 0xE08000, 0xE0A000, 0xA06040
0x800000, 0xE0A020, 0xE0C040, 0xA06040
0xA06040, 0xE0C040, 0xE0C080, 0xC06040
0xC06040, 0xE0C080, 0xE0E0A0, 0xE08040
0xA06040, 0xE0C040, 0xE0C080, 0xC06040
0x800000, 0xE0A020, 0xE0C040, 0xA06040
end table

public table PlayerObject_TailsSuperAltPal


0x800000, 0xE08000, 0xE0A000, 0xA06040
0x800000, 0xE0A020, 0xE0C040, 0xA06040
0xA06040, 0xE0C040, 0xE0C080, 0xC06040
0xC06040, 0xE0C080, 0xE0E0A0, 0xE08040
0xA06040, 0xE0C040, 0xE0C080, 0xC06040
0x800000, 0xE0A020, 0xE0C040, 0xA06040
end table

public table PlayerObject_KnuxSuperPal


0x600020, 0xC00020, 0xE04060
0x802040, 0xE04060, 0xE060A0
0xA04060, 0xE06080, 0xE080C0
0xC06080, 0xE080A0, 0xE0A0E0
0xE080A0, 0xE0A0C0, 0xE0C0E0
0xE0A0C0, 0xE0C0E0, 0xE0E0E0
0xE080A0, 0xE0A0C0, 0xE0C0E0
0xC06080, 0xE080A0, 0xE0A0E0
0xA04060, 0xE06080, 0xE080C0
0x802040, 0xE04060, 0xE060A0
end table

public table PlayerObject_KnuxSuperAltPal


0x600020, 0xC00040, 0xE04080
0x802040, 0xE04060, 0xE060A0
0xA04060, 0xE06080, 0xE080C0
0xC06080, 0xE080A0, 0xE0A0E0
0xE080A0, 0xE0A0C0, 0xE0C0E0
0xE0A0C0, 0xE0C0E0, 0xE0E0E0
0xE080A0, 0xE0A0C0, 0xE0C0E0
0xC06080, 0xE080A0, 0xE0A0E0
0xA04060, 0xE06080, 0xE080C0
0x802040, 0xE04060, 0xE060A0
end table

public table PlayerObject_AmySuperPal


0xE080E0, 0xE060C0, 0xC040A0, 0x802060
0xE0A0E0, 0xE080E0, 0xE060C0, 0xA04080
0xE0C0E0, 0xE0A0E0, 0xE080E0, 0xC060A0
0xE0E0E0, 0xE0C0E0, 0xE0A0E0, 0xE080C0
0xE0E0E0, 0xE0E0E0, 0xE0C0E0, 0xE0A0E0
0xE0E0E0, 0xE0C0E0, 0xE0A0E0, 0xE080C0
0xE0C0E0, 0xE0A0E0, 0xE080E0, 0xC060A0
0xE0A0E0, 0xE080E0, 0xE060C0, 0xA04080
end table

public table PlayerObject_AmySuperAltPal


0xE080E0, 0xE060C0, 0xC040A0, 0x802060
0xE0A0E0, 0xE080E0, 0xE060C0, 0xA04080
0xE0C0E0, 0xE0A0E0, 0xE080E0, 0xC060A0
0xE0E0E0, 0xE0C0E0, 0xE0A0E0, 0xE080C0
0xE0E0E0, 0xE0E0E0, 0xE0C0E0, 0xE0A0E0
0xE0E0E0, 0xE0C0E0, 0xE0A0E0, 0xE080C0
0xE0C0E0, 0xE0A0E0, 0xE080E0, 0xC060A0
0xE0A0E0, 0xE080E0, 0xE060C0, 0xA04080
end table

public table PlayerObject_SonicPhysicsTable


0x60000, 0xC00, 0x1800, 0x600, 0x8000, 0x600, 0x68000, -0x40000
0x30000, 0x600, 0xC00, 0x300, 0x4000, 0x300, 0x38000, -0x20000
0xA0000, 0x3000, 0x6000, 0x1800, 0x10000, 0x600, 0x80000, -0x40000
0x50000, 0x1800, 0x3000, 0xC00, 0x8000, 0x300, 0x38000, -0x20000
0xC0000, 0x1800, 0x3000, 0xC00, 0x8000, 0x600, 0x68000, -0x40000
0x60000, 0xC00, 0x1800, 0x600, 0x4000, 0x300, 0x38000, -0x20000
0xC0000, 0x1800, 0x3000, 0xC00, 0x8000, 0x600, 0x80000, -0x40000
0x60000, 0xC00, 0x1800, 0x600, 0x4000, 0x300, 0x38000, -0x20000
end table

public table PlayerObject_TailsPhysicsTable


0x60000, 0xC00, 0x1800, 0x600, 0x8000, 0x600, 0x68000, -0x40000
0x30000, 0x600, 0xC00, 0x300, 0x4000, 0x300, 0x38000, -0x20000
0xA0000, 0x3000, 0x6000, 0x1800, 0x10000, 0x600, 0x80000, -0x40000
0x50000, 0x1800, 0x3000, 0xC00, 0x8000, 0x300, 0x38000, -0x20000
0xC0000, 0x1800, 0x3000, 0xC00, 0x8000, 0x600, 0x68000, -0x40000
0x60000, 0xC00, 0x1800, 0x600, 0x4000, 0x300, 0x38000, -0x20000
0xC0000, 0x1800, 0x3000, 0xC00, 0x8000, 0x600, 0x80000, -0x40000
0x60000, 0xC00, 0x1800, 0x600, 0x4000, 0x300, 0x38000, -0x20000
end table

public table PlayerObject_KnuxPhysicsTable


0x60000, 0xC00, 0x1800, 0x600, 0x8000, 0x600, 0x60000, -0x40000
0x30000, 0x600, 0xC00, 0x300, 0x4000, 0x300, 0x30000, -0x20000
0xA0000, 0x3000, 0x6000, 0x1800, 0x10000, 0x600, 0x60000, -0x40000
0x50000, 0x1800, 0x3000, 0xC00, 0x8000, 0x300, 0x30000, -0x20000
0xC0000, 0x1800, 0x3000, 0xC00, 0x8000, 0x600, 0x60000, -0x40000
0x60000, 0xC00, 0x1800, 0x600, 0x4000, 0x300, 0x30000, -0x20000
0xC0000, 0x1800, 0x3000, 0xC00, 0x8000, 0x600, 0x60000, -0x40000
0x60000, 0xC00, 0x1800, 0x600, 0x8000, 0x300, 0x30000, -0x20000
end table

public table PlayerObject_AmyPhysicsTable


0x60000, 0xC00, 0x1800, 0x600, 0x8000, 0x600, 0x60000, -0x40000
0x30000, 0x600, 0xC00, 0x300, 0x4000, 0x300, 0x30000, -0x20000
0xA0000, 0x3000, 0x6000, 0x1800, 0x10000, 0x600, 0x60000, -0x40000
0x50000, 0x1800, 0x3000, 0xC00, 0x8000, 0x300, 0x30000, -0x20000
0xC0000, 0x1800, 0x3000, 0xC00, 0x8000, 0x600, 0x60000, -0x40000
0x60000, 0xC00, 0x1800, 0x600, 0x4000, 0x300, 0x30000, -0x20000
0xC0000, 0x1800, 0x3000, 0xC00, 0x8000, 0x600, 0x60000, -0x40000
0x60000, 0xC00, 0x1800, 0x600, 0x8000, 0x300, 0x30000, -0x20000
end table

function PlayerObject_InitReplay
PlayerObject_ReplayTablePos = 2
PlayerObject_ReplayFrameCnt = 1
currentPlayer = 0
while currentPlayer < playerCount
GetTableValue(object[currentPlayer].xpos, 0, PlayerObject_ReplayTable)
GetTableValue(object[currentPlayer].ypos, 1, PlayerObject_ReplayTable)
object[currentPlayer].controlMode = -1
object[currentPlayer].up = 0
object[currentPlayer].down = 0
object[currentPlayer].left = 0
object[currentPlayer].right = 0
object[currentPlayer].jumpPress = 0
object[currentPlayer].jumpHold = 0
object[currentPlayer].value1 = 0
currentPlayer++
loop
[Link] = object[0].ixpos
[Link] = object[0].iypos
end function

function PlayerObject_RestorePowerup
switch object[currentPlayer].value37
case 0
ResetObjectEntity(arrayPos0, TypeName[Blank Object], 0, 0, 0)
break
case 1
ResetObjectEntity(arrayPos0, blueShieldType, 0, 0, 0)
object[arrayPos0].priority = PRIORITY_ACTIVE
object[arrayPos0].inkEffect = INK_ALPHA
object[arrayPos0].alpha = 160
break
case 2
ResetObjectEntity(arrayPos0, TypeName[Bubble Shield], 0, 0, 0)
object[arrayPos0].priority = PRIORITY_ACTIVE
break
case 3
ResetObjectEntity(arrayPos0, TypeName[Fire Shield], 0, 0, 0)
object[arrayPos0].priority = PRIORITY_ACTIVE
break
case 4
ResetObjectEntity(arrayPos0, TypeName[LightningShield], 0, 0, 0)
object[arrayPos0].priority = PRIORITY_ACTIVE
break
case 5
ResetObjectEntity(arrayPos0, goggleType, 0, 0, 0)
object[arrayPos0].priority = PRIORITY_ACTIVE
object[arrayPos0].value0 = currentPlayer
object[arrayPos0].drawOrder = -1
end switch
end function

function PlayerObject_HandleSuperPalSonic
if PlayerObject_SuperState == 1
PlayerObject_value3++
if PlayerObject_value3 >= 4
PlayerObject_value3 = 0
PlayerObject_value2 += 4
if PlayerObject_value2 >= 64
PlayerObject_value2 = 24
end if
end if
else
PlayerObject_value3++
if PlayerObject_value3 >= 8
PlayerObject_value3 = 0
PlayerObject_value2 -= 4
if PlayerObject_value2 <= 0
PlayerObject_value2 = 0
PlayerObject_SuperState = 0
end if
if PlayerObject_value2 >= 24
PlayerObject_value2 = 24
end if
end if
end if
temp1 = PlayerObject_value2
GetTableValue(temp0, temp1, PlayerObject_SonicSuperPal)
SetPaletteEntry(0, 2, temp0)
GetTableValue(temp0, temp1, PlayerObject_SonicSuperAltPal)
SetPaletteEntry(1, 2, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_SonicSuperPal)
SetPaletteEntry(0, 3, temp0)
GetTableValue(temp0, temp1, PlayerObject_SonicSuperAltPal)
SetPaletteEntry(1, 3, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_SonicSuperPal)
SetPaletteEntry(0, 4, temp0)
GetTableValue(temp0, temp1, PlayerObject_SonicSuperAltPal)
SetPaletteEntry(1, 4, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_SonicSuperPal)
SetPaletteEntry(0, 5, temp0)
GetTableValue(temp0, temp1, PlayerObject_SonicSuperAltPal)
SetPaletteEntry(1, 5, temp0)
end function

function PlayerObject_HandleSuperPalTails
if PlayerObject_SuperState == 1
PlayerObject_value3++
if PlayerObject_value3 >= 12
PlayerObject_value3 = 0
PlayerObject_value2 += 4
if PlayerObject_value2 >= 24
PlayerObject_value2 = 0
end if
end if
else
if PlayerObject_value2 > 12
FlipSign(PlayerObject_value2)
PlayerObject_value2 += 24
end if
PlayerObject_value3++
if PlayerObject_value3 >= 12
PlayerObject_value3 = 0
PlayerObject_value2 -= 4
if PlayerObject_value2 <= 0
PlayerObject_value2 = 0
PlayerObject_SuperState = 0
end if
end if
end if
temp1 = PlayerObject_value2
GetTableValue(temp0, temp1, PlayerObject_TailsSuperPal)
SetPaletteEntry(0, 13, temp0)
GetTableValue(temp0, temp1, PlayerObject_TailsSuperAltPal)
SetPaletteEntry(1, 13, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_TailsSuperPal)
SetPaletteEntry(0, 17, temp0)
GetTableValue(temp0, temp1, PlayerObject_TailsSuperAltPal)
SetPaletteEntry(1, 17, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_TailsSuperPal)
SetPaletteEntry(0, 18, temp0)
GetTableValue(temp0, temp1, PlayerObject_TailsSuperAltPal)
SetPaletteEntry(1, 18, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_TailsSuperPal)
SetPaletteEntry(0, 16, temp0)
GetTableValue(temp0, temp1, PlayerObject_TailsSuperAltPal)
SetPaletteEntry(1, 16, temp0)
end function

function PlayerObject_HandleSuperPalKnux
if PlayerObject_SuperState == 1
PlayerObject_value3++
if PlayerObject_value3 >= 12
PlayerObject_value3 = 9
PlayerObject_value2 += 3
if PlayerObject_value2 >= 30
PlayerObject_value3 = 0
PlayerObject_value2 = 0
end if
end if
else
if PlayerObject_value2 > 15
FlipSign(PlayerObject_value2)
PlayerObject_value2 += 30
end if
PlayerObject_value3++
if PlayerObject_value3 >= 12
PlayerObject_value3 = 0
PlayerObject_value2 -= 3
if PlayerObject_value2 <= 0
PlayerObject_value2 = 0
PlayerObject_SuperState = 0
end if
end if
end if
temp1 = PlayerObject_value2
GetTableValue(temp0, temp1, PlayerObject_KnuxSuperPal)
SetPaletteEntry(0, 26, temp0)
GetTableValue(temp0, temp1, PlayerObject_KnuxSuperAltPal)
SetPaletteEntry(1, 26, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_KnuxSuperPal)
SetPaletteEntry(0, 27, temp0)
GetTableValue(temp0, temp1, PlayerObject_KnuxSuperAltPal)
SetPaletteEntry(1, 27, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_KnuxSuperPal)
SetPaletteEntry(0, 28, temp0)
GetTableValue(temp0, temp1, PlayerObject_KnuxSuperAltPal)
SetPaletteEntry(1, 28, temp0)
end function

function PlayerObject_HandleSuperPalAmy
if PlayerObject_SuperState == 1
PlayerObject_value3++
if PlayerObject_value3 >= 12
PlayerObject_value3 = 9
PlayerObject_value2 += 4
if PlayerObject_value2 >= 32
PlayerObject_value3 = 0
PlayerObject_value2 = 0
end if
end if
else
if PlayerObject_value2 > 20
FlipSign(PlayerObject_value2)
PlayerObject_value2 += 32
end if
PlayerObject_value3++
if PlayerObject_value3 >= 16
PlayerObject_value3 = 0
PlayerObject_value2 -= 4
if PlayerObject_value2 <= 0
PlayerObject_value2 = 0
PlayerObject_SuperState = 0
end if
end if
end if
temp1 = PlayerObject_value2
GetTableValue(temp0, temp1, PlayerObject_AmySuperPal)
SetPaletteEntry(0, 48, temp0)
GetTableValue(temp0, temp1, PlayerObject_AmySuperAltPal)
SetPaletteEntry(1, 48, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_AmySuperPal)
SetPaletteEntry(0, 49, temp0)
GetTableValue(temp0, temp1, PlayerObject_AmySuperAltPal)
SetPaletteEntry(1, 49, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_AmySuperPal)
SetPaletteEntry(0, 50, temp0)
GetTableValue(temp0, temp1, PlayerObject_AmySuperAltPal)
SetPaletteEntry(1, 50, temp0)
temp1++
GetTableValue(temp0, temp1, PlayerObject_AmySuperPal)
SetPaletteEntry(0, 51, temp0)
GetTableValue(temp0, temp1, PlayerObject_AmySuperAltPal)
SetPaletteEntry(1, 51, temp0)
end function

function PlayerObject_SwapPhysics
switch [Link]
case 0
case 3
temp0 = PlayerObject_SonicPhysicsTable
break
case 1
temp0 = PlayerObject_TailsPhysicsTable
break
case 2
temp0 = PlayerObject_KnuxPhysicsTable
break
case 5
temp0 = PlayerObject_AmyPhysicsTable
break
end switch
temp1 = 0
temp2 = 0
if [Link] != 3
temp3 = object[currentPlayer].ypos
temp3 >>= 16
CheckGreater(temp3, [Link])
temp4 = checkResult
CheckNotEqual(object[currentPlayer].type, TypeName[Debug Mode])
temp4 &= checkResult
if temp4 == 1
SetBit(temp1, 0, 1)
object[currentPlayer].value25 = 0x1000
else
object[currentPlayer].value25 = 0x3800
end if
if PlayerObject_SuperState == 1
SetBit(temp1, 1, 1)
temp2 = 2
end if
if object[currentPlayer].value6 > 0
SetBit(temp1, 2, 1)
temp2 = 1
end if
temp1 <<= 3
end if
GetTableValue(object[currentPlayer].value20, temp1, temp0)
temp1++
GetTableValue(object[currentPlayer].value21, temp1, temp0)
object[currentPlayer].value22 = object[currentPlayer].value21
object[currentPlayer].value22 >>= temp2
temp1++
GetTableValue(object[currentPlayer].value23, temp1, temp0)
temp1++
//GetTableValue(object[currentPlayer].value24, temp1, temp0)
temp1++
GetTableValue(object[currentPlayer].value9, temp1, temp0)
temp1++
GetTableValue(object[currentPlayer].value29, temp1, temp0)
temp1++
GetTableValue(object[currentPlayer].value27, temp1, temp0)
temp1++
GetTableValue(object[currentPlayer].value28, temp1, temp0)
end function

function PlayerObject_ProcessSuperForms
if PlayerObject_SuperState != 0
switch [Link]
case 0
case 3
CallFunction(PlayerObject_HandleSuperPalSonic)
break
case 1
CallFunction(PlayerObject_HandleSuperPalTails)
break
case 2
CallFunction(PlayerObject_HandleSuperPalKnux)
break
case 5
CallFunction(PlayerObject_HandleSuperPalAmy)
break
end switch
end if
if PlayerObject_SuperState == 1
[Link] = 60
PlayerObject_value1++
if PlayerObject_value1 == 60
PlayerObject_value1 = 0
[Link]--
if [Link] == 0
PlayerObject_SuperState = 2
end if
end if
end if
if PlayerObject_SuperState == 2
CallFunction(PlayerObject_EndSuper)
end if
end function

function PlayerObject_EndSuper
if [Link] == 0
LoadAnimation("[Link]")
end if
if [Link] == 7
PlayMusic(0)
end if
if [Link] == 6
if [Link] == 2
PlayMusic(0)
end if
end if
if [Link] == 7
if [Link] < 1
CallFunction(SlowDownMusic)
end if
end if
[Link] = 0
if [Link] != PlayerObject_Death
if [Link] != PlayerObject_Drown
currentPlayer = [Link]
arrayPos0 = currentPlayer
arrayPos0 += playerCount
CallFunction(PlayerObject_RestorePowerup)
[Link] = 60
end if
end if
PlayerObject_SuperState = 3
CallFunction(PlayerObject_SwapPhysics)
if SuperTimeAttack == 1
if [Link] == 1
ResetObjectEntity(11, TypeName[Title Card], 0, 0, 0)
object[11].state = 10
object[11].priority = PRIORITY_ACTIVE
object[11].drawOrder = 6
[Link] = 80
[Link] = 0
end if
end if
end function

function PlayerObject_CheckHit
CheckEqual(object[currentPlayer].animation, ANI_JUMPING)
temp0 = checkResult
CheckEqual(object[currentPlayer].animation, ANI_SPINDASH)
temp0 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_GLIDING)
temp0 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_GLIDING_STOP)
temp0 |= checkResult
CheckNotEqual(object[currentPlayer].value7, 0)
temp0 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLYING)
temp1 = checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLYINGTIRED)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLY_LIFT_UP)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLY_LIFT_DOWN)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLY_LIFT_TIRED)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_HAMMER_JUMP)
temp0 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_HAMMER_SPEEN)
temp0 |= checkResult
if temp1 == 1
CheckGreater(object[currentPlayer].ypos, [Link])
temp0 |= checkResult
end if

if temp0 == 1
FlipSign(object[currentPlayer].xvel)
object[currentPlayer].xvel >>= 1
object[currentPlayer].speed = object[currentPlayer].xvel
FlipSign(object[currentPlayer].yvel)
object[currentPlayer].yvel >>= 1
if object[currentPlayer].animation == ANI_GLIDING
object[currentPlayer].value1 = 0
object[currentPlayer].animation = ANI_GLIDING_DROP
object[currentPlayer].state = PlayerObject_KnuxGlideDrop
end if
checkResult = 1
else
if object[currentPlayer].state != PlayerObject_Death
if object[currentPlayer].value7 == 0
if object[currentPlayer].value8 == 0
object[currentPlayer].state = PlayerObject_Hurt
if object[currentPlayer].xpos > [Link]
object[currentPlayer].speed = 0x20000
else
object[currentPlayer].speed = -0x20000
end if
end if
end if
end if
checkResult = 0
end if
end function

function PlayerObject_BadnikBreak
CheckEqual(object[currentPlayer].animation, ANI_JUMPING)
temp0 = checkResult
CheckEqual(object[currentPlayer].animation, ANI_SPINDASH)
temp0 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_GLIDING)
temp0 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_GLIDING_STOP)
temp0 |= checkResult
CheckNotEqual(object[currentPlayer].value7, 0)
temp0 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLYING)
temp1 = checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLYINGTIRED)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLY_LIFT_UP)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLY_LIFT_DOWN)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLY_LIFT_TIRED)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_HAMMER_JUMP)
temp0 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_HAMMER_SPEEN)
temp0 |= checkResult
if temp1 == 1
CheckGreater(object[currentPlayer].ypos, [Link])
temp0 |= checkResult
end if

if temp0 == 1
ResetObjectEntity([Link], TypeName[Blank Object], 0,
[Link], [Link])
Rand(checkResult, 32)
if checkResult > 15
CreateTempObject(animalType1, TypeName[Blank Object],
[Link], [Link])
else
CreateTempObject(animalType2, TypeName[Blank Object],
[Link], [Link])
end if
object[tempObjectPos].priority = PRIORITY_UNKNOWN
CreateTempObject(TypeName[Smoke Puff], 0, [Link], [Link])
object[tempObjectPos].drawOrder = 4
CreateTempObject(TypeName[Object Score], object[currentPlayer].value19,
[Link], [Link])
object[tempObjectPos].drawOrder = 4
PlaySfx(SfxName[Destroy], 0)
if object[currentPlayer].yvel > 0
if object[currentPlayer].ypos >= [Link]
object[currentPlayer].yvel -= 0x10000
else
object[currentPlayer].yvel += object[currentPlayer].value25
object[currentPlayer].yvel += object[currentPlayer].value25
FlipSign(object[currentPlayer].yvel)
end if
else
object[currentPlayer].yvel += 0x10000
end if
if [Link] == 0
temp0 = currentPlayer
currentPlayer = 0
end if
if [Link] == 0
saveRAM[999]++
end if
switch object[currentPlayer].value19
case 0
[Link] += 100
break
case 1
[Link] += 200
break
case 2
[Link] += 500
break
case 3
case 4
case 5
case 6
case 7
case 8
case 9
case 10
case 11
case 12
case 13
case 14
[Link] += 1000
break
case 15
[Link] += 0x2710
break
end switch
if object[currentPlayer].value19 < 15
object[currentPlayer].value19++
end if
if [Link] == 0
currentPlayer = temp0
end if
else
if object[currentPlayer].state != PlayerObject_Death
if object[currentPlayer].value7 == 0
if object[currentPlayer].value8 == 0
object[currentPlayer].state = PlayerObject_Hurt
if object[currentPlayer].xpos > [Link]
object[currentPlayer].speed = 0x20000
else
object[currentPlayer].speed = -0x20000
end if
end if
end if
end if
end if
end function

function PlayerObject_Hit
if object[currentPlayer].state != PlayerObject_Death
arrayPos0 = object[currentPlayer].entityPos
arrayPos0 += playerCount
if object[currentPlayer].value7 == 0
if object[currentPlayer].value8 == 0
object[currentPlayer].state = PlayerObject_Hurt
if object[currentPlayer].xpos > [Link]
object[currentPlayer].speed = 0x20000
else
object[currentPlayer].speed = -0x20000
end if
end if
end if
end if
end function

function PlayerObject_FireHit
if object[currentPlayer].value37 != 3
if object[currentPlayer].state != PlayerObject_Death
arrayPos0 = object[currentPlayer].entityPos
arrayPos0 += playerCount
if object[currentPlayer].value7 == 0
if object[currentPlayer].value8 == 0
object[currentPlayer].state = PlayerObject_Hurt
if object[currentPlayer].xpos > [Link]
object[currentPlayer].speed = 0x20000
else
object[currentPlayer].speed = -0x20000
end if
end if
end if
end if
end if
end function

function PlayerObject_LightningHit
if object[currentPlayer].value37 != 4
if object[currentPlayer].state != PlayerObject_Death
arrayPos0 = object[currentPlayer].entityPos
arrayPos0 += playerCount
if object[currentPlayer].value7 == 0
if object[currentPlayer].value8 == 0
object[currentPlayer].state = PlayerObject_Hurt
if object[currentPlayer].xpos > [Link]
object[currentPlayer].speed = 0x20000
else
object[currentPlayer].speed = -0x20000
end if
end if
end if
end if
end if
end function

function PlayerObject_ProjectileHit
//if object[currentPlayer].value37 > 1

arrayPos0 = currentPlayer
arrayPos0 += playerCount
arrayPos0 += playerCount
CheckEqual(object[arrayPos0].type, TypeName[Insta Shield])
temp2 = checkResult
CheckEqual(object[arrayPos0].propertyValue, 0)
temp2 &= checkResult
CheckGreater(object[currentPlayer].value37, 1)
temp2 |= checkResult

CheckEqual(object[currentPlayer].animation, ANI_FLYING)
temp1 = checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLYINGTIRED)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLY_LIFT_UP)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLY_LIFT_DOWN)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_FLY_LIFT_TIRED)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_HAMMER_SPEEN)
temp1 |= checkResult
CheckEqual(object[currentPlayer].animation, ANI_HAMMER_JUMP)
temp1 |= checkResult
if temp1 == 1
CheckGreater(object[currentPlayer].ypos, [Link])
temp2 |= checkResult
end if

CheckEqual(object[currentPlayer].animation, ANI_GLIDING)
if checkResult ==1
if object[currentPlayer].state == PlayerObject_KnuxGlideRight
CheckLower(object[currentPlayer].xpos, [Link])
temp2 |= checkResult
else
if object[currentPlayer].state == PlayerObject_KnuxGlideLeft
CheckGreater(object[currentPlayer].xpos, [Link])
temp2 |= checkResult
end if
end if
end if

if temp2 == 1
temp0 = object[currentPlayer].xpos
temp0 -= [Link]
temp1 = object[currentPlayer].ypos
temp1 -= [Link]
ATan2(temp2, temp0, temp1)
Sin256(temp0, temp2)
Cos256(temp1, temp2)
[Link] = temp1
[Link] *= -0x800
[Link] = temp0
[Link] *= -0x800
else
if object[currentPlayer].state != PlayerObject_Death
arrayPos0 = object[currentPlayer].entityPos
arrayPos0 += playerCount
if object[currentPlayer].value7 == 0
if object[currentPlayer].value8 == 0
object[currentPlayer].state = PlayerObject_Hurt
if object[currentPlayer].xpos > [Link]
object[currentPlayer].speed = 0x20000
else
object[currentPlayer].speed = -0x20000
end if
end if
end if
end if
end if
end function

function PlayerObject_SpikeHit
if object[currentPlayer].state != PlayerObject_Death
arrayPos0 = object[currentPlayer].entityPos
arrayPos0 += playerCount
if object[currentPlayer].value7 == 0
if object[currentPlayer].state != PlayerObject_Hurt
if object[currentPlayer].state != PlayerObject_Knockback
temp0 = [Link]
if [Link] == 1
temp0 = 0
end if
CheckEqual(object[currentPlayer].value8, 0)
temp0 |= checkResult
if temp0 == 1
if object[currentPlayer].value8 == 0
object[currentPlayer].value8 = 2
end if
object[currentPlayer].state = PlayerObject_Hurt
if object[currentPlayer].xpos > [Link]
object[currentPlayer].speed = 0x20000
else
object[currentPlayer].speed = -0x20000
end if
end if
end if
end if
end if
end if
end function

function PlayerObject_Kill
PlaySfx(SfxName[Hurt], 0)
object[currentPlayer].speed = 0
object[currentPlayer].xvel = 0
object[currentPlayer].yvel = -0x68000
object[currentPlayer].state = PlayerObject_Death
object[currentPlayer].animation = ANI_DYING
object[currentPlayer].tileCollisions = 0
object[currentPlayer].interaction = 0
object[currentPlayer].value8 = 0
object[currentPlayer].visible = 1
object[currentPlayer].value18 = 6
if currentPlayer == 0
object[currentPlayer].priority = PRIORITY_ACTIVE_PAUSED
if object[1].type == TypeName[Player 2 Object]
object[1].priority = PRIORITY_ACTIVE_PAUSED
end if
[Link] = 0
[Link] = 0
[Link] = 3
end if
arrayPos0 = currentPlayer
arrayPos0 += playerCount
if object[arrayPos0].type == invincibilityType
object[arrayPos0].propertyValue = 3
end if
object[arrayPos0].type = TypeName[Blank Object]
object[currentPlayer].value37 = 0
end function

function PlayerObject_ProcessPlayer
if [Link] == 1
if [Link] == 0
if [Link] == 0
CheckTouchRect(0, 96, [Link], [Link])
if checkResult > -1
arrayPos0 = checkResult
temp0 = touchscreen[arrayPos0].xpos
temp0 -= 56
temp1 = touchscreen[arrayPos0].ypos
temp1 -= 184
ATan2(temp2, temp0, temp1)
temp2 += 16
temp2 &= 255
temp2 >>= 5
switch temp2
case 0
[Link] = true
break
case 1
[Link] = true
[Link] = true
break
case 2
[Link] = true
break
case 3
[Link] = true
[Link] = true
break
case 4
[Link] = true
break
case 5
[Link] = true
[Link] = true
break
case 6
[Link] = true
break
case 7
[Link] = true
[Link] = true
break
end switch
end if
CheckTouchRect([Link], 96, [Link], 240)
if checkResult > -1
[Link] = 1
end if
if touchJump == 0
[Link] |= [Link]
end if
touchJump = [Link]
if [Link] == 1
CheckTouchRect(0, 0, 122, 56)
if checkResult > -1
[Link] = 1
end if
if touchDebug == 0
[Link] |= [Link]
end if
touchDebug = [Link]
end if
temp0=[Link]
temp0-=90
CheckTouchRect(temp0, 0, [Link], 40)
if checkResult > -1
[Link] = 1
end if
temp0 -= 37
temp1 = [Link]
temp1 -= 95
CheckTouchRect(temp0, 0, temp1, 40)
if checkResult > -1
[Link] = 1
end if
if touchMisc == 0
[Link] |= [Link]
end if
touchMisc = [Link]
end if
if object[30].type == TypeName[Act Finish])
CheckTouchRect(0, 0, [Link], [Link])
if checkResult > -1
[Link] = 1
end if
end if
else
CheckTouchRect(0, 0, [Link], [Link])
if checkResult > -1
[Link] = 1
end if
end if
end if

if [Link] == 0
ProcessObjectControl()
else
//if [Link] == 0
temp4 = 0
if [Link] == 1
if PlayerObject_ReplayLength > 1
PlayerObject_ReplayLength = 1
temp4 = 1
end if
end if
//end if
if [Link] == 0
PlayerObject_ReplayFrameCnt--
if PlayerObject_ReplayFrameCnt < 1
if PlayerObject_ReplayTablePos < PlayerObject_ReplaySize
GetTableValue(temp0, PlayerObject_ReplayTablePos,
PlayerObject_ReplayTable)
GetBit([Link], temp0, 0)
GetBit([Link], temp0, 1)
GetBit([Link], temp0, 2)
GetBit([Link], temp0, 3)
GetBit([Link], temp0, 4)
GetBit([Link], temp0, 5)
PlayerObject_ReplayTablePos++
GetTableValue(PlayerObject_ReplayFrameCnt,
PlayerObject_ReplayTablePos, PlayerObject_ReplayTable)
PlayerObject_ReplayTablePos++
end if
else
if [Link] == 1
[Link] = 0
end if
end if
if PlayerObject_ReplayLength > 0
PlayerObject_ReplayLength--
if PlayerObject_ReplayLength < 1
ResetObjectEntity(11, TypeName[Title Card], 0, 0, 0)
object[11].state = 8
if [Link] > 0
object[11].state += temp4
end if
object[11].priority = PRIORITY_ACTIVE
object[11].drawOrder = 6
[Link] = 80
[Link] = 0
end if
end if
end if
end if
if [Link] > 0
[Link]--
if [Link] < 1
currentPlayer = [Link]
CallFunction(PlayerObject_SwapPhysics)
if SlowDownMusic != 0
if PlayerObject_SuperState != 1
CallFunction(SlowDownMusic)
else
if [Link] != 7
CallFunction(SlowDownMusic)
end if
end if
end if
[Link] = 0
end if
end if
if [Link] != PlayerObject_Knockback
if [Link] > 0
[Link]--
GetBit(temp0, [Link], 2)
if temp0 == 1
[Link] = 0
else
[Link] = 1
end if
end if
end if
if [Link] > 0
[Link]--
if [Link] == 0
if [Link] == 2
PlayMusic(0)
end if
if object[+playerCount].type == invincibilityType
currentPlayer = [Link]
arrayPos0 = currentPlayer
arrayPos0 += playerCount
CallFunction(PlayerObject_RestorePowerup)
[Link] = 60
end if
end if
end if
if [Link] != PlayerObject_LookingUp
if [Link] != PlayerObject_Crouching
if [Link] > 0
[Link] -= 2
end if
if [Link] < 0
[Link] += 2
end if
end if
end if
if [Link] > 0
[Link]--
if [Link] == 0
[Link] = 0
end if
end if
if [Link] != PlayerObject_HandleTailsFlight
if [Link] != 0
if [Link] != PlayerObject_HandleHammerSpin
StopSfx(SfxName[Flying])
StopSfx(SfxName[Tired])
[Link] = 0
end if
end if
end if
end function

function PlayerObject_Blank
checkResult = 0
end function

function PlayerObject_HandleRollAnimSpd
if [Link] == 1
[Link] = 120
else
[Link] = [Link]
if [Link] < 0
FlipSign([Link])
end if
[Link] *= 240
[Link] /= 0x60000
[Link] += 48
end if
end function

function PlayerObject_HandleWalkAnimSpd
[Link] = [Link]
if [Link] < 0
FlipSign([Link])
end if
[Link] *= 60
[Link] /= 0x60000
[Link] += 20
end function

function PlayerObject_HandleRunAnimSpd
[Link] = [Link]
if [Link] < 0
FlipSign([Link])
end if
[Link] *= 80
[Link] /= 0x60000
end function

function PlayerObject_HandleMovement
if [Link] > 0
[Link]--
Sin256(temp0, [Link])
temp0 *= 0x2000
temp0 >>= 8
[Link] += temp0
else
if [Link] == 1
temp0 = [Link]
FlipSign(temp0)
if [Link] > temp0
if [Link] > 0
if [Link] == CMODE_FLOOR
if [Link] > 0x40000
[Link] = 16
end if
end if
if [Link] < [Link]
[Link] = [Link]
FlipSign([Link])
[Link] = 0
else
[Link] -= [Link]
end if
else
[Link] -= [Link]
[Link] = 0
end if
end if
if [Link] <= 0
[Link] = FLIP_X
end if
end if
if [Link] == 1
if [Link] < [Link]
if [Link] < 0
if [Link] == CMODE_FLOOR
if [Link] < -0x40000
[Link] = 16
end if
end if
temp0 = [Link]
FlipSign(temp0)
if [Link] > temp0
[Link] = [Link]
[Link] = 0
else
[Link] += [Link]
end if
else
[Link] += [Link]
[Link] = 0
end if
end if
if [Link] >= 0
[Link] = FLIP_NONE
end if
end if
temp0 = [Link]
temp0 |= [Link]
if temp0 == 0
if [Link] > 0
[Link] -= [Link]
if [Link] < 0
[Link] = 0
end if
else
[Link] += [Link]
if [Link] > 0
[Link] = 0
end if
end if
if [Link] > 0x2000
Sin256(temp0, [Link])
temp0 *= 0x2000
temp0 >>= 8
[Link] += temp0
end if
if [Link] < -0x2000
Sin256(temp0, [Link])
temp0 *= 0x2000
temp0 >>= 8
[Link] += temp0
end if
if [Link] > 192
if [Link] < 228
if [Link] > -0x10000
if [Link] < 0x10000
[Link] = 30
end if
end if
end if
end if
if [Link] > 28
if [Link] < 64
if [Link] > -0x10000
if [Link] < 0x10000
[Link] = 30
end if
end if
end if
end if
else
Sin256(temp0, [Link])
temp0 *= 0x2000
temp0 >>= 8
[Link] += temp0
if [Link] == 1
if [Link] == 0
if [Link] > 192
if [Link] < 228
if [Link] < 0x28000
if [Link] > -0x20000
[Link] = 30
end if
end if
end if
end if
end if
else
if [Link] == 1
if [Link] > 28
if [Link] < 64
if [Link] > -0x28000
if [Link] < 0x20000
[Link] = 30
end if
end if
end if
end if
end if
end if
end if
if [Link] == 1
if [Link] == 0
if [Link] == 1
temp0 = [Link]
FlipSign(temp0)
if [Link] < temp0
[Link] = temp0
end if
end if
if [Link] == 1
if [Link] > [Link]
[Link] = [Link]
end if
end if
end if
end if
end if
switch [Link]
case 1
if [Link] <= 192
if [Link] > -0x20000
if [Link] < 0x20000
[Link] = GRAVITY_AIR
[Link] = 0
[Link] = CMODE_FLOOR
[Link] = [Link]
end if
end if
end if
break
case 2
if [Link] > -0x20000
if [Link] < 0x20000
[Link] = GRAVITY_AIR
[Link] = 0
[Link] = CMODE_FLOOR
[Link] = [Link]
end if
end if
break
case 3
if [Link] >= 64
if [Link] > -0x20000
if [Link] < 0x20000
[Link] = GRAVITY_AIR
[Link] = 0
[Link] = CMODE_FLOOR
[Link] = [Link]
end if
end if
end if
break
end switch
end function

function PlayerObject_HandleAirAcceleration
if [Link] > -0x40000
if [Link] < 0
temp0 = [Link]
temp0 >>= 5
[Link] -= temp0
end if
end if
temp0 = [Link]
FlipSign(temp0)
if [Link] > temp0
if [Link] == 1
[Link] -= [Link]
[Link] = FLIP_X
end if
else
if [Link] == 1
[Link] = FLIP_X
end if
end if
if [Link] < [Link]
if [Link] == 1
[Link] += [Link]
[Link] = FLIP_NONE
end if
else
if [Link] == 1
[Link] = FLIP_NONE
end if
end if
if [Link] == 1
if [Link] == 0
if [Link] == 1
temp0 = [Link]
FlipSign(temp0)
if [Link] < temp0
[Link] = temp0
end if
end if
if [Link] == 1
if [Link] > [Link]
[Link] = [Link]
end if
end if
end if
end if
end function

function PlayerObject_HandleRolling
if [Link] == 1
if [Link] < 0
[Link] += [Link]
end if
end if
if [Link] == 1
if [Link] > 0
[Link] -= [Link]
end if
end if
temp1 = [Link]
if [Link] > 0
[Link] -= [Link]
Sin256(temp0, [Link])
if temp0 > 0
Sin256(temp0, [Link])
temp0 *= 0x5000
else
Sin256(temp0, [Link])
temp0 *= 0x1400
end if
temp0 >>= 8
[Link] += temp0
if [Link] > 0x120000
[Link] = 0x120000
end if
else
[Link] += [Link]
Sin256(temp0, [Link])
if temp0 < 0
Sin256(temp0, [Link])
temp0 *= 0x5000
else
Sin256(temp0, [Link])
temp0 *= 0x1400
end if
temp0 >>= 8
[Link] += temp0
if [Link] < -0x120000
[Link] = -0x120000
end if
end if
switch [Link]
case 0
case 2
if temp1 > 0
if [Link] < 0
[Link] = 0
[Link] = PlayerObject_HandleGround
end if
else
if [Link] > 0
[Link] = 0
[Link] = PlayerObject_HandleGround
end if
end if
break
case 1
if [Link] < 193
if temp1 > 0
if [Link] < 0x20000
[Link] = GRAVITY_AIR
[Link] = 0
[Link] = 0
end if
end if
end if
break
case 3
if [Link] > 63
if temp1 < 0
if [Link] > -0x20000
[Link] = GRAVITY_AIR
[Link] = 0
[Link] = 0
end if
end if
end if
break
end switch
end function
function PlayerObject_HandleAirMovement
[Link] = 1
[Link] += [Link]
if [Link] < [Link]
if [Link] == 0
if object.value1 > 0
[Link] = [Link]
temp0 = [Link]
temp0 >>= 5
[Link] -= temp0
end if
end if
end if
[Link] = [Link]

[Link] = CMODE_FLOOR
if [Link] == ANI_JUMPING
[Link] = [Link]
end if
end function

function PlayerObject_ResetOnFloor
[Link] = 0
Cos256(temp0, [Link])
temp0 *= [Link]
temp0 >>= 8
[Link] = temp0
Sin256(temp0, [Link])
temp0 *= [Link]
temp0 >>= 8
[Link] = temp0
end function

function PlayerObject_StartJump
temp1 = 0
if [Link] == CMODE_FLOOR
temp6 = [Link]
temp7 = [Link]
temp0 = [Link]
temp0 -= 2
ObjectTileCollision(CSIDE_ROOF, 0, temp0, [Link])
temp1 = checkResult
[Link] = temp6
[Link] = temp7
temp0 = [Link]
if [Link] != ANI_JUMPING
if [Link] != 5
[Link] -= [Link]
temp0 += [Link]
end if
end if
ObjectTileCollision(CSIDE_FLOOR, 0, temp0, [Link])
end if
if temp1 == 0
temp2 = 0
if [Link] == 5
if [Link] == 1
if [Link] == 0
temp2 = 1
end if
end if
end if
[Link] = 0
[Link] = GRAVITY_AIR
temp1 = [Link]
temp1 += [Link]
Sin256([Link], [Link])
[Link] *= temp1
Cos256(temp0, [Link])
temp0 *= [Link]
[Link] += temp0
[Link] >>= 8
Sin256([Link], [Link])
[Link] *= [Link]
Cos256(temp0, [Link])
temp0 *= temp1
[Link] -= temp0
[Link] >>= 8
[Link] = [Link]
[Link] = 1
if temp2 == 1
if [Link] == 0
[Link] = CMODE_FLOOR
temp0 = [Link]
temp0 >>= 6
switch temp0
case 1
case 2
[Link] -= [Link]
[Link] = ANI_HAMMER_JUMP
break
default
[Link] += [Link]
[Link] = ANI_FALL
break
end switch
[Link] = ANI_HAMMER_JUMP
PlaySfx(SfxName[Thud], 0)
object.value1 = 0
[Link] = PlayerObject_HandleAir
end if
else
[Link] = 0
[Link] = CMODE_FLOOR
object.value1 = 1
[Link] = ANI_JUMPING
if [Link] == 5
if [Link] == 1
[Link] = 11
object.value10 = ANI_FALL
end if
end if

CallFunction(PlayerObject_HandleRollAnimSpd)
if [Link] == PlayerObject_HandleRoll
if [Link] == 1
[Link] = PlayerObject_RollingJump
else
if [Link] == 1
[Link] = PlayerObject_RollingJump
else
[Link] = PlayerObject_HandleAir
end if
end if
else
[Link] = PlayerObject_HandleAir
end if
PlaySfx(SfxName[Jump], 0)
[Link] = 1
end if

[Link] = 1
end if
end function

function PlayerObject_StartSpindash
[Link] = PlayerObject_HandleSpindash
[Link] = ANI_SPINDASH
object.value2 = 0
PlaySfx(SfxName[Charge], 0)
CreateTempObject(TypeName[Dust Puff], [Link], [Link],
[Link])
object[tempObjectPos].iypos = [Link]
object[tempObjectPos].ypos += [Link]
object[tempObjectPos].frame = 4
object[tempObjectPos].drawOrder = 4
object[tempObjectPos].direction = [Link]
end function

function PlayerObject_StartSpindashCD
[Link] = PlayerObject_HandleSpindashCD
[Link] = ANI_JUMPING
object.value2 = 0
[Link] -= [Link]
PlaySfx(SfxName[Charge], 0)
CreateTempObject(TypeName[Dust Puff], [Link], [Link],
[Link])
object[tempObjectPos].iypos = [Link]
object[tempObjectPos].ypos += [Link]
object[tempObjectPos].frame = 4
object[tempObjectPos].drawOrder = 4
object[tempObjectPos].direction = [Link]
end function

function PlayerObject_Transforming
[Link] = 1
object.value1--
if object.value1 == 0
[Link] = PlayerObject_HandleAir
[Link] = ANI_WALKING
end if
end function

function PlayerObject_SuperTransform
if [Link] == 1
if [Link] == 0
arrayPos0 = currentPlayer
arrayPos0 += playerCount
ResetObjectEntity(arrayPos0, TypeName[Super Spark], 0,
object[0].xpos, object[0].ypos)
object[arrayPos0].priority = PRIORITY_ACTIVE
PlaySfx(SfxName[Transform], 0)

if [Link] != 4
switch [Link]
case 0
if [Link] != 0
PlayMusic(0)
end if
break
case 6
if [Link] != 2
PlayMusic(2)
end if
break
case 7
if [Link] != 0
PlayMusic(0)
end if
if object[currentPlayer].value6 < 1
CallFunction(SpeedUpMusic)
end if
break
default
PlayMusic(7)
break
end switch
end if
PlayerObject_SuperState = 1
object[currentPlayer].value7 = 60
object[currentPlayer].value8 = 0
object[currentPlayer].visible = 1
CallFunction(PlayerObject_SwapPhysics)
if [Link] == 0
LoadAnimation("[Link]")
if saveRAM[411] == 1
if [Link] == 0
[Link] = 14
end if
end if
end if
if [Link] == 1
if [Link] > 0
temp0 = 0
arrayPos0 = 13
while temp0 < 4
Rand(temp1, 201)
temp1 -= 100
temp1 += [Link]
temp1 -= [Link]
//temp1 += [Link]
temp1 <<= 16

Rand(temp2, 201)
temp2 -= 100
temp2 += [Link]
temp2 -= [Link]
//temp2 += [Link]
temp2 <<= 16

ResetObjectEntity(arrayPos0, TypeName[Insta
Shield], 2, temp1, temp2)
object[arrayPos0].priority = PRIORITY_ACTIVE
object[arrayPos0].angle = 64
object[arrayPos0].angle *= temp0
object[arrayPos0].drawOrder = 5
arrayPos0++
temp0++
loop
end if
end if
object[currentPlayer].state = PlayerObject_Transforming
object[currentPlayer].value34 = 1
object[currentPlayer].animation = ANI_SUPER_TRANSFORM
object[currentPlayer].value1 = 24
end if
end if
end function

function PlayerObject_BubbleBounce
CallFunction(PlayerObject_HandleAirAcceleration)
CheckNotEqual([Link], 2)
temp0 = checkResult
CheckNotEqual([Link], 0)
temp0 |= checkResult
CheckEqual(PlayerObject_SuperState, 1)
temp0 |= checkResult
if temp0 == 1
[Link] = PlayerObject_HandleAir
else
if [Link] == GRAVITY_AIR
CallFunction(PlayerObject_HandleAirMovement)
else
[Link] = 1
[Link] = GRAVITY_AIR
if [Link] == 0x38000
temp1 = 0x40000
else
temp1 = 0x78000
end if
temp1 += [Link]
Sin256([Link], [Link])
[Link] *= temp1
Cos256(temp0, [Link])
temp0 *= [Link]
[Link] += temp0
[Link] >>= 8
Sin256([Link], [Link])
[Link] *= [Link]
Cos256(temp0, [Link])
temp0 *= temp1
[Link] -= temp0
[Link] >>= 8
[Link] = [Link]
[Link] = 1
[Link] = ANI_JUMPING
[Link] = 0
[Link] = CMODE_FLOOR
object.value1 = 1
CallFunction(PlayerObject_HandleRollAnimSpd)
[Link] = PlayerObject_HandleAir
PlaySfx(SfxName[Bubble Bounce], 0)
object[+playerCount].state = 4
end if
end if
end function

function PlayerObject_HandleShieldAbilities
if [Link] == 0
if [Link] == 1
if [Link] == 0
CheckNotEqual([Link], 0)
temp0 = checkResult
CheckEqual(PlayerObject_SuperState, 1)
temp0 |= checkResult
CheckLower([Link], 2)
temp0 |= checkResult
CheckEqual([Link], 5)
temp0 |= checkResult
CheckGreater([Link],0)
temp0 |= checkResult
if temp0 == 1
CallFunction(PlayerObject_DropDash)
end if
end if
end if
end if
if [Link] == 1
if [Link] == 1
CheckEqual([Link], 127)
temp0 = checkResult
CheckGreater([Link], 49)
temp0 &= checkResult
CheckNotEqual(PlayerObject_SuperState, 1)
temp0 &= checkResult
CheckNotEqual(object[30].type, TypeName[Act Finish])
temp0 &= checkResult
CheckEqual([Link], 1)
temp0 &= checkResult
CheckEqual ([Link], 0)
temp0 &= checkResult

if temp0 == 1
currentPlayer = [Link]
CallFunction(PlayerObject_SuperTransform)
end if
end if
//CheckEqual(stage.player2Enabled, 1)
//temp4 = checkResult
//CheckEqual([Link], 1)
//temp4 &= checkResult
//if temp4 == 0
if [Link] == 1
if PlayerObject_SuperState == 1
if [Link] > 0
if [Link] != 2
[Link] = 2
ResetObjectEntity(13, TypeName[Insta
Shield], 1, 0, 0)
object[13].priority = PRIORITY_ACTIVE
PlaySfx(SfxName[Release],0)

temp5 = 0
SetBit(temp5, 0, [Link])
SetBit(temp5, 1, [Link])
SetBit(temp5, 2, [Link])
SetBit(temp5, 3, [Link])

CheckNotEqual(temp5, 0)
temp4 = checkResult
CheckLower(temp5, 12)
temp4 &= checkResult

if temp4 == 1
temp6 = temp5
temp6 &= 3
switch temp6
case 1
[Link] = -0x80000
break
case 2
[Link] = 0x80000
break
default
[Link] = 0
break
end switch

temp6 = temp5
temp6 &= 12
switch temp6
case 4
[Link] = -0x80000
break
case 8
[Link] = 0x80000
break
default
[Link] = 0
break
end switch

[Link] = [Link]
[Link] = 2
if [Link] == 0
[Link] = 15
end if
[Link] = 4
if [Link] ==
PlayerObject_RollingJump
[Link] =
PlayerObject_HandleAir
end if
else
GetBit(temp0, [Link], 0)
if temp0 == 0
[Link] = 0x80000
else
[Link] = -0x80000
end if
[Link] = [Link]
[Link] = 0
[Link] = 2
if [Link] == 0
[Link] = 15
end if
[Link] = 4
if [Link] ==
PlayerObject_RollingJump
[Link] =
PlayerObject_HandleAir
end if

end if
end if
end if
end if

CheckEqual([Link], 0)
temp0 = checkResult
CheckNotEqual(PlayerObject_SuperState, 1)
temp0 &= checkResult
if temp0 == 1
switch [Link]
case 0
case 5
if [Link] == 1
if [Link] == 0
PlaySfx(SfxName[Insta Shield], 0)
//if object[+playerCount].type ==
TypeName[Blank Object]
currentPlayer =
[Link]
arrayPos0 = currentPlayer
arrayPos0 += playerCount
arrayPos0 += playerCount
ResetObjectEntity(arrayPos0,
TypeName[Insta Shield], 0, 0, 0)
object[arrayPos0].priority =
PRIORITY_ACTIVE
object[arrayPos0].value16 =
[Link]
//end if
[Link] = 2
object[+playerCount].state = 1
if [Link] ==
PlayerObject_RollingJump
[Link] =
PlayerObject_HandleAir
end if
end if
end if
break
case 1
break
case 2
PlaySfx(SfxName[Bubble Bounce], 0)
[Link] = 0x80000
if [Link] == 0
[Link] = 0
else
[Link] >>= 1
end if
[Link] = [Link]
[Link] = 2
[Link] = PlayerObject_BubbleBounce
object[+playerCount].state = 2
break
case 3
PlaySfx(SfxName[Fire Dash], 0)
GetBit(temp0, [Link], 0)
if temp0 == 0
[Link] = 0x80000
else
[Link] = -0x80000
end if
[Link] = [Link]
[Link] = 0
[Link] = 2
[Link] = 15
[Link] = 4
if [Link] == PlayerObject_RollingJump
[Link] = PlayerObject_HandleAir
end if
object[+playerCount].state = 2
object[+playerCount].direction =
[Link]
break
case 4
PlaySfx(SfxName[Lightning Jump], 0)
[Link] = -0x58000
[Link] = 2
CreateTempObject(TypeName[Lightning Spark], 0,
[Link], [Link])
object[tempObjectPos].xvel = -0x20000
object[tempObjectPos].yvel = -0x20000
CreateTempObject(TypeName[Lightning Spark], 0,
[Link], [Link])
object[tempObjectPos].xvel = 0x20000
object[tempObjectPos].yvel = -0x20000
CreateTempObject(TypeName[Lightning Spark], 0,
[Link], [Link])
object[tempObjectPos].xvel = -0x20000
object[tempObjectPos].yvel = 0x20000
CreateTempObject(TypeName[Lightning Spark], 0,
[Link], [Link])
object[tempObjectPos].xvel = 0x20000
object[tempObjectPos].yvel = 0x20000
if [Link] == PlayerObject_RollingJump
[Link] = PlayerObject_HandleAir
end if
break
end switch
end if
end if
//end if
end if
end function

function PlayerObject_DropDash
if [Link] > 0
if [Link] > 0
if [Link]==1
[Link]++
if [Link] == 21
PlaySfx(SfxName[Drop Dash], 0)
object.value2 = 0
end if

else
object.value1 = 0
[Link] = 0
if [Link] < 21
object.value2 = 0
end if
end if
else
if [Link] == 1
[Link] = 2
end if
end if
end if
end function

function PlayerObject_StartHop
PlaySfx(SfxName[Flying], 0)
[Link] = 0
[Link] = GRAVITY_AIR

if [Link] == FLIP_X
[Link] -= 0x50000
else
[Link] += 0x50000
end if

[Link] = -0x30000

[Link] = [Link]
[Link] = 1
[Link] = ANI_HAMMER_SPEEN
[Link] = 0
[Link] = CMODE_FLOOR
object.value1 = 1
[Link] = PlayerObject_HandleAir

object.value34 = 1
object.value35 = 1
[Link] = 2
end function

function PlayerObject_StartSecondJump
temp1 = 0
if [Link] == CMODE_FLOOR
temp6 = [Link]
temp7 = [Link]
temp0 = [Link]
temp0 -= 2
ObjectTileCollision(CSIDE_ROOF, 0, temp0, [Link])
temp1 = checkResult
[Link] = temp6
[Link] = temp7
temp0 = [Link]
if [Link] != ANI_JUMPING
if [Link] != 5
[Link] -= [Link]
temp0 += [Link]
end if
end if
ObjectTileCollision(CSIDE_FLOOR, 0, temp0, [Link])
end if
if temp1 == 0
temp2 = 1
[Link] = 0
[Link] = GRAVITY_AIR
temp1 = [Link]
temp1 += [Link]
Sin256([Link], [Link])
[Link] *= temp1
Cos256(temp0, [Link])
temp0 *= [Link]
[Link] += temp0
[Link] >>= 8
Sin256([Link], [Link])
[Link] *= [Link]
Cos256(temp0, [Link])
temp0 *= temp1
[Link] -= temp0
[Link] >>= 8
[Link] = [Link]
[Link] = 1
[Link] = 0
[Link] = CMODE_FLOOR
object.value1 = 1
if temp2 == 1
[Link] = ANI_HAMMER_JUMP
PlaySfx(SfxName[Thud], 0)
object.value1 = 0
[Link] = PlayerObject_HandleAir
[Link] = 52
end if
[Link] = 1
[Link] = 2
end if
end function

function PlayerObject_StartHammerSpin
if [Link] == 1
if [Link] == 1
CheckEqual([Link], 127)
temp0 = checkResult
CheckGreater([Link], 49)
temp0 &= checkResult
CheckNotEqual(PlayerObject_SuperState, 1)
temp0 &= checkResult
CheckNotEqual(object[30].type, TypeName[Act Finish])
temp0 &= checkResult
CheckEqual([Link], 1)
temp0 &= checkResult
CheckEqual ([Link], 0)
temp0 &= checkResult
if temp0 == 1
currentPlayer = [Link]
CallFunction(PlayerObject_SuperTransform)
end if
end if
if [Link] == 1
if [Link] == 0
object.value1 = 0
[Link] = PlayerObject_HandleHammerSpin
[Link] = 0x800
[Link] = 0
if [Link] == 0x3800
PlaySfx(SfxName[Flying], 1)
end if
[Link] = ANI_HAMMER_SPEEN
end if
end if
end if
end function

function PlayerObject_HandleHammerSpin
CallFunction(PlayerObject_HandleAirAcceleration)
if [Link] == GRAVITY_AIR
[Link] = [Link]
if [Link] < -0x10000
[Link] = 0x800
else
if [Link] < 1
if object.value2 < 60
object.value2++
else
[Link] = 0x800
end if
end if
end if
[Link] += [Link]
if [Link] < 0x100000
if [Link] < 0
[Link] = 0
end if
end if
object.value1++
CheckLower(object.value1, 180)
temp0 = checkResult
CheckEqual([Link], 1)
temp0 &= checkResult
if temp0 == 0
[Link] = ANI_HAMMER_SPEEN
[Link] = PlayerObject_HandleAir
end if
else
[Link] = ANI_WALKING
[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
end if

//Fly Cancel

if [Link] == 1
if [Link] == 0
if [Link] == 0
temp2 = [Link]
temp2 |= [Link]
temp2 |= [Link]
temp2 &= [Link]
if temp2 == 1
[Link] = PlayerObject_HandleAir
[Link] = 0
[Link] = ANI_JUMPING
[Link] = 1
end if
end if
end if
end if
//Fly Cancel
end function

function PlayerObject_StartTailsFlight
if [Link] == 1
if [Link] == 1
CheckEqual([Link], 127)
temp0 = checkResult
CheckGreater([Link], 49)
temp0 &= checkResult
CheckNotEqual(PlayerObject_SuperState, 1)
temp0 &= checkResult
CheckNotEqual(object[30].type, TypeName[Act Finish])
temp0 &= checkResult
CheckEqual([Link], 1)
temp0 &= checkResult
CheckEqual ([Link], 0)
temp0 &= checkResult
if temp0 == 1
currentPlayer = [Link]
CallFunction(PlayerObject_SuperTransform)
end if
end if
if object[0].jumpPress == 1
object.value1 = 0
[Link] = PlayerObject_HandleTailsFlight
[Link] = 0x800
if [Link] == 1
[Link] = 0
end if
if [Link] == 0x3800
PlaySfx(SfxName[Flying], 1)
[Link] = ANI_FLYING
else
[Link] = ANI_SWIMMING
end if
end if
end if
end function

function PlayerObject_StartKnuxGlide
if [Link] == 1
if [Link] == 1
CheckEqual([Link], 127)
temp0 = checkResult
CheckGreater([Link], 49)
temp0 &= checkResult
CheckNotEqual(PlayerObject_SuperState, 1)
temp0 &= checkResult
CheckNotEqual(object[30].type, TypeName[Act Finish])
temp0 &= checkResult
CheckEqual([Link], 1)
temp0 &= checkResult
CheckEqual ([Link], 0)
temp0 &= checkResult

if temp0 == 1
currentPlayer = [Link]
CallFunction(PlayerObject_SuperTransform)
end if
end if
//CheckEqual(stage.player2Enabled, 1)
//temp4 = checkResult
//CheckEqual([Link], 1)
//temp4 &= checkResult
//if temp4 == 0
if [Link] == 1
[Link] = 0x40000
[Link] += 0x20000 //accuracy to 3AIR, for superglide
if [Link] < 0
[Link] = 0
end if
if [Link] == FLIP_NONE
ObjectTileCollision(CSIDE_LWALL, 15, -2,
[Link])
ObjectTileCollision(CSIDE_LWALL, 15, 11,
[Link])
ObjectTileCollision(CSIDE_ROOF, 0, -15,
[Link])
[Link] = PlayerObject_KnuxGlideRight
[Link] = 0x40000
object.value1 = 0
else
ObjectTileCollision(CSIDE_RWALL, -12, -2,
[Link])
ObjectTileCollision(CSIDE_RWALL, -12, 11,
[Link])
ObjectTileCollision(CSIDE_ROOF, 0, -15,
[Link])
[Link] = PlayerObject_KnuxGlideLeft
[Link] = -0x40000
object.value1 = 256
end if
[Link] = [Link]
[Link] = ANI_GLIDING
[Link] = ANI_GLIDING
[Link] = 2
[Link] = 0
[Link] = 0
end if
//end if
end if
end function

function PlayerObject_HandleGround
if [Link] != ANI_SKIDDING
temp7 = 1
else
temp7 = 0
end if
CallFunction(PlayerObject_HandleMovement)
if [Link] == GRAVITY_AIR
[Link] = PlayerObject_HandleAir
CallFunction(PlayerObject_HandleAirMovement)
else
CallFunction(PlayerObject_ResetOnFloor)
if [Link] == 0
if [Link] == CMODE_FLOOR
if object.value1 < 240
[Link] = ANI_STOPPED
object.value1++
else
[Link] = ANI_WAITING
if [Link] == 2
object.value1++
if object.value1 == 836
object.value1 = 0
[Link] = ANI_STOPPED
end if
end if
if [Link] == 5
if [Link] != 3
object.value1++
if object.value1 == 10620
object.value1 = 0
PlaySfx(SfxName[OuttaHere], 0)
[Link] =
PlayerObject_OuttaHere
[Link] = 46
end if
end if
end if
end if
switch [Link]
case 0
case 1
case 5
if [Link] == 0
if [Link] == 0
object.value1 = 0
[Link] = ANI_FLAILING1
[Link] = FLIP_NONE
end if
if [Link] == 0
object.value1 = 0
[Link] = ANI_FLAILING1
[Link] = FLIP_X
end if
end if
break
case 2
if [Link] == 0
if [Link] == 0
object.value1 = 0
[Link] = ANI_FLAILING1
if [Link] == FLIP_X
[Link] =
ANI_FLAILING1
[Link] = 4
[Link] = 0
[Link] = 0
end if
[Link] = FLIP_NONE
end if
if [Link] == 0
object.value1 = 0
[Link] = ANI_FLAILING1
if [Link] == FLIP_NONE
[Link] =
ANI_FLAILING1
[Link] = 4
[Link] = 0
[Link] = 0
end if
[Link] = FLIP_X
end if
end if
break
end switch
end if
else
object.value1 = 0
CallFunction(PlayerObject_MoveAnimate)
end if
if [Link] > 0
if temp7 == 1
PlaySfx(SfxName[Skidding], 0)
end if
[Link] = ANI_SKIDDING
[Link] = 0
[Link]--
if ringTimer == 0
CreateTempObject(TypeName[Dust Puff], 0, [Link],
[Link])
object[tempObjectPos].iypos += [Link]
object[tempObjectPos].drawOrder = [Link]
end if
if [Link] > 0
[Link] = FLIP_NONE
else
[Link] = FLIP_X
end if
end if
if [Link] == CMODE_FLOOR
if [Link] == 2
[Link] = ANI_PUSHING
[Link] = 0
end if
end if
if [Link] == 1
CheckEqual([Link], 5)
temp0 = checkResult
CheckEqual([Link], 1)
temp0 &= checkResult
temp0 &= [Link]
if temp0 == 1
CallFunction(PlayerObject_StartHop)
else
CallFunction(PlayerObject_StartJump)
end if
else
if [Link] == 1
if [Link] == 0
if [Link] != ANI_FLAILING1
if [Link] != ANI_FLAILING2
[Link] = PlayerObject_LookingUp
object.value1 = 0
else
[Link] = 0
[Link] = 0
end if
else
[Link] = 0
[Link] = 0
end if
end if
end if
if [Link] == 1
if [Link] == 0
if [Link] != ANI_FLAILING1
if [Link] != ANI_FLAILING2
[Link] = PlayerObject_Crouching
object.value1 = 0
else
[Link] = 0
[Link] = 0
end if
else
[Link] = 0
[Link] = 0
end if
else
if [Link] == 0
if [Link] == 0
CheckEqual([Link], 5)
temp0 = checkResult
CheckEqual([Link], 1)
temp0 &= checkResult
if temp0 == 0
if [Link] > 0
if [Link] > 0x8800
[Link] =
PlayerObject_HandleRoll
[Link] =
ANI_JUMPING
if
[Link] != ANI_JUMPING
[Link] -=
[Link]
end if
object.value2 = 0x400

PlaySfx(SfxName[Rolling], 0)
end if
else
if [Link] < -0x8800
[Link] =
PlayerObject_HandleRoll
[Link] =
ANI_JUMPING
if
[Link] != ANI_JUMPING
[Link] -=
[Link]
end if
object.value2 = 0x400

PlaySfx(SfxName[Rolling], 0)
end if
end if
end if
end if
end if
end if
end if
end if
end if
end function

function PlayerObject_HandleAir
CallFunction(PlayerObject_HandleAirAcceleration)
if [Link] == GRAVITY_AIR
CallFunction(PlayerObject_HandleAirMovement)
if [Link] > 0x20000
if [Link] == ANI_FLAILING1
[Link] = ANI_WALKING
end if
if [Link] == ANI_FLAILING2
[Link] = ANI_WALKING
end if
end if
if [Link] == ANI_BOUNCING
if [Link] >= 0
if [Link] == ANI_STOPPED
[Link] = ANI_WALKING
end if
if [Link] == 5
[Link] = ANI_FALL
else
[Link] = [Link]
end if
end if
else
if [Link] == 11
if [Link] >= 0
if [Link] == ANI_STOPPED
[Link] = ANI_WALKING
end if
if [Link] == 5
[Link] = ANI_FALL
else
[Link] =
[Link]
end if
end if
end if
end if
if [Link] == ANI_HAMMER_JUMP
if [Link] >= 100
//[Link] = 0
//[Link] = 0
[Link] = [Link]
end if
end if
if [Link] == ANI_HURT
if [Link] >= 0
if [Link] == ANI_STOPPED
[Link] = ANI_WALKING
end if
[Link] = [Link]
end if
end if
if [Link] == ANI_JUMPING
//if [Link] == 1
if [Link] >= [Link]
CallFunction([Link])
end if
//end if
end if
if [Link] == ANI_SKIDDING
if [Link] > 0
[Link]--
else
[Link] = ANI_WALKING
[Link] = ANI_WALKING
[Link] = 0
[Link] = 40
end if
end if
if [Link] == 1
if [Link] == 5
CheckEqual([Link], 11)
temp0 = checkResult
CheckEqual([Link], ANI_FALL)
temp0 |= checkResult
CheckEqual([Link], 52)
temp0 |= checkResult
CheckEqual([Link], ANI_HAMMER_SPEEN)
temp0 |= checkResult
if temp0 == 1
CheckEqual([Link], 1)
temp1 = checkResult
switch [Link]
case 1
if [Link] == 1

CheckEqual([Link], 127)
temp0 = checkResult
CheckGreater([Link],
49)
temp0 &= checkResult

CheckNotEqual(PlayerObject_SuperState, 1)
temp0 &= checkResult

CheckNotEqual(object[30].type, TypeName[Act Finish])


temp0 &= checkResult
CheckEqual([Link],
1)
temp0 &= checkResult
CheckEqual
([Link], 0)
temp0 &= checkResult

if temp0 == 1
currentPlayer =
[Link]

CallFunction(PlayerObject_SuperTransform)
end if
end if
if [Link] == 1
if temp1 == 1

CallFunction(PlayerObject_StartSecondJump)
[Link] =
3
else

CallFunction(PlayerObject_StartHop)
[Link] =
4
end if
end if
break
case 3
if [Link] == 1
if temp1 == 0

CallFunction(PlayerObject_StartHop)
[Link] =
2
end if
end if
break
case 4
if [Link] == 1
if temp1 == 1

CallFunction(PlayerObject_StartSecondJump)
[Link] =
2
end if
end if
break
end switch
end if
end if
end if
else
if [Link] == 0
if [Link] < 21

[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
[Link] = 0
[Link] = 0

else //release drop dash


[Link] = PlayerObject_HandleRoll
StopSfx(SfxName[Drop Dash])
CreateTempObject(TypeName[Dust Puff],
[Link], [Link], [Link])
object[tempObjectPos].iypos = [Link]
object[tempObjectPos].ypos += [Link]
object[tempObjectPos].frame = 11
object[tempObjectPos].drawOrder =
[Link]
object[tempObjectPos].direction = [Link]
object.value1 = 0
object.value2 = 0
[Link] = ANI_JUMPING
[Link] -= [Link]
if [Link] == 0
[Link] = 15
[Link] = 4
end if
if PlayerObject_SuperState == 1
temp0 = 0xC0000
temp1 = 0xD0000
[Link] = 5
[Link] = 5
else
temp0 = 0x80000
temp1 = 0xC0000
end if

if [Link]==FLIP_X
FlipSign([Link])
FlipSign([Link])
end if

if [Link] >= 0
[Link] >>= 2
[Link] += temp0
if [Link] > temp1
[Link] = temp1
end if
else
[Link] >>= 1
[Link] += temp0
end if

if [Link] == FLIP_X
FlipSign([Link])
FlipSign([Link])
end if

CallFunction(PlayerObject_ResetOnFloor)
StopSfx(SfxName[Charge])
if PlayerObject_SuperState == 1
PlaySfx(SfxName[Peelout Release],0)
else
PlaySfx(SfxName[Drop Dash Release],0)
end if
[Link] = 0
end if
else
[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
[Link] = 0
end if
end if
end function

function PlayerObject_AirCtrlLock
CallFunction(PlayerObject_HandleAirAcceleration)
if [Link] == GRAVITY_AIR
CallFunction(PlayerObject_HandleAirMovement)
else
[Link] = PlayerObject_Unknown2
CallFunction(PlayerObject_ResetOnFloor)
[Link] = 0
end if
[Link] = ANI_JUMPING
end function

function PlayerObject_HandleRoll
CallFunction(PlayerObject_HandleRolling)
if [Link] == GRAVITY_AIR
[Link] = PlayerObject_HandleAir
object.value1 = 0
CallFunction(PlayerObject_HandleAirMovement)
else
CallFunction(PlayerObject_HandleRollAnimSpd)
[Link] = [Link]
CallFunction(PlayerObject_ResetOnFloor)
if [Link] == 1
CallFunction(PlayerObject_StartJump)
end if
end if
end function

function PlayerObject_RollingJump
if [Link] == 1
[Link] = PlayerObject_HandleAir
end if

[Link] = 0
[Link] = 0
CallFunction(PlayerObject_HandleAirAcceleration)
if [Link] == GRAVITY_AIR
if [Link] == ANI_JUMPING
//if [Link] == 1
if [Link] >= [Link]
CallFunction([Link])
end if
//end if
end if
CallFunction(PlayerObject_HandleAirMovement)
else
if [Link] == 0
if [Link] < 21

[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
[Link] = 0

else //release drop dash


[Link] = PlayerObject_HandleRoll
CallFunction(PlayerObject_ResetOnFloor)
StopSfx(SfxName[Drop Dash])
CreateTempObject(TypeName[Dust Puff], [Link],
[Link], [Link])
object[tempObjectPos].iypos = [Link]
object[tempObjectPos].ypos += [Link]
object[tempObjectPos].frame = 11
object[tempObjectPos].drawOrder = [Link]
object[tempObjectPos].direction = [Link]
object.value1 = 0
object.value2 = 0
[Link] = ANI_JUMPING
[Link] -= [Link]
if [Link] == 0
[Link] = 15
[Link] = 4
end if
if PlayerObject_SuperState == 1
temp0 = 0xC0000
temp1 = 0xD0000
else
temp0 = 0x80000
temp1 = 0xC0000
end if

if [Link]==FLIP_X
FlipSign([Link])
end if

if [Link] >= 0
[Link]>>=2
[Link]+=temp0
if [Link] > temp1
[Link]=temp1
end if
else
[Link]>>=1
[Link]+=temp0
end if
if [Link]==FLIP_X
FlipSign([Link])
FlipSign([Link])
end if
StopSfx(SfxName[Charge])
PlaySfx(SfxName[Release],0)
end if
else
[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
[Link] = 0
end if
end if
end function

function PlayerObject_LookingUp
CheckGreater([Link], 31)
temp0 = checkResult
CheckLower([Link], 225)
temp0 &= checkResult
CheckEqual([Link], 0)
temp0 |= checkResult
if temp0 == 1
[Link] = PlayerObject_HandleGround
object.value1 = 0
else
if object.value1 < 60
object.value1++
else
temp0 = [Link]
temp0 >>= 16
temp0 -= [Link]
temp0 -= 112
if [Link] > temp0
[Link] -= 2
end if
end if
[Link] = ANI_LOOKINGUP
if [Link] == GRAVITY_AIR
[Link] = PlayerObject_HandleAir
object.value1 = 0
else
if [Link] == 1
switch [Link]
case 0
//case 3
if [Link] == 1
if [Link] == 0

CallFunction(PlayerObject_StartSuperPeel)
else

CallFunction(PlayerObject_StartJump)
end if
else
CallFunction(PlayerObject_StartJump)
end if
break
case 1
case 2
CallFunction(PlayerObject_StartJump)
break
case 5
if [Link] == 0
CallFunction(PlayerObject_StartJump)
else
CallFunction(PlayerObject_StartSuperPeel)
end if
break
end switch
end if
end if
end if
end function

function PlayerObject_HandleSuperPeel
if [Link] == GRAVITY_AIR
[Link] = PlayerObject_HandleAir
[Link] = 0
else
if [Link] == 0x1000
if object.value2 < 0x60000
object.value2 += 0x6000
end if
else
if object.value2 < 0xC0000
object.value2 += 0x6000
end if
end if
if object.value2 < 0x5F5C2
[Link] = ANI_WALKING
[Link] = object.value2
if [Link] < 0
FlipSign([Link])
end if
[Link] *= 60
[Link] /= 0x60000
[Link] += 20
else
temp0 = object.value2
if PlayerObject_SuperState == 1
if temp0 > 0xAFFFF
switch [Link]
case 0
[Link] = ANI_RUNNING
break
case 1
[Link] = ANI_PEELOUT
break
case 2
[Link] = ANI_DASHMANIA
break
end switch
else
[Link] = ANI_RUNNING
end if
else
if temp0 > 0x9FFFF
switch [Link]
case 0
[Link] = ANI_RUNNING
break
case 1
[Link] = ANI_PEELOUT
break
case 2
[Link] = ANI_BDASH2
break
case 3
[Link] = ANI_DASHMANIA
break
end switch
else
if [Link] == 2
if temp0 > 0x7FAE0
[Link] = ANI_BDASH1
else
[Link] = ANI_RUNNING
end if
else
[Link] = ANI_RUNNING
end if
end if
end if

[Link] = object.value2
if [Link] < 0
FlipSign([Link])
end if
[Link] *= 80
[Link] /= 0x60000
end if
if [Link] == 0
[Link] = PlayerObject_HandleGround
if [Link] == 0
object.value11 = 15
[Link] = 4
end if
if object.value2 < 0x5F5C2
[Link] = 0
else
[Link] = object.value2
if [Link] == FLIP_X
FlipSign([Link])
end if
StopSfx(SfxName[Peelout Charge])
PlaySfx(SfxName[Peelout Release], 0)
end if
CallFunction(PlayerObject_ResetOnFloor)
end if
end if
end function

function PlayerObject_HandleAmySuperPeel
if [Link] == GRAVITY_AIR
[Link] = PlayerObject_HandleAir
[Link] = 0
else
if [Link] == 0x1000
if object.value2 < 0x60000
object.value2 += 0x9000
end if
else
if object.value2 < 0xC0000
object.value2 += 0x9000
end if
end if
if object.value2 < 0x5F5C2
[Link] = ANI_WALKING
[Link] = object.value2
if [Link] < 0
FlipSign([Link])
end if
[Link] *= 60
[Link] /= 0x60000
[Link] += 20
else
temp0 = object.value2
if temp0 > 0x9FFFF
switch [Link]
case 0
[Link] = ANI_RUNNING
break
case 1
[Link] = ANI_PEELOUT
break
case 2
[Link] = 44
break
end switch
else
[Link] = ANI_RUNNING
end if

[Link] = object.value2
if [Link] < 0
FlipSign([Link])
end if
[Link] *= 80
[Link] /= 0x60000
end if
if [Link] == 0
[Link] = PlayerObject_HandleGround
if [Link] == 0
object.value11 = 15
[Link] = 4
end if
if object.value2 < 0x5F5C2
[Link] = 0
else
[Link] = object.value2
[Link] -= 0x1300
if [Link] == FLIP_X
FlipSign([Link])
end if
StopSfx(SfxName[Peelout Charge])
PlaySfx(SfxName[Peelout Release], 0)
end if
CallFunction(PlayerObject_ResetOnFloor)
end if
end if
end function

function PlayerObject_StartSuperPeel
if [Link] == 0
if [Link] == 5
[Link] = PlayerObject_HandleAmySuperPeel
else
[Link] = PlayerObject_HandleSuperPeel
end if
object.value2 = 0
PlaySfx(SfxName[Peelout Charge], 0)
[Link] = ANI_WALKING
else
CallFunction(PlayerObject_StartJump)
end if

end function

function PlayerObject_Crouching
CheckGreater([Link], 31)
temp0 = checkResult
CheckLower([Link], 225)
temp0 &= checkResult
CheckEqual([Link], 0)
temp0 |= checkResult
if temp0 == 1
[Link] = PlayerObject_HandleGround
object.value1 = 0
else
if object.value1 < 60
object.value1++
else
temp0 = [Link]
temp0 >>= 16
temp0 -= [Link]
temp0 += 96
if [Link] < temp0
[Link] += 2
end if
end if
[Link] = ANI_LOOKINGDOWN
if [Link] == GRAVITY_AIR
[Link] = PlayerObject_HandleAir
object.value1 = 0
else
if [Link] == 1
CallFunction([Link])
end if
end if
end if
end function

function PlayerObject_HandleSpindash
if [Link] == GRAVITY_AIR
CallFunction(PlayerObject_HandleAirAcceleration)
CallFunction(PlayerObject_HandleAirMovement)
else
[Link] = 0
if [Link] == 1
if object.value2 < 0x90000
object.value2 += 0x20000
else
object.value2 = 0x80000
end if
[Link] = 0
PlaySfx(SfxName[Charge], 0)
else
temp0 = object.value2
temp0 >>= 5
object.value2 -= temp0
end if
if [Link] == 0
object.value1 = 0
[Link] = PlayerObject_HandleRoll
[Link] = ANI_JUMPING
[Link] -= [Link]
if [Link] == 0
[Link] = 15
[Link] = 4
end if
temp0 = object.value2
temp0 >>= 17
temp0 <<= 16
if PlayerObject_SuperState == 1
temp0 += 0xB0000
else
temp0 += 0x80000
end if
if [Link] == FLIP_NONE
[Link] = temp0
else
[Link] = temp0
FlipSign([Link])
end if
StopSfx(SfxName[Charge])
PlaySfx(SfxName[Release], 0)
CallFunction(PlayerObject_ResetOnFloor)
end if
end if
end function

function PlayerObject_HandleSpindashCD
if [Link] == GRAVITY_AIR
CallFunction(PlayerObject_HandleAirAcceleration)
CallFunction(PlayerObject_HandleAirMovement)
else
[Link] = 0
if [Link] == 4096
if object.value1 < 524288
object.value1 += 24576
end if
else
if object.value1 < 786432
object.value1 += 24576
end if
end if
if [Link]==0
if object.value1 < 195297
[Link] = 0
[Link] = PlayerObject_HandleGround
else
[Link] = PlayerObject_HandleRoll
[Link] = ANI_JUMPING
[Link] = object.value1
if [Link] == FACING_LEFT
FlipSign([Link])
end if
playsfx(7,0)
end if
CallFunction(PlayerObject_ResetOnFloor)
object.value1 = 0
end if
end if
end function

function PlayerObject_StartFlyCarry
if [Link] != 0
[Link]--
end if
temp0 = [Link]
temp1 = [Link]
temp1 += 0x1F0000
if object[0].animation == ANI_JUMPING
temp1 += 0x50000
end if
temp0 -= object[0].xpos
temp1 -= object[0].ypos
if object[0].state != PlayerObject_FlyCarry
CheckEqual(object[0].gravity, GRAVITY_GROUND)
temp2 = checkResult
CheckGreater([Link], 0)
temp2 &= checkResult
if temp2 == 0
CheckEqual(object[0].state, PlayerObject_HandleGround)
temp2 = checkResult
CheckEqual(object[0].state, PlayerObject_HandleRoll)
temp2 |= checkResult
CheckEqual(object[0].state, PlayerObject_HandleAir)
temp2 |= checkResult
CheckEqual(object[0].state, PlayerObject_RollingJump)
temp2 |= checkResult
CheckEqual(object[0].state, PlayerObject_LookingUp)
temp2 |= checkResult
CheckEqual(object[0].state, PlayerObject_Crouching)
temp2 |= checkResult
if temp2 != 0
temp2 = temp0
Abs(temp2)
temp3 = temp1
Abs(temp3)
if temp2 <= 0x80000
if temp3 <= 0x80000
if [Link] == 0
if object[0].down == 0
object[0].animation = ANI_HANGING
object[0].state =
PlayerObject_FlyCarry
object[0].xpos += temp0
object[0].ypos += temp1
PlaySfx(SfxName[Catch], 0)
end if
end if
end if
end if
end if
end if
end if
if object[0].state == PlayerObject_FlyCarry
temp2 = [Link]
temp3 = [Link]
temp6 = [Link]
temp7 = [Link]
ProcessObjectMovement()
PlayerObject_SidekickX = [Link]
PlayerObject_SidekickY = [Link]
temp4 = [Link]
temp4 &= -0x10000
temp5 = [Link]
temp5 &= -0x10000
temp5 += 0x1F0000
[Link] = temp2
[Link] = temp3
[Link] = temp6
[Link] = temp7
[Link] = 0
temp0 = [Link]
temp0 &= -0x10000
temp1 = [Link]
temp1 &= -0x10000
[Link] = temp4
[Link] = temp5
[Link] -= temp0
[Link] -= temp1
ProcessObjectMovement()
[Link] = 1
object[0].collisionPlane = [Link]
object[0].speed = [Link]
object[0].direction = [Link]
PlayerObject_LeaderX = object[0].xpos
PlayerObject_LeaderY = object[0].ypos
temp2 = object[0].xpos
temp2 &= -0x10000
temp3 = object[0].ypos
temp3 &= -0x10000
CheckNotEqual(temp4, temp2)
temp6 = checkResult
CheckNotEqual(temp5, temp3)
temp6 |= checkResult
if temp6 == 1
if object[0].gravity == GRAVITY_GROUND
object[0].state = PlayerObject_HandleGround
else
object[0].state = PlayerObject_HandleAir
end if
[Link] = 30
end if
end if
end function

function PlayerObject_FlyCarry
if object[1].state != PlayerObject_HandleTailsFlight
[Link] = PlayerObject_HandleAir
end if
temp0 = object[1].xpos
temp0 &= -0x10000
temp2 = [Link]
temp2 &= -0x10000
if [Link] == PlayerObject_LeaderX
PlayerObject_SidekickX &= -0x10000
temp1 = temp0
temp1 -= PlayerObject_SidekickX
temp2 += temp1
end if
if temp0 != temp2
if [Link] == GRAVITY_GROUND
[Link] = PlayerObject_HandleGround
else
[Link] = PlayerObject_HandleAir
end if
end if
if [Link] == GRAVITY_GROUND
if [Link] >= 0
[Link] = PlayerObject_HandleGround
end if
end if
if [Link] != 0
if [Link] != 0
if [Link] == 0x3800
[Link] = -0x40000
else
[Link] = -0x20000
end if
[Link] = PlayerObject_HandleAir
[Link] = ANI_JUMPING
end if
end if
if [Link] == PlayerObject_FlyCarry
[Link] = 0
[Link] = 0
[Link] = 0
else
object[1].value36 = 30
end if
end function

function PlayerObject_HandleTailsFlight
CallFunction(PlayerObject_HandleAirAcceleration)
if [Link] == GRAVITY_AIR
[Link] = [Link]
if [Link] < -0x10000
[Link] = 0x800
else
if [Link] < 1
if object.value2 < 60
object.value2++
else
[Link] = 0x800
end if
end if
end if
[Link] += [Link]
if [Link] < 0x100000
if [Link] < 0
[Link] = 0
end if
end if
CallFunction(PlayerObject_StartFlyCarry)
if object.value1 < 480
if [Link] == 0x3800
if object[0].state == PlayerObject_FlyCarry
if [Link] < 0
[Link] = ANI_FLY_LIFT_UP
[Link] = 240
else
[Link] = ANI_FLY_LIFT_DOWN
[Link] = 120
end if
else
[Link] = ANI_FLYING
if [Link] < 0
[Link] = 240
else
[Link] = 120
end if
end if
else
if object[0].state == PlayerObject_FlyCarry
[Link] = ANI_SWIM_LIFT
else
[Link] = ANI_SWIMMING
if [Link] < 0
[Link] = 60
else
[Link] = 30
end if
end if
end if
object.value1++
if object.value1 == 480
[Link] = 0x800
if [Link] == 0x3800
if object[0].state == PlayerObject_FlyCarry
[Link] = ANI_FLY_LIFT_TIRED
else
[Link] = ANI_FLYINGTIRED
end if
[Link] = 120
StopSfx(SfxName[Flying])
PlaySfx(SfxName[Tired], 1)
else
if object[0].state == PlayerObject_FlyCarry
[Link] = ANI_SWIM_LIFT
else
[Link] = ANI_SWIMMINGTIRED
end if
end if
else
temp0 = [Link]
temp0 -= 2
ObjectTileCollision(CSIDE_ROOF, 0, temp0,
[Link])
if checkResult == 0
CheckEqual([Link], 0)
temp0 = checkResult
CheckEqual(object[0].state, PlayerObject_FlyCarry)
temp0 |= checkResult
if temp0 == 1
if object[0].jumpPress == 1
CheckNotEqual([Link],
0x3800)
temp0 = checkResult
CheckEqual(object[0].state,
PlayerObject_FlyCarry)
temp0 &= checkResult
if temp0 == 0
[Link] = -0x2000
object.value2 = 0
end if
end if
if object[0].up == 1
CheckNotEqual([Link],
0x3800)
temp0 = checkResult
CheckEqual(object[0].state,
PlayerObject_FlyCarry)
temp0 &= checkResult
if temp0 == 0
[Link] = -0x2000
object.value2 = 0
end if
end if
else
[Link].y = object[0].ypos
if object[0].gravity == GRAVITY_GROUND
temp0 = 75
else
temp0 = 10
end if
temp0 <<= 16
FlipSign(temp0)
temp0 += object[0].ypos
if [Link] > temp0
if object[0].down == 0

CheckNotEqual([Link], 0x3800)
temp0 = checkResult
CheckEqual(object[0].state,
PlayerObject_FlyCarry)
temp0 &= checkResult
if temp0 == 0
[Link] =
-0x2000
object.value2 = 0
end if
end if
else
[Link] = 0x800
end if
end if
end if
end if
else
if [Link] == 0x3800
if object[0].state == PlayerObject_FlyCarry
[Link] = ANI_FLY_LIFT_TIRED
else
[Link] = ANI_FLYINGTIRED
end if
else
if object[0].state == PlayerObject_FlyCarry
[Link] = ANI_SWIM_LIFT
else
[Link] = ANI_SWIMMINGTIRED
end if
end if
end if
else
[Link] = ANI_WALKING
[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
end if

//Fly Cancel

if [Link] == 1
if [Link] == 0
if [Link] == 0
temp2 = [Link]
temp2 |= [Link]
temp2 |= [Link]
temp2 &= [Link]
if temp2 == 1
[Link] = PlayerObject_HandleAir
[Link] = 0
[Link] = ANI_JUMPING
[Link] = 1
end if
end if
end if
end if
//Fly Cancel
end function

function PlayerObject_KnuxGlideLeft
if [Link] == GRAVITY_AIR
ObjectTileCollision(CSIDE_ROOF, 0, -15, [Link])
if [Link] == 1
if object.value1 == 256
if [Link] < 0x180000
[Link] += 0x400
end if
else
if [Link] < 0x40000
[Link] += 0x1000
end if
end if
if [Link] > 0x8000
[Link] -= 0x2000
else
[Link] += 0x2000
end if
if object.value1 < 256
object.value1 += 4
end if
if object.value1 < 170
if object.value1 > 86
[Link] = 0
else
if object.value1 > 44
[Link] = 1
else
[Link] = 2
end if
end if
else
if object.value1 < 212
[Link] = 1
else
[Link] = 2
end if
end if
if [Link] == 2
temp0 = oscillation
temp0 >>= 2
temp0 %= 2
if temp0 == 1
[Link] = 3
end if
end if
temp7 = [Link]
if object.value1 < 128
[Link] = FLIP_NONE
temp0 = 0
temp1 = 0
else
[Link] = FLIP_X
[Link] = temp7
[Link] += [Link]
[Link] = [Link]
ObjectTileCollision(CSIDE_RWALL, -12, -2,
[Link])
temp0 = checkResult
temp2 = [Link]
[Link] = temp7
[Link] += [Link]
ObjectTileCollision(CSIDE_RWALL, -12, 11,
[Link])
temp1 = checkResult
temp3 = [Link]
end if
Cos([Link], object.value1)
[Link] *= [Link]
[Link] >>= 9
if [Link] == 1
[Link] = PlayerObject_KnuxGlideRight
end if
[Link] = temp7
checkResult = temp0
checkResult &= temp1
if checkResult == 1
if temp2 == temp3
[Link] = PlayerObject_KnuxWallClimb
if PlayerObject_SuperState == 1
if [Link] > 0
if [Link] > 0x48000
ResetObjectEntity(13,
TypeName[Insta Shield], 3, 0, 0)
object[13].priority =
PRIORITY_ACTIVE
PlaySfx(SfxName[Thud],0)
end if
end if
end if
[Link] = 0
[Link] = 0
[Link] = 0
object.value1 = 0
PlaySfx(SfxName[Catch], 0)
else
object.value1 = 0
[Link] >>= 2
[Link] = [Link]
[Link] = ANI_GLIDING_DROP
[Link] = PlayerObject_KnuxGlideDrop
end if
else
if temp0 == 1
object.value1 = 0
[Link] >>= 2
[Link] = [Link]
[Link] = ANI_GLIDING_DROP
[Link] = PlayerObject_KnuxGlideDrop
end if
end if
else
object.value1 = 0
[Link] >>= 2
[Link] = [Link]
[Link] = ANI_GLIDING_DROP
if object[0].ixpos <= 10
[Link] = FLIP_NONE
endif
[Link] = PlayerObject_KnuxGlideDrop
end if
else
if [Link] == CMODE_FLOOR
object.value1 = 0
[Link] = PlayerObject_KnuxGlideSlide
[Link] = ANI_GLIDING_STOP
[Link] = [Link]
else
[Link] = ANI_WALKING
[Link] >>= 1
[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
[Link] = 0
end if
end if
CallFunction(PlayerObject_TopGlide)
end function

function PlayerObject_KnuxGlideRight
if [Link] == GRAVITY_AIR
ObjectTileCollision(CSIDE_ROOF, 0, -15, [Link])
if [Link] == 1
if object.value1 == 0
if [Link] < 0x180000
[Link] += 0x400
end if
else
if [Link] < 0x40000
[Link] += 0x1000
end if
end if
if [Link] > 0x8000
[Link] -= 0x2000
else
[Link] += 0x2000
end if
if object.value1 > 0
object.value1 -= 4
end if
if object.value1 < 170
if object.value1 > 86
[Link] = 0
else
if object.value1 > 44
[Link] = 1
else
[Link] = 2
end if
end if
else
if object.value1 < 212
[Link] = 1
else
[Link] = 2
end if
end if
if [Link] == 2
temp0 = oscillation
temp0 >>= 2
temp0 %= 2
if temp0 == 1
[Link] = 3
end if
end if
temp7 = [Link]
if object.value1 < 128
[Link] = FLIP_NONE
[Link] = temp7
[Link] += [Link]
[Link] = [Link]
ObjectTileCollision(CSIDE_LWALL, 12, -2,
[Link])
temp0 = checkResult
temp2 = [Link]
[Link] = temp7
[Link] += [Link]
ObjectTileCollision(CSIDE_LWALL, 12, 11,
[Link])
temp1 = checkResult
temp3 = [Link]
else
[Link] = FLIP_X
temp0 = 0
temp1 = 0
end if
Cos([Link], object.value1)
[Link] *= [Link]
[Link] >>= 9
if [Link] == 1
[Link] = PlayerObject_KnuxGlideLeft
end if
[Link] = temp7
checkResult = temp0
checkResult &= temp1
if checkResult == 1
temp2 >>= 1
temp3 >>= 1
if temp2 == temp3
[Link] = PlayerObject_KnuxWallClimb
if PlayerObject_SuperState == 1
if [Link] > 0
if [Link] > 0x48000
ResetObjectEntity(13,
TypeName[Insta Shield], 3, 0, 0)
object[13].priority =
PRIORITY_ACTIVE
PlaySfx(SfxName[Thud],0)
end if
end if
end if
[Link] = 0
[Link] = 0
[Link] = 0
object.value1 = 0
PlaySfx(SfxName[Catch], 0)
else
object.value1 = 0
[Link] >>= 2
[Link] = [Link]
[Link] = ANI_GLIDING_DROP
[Link] = PlayerObject_KnuxGlideDrop
end if
else
if temp0 == 1
[Link] = 0
object.value1 = 0
[Link] >>= 2
[Link] = [Link]
[Link] = ANI_GLIDING_DROP
[Link] = PlayerObject_KnuxGlideDrop
end if
end if
else
object.value1 = 0
[Link] >>= 2
[Link] = [Link]
[Link] = ANI_GLIDING_DROP
[Link] = PlayerObject_KnuxGlideDrop
end if
else
if [Link] == CMODE_FLOOR
object.value1 = 0
[Link] = PlayerObject_KnuxGlideSlide
[Link] = ANI_GLIDING_STOP
[Link] = [Link]
else
[Link] = ANI_WALKING
[Link] >>= 1
[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
[Link] = 0
end if
end if
CallFunction(PlayerObject_TopGlide)
end function

function PlayerObject_TopGlide
temp0 = stage.curYBoundary1
temp0 += 16
temp0 <<= 16
if [Link] < temp0
[Link] = 0
[Link] = [Link]
end if
end function

function PlayerObject_KnuxGlideDrop
if [Link] == GRAVITY_AIR
CallFunction(PlayerObject_HandleAirAcceleration)
CallFunction(PlayerObject_HandleAirMovement)
else
if object.value1 == 0
PlaySfx(SfxName[Landing], 0)
end if
[Link] = 0
[Link] = 0
[Link] = 0
[Link] = ANI_LOOKINGDOWN
[Link] = ANI_LOOKINGDOWN
[Link] = 2
if object.value1 < 11
object.value1++
if [Link] == 1
CallFunction(PlayerObject_ResetOnFloor)
[Link] = PlayerObject_LookingUp
[Link] = 0
else
if [Link] == 1
CallFunction(PlayerObject_ResetOnFloor)
[Link] = PlayerObject_Crouching
[Link] = 0
else
if [Link] == 1
[Link] = 0
CallFunction(PlayerObject_StartJump)
end if
end if
end if
else
[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
[Link] = 0
end if
end if
end function

function PlayerObject_KnuxGlideSlide
if [Link] == GRAVITY_GROUND
if [Link] == 0
if [Link] == 1
if [Link] == 1
CallFunction(PlayerObject_ResetOnFloor)
[Link] = [Link]
[Link] = 0
else
[Link] = 0
CallFunction(PlayerObject_StartJump)
end if
end if
[Link] = 0
[Link] = 1
if object.value1 < 16
object.value1++
else
[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
[Link] = 0
end if
else
if ringTimer == 0
CreateTempObject(TypeName[Dust Puff], 0, [Link],
[Link])
object[tempObjectPos].iypos += [Link]
object[tempObjectPos].drawOrder = [Link]
if object.value1 == 0
PlaySfx(SfxName[Sliding], 0)
object.value1 = 1
else
object.value1 = 0
end if
end if
[Link] = 0
if [Link] > 0
[Link] -= 0x2000
if [Link] < 0
[Link] = 0
object.value1 = 0
end if
else
[Link] += 0x2000
if [Link] > 0
[Link] = 0
object.value1 = 0
end if
end if
if [Link] == 0
[Link] = 0
object.value1 = 0
end if
end if
[Link] = [Link]
else
object.value1 = 0
[Link] = ANI_GLIDING_DROP
[Link] = PlayerObject_KnuxGlideDrop
end if
end function

function PlayerObject_KnuxWallClimb
if [Link] == GRAVITY_AIR
[Link] = ANI_CLIMBING
if [Link] == 1
if PlayerObject_SuperState == 1
[Link] = -0x20000
else
[Link] = -0x10000
end if
temp0 = [Link]
temp0 *= -0x10000
if [Link] < temp0
[Link] = temp0
end if
object.value1++
if object.value1 == 4
object.value1 = 0
[Link]++
[Link] %= 6
end if
else
if [Link] == 1
if PlayerObject_SuperState == 1
[Link] = 0x20000
else
[Link] = 0x10000
end if
object.value1++
if object.value1 == 4
object.value1 = 0
if [Link] < 1
[Link] += 6
end if
[Link]--
end if
else
[Link] = 0
end if
end if
if [Link] == 1
[Link] = ANI_JUMPING
[Link] = PlayerObject_HandleAir
object.value1 = 0
PlaySfx(SfxName[Jump], 0)
if [Link] == FLIP_X
[Link] = 0x40000
[Link] = 0x40000
[Link] = FLIP_NONE
else
[Link] = -0x40000
[Link] = -0x40000
[Link] = FLIP_X
end if
[Link] = -0x40000
if [Link] != 0x3800
[Link] >>= 1
[Link] >>= 1
[Link] >>= 1
end if
else
if [Link] == FLIP_NONE
temp2 = [Link]
ObjectTileGrip(CSIDE_LWALL, 10, -10, [Link])
temp0 = checkResult
temp3 = [Link]
[Link] = temp2
ObjectTileGrip(CSIDE_LWALL, 10, 11, [Link])
temp1 = checkResult
if [Link] > temp3
[Link] = temp3
end if
else
temp2 = [Link]
ObjectTileGrip(CSIDE_RWALL, -10, -10,
[Link])
temp0 = checkResult
temp3 = [Link]
[Link] = temp2
ObjectTileGrip(CSIDE_RWALL, -10, 11, [Link])
temp1 = checkResult
if [Link] < temp3
[Link] = temp3
end if
end if
if temp0 == 0
[Link] = temp2
[Link] = ANI_LEDGEPULLUP
[Link] = 0
object.value1 = 0
[Link] = PlayerObject_KnuxLedgePullUp
[Link] = 0
if [Link] == FLIP_NONE
[Link] += 0x10000
end if
else
if temp1 == 0
[Link] = ANI_GLIDING_DROP
[Link] = ANI_GLIDING_DROP
[Link] = 2
object.value1 = 0
[Link] = PlayerObject_KnuxGlideDrop
end if
end if
end if
else
[Link] = ANI_WALKING
[Link] = PlayerObject_HandleGround
CallFunction(PlayerObject_ResetOnFloor)
end if
end function
function PlayerObject_KnuxLedgePullUp
switch [Link]
case 0
if object.value1 < 5
ObjectTileGrip(CSIDE_FLOOR, 12, -9, [Link])
object.value1++
else
object.value1 = 0
[Link]++
if [Link] == FLIP_NONE
[Link] += 0x90000
else
[Link] -= 0x90000
end if
[Link] -= 0xA0000
end if
break
case 1
if object.value1 < 5
object.value1++
else
object.value1 = 0
[Link]++
if [Link] == FLIP_NONE
[Link] += 0x50000
else
[Link] -= 0x50000
end if
[Link] -= 0x20000
end if
break
case 2
if object.value1 < 5
object.value1++
else
object.value1 = 0
[Link] = ANI_STOPPED
[Link] = PlayerObject_HandleAir
[Link] -= 0xA0000
[Link] = 1
end if
break
end switch
end function

function PlayerObject_Hurt
if player.isPlayer2 == 0
arrayPos0 = [Link]
arrayPos0 += playerCount
switch [Link]
//if [Link] != 0
case 1
case 2
case 3
case 4
temp0 = 1
ResetObjectEntity(arrayPos0, TypeName[Blank Object], 0, 0,
0)
[Link] = 0
CheckEqual([Link], 0)
temp1 = checkResult
if [Link] == 1
temp1 = 1
end if
CheckNotEqual([Link], 0)
temp1 &= checkResult
if temp1 == 1
PlaySfx(SfxName[Spike], 0)
else
PlaySfx(SfxName[Hurt], 0)
end if
break
//else
case 5
case 0
ResetObjectEntity(arrayPos0, TypeName[Blank Object], 0, 0,
0)
[Link] = 0
if object[0].value0 == 0
if [Link] != 0
PlaySfx(SfxName[Spike], 0)
else
PlaySfx(SfxName[Hurt], 0)
end if
temp0 = 3
else
PlaySfx(SfxName[Lose Rings], 0)
temp0 = 2
end if
break
//end if
end switch
else
temp0 = 1
if [Link] != 0
PlaySfx(SfxName[Spike], 0)
else
PlaySfx(SfxName[Hurt], 0)
end if
end if
[Link] = 1
switch temp0
case 1
[Link] = PlayerObject_Knockback
[Link] = ANI_HURT
[Link] = -0x40000
[Link] = GRAVITY_AIR
[Link] = 1
[Link] = 1
[Link] = 120
if [Link] == 0x1000
[Link] >>= 1
[Link] >>= 1
end if
break
case 2
[Link] = PlayerObject_Knockback
[Link] = ANI_HURT
[Link] = -0x40000
[Link] = GRAVITY_AIR
[Link] = 1
[Link] = 1
[Link] = 120
if [Link] == 0x1000
[Link] >>= 1
[Link] >>= 1
end if
temp0 = object[0].value0
if temp0 > 16
temp1 = temp0
temp1 -= 16
temp0 = 16
else
temp1 = 0
end if
if temp1 > 16
temp1 = 16
end if
temp3 = temp1
temp3 >>= 1
temp3 <<= 5
temp2 = 384
temp2 -= temp3
temp3 >>= 4
if temp3 == temp1
temp2 += 16
else
temp2 -= 16
end if
temp3 = 0
while temp3 < temp1
CreateTempObject(TypeName[Lose Ring], [Link],
[Link], [Link])
Cos(object[tempObjectPos].xvel, temp2)
Sin(object[tempObjectPos].yvel, temp2)
object[tempObjectPos].xvel <<= 8
object[tempObjectPos].yvel <<= 8
object[tempObjectPos].animationSpeed = 256
object[tempObjectPos].inkEffect = INK_ALPHA
object[tempObjectPos].alpha = 256
temp3++
temp2 += 32
loop
temp3 = temp0
temp3 >>= 1
temp3 <<= 5
temp2 = 384
temp2 -= temp3
temp3 >>= 4
if temp3 == temp0
temp2 += 16
else
temp2 -= 16
end if
temp3 = 0
while temp3 < temp0
CreateTempObject(TypeName[Lose Ring], [Link],
[Link], [Link])
Cos(object[tempObjectPos].xvel, temp2)
Sin(object[tempObjectPos].yvel, temp2)
object[tempObjectPos].xvel <<= 9
object[tempObjectPos].yvel <<= 9
object[tempObjectPos].animationSpeed = 256
object[tempObjectPos].inkEffect = INK_ALPHA
object[tempObjectPos].alpha = 256
temp3++
temp2 += 32
loop
object[0].value0 = 0
ringExtraLife = 100
if [Link] == 0
saveRAM[997] = 0
end if
break
case 3
[Link] = 6
[Link] = 0
[Link] = -0x70000
[Link] = 0
[Link] = 0
[Link] = PlayerObject_Death
[Link] = ANI_DYING
[Link] = 0
[Link] = 0
if [Link] == 0
[Link] = PRIORITY_ACTIVE_PAUSED
if object[1].type == TypeName[Player 2 Object]
object[1].priority = PRIORITY_ACTIVE_PAUSED
end if
[Link] = 0
[Link] = 3
end if
if object[+playerCount].type == invincibilityType
object[+playerCount].propertyValue = 3
end if
object[+playerCount].type = TypeName[Blank Object]
break
end switch
end function

function PlayerObject_Knockback
if [Link] == GRAVITY_AIR
[Link] = HITBOX_AUTO
[Link] = HITBOX_AUTO
[Link] = HITBOX_AUTO
[Link] = HITBOX_AUTO
[Link] = 1
if [Link] == 0x3800
[Link] += 0x3000
else
[Link] += 0xF00
end if
[Link] = [Link]
else
[Link] = PlayerObject_HandleGround
[Link] = 0
[Link] = 0
CallFunction(PlayerObject_ResetOnFloor)
end if
end function

function PlayerObject_Death
if [Link] == 0
[Link] = 0
if PlayerObject_SuperState == 1
PlayerObject_SuperState = 2
end if
end if
if [Link] != -1
[Link] = -0x70000
[Link] = -1
end if
if [Link] != 0
[Link] = 0
[Link] = 1
end if
[Link] += 0x3800
if [Link] != ANI_BORED
if [Link] != 46
[Link] = ANI_DYING
end if
end if
if [Link] > 0x100000
if player.isPlayer2 == 0
if [Link] == 0
CheckEqual([Link], 5)
temp0 = checkResult
CheckEqual([Link], 46)
temp0 &= checkResult
if temp0 == 1
[Link] = 0
else
[Link]--
endif
end if
[Link] = 0
[Link] = TypeName[Death Event]
[Link] = 6
object.value1 = [Link]
object.value1 -= 264
object.value2 = [Link]
object.value2 += 200
if [Link] == 2
[Link] = 0
[Link] = 3
else
if [Link] == 0
[Link] = -0xB40
[Link] = 0
PlayMusic(5)
[Link] = 0
else
if TimeOverFlag == 1
[Link] = -0xB40
[Link] = 1
PlayMusic(5)
[Link] = 0
else
[Link] = 0
[Link] = 2
end if
end if
end if
end if
end if
end function

function PlayerObject_Drown
if [Link] == 0
[Link] = 0
if PlayerObject_SuperState == 1
PlayerObject_SuperState = 2
end if
end if
[Link] = -1
[Link] += [Link]
[Link] = ANI_DROWNING
if [Link] > 0x80000
if player.isPlayer2 == 0
if [Link] == 0
[Link]--
end if
[Link] = 0
[Link] = TypeName[Death Event]
[Link] = 6
object.value1 = [Link]
object.value1 -= 264
object.value2 = [Link]
object.value2 += 200
if [Link] == 2
[Link] = 0
[Link] = 3
else
if [Link] == 0
[Link] = -0xB40
[Link] = 0
PlayMusic(5)
[Link] = 0
else
[Link] = 0
[Link] = 2
end if
end if
end if
end if
end function

function PlayerObject_CheckTile
if [Link] == 1
[Link] = FLIP_X
[Link] = -0x20000
[Link] = 30
else
if [Link] == 1
[Link] = FLIP_NONE
[Link] = 0x20000
[Link] = 30
else
[Link] = 0
[Link] = 0
end if
end if
temp1 = [Link]
temp1 >>= 16
temp2 = [Link]
temp2 >>= 16
temp2 += [Link]
Get16x16TileInfo(temp0, temp1, temp2, TILEINFO_ANGLEB)
if temp0 != 3
[Link] = PlayerObject_HandleAir
[Link] = 0
[Link] = 0
[Link] = 0
end if
if [Link] == 1
[Link] = PlayerObject_HandleAir
[Link] = 0
[Link] = 0
[Link] = 0
[Link] += 0x40000
end if
[Link] = [Link]
end function

function PlayerObject_Unknown1
[Link] = 0
CallFunction(PlayerObject_HandleMovement)
[Link] = 34
if [Link] < 0x60000
if [Link] > -0x60000
[Link] = ANI_WALKING
[Link] = PlayerObject_HandleAir
[Link] = 0
if [Link] < 0
[Link] = FLIP_X
end if
end if
end if
if [Link] == 1
if [Link] > 0x199A
[Link] = PlayerObject_RollUnknown
[Link] = ANI_JUMPING
end if
if [Link] < -0x199A
[Link] = PlayerObject_RollUnknown
[Link] = ANI_JUMPING
end if
end if
if [Link] > 0
if [Link] == 16
PlaySfx(SfxName[Destroy], 0)
end if
[Link] = ANI_SKIDDING
[Link]--
end if
if [Link] == 1
CallFunction(PlayerObject_StartJump)
else
CallFunction(PlayerObject_ResetOnFloor)
end if
end function

function PlayerObject_RollUnknown
[Link] = 0
CallFunction(PlayerObject_HandleRolling)
if [Link] < 0x60000
if [Link] > -0x60000
[Link] = PlayerObject_HandleAir
end if
end if
if [Link] == 1
CallFunction(PlayerObject_StartJump)
else
CallFunction(PlayerObject_ResetOnFloor)
end if
end function

function PlayerObject_Unknown2
if [Link] == GRAVITY_AIR
[Link] = PlayerObject_AirCtrlLock
object.value1 = 0
CallFunction(PlayerObject_HandleAirMovement)
else
if [Link] > 0
if [Link] == CMODE_FLOOR
if [Link] < 0x10000
[Link] = 0x40000
end if
end if
else
if [Link] == CMODE_FLOOR
if [Link] > -0x10000
[Link] = -0x40000
end if
end if
end if
if [Link] == 1
if [Link] < 0
[Link] += [Link]
end if
end if
if [Link] == 1
if [Link] > 0
[Link] -= [Link]
end if
end if
if [Link] > 0
[Link] -= [Link]
Sin256(temp0, [Link])
if temp0 > 0
Sin256(temp0, [Link])
temp0 *= 0x5000
else
Sin256(temp0, [Link])
temp0 *= 0x1E00
end if
temp0 >>= 8
[Link] += temp0
else
[Link] += [Link]
Sin256(temp0, [Link])
if temp0 < 0
Sin256(temp0, [Link])
temp0 *= 0x5000
else
Sin256(temp0, [Link])
temp0 *= 0x1E00
end if
temp0 >>= 8
[Link] += temp0
end if
CallFunction(PlayerObject_HandleRollAnimSpd)
[Link] = [Link]
CallFunction(PlayerObject_ResetOnFloor)
end if
end function

function PlayerObject_Clinging
[Link] = GRAVITY_AIR
if [Link] != ANI_CLINGING
[Link] = 0x80000
[Link] = 0x80000
else
[Link] = 0
[Link] = 0
end if
if [Link] == 1
[Link] -= 0x10000
else
if [Link] == 1
[Link] += 0x10000
end if
end if
[Link] = 0
end function

function PlayerObject_WaterSlide
if [Link] == GRAVITY_AIR
[Link] = PlayerObject_HandleAir
[Link] = 0
[Link] = CMODE_FLOOR
object.value1 = 0
CallFunction(PlayerObject_HandleAirMovement)
[Link] = ANI_WATERSLIDE
else
if [Link] == FLIP_NONE
[Link] = 0xA0000
else
[Link] = -0xA0000
end if
CallFunction(PlayerObject_HandleRollAnimSpd)
[Link] = ANI_WATERSLIDE
CallFunction(PlayerObject_ResetOnFloor)
if [Link] == 1
CallFunction(PlayerObject_StartJump)
end if
end if
end function

function PlayerObject_HandleRunSpd2
if [Link] > 0x10000
object.value1 = 0
CallFunction(PlayerObject_MoveAnimate)
end if
end function

function PlayerObject_OuttaHere
if object.value1 < 140
object.value1++
else
object.value1 = 0
[Link] = 5
if [Link] == FLIP_NONE
[Link] = 0x10000
[Link] = 0x10000
else
[Link] = -0x10000
[Link] = -0x10000
end if
[Link] = -0x58000
[Link] = PlayerObject_Death
[Link] = 0
[Link] = 0
if [Link] == 0
[Link] = PRIORITY_ACTIVE_PAUSED
if object[1].type == TypeName[Player 2 Object]
object[1].priority = PRIORITY_ACTIVE_PAUSED
end if
[Link] = 0
[Link] = 3
end if
if object[+playerCount].type == invincibilityType
object[+playerCount].propertyValue = 3
end if
if object[+playerCount].type != goggleType
object[+playerCount].type = TypeName[Blank Object]
end if
endif
end function

function PlayerObject_MoveAnimate
temp0 = [Link]
abs(temp0)

if temp0 < 0x5F5C2


[Link] = ANI_WALKING
CallFunction(PlayerObject_HandleWalkAnimSpd)
else
switch [Link]
case 0 //Sonic
if PlayerObject_SuperState == 1
if temp0 > 0xAFFFF
switch [Link]
case 0
[Link] = ANI_RUNNING
break
case 1
[Link] = ANI_PEELOUT
break
case 2
[Link] = ANI_DASHMANIA
break
end switch
else
[Link] = ANI_RUNNING
end if
else
if temp0 > 0x9FFFF
switch [Link]
case 0
[Link] = ANI_RUNNING
break
case 1
[Link] = ANI_PEELOUT
break
case 2
[Link] = ANI_BDASH2
break
case 3
[Link] = ANI_DASHMANIA
break
end switch
else
if [Link] == 2
if temp0 > 0x7FAE0
[Link] = ANI_BDASH1
else
[Link] = ANI_RUNNING
end if
else
[Link] = ANI_RUNNING
end if
end if
end if
break
case 1 //Tails
if temp0 > 0x9DDDD
switch [Link]
case 0
[Link] = ANI_RUNNING
break
case 1
[Link] = ANI_PEELOUT
break
case 2
[Link] = ANI_DASHMANIA
break
end switch
else
[Link] = ANI_RUNNING
end if
break
case 2 //Knuckles
if temp0 > 0x9FFFF
switch [Link]
case 0
[Link] = ANI_RUNNING
break
case 1
[Link] = ANI_PEELOUT
break
case 2
[Link] = ANI_DASHMANIA
break
end switch
else
[Link] = ANI_RUNNING
end if
break
case 5 //Amy
if temp0 > 0x9FFFF
switch [Link]
case 0
[Link] = ANI_RUNNING
break
case 1
[Link] = ANI_PEELOUT
break
case 2
[Link] = 44
break
end switch
else
[Link] = ANI_RUNNING
end if
break
end switch
CallFunction(PlayerObject_HandleRunAnimSpd)
end if
end function

event ObjectMain
if SuperTimeAttack == 2
SuperTimeAttack = 1
currentPlayer = 0
CallFunction(PlayerObject_SuperTransform)
end if
if [Link] == 1
CallFunction(PlayerObject_ProcessPlayer)
CheckEqual([Link], 0)
temp0 = checkResult
CheckEqual([Link], 1)
temp0 &= checkResult
if temp0 == 1

CheckEqual([Link], ANI_DROWNING)
temp1 = checkResult
CheckEqual([Link], ANI_DYING)
temp1 |= checkResult
if temp1 == 1
[Link] = 1
[Link] = 1
end if

[Link] = TypeName[Debug Mode]


[Link] = 0
[Link] = PlayerObject_Blank
[Link] = 0
[Link] = 0
[Link] = 0
[Link] = 4
[Link] = PRIORITY_ACTIVE
[Link] = 0
[Link] = 1
object.value2 = 0
[Link] = 0
[Link] = 0
[Link] = [Link]
[Link] = 1
[Link] = 0
[Link] = HITBOX_AUTO
[Link] = HITBOX_AUTO
[Link] = HITBOX_AUTO
[Link] = HITBOX_AUTO
if [Link] == 3
[Link] = STAGE_RUNNING
end if
[Link] = 1
if object[1].type == TypeName[Player 2 Object]
object[1].priority = PRIORITY_ACTIVE
end if
if object[+playerCount].propertyValue == 3
object[+playerCount].type = invincibilityType
object[+playerCount].propertyValue = 0
end if
else
if [Link] == GRAVITY_GROUND
[Link] = 0
end if
CallFunction([Link])
ProcessAnimation()
if [Link] == [Link]
if [Link] == ANI_JUMPING
[Link] = [Link]
else
if [Link] == [Link]
[Link] = 0
[Link] += [Link]
end if
end if
end if
if [Link] == 0
temp0 = [Link]
[Link] = [Link]
ProcessObjectMovement()
[Link] ^= 1
CheckEqual([Link], GRAVITY_GROUND)
[Link] |= checkResult
[Link] ^= 1
if temp0 == 1
if [Link] == 0
[Link] = 0
achieveRingCount = 0
if [Link] == ANI_JUMPING
if [Link] == 0
if [Link] !=
PlayerObject_BubbleBounce
if [Link] !=
PlayerObject_HandleRoll
if [Link] !=
PlayerObject_Unknown2
//if
[Link] < 21

[Link] = ANI_WALKING
if
[Link] == [Link]

[Link] = 0
end if
[Link]
+= [Link]
//end if
end if
end if
end if
end if
end if
end if
end if
else
[Link] = 0
end if
end if
else
CallFunction(PlayerObject_ProcessPlayer)
if [Link] == GRAVITY_GROUND
[Link] = 0
end if
CallFunction([Link])
ProcessAnimation()
if [Link] == [Link]
if [Link] == ANI_JUMPING
[Link] = [Link]
else
if [Link] == [Link]
[Link] = 0
[Link] += [Link]
end if
end if
end if
if [Link] == 0
temp0 = [Link]
[Link] = [Link]
ProcessObjectMovement()
[Link] ^= 1
CheckEqual([Link], GRAVITY_GROUND)
[Link] |= checkResult
[Link] ^= 1
if temp0 == 1
if [Link] == 0
[Link] = 0
achieveRingCount = 0
if [Link] == ANI_JUMPING
if [Link] == 0
if [Link] !=
PlayerObject_BubbleBounce
if [Link] !=
PlayerObject_HandleRoll
if [Link] !=
PlayerObject_Unknown2
if [Link]
< 21
[Link] =
ANI_WALKING
if
[Link] == [Link]

[Link] = 0
end if
[Link] +=
[Link]
end if
end if
end if
end if
end if
end if
end if
end if
else
[Link] = 0
end if
end if
CallFunction(PlayerObject_ProcessSuperForms)

if [Link] == 1
if [Link] == 2
if [Link] == 1
[Link] = 0
ResetObjectEntity(11, TypeName[Title Card], 0, 0, 0)
object[11].state = 10
object[11].priority = PRIORITY_ACTIVE
object[11].drawOrder = 6
[Link] = 80
[Link] = 0
end if
else
if PlayerObject_SuperState == 1
if [Link] != ANI_SUPER_TRANSFORM
if [Link] == 1
CallFunction(PlayerObject_EndSuper)
end if
end if
end if
end if
end if
end event

event ObjectDraw
if [Link] >= 21
CheckEqual([Link],ANI_JUMPING)
temp0 = checkResult
CheckEqual([Link],ANI_WALKING)
temp0 |= checkResult
CheckEqual([Link],ANI_STOPPED)
temp0 |= checkResult
if temp0 == 0
[Link] = 0
end if
else
temp0 = 0
end if

if temp0 == 1
object.value2++
object.value2 %= 8

DrawSpriteFX(object.value2 , FX_FLIP, [Link], [Link])


else
if [Link] != [Link]
[Link] = [Link]
[Link] = 0
[Link] = 0
[Link] = 0
end if

if [Link] == 0
CallFunction(PlayerObject_Force45)
else
CallFunction(PlayerObject_ManiaRotate)
//DrawObjectAnimation()
end if
end if
end event

function PlayerObject_Force45
if [Link] == GRAVITY_AIR
CheckEqual([Link], 5)
temp0 = checkResult
CheckEqual([Link], ANI_HAMMER_JUMP)
temp0 &= checkResult
if temp0 == 1
if [Link] == 0
[Link] += [Link]
else
[Link] -= [Link]
end if
else
if [Link] < 256
if [Link] > 3
[Link] -= 4
else
[Link] = 0
end if
else
if [Link] < 509
[Link] += 4
else
[Link] = 0
end if
end if
end if
end if
temp0 = [Link]
if [Link] >= 0x100
temp1 = 532
temp1 -= [Link]
temp1 >>= 6
[Link] = 8
[Link] -= temp1
else
[Link] += 20
[Link] >>= 6
end if
if [Link] == 8
[Link] = 0
end if
[Link] <<= 6
DrawObjectAnimation()
[Link] = temp0
end function

function PlayerObject_ManiaRotate
temp0 = [Link]
if [Link] == GRAVITY_GROUND
if [Link] < 0x04
[Link] = 0
else
if [Link] > 0xFC
[Link] = 0
else
temp1 = 0
if [Link] > 0x10
if [Link] < 0xE8
temp1 = [Link]
temp1 <<= 1
end if
end if
temp2 = temp1
temp2 -= [Link]
temp3 = 1
temp4 = [Link]
abs(temp4)
if temp4 <= 0x60000
temp3++
end if
temp4 = temp2
abs(temp4)
temp5 = temp2
temp5 -= 0x200
abs(temp5)
if temp4 >= temp5
temp4 = temp2
temp4 += 0x200
abs(temp4)
if temp5 < temp4
temp4 = temp2
temp4 -= 0x200
temp4 >>= temp3
[Link] += temp4
else
temp4 = temp2
temp4 += 0x200
temp4 >>= temp3
[Link] += temp4
end if
else
temp5 = temp2
temp5 += 0x200
if temp4 < temp5
temp4 = temp2
temp4 >>= temp3
[Link] += temp4
else
temp4 = temp2
temp4 += 0x200
temp4 >>= temp3
[Link] += temp4
end if
end if
end if
end if
else
CheckEqual([Link], 5)
temp0 = checkResult
CheckEqual([Link], ANI_HAMMER_JUMP)
temp0 &= checkResult
if temp0 == 1
if [Link] == 0
[Link] += [Link]
else
[Link] -= [Link]
end if
temp0 = [Link]
else
if [Link] < 256
if [Link] > 3
[Link] -= 4
else
[Link] = 0
end if
else
if [Link] < 509
[Link] += 4
else
[Link] = 0
end if
end if
end if
end if
[Link] &= 0x1FF
[Link] = [Link]
DrawObjectAnimation()
[Link] = temp0
end function

event ObjectStartup
playerCount = 0
foreach (TypeName[Player Object], arrayPos0, ALL_ENTITIES)
[Link] = 1
[Link] = 0
[Link] = 0
currentPlayer = 0
switch [Link]
case 3
[Link] = 0
stage.player2Enabled = 1
break
case 4
[Link] = 2
stage.player2Enabled = 1
break
case 100
[Link] = 0
SuperTimeAttack = 1
break
end switch

ResetObjectEntity(0, TypeName[Player Object], 0,


object[arrayPos0].xpos, object[arrayPos0].ypos)
[Link] = object[0].ixpos
[Link] = object[0].iypos
object[0].groupID = GROUP_PLAYERS
object[0].state = PlayerObject_HandleAir
object[0].priority = PRIORITY_ACTIVE
object[0].drawOrder = -1
object[0].value18 = 4
object[0].value31 = 0x2000

if SuperTimeAttack == 1 //Super Sonic Time Attack


object[0].value0 = 20
end if

switch [Link]
case 0
if [Link] == 0
object[0].value33 = PlayerObject_StartJump
else
object[0].value33 = PlayerObject_StartSpindash
end if
break
case 1
object[0].value33 = PlayerObject_StartSpindash
break
case 2
object[0].value33 = PlayerObject_StartSpindashCD
break
end switch

if [Link] == 5
if [Link] == 1
object[0].value33 = PlayerObject_StartHop
end if
end if
object[0].value38 = HITBOX_AUTO
object[0].value39 = HITBOX_AUTO
object[0].value40 = HITBOX_AUTO
object[0].value41 = HITBOX_AUTO
PlayerObject_SuperState = 0
PlayerObject_value1 = 0
PlayerObject_value2 = 0
PlayerObject_value3 = 0

switch [Link]
case 0
LoadAnimation("[Link]")
LoadAnimation("[Link]")
CallFunction(PlayerObject_HandleSuperPalSonic)
object[0].propertyValue = 0
object[0].value30 = -5
object[0].value32 = PlayerObject_HandleShieldAbilities
break
case 1
object[0].type = TypeName[Tails Object]
object[0].propertyValue = 1
CallFunction(PlayerObject_HandleSuperPalTails)
LoadAnimation("[Link]")
object[0].value30 = -1
object[0].value32 = PlayerObject_StartTailsFlight
stage.player2Enabled = 0
break
case 2
LoadAnimation("[Link]")
CallFunction(PlayerObject_HandleSuperPalKnux)
object[0].propertyValue = 2
object[0].value30 = -5
object[0].value32 = PlayerObject_StartKnuxGlide
break
case 5
LoadAnimation("[Link]")
CallFunction(PlayerObject_HandleSuperPalAmy)
object[0].propertyValue = 5
object[0].value30 = -5
object[0].value32 = PlayerObject_StartHammerSpin
stage.player2Enabled = 0
break
end switch

if [Link] == 1
ANI_BOUNCING = ANI_SPEEN
else
ANI_BOUNCING = 11
end if

if stage.player2Enabled == 1
playerCount = 2
else
playerCount = 1
end if
currentPlayer = 0
CallFunction(PlayerObject_SwapPhysics)
ResetObjectEntity(arrayPos0, TypeName[Blank Object], 0, 0, 0)
next
goggleType = TypeName[Goggles]

LoadSpriteSheet("Players/[Link]")
//DropDash Sprites
SpriteFrame(-16, -16, 32, 32, 1, 180) //0
SpriteFrame(-16, -16, 32, 32, 34, 180) //1
SpriteFrame(-16, -16, 32, 32, 1, 213) //2
SpriteFrame(-16, -16, 32, 32, 67, 180) //3
SpriteFrame(-16, -16, 32, 32, 1, 180) //4
SpriteFrame(-16, -16, 32, 32, 100, 180) //5
SpriteFrame(-16, -16, 32, 32, 1, 213) //6
SpriteFrame(-16, -16, 32, 32, 133, 180) //7
end event

event RSDKDraw
DrawSprite(0)
end event

event RSDKLoad
LoadSpriteSheet("Players/[Link]")
SpriteFrame(-16, -19, 28, 39, 1, 1)
end event

You might also like