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 #define ENTITY_H
#include "global.h" #include "global.h"
#include "sprite.h"
typedef struct { typedef struct {
void* entity1; void* entity1;
@ -73,8 +74,8 @@ typedef struct Entity {
u8 b2 : 3; u8 b2 : 3;
} PACKED spriteOrientation; } PACKED spriteOrientation;
u8 filler[2]; u8 filler[2];
u8 animationList; u8 frameIndex;
u8 field_1f; u8 lastFrameIndex;
s32 field_0x20; s32 field_0x20;
s16 nonPlanarMovement; s16 nonPlanarMovement;
u8 spriteAnimation[3]; u8 spriteAnimation[3];
@ -109,8 +110,8 @@ typedef struct Entity {
u8 field_0x4f; u8 field_0x4f;
struct Entity* parent; struct Entity* parent;
struct Entity* attachedEntity; struct Entity* attachedEntity;
u8 field_0x58; u8 animIndex;
u8 animTime; u8 frameDuration;
union { union {
u8 all; u8 all;
struct { struct {
@ -120,11 +121,8 @@ typedef struct Entity {
u8 f3 : 1; u8 f3 : 1;
} PACKED b; } PACKED b;
} PACKED frames; } PACKED frames;
u8 gfx; u8 frameSpriteSettings;
u8 field_0x5c; Frame* animPtr;
u8 field_0x5d;
u8 field_0x5e;
u8 field_0x5f;
u16 spriteVramOffset; u16 spriteVramOffset;
u8 spriteOffsetX; u8 spriteOffsetX;
u8 spriteOffsetY; 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; this->field_0xf = 0x10;
} else { } else {
this->field_0xf--; this->field_0xf--;
uVar1 = (u32)this->field_0x58; uVar1 = (u32)this->animIndex;
} }
} }
iVar2 = sub_0806F078(this, uVar1); iVar2 = sub_0806F078(this, uVar1);

View File

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

View File

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

View File

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

View File

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

View File

@ -47,10 +47,10 @@ void sub_0806559C(Entity* this) {
offset = result; offset = result;
} }
} else { } else {
offset = this->field_0x58; offset = this->animIndex;
} }
if (this->field_0x58 != offset) { if (this->animIndex != offset) {
InitializeAnimation(this, offset); InitializeAnimation(this, offset);
} else { } else {
GetNextFrame(this); GetNextFrame(this);
@ -128,11 +128,11 @@ void sub_080656D4(Entity* this) {
void sub_0806574C(Entity* this) { void sub_0806574C(Entity* this) {
u32 j; u32 j;
j = (this->field_0x58 & ~3) + sub_0806F5A4(sub_080045C4(this, &gLinkEntity)); j = (this->animIndex & ~3) + sub_0806F5A4(sub_080045C4(this, &gLinkEntity));
if (this->field_0x58 != j) { if (this->animIndex != j) {
InitAnimationForceUpdate(this, 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) { 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) { void Talon_Head(Entity* this) {
sub_0806FF60(this, 0, ((this->frames.all & 7) + 0xB)); 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_0806FF88(this, 1, 0);
sub_0807000C(this); sub_0807000C(this);
} }

View File

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

View File

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

View File

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