Renamed Entity fields for knockback

SolidifiedGaming identified these while glitchhunting.
This commit is contained in:
Ibot02 2021-10-25 13:32:54 +02:00
parent 9bca0fe57f
commit 59076fccb7
33 changed files with 87 additions and 87 deletions

View File

@ -109,11 +109,11 @@ typedef struct Entity {
/*0x3b*/ u8 flags2;
/*0x3c*/ u8 field_0x3c;
/*0x3d*/ s8 iframes;
/*0x3e*/ u8 field_0x3e;
/*0x3e*/ u8 knockbackDirection;
/*0x3f*/ u8 damageType;
/*0x40*/ u8 field_0x40;
/*0x41*/ u8 bitfield;
/*0x42*/ u8 field_0x42;
/*0x42*/ u8 knockbackDuration;
/*0x43*/ u8 field_0x43;
/*0x44*/ u8 field_0x44;
/*0x45*/ u8 currentHealth;

View File

@ -52,7 +52,7 @@ void sub_080318DC(Entity* this) {
if (this->bitfield != 0x80 && this->bitfield != 0x81) {
if (this->type == 1) {
if (this->action < 7 && this->field_0x42) {
if (this->action < 7 && this->knockbackDuration != 0) {
brother = this->attachedEntity;
if (brother) {
brother->parent = this->parent;
@ -72,7 +72,7 @@ void sub_080318DC(Entity* this) {
this->action = 9;
this->spritePriority.b1 = 1;
if (this->field_0x3e < 0x10) {
if (this->knockbackDirection < 0x10) {
this->spriteSettings.b.flipX = 0;
} else {
this->spriteSettings.b.flipX = 1;
@ -81,19 +81,19 @@ void sub_080318DC(Entity* this) {
}
if (this->currentHealth == 0) {
this->field_0x3e = ((this->field_0x3e + (7 & Random())) - 4) & 0x1f;
this->field_0x42 += this->type2 * 3;
this->knockbackDirection = ((this->knockbackDirection + (7 & Random())) - 4) & 0x1f;
this->knockbackDuration += this->type2 * 3;
sub_08032338(this);
}
}
if (this->field_0x42 && this->frames.all & 0x10) {
if (this->knockbackDuration != 0 && this->frames.all & 0x10) {
if (this->type == 0) {
this->action = 8;
} else {
this->action = 9;
}
if (this->field_0x3e < 0x10) {
if (this->knockbackDirection < 0x10) {
this->spriteSettings.b.flipX = 0;
} else {
this->spriteSettings.b.flipX = 1;

View File

@ -48,7 +48,7 @@ void sub_08021780(Entity* this) {
}
if (this->currentHealth == 0)
this->field_0x42 = 0;
this->knockbackDuration = 0;
sub_0804AA30(this, gUnk_080CB590);
}

View File

@ -30,8 +30,8 @@ void sub_0802C688(Entity* this) {
case 0:
case 1:
if (this->field_0x82.HALF.LO) {
this->field_0x42 = 0;
gPlayerEntity.field_0x42 = 4;
this->knockbackDuration = 0;
gPlayerEntity.knockbackDuration = 4;
}
return;
case 0xe:
@ -39,7 +39,7 @@ void sub_0802C688(Entity* this) {
case 0x15:
case 0x16:
this->action = 3;
this->field_0x42 = 0;
this->knockbackDuration = 0;
sub_0802CBC4(this);
return;
}

View File

@ -64,7 +64,7 @@ void sub_08020BB8(Entity* this) {
this->action = 11;
this->actionDelay = gUnk_080CAB0C[this->type];
this->damageType = 81;
sub_08021218(this, 8, DirectionToAnimationState(this->field_0x3e ^ 0x10));
sub_08021218(this, 8, DirectionToAnimationState(this->knockbackDirection ^ 0x10));
sub_08021588(this);
sub_0804A9FC(this, 0x1c);
break;
@ -72,7 +72,7 @@ void sub_08020BB8(Entity* this) {
this->action = 11;
this->actionDelay = gUnk_080CAB10[this->type];
this->damageType = 81;
sub_08021218(this, 8, DirectionToAnimationState(this->field_0x3e ^ 0x10));
sub_08021218(this, 8, DirectionToAnimationState(this->knockbackDirection ^ 0x10));
sub_08021588(this);
sub_0804A9FC(this, 0x1c);
break;

View File

@ -58,7 +58,7 @@ NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* th
} else {
if ((u8)(this->action - 1) < 2) {
this->action = 1;
x = DirectionTurnAround(this->field_0x3e);
x = DirectionTurnAround(this->knockbackDirection);
this->direction = x;
this->animationState = x >> 3;
InitAnimationForceUpdate(this, this->animationState);
@ -342,8 +342,8 @@ void sub_08037A58(Entity* this) {
this->damageType = 0x26;
this->flags2 |= 1;
this->iframes = 0xf4;
this->field_0x3e = (this->animationState << 3) ^ 0x10;
this->field_0x42 = 8;
this->knockbackDirection = DirectionFromAnimationState(this->animationState) ^ 0x10;
this->knockbackDuration = 8;
this->field_0x46 = 0x180;
this->field_0x76.HALF.LO = 0x3c;
InitAnimationForceUpdate(this, this->animationState + 0x10);
@ -353,8 +353,8 @@ void sub_08037ACC(Entity* this) {
gPlayerState.flags.all &= 0xFFFFFEFF;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.iframes = 0x1e;
gPlayerEntity.field_0x3e = DirectionFromAnimationState(this->animationState);
gPlayerEntity.field_0x42 = 4;
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(this->animationState);
gPlayerEntity.knockbackDuration = 4;
gPlayerEntity.field_0x46 = 0x180;
}
// Damage player maybe?

View File

@ -48,7 +48,7 @@ void sub_0802BBC4(Entity* this) {
case 2:
case 3:
if (this->action == 4) {
this->field_0x42 = 0;
this->knockbackDuration = 0;
sub_0802C218(this);
}
break;

View File

@ -39,7 +39,7 @@ void sub_080323F4(Entity* this) {
if (this->action != 3 && this->action != 4) {
this->action = 3;
this->actionDelay = 0xC;
this->direction = DirectionTurnAround(this->field_0x3e);
this->direction = DirectionTurnAround(this->knockbackDirection);
InitAnimationForceUpdate(this, this->direction >> 3);
} else if (this->bitfield == 0xCC) {
if (this->field_0x43 == 0) {

View File

@ -64,7 +64,7 @@ void sub_0803C784(Entity* this) {
Entity* fx = CreateFx(this, 2, 0);
if (fx != NULL) {
u32 angle = (this->field_0x3e ^ 0x10) << 3;
u32 angle = (this->knockbackDirection ^ 0x10) << 3;
s32 sine;
sine = gSineTable[angle];

View File

@ -24,7 +24,7 @@ void sub_0803CCD4(Entity* this) {
}
void sub_0803CCEC(Entity* this) {
this->field_0x42 = 0;
this->knockbackDuration = 0;
sub_0803CCD4(this);
}

View File

@ -36,7 +36,7 @@ void sub_08022BEC(Entity* this) {
this->field_0x7a.HALF.LO = this->currentHealth;
this->actionDelay = 1;
this->direction = this->field_0x3e;
this->direction = this->knockbackDirection;
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
this->frameIndex = this->animationState;

View File

@ -234,7 +234,7 @@ void Peahat_Stunned(Entity* this) {
}
if (this->direction == 0xff)
this->direction = this->field_0x3e;
this->direction = this->knockbackDirection;
ProcessMovement(this);
GetNextFrame(this);

View File

@ -75,7 +75,7 @@ void sub_08025020(Entity* this) {
this->field_0x20 = 0;
}
this->iframes = -0xc;
this->field_0x42 = 0;
this->knockbackDuration = 0;
if (this->field_0x80.HALF.LO == 0) {
this->animationState = (*(Entity**)&this->field_0x4c)->direction >> 3;
InitializeAnimation(this, this->animationState + 4);

View File

@ -51,7 +51,7 @@ void sub_08022254(Entity* this) {
this->action = 2;
this->flags &= ~0x80;
this->spriteSettings.b.draw = 0;
this->direction = this->field_0x3e;
this->direction = this->knockbackDirection;
this->attachedEntity = ent;
}
}
@ -101,8 +101,8 @@ void sub_080223E4(Entity* this) {
ent->bitfield = 0x94;
ent->iframes = 0x10;
#ifndef EU
ent->field_0x42 = 0xc;
ent->field_0x3e = this->direction;
ent->knockbackDuration = 0xc;
ent->knockbackDirection = this->direction;
#endif
}

View File

@ -54,11 +54,11 @@ void sub_08020668(Entity* this) {
void sub_080206E0(Entity* this) {
if (Rollobite_TryToHoleUp(this)) {
this->field_0x42 = 0;
this->knockbackDuration = 0;
} else if (Rollobite_IsRolledUp(this)) {
this->field_0x42--;
sub_080AE58C(this, this->field_0x3e, 10);
sub_080AE7E8(this, this->field_0x46, this->field_0x3e, 10);
this->knockbackDuration--;
sub_080AE58C(this, this->knockbackDirection, 10);
sub_080AE7E8(this, this->field_0x46, this->knockbackDirection, 10);
} else {
sub_08001324(this);
}

View File

@ -379,11 +379,11 @@ bool32 sub_080288A4(Entity* this) {
void sub_080288C0(Entity* this) {
Entity* ent = this->attachedEntity;
if (ent && (ent->bitfield & 0x80)) {
this->field_0x3e = ent->field_0x3e;
this->knockbackDirection = ent->knockbackDirection;
this->iframes = -ent->iframes;
this->field_0x46 = ent->field_0x46;
this->field_0x42 = ent->field_0x42;
ent->field_0x42 = 0;
this->knockbackDuration = ent->knockbackDuration;
ent->knockbackDuration = 0;
}
}

View File

@ -51,8 +51,8 @@ void sub_0802B628(Entity* this) {
this->action = 6;
this->field_0x20 = 0x18000;
this->speed = 0xc0;
this->direction = this->field_0x3e;
this->field_0x42 = 0;
this->direction = this->knockbackDirection;
this->knockbackDuration = 0;
this->iframes = -8;
this->damageType = 100;
InitializeAnimation(this, 9);

View File

@ -1068,7 +1068,7 @@ void sub_080409B0(Entity* this) {
}
if (this->field_0x80.HALF.HI < 3) {
if (this->field_0x42 != 0) {
if (this->knockbackDuration != 0) {
sub_080AF18C(this);
}
} else {

View File

@ -37,9 +37,9 @@ void sub_0802A454(Entity* this) {
}
}
if (this->field_0x42)
if (this->field_0x42 > 4)
this->field_0x42 -= 4;
if (this->knockbackDuration != 0)
if (this->knockbackDuration > 4)
this->knockbackDuration -= 4;
if (this->field_0x43 != 0) {
sub_0804A9FC(this, 0x1c);

View File

@ -102,7 +102,7 @@ void DeleteEntity(Entity* ent) {
ent->spriteSettings.b.draw = 0;
ent->field_0x3c = 0;
ent->bitfield = 0;
ent->field_0x42 = 0;
ent->knockbackDuration = 0;
ent->currentHealth = 0;
UnlinkEntity(ent);
ent->next = NULL;

View File

@ -85,8 +85,8 @@ void sub_08063DC8(Entity* this) {
InitAnimationForceUpdate(this, this->animationState + 4);
} else {
sub_0806EE20(this);
if (this->field_0x3e != this->animationState) {
this->animationState = this->field_0x3e;
if (this->knockbackDirection != this->animationState) {
this->animationState = this->knockbackDirection;
InitializeAnimation(this, this->animationState + 4);
} else {
GetNextFrame(this);

View File

@ -67,7 +67,7 @@ void sub_0806045C(Entity* this) {
TextboxNoOverlapFollow(0);
break;
default:
bVar1 = this->field_0x3e;
bVar1 = this->knockbackDirection;
if (bVar1 != this->animationState) {
this->animationState = bVar1;
InitAnimationForceUpdate(this, 4 + bVar1);

View File

@ -66,8 +66,8 @@ void sub_0809CD0C(Entity* this) {
ModHealth(-2);
sub_0800449C(&gPlayerEntity, 0x7a);
gPlayerEntity.iframes = 16;
gPlayerEntity.field_0x3e = 16;
gPlayerEntity.field_0x42 = 12;
gPlayerEntity.knockbackDirection = 16;
gPlayerEntity.knockbackDuration = 12;
gPlayerEntity.field_0x46 = 16;
}
}

View File

@ -199,7 +199,7 @@ void sub_08070D38(Entity* this) {
this->flags &= ~0x80;
this->direction = ((this->animationState & 0xe) << 2) ^ 0x10;
this->speed = 0x100;
this->field_0x42 = 0;
this->knockbackDuration = 0;
this->subAction++;
this->actionDelay = gPlayerState.field_0x38;
this->spriteIndex = 1;
@ -366,7 +366,7 @@ void sub_08071038(Entity* this) {
if (this->frames.all & 0x80) {
this->attachedEntity = 0;
this->field_0x42 = 0;
this->knockbackDuration = 0;
this->iframes = 248;
gPlayerState.jumpStatus = 0;
sub_080791D0();
@ -465,7 +465,7 @@ void sub_08071130(Entity* this) {
this->subAction++;
sub_08078F60();
this->field_0x42 = 0;
this->knockbackDuration = 0;
SoundReq(SFX_PLY_LAND);
}
@ -531,7 +531,7 @@ void sub_080712F0(Entity* this) {
if (temp == FALSE)
return;
this->field_0x42 = 0;
this->knockbackDuration = 0;
this->iframes = 32;
this->spritePriority.b1 = 1;
this->spriteSettings.b.draw = FALSE;
@ -568,7 +568,7 @@ void PortalJumpOnUpdate(Entity* this) {
u16 y;
this->flags &= ~0x80;
this->field_0x42 = 0;
this->knockbackDuration = 0;
x = gArea.curPortalX;
y = gArea.curPortalY;
@ -887,7 +887,7 @@ void sub_08071B60(Entity* this) {
gPlayerState.pushedObject = 2;
gPlayerState.flags.all &= ~0x1;
this->type = 0;
this->field_0x42 = 0;
this->knockbackDuration = 0;
sub_080728AC(this);
this->field_0xf = 6;
if ((gPlayerState.flags.all & 0x80) == 0) {
@ -1139,7 +1139,7 @@ void sub_08071F80(Entity* this) {
void sub_08072008(Entity* this) {
this->iframes = 160;
this->field_0x42 = 0;
this->knockbackDuration = 0;
this->flags |= 0x80;
this->spriteOffsetX = 0;
gPlayerState.flags.all &= ~(0x800 | 0x1);
@ -1216,7 +1216,7 @@ void sub_08072168(Entity* this) {
gPlayerState.field_0xd = this->direction;
sub_08019840();
if (--this->actionDelay == 0xff) {
this->field_0x42 = 0;
this->knockbackDuration = 0;
this->flags |= 0x80;
UpdateSpriteForCollisionLayer(this);
sub_080791BC();
@ -1256,7 +1256,7 @@ void sub_08072260(Entity* this) {
} else {
gPlayerState.field_0x8 = 0x944;
}
this->field_0x42 = 0;
this->knockbackDuration = 0;
sub_080791BC();
}
}
@ -1283,7 +1283,7 @@ void sub_080722DC(Entity* this) {
} else {
this->spriteSettings.b.draw = 0;
this->subAction = 3;
this->field_0x42 = 10;
this->knockbackDuration = 10;
}
gPlayerState.flags.all |= (0x400 | 0x1);
ResetPlayer();
@ -1299,7 +1299,7 @@ void sub_08072354(Entity* this) {
return;
this->spritePriority.b1 = 0;
this->field_0x42 = 0;
this->knockbackDuration = 0;
this->subAction = 2;
this->actionDelay = 0x3c;
gPlayerState.field_0x8 = 0x2c1;
@ -1320,7 +1320,7 @@ void sub_080723D0(Entity* this) {
}
void sub_0807240C(Entity* this) {
if (--this->field_0x42 == 0xff) {
if (--this->knockbackDuration == 0xff) {
this->spriteSettings.b.draw = 3;
this->iframes = 0x14;
gPlayerState.flags.all &= ~0x400;
@ -1360,7 +1360,7 @@ void PlayerRoomTransition(Entity* this) {
}
void sub_080724DC(Entity* this) {
this->field_0x42 = 0;
this->knockbackDuration = 0;
sub_0807A108();
if (sub_080002B8(this) != 0x29) {
if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swimState != 0)) {
@ -1794,7 +1794,7 @@ NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(Entity* t
}
this->actionDelay = 6;
this->subAction = 3;
this->field_0x42 = 0;
this->knockbackDuration = 0;
SoundReq(0x7d);
}
}
@ -1816,9 +1816,9 @@ void sub_08072F34(Entity* this) {
gPlayerState.field_0xa8 = 0x18;
gPlayerState.field_0x10[2] = sub_0807A1E8(this, 0, 0);
gUnk_0811BBE4[this->subAction](this);
if (this->field_0x42 != 0) {
if (this->knockbackDuration != 0) {
sub_080792D8();
if (this->field_0x42 == 0) {
if (this->knockbackDuration == 0) {
this->action = 0x1d;
this->subAction = 0;
this->y.HALF.LO = 0;
@ -1897,7 +1897,7 @@ void sub_08073094(Entity* this) {
switch (gPlayerState.field_0x10[2]) {
case 0x2a:
case 0x2c:
this->field_0x42 = 0;
this->knockbackDuration = 0;
gPlayerState.flags.all |= 0x20000000;
UpdateAnimationSingleFrame(this);
if ((this->frames.all & 0x40) != 0) {

View File

@ -34,7 +34,7 @@ void sub_080A9334(Entity* this) {
if ((this->bitfield & 0x3f) != 0) {
ModHealth(-2);
sub_080A9488(this);
this->field_0x42 = 0;
this->knockbackDuration = 0;
this->iframes = 0;
} else {
DeleteThisEntity();
@ -107,7 +107,7 @@ void sub_080A9488(Entity* this) {
this->flags &= 0x7f;
this->actionDelay = 2;
this->field_0x20 = 0x18000;
this->animationState = (this->field_0x3e & 0x18) >> 3;
this->animationState = (this->knockbackDirection & 0x18) >> 3;
EnqueueSFX(SFX_METAL_CLINK);
sub_080A94C0(this, this->animationState);
}

View File

@ -27,7 +27,7 @@ void sub_080AB544(Entity* this) {
if (this->iframes < -4) {
this->action = 2;
this->direction = this->field_0x3e;
this->direction = this->knockbackDirection;
tmp = (this->type ^ 2) << 3;
if (this->direction - tmp + 1 < 3) {
this->direction = tmp;

View File

@ -30,7 +30,7 @@ void sub_080A8470(Entity* this) {
}
DeleteEntity(this);
} else {
this->direction = (this->field_0x3e + 4) & 0x18;
this->direction = DirectionRoundUp(this->knockbackDirection);
if ((u8)(this->bitfield + 0x7e) < 2) {
sub_080A8680(this);
} else {
@ -74,14 +74,14 @@ void DekuSeedProjectile_Action1(Entity* this) {
parent = this->parent;
if ((parent->next != NULL) && (sub_080177A0(this, parent) != 0)) {
this->iframes = 0x10;
this->field_0x3e = -this->direction;
this->knockbackDirection = -this->direction;
this->bitfield = -0x80;
this->field_0x42 = 0xc;
this->knockbackDuration = 0xc;
this->field_0x46 = 0;
parent->iframes = 0x10;
parent->field_0x3e = this->direction;
parent->knockbackDirection = this->direction;
parent->bitfield = -0x3e;
parent->field_0x42 = 0xc;
parent->knockbackDuration = 0xc;
parent->field_0x46 = 0;
}
}

View File

@ -35,7 +35,7 @@ void GuardLineOfSight(Entity* this) {
entity = CreateProjectile(0xc);
if (entity != NULL) {
entity->type = 1;
tmp = this->parent->field_0x3e;
tmp = this->parent->knockbackDirection;
entity->direction = (gUnk_081299C8[(this->actionDelay >> 2 & 7)] + (tmp << 3)) & 0x1f;
entity->parent = this->parent;
CopyPosition(this, entity);

View File

@ -66,14 +66,14 @@ void sub_080A9EBC(Entity* this) {
default:
parent = this->parent;
parent->iframes = this->iframes;
parent->field_0x3e = this->field_0x3e;
parent->field_0x42 = this->field_0x42;
parent->knockbackDirection = this->knockbackDirection;
parent->knockbackDuration = this->knockbackDuration;
if (this->action == 1) {
sub_080AA320(this);
}
break;
}
this->field_0x42 = 0;
this->knockbackDuration = 0;
}
}

View File

@ -27,7 +27,7 @@ void sub_080A832C(Entity* this) {
if (this->bitfield == 0x80) {
this->iframes = 0x10;
this->field_0x42 = 0xc;
this->knockbackDuration = 0xc;
this->field_0x46 = 0x180;
this->parent->bitfield = this->bitfield;
}
@ -37,10 +37,10 @@ void sub_080A832C(Entity* this) {
} else {
this->parent->iframes = -tmp;
}
this->parent->field_0x42 = this->field_0x42;
this->parent->knockbackDuration = this->knockbackDuration;
this->parent->field_0x46 = this->field_0x46;
this->parent->field_0x3e = this->field_0x3e;
this->field_0x42 = 0;
this->parent->knockbackDirection = this->knockbackDirection;
this->knockbackDuration = 0;
}
void MoblinSpear_Init(Entity* this) {

View File

@ -84,7 +84,7 @@ void OctorokBossProjectile_Action1(Entity* this) {
if ((this->bitfield & 0x7f) == 0) {
OctorokBossProjectile_Action2(this);
}
this->direction = this->field_0x3e << 3;
this->direction = this->knockbackDirection << 3;
this->speed = 0x400;
this->type2 = 1;
this->actionDelay = 0;
@ -98,9 +98,9 @@ void OctorokBossProjectile_Action1(Entity* this) {
this->parent->currentHealth -= 1;
this->parent->iframes = 0x1e;
if (this->parent->field_0x7c.BYTES.byte0 != 0) {
this->parent->field_0x42 = 0x18;
this->parent->knockbackDuration = 0x18;
this->parent->field_0x46 = 0x200;
this->parent->field_0x3e = this->direction >> 3;
this->parent->knockbackDirection = this->direction >> 3;
}
SoundReq(SFX_BOSS_HIT);
OctorokBossProjectile_Action2(this);

View File

@ -23,7 +23,7 @@ void sub_080A8064(Entity* this) {
if (this->bitfield == 0x80) {
DeleteEntity(this);
} else {
this->direction = this->field_0x3e;
this->direction = this->knockbackDirection;
sub_080A8178(this);
}
}

View File

@ -49,8 +49,8 @@ void sub_080AAC44(Entity* this) {
CopyPosition(this->parent, this);
}
}
if (this->field_0x42 != 0) {
this->field_0x42 = 0;
if (this->knockbackDuration != 0) {
this->knockbackDuration = 0;
}
}