mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 12:14:20 +01:00
Add missing array constants in field_player_avatar
This commit is contained in:
parent
a837d1fe2c
commit
8f1a760937
@ -30,6 +30,15 @@
|
|||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
#include "constants/trainer_types.h"
|
#include "constants/trainer_types.h"
|
||||||
|
|
||||||
|
#define NUM_FORCED_MOVEMENTS 18
|
||||||
|
#define NUM_ACRO_BIKE_COLLISIONS 5
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PLAYER_STILL,
|
||||||
|
PLAYER_TURNING,
|
||||||
|
PLAYER_MOVING,
|
||||||
|
};
|
||||||
|
|
||||||
static EWRAM_DATA u8 sSpinStartFacingDir = 0;
|
static EWRAM_DATA u8 sSpinStartFacingDir = 0;
|
||||||
EWRAM_DATA struct ObjectEvent gObjectEvents[OBJECT_EVENTS_COUNT] = {};
|
EWRAM_DATA struct ObjectEvent gObjectEvents[OBJECT_EVENTS_COUNT] = {};
|
||||||
EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {};
|
EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {};
|
||||||
@ -139,9 +148,7 @@ static void AlignFishingAnimationFrames(void);
|
|||||||
|
|
||||||
static u8 TrySpinPlayerForWarp(struct ObjectEvent *object, s16 *a1);
|
static u8 TrySpinPlayerForWarp(struct ObjectEvent *object, s16 *a1);
|
||||||
|
|
||||||
// .rodata
|
static bool8 (*const sForcedMovementTestFuncs[NUM_FORCED_MOVEMENTS])(u8) =
|
||||||
|
|
||||||
static bool8 (*const sForcedMovementTestFuncs[])(u8) =
|
|
||||||
{
|
{
|
||||||
MetatileBehavior_IsTrickHouseSlipperyFloor,
|
MetatileBehavior_IsTrickHouseSlipperyFloor,
|
||||||
MetatileBehavior_IsIce_2,
|
MetatileBehavior_IsIce_2,
|
||||||
@ -163,7 +170,8 @@ static bool8 (*const sForcedMovementTestFuncs[])(u8) =
|
|||||||
MetatileBehavior_IsMuddySlope,
|
MetatileBehavior_IsMuddySlope,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool8 (*const sForcedMovementFuncs[])(void) =
|
// + 1 for ForcedMovement_None, which is excluded above
|
||||||
|
static bool8 (*const sForcedMovementFuncs[NUM_FORCED_MOVEMENTS + 1])(void) =
|
||||||
{
|
{
|
||||||
ForcedMovement_None,
|
ForcedMovement_None,
|
||||||
ForcedMovement_Slip,
|
ForcedMovement_Slip,
|
||||||
@ -188,12 +196,12 @@ static bool8 (*const sForcedMovementFuncs[])(void) =
|
|||||||
|
|
||||||
static void (*const sPlayerNotOnBikeFuncs[])(u8, u16) =
|
static void (*const sPlayerNotOnBikeFuncs[])(u8, u16) =
|
||||||
{
|
{
|
||||||
PlayerNotOnBikeNotMoving,
|
[PLAYER_STILL] = PlayerNotOnBikeNotMoving,
|
||||||
PlayerNotOnBikeTurningInPlace,
|
[PLAYER_TURNING] = PlayerNotOnBikeTurningInPlace,
|
||||||
PlayerNotOnBikeMoving,
|
[PLAYER_MOVING] = PlayerNotOnBikeMoving,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool8 (*const sAcroBikeTrickMetatiles[])(u8) =
|
static bool8 (*const sAcroBikeTrickMetatiles[NUM_ACRO_BIKE_COLLISIONS])(u8) =
|
||||||
{
|
{
|
||||||
MetatileBehavior_IsBumpySlope,
|
MetatileBehavior_IsBumpySlope,
|
||||||
MetatileBehavior_IsIsolatedVerticalRail,
|
MetatileBehavior_IsIsolatedVerticalRail,
|
||||||
@ -202,7 +210,7 @@ static bool8 (*const sAcroBikeTrickMetatiles[])(u8) =
|
|||||||
MetatileBehavior_IsHorizontalRail,
|
MetatileBehavior_IsHorizontalRail,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 sAcroBikeTrickCollisionTypes[] = {
|
static const u8 sAcroBikeTrickCollisionTypes[NUM_ACRO_BIKE_COLLISIONS] = {
|
||||||
COLLISION_WHEELIE_HOP,
|
COLLISION_WHEELIE_HOP,
|
||||||
COLLISION_ISOLATED_VERTICAL_RAIL,
|
COLLISION_ISOLATED_VERTICAL_RAIL,
|
||||||
COLLISION_ISOLATED_HORIZONTAL_RAIL,
|
COLLISION_ISOLATED_HORIZONTAL_RAIL,
|
||||||
@ -232,33 +240,41 @@ static bool8 (*const sArrowWarpMetatileBehaviorChecks[])(u8) =
|
|||||||
|
|
||||||
static const u8 sRivalAvatarGfxIds[][2] =
|
static const u8 sRivalAvatarGfxIds[][2] =
|
||||||
{
|
{
|
||||||
{OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL, OBJ_EVENT_GFX_RIVAL_MAY_NORMAL},
|
[PLAYER_AVATAR_STATE_NORMAL] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL, OBJ_EVENT_GFX_RIVAL_MAY_NORMAL},
|
||||||
{OBJ_EVENT_GFX_RIVAL_BRENDAN_MACH_BIKE, OBJ_EVENT_GFX_RIVAL_MAY_MACH_BIKE},
|
[PLAYER_AVATAR_STATE_MACH_BIKE] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_MACH_BIKE, OBJ_EVENT_GFX_RIVAL_MAY_MACH_BIKE},
|
||||||
{OBJ_EVENT_GFX_RIVAL_BRENDAN_ACRO_BIKE, OBJ_EVENT_GFX_RIVAL_MAY_ACRO_BIKE},
|
[PLAYER_AVATAR_STATE_ACRO_BIKE] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_ACRO_BIKE, OBJ_EVENT_GFX_RIVAL_MAY_ACRO_BIKE},
|
||||||
{OBJ_EVENT_GFX_RIVAL_BRENDAN_SURFING, OBJ_EVENT_GFX_RIVAL_MAY_SURFING},
|
[PLAYER_AVATAR_STATE_SURFING] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_SURFING, OBJ_EVENT_GFX_RIVAL_MAY_SURFING},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_UNDERWATER, OBJ_EVENT_GFX_MAY_UNDERWATER},
|
[PLAYER_AVATAR_STATE_UNDERWATER] = {OBJ_EVENT_GFX_BRENDAN_UNDERWATER, OBJ_EVENT_GFX_MAY_UNDERWATER},
|
||||||
{OBJ_EVENT_GFX_RIVAL_BRENDAN_FIELD_MOVE, OBJ_EVENT_GFX_RIVAL_MAY_FIELD_MOVE},
|
[PLAYER_AVATAR_STATE_FIELD_MOVE] = {OBJ_EVENT_GFX_RIVAL_BRENDAN_FIELD_MOVE, OBJ_EVENT_GFX_RIVAL_MAY_FIELD_MOVE},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_FISHING, OBJ_EVENT_GFX_MAY_FISHING},
|
[PLAYER_AVATAR_STATE_FISHING] = {OBJ_EVENT_GFX_BRENDAN_FISHING, OBJ_EVENT_GFX_MAY_FISHING},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_WATERING, OBJ_EVENT_GFX_MAY_WATERING}
|
[PLAYER_AVATAR_STATE_WATERING] = {OBJ_EVENT_GFX_BRENDAN_WATERING, OBJ_EVENT_GFX_MAY_WATERING}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 sPlayerAvatarGfxIds[][2] =
|
static const u8 sPlayerAvatarGfxIds[][2] =
|
||||||
{
|
{
|
||||||
{OBJ_EVENT_GFX_BRENDAN_NORMAL, OBJ_EVENT_GFX_MAY_NORMAL},
|
[PLAYER_AVATAR_STATE_NORMAL] = {OBJ_EVENT_GFX_BRENDAN_NORMAL, OBJ_EVENT_GFX_MAY_NORMAL},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_MACH_BIKE, OBJ_EVENT_GFX_MAY_MACH_BIKE},
|
[PLAYER_AVATAR_STATE_MACH_BIKE] = {OBJ_EVENT_GFX_BRENDAN_MACH_BIKE, OBJ_EVENT_GFX_MAY_MACH_BIKE},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_ACRO_BIKE, OBJ_EVENT_GFX_MAY_ACRO_BIKE},
|
[PLAYER_AVATAR_STATE_ACRO_BIKE] = {OBJ_EVENT_GFX_BRENDAN_ACRO_BIKE, OBJ_EVENT_GFX_MAY_ACRO_BIKE},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_SURFING, OBJ_EVENT_GFX_MAY_SURFING},
|
[PLAYER_AVATAR_STATE_SURFING] = {OBJ_EVENT_GFX_BRENDAN_SURFING, OBJ_EVENT_GFX_MAY_SURFING},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_UNDERWATER, OBJ_EVENT_GFX_MAY_UNDERWATER},
|
[PLAYER_AVATAR_STATE_UNDERWATER] = {OBJ_EVENT_GFX_BRENDAN_UNDERWATER, OBJ_EVENT_GFX_MAY_UNDERWATER},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_FIELD_MOVE, OBJ_EVENT_GFX_MAY_FIELD_MOVE},
|
[PLAYER_AVATAR_STATE_FIELD_MOVE] = {OBJ_EVENT_GFX_BRENDAN_FIELD_MOVE, OBJ_EVENT_GFX_MAY_FIELD_MOVE},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_FISHING, OBJ_EVENT_GFX_MAY_FISHING},
|
[PLAYER_AVATAR_STATE_FISHING] = {OBJ_EVENT_GFX_BRENDAN_FISHING, OBJ_EVENT_GFX_MAY_FISHING},
|
||||||
{OBJ_EVENT_GFX_BRENDAN_WATERING, OBJ_EVENT_GFX_MAY_WATERING},
|
[PLAYER_AVATAR_STATE_WATERING] = {OBJ_EVENT_GFX_BRENDAN_WATERING, OBJ_EVENT_GFX_MAY_WATERING},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 sFRLGAvatarGfxIds[] = {OBJ_EVENT_GFX_RED, OBJ_EVENT_GFX_LEAF};
|
static const u8 sFRLGAvatarGfxIds[GENDER_COUNT] =
|
||||||
|
{
|
||||||
|
[MALE] = OBJ_EVENT_GFX_RED,
|
||||||
|
[FEMALE] = OBJ_EVENT_GFX_LEAF
|
||||||
|
};
|
||||||
|
|
||||||
static const u8 sRSAvatarGfxIds[] = {OBJ_EVENT_GFX_LINK_RS_BRENDAN, OBJ_EVENT_GFX_LINK_RS_MAY};
|
static const u8 sRSAvatarGfxIds[GENDER_COUNT] =
|
||||||
|
{
|
||||||
|
[MALE] = OBJ_EVENT_GFX_LINK_RS_BRENDAN,
|
||||||
|
[FEMALE] = OBJ_EVENT_GFX_LINK_RS_MAY
|
||||||
|
};
|
||||||
|
|
||||||
static const u8 sPlayerAvatarGfxToStateFlag[2][5][2] =
|
static const u8 sPlayerAvatarGfxToStateFlag[GENDER_COUNT][5][2] =
|
||||||
{
|
{
|
||||||
[MALE] =
|
[MALE] =
|
||||||
{
|
{
|
||||||
@ -306,8 +322,6 @@ static bool8 (*const sPlayerAvatarSecretBaseMatSpin[])(struct Task *, struct Obj
|
|||||||
PlayerAvatar_SecretBaseMatSpinStep3,
|
PlayerAvatar_SecretBaseMatSpinStep3,
|
||||||
};
|
};
|
||||||
|
|
||||||
// .text
|
|
||||||
|
|
||||||
void MovementType_Player(struct Sprite *sprite)
|
void MovementType_Player(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, ObjectEventCB2_NoMovement2);
|
UpdateObjectEventCurrentMovement(&gObjectEvents[sprite->data[0]], sprite, ObjectEventCB2_NoMovement2);
|
||||||
@ -406,7 +420,7 @@ static u8 GetForcedMovementByMetatileBehavior(void)
|
|||||||
{
|
{
|
||||||
u8 metatileBehavior = gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior;
|
u8 metatileBehavior = gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior;
|
||||||
|
|
||||||
for (i = 0; i < 18; i++)
|
for (i = 0; i < NUM_FORCED_MOVEMENTS; i++)
|
||||||
{
|
{
|
||||||
if (sForcedMovementTestFuncs[i](metatileBehavior))
|
if (sForcedMovementTestFuncs[i](metatileBehavior))
|
||||||
return i + 1;
|
return i + 1;
|
||||||
@ -429,7 +443,7 @@ static bool8 ForcedMovement_None(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 DoForcedMovement(u8 direction, void (*b)(u8))
|
static bool8 DoForcedMovement(u8 direction, void (*moveFunc)(u8))
|
||||||
{
|
{
|
||||||
struct PlayerAvatar *playerAvatar = &gPlayerAvatar;
|
struct PlayerAvatar *playerAvatar = &gPlayerAvatar;
|
||||||
u8 collision = CheckForPlayerAvatarCollision(direction);
|
u8 collision = CheckForPlayerAvatarCollision(direction);
|
||||||
@ -440,7 +454,7 @@ static u8 DoForcedMovement(u8 direction, void (*b)(u8))
|
|||||||
ForcedMovement_None();
|
ForcedMovement_None();
|
||||||
if (collision < COLLISION_STOP_SURFING)
|
if (collision < COLLISION_STOP_SURFING)
|
||||||
{
|
{
|
||||||
return 0;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -448,23 +462,23 @@ static u8 DoForcedMovement(u8 direction, void (*b)(u8))
|
|||||||
PlayerJumpLedge(direction);
|
PlayerJumpLedge(direction);
|
||||||
playerAvatar->flags |= PLAYER_AVATAR_FLAG_FORCED_MOVE;
|
playerAvatar->flags |= PLAYER_AVATAR_FLAG_FORCED_MOVE;
|
||||||
playerAvatar->runningState = MOVING;
|
playerAvatar->runningState = MOVING;
|
||||||
return 1;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playerAvatar->runningState = MOVING;
|
playerAvatar->runningState = MOVING;
|
||||||
b(direction);
|
moveFunc(direction);
|
||||||
return 1;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 DoForcedMovementInCurrentDirection(void (*a)(u8))
|
static bool8 DoForcedMovementInCurrentDirection(void (*moveFunc)(u8))
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
playerObjEvent->disableAnim = TRUE;
|
playerObjEvent->disableAnim = TRUE;
|
||||||
return DoForcedMovement(playerObjEvent->movementDirection, a);
|
return DoForcedMovement(playerObjEvent->movementDirection, moveFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 ForcedMovement_Slip(void)
|
static bool8 ForcedMovement_Slip(void)
|
||||||
@ -512,13 +526,13 @@ static bool8 ForcedMovement_PushedEastByCurrent(void)
|
|||||||
return DoForcedMovement(DIR_EAST, PlayerRideWaterCurrent);
|
return DoForcedMovement(DIR_EAST, PlayerRideWaterCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 ForcedMovement_Slide(u8 direction, void (*b)(u8))
|
static bool8 ForcedMovement_Slide(u8 direction, void (*moveFunc)(u8))
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
playerObjEvent->disableAnim = TRUE;
|
playerObjEvent->disableAnim = TRUE;
|
||||||
playerObjEvent->facingDirectionLocked = TRUE;
|
playerObjEvent->facingDirectionLocked = TRUE;
|
||||||
return DoForcedMovement(direction, b);
|
return DoForcedMovement(direction, moveFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 ForcedMovement_SlideSouth(void)
|
static bool8 ForcedMovement_SlideSouth(void)
|
||||||
@ -579,17 +593,17 @@ static u8 CheckMovementInputNotOnBike(u8 direction)
|
|||||||
if (direction == DIR_NONE)
|
if (direction == DIR_NONE)
|
||||||
{
|
{
|
||||||
gPlayerAvatar.runningState = NOT_MOVING;
|
gPlayerAvatar.runningState = NOT_MOVING;
|
||||||
return 0;
|
return PLAYER_STILL;
|
||||||
}
|
}
|
||||||
else if (direction != GetPlayerMovementDirection() && gPlayerAvatar.runningState != MOVING)
|
else if (direction != GetPlayerMovementDirection() && gPlayerAvatar.runningState != MOVING)
|
||||||
{
|
{
|
||||||
gPlayerAvatar.runningState = TURN_DIRECTION;
|
gPlayerAvatar.runningState = TURN_DIRECTION;
|
||||||
return 1;
|
return PLAYER_TURNING;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gPlayerAvatar.runningState = MOVING;
|
gPlayerAvatar.runningState = MOVING;
|
||||||
return 2;
|
return PLAYER_MOVING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -755,7 +769,7 @@ static void CheckAcroBikeCollision(s16 x, s16 y, u8 metatileBehavior, u8 *collis
|
|||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_COUNT(sAcroBikeTrickMetatiles); i++)
|
for (i = 0; i < NUM_ACRO_BIKE_COLLISIONS; i++)
|
||||||
{
|
{
|
||||||
if (sAcroBikeTrickMetatiles[i](metatileBehavior))
|
if (sAcroBikeTrickMetatiles[i](metatileBehavior))
|
||||||
{
|
{
|
||||||
|
@ -1408,10 +1408,10 @@ static void NamingScreen_CreatePlayerIcon(void)
|
|||||||
u8 rivalGfxId;
|
u8 rivalGfxId;
|
||||||
u8 spriteId;
|
u8 spriteId;
|
||||||
|
|
||||||
rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(0, sNamingScreen->monSpecies);
|
rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, sNamingScreen->monSpecies);
|
||||||
spriteId = CreateObjectGraphicsSprite(rivalGfxId, SpriteCallbackDummy, 56, 37, 0);
|
spriteId = CreateObjectGraphicsSprite(rivalGfxId, SpriteCallbackDummy, 56, 37, 0);
|
||||||
gSprites[spriteId].oam.priority = 3;
|
gSprites[spriteId].oam.priority = 3;
|
||||||
StartSpriteAnim(&gSprites[spriteId], 4);
|
StartSpriteAnim(&gSprites[spriteId], ANIM_STD_GO_SOUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NamingScreen_CreatePCIcon(void)
|
static void NamingScreen_CreatePCIcon(void)
|
||||||
@ -1438,7 +1438,7 @@ static void NamingScreen_CreateWaldaDadIcon(void)
|
|||||||
|
|
||||||
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MAN_1, SpriteCallbackDummy, 56, 37, 0);
|
spriteId = CreateObjectGraphicsSprite(OBJ_EVENT_GFX_MAN_1, SpriteCallbackDummy, 56, 37, 0);
|
||||||
gSprites[spriteId].oam.priority = 3;
|
gSprites[spriteId].oam.priority = 3;
|
||||||
StartSpriteAnim(&gSprites[spriteId], 4);
|
StartSpriteAnim(&gSprites[spriteId], ANIM_STD_GO_SOUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user