entity.h UPDATE

This commit is contained in:
theo3 2020-06-18 15:48:30 -07:00
parent f8ae0eaef7
commit b093824bde
11 changed files with 54 additions and 30 deletions

View File

@ -2,6 +2,7 @@
#define ENTITY_H
#include "global.h"
#include "sprite.h"
typedef struct {
void* entity1;
@ -73,8 +74,8 @@ typedef struct Entity {
u8 b2 : 3;
} PACKED spriteOrientation;
u8 filler[2];
u8 animationList;
u8 field_1f;
u8 frameIndex;
u8 lastFrameIndex;
s32 field_0x20;
s16 nonPlanarMovement;
u8 spriteAnimation[3];
@ -109,8 +110,8 @@ typedef struct Entity {
u8 field_0x4f;
struct Entity* parent;
struct Entity* attachedEntity;
u8 field_0x58;
u8 animTime;
u8 animIndex;
u8 frameDuration;
union {
u8 all;
struct {
@ -120,11 +121,8 @@ typedef struct Entity {
u8 f3 : 1;
} PACKED b;
} PACKED frames;
u8 gfx;
u8 field_0x5c;
u8 field_0x5d;
u8 field_0x5e;
u8 field_0x5f;
u8 frameSpriteSettings;
Frame* animPtr;
u16 spriteVramOffset;
u8 spriteOffsetX;
u8 spriteOffsetY;

View File

@ -0,0 +1,26 @@
#ifndef SPRITE_H
#define SPRITE_H
#include "global.h"
typedef struct {
u8 index;
u8 duration;
union {
u8 raw;
struct {
u8 unk : 6;
u8 hFlip : 1;
u8 vFlip : 1;
} PACKED b;
} PACKED spriteSettings;
union {
u8 raw;
struct {
u8 extraFrameIndex : 6;
u8 unk : 1;
u8 endOfAnimation : 1;
} PACKED b;
} PACKED frameSettings;
} Frame;
#endif

View File

@ -86,7 +86,7 @@ void sub_08068A4C(Entity* this) {
this->field_0xf = 0x10;
} else {
this->field_0xf--;
uVar1 = (u32)this->field_0x58;
uVar1 = (u32)this->animIndex;
}
}
iVar2 = sub_0806F078(this, uVar1);

View File

@ -15,7 +15,7 @@ void GiantLeaf(Entity* ent) {
ent->spriteSettings.b.ss0 = 1;
ent->spriteOrder.b3 = 3;
ent->ticks.b0 = 7;
ent->animationList = ent->entityType.form;
ent->frameIndex = ent->entityType.form;
sub_0808D618(ent);
}
}

View File

@ -32,7 +32,7 @@ void sub_08069328(Entity* this) {
this->animationState = action;
}
}
if (this->field_0x58 != this->animationState) {
if (this->animIndex != this->animationState) {
InitAnimationForceUpdate(this, this->animationState);
}
if (this->interactType != 0) {
@ -62,7 +62,7 @@ void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65);
void sub_080693D0(Entity* this) {
sub_0807DD94(this, 0);
if (this->field_0x58 == 8) {
if (this->animIndex == 8) {
u32 var0 = this->field_0x82 & 0xF;
bool32 createFx65 = ((-var0) | var0) >> 0x1F; // = !var0

View File

@ -33,7 +33,7 @@ void sub_08063220(Entity* this) {
bVar1 = 0;
}
if (this->field_0x58 != bVar1) {
if (this->animIndex != bVar1) {
InitAnimationForceUpdate(this);
} else {
sub_08063280(this, bVar1);

View File

@ -28,7 +28,7 @@ void sub_0806a370(Entity* this) {
sub_0807DDE4(this);
UpdateAnimationSingleFrame(this);
sub_0806ED78(this);
if (this->field_0x58 == 0xf) {
if (this->animIndex == 0xf) {
pbVar1 = &this->frames.all;
if (*pbVar1 == 1) {
*pbVar1 = 0;

View File

@ -47,10 +47,10 @@ void sub_0806559C(Entity* this) {
offset = result;
}
} else {
offset = this->field_0x58;
offset = this->animIndex;
}
if (this->field_0x58 != offset) {
if (this->animIndex != offset) {
InitializeAnimation(this, offset);
} else {
GetNextFrame(this);
@ -128,11 +128,11 @@ void sub_080656D4(Entity* this) {
void sub_0806574C(Entity* this) {
u32 j;
j = (this->field_0x58 & ~3) + sub_0806F5A4(sub_080045C4(this, &gLinkEntity));
if (this->field_0x58 != j) {
j = (this->animIndex & ~3) + sub_0806F5A4(sub_080045C4(this, &gLinkEntity));
if (this->animIndex != j) {
InitAnimationForceUpdate(this, j);
}
this->field_0x6a.HALF.LO = this->field_0x58;
this->field_0x6a.HALF.LO = this->animIndex;
}
void sub_08065780(Entity* this, u16* param_2) {
@ -145,7 +145,7 @@ void sub_08065780(Entity* this, u16* param_2) {
void Talon_Head(Entity* this) {
sub_0806FF60(this, 0, ((this->frames.all & 7) + 0xB));
sub_0806FF60(this, 1, this->animationList);
sub_0806FF60(this, 1, this->frameIndex);
sub_0806FF88(this, 1, 0);
sub_0807000C(this);
}

View File

@ -19,7 +19,7 @@ void WindTribeFlag(Entity *this)
else {
GetNextFrame(this);
}
if (this->animTime == 0xff) {
this->animTime = (Random() & 0xf) + 0x10;
if (this->frameDuration == 0xff) {
this->frameDuration = (Random() & 0xf) + 0x10;
}
}

View File

@ -21,7 +21,7 @@ void Windcrest(Entity *this)
{
if (this->action == 0) {
this->action++;
this->animationList = 0;
this->frameIndex = 0;
sub_0807DD64(this);
}
sub_0807DDAC(this, 0);

View File

@ -112,27 +112,27 @@ void sub_08066DE4(Entity* ent) {
void sub_08066E08(Entity* ent) {
InitAnimationForceUpdate(ent, 0x50);
ent->field_0x80 = ent->field_0x58;
ent->field_0x80 = ent->animIndex;
}
void sub_08066E20(Entity* ent) {
InitAnimationForceUpdate(ent, 0x44);
ent->field_0x80 = ent->field_0x58;
ent->field_0x80 = ent->animIndex;
}
void sub_08066E38(Entity* ent) {
InitAnimationForceUpdate(ent, 0x48);
ent->field_0x80 = ent->field_0x58;
ent->field_0x80 = ent->animIndex;
}
void sub_08066E50(Entity* ent) {
InitAnimationForceUpdate(ent, 0x4C);
ent->field_0x80 = ent->field_0x58;
ent->field_0x80 = ent->animIndex;
}
void sub_08066E68(Entity* ent) {
InitAnimationForceUpdate(ent, 0x54);
ent->field_0x80 = ent->field_0x58;
ent->field_0x80 = ent->animIndex;
}
void sub_08066E80(Entity* ent, u8* param_2) {
@ -175,7 +175,7 @@ void sub_08066E80(Entity* ent, u8* param_2) {
return;
}
}
ent->field_0x80 = ent->field_0x58;
ent->field_0x80 = ent->animIndex;
gUnk_02033280[6] = 0;
}