Merge pull request #476 from notyourav/pitems

match sub_080A310C
This commit is contained in:
notyourav 2022-03-28 16:45:28 -07:00 committed by GitHub
commit 52439a0fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 136 deletions

View File

@ -1,116 +0,0 @@
.syntax unified
push {r4, r5, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xa]
cmp r0, #0
beq _080A312A
ldrb r0, [r4, #0xe]
subs r0, #1
strb r0, [r4, #0xe]
lsls r0, r0, #0x18
lsrs r0, r0, #0x18
cmp r0, #0xff
bne _080A3200
bl DeleteThisEntity
b _080A3200
_080A312A:
adds r0, r4, #0
bl GetNextFrame
ldr r0, [r4, #0x6c]
subs r0, #1
str r0, [r4, #0x6c]
movs r1, #1
rsbs r1, r1, #0
cmp r0, r1
beq _080A31FC
adds r0, r4, #0
bl GetNextFrame
adds r0, r4, #0
bl LinearMoveUpdate
ldrb r0, [r4, #0xe]
adds r0, #1
strb r0, [r4, #0xe]
ldrb r0, [r4, #0xb]
cmp r0, #0
bne _080A315C
adds r0, r4, #0
bl sub_0800451C
_080A315C:
movs r1, #0x2e
ldrsh r0, [r4, r1]
ldr r2, _080A31F0 @ =gRoomControls
ldrh r1, [r2, #6]
subs r0, r0, r1
asrs r0, r0, #4
movs r3, #0x3f
ands r0, r3
movs r5, #0x32
ldrsh r1, [r4, r5]
ldrh r2, [r2, #8]
subs r1, r1, r2
asrs r1, r1, #4
ands r1, r3
lsls r1, r1, #6
orrs r0, r1
ldr r1, _080A31F4 @ =gPlayerEntity
adds r1, #0x38
ldrb r1, [r1]
movs r2, #0x80
bl sub_080B1BA4
cmp r0, #0
bne _080A31AE
ldr r1, _080A31F8 @ =gUnk_08003E44
movs r0, #0x2e
ldrsh r2, [r4, r0]
movs r5, #0x32
ldrsh r3, [r4, r5]
adds r0, r4, #0
bl sub_080040D8
cmp r0, #0
beq _080A31AE
adds r0, r4, #0
movs r1, #0x19
movs r2, #0
bl CreateFx
bl DeleteThisEntity
_080A31AE:
adds r0, r4, #0
adds r0, #0x41
ldrb r0, [r0]
cmp r0, #0
beq _080A31C6
adds r0, r4, #0
movs r1, #0x19
movs r2, #0
bl CreateFx
bl DeleteThisEntity
_080A31C6:
adds r0, r4, #0
movs r1, #0xc
bl sub_08008790
cmp r0, #0
beq _080A31D6
bl DeleteThisEntity
_080A31D6:
adds r0, r4, #0
adds r0, #0x68
ldrb r3, [r0]
movs r0, #0x15
movs r1, #1
movs r2, #0
bl CreatePlayerItem
str r0, [r4, #0x54]
cmp r0, #0
beq _080A3200
str r4, [r0, #0x50]
b _080A3200
.align 2, 0
_080A31F0: .4byte gRoomControls
_080A31F4: .4byte gPlayerEntity
_080A31F8: .4byte gUnk_08003E44
_080A31FC:
bl DeleteThisEntity
_080A3200:
pop {r4, r5, pc}
.align 2, 0
.syntax divided

View File

@ -1,38 +1,84 @@
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "sound.h"
#include "coord.h"
#include "functions.h"
#include "effects.h"
extern void (*const gUnk_08127270[])(Entity*);
typedef struct {
Entity base;
u8 unk68;
u16 unk6a;
u32 unk6c;
} FireRodProjectileEntity;
extern u8 gUnk_08003E44;
extern void (*const gUnk_08127270[])(FireRodProjectileEntity*);
extern Hitbox gUnk_08127278;
void sub_080A310C(Entity*);
void sub_080A310C(FireRodProjectileEntity*);
void PlayerItemFireRodProjectile(Entity* this) {
gUnk_08127270[this->action](this);
gUnk_08127270[this->action]((FireRodProjectileEntity*)this);
}
void sub_080A3084(Entity* this) {
this->spriteSettings.draw = 1;
this->action = 0x01;
CopyPosition(this->parent, this);
if (this->type == 0) {
this->field_0x3c = gPlayerEntity.field_0x3c + 0x01;
this->hitbox = &gUnk_08127278;
this->speed = 0x400;
if (this->collisionLayer == 0x02) {
this->type2 = 0x01;
void sub_080A3084(FireRodProjectileEntity* this) {
super->spriteSettings.draw = 1;
super->action = 0x01;
CopyPosition(super->parent, super);
if (super->type == 0) {
super->field_0x3c = gPlayerEntity.field_0x3c + 1;
super->hitbox = &gUnk_08127278;
super->speed = 0x400;
if (super->collisionLayer == 0x02) {
super->type2 = 0x01;
}
this->direction = this->animationState << 2;
*(u32*)&this->field_0x6c = 0x3c;
sub_0801766C(this);
LinearMoveUpdate(this);
super->direction = Direction8FromAnimationState(super->animationState);
this->unk6c = 60;
sub_0801766C(super);
LinearMoveUpdate(super);
SoundReq(SFX_ITEM_SWORD_BEAM);
} else {
this->actionDelay = 0x06;
super->actionDelay = 6;
}
InitializeAnimation(this, 0x18);
InitializeAnimation(super, 0x18);
sub_080A310C(this);
}
ASM_FUNC("asm/non_matching/playerItem15/sub_080A310C.inc", void sub_080A310C(Entity* this))
void sub_080A310C(FireRodProjectileEntity* this) {
if (super->type != 0) {
if (super->actionDelay-- == 0) {
DeleteThisEntity();
}
} else {
GetNextFrame(super);
if (this->unk6c-- != 0) {
GetNextFrame(super);
LinearMoveUpdate(super);
super->actionDelay++;
if (super->type2 == 0) {
sub_0800451C(super);
}
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0 &&
sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI)) {
CreateFx(super, FX_SWORD_MAGIC, 0);
DeleteThisEntity();
}
if (super->bitfield != 0) {
CreateFx(super, FX_SWORD_MAGIC, 0);
DeleteThisEntity();
}
if (sub_08008790(super, 0xc)) {
DeleteThisEntity();
}
super->child = CreatePlayerItem(0x15, 1, 0, this->unk68);
if (super->child != NULL) {
super->child->parent = super;
}
} else {
DeleteThisEntity();
}
}
}