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

View File

@ -1,89 +0,0 @@
.syntax unified
push {r4, lr}
adds r4, r0, #0
ldrb r1, [r4, #0x14]
movs r0, #2
ands r0, r1
cmp r0, #0
beq _0801B960
ldr r3, _0801B95C @ =gPlayerEntity
ldrb r1, [r3, #0x18]
lsls r1, r1, #0x19
lsrs r1, r1, #0x1f
movs r0, #1
eors r1, r0
lsls r1, r1, #6
ldrb r2, [r4, #0x18]
subs r0, #0x42
b _0801B96E
.align 2, 0
_0801B95C: .4byte gPlayerEntity
_0801B960:
ldr r3, _0801B998 @ =gPlayerEntity
ldrb r0, [r3, #0x18]
movs r1, #0x40
ands r1, r0
ldrb r2, [r4, #0x18]
movs r0, #0x41
rsbs r0, r0, #0
_0801B96E:
ands r0, r2
orrs r0, r1
strb r0, [r4, #0x18]
adds r0, r3, #0
adds r0, #0x58
ldrb r0, [r0]
adds r0, #0x68
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
cmp r0, #3
bhi _0801B99C
ldrb r0, [r3, #0x1e]
adds r0, #0x2e
strb r0, [r4, #0x1e]
ldrb r1, [r4, #0x1e]
ldrh r2, [r4, #0x12]
adds r0, r4, #0
bl sub_080042D0
b _0801B9A0
.align 2, 0
_0801B998: .4byte gPlayerEntity
_0801B99C:
movs r0, #0xff
strb r0, [r4, #0x1e]
_0801B9A0:
ldrb r3, [r4, #0x14]
lsrs r3, r3, #1
lsls r0, r3, #3
ldr r1, _0801B9E0 @ =gUnk_080B7850
adds r0, r0, r1
str r0, [r4, #0x48]
lsls r3, r3, #1
ldr r0, _0801B9E4 @ =gUnk_080B7848
adds r3, r3, r0
ldr r0, _0801B9E8 @ =gPlayerState
adds r0, #0xac
ldrh r0, [r0]
movs r1, #8
ands r1, r0
lsls r1, r1, #0x10
lsrs r1, r1, #0x10
rsbs r1, r1, #0
lsrs r1, r1, #0x1f
movs r2, #0
ldrsb r2, [r3, r2]
ldrb r3, [r3, #1]
lsls r3, r3, #0x18
asrs r3, r3, #0x18
adds r0, r4, #0
bl sub_08008782
ldr r1, _0801B9EC @ =gPlayerEntity
adds r0, r4, #0
bl sub_08078E84
pop {r4, pc}
.align 2, 0
_0801B9E0: .4byte gUnk_080B7850
_0801B9E4: .4byte gUnk_080B7848
_0801B9E8: .4byte gPlayerState
_0801B9EC: .4byte gPlayerEntity
.syntax divided

View File

@ -20860,16 +20860,6 @@
"start": 751604,
"size": 8
},
{
"path": "playerItemC/gUnk_080B7848.bin",
"start": 751688,
"size": 8
},
{
"path": "playerItemC/gUnk_080B7850.bin",
"start": 751696,
"size": 32
},
{
"path": "playerItemSwordSpin/gUnk_080B7878.bin",
"start": 751736,

View File

@ -1,15 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_080B7840:: @ 080B7840
.4byte sub_0801B8B0
.4byte sub_0801B8FC
gUnk_080B7848:: @ 080B7848
.incbin "playerItemC/gUnk_080B7848.bin"
gUnk_080B7850:: @ 080B7850
.incbin "playerItemC/gUnk_080B7850.bin"

View File

@ -930,7 +930,7 @@ SECTIONS {
data/data_080B4410.o(.rodata);
data/const/playerItem/playerItemBomb.o(.rodata);
src/playerItem/playerItem3.o(.rodata);
data/const/playerItem/playerItemC.o(.rodata);
src/playerItem/playerItemC.o(.rodata);
data/const/playerItem/playerItemSwordSpin.o(.rodata);
data/data_080B7910.o(.rodata);
data/const/playerItem/playerItemCellOverwriteSet.o(.rodata);

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);