Match sub_0801B938 + data

This commit is contained in:
Tal Hayon
2022-02-12 15:59:03 +02:00
parent b9876fd30f
commit 52c5a47bbd
5 changed files with 39 additions and 120 deletions
+38 -5
View File
@@ -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);