A few more

This commit is contained in:
Elliptic Ellipsis 2022-03-25 13:52:16 +00:00
parent 2d37348cb6
commit dbbf77d76a
6 changed files with 36 additions and 35 deletions

View File

@ -75,7 +75,7 @@ void AcroBandit_OnCollision(Entity* this) {
if (this->type == 1) {
if (this->action < 7 && this->knockbackDuration != 0) {
brother = this->child;
if (brother) {
if (brother != NULL) {
brother->parent = this->parent;
do {
brother->action = 5;
@ -181,6 +181,7 @@ void AcroBandit_Type0Action1(Entity* this) {
void AcroBandit_Type0Action2(Entity* this) {
static const u8 actionDelays[] = { 2, 2, 2, 3, 3, 3, 3, 4 };
GetNextFrame(this);
if (this->frame & 1) {
this->frame = 0;
@ -318,14 +319,14 @@ void AcroBandit_Type0Action8(Entity* this) {
}
}
u32 sub_08031E04(Entity* this) {
bool32 sub_08031E04(Entity* this) {
static const s8 gUnk_080CE5C0[] = { -32, 0, 0, 32, 32, 0, 0, 0 };
Entity* ent;
const s8* tmp;
ent = sub_08049DF4(1);
if (ent == NULL)
return 0;
return FALSE;
tmp = &gUnk_080CE5C0[this->frame & 6];
return EntityWithinDistance(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
@ -386,6 +387,7 @@ void AcroBandit_Type1Action1(Entity* this) {
void AcroBandit_Type1Action2(Entity* this) {
static const u16 banditGravity[] = { 0x1600, 0x1300, 0x1000, 0xD00, 0xB00 };
GravityUpdate(this, banditGravity[this->type2]);
if (this->type2 * -0xe <= this->z.HALF.HI) {
this->action = 3;
@ -399,7 +401,7 @@ void AcroBandit_Type1Action2(Entity* this) {
void AcroBandit_Type1Action3(Entity* this) {
GetNextFrame(this);
if ((this->frame & ANIM_DONE) && (this->parent || --this->actionDelay == 0)) {
if ((this->frame & ANIM_DONE) && ((this->parent != NULL) || (--this->actionDelay == 0))) {
this->action = 4;
this->direction = sub_08049F84(this, 1);
*(u8*)&this->field_0x76 = 0;
@ -414,9 +416,9 @@ void AcroBandit_Type1Action3(Entity* this) {
void AcroBandit_Type1Action4(Entity* this) {
Entity* parent;
if (sub_080322A4(this) == 0) {
if (!sub_080322A4(this)) {
parent = this->parent;
if (parent == 0) {
if (parent == NULL) {
if (sub_08049FDC(this, 1)) {
if ((++this->field_0x78.HALF.HI & 7) == 0) {
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
@ -538,30 +540,29 @@ void sub_08032290(Entity* this) {
InitializeAnimation(this, 11);
}
u32 sub_080322A4(Entity* this) {
bool32 sub_080322A4(Entity* this) {
if (this->child != NULL && (this->child->z.HALF.HI + 8) >= this->z.HALF.HI) {
if (this->z.HALF.HI) {
this->action = 5;
this->z.HALF.HI = this->child->z.HALF.HI + 8;
InitializeAnimation(this, 11);
return 1;
return TRUE;
} else {
sub_08032290(this);
return 1;
return TRUE;
}
}
return 0;
return FALSE;
}
void sub_080322E8(Entity* this) {
u8 tmp;
if (this->field_0x78.HALF.LO) {
if (--this->field_0x78.HALF.LO == 0) {
u32 flipX = this->spriteSettings.flipX;
this->spriteSettings.flipX = flipX ^ 1;
}
} else {
tmp = this->direction;
u8 tmp = this->direction;
if (tmp & 0xF) {
tmp >>= 4;
tmp ^= 1;

View File

@ -34,7 +34,7 @@ void MiniSlime_OnCollision(Entity* this) {
void MiniSlime_OnDeath(Entity* this) {
Entity* parent = this->parent;
if (this != parent && parent) {
if ((this != parent) && (parent != NULL)) {
this->field_0x6c.HALF.LO &= 0x7f;
this->parent->child = this->child;
this->child->parent = this->parent;

View File

@ -380,7 +380,7 @@ bool32 sub_080288A4(Entity* this) {
void sub_080288C0(Entity* this) {
Entity* ent = this->child;
if (ent && (ent->bitfield & 0x80)) {
if ((ent != NULL) && (ent->bitfield & 0x80)) {
this->knockbackDirection = ent->knockbackDirection;
this->iframes = -ent->iframes;
this->knockbackSpeed = ent->knockbackSpeed;

View File

@ -117,7 +117,7 @@ void sub_08064EE8(Entity* this) {
}
fxEnt = CreateFx(this, confettiFx, 0);
if (fxEnt && bVar1 == 2) {
if ((fxEnt != NULL) && (bVar1 == 2)) {
fxEnt->spriteSettings.flipX = 1;
}
}

View File

@ -15,11 +15,9 @@ void Book(Entity* this) {
}
void sub_0809B3C4(Entity* this) {
u32 obtained;
obtained = GetInventoryValue(this->type + ITEM_QST_BOOK1);
u32 obtained = GetInventoryValue(this->type + ITEM_QST_BOOK1);
if (this->type2 != 3) {
if (obtained) {
if (obtained != 0) {
DeleteThisEntity();
}
} else {
@ -55,22 +53,23 @@ void sub_0809B3C4(Entity* this) {
case 1: {
u32 scroll;
u32 height;
this->action = 3;
scroll = (u16)gRoomControls.scroll_y - 0x10;
height = (u16)this->y.HALF.HI - scroll;
this->z.HALF.HI -= height;
return;
break;
}
case 2:
this->action = 4;
return;
break;
case 3:
this->action = 5;
this->subAction = 0;
this->spritePriority.b0 = 3;
break;
default:
return;
break;
}
}
@ -92,7 +91,7 @@ void sub_0809B4A8(Entity* this) {
this->speed = 64;
this->direction = 16;
gPlayerState.pushedObject = 0x9e;
gPlayerState.pushedObject = TREE_THORNS;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
@ -134,7 +133,7 @@ void sub_0809B56C(Entity* this) {
SetFlag(this->field_0x86.HWORD);
fx = CreateFx(this, FX_DEATH, 0);
if (fx) {
if (fx != NULL) {
SortEntityAbove(this, fx);
}
}
@ -152,9 +151,8 @@ void sub_0809B5EC(Entity* this) {
if (this->spriteSettings.draw == 1) {
switch (this->subAction) {
case 0: {
Entity* parent;
parent = FindEntityByID(NPC, STURGEON, 7);
if (!parent) {
Entity* parent = FindEntityByID(NPC, STURGEON, 7);
if (parent == NULL) {
return;
}
if (parent->x.HALF.HI < this->x.HALF.HI) {
@ -170,7 +168,7 @@ void sub_0809B5EC(Entity* this) {
break;
}
case 1: {
if (!this->parent || !this->parent->next) {
if ((this->parent == NULL) || (this->parent->next == NULL)) {
DeleteThisEntity();
return;
}
@ -206,9 +204,8 @@ void sub_0809B5EC(Entity* this) {
}
u32 sub_0809B688(Entity* this) {
u32 ret;
u32 ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12);
ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12);
if (ret == 1 && gPlayerState.field_0xd != 16) {
ret = 0;
}
@ -217,8 +214,7 @@ u32 sub_0809B688(Entity* this) {
}
void sub_0809B6B0(Entity* parent, Entity* this) {
s32 offset;
offset = (s32)gUnk_08123D94[parent->animationState >> 1] << 16;
s32 offset = (s32)gUnk_08123D94[parent->animationState >> 1] << 16;
PositionRelative(parent, this, 0, offset);

View File

@ -144,6 +144,7 @@ void sub_080844E0(SpecialFxObject* this) {
static const u8 gUnk_0811FAC8[] = { 0x03, 0x37, 0x38, 0x39 };
static const u8 gUnk_0811FACC[] = { 0x17, 0x3e, 0x3f, 0x40 };
const struct_0811F960* ptr;
super->action = 1;
super->flags &= ~0x80;
super->spriteSettings.draw = 1;
@ -219,7 +220,7 @@ void sub_08084680(SpecialFxObject* this) {
}
void sub_08084694(SpecialFxObject* this) {
if (!super->parent || !super->parent->next) {
if ((super->parent == NULL) || (super->parent->next == NULL)) {
DeleteThisEntity();
}
GetNextFrame(super);
@ -253,12 +254,15 @@ void sub_080846B0(SpecialFxObject* this) {
void sub_0808471C(SpecialFxObject* this) {
static const s8 gUnk_0811FB08[] = { -8, -8, 8, -8, -8, 8, 8, 8 };
GetNextFrame(super);
if (super->frame & ANIM_DONE) {
u32 i;
for (i = 0; i < 4; i++) {
Entity* fx = CreateFx(super, 0x24, 0);
if (fx) {
if (fx != NULL) {
const s8* ptr = &gUnk_0811FB08[2 * i];
fx->x.HALF.HI += ptr[0];
fx->y.HALF.HI += ptr[1];
@ -280,7 +284,7 @@ void sub_08084784(SpecialFxObject* this) {
void sub_08084798(SpecialFxObject* this) {
GetNextFrame(super);
if ((super->frame & ANIM_DONE) || !super->child->next) {
if ((super->frame & ANIM_DONE) || (super->child->next == NULL)) {
DeleteThisEntity();
}
}