fully working walk/run/mach bike/acro bike regular movement
This commit is contained in:
parent
31e9f97d52
commit
e4674ccd03
@ -1,8 +1,6 @@
|
||||
#ifndef GUARD_CONSTANTS_EVENT_OBJECT_MOVEMENT_H
|
||||
#define GUARD_CONSTANTS_EVENT_OBJECT_MOVEMENT_H
|
||||
|
||||
#define SLOW_MOVEMENT_ON_STAIRS TRUE // change to false to keep emerald's normal movement speed on outdoor stairs
|
||||
|
||||
#define MOVEMENT_TYPE_NONE 0x0
|
||||
#define MOVEMENT_TYPE_LOOK_AROUND 0x1
|
||||
#define MOVEMENT_TYPE_WANDER_AROUND 0x2
|
||||
@ -265,7 +263,6 @@
|
||||
#define MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN_RIGHT 0xAD
|
||||
//sideways stairs - mach bike
|
||||
|
||||
|
||||
#define MOVEMENT_ACTION_STEP_END 0xFE
|
||||
|
||||
#endif // GUARD_CONSTANTS_EVENT_OBJECT_MOVEMENT_H
|
||||
|
||||
@ -118,4 +118,6 @@
|
||||
#define DIR_NORTHWEST 7
|
||||
#define DIR_NORTHEAST 8
|
||||
|
||||
#define SLOW_MOVEMENT_ON_STAIRS TRUE // change to false to keep emerald's normal movement speed on outdoor stairs
|
||||
|
||||
#endif // GUARD_CONSTANTS_GLOBAL_H
|
||||
|
||||
@ -74,13 +74,13 @@
|
||||
#define MB_SLIDE_NORTH 0x46
|
||||
#define MB_SLIDE_SOUTH 0x47
|
||||
#define MB_TRICK_HOUSE_PUZZLE_8_FLOOR 0x48
|
||||
#define MB_SIDEWAYS_STAIRS_RIGHT 0x49
|
||||
#define MB_SIDEWAYS_STAIRS_LEFT 0x4A
|
||||
#define MB_ROCK_STAIRS 0x4B
|
||||
#define MB_UNUSED_4C 0x4C
|
||||
#define MB_UNUSED_4D 0x4D
|
||||
#define MB_UNUSED_4E 0x4E
|
||||
#define MB_UNUSED_4F 0x4F
|
||||
#define MB_SIDEWAYS_STAIRS_RIGHT_SIDE 0x49
|
||||
#define MB_SIDEWAYS_STAIRS_LEFT_SIDE 0x4A
|
||||
#define MB_SIDEWAYS_STAIRS_RIGHT_SIDE_TOP 0x4B
|
||||
#define MB_SIDEWAYS_STAIRS_LEFT_SIDE_TOP 0x4C
|
||||
#define MB_SIDEWAYS_STAIRS_RIGHT_SIDE_BOTTOM 0x4D
|
||||
#define MB_SIDEWAYS_STAIRS_LEFT_SIDE_BOTTOM 0x4E
|
||||
#define MB_ROCK_STAIRS 0x4F
|
||||
#define MB_EASTWARD_CURRENT 0x50
|
||||
#define MB_WESTWARD_CURRENT 0x51
|
||||
#define MB_NORTHWARD_CURRENT 0x52
|
||||
|
||||
@ -66,12 +66,12 @@ u8 player_get_pos_including_state_based_drift(s16 *x, s16 *y);
|
||||
void StartFishing(u8 rod);
|
||||
bool32 PlayerIsMovingOnRockStairs(u8 direction);
|
||||
//sideways stairs
|
||||
u8 GetRightStairsDirection(u8 direction);
|
||||
u8 GetLeftStairsDirection(u8 direction);
|
||||
void PlayerSidewaysStairsToRight(u8 direction);
|
||||
void PlayerSidewaysStairsToLeft(u8 direction);
|
||||
void PlayerSidewaysStairsToRightRunning(u8 direction);
|
||||
void PlayerSidewaysStairsToLeftRunning(u8 direction);
|
||||
u8 GetRightSideStairsDirection(u8 direction);
|
||||
u8 GetLeftSideStairsDirection(u8 direction);
|
||||
void PlayerSidewaysStairsRightSide(u8 direction);
|
||||
void PlayerSidewaysStairsLeftSide(u8 direction);
|
||||
void PlayerSidewaysStairsRightSideRunning(u8 direction);
|
||||
void PlayerSidewaysStairsLeftSideRunning(u8 direction);
|
||||
void PlayerSidewaysStairsToAcroBikeLeft(u8 direction);
|
||||
void PlayerSidewaysStairsToAcroBikeRight(u8 direction);
|
||||
|
||||
|
||||
@ -279,10 +279,8 @@ enum
|
||||
COLLISION_VERTICAL_RAIL,
|
||||
COLLISION_HORIZONTAL_RAIL,
|
||||
//sideways_stairs
|
||||
COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_WALKING,
|
||||
COLLISION_SIDEWAYS_STAIRS_TO_LEFT_WALKING,
|
||||
COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_RUNNING,
|
||||
COLLISION_SIDEWAYS_STAIRS_TO_LEFT_RUNNING,
|
||||
COLLISION_SIDEWAYS_STAIRS_TO_RIGHT,
|
||||
COLLISION_SIDEWAYS_STAIRS_TO_LEFT
|
||||
};
|
||||
|
||||
// player running states
|
||||
|
||||
@ -147,7 +147,13 @@ bool8 MetatileBehavior_IsLongGrassSouthEdge(u8);
|
||||
bool8 MetatileBehavior_IsTrainerHillTimer(u8);
|
||||
bool8 MetatileBehavior_IsRockStairs(u8 metatileBehavior);
|
||||
//sideways stairs
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRight(u8);
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeft(u8);
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRightSide(u8);
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeftSide(u8);
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRightSideTop(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeftSideTop(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRightSideBottom(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeftSideBottom(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRightSideAny(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeftSideAny(u8 metatileBehavior);
|
||||
|
||||
#endif // GUARD_METATILE_BEHAVIOR
|
||||
|
||||
51
src/bike.c
51
src/bike.c
@ -240,25 +240,24 @@ static void MachBikeTransition_TrySpeedUp(u8 direction)
|
||||
PlayerOnBikeCollide(direction);
|
||||
}
|
||||
}
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT_WALKING)
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT)
|
||||
{
|
||||
gPlayerAvatar.bikeFrameCounter = 0;
|
||||
gPlayerAvatar.bikeSpeed = SPEED_STANDING;
|
||||
PlayerGoSpeed2(GetLeftStairsDirection(direction));
|
||||
PlayerGoSpeed2(GetLeftSideStairsDirection(direction));
|
||||
//PlayerSidewaysStairsToAcroBikeLeft(direction);
|
||||
return;
|
||||
}
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_WALKING)
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT)
|
||||
{
|
||||
gPlayerAvatar.bikeFrameCounter = 0;
|
||||
gPlayerAvatar.bikeSpeed = SPEED_STANDING;
|
||||
//PlayerSidewaysStairsToAcroBikeRight(direction);
|
||||
PlayerGoSpeed2(GetRightStairsDirection(direction));
|
||||
PlayerGoSpeed2(GetRightSideStairsDirection(direction));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// to do: this sometimes crashes based on the metatile behaviours (eg. holding up while traveling down sideways stairs to sw)
|
||||
if (PlayerIsMovingOnRockStairs(direction))
|
||||
gPlayerAvatar.bikeFrameCounter--;
|
||||
|
||||
@ -296,15 +295,14 @@ static void MachBikeTransition_TrySlowDown(u8 direction)
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT_WALKING)
|
||||
/*if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT)
|
||||
{
|
||||
return PlayerGoSpeed2(GetLeftStairsDirection(direction));
|
||||
return PlayerGoSpeed2(GetLeftSideStairsDirection(direction));
|
||||
//return PlayerSidewaysStairsToLeftMachBike(direction);
|
||||
}
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_WALKING)
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT)
|
||||
{
|
||||
return PlayerGoSpeed2(GetRightStairsDirection(direction));
|
||||
return PlayerGoSpeed2(GetRightSideStairsDirection(direction));
|
||||
//return PlayerSidewaysStairsToRightMachBike(direction);
|
||||
}*/
|
||||
|
||||
@ -315,6 +313,7 @@ static void MachBikeTransition_TrySlowDown(u8 direction)
|
||||
// the acro bike requires the input handler to be executed before the transition can.
|
||||
static void MovePlayerOnAcroBike(u8 newDirection, u16 newKeys, u16 heldKeys)
|
||||
{
|
||||
|
||||
sAcroBikeTransitions[CheckMovementInputAcroBike(&newDirection, newKeys, heldKeys)](newDirection);
|
||||
}
|
||||
|
||||
@ -603,10 +602,10 @@ static void AcroBikeTransition_Moving(u8 direction)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_WALKING)
|
||||
return PlayerGoSpeed2(GetRightStairsDirection(direction));
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT_WALKING)
|
||||
return PlayerGoSpeed2(GetLeftStairsDirection(direction));
|
||||
if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT)
|
||||
return PlayerGoSpeed2(GetRightSideStairsDirection(direction));
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT)
|
||||
return PlayerGoSpeed2(GetLeftSideStairsDirection(direction));
|
||||
|
||||
if (PlayerIsMovingOnRockStairs(direction))
|
||||
PlayerGoSpeed2(direction);
|
||||
@ -614,10 +613,10 @@ static void AcroBikeTransition_Moving(u8 direction)
|
||||
PlayerRideWaterCurrent(direction);
|
||||
|
||||
/* works, but might be better to keep rock stairs to up/down for mach bike
|
||||
if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_WALKING)
|
||||
direction = GetRightStairsDirection(direction);
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT_WALKING)
|
||||
direction = GetLeftStairsDirection(direction);
|
||||
if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT)
|
||||
direction = GetRightSideStairsDirection(direction);
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT)
|
||||
direction = GetLeftSideStairsDirection(direction);
|
||||
|
||||
if (PlayerIsMovingOnRockStairs(direction))
|
||||
PlayerGoSpeed2(direction);
|
||||
@ -692,10 +691,10 @@ static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
|
||||
else
|
||||
{
|
||||
derp:
|
||||
/*if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT_WALKING)
|
||||
direction = GetLeftStairsDirection(direction);
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_WALKING)
|
||||
direction = GetRightStairsDirection(direction);
|
||||
/*if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT)
|
||||
direction = GetLeftSideStairsDirection(direction);
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT)
|
||||
direction = GetRightSideStairsDirection(direction);
|
||||
*/
|
||||
PlayerMovingHoppingWheelie(direction);
|
||||
}
|
||||
@ -765,10 +764,10 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT_WALKING)
|
||||
direction = GetLeftStairsDirection(direction);
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_WALKING)
|
||||
direction = GetRightStairsDirection(direction);*/
|
||||
/*if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT)
|
||||
direction = GetLeftSideStairsDirection(direction);
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT)
|
||||
direction = GetRightSideStairsDirection(direction);*/
|
||||
|
||||
PlayerWheelieMove(direction);
|
||||
gPlayerAvatar.runningState = MOVING;
|
||||
|
||||
@ -1122,34 +1122,34 @@ const u8 gRunSlowMovementActions[] = {
|
||||
};
|
||||
|
||||
// sideways stairs
|
||||
const u8 gDiagonalStairRightMovementActions[] = {
|
||||
[DIR_NONE] = MOVEMENT_ACTION_JUMP_2_RIGHT,
|
||||
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_2_DOWN,
|
||||
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_2_UP,
|
||||
const u8 gDiagonalStairLeftSideMovementActions[] = { //movement actions for stairs on left side of a wall (southwest and northeast)
|
||||
[DIR_NONE] = MOVEMENT_ACTION_WALK_SLOW_DOWN,
|
||||
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_SLOW_DOWN,
|
||||
[DIR_NORTH] = MOVEMENT_ACTION_RUN_UP_SLOW,
|
||||
[DIR_WEST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_DOWN_LEFT,
|
||||
[DIR_EAST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_UP_RIGHT,
|
||||
};
|
||||
const u8 gDiagonalStairLeftMovementActions[] = {
|
||||
[DIR_NONE] = MOVEMENT_ACTION_JUMP_2_LEFT,
|
||||
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_2_DOWN,
|
||||
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_2_UP,
|
||||
const u8 gDiagonalStairRightSideMovementActions[] = { //movement actions for stairs on right side of a wall (southeast and northwest)
|
||||
[DIR_NONE] = MOVEMENT_ACTION_WALK_SLOW_DOWN,
|
||||
[DIR_SOUTH] = MOVEMENT_ACTION_WALK_SLOW_DOWN,
|
||||
[DIR_NORTH] = MOVEMENT_ACTION_RUN_UP_SLOW,
|
||||
[DIR_WEST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_UP_LEFT,
|
||||
[DIR_EAST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_DOWN_RIGHT,
|
||||
};
|
||||
const u8 gDiagonalStairRightRunningMovementActions[] = {
|
||||
[DIR_NONE] = MOVEMENT_ACTION_JUMP_2_RIGHT,
|
||||
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_2_DOWN,
|
||||
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_2_UP,
|
||||
[DIR_WEST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_DOWN_LEFT_RUNNING,
|
||||
[DIR_EAST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_UP_RIGHT_RUNNING,
|
||||
};
|
||||
const u8 gDiagonalStairLeftRunningMovementActions[] = {
|
||||
[DIR_NONE] = MOVEMENT_ACTION_JUMP_2_LEFT,
|
||||
[DIR_SOUTH] = MOVEMENT_ACTION_JUMP_2_DOWN,
|
||||
[DIR_NORTH] = MOVEMENT_ACTION_JUMP_2_UP,
|
||||
const u8 gDiagonalStairRightSideRunningMovementActions[] = {
|
||||
[DIR_NONE] = MOVEMENT_ACTION_RUN_DOWN_SLOW,
|
||||
[DIR_SOUTH] = MOVEMENT_ACTION_RUN_DOWN_SLOW,
|
||||
[DIR_NORTH] = MOVEMENT_ACTION_RUN_UP_SLOW,
|
||||
[DIR_WEST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_UP_LEFT_RUNNING,
|
||||
[DIR_EAST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_DOWN_RIGHT_RUNNING,
|
||||
};
|
||||
const u8 gDiagonalStairLeftSideRunningMovementActions[] = {
|
||||
[DIR_NONE] = MOVEMENT_ACTION_RUN_DOWN_SLOW,
|
||||
[DIR_SOUTH] = MOVEMENT_ACTION_RUN_DOWN_SLOW,
|
||||
[DIR_NORTH] = MOVEMENT_ACTION_RUN_UP_SLOW,
|
||||
[DIR_WEST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_DOWN_LEFT_RUNNING,
|
||||
[DIR_EAST] = MOVEMENT_ACTION_WALK_STAIRS_DIAGONAL_UP_RIGHT_RUNNING,
|
||||
};
|
||||
const u8 gDiagonalStairLeftAcroBikeMovementActions[] = {
|
||||
[DIR_NONE] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT,
|
||||
[DIR_SOUTH] = MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT,
|
||||
@ -5160,10 +5160,10 @@ u8 name(u32 idx)\
|
||||
}
|
||||
|
||||
//sideways stairs
|
||||
dirn_to_anim(GetDiagonalRightStairsMovement, gDiagonalStairRightMovementActions);
|
||||
dirn_to_anim(GetDiagonalLeftStairsMovement, gDiagonalStairLeftMovementActions);
|
||||
dirn_to_anim(GetDiagonalRightStairsRunningMovement, gDiagonalStairRightRunningMovementActions);
|
||||
dirn_to_anim(GetDiagonalLeftStairsRunningMovement, gDiagonalStairLeftRunningMovementActions);
|
||||
dirn_to_anim(GetDiagonalRightStairsMovement, gDiagonalStairRightSideMovementActions);
|
||||
dirn_to_anim(GetDiagonalLeftStairsMovement, gDiagonalStairLeftSideMovementActions);
|
||||
dirn_to_anim(GetDiagonalRightStairsRunningMovement, gDiagonalStairRightSideRunningMovementActions);
|
||||
dirn_to_anim(GetDiagonalLeftStairsRunningMovement, gDiagonalStairLeftSideRunningMovementActions);
|
||||
dirn_to_anim(GetDiagonalLeftAcroBikeMovement, gDiagonalStairLeftAcroBikeMovementActions);
|
||||
dirn_to_anim(GetDiagonalRightAcroBikeMovement, gDiagonalStairRightAcroBikeMovementActions);
|
||||
|
||||
@ -9227,57 +9227,63 @@ bool8 MovementActionFunc_RunSlow_Step1(struct ObjectEvent *objectEvent, struct S
|
||||
}
|
||||
|
||||
//sideways stairs
|
||||
/*
|
||||
u8 GetSidewaysStairsToRightDirection(s16 x, s16 y, u8 z)
|
||||
{
|
||||
static bool8 (*const direction[])(u8) = {
|
||||
static bool8 (*const sRightStairsBehaviors[])(u8) = {
|
||||
MetatileBehavior_IsWalkSouth,
|
||||
MetatileBehavior_IsWalkNorth,
|
||||
MetatileBehavior_IsSidewaysStairsRight,
|
||||
MetatileBehavior_IsSidewaysStairsRight,
|
||||
};
|
||||
|
||||
u8 b;
|
||||
u8 metatileBehavior;
|
||||
u8 index = z;
|
||||
|
||||
if (index == 0)
|
||||
return 0;
|
||||
else if (index > 4)
|
||||
index -= 4;
|
||||
if (index == DIR_NONE)
|
||||
return DIR_NONE;
|
||||
else if (index > DIR_EAST)
|
||||
index -= DIR_EAST;
|
||||
|
||||
index--;
|
||||
b = MapGridGetMetatileBehaviorAt(x, y);
|
||||
|
||||
if (direction[index](b) == 1)
|
||||
metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
if (MetatileBehavior_IsEastBlocked(metatileBehavior))
|
||||
return DIR_NONE;
|
||||
|
||||
if (sRightStairsBehaviors[index](metatileBehavior))
|
||||
return index + 1;
|
||||
|
||||
return 0;
|
||||
return DIR_NONE;
|
||||
}
|
||||
|
||||
u8 GetSidewaysStairsToLeftDirection(s16 x, s16 y, u8 z)
|
||||
{
|
||||
static bool8 (*const direction[])(u8) = {
|
||||
static bool8 (*const sLeftStairsBehaviors[])(u8) = {
|
||||
MetatileBehavior_IsWalkSouth,
|
||||
MetatileBehavior_IsWalkNorth,
|
||||
MetatileBehavior_IsSidewaysStairsLeft,
|
||||
MetatileBehavior_IsSidewaysStairsLeft,
|
||||
};
|
||||
|
||||
u8 b;
|
||||
u8 metatileBehavior;
|
||||
u8 index = z;
|
||||
|
||||
if (index == 0)
|
||||
return 0;
|
||||
if (index == DIR_NONE)
|
||||
return DIR_NONE;
|
||||
else if (index > 4)
|
||||
index -= 4;
|
||||
|
||||
index--;
|
||||
b = MapGridGetMetatileBehaviorAt(x, y);
|
||||
metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
if (MetatileBehavior_IsWestBlocked(metatileBehavior))
|
||||
return DIR_NONE;
|
||||
|
||||
if (direction[index](b) == 1)
|
||||
if (sLeftStairsBehaviors[index](metatileBehavior) == 1)
|
||||
return index + 1;
|
||||
|
||||
return 0;
|
||||
return DIR_NONE;
|
||||
}
|
||||
*/
|
||||
|
||||
bool8 MovementAction_WalkStairDiagonalUpLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
|
||||
@ -624,24 +624,20 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
|
||||
PlayerNotOnBikeCollideWithFarawayIslandMew(direction);
|
||||
return;
|
||||
}
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_WALKING)
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT)
|
||||
{
|
||||
PlayerSidewaysStairsToRight(direction);
|
||||
if (heldKeys & B_BUTTON && FlagGet(FLAG_SYS_B_DASH))
|
||||
PlayerSidewaysStairsRightSideRunning(direction);
|
||||
else
|
||||
PlayerSidewaysStairsRightSide(direction);
|
||||
return;
|
||||
}
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT_WALKING)
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT)
|
||||
{
|
||||
PlayerSidewaysStairsToLeft(direction);
|
||||
return;
|
||||
}
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_RUNNING)
|
||||
{
|
||||
PlayerSidewaysStairsToRightRunning(direction);
|
||||
return;
|
||||
}
|
||||
else if (collision == COLLISION_SIDEWAYS_STAIRS_TO_LEFT_RUNNING)
|
||||
{
|
||||
PlayerSidewaysStairsToLeftRunning(direction);
|
||||
if (heldKeys & B_BUTTON && FlagGet(FLAG_SYS_B_DASH))
|
||||
return PlayerSidewaysStairsLeftSideRunning(direction);
|
||||
else
|
||||
return PlayerSidewaysStairsLeftSide(direction);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -748,6 +744,8 @@ static u8 sub_808B028(u8 direction)
|
||||
u8 CheckForObjectEventCollision(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior)
|
||||
{
|
||||
u8 collision = GetCollisionAtCoords(objectEvent, x, y, direction);
|
||||
u8 currentBehavior = MapGridGetMetatileBehaviorAt(objectEvent->currentCoords.x, objectEvent->currentCoords.y);
|
||||
|
||||
if (collision == COLLISION_ELEVATION_MISMATCH && CanStopSurfing(x, y, direction))
|
||||
return COLLISION_STOP_SURFING;
|
||||
|
||||
@ -766,25 +764,50 @@ u8 CheckForObjectEventCollision(struct ObjectEvent *objectEvent, s16 x, s16 y, u
|
||||
CheckAcroBikeCollision(x, y, metatileBehavior, &collision);
|
||||
}
|
||||
|
||||
if (collision != COLLISION_IMPASSABLE)
|
||||
//sideways stairs logic
|
||||
if (MetatileBehavior_IsSidewaysStairsLeftSideTop(metatileBehavior) && direction == DIR_EAST)
|
||||
return COLLISION_IMPASSABLE; //moving onto left-side top edge east from ground -> cannot move
|
||||
else if (MetatileBehavior_IsSidewaysStairsRightSideTop(metatileBehavior) && direction == DIR_WEST)
|
||||
return COLLISION_IMPASSABLE; //moving onto left-side top edge east from ground -> cannot move
|
||||
else if (MetatileBehavior_IsSidewaysStairsRightSideBottom(metatileBehavior) && (direction == DIR_EAST || direction == DIR_SOUTH))
|
||||
return COLLISION_IMPASSABLE;
|
||||
else if (MetatileBehavior_IsSidewaysStairsLeftSideBottom(metatileBehavior) && (direction == DIR_WEST || direction == DIR_SOUTH))
|
||||
return COLLISION_IMPASSABLE;
|
||||
|
||||
if (MetatileBehavior_IsSidewaysStairsLeftSide(metatileBehavior))
|
||||
{
|
||||
if (IsSidewaysStairToRight(x, y, direction))
|
||||
{
|
||||
if (gMain.heldKeys & B_BUTTON)
|
||||
return COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_RUNNING;
|
||||
else
|
||||
return COLLISION_SIDEWAYS_STAIRS_TO_RIGHT_WALKING;
|
||||
}
|
||||
else if (IsSidewaysStairToLeft(x, y, direction))
|
||||
{
|
||||
if (gMain.heldKeys & B_BUTTON)
|
||||
return COLLISION_SIDEWAYS_STAIRS_TO_LEFT_RUNNING;
|
||||
else
|
||||
return COLLISION_SIDEWAYS_STAIRS_TO_LEFT_WALKING;
|
||||
}
|
||||
//moving ONTO left side stair
|
||||
if (direction == DIR_WEST && currentBehavior != metatileBehavior)
|
||||
return collision; //moving onto top part of left-stair going left, so no diagonal
|
||||
else
|
||||
return COLLISION_SIDEWAYS_STAIRS_TO_LEFT; // move diagonally
|
||||
}
|
||||
else if (MetatileBehavior_IsSidewaysStairsRightSide(metatileBehavior))
|
||||
{
|
||||
//moving ONTO right side stair
|
||||
if (direction == DIR_EAST && currentBehavior != metatileBehavior)
|
||||
return collision; //moving onto top part of right-stair going right, so no diagonal
|
||||
else
|
||||
return COLLISION_SIDEWAYS_STAIRS_TO_RIGHT;
|
||||
}
|
||||
else if (MetatileBehavior_IsSidewaysStairsLeftSideAny(currentBehavior))
|
||||
{
|
||||
//moving OFF of any left side stair
|
||||
if (direction == DIR_WEST && metatileBehavior != currentBehavior)
|
||||
return COLLISION_SIDEWAYS_STAIRS_TO_LEFT; //moving off of left stairs onto non-stair -> move diagonal
|
||||
else
|
||||
return collision; //moving off of left side stair to east -> move east
|
||||
}
|
||||
else if (MetatileBehavior_IsSidewaysStairsRightSideAny(currentBehavior))
|
||||
{
|
||||
//moving OFF of any right side stair
|
||||
if (direction == DIR_EAST && metatileBehavior != currentBehavior)
|
||||
return COLLISION_SIDEWAYS_STAIRS_TO_RIGHT; //moving off right stair onto non-stair -> move diagonal
|
||||
else
|
||||
return collision;
|
||||
}
|
||||
|
||||
return collision;
|
||||
return collision;
|
||||
}
|
||||
|
||||
static u8 sub_808B164(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior)
|
||||
@ -2321,6 +2344,7 @@ static u8 TrySpinPlayerForWarp(struct ObjectEvent *object, s16 *delayTimer)
|
||||
}
|
||||
|
||||
//sideways stairs
|
||||
/*
|
||||
static bool8 IsSidewaysStairToRight(s16 x, s16 y, u8 z)
|
||||
{
|
||||
if (GetSidewaysStairsToRightDirection(x, y, z) != 0)
|
||||
@ -2336,24 +2360,9 @@ static bool8 IsSidewaysStairToLeft(s16 x, s16 y, u8 z)
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
|
||||
u8 GetRightStairsDirection(u8 direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case DIR_WEST:
|
||||
return DIR_SOUTHWEST;
|
||||
case DIR_EAST:
|
||||
return DIR_NORTHEAST;
|
||||
default:
|
||||
if (direction > DIR_EAST)
|
||||
direction -= DIR_EAST;
|
||||
|
||||
return direction;
|
||||
}
|
||||
}
|
||||
|
||||
u8 GetLeftStairsDirection(u8 direction)
|
||||
u8 GetRightSideStairsDirection(u8 direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
@ -2365,26 +2374,42 @@ u8 GetLeftStairsDirection(u8 direction)
|
||||
if (direction > DIR_EAST)
|
||||
direction -= DIR_EAST;
|
||||
|
||||
return direction;
|
||||
}
|
||||
}
|
||||
|
||||
u8 GetLeftSideStairsDirection(u8 direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case DIR_WEST:
|
||||
return DIR_SOUTHWEST;
|
||||
case DIR_EAST:
|
||||
return DIR_NORTHEAST;
|
||||
default:
|
||||
if (direction > DIR_EAST)
|
||||
direction -= DIR_EAST;
|
||||
|
||||
return direction;
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerSidewaysStairsToRight(u8 direction)
|
||||
void PlayerSidewaysStairsRightSide(u8 direction)
|
||||
{
|
||||
PlayerSetAnimId(GetDiagonalRightStairsMovement(direction), 8);
|
||||
}
|
||||
|
||||
void PlayerSidewaysStairsToLeft(u8 direction)
|
||||
void PlayerSidewaysStairsLeftSide(u8 direction)
|
||||
{
|
||||
PlayerSetAnimId(GetDiagonalLeftStairsMovement(direction), 8);
|
||||
}
|
||||
|
||||
void PlayerSidewaysStairsToRightRunning(u8 direction)
|
||||
void PlayerSidewaysStairsRightSideRunning(u8 direction)
|
||||
{
|
||||
PlayerSetAnimId(GetDiagonalRightStairsRunningMovement(direction), 8);
|
||||
}
|
||||
|
||||
void PlayerSidewaysStairsToLeftRunning(u8 direction)
|
||||
void PlayerSidewaysStairsLeftSideRunning(u8 direction)
|
||||
{
|
||||
PlayerSetAnimId(GetDiagonalLeftStairsRunningMovement(direction), 8);
|
||||
}
|
||||
|
||||
@ -83,13 +83,13 @@ static const u8 sTileBitAttributes[] =
|
||||
[MB_SLIDE_NORTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SLIDE_SOUTH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_TRICK_HOUSE_PUZZLE_8_FLOOR] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
|
||||
[MB_SIDEWAYS_STAIRS_RIGHT] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SIDEWAYS_STAIRS_LEFT] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SIDEWAYS_STAIRS_RIGHT_SIDE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SIDEWAYS_STAIRS_LEFT_SIDE] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SIDEWAYS_STAIRS_RIGHT_SIDE_TOP] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SIDEWAYS_STAIRS_LEFT_SIDE_TOP] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SIDEWAYS_STAIRS_RIGHT_SIDE_BOTTOM] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_SIDEWAYS_STAIRS_LEFT_SIDE_BOTTOM] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_ROCK_STAIRS] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_4C] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_4D] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_4E] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_UNUSED_4F] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
|
||||
[MB_EASTWARD_CURRENT] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_WESTWARD_CURRENT] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
[MB_NORTHWARD_CURRENT] = TILE_ATTRIBUTES(TRUE, TRUE, FALSE),
|
||||
@ -1496,17 +1496,69 @@ bool8 MetatileBehavior_IsTrainerHillTimer(u8 metatileBehavior)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRight(u8 metatileBehavior)
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRightSide(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_RIGHT)
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_RIGHT_SIDE || metatileBehavior == MB_SIDEWAYS_STAIRS_RIGHT_SIDE_BOTTOM)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeft(u8 metatileBehavior)
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeftSide(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_LEFT)
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_LEFT_SIDE || metatileBehavior == MB_SIDEWAYS_STAIRS_LEFT_SIDE_BOTTOM)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRightSideTop(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_RIGHT_SIDE_TOP)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeftSideTop(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_LEFT_SIDE_TOP)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRightSideBottom(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_RIGHT_SIDE_BOTTOM)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeftSideBottom(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_LEFT_SIDE_BOTTOM)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsSidewaysStairsRightSideAny(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_RIGHT_SIDE
|
||||
|| metatileBehavior == MB_SIDEWAYS_STAIRS_RIGHT_SIDE_BOTTOM
|
||||
|| metatileBehavior == MB_SIDEWAYS_STAIRS_RIGHT_SIDE_TOP)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsSidewaysStairsLeftSideAny(u8 metatileBehavior)
|
||||
{
|
||||
if (metatileBehavior == MB_SIDEWAYS_STAIRS_LEFT_SIDE
|
||||
|| metatileBehavior == MB_SIDEWAYS_STAIRS_LEFT_SIDE_BOTTOM
|
||||
|| metatileBehavior == MB_SIDEWAYS_STAIRS_LEFT_SIDE_TOP)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user