mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-26 13:31:03 +01:00
Merge pull request #1566 from cbt6/move-speed
Rename speed parameter to distance in jump functions
This commit is contained in:
commit
01859a63ff
@ -706,8 +706,16 @@ u8 (*const gMovementActionFuncs_WalkNormalRight[])(struct ObjectEvent *, struct
|
||||
MovementAction_PauseSpriteAnim,
|
||||
};
|
||||
|
||||
static const s16 sJumpInitDisplacements[] = {0, 1, 1};
|
||||
static const s16 sJumpDisplacements[] = {0, 0, 1};
|
||||
static const s16 sJumpInitDisplacements[] = {
|
||||
[JUMP_DISTANCE_IN_PLACE] = 0,
|
||||
[JUMP_DISTANCE_NORMAL] = 1,
|
||||
[JUMP_DISTANCE_FAR] = 1,
|
||||
};
|
||||
static const s16 sJumpDisplacements[] = {
|
||||
[JUMP_DISTANCE_IN_PLACE] = 0,
|
||||
[JUMP_DISTANCE_NORMAL] = 0,
|
||||
[JUMP_DISTANCE_FAR] = 1,
|
||||
};
|
||||
|
||||
u8 (*const gMovementActionFuncs_Jump2Down[])(struct ObjectEvent *, struct Sprite *) = {
|
||||
MovementAction_Jump2Down_Step0,
|
||||
|
@ -40,12 +40,17 @@ enum {
|
||||
MOVE_SPEED_FASTEST,
|
||||
};
|
||||
|
||||
enum {
|
||||
JUMP_DISTANCE_IN_PLACE,
|
||||
JUMP_DISTANCE_NORMAL,
|
||||
JUMP_DISTANCE_FAR,
|
||||
};
|
||||
|
||||
// Sprite data used throughout
|
||||
#define sObjEventId data[0]
|
||||
#define sTypeFuncId data[1] // Index into corresponding gMovementTypeFuncs_* table
|
||||
#define sActionFuncId data[2] // Index into corresponding gMovementActionFuncs_* table
|
||||
#define sDirection data[3]
|
||||
#define sSpeed data[4]
|
||||
|
||||
|
||||
#define movement_type_def(setup, table) \
|
||||
@ -5386,7 +5391,7 @@ enum {
|
||||
JUMP_TYPE_NORMAL,
|
||||
};
|
||||
|
||||
static void InitJump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 speed, u8 type)
|
||||
static void InitJump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 distance, u8 type)
|
||||
{
|
||||
s16 displacements[ARRAY_COUNT(sJumpInitDisplacements)];
|
||||
s16 x;
|
||||
@ -5396,22 +5401,24 @@ static void InitJump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8
|
||||
x = 0;
|
||||
y = 0;
|
||||
SetObjectEventDirection(objectEvent, direction);
|
||||
MoveCoordsInDirection(direction, &x, &y, displacements[speed], displacements[speed]);
|
||||
MoveCoordsInDirection(direction, &x, &y, displacements[distance], displacements[distance]);
|
||||
ShiftObjectEventCoords(objectEvent, objectEvent->currentCoords.x + x, objectEvent->currentCoords.y + y);
|
||||
SetJumpSpriteData(sprite, direction, speed, type);
|
||||
SetJumpSpriteData(sprite, direction, distance, type);
|
||||
sprite->sActionFuncId = 1;
|
||||
sprite->animPaused = FALSE;
|
||||
objectEvent->triggerGroundEffectsOnMove = TRUE;
|
||||
objectEvent->disableCoveringGroundEffects = TRUE;
|
||||
}
|
||||
|
||||
static void InitJumpRegular(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 speed, u8 type)
|
||||
static void InitJumpRegular(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 distance, u8 type)
|
||||
{
|
||||
InitJump(objectEvent, sprite, direction, speed, type);
|
||||
InitJump(objectEvent, sprite, direction, distance, type);
|
||||
SetStepAnimHandleAlternation(objectEvent, sprite, GetMoveDirectionAnimNum(objectEvent->facingDirection));
|
||||
DoShadowFieldEffect(objectEvent);
|
||||
}
|
||||
|
||||
#define sDistance data[4]
|
||||
|
||||
static u8 UpdateJumpAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 callback(struct Sprite *))
|
||||
{
|
||||
s16 displacements[ARRAY_COUNT(sJumpDisplacements)];
|
||||
@ -5421,11 +5428,11 @@ static u8 UpdateJumpAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite,
|
||||
|
||||
memcpy(displacements, sJumpDisplacements, sizeof sJumpDisplacements);
|
||||
result = callback(sprite);
|
||||
if (result == JUMP_HALFWAY && displacements[sprite->sSpeed] != 0)
|
||||
if (result == JUMP_HALFWAY && displacements[sprite->sDistance] != 0)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
MoveCoordsInDirection(objectEvent->movementDirection, &x, &y, displacements[sprite->sSpeed], displacements[sprite->sSpeed]);
|
||||
MoveCoordsInDirection(objectEvent->movementDirection, &x, &y, displacements[sprite->sDistance], displacements[sprite->sDistance]);
|
||||
ShiftObjectEventCoords(objectEvent, objectEvent->currentCoords.x + x, objectEvent->currentCoords.y + y);
|
||||
objectEvent->triggerGroundEffectsOnMove = TRUE;
|
||||
objectEvent->disableCoveringGroundEffects = TRUE;
|
||||
@ -5440,6 +5447,8 @@ static u8 UpdateJumpAnim(struct ObjectEvent *objectEvent, struct Sprite *sprite,
|
||||
return result;
|
||||
}
|
||||
|
||||
#undef sDistance
|
||||
|
||||
static u8 DoJumpAnimStep(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
return UpdateJumpAnim(objectEvent, sprite, DoJumpSpriteMovement);
|
||||
@ -5482,7 +5491,7 @@ static bool8 DoJumpInPlaceAnim(struct ObjectEvent *objectEvent, struct Sprite *s
|
||||
|
||||
bool8 MovementAction_Jump2Down_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_SOUTH, 2, JUMP_TYPE_HIGH);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH);
|
||||
return MovementAction_Jump2Down_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -5499,7 +5508,7 @@ bool8 MovementAction_Jump2Down_Step1(struct ObjectEvent *objectEvent, struct Spr
|
||||
|
||||
bool8 MovementAction_Jump2Up_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_NORTH, 2, JUMP_TYPE_HIGH);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH);
|
||||
return MovementAction_Jump2Up_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -5516,7 +5525,7 @@ bool8 MovementAction_Jump2Up_Step1(struct ObjectEvent *objectEvent, struct Sprit
|
||||
|
||||
bool8 MovementAction_Jump2Left_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_WEST, 2, JUMP_TYPE_HIGH);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH);
|
||||
return MovementAction_Jump2Left_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -5533,7 +5542,7 @@ bool8 MovementAction_Jump2Left_Step1(struct ObjectEvent *objectEvent, struct Spr
|
||||
|
||||
bool8 MovementAction_Jump2Right_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_EAST, 2, JUMP_TYPE_HIGH);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH);
|
||||
return MovementAction_Jump2Right_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6064,7 +6073,7 @@ bool8 MovementAction_WaitSpriteAnim(struct ObjectEvent *objectEvent, struct Spri
|
||||
|
||||
static void InitJumpSpecial(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction)
|
||||
{
|
||||
InitJump(objectEvent, sprite, direction, 1, JUMP_TYPE_HIGH);
|
||||
InitJump(objectEvent, sprite, direction, JUMP_DISTANCE_NORMAL, JUMP_TYPE_HIGH);
|
||||
StartSpriteAnim(sprite, GetJumpSpecialDirectionAnimNum(direction));
|
||||
}
|
||||
|
||||
@ -6178,7 +6187,7 @@ bool8 MovementAction_UnlockFacingDirection_Step0(struct ObjectEvent *objectEvent
|
||||
|
||||
bool8 MovementAction_JumpDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_SOUTH, 1, JUMP_TYPE_NORMAL);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_NORMAL, JUMP_TYPE_NORMAL);
|
||||
return MovementAction_JumpDown_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6195,7 +6204,7 @@ bool8 MovementAction_JumpDown_Step1(struct ObjectEvent *objectEvent, struct Spri
|
||||
|
||||
bool8 MovementAction_JumpUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_NORTH, 1, JUMP_TYPE_NORMAL);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_NORMAL, JUMP_TYPE_NORMAL);
|
||||
return MovementAction_JumpUp_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6212,7 +6221,7 @@ bool8 MovementAction_JumpUp_Step1(struct ObjectEvent *objectEvent, struct Sprite
|
||||
|
||||
bool8 MovementAction_JumpLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_WEST, 1, JUMP_TYPE_NORMAL);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_NORMAL, JUMP_TYPE_NORMAL);
|
||||
return MovementAction_JumpLeft_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6229,7 +6238,7 @@ bool8 MovementAction_JumpLeft_Step1(struct ObjectEvent *objectEvent, struct Spri
|
||||
|
||||
bool8 MovementAction_JumpRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_EAST, 1, JUMP_TYPE_NORMAL);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_NORMAL, JUMP_TYPE_NORMAL);
|
||||
return MovementAction_JumpRight_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6246,7 +6255,7 @@ bool8 MovementAction_JumpRight_Step1(struct ObjectEvent *objectEvent, struct Spr
|
||||
|
||||
bool8 MovementAction_JumpInPlaceDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_SOUTH, 0, JUMP_TYPE_HIGH);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_HIGH);
|
||||
return MovementAction_JumpInPlaceDown_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6263,7 +6272,7 @@ bool8 MovementAction_JumpInPlaceDown_Step1(struct ObjectEvent *objectEvent, stru
|
||||
|
||||
bool8 MovementAction_JumpInPlaceUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_NORTH, 0, JUMP_TYPE_HIGH);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_HIGH);
|
||||
return MovementAction_JumpInPlaceUp_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6280,7 +6289,7 @@ bool8 MovementAction_JumpInPlaceUp_Step1(struct ObjectEvent *objectEvent, struct
|
||||
|
||||
bool8 MovementAction_JumpInPlaceLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_WEST, 0, JUMP_TYPE_HIGH);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_HIGH);
|
||||
return MovementAction_JumpInPlaceLeft_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6297,7 +6306,7 @@ bool8 MovementAction_JumpInPlaceLeft_Step1(struct ObjectEvent *objectEvent, stru
|
||||
|
||||
bool8 MovementAction_JumpInPlaceRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_EAST, 0, JUMP_TYPE_HIGH);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_HIGH);
|
||||
return MovementAction_JumpInPlaceRight_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6314,7 +6323,7 @@ bool8 MovementAction_JumpInPlaceRight_Step1(struct ObjectEvent *objectEvent, str
|
||||
|
||||
bool8 MovementAction_JumpInPlaceDownUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_SOUTH, 0, JUMP_TYPE_NORMAL);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_NORMAL);
|
||||
return MovementAction_JumpInPlaceDownUp_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6331,7 +6340,7 @@ bool8 MovementAction_JumpInPlaceDownUp_Step1(struct ObjectEvent *objectEvent, st
|
||||
|
||||
bool8 MovementAction_JumpInPlaceUpDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_NORTH, 0, JUMP_TYPE_NORMAL);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_NORMAL);
|
||||
return MovementAction_JumpInPlaceUpDown_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6348,7 +6357,7 @@ bool8 MovementAction_JumpInPlaceUpDown_Step1(struct ObjectEvent *objectEvent, st
|
||||
|
||||
bool8 MovementAction_JumpInPlaceLeftRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_WEST, 0, JUMP_TYPE_NORMAL);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_NORMAL);
|
||||
return MovementAction_JumpInPlaceLeftRight_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6365,7 +6374,7 @@ bool8 MovementAction_JumpInPlaceLeftRight_Step1(struct ObjectEvent *objectEvent,
|
||||
|
||||
bool8 MovementAction_JumpInPlaceRightLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitJumpRegular(objectEvent, sprite, DIR_EAST, 0, JUMP_TYPE_NORMAL);
|
||||
InitJumpRegular(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_NORMAL);
|
||||
return MovementAction_JumpInPlaceRightLeft_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6800,16 +6809,16 @@ bool8 MovementAction_Figure8_Step1(struct ObjectEvent *objectEvent, struct Sprit
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void InitAcroWheelieJump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 speed, u8 type)
|
||||
static void InitAcroWheelieJump(struct ObjectEvent *objectEvent, struct Sprite *sprite, u8 direction, u8 distance, u8 type)
|
||||
{
|
||||
InitJump(objectEvent, sprite, direction, speed, type);
|
||||
InitJump(objectEvent, sprite, direction, distance, type);
|
||||
StartSpriteAnimIfDifferent(sprite, GetAcroWheelieDirectionAnimNum(direction));
|
||||
DoShadowFieldEffect(objectEvent);
|
||||
}
|
||||
|
||||
bool8 MovementAction_AcroWheelieHopFaceDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, 0, JUMP_TYPE_LOW);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_LOW);
|
||||
return MovementAction_AcroWheelieHopFaceDown_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6826,7 +6835,7 @@ bool8 MovementAction_AcroWheelieHopFaceDown_Step1(struct ObjectEvent *objectEven
|
||||
|
||||
bool8 MovementAction_AcroWheelieHopFaceUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, 0, JUMP_TYPE_LOW);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_LOW);
|
||||
return MovementAction_AcroWheelieHopFaceUp_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6843,7 +6852,7 @@ bool8 MovementAction_AcroWheelieHopFaceUp_Step1(struct ObjectEvent *objectEvent,
|
||||
|
||||
bool8 MovementAction_AcroWheelieHopFaceLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, 0, JUMP_TYPE_LOW);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_LOW);
|
||||
return MovementAction_AcroWheelieHopFaceLeft_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6860,7 +6869,7 @@ bool8 MovementAction_AcroWheelieHopFaceLeft_Step1(struct ObjectEvent *objectEven
|
||||
|
||||
bool8 MovementAction_AcroWheelieHopFaceRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, 0, JUMP_TYPE_LOW);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_IN_PLACE, JUMP_TYPE_LOW);
|
||||
return MovementAction_AcroWheelieHopFaceRight_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6877,7 +6886,7 @@ bool8 MovementAction_AcroWheelieHopFaceRight_Step1(struct ObjectEvent *objectEve
|
||||
|
||||
bool8 MovementAction_AcroWheelieHopDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, 1, JUMP_TYPE_LOW);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_NORMAL, JUMP_TYPE_LOW);
|
||||
return MovementAction_AcroWheelieHopDown_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6894,7 +6903,7 @@ bool8 MovementAction_AcroWheelieHopDown_Step1(struct ObjectEvent *objectEvent, s
|
||||
|
||||
bool8 MovementAction_AcroWheelieHopUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, 1, JUMP_TYPE_LOW);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_NORMAL, JUMP_TYPE_LOW);
|
||||
return MovementAction_AcroWheelieHopUp_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6911,7 +6920,7 @@ bool8 MovementAction_AcroWheelieHopUp_Step1(struct ObjectEvent *objectEvent, str
|
||||
|
||||
bool8 MovementAction_AcroWheelieHopLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, 1, JUMP_TYPE_LOW);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_NORMAL, JUMP_TYPE_LOW);
|
||||
return MovementAction_AcroWheelieHopLeft_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6928,7 +6937,7 @@ bool8 MovementAction_AcroWheelieHopLeft_Step1(struct ObjectEvent *objectEvent, s
|
||||
|
||||
bool8 MovementAction_AcroWheelieHopRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, 1, JUMP_TYPE_LOW);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_NORMAL, JUMP_TYPE_LOW);
|
||||
return MovementAction_AcroWheelieHopRight_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6945,7 +6954,7 @@ bool8 MovementAction_AcroWheelieHopRight_Step1(struct ObjectEvent *objectEvent,
|
||||
|
||||
bool8 MovementAction_AcroWheelieJumpDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, 2, JUMP_TYPE_HIGH);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_SOUTH, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH);
|
||||
return MovementAction_AcroWheelieJumpDown_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6962,7 +6971,7 @@ bool8 MovementAction_AcroWheelieJumpDown_Step1(struct ObjectEvent *objectEvent,
|
||||
|
||||
bool8 MovementAction_AcroWheelieJumpUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, 2, JUMP_TYPE_HIGH);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_NORTH, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH);
|
||||
return MovementAction_AcroWheelieJumpUp_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6979,7 +6988,7 @@ bool8 MovementAction_AcroWheelieJumpUp_Step1(struct ObjectEvent *objectEvent, st
|
||||
|
||||
bool8 MovementAction_AcroWheelieJumpLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, 2, JUMP_TYPE_HIGH);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_WEST, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH);
|
||||
return MovementAction_AcroWheelieJumpLeft_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -6996,7 +7005,7 @@ bool8 MovementAction_AcroWheelieJumpLeft_Step1(struct ObjectEvent *objectEvent,
|
||||
|
||||
bool8 MovementAction_AcroWheelieJumpRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, 2, JUMP_TYPE_HIGH);
|
||||
InitAcroWheelieJump(objectEvent, sprite, DIR_EAST, JUMP_DISTANCE_FAR, JUMP_TYPE_HIGH);
|
||||
return MovementAction_AcroWheelieJumpRight_Step1(objectEvent, sprite);
|
||||
}
|
||||
|
||||
@ -8166,6 +8175,7 @@ static void Step8(struct Sprite *sprite, u8 dir)
|
||||
sprite->y += 8 * (u16) sDirectionToVectors[dir].y;
|
||||
}
|
||||
|
||||
#define sSpeed data[4]
|
||||
#define sTimer data[5]
|
||||
|
||||
static void SetSpriteDataForNormalStep(struct Sprite *sprite, u8 direction, u8 speed)
|
||||
@ -8259,6 +8269,7 @@ static bool8 NpcTakeStep(struct Sprite *sprite)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#undef sSpeed
|
||||
#undef sTimer
|
||||
|
||||
#define sTimer data[4]
|
||||
@ -8393,34 +8404,43 @@ static s16 GetJumpY(s16 i, u8 type)
|
||||
return sJumpYTable[type][i];
|
||||
}
|
||||
|
||||
#define sDistance data[4]
|
||||
#define sJumpType data[5]
|
||||
#define sTimer data[6]
|
||||
|
||||
static void SetJumpSpriteData(struct Sprite *sprite, u8 direction, u8 speed, u8 type)
|
||||
static void SetJumpSpriteData(struct Sprite *sprite, u8 direction, u8 distance, u8 type)
|
||||
{
|
||||
sprite->sDirection = direction;
|
||||
sprite->sSpeed = speed;
|
||||
sprite->sDistance = distance;
|
||||
sprite->sJumpType = type;
|
||||
sprite->sTimer = 0;
|
||||
}
|
||||
|
||||
static u8 DoJumpSpriteMovement(struct Sprite *sprite)
|
||||
{
|
||||
s16 speedToTime[] = {16, 16, 32};
|
||||
u8 speedToShift[] = {0, 0, 1};
|
||||
s16 distanceToTime[] = {
|
||||
[JUMP_DISTANCE_IN_PLACE] = 16,
|
||||
[JUMP_DISTANCE_NORMAL] = 16,
|
||||
[JUMP_DISTANCE_FAR] = 32,
|
||||
};
|
||||
u8 distanceToShift[] = {
|
||||
[JUMP_DISTANCE_IN_PLACE] = 0,
|
||||
[JUMP_DISTANCE_NORMAL] = 0,
|
||||
[JUMP_DISTANCE_FAR] = 1,
|
||||
};
|
||||
u8 result = 0;
|
||||
|
||||
if (sprite->sSpeed)
|
||||
if (sprite->sDistance != JUMP_DISTANCE_IN_PLACE)
|
||||
Step1(sprite, sprite->sDirection);
|
||||
|
||||
sprite->y2 = GetJumpY(sprite->sTimer >> speedToShift[sprite->sSpeed], sprite->sJumpType);
|
||||
sprite->y2 = GetJumpY(sprite->sTimer >> distanceToShift[sprite->sDistance], sprite->sJumpType);
|
||||
|
||||
sprite->sTimer++;
|
||||
|
||||
if (sprite->sTimer == speedToTime[sprite->sSpeed] >> 1)
|
||||
if (sprite->sTimer == distanceToTime[sprite->sDistance] >> 1)
|
||||
result = JUMP_HALFWAY;
|
||||
|
||||
if (sprite->sTimer >= speedToTime[sprite->sSpeed])
|
||||
if (sprite->sTimer >= distanceToTime[sprite->sDistance])
|
||||
{
|
||||
sprite->y2 = 0;
|
||||
result = JUMP_FINISHED;
|
||||
@ -8431,21 +8451,29 @@ static u8 DoJumpSpriteMovement(struct Sprite *sprite)
|
||||
|
||||
static u8 DoJumpSpecialSpriteMovement(struct Sprite *sprite)
|
||||
{
|
||||
s16 speedToTime[] = {32, 32, 64};
|
||||
u8 speedToShift[] = {1, 1, 2};
|
||||
s16 distanceToTime[] = {
|
||||
[JUMP_DISTANCE_IN_PLACE] = 32,
|
||||
[JUMP_DISTANCE_NORMAL] = 32,
|
||||
[JUMP_DISTANCE_FAR] = 64,
|
||||
};
|
||||
u8 distanceToShift[] = {
|
||||
[JUMP_DISTANCE_IN_PLACE] = 1,
|
||||
[JUMP_DISTANCE_NORMAL] = 1,
|
||||
[JUMP_DISTANCE_FAR] = 2,
|
||||
};
|
||||
u8 result = 0;
|
||||
|
||||
if (sprite->sSpeed && !(sprite->sTimer & 1))
|
||||
if (sprite->sDistance != JUMP_DISTANCE_IN_PLACE && !(sprite->sTimer & 1))
|
||||
Step1(sprite, sprite->sDirection);
|
||||
|
||||
sprite->y2 = GetJumpY(sprite->sTimer >> speedToShift[sprite->sSpeed], sprite->sJumpType);
|
||||
sprite->y2 = GetJumpY(sprite->sTimer >> distanceToShift[sprite->sDistance], sprite->sJumpType);
|
||||
|
||||
sprite->sTimer++;
|
||||
|
||||
if (sprite->sTimer == speedToTime[sprite->sSpeed] >> 1)
|
||||
if (sprite->sTimer == distanceToTime[sprite->sDistance] >> 1)
|
||||
result = JUMP_HALFWAY;
|
||||
|
||||
if (sprite->sTimer >= speedToTime[sprite->sSpeed])
|
||||
if (sprite->sTimer >= distanceToTime[sprite->sDistance])
|
||||
{
|
||||
sprite->y2 = 0;
|
||||
result = JUMP_FINISHED;
|
||||
@ -8454,7 +8482,7 @@ static u8 DoJumpSpecialSpriteMovement(struct Sprite *sprite)
|
||||
return result;
|
||||
}
|
||||
|
||||
#undef sSpeed
|
||||
#undef sDistance
|
||||
#undef sJumpType
|
||||
#undef sTimer
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user