Finish porting/decompiling field_player_avatar

This commit is contained in:
Diegoisawesome 2018-10-19 00:05:54 -05:00
parent 6206acd2d2
commit dd3689fdbf
13 changed files with 1652 additions and 4356 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8335,7 +8335,7 @@ _08019C5A:
beq _08019CE6 beq _08019CE6
mov r0, sp mov r0, sp
adds r1, r4, 0 adds r1, r4, 0
bl plaer_get_pos_including_state_based_drift bl player_get_pos_including_state_based_drift
mov r0, sp mov r0, sp
movs r1, 0 movs r1, 0
ldrsh r2, [r0, r1] ldrsh r2, [r0, r1]
@ -8881,7 +8881,7 @@ sub_801A064: @ 801A064
adds r5, 0x6 adds r5, 0x6
adds r0, r4, 0 adds r0, r4, 0
adds r1, r5, 0 adds r1, r5, 0
bl plaer_get_pos_including_state_based_drift bl player_get_pos_including_state_based_drift
lsls r0, r7, 2 lsls r0, r7, 2
adds r0, r7 adds r0, r7
subs r0, 0x38 subs r0, 0x38

View File

@ -143,9 +143,27 @@ u8 GetCollisionFlagsAtCoords(struct EventObject *eventObject, s16 x, s16 y, u8 d
u8 GetFaceDirectionMovementAction(u32); u8 GetFaceDirectionMovementAction(u32);
u8 GetWalkNormalMovementAction(u32); u8 GetWalkNormalMovementAction(u32);
u8 GetWalkFastMovementAction(u32); u8 GetWalkFastMovementAction(u32);
u8 GetRideWaterCurrentMovementAction(u32);
u8 GetWalkFastestMovementAction(u32); u8 GetWalkFastestMovementAction(u32);
u8 GetPlayerRunMovementAction(u32);
u8 GetJumpInPlaceMovementAction(u32); u8 GetJumpInPlaceMovementAction(u32);
u8 GetAcroWheelieFaceDirectionMovementAction(u32);
u8 GetAcroPopWheelieFaceDirectionMovementAction(u32);
u8 GetAcroEndWheelieFaceDirectionMovementAction(u32);
u8 GetAcroWheelieHopFaceDirectionMovementAction(u32);
u8 GetAcroWheelieHopDirectionMovementAction(u32);
u8 GetAcroWheelieJumpDirectionMovementAction(u32);
u8 GetJumpInPlaceTurnAroundMovementAction(u32);
u8 GetAcroWheelieInPlaceDirectionMovementAction(u32);
u8 GetAcroPopWheelieMoveDirectionMovementAction(u32);
u8 GetAcroWheelieMoveDirectionMovementAction(u32);
u8 GetAcroEndWheelieMoveDirectionMovementAction(u32);
u8 GetFishingDirectionAnimNum(u8 direction);
u8 GetAcroWheelieDirectionAnimNum(u8 direction);
u8 GetFishingBiteDirectionAnimNum(u8 direction);
u8 GetFishingNoCatchDirectionAnimNum(u8 direction);
bool8 EventObjectSetHeldMovement(struct EventObject *eventObject, u8 specialAnimId); bool8 EventObjectSetHeldMovement(struct EventObject *eventObject, u8 specialAnimId);
void EventObjectForceSetHeldMovement(struct EventObject *eventObject, u8 movementActionId);
bool8 EventObjectIsMovementOverridden(struct EventObject *eventObject); bool8 EventObjectIsMovementOverridden(struct EventObject *eventObject);
u8 EventObjectCheckHeldMovementStatus(struct EventObject *eventObject); u8 EventObjectCheckHeldMovementStatus(struct EventObject *eventObject);
u8 EventObjectGetHeldMovementActionId(struct EventObject *eventObject); u8 EventObjectGetHeldMovementActionId(struct EventObject *eventObject);
@ -194,6 +212,7 @@ u16 GetObjectPaletteTag(u8 palSlot);
void UpdateEventObjectSpriteVisibility(struct Sprite *sprite, bool8 invisible); void UpdateEventObjectSpriteVisibility(struct Sprite *sprite, bool8 invisible);
s16 sub_809773C(s16 a1); s16 sub_809773C(s16 a1);
s16 sub_8097728(s16 a1); s16 sub_8097728(s16 a1);
void CameraObjectReset2(void);
void MovementType_None(struct Sprite *); void MovementType_None(struct Sprite *);
void MovementType_LookAround(struct Sprite *); void MovementType_LookAround(struct Sprite *);

View File

@ -7,9 +7,10 @@
// Exported ROM declarations // Exported ROM declarations
u8 CreateWarpArrowSprite(void); u8 CreateWarpArrowSprite(void);
u8 sub_8155800(u8 oldSpriteId);
void sub_81555AC(u8, u8);
bool8 sub_8155DA0(struct EventObject *); bool8 sub_8155DA0(struct EventObject *);
void sub_8155D78(struct EventObject *); void sub_8155D78(struct EventObject *);
void sub_81555AC(u8, u8);
void StartAshFieldEffect(s16, s16, u16, s16); void StartAshFieldEffect(s16, s16, u16, s16);
void SetUpReflection(struct EventObject*, struct Sprite*, u8); void SetUpReflection(struct EventObject*, struct Sprite*, u8);
u32 StartFieldEffectForEventObject(u8, struct EventObject*); u32 StartFieldEffectForEventObject(u8, struct EventObject*);
@ -30,5 +31,8 @@ void UpdateShortGrassFieldEffect(struct Sprite*);
void UpdateHotSpringsWaterFieldEffect(struct Sprite*); void UpdateHotSpringsWaterFieldEffect(struct Sprite*);
void UpdateBubblesFieldEffect(struct Sprite*); void UpdateBubblesFieldEffect(struct Sprite*);
void UpdateSparkleFieldEffect(struct Sprite*); void UpdateSparkleFieldEffect(struct Sprite*);
void SetSpriteInvisible(u8 spriteId);
void ShowWarpArrowSprite(u8 spriteId, u8 direction, s16 x, s16 y);
void sub_8155604(u8 spriteId, u8 value, s16 data1);
#endif //GUARD_FIELD_EFFECT_HELPERS_H #endif //GUARD_FIELD_EFFECT_HELPERS_H

View File

@ -1,6 +1,17 @@
#ifndef GUARD_FIELD_PLAYER_AVATAR_H #ifndef GUARD_FIELD_PLAYER_AVATAR_H
#define GUARD_FIELD_PLAYER_AVATAR_H #define GUARD_FIELD_PLAYER_AVATAR_H
enum {
PLAYER_AVATAR_STATE_NORMAL,
PLAYER_AVATAR_STATE_MACH_BIKE,
PLAYER_AVATAR_STATE_ACRO_BIKE,
PLAYER_AVATAR_STATE_SURFING,
PLAYER_AVATAR_STATE_UNDERWATER,
PLAYER_AVATAR_STATE_FIELD_MOVE,
PLAYER_AVATAR_STATE_FISHING,
PLAYER_AVATAR_STATE_WATERING,
};
void player_step(u8 a, u16 b, u16 c); void player_step(u8 a, u16 b, u16 c);
void ClearPlayerAvatarInfo(void); void ClearPlayerAvatarInfo(void);
void SetPlayerAvatarExtraStateTransition(u8, u8); void SetPlayerAvatarExtraStateTransition(u8, u8);
@ -13,7 +24,7 @@ u8 GetPlayerMovementDirection(void);
u8 PlayerGetCopyableMovement(void); u8 PlayerGetCopyableMovement(void);
void PlayerGoSpeed1(u8); void PlayerGoSpeed1(u8);
void PlayerGoSpeed2(u8); void PlayerGoSpeed2(u8);
void PlayerGoSpeed3(u8); void PlayerRideWaterCurrent(u8);
void PlayerGoSpeed4(u8); void PlayerGoSpeed4(u8);
void PlayerOnBikeCollide(u8); void PlayerOnBikeCollide(u8);
void PlayerFaceDirection(u8 a); void PlayerFaceDirection(u8 a);
@ -48,22 +59,4 @@ bool8 PartyHasMonWithSurf(void);
bool8 IsPlayerFacingSurfableFishableWater(void); bool8 IsPlayerFacingSurfableFishableWater(void);
bool8 IsPlayerSurfingNorth(void); bool8 IsPlayerSurfingNorth(void);
bool8 ForcedMovement_None(void);
bool8 ForcedMovement_Slip(void);
bool8 ForcedMovement_WalkSouth(void);
bool8 ForcedMovement_WalkNorth(void);
bool8 ForcedMovement_WalkWest(void);
bool8 ForcedMovement_WalkEast(void);
bool8 ForcedMovement_PushedSouthByCurrent(void);
bool8 ForcedMovement_PushedNorthByCurrent(void);
bool8 ForcedMovement_PushedWestByCurrent(void);
bool8 ForcedMovement_PushedEastByCurrent(void);
bool8 ForcedMovement_SlideSouth(void);
bool8 ForcedMovement_SlideNorth(void);
bool8 ForcedMovement_SlideWest(void);
bool8 ForcedMovement_SlideEast(void);
bool8 ForcedMovement_0xBB(void);
bool8 ForcedMovement_0xBC(void);
bool8 ForcedMovement_MuddySlope(void);
#endif // GUARD_FIELD_PLAYER_AVATAR_H #endif // GUARD_FIELD_PLAYER_AVATAR_H

View File

@ -232,7 +232,7 @@ struct EventObjectGraphicsInfo
#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1) #define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1)
#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2) #define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2)
#define PLAYER_AVATAR_FLAG_SURFING (1 << 3) #define PLAYER_AVATAR_FLAG_SURFING (1 << 3)
#define PLAYER_AVATAR_FLAG_4 (1 << 4) #define PLAYER_AVATAR_FLAG_UNDERWATER (1 << 4)
#define PLAYER_AVATAR_FLAG_5 (1 << 5) #define PLAYER_AVATAR_FLAG_5 (1 << 5)
#define PLAYER_AVATAR_FLAG_6 (1 << 6) #define PLAYER_AVATAR_FLAG_6 (1 << 6)
#define PLAYER_AVATAR_FLAG_DASH (1 << 7) #define PLAYER_AVATAR_FLAG_DASH (1 << 7)

View File

@ -872,4 +872,9 @@ extern const u8 gText_ShopBuy[];
extern const u8 gText_ShopSell[]; extern const u8 gText_ShopSell[];
extern const u8 gText_ShopQuit[]; extern const u8 gText_ShopQuit[];
extern const u8 gText_OhABite[];
extern const u8 gText_PokemonOnHook[];
extern const u8 gText_NotEvenANibble[];
extern const u8 gText_ItGotAway[];
#endif //GUARD_STRINGS_H #endif //GUARD_STRINGS_H

View File

@ -92,7 +92,6 @@ SECTIONS {
src/field_camera.o(.text); src/field_camera.o(.text);
src/field_door.o(.text); src/field_door.o(.text);
src/field_player_avatar.o(.text); src/field_player_avatar.o(.text);
asm/field_player_avatar.o(.text);
src/event_object_movement.o(.text); src/event_object_movement.o(.text);
src/field_message_box.o(.text); src/field_message_box.o(.text);
src/event_obj_lock.o(.text); src/event_obj_lock.o(.text);

View File

@ -18,7 +18,7 @@ extern u8 sub_808B980(u8 direction);
extern u8 sub_808B9BC(u8 direction); extern u8 sub_808B9BC(u8 direction);
extern u8 sub_808B9A4(u8 direction); extern u8 sub_808B9A4(u8 direction);
extern u8 sub_808C1B4(u8 direction); extern u8 sub_808C1B4(u8 direction);
extern u8 npc_use_some_d2s(u8 direction); extern u8 sub_808B9D4(u8 direction);
extern void Overworld_ClearSavedMusic(void); extern void Overworld_ClearSavedMusic(void);
extern void Overworld_PlaySpecialMapMusic(void); extern void Overworld_PlaySpecialMapMusic(void);
@ -575,7 +575,7 @@ static void AcroBikeTransition_Moving(u8 direction)
} }
else else
{ {
PlayerGoSpeed3(direction); PlayerRideWaterCurrent(direction);
} }
} }
@ -768,7 +768,7 @@ static void AcroBikeTransition_WheelieLoweringMoving(u8 direction)
PlayerEndWheelie(direction); PlayerEndWheelie(direction);
return; return;
} }
npc_use_some_d2s(direction); sub_808B9D4(direction);
} }
void Bike_TryAcroBikeHistoryUpdate(u16 newKeys, u16 heldKeys) void Bike_TryAcroBikeHistoryUpdate(u16 newKeys, u16 heldKeys)
@ -968,7 +968,7 @@ bool8 IsBikingDisallowedByPlayer(void)
s16 x, y; s16 x, y;
u8 tileBehavior; u8 tileBehavior;
if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_4))) if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_UNDERWATER)))
{ {
PlayerGetDestCoords(&x, &y); PlayerGetDestCoords(&x, &y);
tileBehavior = MapGridGetMetatileBehaviorAt(x, y); tileBehavior = MapGridGetMetatileBehaviorAt(x, y);

File diff suppressed because it is too large Load Diff

View File

@ -260,7 +260,7 @@ bool32 CanFish(void)
if (MetatileBehavior_IsWaterfall(tileBehavior)) if (MetatileBehavior_IsWaterfall(tileBehavior))
return FALSE; return FALSE;
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4)) if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER))
return FALSE; return FALSE;
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))

View File

@ -166,8 +166,8 @@ extern u32 sub_800B4DC(void);
extern bool32 sub_80B39D4(u8); extern bool32 sub_80B39D4(u8);
extern const u8* GetInteractedLinkPlayerScript(struct MapPosition *a1, u8, u8); extern const u8* GetInteractedLinkPlayerScript(struct MapPosition *a1, u8, u8);
extern u8 *GetCoordEventScriptAtMapPosition(void*); extern u8 *GetCoordEventScriptAtMapPosition(void*);
extern u8 sub_808BD6C(u8); extern u8 GetFRLGAvatarGraphicsIdByGender(u8);
extern u8 sub_808BD7C(u8); extern u8 GetRSAvatarGraphicsIdByGender(u8);
extern void UpdateEventObjectSpriteVisibility(struct Sprite*, u8); extern void UpdateEventObjectSpriteVisibility(struct Sprite*, u8);
// this file's functions // this file's functions
@ -919,7 +919,7 @@ void StoreInitialPlayerAvatarState(void)
gInitialPlayerAvatarState.transitionFlags = 4; gInitialPlayerAvatarState.transitionFlags = 4;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
gInitialPlayerAvatarState.transitionFlags = 8; gInitialPlayerAvatarState.transitionFlags = 8;
else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4)) else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER))
gInitialPlayerAvatarState.transitionFlags = 16; gInitialPlayerAvatarState.transitionFlags = 16;
else else
gInitialPlayerAvatarState.transitionFlags = 1; gInitialPlayerAvatarState.transitionFlags = 1;
@ -3137,11 +3137,11 @@ static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion)
{ {
case VERSION_FIRE_RED: case VERSION_FIRE_RED:
case VERSION_LEAF_GREEN: case VERSION_LEAF_GREEN:
eventObj->spriteId = AddPseudoEventObject(sub_808BD6C(eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0); eventObj->spriteId = AddPseudoEventObject(GetFRLGAvatarGraphicsIdByGender(eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0);
break; break;
case VERSION_RUBY: case VERSION_RUBY:
case VERSION_SAPPHIRE: case VERSION_SAPPHIRE:
eventObj->spriteId = AddPseudoEventObject(sub_808BD7C(eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0); eventObj->spriteId = AddPseudoEventObject(GetRSAvatarGraphicsIdByGender(eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0);
break; break;
case VERSION_EMERALD: case VERSION_EMERALD:
eventObj->spriteId = AddPseudoEventObject(GetRivalAvatarGraphicsIdByStateIdAndGender(0, eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0); eventObj->spriteId = AddPseudoEventObject(GetRivalAvatarGraphicsIdByStateIdAndGender(0, eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0);

View File

@ -209,23 +209,7 @@ gUnknown_020322D5: @ 20322D5
.include "src/overworld.o" .include "src/overworld.o"
.include "src/fieldmap.o" .include "src/fieldmap.o"
.include "src/field_camera.o" .include "src/field_camera.o"
.include "src/field_player_avatar.o"
.align 2
gUnknown_0203734C: @ 203734C
.space 0x4
gEventObjects: @ 2037350
.space 0x240
gPlayerAvatar: @ 2037590
.space 0x14
gUnknown_020375A4: @ 20375A4
.space 0x8
gUnknown_020375AC: @ 20375AC
.space 0x8
.include "src/event_object_movement.o" .include "src/event_object_movement.o"
.include "src/field_message_box.o" .include "src/field_message_box.o"