summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-02-12 15:59:03 +0200
committerTal Hayon <talhayon1@gmail.com>2022-02-12 16:18:42 +0200
commit52c5a47bbd02aeaa4a46ca5fdaa6c1cdb6d8aaf3 (patch)
tree89e5ae70500e5c7c273bb342d9c2630acce40d77 /src
parentb9876fd30f2bc04036a3a223c193fd8fd833cafa (diff)
Match sub_0801B938 + data
Diffstat (limited to 'src')
-rw-r--r--src/playerItem/playerItemC.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/playerItem/playerItemC.c b/src/playerItem/playerItemC.c
index aa08e1bc..f376fdd2 100644
--- a/src/playerItem/playerItemC.c
+++ b/src/playerItem/playerItemC.c
@@ -3,17 +3,21 @@
#include "player.h"
#include "functions.h"
-extern void (*const gUnk_080B7840[])(Entity*);
-
extern void sub_08079BD8(Entity*);
-void sub_0801B8FC(Entity*);
+extern Entity* sub_08008782(Entity*, u32, s32, s32);
+void sub_0801B8FC(Entity*);
+void sub_0801B8B0(Entity*);
void sub_0801B938(Entity*);
extern void sub_08017744(Entity*);
void PlayerItemC(Entity* this) {
- gUnk_080B7840[this->action](this);
+ static void (*const PlayerItemC_Actions[])(Entity*) = {
+ sub_0801B8B0,
+ sub_0801B8FC,
+ };
+ PlayerItemC_Actions[this->action](this);
}
void sub_0801B8B0(Entity* this) {
@@ -48,7 +52,36 @@ void sub_0801B8FC(Entity* this) {
}
}
-ASM_FUNC("asm/non_matching/playerItemC/sub_0801B938.inc", void sub_0801B938(Entity* this))
+void sub_0801B938(Entity* this) {
+ static const s8 gUnk_080B7848[] = {
+ 0, -15, 12, -3, 0, 9, -12, -3,
+ };
+ static const Hitbox gUnk_080B7850[] = {
+ { 0, -18, { 0 }, 4, 8 },
+ { 16, 0, { 0 }, 8, 4 },
+ { 2, 11, { 0 }, 4, 8 },
+ { -16, 0, { 0 }, 8, 4 },
+ };
+ const s8* ptr;
+
+ if ((this->animationState & 2)) {
+ this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX ^ 1;
+ } else {
+ this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
+ }
+
+ if ((u8)(gPlayerEntity.animIndex + 0x68) < 4) {
+ this->frameIndex = gPlayerEntity.frameIndex + 0x2e;
+ sub_080042D0(this, this->frameIndex, this->spriteIndex);
+ } else {
+ this->frameIndex = 0xff;
+ }
+
+ this->hitbox = (Hitbox*)&gUnk_080B7850[this->animationState >> 1];
+ ptr = &gUnk_080B7848[(this->animationState >> 1) * 2];
+ sub_08008782(this, -(gPlayerState.field_0xac & 8) != 0, ptr[0], ptr[1]);
+ sub_08078E84(this, &gPlayerEntity);
+}
void sub_0801B9F0(Entity* this) {
COLLISION_OFF(this);