commented offsets in entity, linkState

This commit is contained in:
theo3
2020-07-09 01:39:40 -07:00
parent bde7b45adb
commit 03a8e052af
105 changed files with 630 additions and 887 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ void FUN_08068b2c(Entity* this) {
if (this->interactType == '\x02') {
this->action = 2;
this->interactType = '\0';
uVar1 = sub_0806F5A4(sub_080045C4(this, &gLinkEntity));
uVar1 = sub_0806F5A4(GetFacingDirection(this, &gLinkEntity));
InitAnimationForceUpdate(this, uVar1);
sub_0806F118(this);
} else {
+74
View File
@@ -0,0 +1,74 @@
#include "global.h"
#include "entity.h"
#include "sprite.h"
#include "link.h"
extern void DeleteThisEntity();
extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
extern SpriteLoadData gUnk_08110CA8[];
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD64(Entity*);
extern u32 GetFacingDirection(Entity*, Entity*);
extern void sub_0806F118(Entity*);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern u32 UpdateFuseInteraction(Entity*);
extern void SetSpriteSubEntryOffsetData2(Entity*, u32, u32);
extern void sub_0807000C(Entity*);
extern u32 sub_0806F5A4();
void Carpenter(Entity* this) {
if (*(u32*)&this->cutsceneBeh == 0) {
DeleteThisEntity();
}
switch (this->action) {
case 0:
if (!LoadExtraSpriteData(this, gUnk_08110CA8 + this->entityType.form * 4))
break;
this->action = 1;
this->field_0x69 = 0;
sub_0805E3A0(this, 2);
sub_0807DD64(this);
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x69 = this->animIndex;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + 4 + (this->entityType.form * 8));
sub_0806F118(this);
} else {
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
GetNextFrame(this);
}
break;
case 2:
if (!UpdateFuseInteraction(this))
break;
this->action = 1;
InitializeAnimation(this, this->field_0x69);
break;
}
}
void Carpenter_Head(Entity* this) {
if ((this->entityType).form < 2) {
SetExtraSpriteFrame(this, 0, this->frames.all & 0xffffff7f);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetExtraSpriteFrame(this, 2, this->frameSpriteSettings & 0x3f);
SetSpriteSubEntryOffsetData1(this, 1, 0);
SetSpriteSubEntryOffsetData2(this, 1, 2);
sub_0807000C(this);
} else {
SetExtraSpriteFrame(this, 0, this->frames.all & 0xffffff7f);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
}
void sub_080672b0(Entity *this, u32 param_2)
{
InitializeAnimation(this,*(u32 *)(param_2 + 4) + (this->animationState >> 1) + this->entityType.form * 8);
}
+29
View File
@@ -0,0 +1,29 @@
#include "global.h"
#include "entity.h"
extern u32 SetTileType(u32 tileID, u32 tilePos, u32 layerID);
void CreateMinishEntrance(u32 tilePos)
{
u32 x, y;
u32 tileID = 0x185;
for (y = 0; y <= 3; y++) {
for (x = 0; x <= 4; x++) {
SetTileType(tileID++, tilePos + x, 1);
}
tilePos += 0x40;
}
}
void sub_08018C58(u32 tilePos)
{
u32 i = 0;
for (;i < 6;) {
SetTileType(0x260 + i, tilePos, 1);
SetTileType(0x261 + i, tilePos + 1, 1);
i += 2;
tilePos += 0x40;
}
}
+2 -2
View File
@@ -9,7 +9,7 @@
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern void sub_080045C4(Entity*, Entity*);
extern void GetFacingDirection(Entity*, Entity*);
extern u32 sub_0806F5A4(void);
extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32);
@@ -37,7 +37,7 @@ void Dampe(Entity* this) {
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
sub_080045C4(this, &gLinkEntity);
GetFacingDirection(this, &gLinkEntity);
InitAnimationForceUpdate(this, sub_0806F5A4() + 4);
sub_0806F118(this);
} else {
+1 -1
View File
@@ -78,7 +78,7 @@ void sub_08065AA4(Entity* this) {
sub_0805E3A0(this, 2);
sub_08065A50(this);
}
InitAnimationForceUpdate(this, sub_0806F5A4(sub_080045C4(this, &gLinkEntity)));
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
} else {
sub_08065A50(this);
sub_080791D0();
+99
View File
@@ -0,0 +1,99 @@
#include "global.h"
#include "entity.h"
#include "link.h"
extern void DeleteThisEntity();
extern void sub_08078CD0(Entity*);
extern void sub_08018FA0(Entity*);
extern void sub_0801766C(Entity*);
extern void sub_08018F6C(Entity*);
extern void (*const gUnk_080B3DD0[])(Entity*);
extern BoundingBox gUnk_080B3E18;
extern u8 gUnk_080B3DE0[];
extern BoundingBox* gUnk_080B3DE8[];
void Item11(Entity *this)
{
if (this->currentHealth) {
this->hurtBlinkTime = 0;
gUnk_080B3DD0[this->action](this);
}
else {
DeleteThisEntity();
}
}
void sub_08018CBC(Entity *this)
{
u32 PVar1;
u8 uVar2;
Entity *pEVar3;
*(u32 *)&this->cutsceneBeh = this->x.WORD = gLinkEntity.x.WORD;
*(u32 *)&this->field_0x80 = this->y.WORD = gLinkEntity.y.WORD;
uVar2 = this->animationState = gLinkEntity.animationState & 0xe;
this->direction = (u8)(uVar2 << 2);
this->nonPlanarMovement = 0x400;
this->damageType = 0x96;
this->field_0x3c = (gLinkEntity.field_0x3c + 1) | 0x80;
this->flags2 = gLinkEntity.flags2;
pEVar3 = this->attachedEntity;
if (pEVar3 != NULL) {
this->action = 1;
this->flags = this->flags & 0x7f;
this->actionDelay = 0x56;
this->field_0x40 = 0x1c;
this->field_0x44 = 6;
this->boundingBox = &gUnk_080B3E18;
this->attachedEntity->spriteOffsetX = 0;
this->attachedEntity->spriteSettings.b.ss0 = 0;
}
else {
if (gLinkState.field_0x1c == 0) {
DeleteThisEntity();
}
this->action = 2;
this->spriteSettings.b.ss0 = 1;
this->spriteTileSize = 0xa6;
this->palette = 0x33;
this->spriteVramOffset = 0;
(this->entityType).form = gLinkState.filler9[0] - 1;
this->actionDelay = gUnk_080B3DE0[(this->entityType).form * 2];
this->field_0x44 = gUnk_080B3DE0[(this->entityType).form * 2 + 1];
this->field_0x40 = 0x1b;
this->boundingBox = gUnk_080B3DE8[(this->entityType).form];
(u32 *)gLinkEntity.field_0x70 = this;
sub_08078CD0(&gLinkEntity);
(u32 *)gLinkEntity.field_0x70 = pEVar3;
InitializeAnimation(this, (this->entityType).form + 10);
sub_08018FA0(this);
}
sub_0801766C(this);
}
void sub_08018DE8(Entity *this)
{
u8 bVar1;
bVar1 = this->attachedEntity->field_0x3a & 4;
if (bVar1 == 0) {
gLinkState.field_0x1c = bVar1;
DeleteThisEntity();
}
switch (gLinkState.field_0x1c) {
case 0:
sub_08018F6C(this);
break;
case 5:
this->attachedEntity->previousActionFlag = 4;
this->flags = this->flags | 0x80;
this->action = 2;
this->ticks.b0 = 2;
this->attachedEntity->spriteSettings.b.ss0 = 1;
sub_08018FA0(this);
break;
}
sub_08078CD0(&gLinkEntity);
}
+3 -3
View File
@@ -53,7 +53,7 @@ extern u32 sub_0806FCB8(Entity *, u32, u32, u32);
extern u32 sub_080041A0(Entity *, Entity *, u32, u32);
// sub_0803CA84
extern u32 sub_080045C4(Entity *, Entity *);
extern u32 GetFacingDirection(Entity *, Entity *);
// sub_0803CAD0
extern u8 sub_080045D4(s16, s16, u16, u16);
@@ -288,7 +288,7 @@ bool32 sub_0803CA4C(Entity *this) {
}
void sub_0803CA84(Entity *this, u32 unkParameter) {
u32 altAnimState = sub_080045C4(this, &gLinkEntity);
u32 altAnimState = GetFacingDirection(this, &gLinkEntity);
if (((altAnimState - 3) & 7) > 2 || ((this->animationState - (altAnimState >> 3)) & 3) > 1) {
u32 intermediate = (altAnimState + 4) & 0x18;
@@ -334,7 +334,7 @@ void sub_0803CB34(Entity *this) {
this->action = 5;
this->damageType = 0xa6;
this->field_0x78.HALF.LO = sub_080045C4(this, &gLinkEntity);
this->field_0x78.HALF.LO = GetFacingDirection(this, &gLinkEntity);
InitAnimationForceUpdate(this, this->animationState + 8);
}
+1 -1
View File
@@ -41,7 +41,7 @@ void sub_080658BC(Entity* this) {
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(sub_080045C4(this, &gLinkEntity)));
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
+1 -1
View File
@@ -126,7 +126,7 @@ void sub_080656D4(Entity* this) {
void sub_0806574C(Entity* this) {
u32 j;
j = (this->animIndex & ~3) + sub_0806F5A4(sub_080045C4(this, &gLinkEntity));
j = (this->animIndex & ~3) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity));
if (this->animIndex != j) {
InitAnimationForceUpdate(this, j);
}
+1 -1
View File
@@ -52,7 +52,7 @@ void sub_0806ABFC(Entity *this)
Entity *link = &gLinkEntity;
if (sub_080041A0(this, link, 0x18, 0x18)) {
unk = sub_080045C4(this, link) & (u8)0x1e;
unk = GetFacingDirection(this, link) & (u8)0x1e;
}
else {
unk = this->animationState << 2;