through InitPlayerAvatar
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -7871,7 +7871,7 @@ sub_8058878: @ 8058878
|
|||||||
lsls r1, 30
|
lsls r1, 30
|
||||||
lsrs r1, 31
|
lsrs r1, 31
|
||||||
movs r0, 0
|
movs r0, 0
|
||||||
bl sub_805C7C8
|
bl GetRivalAvatarGraphicsIdByStateIdAndGender
|
||||||
b _080588C6
|
b _080588C6
|
||||||
.align 2, 0
|
.align 2, 0
|
||||||
_080588B4: .4byte gLinkPlayerObjectEvents
|
_080588B4: .4byte gLinkPlayerObjectEvents
|
||||||
|
|||||||
@@ -3,37 +3,6 @@
|
|||||||
.include "constants/constants.inc"
|
.include "constants/constants.inc"
|
||||||
.section .rodata
|
.section .rodata
|
||||||
.align 2
|
.align 2
|
||||||
gUnknown_835B864:: @ 835B864
|
|
||||||
.4byte MetatileBehavior_IsSouthArrowWarp
|
|
||||||
.4byte MetatileBehavior_IsNorthArrowWarp
|
|
||||||
.4byte MetatileBehavior_IsWestArrowWarp
|
|
||||||
.4byte MetatileBehavior_IsEastArrowWarp
|
|
||||||
|
|
||||||
gUnknown_835B874:: @ 835B874
|
|
||||||
.byte OBJ_EVENT_GFX_RED_NORMAL, OBJ_EVENT_GFX_GREEN_NORMAL
|
|
||||||
.byte OBJ_EVENT_GFX_RED_BIKE, OBJ_EVENT_GFX_GREEN_BIKE
|
|
||||||
.byte OBJ_EVENT_GFX_RED_SURF, OBJ_EVENT_GFX_GREEN_SURF
|
|
||||||
.byte OBJ_EVENT_GFX_RED_ITEM, OBJ_EVENT_GFX_GREEN_ITEM
|
|
||||||
.byte OBJ_EVENT_GFX_RED_FISH, OBJ_EVENT_GFX_GREEN_FISH
|
|
||||||
.byte OBJ_EVENT_GFX_RED_ITEM_COPY, OBJ_EVENT_GFX_GREEN_ITEM_COPY
|
|
||||||
|
|
||||||
gUnknown_835B880:: @ 835B880
|
|
||||||
.byte OBJ_EVENT_GFX_RS_BRENDAN
|
|
||||||
.byte OBJ_EVENT_GFX_RS_MAY
|
|
||||||
|
|
||||||
gUnknown_835B882:: @ 835B882
|
|
||||||
@ Male
|
|
||||||
.byte OBJ_EVENT_GFX_RED_NORMAL, 0x01
|
|
||||||
.byte OBJ_EVENT_GFX_RED_BIKE, 0x02
|
|
||||||
.byte OBJ_EVENT_GFX_RED_SURF, 0x08
|
|
||||||
@ Female
|
|
||||||
.byte OBJ_EVENT_GFX_GREEN_NORMAL, 0x01
|
|
||||||
.byte OBJ_EVENT_GFX_GREEN_BIKE, 0x02
|
|
||||||
.byte OBJ_EVENT_GFX_GREEN_SURF, 0x08
|
|
||||||
|
|
||||||
gUnknown_835B88E:: @ 835B88E
|
|
||||||
.byte OBJ_EVENT_GFX_RED_VS_SEEKER
|
|
||||||
.byte OBJ_EVENT_GFX_GREEN_VS_SEEKER
|
|
||||||
|
|
||||||
gUnknown_835B890:: @ 835B890
|
gUnknown_835B890:: @ 835B890
|
||||||
.4byte MetatileBehavior_IsSouthArrowWarp
|
.4byte MetatileBehavior_IsSouthArrowWarp
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ s16 GetPlayerSpeed(void);
|
|||||||
|
|
||||||
void MovePlayerOnBike(u8 direction, u16 newKeys, u16 heldKeys);
|
void MovePlayerOnBike(u8 direction, u16 newKeys, u16 heldKeys);
|
||||||
bool32 IsRunningDisallowed(u8 metatileBehavior);
|
bool32 IsRunningDisallowed(u8 metatileBehavior);
|
||||||
|
void Bike_HandleBumpySlopeJump(void);
|
||||||
|
void Bike_UpdateBikeCounterSpeed(u8 counter);
|
||||||
|
|
||||||
#endif //GUARD_BIKE_H
|
#endif //GUARD_BIKE_H
|
||||||
|
|||||||
@@ -206,5 +206,16 @@ u8 sub_8064008(u32 direction);
|
|||||||
u8 GetPlayerRunMovementAction(u32 direction);
|
u8 GetPlayerRunMovementAction(u32 direction);
|
||||||
u8 GetPlayerRunSlowMovementAction(u32 direction);
|
u8 GetPlayerRunSlowMovementAction(u32 direction);
|
||||||
u8 GetWalkSlowMovementAction(u32 direction);
|
u8 GetWalkSlowMovementAction(u32 direction);
|
||||||
|
u8 sub_80640E4(u32 direction);
|
||||||
|
u8 GetAcroWheelieFaceDirectionMovementAction(u32 direction);
|
||||||
|
u8 GetAcroPopWheelieFaceDirectionMovementAction(u32 direction);
|
||||||
|
u8 GetAcroEndWheelieFaceDirectionMovementAction(u32 direction);
|
||||||
|
u8 GetAcroWheelieHopFaceDirectionMovementAction(u32 direction);
|
||||||
|
u8 GetAcroWheelieHopDirectionMovementAction(u32 direction);
|
||||||
|
u8 GetAcroWheelieJumpDirectionMovementAction(u32 direction);
|
||||||
|
u8 GetJumpInPlaceTurnAroundMovementAction(u32 direction);
|
||||||
|
u8 GetAcroWheelieInPlaceDirectionMovementAction(u32 direction);
|
||||||
|
u8 GetAcroPopWheelieMoveDirectionMovementAction(u32 direction);
|
||||||
|
u8 GetAcroWheelieMoveDirectionMovementAction(u32 direction);
|
||||||
|
|
||||||
#endif // GUARD_EVENT_OBJECT_MOVEMENT_H
|
#endif // GUARD_EVENT_OBJECT_MOVEMENT_H
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ bool32 sub_805DAD0(void);
|
|||||||
bool32 sub_805DC24(void);
|
bool32 sub_805DC24(void);
|
||||||
bool8 PartyHasMonWithSurf(void);
|
bool8 PartyHasMonWithSurf(void);
|
||||||
bool8 IsPlayerSurfingNorth(void);
|
bool8 IsPlayerSurfingNorth(void);
|
||||||
void player_get_pos_including_state_based_drift(s16 *x, s16 *y);
|
u8 player_get_pos_including_state_based_drift(s16 *x, s16 *y);
|
||||||
void sub_805CBE8(void);
|
void sub_805CBE8(void);
|
||||||
u8 sub_805C7C8(u8 state, u8 gender);
|
u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender);
|
||||||
|
u8 GetPlayerAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender);
|
||||||
|
|
||||||
#endif //GUARD_FIELD_PLAYER_AVATAR_H
|
#endif //GUARD_FIELD_PLAYER_AVATAR_H
|
||||||
|
|||||||
@@ -278,14 +278,25 @@ struct ObjectEventGraphicsInfo
|
|||||||
/*0x20*/ const union AffineAnimCmd *const *affineAnims;
|
/*0x20*/ const union AffineAnimCmd *const *affineAnims;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PLAYER_AVATAR_FLAG_ON_FOOT (1 << 0)
|
enum {
|
||||||
#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1)
|
PLAYER_AVATAR_STATE_NORMAL,
|
||||||
#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2)
|
PLAYER_AVATAR_STATE_MACH_BIKE,
|
||||||
#define PLAYER_AVATAR_FLAG_SURFING (1 << 3)
|
PLAYER_AVATAR_STATE_ACRO_BIKE,
|
||||||
#define PLAYER_AVATAR_FLAG_4 (1 << 4)
|
PLAYER_AVATAR_STATE_SURFING,
|
||||||
#define PLAYER_AVATAR_FLAG_FORCED_MVMT_DISABLED (1 << 5)
|
PLAYER_AVATAR_STATE_UNDERWATER,
|
||||||
#define PLAYER_AVATAR_FLAG_MVMT_IS_FORCED (1 << 6)
|
PLAYER_AVATAR_STATE_FIELD_MOVE,
|
||||||
#define PLAYER_AVATAR_FLAG_DASH (1 << 7)
|
PLAYER_AVATAR_STATE_FISHING,
|
||||||
|
PLAYER_AVATAR_STATE_WATERING,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define PLAYER_AVATAR_FLAG_ON_FOOT (1 << PLAYER_AVATAR_STATE_NORMAL)
|
||||||
|
#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << PLAYER_AVATAR_STATE_MACH_BIKE)
|
||||||
|
#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << PLAYER_AVATAR_STATE_ACRO_BIKE)
|
||||||
|
#define PLAYER_AVATAR_FLAG_SURFING (1 << PLAYER_AVATAR_STATE_SURFING)
|
||||||
|
#define PLAYER_AVATAR_FLAG_4 (1 << PLAYER_AVATAR_STATE_UNDERWATER)
|
||||||
|
#define PLAYER_AVATAR_FLAG_FORCED_MVMT_DISABLED (1 << PLAYER_AVATAR_STATE_FIELD_MOVE)
|
||||||
|
#define PLAYER_AVATAR_FLAG_MVMT_IS_FORCED (1 << PLAYER_AVATAR_STATE_FISHING)
|
||||||
|
#define PLAYER_AVATAR_FLAG_DASH (1 << PLAYER_AVATAR_STATE_WATERING)
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|||||||
+10
-10
@@ -4628,7 +4628,7 @@ dirn_to_anim(GetPlayerRunSlowMovementAction, gUnknown_83A6528);
|
|||||||
dirn_to_anim(sub_80640E4, gUnknown_83A652D);
|
dirn_to_anim(sub_80640E4, gUnknown_83A652D);
|
||||||
dirn_to_anim(GetJump2MovementAction, gUnknown_83A6532);
|
dirn_to_anim(GetJump2MovementAction, gUnknown_83A6532);
|
||||||
dirn_to_anim(GetJumpInPlaceMovementAction, gUnknown_83A6537);
|
dirn_to_anim(GetJumpInPlaceMovementAction, gUnknown_83A6537);
|
||||||
dirn_to_anim(sub_8064168, gUnknown_83A653C);
|
dirn_to_anim(GetJumpInPlaceTurnAroundMovementAction, gUnknown_83A653C);
|
||||||
dirn_to_anim(GetJumpMovementAction, gUnknown_83A6541);
|
dirn_to_anim(GetJumpMovementAction, gUnknown_83A6541);
|
||||||
dirn_to_anim(sub_80641C0, gUnknown_83A6546);
|
dirn_to_anim(sub_80641C0, gUnknown_83A6546);
|
||||||
dirn_to_anim(sub_80641EC, gUnknown_83A654B);
|
dirn_to_anim(sub_80641EC, gUnknown_83A654B);
|
||||||
@@ -4642,15 +4642,15 @@ bool8 ObjectEventFaceOppositeDirection(struct ObjectEvent *objectEvent, u8 direc
|
|||||||
return ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(GetOppositeDirection(direction)));
|
return ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(GetOppositeDirection(direction)));
|
||||||
}
|
}
|
||||||
|
|
||||||
dirn_to_anim(sub_80642F4, gUnknown_83A6564);
|
dirn_to_anim(GetAcroWheelieFaceDirectionMovementAction, gUnknown_83A6564);
|
||||||
dirn_to_anim(sub_8064320, gUnknown_83A6569);
|
dirn_to_anim(GetAcroPopWheelieFaceDirectionMovementAction, gUnknown_83A6569);
|
||||||
dirn_to_anim(sub_806434C, gUnknown_83A656E);
|
dirn_to_anim(GetAcroEndWheelieFaceDirectionMovementAction, gUnknown_83A656E);
|
||||||
dirn_to_anim(sub_8064378, gUnknown_83A6573);
|
dirn_to_anim(GetAcroWheelieHopFaceDirectionMovementAction, gUnknown_83A6573);
|
||||||
dirn_to_anim(sub_80643A4, gUnknown_83A6578);
|
dirn_to_anim(GetAcroWheelieHopDirectionMovementAction, gUnknown_83A6578);
|
||||||
dirn_to_anim(sub_80643D0, gUnknown_83A657D);
|
dirn_to_anim(GetAcroWheelieJumpDirectionMovementAction, gUnknown_83A657D);
|
||||||
dirn_to_anim(sub_80643FC, gUnknown_83A6582);
|
dirn_to_anim(GetAcroWheelieInPlaceDirectionMovementAction, gUnknown_83A6582);
|
||||||
dirn_to_anim(sub_8064428, gUnknown_83A6587);
|
dirn_to_anim(GetAcroPopWheelieMoveDirectionMovementAction, gUnknown_83A6587);
|
||||||
dirn_to_anim(sub_8064454, gUnknown_83A658C);
|
dirn_to_anim(GetAcroWheelieMoveDirectionMovementAction, gUnknown_83A658C);
|
||||||
|
|
||||||
u8 GetOppositeDirection(u8 direction)
|
u8 GetOppositeDirection(u8 direction)
|
||||||
{
|
{
|
||||||
|
|||||||
+429
-5
@@ -5,9 +5,11 @@
|
|||||||
#include "event_object_movement.h"
|
#include "event_object_movement.h"
|
||||||
#include "fieldmap.h"
|
#include "fieldmap.h"
|
||||||
#include "field_control_avatar.h"
|
#include "field_control_avatar.h"
|
||||||
|
#include "field_effect_helpers.h"
|
||||||
#include "field_player_avatar.h"
|
#include "field_player_avatar.h"
|
||||||
#include "metatile_behavior.h"
|
#include "metatile_behavior.h"
|
||||||
#include "overworld.h"
|
#include "overworld.h"
|
||||||
|
#include "party_menu.h"
|
||||||
#include "quest_log.h"
|
#include "quest_log.h"
|
||||||
#include "quest_log_player.h"
|
#include "quest_log_player.h"
|
||||||
#include "constants/event_object_movement.h"
|
#include "constants/event_object_movement.h"
|
||||||
@@ -15,6 +17,8 @@
|
|||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
#include "constants/flags.h"
|
#include "constants/flags.h"
|
||||||
#include "constants/metatile_behaviors.h"
|
#include "constants/metatile_behaviors.h"
|
||||||
|
#include "constants/species.h"
|
||||||
|
#include "constants/moves.h"
|
||||||
|
|
||||||
EWRAM_DATA struct ObjectEvent * gUnknown_2036E30 = NULL;
|
EWRAM_DATA struct ObjectEvent * gUnknown_2036E30 = NULL;
|
||||||
EWRAM_DATA bool8 gUnknown_2036E34 = FALSE;
|
EWRAM_DATA bool8 gUnknown_2036E34 = FALSE;
|
||||||
@@ -77,15 +81,17 @@ void PlayerGoSpeed2(u8 direction);
|
|||||||
void PlayerGoSpeed1(u8 direction);
|
void PlayerGoSpeed1(u8 direction);
|
||||||
void PlayerGoSlow(u8 direction);
|
void PlayerGoSlow(u8 direction);
|
||||||
void PlayerRideWaterCurrent(u8 direction);
|
void PlayerRideWaterCurrent(u8 direction);
|
||||||
void sub_805C438(u8 direction);
|
|
||||||
void CreateStopSurfingTask(u8 direction);
|
|
||||||
void StartStrengthAnim(u8 objectEventId, u8 direction);
|
|
||||||
void PlayerNotOnBikeCollide(u8 direction);
|
void PlayerNotOnBikeCollide(u8 direction);
|
||||||
void PlayerFaceDirection(u8 direction);
|
void PlayerFaceDirection(u8 direction);
|
||||||
void PlayerTurnInPlace(u8 direction);
|
void PlayerTurnInPlace(u8 direction);
|
||||||
void PlayerJumpLedge(u8 direction);
|
void PlayerJumpLedge(u8 direction);
|
||||||
|
void PlayCollisionSoundIfNotFacingWarp(u8 direction);
|
||||||
void PlayerGoSpin(u8 direction);
|
void PlayerGoSpin(u8 direction);
|
||||||
void sub_805C2CC(u8 metatileBehavior);
|
void sub_805C2CC(u8 metatileBehavior);
|
||||||
|
bool8 MetatileAtCoordsIsWaterTile(s16 x, s16 y);
|
||||||
|
bool8 player_should_look_direction_be_enforced_upon_movement(void);
|
||||||
|
void CreateStopSurfingTask(u8 direction);
|
||||||
|
void StartStrengthAnim(u8 objectEventId, u8 direction);
|
||||||
void sub_805CC40(struct ObjectEvent * playerObjEvent);
|
void sub_805CC40(struct ObjectEvent * playerObjEvent);
|
||||||
void DoPlayerMatJump(void);
|
void DoPlayerMatJump(void);
|
||||||
void DoPlayerMatSpin(void);
|
void DoPlayerMatSpin(void);
|
||||||
@@ -840,13 +846,13 @@ void PlayerRunSlow(u8 direction)
|
|||||||
|
|
||||||
void PlayerOnBikeCollide(u8 direction)
|
void PlayerOnBikeCollide(u8 direction)
|
||||||
{
|
{
|
||||||
sub_805C438(direction);
|
PlayCollisionSoundIfNotFacingWarp(direction);
|
||||||
PlayerSetAnimId(GetWalkInPlaceNormalMovementAction(direction), 2);
|
PlayerSetAnimId(GetWalkInPlaceNormalMovementAction(direction), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerNotOnBikeCollide(u8 direction)
|
void PlayerNotOnBikeCollide(u8 direction)
|
||||||
{
|
{
|
||||||
sub_805C438(direction);
|
PlayCollisionSoundIfNotFacingWarp(direction);
|
||||||
PlayerSetAnimId(GetStepInPlaceDelay32AnimId(direction), 2);
|
PlayerSetAnimId(GetStepInPlaceDelay32AnimId(direction), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -864,3 +870,421 @@ void PlayerTurnInPlace(u8 direction)
|
|||||||
{
|
{
|
||||||
PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(direction), 1);
|
PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(direction), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerJumpLedge(u8 direction)
|
||||||
|
{
|
||||||
|
PlaySE(SE_DANSA);
|
||||||
|
PlayerSetAnimId(GetJump2MovementAction(direction), 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_805C260(void)
|
||||||
|
{
|
||||||
|
PlayerSetAnimId(MOVEMENT_ACTION_0x9F, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_805C270(void)
|
||||||
|
{
|
||||||
|
if (gPlayerAvatar.tileTransitionState == T_TILE_CENTER || gPlayerAvatar.tileTransitionState == T_NOT_MOVING)
|
||||||
|
{
|
||||||
|
if (player_should_look_direction_be_enforced_upon_movement())
|
||||||
|
PlayerForceSetHeldMovement(GetFaceDirectionMovementAction(gObjectEvents[gPlayerAvatar.objectEventId].facingDirection));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerGoSpin(u8 direction)
|
||||||
|
{
|
||||||
|
PlayerSetAnimId(sub_80640E4(direction), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_805C2CC(u8 metatileBehavior)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; sForcedMovementFuncs[i].unk0 != NULL; i++)
|
||||||
|
{
|
||||||
|
if (sForcedMovementFuncs[i].unk0(metatileBehavior))
|
||||||
|
sForcedMovementFuncs[i].unk4();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerIdleWheelie(u8 direction)
|
||||||
|
{
|
||||||
|
PlayerSetAnimId(GetAcroWheelieFaceDirectionMovementAction(direction), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerStartWheelie(u8 direction)
|
||||||
|
{
|
||||||
|
PlayerSetAnimId(GetAcroPopWheelieFaceDirectionMovementAction(direction), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerEndWheelie(u8 direction)
|
||||||
|
{
|
||||||
|
PlayerSetAnimId(GetAcroEndWheelieFaceDirectionMovementAction(direction), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerStandingHoppingWheelie(u8 direction)
|
||||||
|
{
|
||||||
|
PlaySE(SE_JITE_PYOKO);
|
||||||
|
PlayerSetAnimId(GetAcroWheelieHopFaceDirectionMovementAction(direction), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerMovingHoppingWheelie(u8 direction)
|
||||||
|
{
|
||||||
|
PlaySE(SE_JITE_PYOKO);
|
||||||
|
PlayerSetAnimId(GetAcroWheelieHopDirectionMovementAction(direction), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerLedgeHoppingWheelie(u8 direction)
|
||||||
|
{
|
||||||
|
PlaySE(SE_JITE_PYOKO);
|
||||||
|
PlayerSetAnimId(GetAcroWheelieJumpDirectionMovementAction(direction), 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerAcroTurnJump(u8 direction)
|
||||||
|
{
|
||||||
|
PlaySE(SE_JITE_PYOKO);
|
||||||
|
PlayerSetAnimId(GetJumpInPlaceTurnAroundMovementAction(direction), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerAcroWheelieCollide(u8 direction)
|
||||||
|
{
|
||||||
|
PlaySE(SE_WALL_HIT);
|
||||||
|
PlayerSetAnimId(GetAcroWheelieInPlaceDirectionMovementAction(direction), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_805C408(u8 direction)
|
||||||
|
{
|
||||||
|
PlayerSetAnimId(GetAcroPopWheelieMoveDirectionMovementAction(direction), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_805C420(u8 direction)
|
||||||
|
{
|
||||||
|
PlayerSetAnimId(GetAcroWheelieMoveDirectionMovementAction(direction), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 (*const sArrowWarpMetatileBehaviorChecks[])(u8) = {
|
||||||
|
MetatileBehavior_IsSouthArrowWarp,
|
||||||
|
MetatileBehavior_IsNorthArrowWarp,
|
||||||
|
MetatileBehavior_IsWestArrowWarp,
|
||||||
|
MetatileBehavior_IsEastArrowWarp
|
||||||
|
};
|
||||||
|
|
||||||
|
void PlayCollisionSoundIfNotFacingWarp(u8 direction)
|
||||||
|
{
|
||||||
|
s16 x, y;
|
||||||
|
u8 metatileBehavior = gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior;
|
||||||
|
|
||||||
|
if (!sArrowWarpMetatileBehaviorChecks[direction - 1](metatileBehavior))
|
||||||
|
{
|
||||||
|
if (direction == DIR_WEST)
|
||||||
|
{
|
||||||
|
if (MetatileBehavior_IsUnknownWarp6D(metatileBehavior) || MetatileBehavior_IsUnknownWarp6F(metatileBehavior))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (direction == DIR_EAST)
|
||||||
|
{
|
||||||
|
if (MetatileBehavior_IsUnknownWarp6C(metatileBehavior) || MetatileBehavior_IsUnknownWarp6E(metatileBehavior))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (direction == DIR_NORTH)
|
||||||
|
{
|
||||||
|
PlayerGetDestCoords(&x, &y);
|
||||||
|
MoveCoords(DIR_NORTH, &x, &y);
|
||||||
|
metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||||
|
if (MetatileBehavior_IsWarpDoor(metatileBehavior))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlaySE(SE_WALL_HIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetXYCoordsOneStepInFrontOfPlayer(s16 *x, s16 *y)
|
||||||
|
{
|
||||||
|
*x = gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.x;
|
||||||
|
*y = gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.y;
|
||||||
|
MoveCoords(GetPlayerFacingDirection(), x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerGetDestCoords(s16 *x, s16 *y)
|
||||||
|
{
|
||||||
|
*x = gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.x;
|
||||||
|
*y = gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 player_get_pos_including_state_based_drift(s16 *x, s16 *y)
|
||||||
|
{
|
||||||
|
struct ObjectEvent *object = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
|
if (object->heldMovementActive && !object->heldMovementFinished && !gSprites[object->spriteId].data[2])
|
||||||
|
{
|
||||||
|
*x = object->currentCoords.x;
|
||||||
|
*y = object->currentCoords.y;
|
||||||
|
|
||||||
|
switch (object->movementActionId)
|
||||||
|
{
|
||||||
|
case MOVEMENT_ACTION_WALK_NORMAL_DOWN:
|
||||||
|
case MOVEMENT_ACTION_PLAYER_RUN_DOWN:
|
||||||
|
(*y)++;
|
||||||
|
return TRUE;
|
||||||
|
case MOVEMENT_ACTION_WALK_NORMAL_UP:
|
||||||
|
case MOVEMENT_ACTION_PLAYER_RUN_UP:
|
||||||
|
(*y)--;
|
||||||
|
return TRUE;
|
||||||
|
case MOVEMENT_ACTION_WALK_NORMAL_LEFT:
|
||||||
|
case MOVEMENT_ACTION_PLAYER_RUN_LEFT:
|
||||||
|
(*x)--;
|
||||||
|
return TRUE;
|
||||||
|
case MOVEMENT_ACTION_WALK_NORMAL_RIGHT:
|
||||||
|
case MOVEMENT_ACTION_PLAYER_RUN_RIGHT:
|
||||||
|
(*x)++;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*x = -1;
|
||||||
|
*y = -1;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetPlayerFacingDirection(void)
|
||||||
|
{
|
||||||
|
return gObjectEvents[gPlayerAvatar.objectEventId].facingDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetPlayerMovementDirection(void)
|
||||||
|
{
|
||||||
|
return gObjectEvents[gPlayerAvatar.objectEventId].movementDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 PlayerGetZCoord(void)
|
||||||
|
{
|
||||||
|
return gObjectEvents[gPlayerAvatar.objectEventId].previousElevation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MovePlayerToMapCoords(s16 x, s16 y)
|
||||||
|
{
|
||||||
|
MoveObjectEventToMapCoords(&gObjectEvents[gPlayerAvatar.objectEventId], x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 TestPlayerAvatarFlags(u8 bm)
|
||||||
|
{
|
||||||
|
return gPlayerAvatar.flags & bm;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetPlayerAvatarFlags(void)
|
||||||
|
{
|
||||||
|
return gPlayerAvatar.flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetPlayerAvatarObjectId(void)
|
||||||
|
{
|
||||||
|
return gPlayerAvatar.spriteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_805C774(void)
|
||||||
|
{
|
||||||
|
ForcedMovement_None();
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_805C780(void)
|
||||||
|
{
|
||||||
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
|
npc_clear_strange_bits(playerObjEvent);
|
||||||
|
SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection);
|
||||||
|
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
||||||
|
{
|
||||||
|
Bike_HandleBumpySlopeJump();
|
||||||
|
Bike_UpdateBikeCounterSpeed(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const u8 sPlayerAvatarGfxIds[][2] = {
|
||||||
|
{OBJ_EVENT_GFX_RED_NORMAL, OBJ_EVENT_GFX_GREEN_NORMAL},
|
||||||
|
{OBJ_EVENT_GFX_RED_BIKE, OBJ_EVENT_GFX_GREEN_BIKE},
|
||||||
|
{OBJ_EVENT_GFX_RED_SURF, OBJ_EVENT_GFX_GREEN_SURF},
|
||||||
|
{OBJ_EVENT_GFX_RED_ITEM, OBJ_EVENT_GFX_GREEN_ITEM},
|
||||||
|
{OBJ_EVENT_GFX_RED_FISH, OBJ_EVENT_GFX_GREEN_FISH},
|
||||||
|
{OBJ_EVENT_GFX_RED_ITEM_COPY, OBJ_EVENT_GFX_GREEN_ITEM_COPY},
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 sHoennLinkPartnerGfxIds[] = {
|
||||||
|
OBJ_EVENT_GFX_RS_BRENDAN,
|
||||||
|
OBJ_EVENT_GFX_RS_MAY
|
||||||
|
};
|
||||||
|
|
||||||
|
u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender)
|
||||||
|
{
|
||||||
|
return GetPlayerAvatarGraphicsIdByStateIdAndGender(state, gender);
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetPlayerAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender)
|
||||||
|
{
|
||||||
|
return sPlayerAvatarGfxIds[state][gender];
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetHoennLinkPartnerGraphicsIdByGender(u8 gender)
|
||||||
|
{
|
||||||
|
return sHoennLinkPartnerGfxIds[gender];
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetPlayerAvatarGraphicsIdByStateId(u8 state)
|
||||||
|
{
|
||||||
|
return GetPlayerAvatarGraphicsIdByStateIdAndGender(state, gPlayerAvatar.gender);
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetPlayerAvatarGenderByGraphicsId(u8 gfxId)
|
||||||
|
{
|
||||||
|
switch (gfxId)
|
||||||
|
{
|
||||||
|
case OBJ_EVENT_GFX_GREEN_NORMAL:
|
||||||
|
case OBJ_EVENT_GFX_GREEN_BIKE:
|
||||||
|
case OBJ_EVENT_GFX_GREEN_SURF:
|
||||||
|
case OBJ_EVENT_GFX_GREEN_ITEM:
|
||||||
|
case OBJ_EVENT_GFX_GREEN_FISH:
|
||||||
|
return FEMALE;
|
||||||
|
default:
|
||||||
|
return MALE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 PartyHasMonWithSurf(void)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
|
||||||
|
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
|
||||||
|
{
|
||||||
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
|
{
|
||||||
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
|
||||||
|
break;
|
||||||
|
if (MonKnowsMove(&gPlayerParty[i], MOVE_SURF))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 IsPlayerSurfingNorth(void)
|
||||||
|
{
|
||||||
|
if (GetPlayerMovementDirection() == DIR_NORTH && TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 IsPlayerFacingSurfableFishableWater(void)
|
||||||
|
{
|
||||||
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
s16 x = playerObjEvent->currentCoords.x;
|
||||||
|
s16 y = playerObjEvent->currentCoords.y;
|
||||||
|
|
||||||
|
MoveCoords(playerObjEvent->facingDirection, &x, &y);
|
||||||
|
if (GetCollisionAtCoords(playerObjEvent, x, y, playerObjEvent->facingDirection) == COLLISION_ELEVATION_MISMATCH
|
||||||
|
&& PlayerGetZCoord() == 3
|
||||||
|
&& MetatileAtCoordsIsWaterTile(x, y) == TRUE)
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 MetatileAtCoordsIsWaterTile(s16 x, s16 y)
|
||||||
|
{
|
||||||
|
return TestMetatileAttributeBit(MapGridGetMetatileAttributeAt(x, y, METATILE_ATTRIBUTE_TERRAIN), TILE_TERRAIN_WATER);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearPlayerAvatarInfo(void)
|
||||||
|
{
|
||||||
|
gPlayerAvatar = (struct PlayerAvatar){};
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetPlayerAvatarStateMask(u8 flags)
|
||||||
|
{
|
||||||
|
gPlayerAvatar.flags &= (PLAYER_AVATAR_FLAG_DASH | PLAYER_AVATAR_FLAG_MVMT_IS_FORCED | PLAYER_AVATAR_FLAG_FORCED_MVMT_DISABLED);
|
||||||
|
gPlayerAvatar.flags |= flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
const u8 gUnknown_835B882[][3][2] = {
|
||||||
|
// Male
|
||||||
|
{
|
||||||
|
{OBJ_EVENT_GFX_RED_NORMAL, PLAYER_AVATAR_FLAG_ON_FOOT},
|
||||||
|
{OBJ_EVENT_GFX_RED_BIKE, PLAYER_AVATAR_FLAG_MACH_BIKE},
|
||||||
|
{OBJ_EVENT_GFX_RED_SURF, PLAYER_AVATAR_FLAG_SURFING},
|
||||||
|
},
|
||||||
|
// Female
|
||||||
|
{
|
||||||
|
{OBJ_EVENT_GFX_GREEN_NORMAL, PLAYER_AVATAR_FLAG_ON_FOOT},
|
||||||
|
{OBJ_EVENT_GFX_GREEN_BIKE, PLAYER_AVATAR_FLAG_MACH_BIKE},
|
||||||
|
{OBJ_EVENT_GFX_GREEN_SURF, PLAYER_AVATAR_FLAG_SURFING},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
u8 GetPlayerAvatarStateTransitionByGraphicsId(u8 graphicsId, u8 gender)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
|
||||||
|
for (i = 0; i < NELEMS(*gUnknown_835B882); i++)
|
||||||
|
{
|
||||||
|
if (gUnknown_835B882[gender][i][0] == graphicsId)
|
||||||
|
return gUnknown_835B882[gender][i][1];
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetPlayerAvatarGraphicsIdByCurrentState(void)
|
||||||
|
{
|
||||||
|
u8 i;
|
||||||
|
u8 r5 = gPlayerAvatar.flags;
|
||||||
|
|
||||||
|
for (i = 0; i < NELEMS(*gUnknown_835B882); i++)
|
||||||
|
{
|
||||||
|
if (gUnknown_835B882[gPlayerAvatar.gender][i][1] & r5)
|
||||||
|
return gUnknown_835B882[gPlayerAvatar.gender][i][0];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const u8 gUnknown_835B88E[] = {
|
||||||
|
OBJ_EVENT_GFX_RED_VS_SEEKER,
|
||||||
|
OBJ_EVENT_GFX_GREEN_VS_SEEKER
|
||||||
|
};
|
||||||
|
|
||||||
|
void SetPlayerAvatarExtraStateTransition(u8 graphicsId, u8 b)
|
||||||
|
{
|
||||||
|
u8 unk = GetPlayerAvatarStateTransitionByGraphicsId(graphicsId, gPlayerAvatar.gender);
|
||||||
|
|
||||||
|
gPlayerAvatar.unk1 |= unk | b;
|
||||||
|
DoPlayerAvatarTransition();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender)
|
||||||
|
{
|
||||||
|
struct ObjectEventTemplate playerObjEventTemplate;
|
||||||
|
u8 objectEventId;
|
||||||
|
struct ObjectEvent *objectEvent;
|
||||||
|
|
||||||
|
playerObjEventTemplate.localId = OBJ_EVENT_ID_PLAYER;
|
||||||
|
playerObjEventTemplate.graphicsId = GetPlayerAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, gender);
|
||||||
|
playerObjEventTemplate.x = x - 7;
|
||||||
|
playerObjEventTemplate.y = y - 7;
|
||||||
|
playerObjEventTemplate.elevation = 0;
|
||||||
|
playerObjEventTemplate.movementType = MOVEMENT_TYPE_PLAYER;
|
||||||
|
playerObjEventTemplate.movementRangeX = 0;
|
||||||
|
playerObjEventTemplate.movementRangeY = 0;
|
||||||
|
playerObjEventTemplate.trainerType = 0;
|
||||||
|
playerObjEventTemplate.trainerRange_berryTreeId = 0;
|
||||||
|
playerObjEventTemplate.script = NULL;
|
||||||
|
playerObjEventTemplate.flagId = 0;
|
||||||
|
objectEventId = SpawnSpecialObjectEvent(&playerObjEventTemplate);
|
||||||
|
objectEvent = &gObjectEvents[objectEventId];
|
||||||
|
objectEvent->isPlayer = 1;
|
||||||
|
objectEvent->warpArrowSpriteId = CreateWarpArrowSprite();
|
||||||
|
ObjectEventTurn(objectEvent, direction);
|
||||||
|
ClearPlayerAvatarInfo();
|
||||||
|
gPlayerAvatar.runningState = NOT_MOVING;
|
||||||
|
gPlayerAvatar.tileTransitionState = T_NOT_MOVING;
|
||||||
|
gPlayerAvatar.objectEventId = objectEventId;
|
||||||
|
gPlayerAvatar.spriteId = objectEvent->spriteId;
|
||||||
|
gPlayerAvatar.gender = gender;
|
||||||
|
SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_FORCED_MVMT_DISABLED | PLAYER_AVATAR_FLAG_ON_FOOT);
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -1300,7 +1300,7 @@ static void NamingScreen_CreatePlayerIcon(void)
|
|||||||
u8 rivalGfxId;
|
u8 rivalGfxId;
|
||||||
u8 spriteId;
|
u8 spriteId;
|
||||||
|
|
||||||
rivalGfxId = sub_805C7C8(0, sNamingScreenData->monSpecies);
|
rivalGfxId = GetRivalAvatarGraphicsIdByStateIdAndGender(0, sNamingScreenData->monSpecies);
|
||||||
spriteId = AddPseudoObjectEvent(rivalGfxId, SpriteCallbackDummy, 0x38, 0x25, 0);
|
spriteId = AddPseudoObjectEvent(rivalGfxId, SpriteCallbackDummy, 0x38, 0x25, 0);
|
||||||
gSprites[spriteId].oam.priority = 3;
|
gSprites[spriteId].oam.priority = 3;
|
||||||
StartSpriteAnim(&gSprites[spriteId], 4);
|
StartSpriteAnim(&gSprites[spriteId], 4);
|
||||||
|
|||||||
Reference in New Issue
Block a user