summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMCboy <atasro2@gmail.com>2018-07-19 21:22:35 +0430
committerGitHub <noreply@github.com>2018-07-19 21:22:35 +0430
commita8f9adeaf54c855f4afdd23257df75f6270733fb (patch)
tree980a825be2d8e3e6787c7083842f99abcfb8cf23
parente3a82bd2c51054511da14e325cea104512e8a4ea (diff)
decompile player_field_avatar
-rw-r--r--src/field_player_avatar.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
new file mode 100644
index 000000000..b0d703e25
--- /dev/null
+++ b/src/field_player_avatar.c
@@ -0,0 +1,46 @@
+#include "global.h"
+#include "global.fieldmap.h"
+#include "sprite.h"
+#include "event_object_movement.h"
+#include "bike.h"
+
+static u8 EventObjectCB2_NoMovement2();
+void sub_808C280(struct EventObject *); //struct EventObject *playerEventObj
+bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8);
+void npc_clear_strange_bits(struct EventObject *);
+void DoPlayerAvatarTransition(void);
+bool8 TryDoMetatileBehaviorForcedMovement();
+void MovePlayerAvatarUsingKeypadInput(u8, u16, u16);
+void PlayerAllowForcedMovementIfMovingSameDirection();
+
+void MovementType_Player(struct Sprite *sprite)
+{
+ // ((Sprite->data[0] << 3) + Sprite->data[0]) << 2
+ UpdateEventObjectCurrentMovement(&gEventObjects[sprite->data[0]], sprite, EventObjectCB2_NoMovement2);
+}
+
+static u8 EventObjectCB2_NoMovement2()
+{
+ return 0;
+}
+
+void player_step(u8 direction, u16 newKeys, u16 heldKeys)
+{
+ struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+
+ sub_808C280(playerEventObj);
+ if (gPlayerAvatar.preventStep == FALSE)
+ {
+ Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys);
+ if (TryInterruptEventObjectSpecialAnim(playerEventObj, direction) == 0)
+ {
+ npc_clear_strange_bits(playerEventObj);
+ DoPlayerAvatarTransition();
+ if (TryDoMetatileBehaviorForcedMovement() == 0)
+ {
+ MovePlayerAvatarUsingKeypadInput(direction, newKeys, heldKeys);
+ PlayerAllowForcedMovementIfMovingSameDirection();
+ }
+ }
+ }
+}