summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2020-03-24 18:17:18 -0400
committerPikalaxALT <PikalaxALT@gmail.com>2020-03-24 18:17:18 -0400
commit8a85485cc25b9ac67c9b60697efd56c88d7b1d5f (patch)
treed4f0c27ea46f67cf587419f7f06789482cf37bf9
parent87b2c7f34b5a734d3af98ea2dc7d9fafecd809a6 (diff)
through PlayerTurnInPlace
-rw-r--r--asm/field_player_avatar.s261
-rw-r--r--include/event_object_movement.h6
-rw-r--r--include/quest_log.h2
-rw-r--r--src/field_player_avatar.c97
-rw-r--r--src/quest_log.c37
5 files changed, 118 insertions, 285 deletions
diff --git a/asm/field_player_avatar.s b/asm/field_player_avatar.s
index 3d6eadc79..bd3cc0536 100644
--- a/asm/field_player_avatar.s
+++ b/asm/field_player_avatar.s
@@ -5,267 +5,6 @@
.text
- thumb_func_start sub_805C06C
-sub_805C06C: @ 805C06C
- push {r4,lr}
- lsls r1, 24
- lsrs r4, r1, 24
- ldr r0, _0805C09C @ =gPlayerAvatar
- ldrb r1, [r0, 0x5]
- lsls r0, r1, 3
- adds r0, r1
- lsls r0, 2
- ldr r1, _0805C0A0 @ =gObjectEvents
- adds r0, r1
- adds r1, r4, 0
- bl ObjectEventSetHeldMovement
- lsls r0, 24
- cmp r0, 0
- bne _0805C094
- adds r0, r4, 0
- movs r1, 0
- bl sub_81126AC
-_0805C094:
- pop {r4}
- pop {r0}
- bx r0
- .align 2, 0
-_0805C09C: .4byte gPlayerAvatar
-_0805C0A0: .4byte gObjectEvents
- thumb_func_end sub_805C06C
-
- thumb_func_start sub_805C0A4
-sub_805C0A4: @ 805C0A4
- push {r4,r5,lr}
- sub sp, 0x4
- adds r4, r0, 0
- lsls r1, 24
- lsrs r5, r1, 24
- adds r1, r5, 0
- bl ObjectEventSetHeldMovement
- lsls r0, 24
- cmp r0, 0
- bne _0805C0CA
- ldrb r0, [r4, 0x8]
- ldrb r1, [r4, 0x9]
- ldrb r2, [r4, 0xA]
- movs r3, 0x20
- str r3, [sp]
- adds r3, r5, 0
- bl sub_8112588
-_0805C0CA:
- add sp, 0x4
- pop {r4,r5}
- pop {r0}
- bx r0
- thumb_func_end sub_805C0A4
-
- thumb_func_start sub_805C0D4
-sub_805C0D4: @ 805C0D4
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl sub_8063F2C
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end sub_805C0D4
-
- thumb_func_start PlayerGoSlow
-PlayerGoSlow: @ 805C0EC
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl sub_8063F58
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end PlayerGoSlow
-
- thumb_func_start PlayerGoSpeed1
-PlayerGoSpeed1: @ 805C104
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl GetWalkNormalMovementAction
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end PlayerGoSpeed1
-
- thumb_func_start PlayerGoSpeed2
-PlayerGoSpeed2: @ 805C11C
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl GetWalkFastMovementAction
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end PlayerGoSpeed2
-
- thumb_func_start sub_805C134
-sub_805C134: @ 805C134
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl sub_8063FDC
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end sub_805C134
-
- thumb_func_start PlayerRideWaterCurrent
-PlayerRideWaterCurrent: @ 805C14C
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl sub_8064008
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end PlayerRideWaterCurrent
-
- thumb_func_start sub_805C164
-sub_805C164: @ 805C164
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl GetWalkFastestMovementAction
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end sub_805C164
-
- thumb_func_start PlayerRun
-PlayerRun: @ 805C17C
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl GetPlayerRunMovementAction
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end PlayerRun
-
- thumb_func_start PlayerRunSlow
-PlayerRunSlow: @ 805C194
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl GetPlayerRunSlowMovementAction
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end PlayerRunSlow
-
- thumb_func_start PlayerOnBikeCollide
-PlayerOnBikeCollide: @ 805C1AC
- push {r4,lr}
- adds r4, r0, 0
- lsls r4, 24
- lsrs r4, 24
- adds r0, r4, 0
- bl sub_805C438
- adds r0, r4, 0
- bl GetWalkInPlaceNormalMovementAction
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end PlayerOnBikeCollide
-
- thumb_func_start PlayerNotOnBikeCollide
-PlayerNotOnBikeCollide: @ 805C1D0
- push {r4,lr}
- adds r4, r0, 0
- lsls r4, 24
- lsrs r4, 24
- adds r0, r4, 0
- bl sub_805C438
- adds r0, r4, 0
- bl GetStepInPlaceDelay32AnimId
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x2
- bl PlayerSetAnimId
- pop {r4}
- pop {r0}
- bx r0
- thumb_func_end PlayerNotOnBikeCollide
-
- thumb_func_start PlayerFaceDirection
-PlayerFaceDirection: @ 805C1F4
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl GetFaceDirectionMovementAction
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x1
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end PlayerFaceDirection
-
- thumb_func_start sub_805C20C
-sub_805C20C: @ 805C20C
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl GetWalkSlowMovementAction
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x1
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end sub_805C20C
-
- thumb_func_start PlayerTurnInPlace
-PlayerTurnInPlace: @ 805C224
- push {lr}
- lsls r0, 24
- lsrs r0, 24
- bl GetWalkInPlaceSlowMovementAction
- lsls r0, 24
- lsrs r0, 24
- movs r1, 0x1
- bl PlayerSetAnimId
- pop {r0}
- bx r0
- thumb_func_end PlayerTurnInPlace
-
thumb_func_start PlayerJumpLedge
PlayerJumpLedge: @ 805C23C
push {r4,lr}
diff --git a/include/event_object_movement.h b/include/event_object_movement.h
index 7bdeb08c5..8b2944578 100644
--- a/include/event_object_movement.h
+++ b/include/event_object_movement.h
@@ -200,5 +200,11 @@ extern const u16 gUnknown_8398648[];
extern const u16 gUnknown_8398688[];
extern const u8 gReflectionEffectPaletteMap[];
u8 GetLedgeJumpDirection(s16 x, s16 y, u8 z);
+u8 sub_8063F58(u32 direction);
+u8 sub_8063FDC(u32 direction);
+u8 sub_8064008(u32 direction);
+u8 GetPlayerRunMovementAction(u32 direction);
+u8 GetPlayerRunSlowMovementAction(u32 direction);
+u8 GetWalkSlowMovementAction(u32 direction);
#endif // GUARD_EVENT_OBJECT_MOVEMENT_H
diff --git a/include/quest_log.h b/include/quest_log.h
index f4fe0ca45..70a5c2f30 100644
--- a/include/quest_log.h
+++ b/include/quest_log.h
@@ -56,5 +56,7 @@ void sub_81128BC(u8 a0);
void sub_811278C(u8 movementActionId, u8 duration);
void Special_UpdateTrainerFansAfterLinkBattle(void);
void sub_8112628(u8 movementActionId);
+void sub_81126AC(u8 movementActionId, u8 duration);
+void sub_8112588(u8 localId, u8 mapNum, u8 mapGroup, u8 movementActionId, u8 duration);
#endif //GUARD_QUEST_LOG_H
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index a7525fc41..61d6f930f 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -71,19 +71,20 @@ bool8 PlayerIsAnimActive(void);
bool8 PlayerCheckIfAnimFinishedOrInactive(void);
bool8 player_is_anim_in_certain_ranges(void);
bool8 sub_805BF58(void);
+void PlayerRun(u8 direction);
+void PlayerRunSlow(u8 direction);
+void PlayerGoSpeed2(u8 direction);
+void PlayerGoSpeed1(u8 direction);
+void PlayerGoSlow(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 PlayerRun(u8 direction);
-void PlayerRunSlow(u8 direction);
void PlayerFaceDirection(u8 direction);
void PlayerTurnInPlace(u8 direction);
-void PlayerGoSpeed2(u8 direction);
-void PlayerGoSpeed1(u8 direction);
void PlayerJumpLedge(u8 direction);
-void PlayerGoSlow(u8 direction);
void PlayerGoSpin(u8 direction);
-void PlayerRideWaterCurrent(u8 direction);
void sub_805C2CC(u8 metatileBehavior);
void sub_805CC40(struct ObjectEvent * playerObjEvent);
void DoPlayerMatJump(void);
@@ -779,3 +780,87 @@ void PlayerSetAnimId(u8 movementActionId, u8 copyableMovement)
sub_8112628(movementActionId);
}
}
+
+void sub_805C06C(struct ObjectEvent * objectEvent, u8 movementAction)
+{
+ if (!ObjectEventSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], movementAction))
+ sub_81126AC(movementAction, 0);
+}
+
+void sub_805C0A4(struct ObjectEvent * objectEvent, u8 movementAction)
+{
+ if (!ObjectEventSetHeldMovement(objectEvent, movementAction))
+ sub_8112588(objectEvent->localId, objectEvent->mapNum, objectEvent->mapGroup, movementAction, 32);
+}
+
+void sub_805C0D4(u8 direction)
+{
+ PlayerSetAnimId(sub_8063F2C(direction), 2);
+}
+
+void PlayerGoSlow(u8 direction)
+{
+ PlayerSetAnimId(sub_8063F58(direction), 2);
+}
+
+void PlayerGoSpeed1(u8 direction)
+{
+ PlayerSetAnimId(GetWalkNormalMovementAction(direction), 2);
+}
+
+void PlayerGoSpeed2(u8 direction)
+{
+ PlayerSetAnimId(GetWalkFastMovementAction(direction), 2);
+}
+
+void sub_805C134(u8 direction)
+{
+ PlayerSetAnimId(sub_8063FDC(direction), 2);
+}
+
+void PlayerRideWaterCurrent(u8 direction)
+{
+ PlayerSetAnimId(sub_8064008(direction), 2);
+}
+
+void sub_805C164(u8 direction)
+{
+ PlayerSetAnimId(GetWalkFastestMovementAction(direction), 2);
+}
+
+void PlayerRun(u8 direction)
+{
+ PlayerSetAnimId(GetPlayerRunMovementAction(direction), 2);
+}
+
+void PlayerRunSlow(u8 direction)
+{
+ PlayerSetAnimId(GetPlayerRunSlowMovementAction(direction), 2);
+}
+
+void PlayerOnBikeCollide(u8 direction)
+{
+ sub_805C438(direction);
+ PlayerSetAnimId(GetWalkInPlaceNormalMovementAction(direction), 2);
+}
+
+void PlayerNotOnBikeCollide(u8 direction)
+{
+ sub_805C438(direction);
+ PlayerSetAnimId(GetStepInPlaceDelay32AnimId(direction), 2);
+}
+
+void PlayerFaceDirection(u8 direction)
+{
+ PlayerSetAnimId(GetFaceDirectionMovementAction(direction), 1);
+}
+
+void sub_805C20C(u8 direction)
+{
+ PlayerSetAnimId(GetWalkSlowMovementAction(direction), 1);
+}
+
+void PlayerTurnInPlace(u8 direction)
+{
+ PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(direction), 1);
+}
diff --git a/src/quest_log.c b/src/quest_log.c
index fb327433a..b2dbb5721 100644
--- a/src/quest_log.c
+++ b/src/quest_log.c
@@ -43,6 +43,7 @@
#include "constants/species.h"
#include "constants/items.h"
#include "constants/field_weather.h"
+#include "constants/event_object_movement.h"
u8 gUnknown_3005E88;
@@ -1448,7 +1449,7 @@ void sub_811246C(struct Sprite *sprite)
}
}
-void sub_81124EC(u8 a0, u8 a1, u8 a2, u8 a3)
+void sub_81124EC(u8 a0, u8 a1, u8 a2, u8 movementActionId)
{
if (!sub_8112CEC())
{
@@ -1457,37 +1458,37 @@ void sub_81124EC(u8 a0, u8 a1, u8 a2, u8 a3)
sCurQuestLogEntry[sQuestLogCursor].unk_0 = a0;
sCurQuestLogEntry[sQuestLogCursor].unk_1 = a1;
sCurQuestLogEntry[sQuestLogCursor].unk_2 = a2;
- sCurQuestLogEntry[sQuestLogCursor].unk_3 = a3;
+ sCurQuestLogEntry[sQuestLogCursor].unk_3 = movementActionId;
sQuestLogCursor++;
sNextStepDelay = 0;
}
}
-void sub_8112588(u8 a0, u8 a1, u8 a2, u8 a3, u8 a4)
+void sub_8112588(u8 localId, u8 mapNum, u8 mapGroup, u8 movementActionId, u8 duration)
{
if (!RecordHeadAtEndOfEntry())
{
sCurQuestLogEntry[sQuestLogCursor].unk_4 = sNextStepDelay;
sCurQuestLogEntry[sQuestLogCursor].unk_6 = 0;
- sCurQuestLogEntry[sQuestLogCursor].unk_0 = a0;
- sCurQuestLogEntry[sQuestLogCursor].unk_1 = a1;
- sCurQuestLogEntry[sQuestLogCursor].unk_2 = a2;
- sCurQuestLogEntry[sQuestLogCursor].unk_3 = a3;
+ sCurQuestLogEntry[sQuestLogCursor].unk_0 = localId;
+ sCurQuestLogEntry[sQuestLogCursor].unk_1 = mapNum;
+ sCurQuestLogEntry[sQuestLogCursor].unk_2 = mapGroup;
+ sCurQuestLogEntry[sQuestLogCursor].unk_3 = movementActionId;
sQuestLogCursor++;
- sNextStepDelay = a4;
+ sNextStepDelay = duration;
}
}
-void sub_8112628(u8 a0)
+void sub_8112628(u8 movementActionId)
{
if (!sub_8112CEC())
{
- if (a0 != sCurQuestLogEntry[gUnknown_203B01C].unk_3 || a0 > 3)
+ if (movementActionId != sCurQuestLogEntry[gUnknown_203B01C].unk_3 || movementActionId > MOVEMENT_ACTION_FACE_RIGHT)
{
sCurQuestLogEntry[sQuestLogCursor].unk_4 = sNextStepDelay;
sCurQuestLogEntry[sQuestLogCursor].unk_6 = 0;
sCurQuestLogEntry[sQuestLogCursor].unk_0 = 0;
- sCurQuestLogEntry[sQuestLogCursor].unk_3 = a0;
+ sCurQuestLogEntry[sQuestLogCursor].unk_3 = movementActionId;
gUnknown_203B01C = sQuestLogCursor;
sQuestLogCursor++;
sNextStepDelay = 0;
@@ -1495,17 +1496,17 @@ void sub_8112628(u8 a0)
}
}
-void sub_81126AC(u8 a0, u8 a1)
+void sub_81126AC(u8 movementActionId, u8 duration)
{
if (!RecordHeadAtEndOfEntry())
{
sCurQuestLogEntry[sQuestLogCursor].unk_4 = sNextStepDelay;
sCurQuestLogEntry[sQuestLogCursor].unk_6 = 0;
sCurQuestLogEntry[sQuestLogCursor].unk_0 = 0;
- sCurQuestLogEntry[sQuestLogCursor].unk_3 = a0;
+ sCurQuestLogEntry[sQuestLogCursor].unk_3 = movementActionId;
gUnknown_203B01C = sQuestLogCursor;
sQuestLogCursor++;
- sNextStepDelay = a1;
+ sNextStepDelay = duration;
}
}
@@ -1637,16 +1638,16 @@ static void SetUpQuestLogEntry(u8 kind, struct QuestLogEntry *entry, u16 size)
{
case DIR_NONE:
case DIR_SOUTH:
- sCurQuestLogEntry[sQuestLogCursor].unk_3 = DIR_SOUTH - 1;
+ sCurQuestLogEntry[sQuestLogCursor].unk_3 = MOVEMENT_ACTION_FACE_DOWN;
break;
case DIR_EAST:
- sCurQuestLogEntry[sQuestLogCursor].unk_3 = DIR_EAST - 1;
+ sCurQuestLogEntry[sQuestLogCursor].unk_3 = MOVEMENT_ACTION_FACE_RIGHT;
break;
case DIR_NORTH:
- sCurQuestLogEntry[sQuestLogCursor].unk_3 = DIR_NORTH - 1;
+ sCurQuestLogEntry[sQuestLogCursor].unk_3 = MOVEMENT_ACTION_FACE_UP;
break;
case DIR_WEST:
- sCurQuestLogEntry[sQuestLogCursor].unk_3 = DIR_WEST - 1;
+ sCurQuestLogEntry[sQuestLogCursor].unk_3 = MOVEMENT_ACTION_FACE_LEFT;
break;
}
gUnknown_203B01C = 0;