Merge pull request #540 from hatal175/sub_08078008

Match sub_08078008
This commit is contained in:
notyourav 2022-07-27 17:26:37 -07:00 committed by GitHub
commit c63f40a0a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 69 deletions

View File

@ -1,56 +0,0 @@
.syntax unified
push {r4, r5, r6, lr}
adds r4, r0, #0
ldr r6, _08078060 @ =gSave
adds r5, r6, #0
adds r5, #0xb4
ldrb r0, [r5]
bl ItemIsSword
cmp r0, #0
bne _0807802C
adds r5, r6, #0
adds r5, #0xb5
ldrb r0, [r5]
bl ItemIsSword
movs r2, #0
cmp r0, #0
beq _0807802E
_0807802C:
ldrb r2, [r5]
_0807802E:
subs r0, r2, #1
cmp r0, #1
bhi _08078036
movs r2, #0
_08078036:
cmp r2, #0
beq _08078068
ldr r0, _08078064 @ =gPlayerState
ldrb r1, [r0, #0x1b]
movs r0, #0x20
ands r0, r1
cmp r0, #0
beq _08078068
ldrb r0, [r4, #1]
adds r0, #1
strb r0, [r4, #1]
lsls r0, r0, #0x18
asrs r0, r0, #0x18
cmp r0, #0x14
ble _0807806C
movs r0, #0xa
strb r0, [r4, #1]
movs r0, #3
strb r0, [r4]
strb r2, [r4, #2]
b _0807806C
.align 2, 0
_08078060: .4byte gSave
_08078064: .4byte gPlayerState
_08078068:
movs r0, #0
strb r0, [r4, #1]
_0807806C:
movs r0, #0
pop {r4, r5, r6, pc}
.syntax divided

View File

@ -704,21 +704,20 @@ bool32 sub_08077FEC(u32 action) {
return gPlayerChargeActions[state->action](state);
}
NONMATCH("asm/non_matching/playerUtils/sub_08078008.inc", bool32 sub_08078008(ChargeState* state)) {
u32 swordType;
if (ItemIsSword(gSave.stats.itemButtons[0]) == 0) {
if (ItemIsSword(gSave.stats.itemButtons[1]) != 0) {
swordType = gSave.stats.itemButtons[1];
} else {
swordType = 0;
}
} else {
bool32 sub_08078008(ChargeState* state) {
Item swordType;
if (ItemIsSword(gSave.stats.itemButtons[0]) != ITEM_NONE) {
swordType = gSave.stats.itemButtons[0];
} else if (ItemIsSword(gSave.stats.itemButtons[1]) != ITEM_NONE) {
swordType = gSave.stats.itemButtons[1];
} else {
swordType = ITEM_NONE;
}
if (swordType == 1 || swordType == 2) {
swordType = 0;
if (swordType == ITEM_SMITH_SWORD || swordType == ITEM_GREEN_SWORD) {
swordType = ITEM_NONE;
}
if ((swordType != 0) && ((gPlayerState.sword_state & 0x20) != 0)) {
if (swordType != ITEM_NONE && ((gPlayerState.sword_state & 0x20) != 0)) {
if (++state->preChargeTimer > 20) {
state->preChargeTimer = 10;
state->action = 3;
@ -729,7 +728,6 @@ NONMATCH("asm/non_matching/playerUtils/sub_08078008.inc", bool32 sub_08078008(Ch
}
return FALSE;
}
END_NONMATCH
bool32 sub_08078070(ChargeState* state) {
if ((gPlayerState.sword_state & 0x20) != 0) {