mirror of
https://github.com/zeldaret/tmc
synced 2026-07-28 07:09:19 -04:00
Merge pull request #432 from hatal175/housedoorinterior
This commit is contained in:
@@ -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--;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user