Match sub_08076088

This commit is contained in:
Tal Hayon 2022-05-21 19:37:34 +03:00
parent 7c7fbef8f9
commit 6243626efe
6 changed files with 63 additions and 154 deletions

View File

@ -1,147 +0,0 @@
.syntax unified
push {r4, r5, r6, r7, lr}
mov r7, r8
push {r7}
adds r4, r0, #0
adds r3, r1, #0
adds r5, r2, #0
cmp r3, #0
beq _080760AA
ldrb r0, [r3, #0x16]
movs r1, #1
ands r1, r0
cmp r1, #0
beq _080760A4
b _080761A0
_080760A4:
movs r0, #2
strb r0, [r3, #0xc]
strb r1, [r3, #0xd]
_080760AA:
str r3, [r4, #0x18]
ldr r0, _080760C4 @ =gPlayerState
ldr r0, [r0, #0x30]
movs r1, #8
ands r0, r1
cmp r0, #0
beq _080760CC
ldr r1, _080760C8 @ =0x00000928
adds r0, r4, #0
bl sub_08077DF4
b _080760D6
.align 2, 0
_080760C4: .4byte gPlayerState
_080760C8: .4byte 0x00000928
_080760CC:
movs r1, #0xce
lsls r1, r1, #2
adds r0, r4, #0
bl sub_08077DF4
_080760D6:
ldr r3, _08076130 @ =gPlayerState
movs r0, #0
mov r8, r0
movs r7, #3
strb r7, [r3, #5]
adds r0, r3, #0
adds r0, #0xa8
movs r6, #4
strb r6, [r0]
movs r0, #2
strb r0, [r4, #4]
movs r0, #0xf
strb r0, [r4, #0xf]
ldr r2, _08076134 @ =gPlayerEntity
movs r1, #0x79
adds r1, r1, r2
mov ip, r1
ldrb r1, [r1]
movs r0, #0x80
ands r0, r1
cmp r0, #0
beq _08076138
mov r1, r8
mov r0, ip
strb r1, [r0]
ldrb r0, [r2, #0x10]
movs r1, #0x80
orrs r0, r1
strb r0, [r2, #0x10]
strb r6, [r3, #5]
movs r1, #8
asrs r1, r5
mvns r1, r1
ldrb r2, [r3, #0xb]
adds r0, r1, #0
ands r0, r2
strb r0, [r3, #0xb]
ldrb r0, [r3, #0xa]
ands r1, r0
strb r1, [r3, #0xa]
strb r7, [r4, #4]
mov r0, r8
strb r0, [r4, #0xf]
b _0807614A
.align 2, 0
_08076130: .4byte gPlayerState
_08076134: .4byte gPlayerEntity
_08076138:
movs r1, #8
asrs r1, r5
ldrb r2, [r3, #0xa]
adds r0, r1, #0
orrs r0, r2
strb r0, [r3, #0xa]
ldrb r0, [r3, #0xb]
orrs r1, r0
strb r1, [r3, #0xb]
_0807614A:
adds r0, r4, #0
movs r1, #0x13
bl CreatePlayerItemWithParent
adds r3, r0, #0
cmp r3, #0
bne _08076162
adds r0, r4, #0
adds r1, r5, #0
bl PlayerCancelHoldItem
b _080761A0
_08076162:
ldr r1, _08076194 @ =gPlayerEntity
str r3, [r1, #0x74]
movs r2, #0
strb r2, [r1, #0xf]
ldr r0, [r4, #0x18]
str r0, [r3, #0x54]
ldrb r0, [r1, #0x16]
strb r0, [r3, #0x16]
str r4, [r3, #0x50]
str r3, [r4, #0x18]
ldrb r0, [r4, #3]
strb r0, [r3, #0xb]
ldrb r0, [r4, #7]
strb r0, [r3, #0xe]
ldrb r0, [r4, #8]
strb r0, [r3, #0xf]
ldr r0, [r4, #0x18]
ldrb r1, [r0, #0x16]
movs r0, #0xf0
ands r0, r1
cmp r0, #0x10
bne _08076198
movs r0, #8
strb r0, [r4, #7]
b _0807619A
.align 2, 0
_08076194: .4byte gPlayerEntity
_08076198:
strb r2, [r4, #7]
_0807619A:
movs r0, #0x7f
bl SoundReq
_080761A0:
pop {r3}
mov r8, r3
pop {r4, r5, r6, r7, pc}
.align 2, 0
.syntax divided

View File

@ -36,7 +36,7 @@ void sub_08075FF8(ItemBehavior* this, u32 idx) {
} }
maxBombs = this->behaviorID == 7 ? 3 : 1; maxBombs = this->behaviorID == 7 ? 3 : 1;
if (maxBombs > bombCount) { if (maxBombs > bombCount) {
entity = CreatePlayerItemWithParent(this, 2); entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_BOMB);
if (entity != NULL) { if (entity != NULL) {
pos = &gUnk_0811BDAC[gPlayerEntity.animationState & 6]; pos = &gUnk_0811BDAC[gPlayerEntity.animationState & 6];
PositionRelative(&gPlayerEntity, entity, Q_16_16(pos[0]), Q_16_16(pos[1])); PositionRelative(&gPlayerEntity, entity, Q_16_16(pos[0]), Q_16_16(pos[1]));
@ -48,4 +48,57 @@ void sub_08075FF8(ItemBehavior* this, u32 idx) {
DeletePlayerItem(this, idx); DeletePlayerItem(this, idx);
} }
ASM_FUNC("asm/non_matching/itemBomb/sub_08076088.inc", void sub_08076088(ItemBehavior* this, void* arg1)) void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
if (param_2 != NULL) {
if ((param_2->carryFlags & 1) != 0) {
return;
}
param_2->action = 2;
param_2->subAction = param_2->carryFlags & 1;
}
this->field_0x18 = param_2;
if ((gPlayerState.flags & PL_NO_CAP)) {
sub_08077DF4(this, 0x928);
} else {
sub_08077DF4(this, 0x338);
}
gPlayerState.heldObject = 3;
gPlayerState.framestate = 4;
this->stateID = 2;
this->field_0xf = 0xf;
if ((gPlayerEntity.field_0x78.HALF.HI & 0x80)) {
gPlayerEntity.field_0x78.HALF.HI = 0;
COLLISION_ON(&gPlayerEntity);
gPlayerState.heldObject = 4;
gPlayerState.keepFacing = ~(8 >> param_3) & gPlayerState.keepFacing;
gPlayerState.field_0xa = ~(8 >> param_3) & gPlayerState.field_0xa;
this->stateID = 3;
this->field_0xf = 0;
} else {
gPlayerState.field_0xa |= (8 >> param_3);
gPlayerState.keepFacing |= (8 >> param_3);
}
param_2 = CreatePlayerItemWithParent(this, PLAYER_ITEM_13);
if (param_2 == NULL) {
PlayerCancelHoldItem(this, param_3);
} else {
Entity* playerEnt = &gPlayerEntity;
*(Entity**)&playerEnt->field_0x74 = param_2;
playerEnt->subtimer = 0;
param_2->child = this->field_0x18;
param_2->carryFlags = playerEnt->carryFlags;
param_2->parent = (Entity*)this;
this->field_0x18 = param_2;
param_2->type2 = this->field_0x2[1];
param_2->timer = this->field_0x5[2];
param_2->subtimer = this->field_0x5[3];
if ((this->field_0x18->carryFlags & 0xf0) == 0x10) {
this->field_0x5[2] = 8;
} else {
this->field_0x5[2] = 0;
}
SoundReq(SFX_PLY_LIFT);
}
}

View File

@ -2,6 +2,7 @@
#include "entity.h" #include "entity.h"
#include "item.h" #include "item.h"
#include "functions.h" #include "functions.h"
#include "playeritem.h"
void sub_08076C98(ItemBehavior*, u32); void sub_08076C98(ItemBehavior*, u32);
void sub_08076CBC(ItemBehavior*, u32); void sub_08076CBC(ItemBehavior*, u32);
@ -26,7 +27,7 @@ void sub_08076CBC(ItemBehavior* beh, u32 idx) {
DeletePlayerItem(beh, idx); DeletePlayerItem(beh, idx);
} else { } else {
if ((beh->field_0x5[9] & 0x40) != 0) { if ((beh->field_0x5[9] & 0x40) != 0) {
CreatePlayerItemWithParent(beh, 0x12); CreatePlayerItemWithParent(beh, PLAYER_ITEM_12);
} }
UpdateItemAnim(beh); UpdateItemAnim(beh);
} }

View File

@ -5,6 +5,7 @@
#include "effects.h" #include "effects.h"
#include "game.h" #include "game.h"
#include "save.h" #include "save.h"
#include "playeritem.h"
void sub_08076964(ItemBehavior*, u32); void sub_08076964(ItemBehavior*, u32);
void sub_080768F8(ItemBehavior*, u32); void sub_080768F8(ItemBehavior*, u32);
@ -105,7 +106,7 @@ void sub_08076964(ItemBehavior* this, u32 idx) {
(gPlayerState.skills & SKILL_DASH_ATTACK) != 0) { (gPlayerState.skills & SKILL_DASH_ATTACK) != 0) {
gPlayerState.field_0xab = 3; gPlayerState.field_0xab = 3;
sub_08077DF4(this, 0x298); sub_08077DF4(this, 0x298);
bombEntity = CreatePlayerItemWithParent(this, 0xc); bombEntity = CreatePlayerItemWithParent(this, PLAYER_ITEM_C);
if (bombEntity != NULL) { if (bombEntity != NULL) {
if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) { if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) {
uVar3 = gSave.stats.itemButtons[SLOT_A]; uVar3 = gSave.stats.itemButtons[SLOT_A];

View File

@ -114,7 +114,7 @@ void sub_080754B8(ItemBehavior* this, u32 idx) {
if (gPlayerEntity.frameSpriteSettings & 1) { if (gPlayerEntity.frameSpriteSettings & 1) {
iVar1 = sub_0807B014(); iVar1 = sub_0807B014();
if (iVar1 && FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_SWORD_BEAM1, 2) == 0) { if (iVar1 && FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_SWORD_BEAM1, 2) == 0) {
CreatePlayerItemWithParent(this, 0xf); CreatePlayerItemWithParent(this, PLAYER_ITEM_SWORD_BEAM1);
if (iVar1 == 0xf) { if (iVar1 == 0xf) {
gPlayerState.field_0xab = 5; gPlayerState.field_0xab = 5;
} else { } else {
@ -235,7 +235,7 @@ void sub_08075738(ItemBehavior* this, u32 idx) {
} else { } else {
if (((((gPlayerEntity.frameSpriteSettings & 1) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) && if (((((gPlayerEntity.frameSpriteSettings & 1) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) &&
((gPlayerState.skills & SKILL_FOURSWORD) != 0))) { ((gPlayerState.skills & SKILL_FOURSWORD) != 0))) {
Entity* bombEnt = CreatePlayerItemWithParent(this, 0x14); Entity* bombEnt = CreatePlayerItemWithParent(this, PLAYER_ITEM_14);
if (bombEnt) { if (bombEnt) {
bombEnt->animationState = (gPlayerEntity.animationState & 6) | 0x80; bombEnt->animationState = (gPlayerEntity.animationState & 6) | 0x80;
} }

View File

@ -22,6 +22,7 @@
#include "game.h" #include "game.h"
#include "screen.h" #include "screen.h"
#include "main.h" #include "main.h"
#include "playeritem.h"
#define GRAVITY_RATE Q_8_8(32) #define GRAVITY_RATE Q_8_8(32)
#define SLOPE_SPEED_MODIFIER 0x50 #define SLOPE_SPEED_MODIFIER 0x50
@ -1657,7 +1658,7 @@ static void PlayerEmptyBottleInit(Entity* this) {
Entity* ent; Entity* ent;
ResetPlayerItem(); ResetPlayerItem();
ent = CreatePlayerItemWithParent((ItemBehavior*)this, 0xe); ent = CreatePlayerItemWithParent((ItemBehavior*)this, PLAYER_ITEM_BOTTLE);
if (ent != NULL) { if (ent != NULL) {
ent->field_0x68.HALF.LO = gPlayerState.field_0x38; ent->field_0x68.HALF.LO = gPlayerState.field_0x38;
this->subAction++; this->subAction++;