entity.h bitfields

This commit is contained in:
theo3 2020-07-09 02:40:55 -07:00
parent 03a8e052af
commit cd25d3c120
29 changed files with 80 additions and 80 deletions

View File

@ -58,26 +58,26 @@ typedef struct Entity {
/*0x18*/ union {
/* */ u8 raw;
/* */ struct {
/* */ u8 ss0 : 2;
/* */ u8 ss2 : 1;
/* */ u8 ss3 : 1;
/* */ u8 ss4 : 1;
/* */ u8 ss5 : 1;
/* */ u8 ss6 : 1;
/* */ u8 ss7 : 1;
/* */ u8 draw : 2; // 1-2
/* */ u8 ss2 : 1; // 4
/* */ u8 ss3 : 1; // 8
/* */ u8 bigShadow : 1; //0x10
/* */ u8 giantShadow : 1; //0x20
/* */ u8 flipX : 1; //0x40
/* */ u8 flipY : 1; //0x80
/* */ } PACKED b;
/* */ } PACKED spriteSettings;
/*0x19*/ struct {
/* */ u8 b0 : 2;
/* */ u8 b1 : 2;
/* */ u8 b2 : 2;
/* */ u8 b3 : 2;
/* */ u8 b0 : 2; // 1-2
/* */ u8 alphaBlend : 2; // 4-8
/* */ u8 b2 : 2; //0x10
/* */ u8 b3 : 2; //0x40
/* */ } PACKED spriteOrder;
/*0x1a*/ u8 palette;
/*0x1b*/ struct {
/* */ u8 b0 : 4;
/* */ u8 b1 : 2;
/* */ u8 b2 : 2;
/* */ u8 b0 : 4;
/* */ u8 flipX : 2; //0x10
/* */ u8 flipY : 2; //0x40
/* */ } PACKED spriteOrientation;
/*0x1c*/ u8 filler[1];
/*0x1d*/ u8 field_0x1d;
@ -87,9 +87,9 @@ typedef struct Entity {
/*0x24*/ s16 nonPlanarMovement;
/*0x26*/ u8 spriteAnimation[3];
/*0x29*/ struct {
/* */ u8 b0 : 3;
/* */ u8 b1 : 3;
/* */ u8 b2 : 2;
/* */ u8 b0 : 3; // 1-4
/* */ u8 b1 : 3; // 8
/* */ u8 b2 : 2; //0x40
/* */ } PACKED ticks;
/*0x2a*/ u16 collisions;
/*0x2c*/ union SplitWord x;
@ -124,8 +124,8 @@ typedef struct Entity {
/* */ struct {
/* */ u8 f0 : 1;
/* */ u8 f1 : 5;
/* */ u8 f2 : 1;
/* */ u8 f3 : 1;
/* */ u8 f2 : 1; //0x40
/* */ u8 f3 : 1; //0x80
/* */ } PACKED b;
/* */ } PACKED frames;
/*0x5b*/ u8 frameSpriteSettings;

View File

@ -9,7 +9,7 @@ void Bell(Entity* ent) {
void sub_08097D90(Entity* ent) {
ent->action = 1;
ent->spriteSettings.b.ss0 = 1;
ent->spriteSettings.b.draw = 1;
ent->collisionLayer = 1;
ent->ticks.b0 = 0;
UpdateSpriteOrderAndFlip(ent);

View File

@ -122,7 +122,7 @@ void sub_08068ADC(Entity* this) {
void sub_08068AFC(Entity* this) {
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
*(u8*)&this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, *(u8*)&this->field_0x68);
sub_0807DD50(this);
@ -400,8 +400,8 @@ void BladeBrothers_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.ss0 = 0;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 0;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 4);
} else {
UpdateAnimationSingleFrame(this);

View File

@ -28,8 +28,8 @@ void sub_08083E08(Entity *this)
void sub_08083E20(Entity *this)
{
this->action = 3;
this->spriteSettings.b.ss0 = 1;
this->spriteOrder.b1 = 0;
this->spriteSettings.b.draw = 1;
this->spriteOrder.alphaBlend = 0;
sub_080842D8(this);
sub_08078828(this);
}

View File

@ -46,7 +46,7 @@ void sub_0809F4DC(Entity* this) {
void sub_0809F514(Entity* this) {
this->action = 1;
this->actionDelay = 120;
this->spriteSettings.b.ss0 = 0;
this->spriteSettings.b.draw = 0;
*(u8*)&this->field_0x68 = 12;
gRoomControls.cameraTarget = this;
gUnk_02034490 = 255;
@ -80,7 +80,7 @@ void sub_0809F5B0(Entity* this) {
void sub_0809F5DC(Entity* this) {
this->action = 1;
this->spriteSettings.b.ss0 = 0;
this->spriteSettings.b.draw = 0;
*(u8*)&this->field_0x68 = 12;
}

View File

@ -229,7 +229,7 @@ void sub_0806924C(Entity* ent) {
void Cow_Fusion(Entity* ent) {
if (ent->action == 0) {
ent->action++;
ent->spriteSettings.b.ss0 = 1;
ent->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(ent, 15);
} else {
UpdateAnimationSingleFrame(ent);

View File

@ -29,7 +29,7 @@ void Dampe(Entity* this) {
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
return;
@ -61,7 +61,7 @@ void sub_0806BE3C(Entity* this) {
void Dampe_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 2);
} else {
UpdateAnimationSingleFrame(this);

View File

@ -18,7 +18,7 @@ void Epona(Entity* this) {
void sub_080659B8(Entity* this) {
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->animationState = 6;
this->field_0x69 = -1;
this->field_0x68 = sub_0801E99C(this);
@ -91,7 +91,7 @@ void sub_08065AA4(Entity* this) {
void Epona_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 7);
} else {
UpdateAnimationSingleFrame(this);

View File

@ -12,7 +12,7 @@ extern s16 gUnk_0812176A[];
void GiantLeaf(Entity* ent) {
if (ent->action == 0) {
ent->action = 1;
ent->spriteSettings.b.ss0 = 1;
ent->spriteSettings.b.draw = 1;
ent->spriteOrder.b3 = 3;
ent->ticks.b0 = 7;
ent->frameIndex = ent->entityType.form;

View File

@ -127,7 +127,7 @@ void sub_080694EC(Entity* this) {
void Goron_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 2);
} else {
UpdateAnimationSingleFrame(this);

View File

@ -161,8 +161,8 @@ void GreatFairy_WingsCallBehavior(Entity* this) {
void GreatFairy_WingsInit(Entity* this) {
GreatFairy_InitializeAnimation(this);
this->ticks.b0 = 5;
this->spriteSettings.b.ss0 = 1;
this->spriteOrder.b1 = 1;
this->spriteSettings.b.draw = 1;
this->spriteOrder.alphaBlend = 1;
gScreen.controls.windowOutsideControl = 3904;
gScreen.controls.mosaicSize = 2057;
this->nonPlanarMovement = 1024;
@ -192,7 +192,7 @@ void GreatFairy_WakeCallBehavior(Entity* this) {
void GreatFairy_WakeInit(Entity* this) {
GreatFairy_InitializeAnimation(this);
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->ticks.b0 = 6;
}
@ -213,7 +213,7 @@ void GreatFairy_MiniInit(Entity* this) {
CopyPosition(this, aff);
aff->parent = this;
GreatFairy_InitializeAnimation(this);
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->field_0xf = 0;
}
}
@ -253,7 +253,7 @@ void GreatFairy_MiniAffineCallBehavior(Entity* this) {
void GreatFairy_MiniAffineInit(Entity* this) {
GreatFairy_InitializeAnimation(this);
this->ticks.b0 = 6;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
}
// Getting ready for affine transformation
@ -293,7 +293,7 @@ void GreatFairy_DropletCallBehavior(Entity* this) {
void GreatFairy_DropletInit(Entity* this) {
GreatFairy_InitializeAnimation(this);
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->height.HALF.HI = 0;
this->ticks.b0 = 5;
PlaySFX(320);
@ -313,7 +313,7 @@ void GreatFairy_RippleCallBehavior(Entity* this) {
void GreatFairy_RippleInit(Entity* this) {
GreatFairy_InitializeAnimation(this);
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->ticks.b0 = 6;
}
@ -333,7 +333,7 @@ void GreatFairy_BigRippleCallBehavior(Entity* this) {
void GreatFairy_BigRippleInit(Entity* this) {
GreatFairy_InitializeAnimation(this);
this->actionDelay = 120;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->ticks.b0 = 5;
PlaySFX(249);
}
@ -361,7 +361,7 @@ void GreatFairy_EnergyCallBehavior(Entity* this) {
void GreatFairy_EnergyInit(Entity* this) {
GreatFairy_InitializeAnimation(this);
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->ticks.b0 = 5;
}
@ -387,7 +387,7 @@ void sub_08087150(Entity* this) {
u32 var2;
GreatFairy_InitializeAnimation(this);
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->spriteOrientation &= 63;
this->spriteOrder.b0 = 0;
this->ticks.b0 = 3;
@ -472,8 +472,8 @@ void sub_08087294(Entity* this) {
#ifdef NON_MATCHING
void sub_080872AC(Entity* this) {
this->spriteSettings.b.ss0 = 1;
this->spriteOrientation.b2 = 1;
this->spriteSettings.b.draw = 1;
this->spriteOrientation.flipY = 1;
this->spriteOrder.b0 = 0;
this->field_0x68 = (u16)(this->x).HALF.HI;
this->field_0x6a = (u16)(this->y).HALF.HI;

View File

@ -30,7 +30,7 @@ void nullsub_7(Entity* this){}
void sub_08021720(Entity *this)
{
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->frameIndex = (this->entityType).form;
this->spriteOrder.b3 = 1;
this->ticks.b0 = 3;

View File

@ -20,7 +20,7 @@ void sub_0808E6A0(Entity* this) {
}
this->action = 1;
this->entityType.form = 0x62;
this->spriteSettings.b.ss0 = 0;
this->spriteSettings.b.draw = 0;
this->boundingBox = &gUnk_08121C58;
this->collisionLayer = 3;
this->scriptedScene = 3;
@ -29,7 +29,7 @@ void sub_0808E6A0(Entity* this) {
void sub_0808E6E4(Entity* this) {
if (CheckFlags(this->field_0x86)) {
this->action = 2;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->spriteOrder.b0 = 3;
sub_0808E714(this);
}

View File

@ -48,14 +48,14 @@ void sub_08018CBC(Entity *this)
this->field_0x44 = 6;
this->boundingBox = &gUnk_080B3E18;
this->attachedEntity->spriteOffsetX = 0;
this->attachedEntity->spriteSettings.b.ss0 = 0;
this->attachedEntity->spriteSettings.b.draw = 0;
}
else {
if (gLinkState.field_0x1c == 0) {
DeleteThisEntity();
}
this->action = 2;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->spriteTileSize = 0xa6;
this->palette = 0x33;
this->spriteVramOffset = 0;
@ -91,7 +91,7 @@ void sub_08018DE8(Entity *this)
this->flags = this->flags | 0x80;
this->action = 2;
this->ticks.b0 = 2;
this->attachedEntity->spriteSettings.b.ss0 = 1;
this->attachedEntity->spriteSettings.b.draw = 1;
sub_08018FA0(this);
break;
}

View File

@ -180,7 +180,7 @@ void sub_0803C8BC(Entity *this) {
if (sub_0803CA4C(this)) {
this->action = 2;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
}
}
@ -218,7 +218,7 @@ void sub_0803C950(Entity *this) {
if (this->frames.b.f3 != 0) {
this->action = 1;
this->spriteSettings.b.ss0 = 0;
this->spriteSettings.b.draw = 0;
InitAnimationForceUpdate(this, this->animationState);
}
@ -368,7 +368,7 @@ void sub_0803CBAC(Entity *this) {
}
this->action = 7;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->ticks.b1 = 1;

View File

@ -99,11 +99,11 @@ void sub_0803CDA8(Entity *this) {
void sub_0803CDD8(Entity *this) {
u8 one;
u8 ss0;
u8 draw;
ss0 = this->spriteSettings.b.ss0;
draw = this->spriteSettings.b.draw;
one = 1;
this->spriteSettings.b.ss0 = ss0 ^ one;
this->spriteSettings.b.draw = draw ^ one;
this->actionDelay--;
@ -112,7 +112,7 @@ void sub_0803CDD8(Entity *this) {
this->flags |= 0x80;
this->spriteSettings.b.ss0 = one;
this->spriteSettings.b.draw = one;
}
}

View File

@ -20,7 +20,7 @@ void Malon(Entity* this) {
void sub_08065864(Entity* this) {
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 0xC);
}
@ -30,7 +30,7 @@ void sub_08065880(Entity* this) {
void sub_08065888(Entity* this) {
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->animationState = 4;
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
@ -72,7 +72,7 @@ void sub_08065914(Entity* this) {
void Malon_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 0xC);
} else {
UpdateAnimationSingleFrame(this);

View File

@ -12,7 +12,7 @@ void MilkCart(Entity* ent) {
void sub_08065B6C(Entity* ent) {
ent->action++;
ent->spriteSettings.b.ss0 = 1;
ent->spriteSettings.b.draw = 1;
ent->y.HALF.LO += -0x8000;
ent->animationState = 6;
InitAnimationForceUpdate(ent, 3);

View File

@ -43,7 +43,7 @@ void nullsub_23(Entity* this) {}
void sub_08045618(Entity *this)
{
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->nonPlanarMovement = 0x80;
this->field_0x3c = this->field_0x3c | 0x10;
sub_0804A720(this);

View File

@ -21,7 +21,7 @@ void sub_080869DC(Entity* ent) {
Entity* itemEntity;
ent->action = 1;
ent->spriteSettings.b.ss0 = 0;
ent->spriteSettings.b.draw = 0;
ent->boundingBox = &gUnk_080FD1A8;
ent->field_0x3c |= 16;
itemEntity = CreateObject(0, ent->entityType.form, 0);

View File

@ -95,7 +95,7 @@ void sub_0808F1F8(Entity *this)
this->spriteOrder.b0 = 3;
this->action++;
this->spriteOrder.b3 = this->parent->spriteOrder.b3;
this->spriteOrientation.b2 = this->parent->spriteOrientation.b2;
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
this->ticks.b0 = 7;
InitializeAnimation(this, 1);
sub_0808F244(this);

View File

@ -53,7 +53,7 @@ void nullsub_171() {
void sub_08044FC8(Entity* this) {
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->nonPlanarMovement = 128;
sub_0804A720(this);
InitializeAnimation(this, 0);

View File

@ -30,7 +30,7 @@ void Stamp(Entity* ent) {
void sub_08062BD4(Entity* ent) {
ent->action = 1;
ent->spriteSettings.b.ss0 = 1;
ent->spriteSettings.b.draw = 1;
InitializeAnimation(ent, 0);
sub_08078778(ent);
}

View File

@ -63,7 +63,7 @@ void sub_0806559C(Entity* this) {
void sub_08065608(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_0810FEB0) != 0) {
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
sub_0807DD50(this);
@ -152,7 +152,7 @@ void Talon_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810FEB0) != 0) {
this->action++;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 6);
}
} else {

View File

@ -18,11 +18,11 @@ void ThoughtBubble(Entity* this)
void ThoughtBubble_Init(Entity *this)
{
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
if (this->actionDelay == 0) {
this->actionDelay = 0x2d;
}
this->spriteOrientation.b2 = 1;
this->spriteOrientation.flipY = 1;
InitializeAnimation(this, this->entityType.parameter);
PlaySFX(ThoughtBubble_SFX[this->entityType.parameter]);
}

View File

@ -52,7 +52,7 @@ void sub_0809E8BC(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 3;
this->actionDelay = 0x3c;
this->spriteSettings.b.ss0 = 0;
this->spriteSettings.b.draw = 0;
sub_0809E96C(this);
sub_0809E918(this);
}

View File

@ -8,10 +8,10 @@ void WindTribeFlag(Entity *this)
this->action++;
this->collisionLayer = 2;
if ((this->entityType).form == 0) {
this->spriteSettings.b.ss6 = 0;
this->spriteSettings.b.flipX = 0;
}
else {
this->spriteSettings.b.ss6 = 1;
this->spriteSettings.b.flipX = 1;
}
UpdateSpriteOrderAndFlip(this);
InitializeAnimation(this,0);

View File

@ -42,7 +42,7 @@ void sub_0806C798(Entity* this) {
iVar1 = LoadExtraSpriteData(this, gUnk_08113A1C + (this->entityType.form * 4));
if (iVar1 != 0) {
this->action = 1;
this->spriteSettings.b.ss0 = 1;
this->spriteSettings.b.draw = 1;
this->animationState = this->actionDelay;
sub_0807DD50(this);
sub_0806C7D4(this);

View File

@ -34,7 +34,7 @@ void Zelda(Entity* ent) {
void sub_08066CCC(Entity* ent) {
ent->action = 1;
ent->spriteSettings.b.ss0 = 1;
ent->spriteSettings.b.draw = 1;
sub_0805EA78(ent, 7);
sub_0805E3A0(ent, 2);
sub_0807DD50(ent);
@ -54,7 +54,7 @@ void sub_08066D14(Entity* ent, u32* param_2) {
parent = ent->parent;
if (parent != NULL) {
ent->animationState = parent->animationState;
ent->spriteSettings.b.ss0 = 1;
ent->spriteSettings.b.draw = 1;
CopyPosition(parent, ent);
sub_08068680(ent, ent->parent);
param_2[5] = 1;
@ -69,9 +69,9 @@ void sub_08066D4C(Entity* ent, u32* param_2) {
parent = ent->parent;
if (ent->parent != NULL) {
CopyPosition(ent, parent);
ent->parent->spriteSettings.b.ss0 = 1;
ent->parent->spriteSettings.b.draw = 1;
ent->parent->animationState = ent->animationState;
ent->spriteSettings.b.ss0 = 0;
ent->spriteSettings.b.draw = 0;
ent->field_0x17 &= 0xFE;
sub_08068694(ent, ent->parent);
param_2[5] = 1;