Match sub_080704FC + playerItemPacciCane data

This commit is contained in:
Tal Hayon 2022-02-18 22:35:08 +02:00
parent 80ef0a7826
commit a25eb9b9fe
4 changed files with 41 additions and 101 deletions

View File

@ -1,84 +0,0 @@
.syntax unified
push {r4, r5, lr}
adds r4, r0, #0
ldr r5, _0807052C @ =gPlayerEntity
adds r0, r5, #0
adds r0, #0x5a
ldrb r2, [r0]
movs r0, #0x80
ands r0, r2
ldr r1, _08070530 @ =gPlayerState
cmp r0, #0
bne _08070518
ldr r0, [r1, #0x2c]
cmp r4, r0
beq _08070534
_08070518:
ldr r0, [r1, #0x2c]
cmp r4, r0
bne _08070522
movs r0, #0
str r0, [r1, #0x2c]
_08070522:
adds r0, r4, #0
bl DeleteEntity
b _08070566
.align 2, 0
_0807052C: .4byte gPlayerEntity
_08070530: .4byte gPlayerState
_08070534:
movs r0, #0xf
ands r0, r2
cmp r0, #0xf
beq _08070562
ldrb r1, [r5, #0x1e]
adds r0, #0x91
subs r0, r1, r0
ldrb r2, [r4, #0x1e]
cmp r0, r2
beq _08070558
adds r0, r1, #0
adds r0, #0x6f
strb r0, [r4, #0x1e]
ldrb r1, [r4, #0x1e]
ldrh r2, [r4, #0x12]
adds r0, r4, #0
bl sub_080042D0
_08070558:
adds r0, r4, #0
adds r1, r5, #0
bl sub_08078E84
b _08070566
_08070562:
movs r0, #0xff
strb r0, [r4, #0x1e]
_08070566:
ldr r2, _08070580 @ =gPlayerEntity
ldrb r1, [r2, #0x14]
movs r0, #2
ands r0, r1
cmp r0, #0
beq _08070584
ldrb r0, [r2, #0x18]
lsls r0, r0, #0x19
lsrs r2, r0, #0x1f
movs r0, #1
eors r2, r0
b _0807058A
.align 2, 0
_08070580: .4byte gPlayerEntity
_08070584:
ldrb r0, [r2, #0x18]
lsls r0, r0, #0x19
lsrs r2, r0, #0x1f
_0807058A:
lsls r2, r2, #6
ldrb r1, [r4, #0x18]
movs r0, #0x41
rsbs r0, r0, #0
ands r0, r1
orrs r0, r2
strb r0, [r4, #0x18]
pop {r4, r5, pc}
.align 2, 0
.syntax divided

View File

@ -1,9 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_0811B9D8:: @ 0811B9D8
.4byte sub_080704D4
.4byte sub_080704FC

View File

@ -1337,7 +1337,7 @@ SECTIONS {
src/playerHitbox.o(.rodata);
data/gfx/sprite_frames.o(.rodata);
src/playerItem/playerItem12.o(.rodata);
data/const/playerItem/playerItemPacciCane.o(.rodata);
src/playerItem/playerItemPacciCane.o(.rodata);
src/player.o(.rodata);
src/item.o(.rodata);
data/const/item/itemSword.o(.rodata);

View File

@ -6,23 +6,56 @@
#include "save.h"
#include "structures.h"
extern void (*const gUnk_0811B9D8[])(Entity*);
void sub_080704FC(Entity*);
void PlayerItemPacciCane_Action1(Entity*);
void PlayerItemPacciCane_Init(Entity* this);
void PlayerItemPacciCane(Entity* this) {
gUnk_0811B9D8[this->action](this);
static void (*const PlayerItemPacciCane_Actions[])(Entity*) = {
PlayerItemPacciCane_Init,
PlayerItemPacciCane_Action1,
};
PlayerItemPacciCane_Actions[this->action](this);
}
void sub_080704D4(Entity* this) {
void PlayerItemPacciCane_Init(Entity* this) {
this->action = 1;
this->frameIndex = -1;
LoadSwapGFX(this, 1, 3);
SoundReq(SFX_10E);
sub_080704FC(this);
PlayerItemPacciCane_Action1(this);
}
ASM_FUNC("asm/non_matching/playerItemPacciCane/sub_080704FC.inc", void sub_080704FC(Entity* this))
void PlayerItemPacciCane_Action1(Entity* this) {
u32 playerFrame;
u32 frameIndex;
u32 flipX;
if (((gPlayerEntity.frame & 0x80) != 0) || (this != gPlayerState.item)) {
if (this == gPlayerState.item) {
gPlayerState.item = NULL;
}
DeleteEntity(this);
} else {
playerFrame = gPlayerEntity.frame & 0xf;
if (playerFrame != 0xf) {
frameIndex = gPlayerEntity.frameIndex;
playerFrame += 0x91;
if (frameIndex - playerFrame != this->frameIndex) {
this->frameIndex = frameIndex + 0x6f;
sub_080042D0(this, this->frameIndex, this->spriteIndex);
}
sub_08078E84(this, &gPlayerEntity);
} else {
this->frameIndex = -1;
}
}
if ((gPlayerEntity.animationState & 2)) {
flipX = gPlayerEntity.spriteSettings.flipX ^ 1;
} else {
flipX = gPlayerEntity.spriteSettings.flipX;
}
this->spriteSettings.flipX = flipX;
}
// TODO This name sounds like this does not belong in this file
void ClearMenuSavestate(void) {