Merge pull request #432 from hatal175/housedoorinterior

This commit is contained in:
notyourav
2022-03-06 21:58:20 -08:00
committed by GitHub
26 changed files with 135 additions and 228 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ void sub_08063390(Entity* this) {
s32 sub_080633C8(Entity* this) {
s32 uVar1;
uVar1 = sub_0806ED9C(this, 0x20, 0x20);
uVar1 = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (uVar1 < 0) {
uVar1 = this->animIndex;
}
+1 -1
View File
@@ -70,7 +70,7 @@ void sub_08068A4C(Entity* this) {
s32 uVar1;
s32 iVar2;
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
uVar1 = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (uVar1 < 0) {
uVar1 = 2;
} else {
+1 -1
View File
@@ -36,7 +36,7 @@ void sub_0806355C(Entity* this) {
}
void sub_08063584(Entity* this) {
if (sub_0806ED9C(this, 0x20, 0x20) >= 0) {
if (GetAnimationStateInRectRadius(this, 0x20, 0x20) >= 0) {
if (this->field_0xf == 0) {
if ((Random() & 0x3f) == 0) {
this->field_0xf = 1;
+1 -1
View File
@@ -104,7 +104,7 @@ void sub_08060158(Entity* this) {
this->actionDelay--;
} else {
this->actionDelay = 2;
index = sub_0806EDD8(this, 0x20, 0x20);
index = GetFacingDirectionInRectRadius(this, 0x20, 0x20);
if (index < 0) {
int state = this->field_0x68.HALF.HI;
this->animationState = state;
+1 -1
View File
@@ -44,7 +44,7 @@ void sub_080697C4(Entity* this) {
void sub_080697EC(Entity* this) {
s32 tmp;
tmp = sub_0806ED9C(this, 0x20, 0x20);
tmp = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (tmp >= 0) {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
+1 -1
View File
@@ -29,7 +29,7 @@ void sub_08069328(Entity* this) {
int action;
this->field_0xf = 0;
action = sub_0806ED9C(this, 40, 40);
action = GetAnimationStateInRectRadius(this, 40, 40);
if (action >= 0) {
this->animationState = action;
}
+1 -1
View File
@@ -38,7 +38,7 @@ void sub_080695AC(Entity* this) {
if (++this->field_0xf > 0x10) {
this->field_0xf = 0;
iVar2 = sub_0806ED9C(this, 0x28, 0x28);
iVar2 = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (iVar2 > -1) {
this->animationState = iVar2;
}
+1 -1
View File
@@ -33,7 +33,7 @@ void sub_08066654(Entity* this) {
}
void sub_08066688(Entity* this) {
s32 tmp = sub_0806ED9C(this, 0x28, 0x28);
s32 tmp = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (tmp < 0) {
tmp = 2;
} else {
+2 -2
View File
@@ -30,7 +30,7 @@ void sub_08068708(Entity* this) {
void sub_08068730(Entity* this) {
s32 animIndex;
animIndex = sub_0806ED9C(this, 0x20, 0x20);
animIndex = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (-1 < animIndex) {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
@@ -123,7 +123,7 @@ void sub_08068910(Entity* this) {
} else {
this->actionDelay = 0x10;
if ((this->frame & 0x20) != 0) {
iVar1 = sub_0806EDD8(this, 0x30, 0x30);
iVar1 = GetFacingDirectionInRectRadius(this, 0x30, 0x30);
if (iVar1 < 0) {
iVar1 = 0x10;
} else {
+1 -1
View File
@@ -26,7 +26,7 @@ void sub_080667E4(Entity* this) {
}
void sub_08066808(Entity* this) {
s32 tmp = sub_0806ED9C(this, 0x28, 0x28);
s32 tmp = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (tmp < 0) {
tmp = 2;
} else {
+2 -2
View File
@@ -65,7 +65,7 @@ void sub_08067E60(Entity* this) {
void sub_08067E88(Entity* this) {
s32 tmp;
tmp = sub_0806ED9C(this, 0x28, 0x28);
tmp = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (tmp < 0) {
tmp = 2;
} else {
@@ -195,7 +195,7 @@ void sub_0806811C(Entity* this) {
this->actionDelay--;
} else {
this->actionDelay = 2;
iVar4 = sub_0806EDD8(this, 0x20, 0x20);
iVar4 = GetFacingDirectionInRectRadius(this, 0x20, 0x20);
if (iVar4 < 0) {
type = this->type;
this->animationState = type;
+1 -1
View File
@@ -25,7 +25,7 @@ static void sub_080669DC(Entity* this) {
s32 sVar1;
s32 sVar2;
sVar1 = sub_0806ED9C(this, 0x28, 0x28);
sVar1 = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (sVar1 < 0) {
sVar1 = 2;
} else {
+1 -1
View File
@@ -38,7 +38,7 @@ void sub_08063A98(Entity* this) {
}
void sub_08063AC0(Entity* this) {
if (sub_0806ED9C(this, 0x20, 0x20) >= 0) {
if (GetAnimationStateInRectRadius(this, 0x20, 0x20) >= 0) {
if (this->field_0xf == 0) {
if ((Random() & 0x3f) == 0) {
InitAnimationForceUpdate(this, 0);
+1 -1
View File
@@ -62,7 +62,7 @@ void sub_0806045C(Entity* this) {
this->animationState = bVar1;
InitAnimationForceUpdate(this, 4 + bVar1);
}
temp = sub_0806ED9C(this, 0x18, 0x18);
temp = GetAnimationStateInRectRadius(this, 0x18, 0x18);
if ((temp > -1) && (temp == this->animationState)) {
bVar3 = 1;
} else {
+1 -1
View File
@@ -64,7 +64,7 @@ void sub_080660EC(Entity* this) {
void sub_08066118(Entity* this) {
s32 uVar1;
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
uVar1 = GetAnimationStateInRectRadius(this, 0x28, 0x28);
if (uVar1 < 0) {
uVar1 = 2;
} else {
+1 -1
View File
@@ -35,7 +35,7 @@ void sub_0806559C(Entity* this) {
this->actionDelay++;
if (this->actionDelay >= 9) {
this->actionDelay = 0;
result = sub_0806ED9C(this, 0x20, 0x20);
result = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (result < 0) {
offset = this->animationState + 4;
} else {
+1 -1
View File
@@ -188,7 +188,7 @@ void sub_0806AEE4(Entity* this) {
this->actionDelay--;
} else {
this->actionDelay = 2;
index = sub_0806EDD8(this, 0x20, 0x20);
index = GetFacingDirectionInRectRadius(this, 0x20, 0x20);
if (index < 0) {
int state = this->field_0x6a.HALF.LO;
this->animationState = state * 2;
+1 -1
View File
@@ -45,7 +45,7 @@ void sub_08061BC8(Entity* this) {
void sub_08061C00(Entity* this) {
s32 uVar1;
uVar1 = sub_0806ED9C(this, 0x20, 0x20);
uVar1 = GetAnimationStateInRectRadius(this, 0x20, 0x20);
if (uVar1 < 0) {
uVar1 = this->animationState + 4;
} else {
+5 -5
View File
@@ -107,7 +107,7 @@ u32 sub_0806ED78(Entity* ent) {
return result;
}
s32 sub_0806ED9C(Entity* ent, u32 x, u32 y) {
s32 GetAnimationStateInRectRadius(Entity* ent, u32 x, u32 y) {
s32 anim = -1;
if (EntityInRectRadius(ent, &gPlayerEntity, x, y))
anim = GetAnimationState(ent);
@@ -119,11 +119,11 @@ u32 GetAnimationState(Entity* ent) {
return sub_0806F5A4(direction);
}
s32 sub_0806EDD8(Entity* ent, u32 x, u32 y) {
s32 anim = -1;
s32 GetFacingDirectionInRectRadius(Entity* ent, u32 x, u32 y) {
s32 dir = -1;
if (EntityInRectRadius(ent, &gPlayerEntity, x, y))
anim = GetFacingDirection(ent, &gPlayerEntity);
return anim;
dir = GetFacingDirection(ent, &gPlayerEntity);
return dir;
}
void sub_0806EE04(Entity* ent, void* a2, u32 a3) {
+1 -1
View File
@@ -164,7 +164,7 @@ void sub_0808692C(Entity* this) {
static u8 sub_08086954(Entity* this) {
if (sub_0800445C(this)) {
if (sub_0806ED9C(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
if (GetAnimationStateInRectRadius(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
(u16)gPlayerState.field_0x90 == 0x400 && gPlayerState.jump_status == 0) {
this->actionDelay--;
}
+105
View File
@@ -0,0 +1,105 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "flags.h"
#include "sound.h"
#include "functions.h"
#include "npc.h"
typedef struct {
Entity base;
u8 filler[0x15];
u8 unk7d;
u8 filler2[0x8];
u16 doorFlags;
} HouseDoorInteriorEntity;
void HouseDoorInterior_Init(HouseDoorInteriorEntity*);
void HouseDoorInterior_Action1(HouseDoorInteriorEntity*);
void HouseDoorInterior_Delete(HouseDoorInteriorEntity*);
typedef struct {
u8 frameIndex;
u8 type2;
} PACKED HouseDoorInteriorFrameIndices_struct;
static const HouseDoorInteriorFrameIndices_struct HouseDoorInteriorFrameIndices[] = {
{ -1, 0 }, { -1, 0 }, { 0, 0 }, { 0, 3 }, { 2, 2 }, { 2, 2 },
};
void HouseDoorInterior(Entity* this) {
static void (*const actionFuncs[])(HouseDoorInteriorEntity*) = {
HouseDoorInterior_Init,
HouseDoorInterior_Action1,
HouseDoorInterior_Delete,
};
actionFuncs[this->action]((HouseDoorInteriorEntity*)this);
}
typedef struct {
u16 animationState;
u16 unk2;
u16 x;
u16 y;
} gUnk_081227CC_struct;
static const gUnk_081227CC_struct gUnk_081227CC[] = {
{ 0x0, 0x400, 0x6, 0x10 },
{ 0x2, 0x100, 0x10, 0x6 },
{ 0x4, 0x800, 0x6, 0x10 },
{ 0x6, 0x200, 0x10, 0x6 },
};
void HouseDoorInterior_Init(HouseDoorInteriorEntity* this) {
static const Hitbox HouseDoorInteriorHitbox = {
0, 0, { 5, 3, 3, 5 }, 6, 6,
};
const HouseDoorInteriorFrameIndices_struct* ptr;
if (this->doorFlags && CheckFlags(this->doorFlags)) {
DeleteThisEntity();
}
super->action = 1;
super->spriteSettings.draw = 1;
this->unk7d = super->actionDelay;
super->spritePriority.b0 = 7;
super->hitbox = (Hitbox*)&HouseDoorInteriorHitbox;
super->actionDelay = 8;
ptr = HouseDoorInteriorFrameIndices + super->type;
if (ptr->frameIndex == 0xff) {
super->frameIndex = super->type2;
} else {
super->frameIndex = ptr->frameIndex;
super->type2 = ptr->type2;
}
}
void HouseDoorInterior_Action1(HouseDoorInteriorEntity* this) {
const gUnk_081227CC_struct* ptr;
if (this->doorFlags && CheckFlags(this->doorFlags)) {
super->action = 2;
SoundReq(SFX_111);
return;
}
if (sub_0800445C(super) && this->unk7d == 0) {
ptr = gUnk_081227CC + super->type2;
if (GetAnimationStateInRectRadius(super, ptr->x, ptr->y) >= 0 &&
ptr->animationState == gPlayerEntity.animationState && gPlayerState.field_0x90 & ptr->unk2) {
--super->actionDelay;
}
} else {
super->actionDelay = 8;
}
if (super->actionDelay == 0) {
super->action = 2;
sub_08078AC0(8, 0, 0);
SoundReq(SFX_111);
}
}
void HouseDoorInterior_Delete(HouseDoorInteriorEntity* this) {
DeleteThisEntity();
}