diff --git a/include/bike.h b/include/bike.h index 893b0b19e..afe773d42 100644 --- a/include/bike.h +++ b/include/bike.h @@ -17,11 +17,11 @@ struct BikeHistoryInputInfo // Player speeds enum { - SPEED_STANDING, - SPEED_NORMAL, - SPEED_FAST, - SPEED_FASTER, - SPEED_FASTEST, + BIKE_SPEED_STANDING, + BIKE_SPEED_NORMAL, + BIKE_SPEED_FAST, + BIKE_SPEED_FASTER, + BIKE_SPEED_FASTEST, }; // mach bike transitions enum diff --git a/include/constants/event_object_movement.h b/include/constants/event_object_movement.h index 4ffb869e4..e7238b56e 100755 --- a/include/constants/event_object_movement.h +++ b/include/constants/event_object_movement.h @@ -128,10 +128,10 @@ #define MOVEMENT_ACTION_RIDE_WATER_CURRENT_UP 0x2A #define MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT 0x2B #define MOVEMENT_ACTION_RIDE_WATER_CURRENT_RIGHT 0x2C -#define MOVEMENT_ACTION_WALK_FASTEST_DOWN 0x2D -#define MOVEMENT_ACTION_WALK_FASTEST_UP 0x2E -#define MOVEMENT_ACTION_WALK_FASTEST_LEFT 0x2F -#define MOVEMENT_ACTION_WALK_FASTEST_RIGHT 0x30 +#define MOVEMENT_ACTION_WALK_FASTER_DOWN 0x2D +#define MOVEMENT_ACTION_WALK_FASTER_UP 0x2E +#define MOVEMENT_ACTION_WALK_FASTER_LEFT 0x2F +#define MOVEMENT_ACTION_WALK_FASTER_RIGHT 0x30 #define MOVEMENT_ACTION_SLIDE_DOWN 0x31 #define MOVEMENT_ACTION_SLIDE_UP 0x32 #define MOVEMENT_ACTION_SLIDE_LEFT 0x33 diff --git a/include/event_object_movement.h b/include/event_object_movement.h index a935502e6..11dac813d 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -136,7 +136,7 @@ u8 GetFaceDirectionMovementAction(u32); u8 GetWalkNormalMovementAction(u32); u8 GetWalkFastMovementAction(u32); u8 GetRideWaterCurrentMovementAction(u32); -u8 GetWalkFastestMovementAction(u32); +u8 GetWalkFasterMovementAction(u32); u8 GetPlayerRunMovementAction(u32); u8 GetJumpInPlaceMovementAction(u32); u8 GetAcroWheelieFaceDirectionMovementAction(u32); diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index e9174d589..823564f22 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -11,10 +11,10 @@ void PlayerGetDestCoords(s16 *, s16 *); u8 GetPlayerFacingDirection(void); u8 GetPlayerMovementDirection(void); u8 PlayerGetCopyableMovement(void); -void PlayerGoSpeed1(u8); -void PlayerGoSpeed2(u8); +void PlayerWalkNormal(u8); +void PlayerWalkFast(u8); void PlayerRideWaterCurrent(u8); -void PlayerGoSpeed4(u8); +void PlayerWalkFaster(u8); void PlayerOnBikeCollide(u8); void PlayerFaceDirection(u8 a); void PlayerTurnInPlace(u8 a); diff --git a/src/bike.c b/src/bike.c index 39433522e..fd794a3c7 100644 --- a/src/bike.c +++ b/src/bike.c @@ -71,12 +71,12 @@ static void (*const sMachBikeTransitions[])(u8) = MachBikeTransition_TrySlowDown, }; -// bikeFrameCounter is input which is represented by sMachBikeSpeeds in order: 0 is normal speed (1 speed), 1 is fast speed (2 speed), 2 is fastest speed (4 speed) +// bikeFrameCounter is input which is represented by sMachBikeSpeeds in order static void (*const sMachBikeSpeedCallbacks[])(u8) = { - PlayerGoSpeed1, // normal speed (1 speed) - PlayerGoSpeed2, // fast speed (2 speed) - PlayerGoSpeed4, // fastest speed (4 speed) + PlayerWalkNormal, + PlayerWalkFast, + PlayerWalkFaster, }; static void (*const sAcroBikeTransitions[])(u8) = @@ -108,7 +108,7 @@ static u8 (*const sAcroBikeInputHandlers[])(u8 *, u16, u16) = }; // used with bikeFrameCounter from mach bike -static const u16 sMachBikeSpeeds[] = {SPEED_NORMAL, SPEED_FAST, SPEED_FASTEST}; +static const u16 sMachBikeSpeeds[] = {BIKE_SPEED_NORMAL, BIKE_SPEED_FAST, BIKE_SPEED_FASTEST}; // this is a list of timers to compare against later, terminated with 0. the only timer being compared against is 4 frames in this list. static const u8 sAcroBikeJumpTimerList[] = {4, 0}; @@ -147,7 +147,7 @@ static u8 GetMachBikeTransition(u8 *dirTraveling) if (*dirTraveling == 0) { *dirTraveling = direction; // update the direction, since below we either faced a direction or we started moving. - if (gPlayerAvatar.bikeSpeed == SPEED_STANDING) + if (gPlayerAvatar.bikeSpeed == BIKE_SPEED_STANDING) { gPlayerAvatar.runningState = NOT_MOVING; return MACH_TRANS_FACE_DIRECTION; @@ -159,7 +159,7 @@ static u8 GetMachBikeTransition(u8 *dirTraveling) // we need to check if the last traveled direction changed from the new direction as well as ensuring that we dont update the state while the player is moving: see the else check. if (*dirTraveling != direction && gPlayerAvatar.runningState != MOVING) { - if (gPlayerAvatar.bikeSpeed != SPEED_STANDING) + if (gPlayerAvatar.bikeSpeed != BIKE_SPEED_STANDING) { *dirTraveling = direction; // implement the new direction gPlayerAvatar.runningState = MOVING; @@ -246,7 +246,7 @@ static void MachBikeTransition_TrySlowDown(u8 direction) { u8 collision; - if (gPlayerAvatar.bikeSpeed != SPEED_STANDING) + if (gPlayerAvatar.bikeSpeed != BIKE_SPEED_STANDING) gPlayerAvatar.bikeFrameCounter = --gPlayerAvatar.bikeSpeed; collision = GetBikeCollision(direction); @@ -306,7 +306,7 @@ static u8 AcroBikeHandleInputNormal(u8 *newDirection, u16 newKeys, u16 heldKeys) return ACRO_TRANS_FACE_DIRECTION; } } - if (*newDirection == direction && (heldKeys & B_BUTTON) && gPlayerAvatar.bikeSpeed == SPEED_STANDING) + if (*newDirection == direction && (heldKeys & B_BUTTON) && gPlayerAvatar.bikeSpeed == BIKE_SPEED_STANDING) { gPlayerAvatar.bikeSpeed++; gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_MOVING; @@ -342,7 +342,7 @@ static u8 AcroBikeHandleInputTurning(u8 *newDirection, u16 newKeys, u16 heldKeys if (*newDirection == AcroBike_GetJumpDirection()) { Bike_SetBikeStill(); // Bike_SetBikeStill sets speed to standing, but the next line immediately overrides it. could have just reset acroBikeState to 0 here instead of wasting a jump. - gPlayerAvatar.bikeSpeed = SPEED_NORMAL; + gPlayerAvatar.bikeSpeed = BIKE_SPEED_NORMAL; if (*newDirection == GetOppositeDirection(direction)) { // do a turn jump. @@ -775,7 +775,7 @@ static void AcroBike_TryHistoryUpdate(u16 newKeys, u16 heldKeys) // newKeys is u else { Bike_UpdateDirTimerHistory(direction); - gPlayerAvatar.bikeSpeed = SPEED_STANDING; + gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING; } direction = heldKeys & (A_BUTTON | B_BUTTON | SELECT_BUTTON | START_BUTTON); // directions is reused for some reason. @@ -787,7 +787,7 @@ static void AcroBike_TryHistoryUpdate(u16 newKeys, u16 heldKeys) // newKeys is u else { Bike_UpdateABStartSelectHistory(direction); - gPlayerAvatar.bikeSpeed = SPEED_STANDING; + gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING; } } @@ -994,7 +994,7 @@ void BikeClearState(int newDirHistory, int newAbStartHistory) gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL; gPlayerAvatar.newDirBackup = DIR_NONE; gPlayerAvatar.bikeFrameCounter = 0; - gPlayerAvatar.bikeSpeed = SPEED_STANDING; + gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING; gPlayerAvatar.directionHistory = newDirHistory; gPlayerAvatar.abStartSelectHistory = newAbStartHistory; @@ -1014,7 +1014,7 @@ void Bike_UpdateBikeCounterSpeed(u8 counter) static void Bike_SetBikeStill(void) { gPlayerAvatar.bikeFrameCounter = 0; - gPlayerAvatar.bikeSpeed = SPEED_STANDING; + gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING; } s16 GetPlayerSpeed(void) @@ -1027,11 +1027,11 @@ s16 GetPlayerSpeed(void) if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE) return machSpeeds[gPlayerAvatar.bikeFrameCounter]; else if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE) - return SPEED_FASTER; + return BIKE_SPEED_FASTER; else if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_DASH)) - return SPEED_FAST; + return BIKE_SPEED_FAST; else - return SPEED_NORMAL; + return BIKE_SPEED_NORMAL; } void Bike_HandleBumpySlopeJump(void) diff --git a/src/data/object_events/movement_action_func_tables.h b/src/data/object_events/movement_action_func_tables.h index 4df07be0d..aa55c31ef 100755 --- a/src/data/object_events/movement_action_func_tables.h +++ b/src/data/object_events/movement_action_func_tables.h @@ -85,14 +85,14 @@ u8 MovementAction_RideWaterCurrentLeft_Step0(struct ObjectEvent *, struct Sprite u8 MovementAction_RideWaterCurrentLeft_Step1(struct ObjectEvent *, struct Sprite *); u8 MovementAction_RideWaterCurrentRight_Step0(struct ObjectEvent *, struct Sprite *); u8 MovementAction_RideWaterCurrentRight_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementAction_WalkFastestDown_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementAction_WalkFastestDown_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementAction_WalkFastestUp_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementAction_WalkFastestUp_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementAction_WalkFastestLeft_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementAction_WalkFastestLeft_Step1(struct ObjectEvent *, struct Sprite *); -u8 MovementAction_WalkFastestRight_Step0(struct ObjectEvent *, struct Sprite *); -u8 MovementAction_WalkFastestRight_Step1(struct ObjectEvent *, struct Sprite *); +u8 MovementAction_WalkFasterDown_Step0(struct ObjectEvent *, struct Sprite *); +u8 MovementAction_WalkFasterDown_Step1(struct ObjectEvent *, struct Sprite *); +u8 MovementAction_WalkFasterUp_Step0(struct ObjectEvent *, struct Sprite *); +u8 MovementAction_WalkFasterUp_Step1(struct ObjectEvent *, struct Sprite *); +u8 MovementAction_WalkFasterLeft_Step0(struct ObjectEvent *, struct Sprite *); +u8 MovementAction_WalkFasterLeft_Step1(struct ObjectEvent *, struct Sprite *); +u8 MovementAction_WalkFasterRight_Step0(struct ObjectEvent *, struct Sprite *); +u8 MovementAction_WalkFasterRight_Step1(struct ObjectEvent *, struct Sprite *); u8 MovementAction_SlideDown_Step0(struct ObjectEvent *, struct Sprite *); u8 MovementAction_SlideDown_Step1(struct ObjectEvent *, struct Sprite *); u8 MovementAction_SlideUp_Step0(struct ObjectEvent *, struct Sprite *); @@ -307,10 +307,10 @@ u8 (*const gMovementActionFuncs_RideWaterCurrentDown[])(struct ObjectEvent *, st u8 (*const gMovementActionFuncs_RideWaterCurrentUp[])(struct ObjectEvent *, struct Sprite *); u8 (*const gMovementActionFuncs_RideWaterCurrentLeft[])(struct ObjectEvent *, struct Sprite *); u8 (*const gMovementActionFuncs_RideWaterCurrentRight[])(struct ObjectEvent *, struct Sprite *); -u8 (*const gMovementActionFuncs_WalkFastestDown[])(struct ObjectEvent *, struct Sprite *); -u8 (*const gMovementActionFuncs_WalkFastestUp[])(struct ObjectEvent *, struct Sprite *); -u8 (*const gMovementActionFuncs_WalkFastestLeft[])(struct ObjectEvent *, struct Sprite *); -u8 (*const gMovementActionFuncs_WalkFastestRight[])(struct ObjectEvent *, struct Sprite *); +u8 (*const gMovementActionFuncs_WalkFasterDown[])(struct ObjectEvent *, struct Sprite *); +u8 (*const gMovementActionFuncs_WalkFasterUp[])(struct ObjectEvent *, struct Sprite *); +u8 (*const gMovementActionFuncs_WalkFasterLeft[])(struct ObjectEvent *, struct Sprite *); +u8 (*const gMovementActionFuncs_WalkFasterRight[])(struct ObjectEvent *, struct Sprite *); u8 (*const gMovementActionFuncs_SlideDown[])(struct ObjectEvent *, struct Sprite *); u8 (*const gMovementActionFuncs_SlideUp[])(struct ObjectEvent *, struct Sprite *); u8 (*const gMovementActionFuncs_SlideLeft[])(struct ObjectEvent *, struct Sprite *); @@ -467,10 +467,10 @@ u8 (*const *const gMovementActionFuncs[])(struct ObjectEvent *, struct Sprite *) [MOVEMENT_ACTION_RIDE_WATER_CURRENT_UP] = gMovementActionFuncs_RideWaterCurrentUp, [MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT] = gMovementActionFuncs_RideWaterCurrentLeft, [MOVEMENT_ACTION_RIDE_WATER_CURRENT_RIGHT] = gMovementActionFuncs_RideWaterCurrentRight, - [MOVEMENT_ACTION_WALK_FASTEST_DOWN] = gMovementActionFuncs_WalkFastestDown, - [MOVEMENT_ACTION_WALK_FASTEST_UP] = gMovementActionFuncs_WalkFastestUp, - [MOVEMENT_ACTION_WALK_FASTEST_LEFT] = gMovementActionFuncs_WalkFastestLeft, - [MOVEMENT_ACTION_WALK_FASTEST_RIGHT] = gMovementActionFuncs_WalkFastestRight, + [MOVEMENT_ACTION_WALK_FASTER_DOWN] = gMovementActionFuncs_WalkFasterDown, + [MOVEMENT_ACTION_WALK_FASTER_UP] = gMovementActionFuncs_WalkFasterUp, + [MOVEMENT_ACTION_WALK_FASTER_LEFT] = gMovementActionFuncs_WalkFasterLeft, + [MOVEMENT_ACTION_WALK_FASTER_RIGHT] = gMovementActionFuncs_WalkFasterRight, [MOVEMENT_ACTION_SLIDE_DOWN] = gMovementActionFuncs_SlideDown, [MOVEMENT_ACTION_SLIDE_UP] = gMovementActionFuncs_SlideUp, [MOVEMENT_ACTION_SLIDE_LEFT] = gMovementActionFuncs_SlideLeft, @@ -603,11 +603,11 @@ u8 (*const gMovementActionFuncs_FaceRight[])(struct ObjectEvent *, struct Sprite }; static u8 (*const sDirectionAnimFuncsBySpeed[])(u8) = { - GetMoveDirectionAnimNum, - GetMoveDirectionFastAnimNum, - GetMoveDirectionFastAnimNum, - GetMoveDirectionFasterAnimNum, - GetMoveDirectionFastestAnimNum, + [MOVE_SPEED_NORMAL] = GetMoveDirectionAnimNum, + [MOVE_SPEED_FAST_1] = GetMoveDirectionFastAnimNum, + [MOVE_SPEED_FAST_2] = GetMoveDirectionFastAnimNum, + [MOVE_SPEED_FASTER] = GetMoveDirectionFasterAnimNum, + [MOVE_SPEED_FASTEST] = GetMoveDirectionFastestAnimNum, }; u8 (*const gMovementActionFuncs_WalkSlowDiagonalUpLeft[])(struct ObjectEvent *, struct Sprite *) = { @@ -907,27 +907,27 @@ u8 (*const gMovementActionFuncs_RideWaterCurrentRight[])(struct ObjectEvent *, s MovementAction_PauseSpriteAnim, }; -u8 (*const gMovementActionFuncs_WalkFastestDown[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkFastestDown_Step0, - MovementAction_WalkFastestDown_Step1, +u8 (*const gMovementActionFuncs_WalkFasterDown[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkFasterDown_Step0, + MovementAction_WalkFasterDown_Step1, MovementAction_PauseSpriteAnim, }; -u8 (*const gMovementActionFuncs_WalkFastestUp[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkFastestUp_Step0, - MovementAction_WalkFastestUp_Step1, +u8 (*const gMovementActionFuncs_WalkFasterUp[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkFasterUp_Step0, + MovementAction_WalkFasterUp_Step1, MovementAction_PauseSpriteAnim, }; -u8 (*const gMovementActionFuncs_WalkFastestLeft[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkFastestLeft_Step0, - MovementAction_WalkFastestLeft_Step1, +u8 (*const gMovementActionFuncs_WalkFasterLeft[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkFasterLeft_Step0, + MovementAction_WalkFasterLeft_Step1, MovementAction_PauseSpriteAnim, }; -u8 (*const gMovementActionFuncs_WalkFastestRight[])(struct ObjectEvent *, struct Sprite *) = { - MovementAction_WalkFastestRight_Step0, - MovementAction_WalkFastestRight_Step1, +u8 (*const gMovementActionFuncs_WalkFasterRight[])(struct ObjectEvent *, struct Sprite *) = { + MovementAction_WalkFasterRight_Step0, + MovementAction_WalkFasterRight_Step1, MovementAction_PauseSpriteAnim, }; diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 074fa2386..1bb4991ab 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -32,6 +32,14 @@ // this file was known as evobjmv.c in Game Freak's original source +enum { + MOVE_SPEED_NORMAL, // walking + MOVE_SPEED_FAST_1, // running / surfing / sliding (ice tile) + MOVE_SPEED_FAST_2, // water current / acro bike + MOVE_SPEED_FASTER, // mach bike's max speed + MOVE_SPEED_FASTEST, +}; + // Sprite data used throughout #define sObjEventId data[0] #define sTypeFuncId data[1] // Index into corresponding gMovementTypeFuncs_* table @@ -941,12 +949,12 @@ const u8 gRideWaterCurrentMovementActions[] = { MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT, MOVEMENT_ACTION_RIDE_WATER_CURRENT_RIGHT, }; -const u8 gWalkFastestMovementActions[] = { - MOVEMENT_ACTION_WALK_FASTEST_DOWN, - MOVEMENT_ACTION_WALK_FASTEST_DOWN, - MOVEMENT_ACTION_WALK_FASTEST_UP, - MOVEMENT_ACTION_WALK_FASTEST_LEFT, - MOVEMENT_ACTION_WALK_FASTEST_RIGHT, +const u8 gWalkFasterMovementActions[] = { + MOVEMENT_ACTION_WALK_FASTER_DOWN, + MOVEMENT_ACTION_WALK_FASTER_DOWN, + MOVEMENT_ACTION_WALK_FASTER_UP, + MOVEMENT_ACTION_WALK_FASTER_LEFT, + MOVEMENT_ACTION_WALK_FASTER_RIGHT, }; const u8 gSlideMovementActions[] = { MOVEMENT_ACTION_SLIDE_DOWN, @@ -4314,7 +4322,7 @@ bool8 CopyablePlayerMovement_GoSpeed2(struct ObjectEvent *objectEvent, struct Sp direction = playerDirection; direction = state_to_direction(gInitialMovementTypeFacingDirections[objectEvent->movementType], objectEvent->directionSequenceIndex, direction); ObjectEventMoveDestCoords(objectEvent, direction, &x, &y); - ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkFastestMovementAction(direction)); + ObjectEventSetSingleMovement(objectEvent, sprite, GetWalkFasterMovementAction(direction)); if (GetCollisionAtCoords(objectEvent, x, y, direction) || (tileCallback != NULL && !tileCallback(MapGridGetMetatileBehaviorAt(x, y)))) { ObjectEventSetSingleMovement(objectEvent, sprite, GetFaceDirectionMovementAction(direction)); @@ -5025,7 +5033,7 @@ dirn_to_anim(GetWalkSlowMovementAction, gWalkSlowMovementActions); dirn_to_anim(GetWalkNormalMovementAction, gWalkNormalMovementActions); dirn_to_anim(GetWalkFastMovementAction, gWalkFastMovementActions); dirn_to_anim(GetRideWaterCurrentMovementAction, gRideWaterCurrentMovementActions); -dirn_to_anim(GetWalkFastestMovementAction, gWalkFastestMovementActions); +dirn_to_anim(GetWalkFasterMovementAction, gWalkFasterMovementActions); dirn_to_anim(GetSlideMovementAction, gSlideMovementActions); dirn_to_anim(GetPlayerRunMovementAction, gPlayerRunMovementActions); dirn_to_anim(GetJump2MovementAction, gJump2MovementActions); @@ -5356,7 +5364,7 @@ bool8 MovementAction_WalkSlowRight_Step1(struct ObjectEvent *objectEvent, struct bool8 MovementAction_WalkNormalDiagonalUpLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTHWEST, 0); + InitMovementNormal(objectEvent, sprite, DIR_NORTHWEST, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalDiagonalUpLeft_Step1(objectEvent, sprite); } @@ -5372,7 +5380,7 @@ bool8 MovementAction_WalkNormalDiagonalUpLeft_Step1(struct ObjectEvent *objectEv bool8 MovementAction_WalkNormalDiagonalUpRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTHEAST, 0); + InitMovementNormal(objectEvent, sprite, DIR_NORTHEAST, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalDiagonalUpRight_Step1(objectEvent, sprite); } @@ -5388,7 +5396,7 @@ bool8 MovementAction_WalkNormalDiagonalUpRight_Step1(struct ObjectEvent *objectE bool8 MovementAction_WalkNormalDiagonalDownLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTHWEST, 0); + InitMovementNormal(objectEvent, sprite, DIR_SOUTHWEST, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalDiagonalDownLeft_Step1(objectEvent, sprite); } @@ -5404,7 +5412,7 @@ bool8 MovementAction_WalkNormalDiagonalDownLeft_Step1(struct ObjectEvent *object bool8 MovementAction_WalkNormalDiagonalDownRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTHEAST, 0); + InitMovementNormal(objectEvent, sprite, DIR_SOUTHEAST, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalDiagonalDownRight_Step1(objectEvent, sprite); } @@ -5420,7 +5428,7 @@ bool8 MovementAction_WalkNormalDiagonalDownRight_Step1(struct ObjectEvent *objec bool8 MovementAction_WalkNormalDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 0); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalDown_Step1(objectEvent, sprite); } @@ -5436,7 +5444,7 @@ bool8 MovementAction_WalkNormalDown_Step1(struct ObjectEvent *objectEvent, struc bool8 MovementAction_WalkNormalUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 0); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalUp_Step1(objectEvent, sprite); } @@ -5452,7 +5460,7 @@ bool8 MovementAction_WalkNormalUp_Step1(struct ObjectEvent *objectEvent, struct bool8 MovementAction_WalkNormalLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 0); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalLeft_Step1(objectEvent, sprite); } @@ -5468,7 +5476,7 @@ bool8 MovementAction_WalkNormalLeft_Step1(struct ObjectEvent *objectEvent, struc bool8 MovementAction_WalkNormalRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 0); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_NORMAL); return MovementAction_WalkNormalRight_Step1(objectEvent, sprite); } @@ -5701,7 +5709,7 @@ bool8 MovementAction_Delay16_Step0(struct ObjectEvent *objectEvent, struct Sprit bool8 MovementAction_WalkFastDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 1); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FAST_1); return MovementAction_WalkFastDown_Step1(objectEvent, sprite); } @@ -5717,7 +5725,7 @@ bool8 MovementAction_WalkFastDown_Step1(struct ObjectEvent *objectEvent, struct bool8 MovementAction_WalkFastUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 1); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FAST_1); return MovementAction_WalkFastUp_Step1(objectEvent, sprite); } @@ -5733,7 +5741,7 @@ bool8 MovementAction_WalkFastUp_Step1(struct ObjectEvent *objectEvent, struct Sp bool8 MovementAction_WalkFastLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 1); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FAST_1); return MovementAction_WalkFastLeft_Step1(objectEvent, sprite); } @@ -5749,7 +5757,7 @@ bool8 MovementAction_WalkFastLeft_Step1(struct ObjectEvent *objectEvent, struct bool8 MovementAction_WalkFastRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 1); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FAST_1); return MovementAction_WalkFastRight_Step1(objectEvent, sprite); } @@ -5891,7 +5899,7 @@ bool8 MovementAction_WalkInPlaceFastestRight_Step0(struct ObjectEvent *objectEve bool8 MovementAction_RideWaterCurrentDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 2); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FAST_2); return MovementAction_RideWaterCurrentDown_Step1(objectEvent, sprite); } @@ -5907,7 +5915,7 @@ bool8 MovementAction_RideWaterCurrentDown_Step1(struct ObjectEvent *objectEvent, bool8 MovementAction_RideWaterCurrentUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 2); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FAST_2); return MovementAction_RideWaterCurrentUp_Step1(objectEvent, sprite); } @@ -5923,7 +5931,7 @@ bool8 MovementAction_RideWaterCurrentUp_Step1(struct ObjectEvent *objectEvent, s bool8 MovementAction_RideWaterCurrentLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 2); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FAST_2); return MovementAction_RideWaterCurrentLeft_Step1(objectEvent, sprite); } @@ -5939,7 +5947,7 @@ bool8 MovementAction_RideWaterCurrentLeft_Step1(struct ObjectEvent *objectEvent, bool8 MovementAction_RideWaterCurrentRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 2); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FAST_2); return MovementAction_RideWaterCurrentRight_Step1(objectEvent, sprite); } @@ -5953,13 +5961,13 @@ bool8 MovementAction_RideWaterCurrentRight_Step1(struct ObjectEvent *objectEvent return FALSE; } -bool8 MovementAction_WalkFastestDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 MovementAction_WalkFasterDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 3); - return MovementAction_WalkFastestDown_Step1(objectEvent, sprite); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FASTER); + return MovementAction_WalkFasterDown_Step1(objectEvent, sprite); } -bool8 MovementAction_WalkFastestDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 MovementAction_WalkFasterDown_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -5969,13 +5977,13 @@ bool8 MovementAction_WalkFastestDown_Step1(struct ObjectEvent *objectEvent, stru return FALSE; } -bool8 MovementAction_WalkFastestUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 MovementAction_WalkFasterUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 3); - return MovementAction_WalkFastestUp_Step1(objectEvent, sprite); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FASTER); + return MovementAction_WalkFasterUp_Step1(objectEvent, sprite); } -bool8 MovementAction_WalkFastestUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 MovementAction_WalkFasterUp_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -5985,13 +5993,13 @@ bool8 MovementAction_WalkFastestUp_Step1(struct ObjectEvent *objectEvent, struct return FALSE; } -bool8 MovementAction_WalkFastestLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 MovementAction_WalkFasterLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 3); - return MovementAction_WalkFastestLeft_Step1(objectEvent, sprite); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FASTER); + return MovementAction_WalkFasterLeft_Step1(objectEvent, sprite); } -bool8 MovementAction_WalkFastestLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 MovementAction_WalkFasterLeft_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -6001,13 +6009,13 @@ bool8 MovementAction_WalkFastestLeft_Step1(struct ObjectEvent *objectEvent, stru return FALSE; } -bool8 MovementAction_WalkFastestRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 MovementAction_WalkFasterRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 3); - return MovementAction_WalkFastestRight_Step1(objectEvent, sprite); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FASTER); + return MovementAction_WalkFasterRight_Step1(objectEvent, sprite); } -bool8 MovementAction_WalkFastestRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) +bool8 MovementAction_WalkFasterRight_Step1(struct ObjectEvent *objectEvent, struct Sprite *sprite) { if (UpdateMovementNormal(objectEvent, sprite)) { @@ -6019,7 +6027,7 @@ bool8 MovementAction_WalkFastestRight_Step1(struct ObjectEvent *objectEvent, str bool8 MovementAction_SlideDown_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_SOUTH, 4); + InitMovementNormal(objectEvent, sprite, DIR_SOUTH, MOVE_SPEED_FASTEST); return MovementAction_SlideDown_Step1(objectEvent, sprite); } @@ -6035,7 +6043,7 @@ bool8 MovementAction_SlideDown_Step1(struct ObjectEvent *objectEvent, struct Spr bool8 MovementAction_SlideUp_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_NORTH, 4); + InitMovementNormal(objectEvent, sprite, DIR_NORTH, MOVE_SPEED_FASTEST); return MovementAction_SlideUp_Step1(objectEvent, sprite); } @@ -6051,7 +6059,7 @@ bool8 MovementAction_SlideUp_Step1(struct ObjectEvent *objectEvent, struct Sprit bool8 MovementAction_SlideLeft_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 4); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FASTEST); return MovementAction_SlideLeft_Step1(objectEvent, sprite); } @@ -6067,7 +6075,7 @@ bool8 MovementAction_SlideLeft_Step1(struct ObjectEvent *objectEvent, struct Spr bool8 MovementAction_SlideRight_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 4); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FASTEST); return MovementAction_SlideRight_Step1(objectEvent, sprite); } @@ -6728,7 +6736,7 @@ bool8 MovementAction_WalkDownAffine_Step1(struct ObjectEvent *objectEvent, struc bool8 MovementAction_WalkLeftAffine_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_WEST, 1); + InitMovementNormal(objectEvent, sprite, DIR_WEST, MOVE_SPEED_FAST_1); sprite->affineAnimPaused = FALSE; ChangeSpriteAffineAnimIfDifferent(sprite, 2); return MovementAction_WalkLeftAffine_Step1(objectEvent, sprite); @@ -6747,7 +6755,7 @@ bool8 MovementAction_WalkLeftAffine_Step1(struct ObjectEvent *objectEvent, struc bool8 MovementAction_WalkRightAffine_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite) { - InitMovementNormal(objectEvent, sprite, DIR_EAST, 1); + InitMovementNormal(objectEvent, sprite, DIR_EAST, MOVE_SPEED_FAST_1); sprite->affineAnimPaused = FALSE; ChangeSpriteAffineAnimIfDifferent(sprite, 3); return MovementAction_WalkRightAffine_Step1(objectEvent, sprite); diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 6ce304c2c..00800636d 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -470,27 +470,27 @@ static u8 DoForcedMovementInCurrentDirection(void (*a)(u8)) static bool8 ForcedMovement_Slip(void) { - return DoForcedMovementInCurrentDirection(PlayerGoSpeed2); + return DoForcedMovementInCurrentDirection(PlayerWalkFast); } static bool8 ForcedMovement_WalkSouth(void) { - return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed1); + return DoForcedMovement(DIR_SOUTH, PlayerWalkNormal); } static bool8 ForcedMovement_WalkNorth(void) { - return DoForcedMovement(DIR_NORTH, PlayerGoSpeed1); + return DoForcedMovement(DIR_NORTH, PlayerWalkNormal); } static bool8 ForcedMovement_WalkWest(void) { - return DoForcedMovement(DIR_WEST, PlayerGoSpeed1); + return DoForcedMovement(DIR_WEST, PlayerWalkNormal); } static bool8 ForcedMovement_WalkEast(void) { - return DoForcedMovement(DIR_EAST, PlayerGoSpeed1); + return DoForcedMovement(DIR_EAST, PlayerWalkNormal); } static bool8 ForcedMovement_PushedSouthByCurrent(void) @@ -524,22 +524,22 @@ static u8 ForcedMovement_Slide(u8 direction, void (*b)(u8)) static bool8 ForcedMovement_SlideSouth(void) { - return ForcedMovement_Slide(DIR_SOUTH, PlayerGoSpeed2); + return ForcedMovement_Slide(DIR_SOUTH, PlayerWalkFast); } static bool8 ForcedMovement_SlideNorth(void) { - return ForcedMovement_Slide(DIR_NORTH, PlayerGoSpeed2); + return ForcedMovement_Slide(DIR_NORTH, PlayerWalkFast); } static bool8 ForcedMovement_SlideWest(void) { - return ForcedMovement_Slide(DIR_WEST, PlayerGoSpeed2); + return ForcedMovement_Slide(DIR_WEST, PlayerWalkFast); } static bool8 ForcedMovement_SlideEast(void) { - return ForcedMovement_Slide(DIR_EAST, PlayerGoSpeed2); + return ForcedMovement_Slide(DIR_EAST, PlayerWalkFast); } static bool8 ForcedMovement_MatJump(void) @@ -562,7 +562,7 @@ static bool8 ForcedMovement_MuddySlope(void) { Bike_UpdateBikeCounterSpeed(0); playerObjEvent->facingDirectionLocked = TRUE; - return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed2); + return DoForcedMovement(DIR_SOUTH, PlayerWalkFast); } else { @@ -631,8 +631,8 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) { - // speed 2 is fast, same speed as running - PlayerGoSpeed2(direction); + // same speed as running + PlayerWalkFast(direction); return; } @@ -645,7 +645,7 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) } else { - PlayerGoSpeed1(direction); + PlayerWalkNormal(direction); } } @@ -953,16 +953,14 @@ void PlayerSetAnimId(u8 movementActionId, u8 copyableMovement) } } -// normal speed (1 speed) -void PlayerGoSpeed1(u8 a) +void PlayerWalkNormal(u8 direction) { - PlayerSetAnimId(GetWalkNormalMovementAction(a), 2); + PlayerSetAnimId(GetWalkNormalMovementAction(direction), 2); } -// fast speed (2 speed) -void PlayerGoSpeed2(u8 a) +void PlayerWalkFast(u8 direction) { - PlayerSetAnimId(GetWalkFastMovementAction(a), 2); + PlayerSetAnimId(GetWalkFastMovementAction(direction), 2); } void PlayerRideWaterCurrent(u8 a) @@ -970,10 +968,9 @@ void PlayerRideWaterCurrent(u8 a) PlayerSetAnimId(GetRideWaterCurrentMovementAction(a), 2); } -// fastest speed (4 speed) -void PlayerGoSpeed4(u8 a) +void PlayerWalkFaster(u8 direction) { - PlayerSetAnimId(GetWalkFastestMovementAction(a), 2); + PlayerSetAnimId(GetWalkFasterMovementAction(direction), 2); } static void PlayerRun(u8 a)