diff options
| author | Elliptic Ellipsis <elliptic.ellipsis@gmail.com> | 2022-03-25 05:34:53 +0000 |
|---|---|---|
| committer | Elliptic Ellipsis <elliptic.ellipsis@gmail.com> | 2022-03-25 05:35:12 +0000 |
| commit | 2d37348cb6994f6fe20a0ffbc2ee2d87bd7447a2 (patch) | |
| tree | c43ce69da5d2e1fe8744d0a54a3a9650de6f20d1 /src/enemy | |
| parent | 481079092ce272558c887c9563948af0f0fa9d58 (diff) | |
Fix a lot of pointer comparisons to 0 (or nothing) to explicitly use NULL
Diffstat (limited to 'src/enemy')
| -rw-r--r-- | src/enemy/acroBandits.c | 6 | ||||
| -rw-r--r-- | src/enemy/beetle.c | 2 | ||||
| -rw-r--r-- | src/enemy/bobomb.c | 2 | ||||
| -rw-r--r-- | src/enemy/bombPeahat.c | 25 | ||||
| -rw-r--r-- | src/enemy/bombarossa.c | 2 | ||||
| -rw-r--r-- | src/enemy/bowMoblin.c | 4 | ||||
| -rw-r--r-- | src/enemy/businessScrubPrologue.c | 12 | ||||
| -rw-r--r-- | src/enemy/chuchu.c | 2 | ||||
| -rw-r--r-- | src/enemy/cuccoAggr.c | 4 | ||||
| -rw-r--r-- | src/enemy/darkNut.c | 8 | ||||
| -rw-r--r-- | src/enemy/fallingBoulder.c | 2 | ||||
| -rw-r--r-- | src/enemy/fireballGuy.c | 2 | ||||
| -rw-r--r-- | src/enemy/flyingSkull.c | 2 | ||||
| -rw-r--r-- | src/enemy/gleerok.c | 10 | ||||
| -rw-r--r-- | src/enemy/helmasaur.c | 4 | ||||
| -rw-r--r-- | src/enemy/moldorm.c | 2 | ||||
| -rw-r--r-- | src/enemy/moldworm.c | 12 | ||||
| -rw-r--r-- | src/enemy/octorok.c | 2 | ||||
| -rw-r--r-- | src/enemy/octorokBoss.c | 2 | ||||
| -rw-r--r-- | src/enemy/peahat.c | 2 | ||||
| -rw-r--r-- | src/enemy/pesto.c | 10 | ||||
| -rw-r--r-- | src/enemy/puffstool.c | 8 | ||||
| -rw-r--r-- | src/enemy/rockChuchu.c | 4 | ||||
| -rw-r--r-- | src/enemy/scissorsBeetle.c | 2 | ||||
| -rw-r--r-- | src/enemy/slime.c | 2 | ||||
| -rw-r--r-- | src/enemy/sluggula.c | 4 | ||||
| -rw-r--r-- | src/enemy/spark.c | 4 | ||||
| -rw-r--r-- | src/enemy/takkuri.c | 4 | ||||
| -rw-r--r-- | src/enemy/waterDrop.c | 2 |
29 files changed, 73 insertions, 74 deletions
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 9ac33af9..463693f2 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -84,10 +84,10 @@ void AcroBandit_OnCollision(Entity* this) { brother->iframes = -12; } while (brother = brother->child, brother != NULL); } - if (this->parent) { + if (this->parent != NULL) { this->parent->child = this->child; } else { - if (this->child) + if (this->child != NULL) this->parent = this; } @@ -403,7 +403,7 @@ void AcroBandit_Type1Action3(Entity* this) { this->action = 4; this->direction = sub_08049F84(this, 1); *(u8*)&this->field_0x76 = 0; - if (this->child) { + if (this->child != NULL) { InitializeAnimation(this, 9); } else { InitializeAnimation(this, 8); diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index 25e104c8..dc15be53 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -60,7 +60,7 @@ void Beetle_OnDeath(Entity* this) { GenericDeath(this); } else { Entity* ent = this->parent; - if (ent) { + if (ent != NULL) { ent->field_0xf--; this->parent = NULL; } diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 5ff23ab7..e47bf4e4 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -290,7 +290,7 @@ void sub_0802CBC4(Entity* this) { FreeCarryEntity(this); ent = CreateObjectWithParent(this, OBJECT_20, 0, 0); - if (ent) { + if (ent != NULL) { ent->collisionLayer = this->collisionLayer; } } diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 5c327b91..5cb6e1db 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -92,7 +92,6 @@ void sub_0802A8FC(Entity* this) { } void nullsub_143(Entity* this) { - /* ... */ } void sub_0802A91C(Entity* this) { @@ -167,7 +166,7 @@ void sub_0802AA40(Entity* this) { this->actionDelay--; } else { Entity* ent = this->child; - if (ent) { + if (ent != NULL) { if (ent->next == NULL) { this->child = NULL; } else { @@ -212,7 +211,7 @@ void sub_0802AAC0(Entity* this) { } } #else - } else if (ent->actionDelay == 0 && ent->field_0xf < 0x51) { + } else if ((ent->actionDelay == 0) && (ent->field_0xf <= 0x50)) { this->field_0x80.HALF.HI = 0; } #endif @@ -304,7 +303,7 @@ void sub_0802AC40(Entity* this) { GetNextFrame(this); LinearMoveUpdate(this); if (this->field_0x7a.HALF.LO) { - if (sub_0802B234(this) == 0) { + if (!sub_0802B234(this)) { this->field_0x7a.HALF.LO = 0; this->spritePriority.b1 = 0; #ifndef EU @@ -349,7 +348,7 @@ void sub_0802ACDC(Entity* this, u32 param_2) { void sub_0802AD1C(Entity* this, u32 param_2) { Entity* ent = sub_08049DF4(1); - if (ent) { + if (ent != NULL) { u32 y = ent->y.HALF.HI - 0x18; u32 x = ent->x.HALF.HI; sub_08004596(this, sub_080045B4(this, x, y)); @@ -416,7 +415,7 @@ void sub_0802AE24(Entity* this) { #ifdef EU void sub_0802AE68(Entity* this) { Entity* ent = this->parent; - if (ent == 0) { + if (ent == NULL) { this->action = 3; this->spriteSettings.draw = 1; this->field_0x80.HALF.LO = 1; @@ -441,7 +440,7 @@ void sub_0802AE68(Entity* this) { #else void sub_0802AE68(Entity* this) { Entity* ent = sub_0802B250(this); - if (ent == 0) { + if (ent == NULL) { this->action = 3; this->field_0x80.HALF.LO = 1; sub_0802B264(this); @@ -559,7 +558,7 @@ void sub_0802B048(Entity* this) { } ent = this->parent; - if (ent && this->action == 1) { + if ((ent != NULL) && this->action == 1) { this->spriteRendering.b3 = ent->spriteRendering.b3; this->spritePriority.b0 = ent->spritePriority.b0; this->spriteOrientation.flipY = ent->spriteOrientation.flipY; @@ -588,7 +587,7 @@ void sub_0802B048(Entity* this) { COLLISION_ON(this); this->field_0x7a.HALF.HI = 0; FreeCarryEntity(this); - if (this->parent->next) { + if (this->parent->next != NULL) { this->parent->field_0x80.HALF.HI = 0; } ent = CreateObjectWithParent(this, OBJECT_20, 0, 0); @@ -622,7 +621,7 @@ void sub_0802B1BC(Entity* this) { } ent = this->parent; - if (ent == 0) { + if (ent == NULL) { this->action = 2; this->spriteSettings.draw = 1; } @@ -651,7 +650,7 @@ void sub_0802B1BC(Entity* this) { } ent = sub_0802B250(this); - if (ent == 0) { + if (ent == NULL) { this->action = 2; sub_0802B264(this); } else { @@ -668,7 +667,7 @@ void sub_0802B1BC(Entity* this) { void sub_0802B204(Entity* this) { if (sub_080044EC(this, 0x2800) == 1) { Entity* ent = CreateEnemy(BOBOMB, 1); - if (ent) { + if (ent != NULL) { CopyPosition(this, ent); ent->parent = this->parent; } @@ -686,7 +685,7 @@ bool32 sub_0802B234(Entity* this) { #ifndef EU Entity* sub_0802B250(Entity* this) { Entity* parent = this->parent; - if (parent && parent->next == NULL) { + if ((parent != NULL) && (parent->next == NULL)) { parent = NULL; } return parent; diff --git a/src/enemy/bombarossa.c b/src/enemy/bombarossa.c index 4004edb5..2119c5e0 100644 --- a/src/enemy/bombarossa.c +++ b/src/enemy/bombarossa.c @@ -44,7 +44,7 @@ void Bombarossa_OnCollision(BombarossaEntity* this) { switch (super->bitfield & 0x7f) { default: ent = CreateObject(OBJECT_20, 0, 0); - if (ent) { + if (ent != NULL) { CopyPosition(super, ent); } DeleteThisEntity(); diff --git a/src/enemy/bowMoblin.c b/src/enemy/bowMoblin.c index b65f1ea3..35d3b011 100644 --- a/src/enemy/bowMoblin.c +++ b/src/enemy/bowMoblin.c @@ -230,7 +230,7 @@ void sub_0803C400(BowMoblinEntity* this) { } sub_0803C6DC(this); - if (super->child) { + if (super->child != NULL) { sub_0803C714(this); } } @@ -271,7 +271,7 @@ void sub_0803C4B0(BowMoblinEntity* this) { u32 sub_0803C568(BowMoblinEntity* this) { if (this->unk_0x81 == 0) { Entity* ent = sub_08049DF4(1); - if (ent) { + if (ent != NULL) { if (this->unk_0x82 == 2) { if (sub_0806FC80(super, ent, 0x30)) { return 1; diff --git a/src/enemy/businessScrubPrologue.c b/src/enemy/businessScrubPrologue.c index f87040f3..f9701c9b 100644 --- a/src/enemy/businessScrubPrologue.c +++ b/src/enemy/businessScrubPrologue.c @@ -48,7 +48,7 @@ void BusinessScrubPrologue_OnCollision(BusinessScrubPrologueEntity* this) { super->flags &= ~ENT_COLLIDE; sub_08046030(this, 4); ent = CreateFx(super, FX_BUSH, 0); - if (ent) { + if (ent != NULL) { ent->z.HALF.HI -= 8; } @@ -123,7 +123,7 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) { sub_0804604C(this); if (super->frame & 1) { ent = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0); - if (ent) { + if (ent != NULL) { ent->parent = super; ent->direction = super->direction; super->frame &= 0xfe; @@ -186,7 +186,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) { super->subAction = 0; sub_08046030(this, 0); ent = Create0x68FX(super, FX_STARS); - if (ent) { + if (ent != NULL) { ent->spritePriority.b0 = 3; ent->z.HALF.HI -= 0xc; SetDefaultPriority(ent, PRIO_MESSAGE); @@ -299,7 +299,7 @@ void sub_08046078(BusinessScrubPrologueEntity* this) { for (index = 0; index <= 4; index++) { ent = CreateFx(super, FX_DEATH, 0x40); - if (ent) { + if (ent != NULL) { ent->x.HALF.HI = gRoomControls.origin_x + *ptr; ptr++; ent->y.HALF.HI = gRoomControls.origin_y + *ptr; @@ -315,12 +315,12 @@ void sub_08046078(BusinessScrubPrologueEntity* this) { sub_0807BA8C(0x7a7, 1); ent = CreateFx(super, FX_BIG_EXPLOSION2, 0x40); - if (ent) { + if (ent != NULL) { CopyPosition(super, ent); EnqueueSFX(SFX_184); } - if (super->child) { + if (super->child != NULL) { super->child->action = 0xff; } diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index 34094ef5..856acda5 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -552,7 +552,7 @@ void sub_0801F884(Entity* this) { this->field_0xf--; } else { Entity* ent = Create0x68FX(this, FX_LIGHTNING_STRIKE); - if (ent) { + if (ent != NULL) { ent->type2 = 64; this->action = 4; this->hitType = 165; diff --git a/src/enemy/cuccoAggr.c b/src/enemy/cuccoAggr.c index 28b32be5..5d2631df 100644 --- a/src/enemy/cuccoAggr.c +++ b/src/enemy/cuccoAggr.c @@ -295,7 +295,7 @@ void sub_080391B4(CuccoAggrEntity* this) { if (this->unk_7a) { if ((this->unk_7b++ & 0x1f) == 0) { Entity* ent = CreateEnemy(CUCCO_AGGR, 2); - if (ent) { + if (ent != NULL) { u32 rand = (Random() & 0x17); const PosOffset* ptr = &gCuccoAggrSpawnPoints[rand]; ent->x.HALF.HI = gRoomControls.scroll_x + ptr->x; @@ -321,7 +321,7 @@ void sub_08039218(CuccoAggrEntity* this) { void CuccoAggr_CreateFx(CuccoAggrEntity* this) { Entity* ent = CreateFx(super, gCuccoAggrFx[super->type], 0); - if (ent) { + if (ent != NULL) { ent->x.HALF.HI += gCuccoAggrFxHorizontalOffsets[super->spriteSettings.flipX]; } } diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index c3e84e19..3d91e7f4 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -312,7 +312,7 @@ void sub_080210E4(Entity* this) { this->frame &= ~1; ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 2); - if (ent) { + if (ent != NULL) { ent->parent = this; this->child = ent; } @@ -558,7 +558,7 @@ void sub_08021540(Entity* this) { } void sub_08021588(Entity* this) { - if (this->child) { + if (this->child != NULL) { this->child->parent = NULL; this->child = NULL; } @@ -571,7 +571,7 @@ void sub_0802159C(Entity* this) { this->frame = 0; this->hitType = 0x51; ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 3); - if (ent) { + if (ent != NULL) { ent->parent = this; this->child = ent; } @@ -592,7 +592,7 @@ void sub_08021600(Entity* this) { this->frame = 0; this->hitType = 0x51; ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 4); - if (ent) { + if (ent != NULL) { ent->parent = this; this->child = ent; } diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 4928bf84..828b3670 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -97,7 +97,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E s32 i; for (i = 1; i > -1; i--) { Entity* ent = CreateFx(this, FX_ROCK2, 0); - if (ent) { + if (ent != NULL) { ent->x.HALF.HI += 12; ent->x.HALF.HI -= diff; } diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index 43ceb90c..6e140df5 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -91,7 +91,7 @@ void sub_08045454(Entity* this) { } ent = CreateFx(this, FX_DEATH, 0); - if (ent) + if (ent != NULL) CopyPosition(this, ent); DeleteEntity(this); diff --git a/src/enemy/flyingSkull.c b/src/enemy/flyingSkull.c index 85ebe162..0374b579 100644 --- a/src/enemy/flyingSkull.c +++ b/src/enemy/flyingSkull.c @@ -141,7 +141,7 @@ void sub_08039DD8(FlyingSkullEntity* this) { super->actionDelay = 0x1e; } else { ent = CreateEnemy(STALFOS, super->type - 2); - if (ent) { + if (ent != NULL) { ent->type2 = 1; CopyPosition(super, ent); SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer); diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index 50ae9126..a97628e6 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -283,7 +283,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE do { ent = CreateEnemy(GLEEROK, 1); super->child = ent; - if (ent) { + if (ent != NULL) { ent->type2 = uvar1 + 1; super->child->collisionLayer = super->collisionLayer; super->child->x.HALF.HI = super->x.HALF.HI; @@ -301,7 +301,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE ent = CreateEnemy(GLEEROK, 2); super->child = ent; - if (ent) { + if (ent != NULL) { super->child->collisionLayer = super->collisionLayer; super->child->x.HALF.HI = super->x.HALF.HI; super->child->y.HALF.HI = super->y.HALF.HI + ((uvar1 + 1) * 12); @@ -760,7 +760,7 @@ void sub_0802DCE0(GleerokEntity* this) { if (this->unk_84->ent2->field_0xf == 0) { super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, 0); - if (super->child) { + if (super->child != NULL) { super->child->direction = this->unk_84->filler[0x15]; super->child->type2 = this->unk_84->ent2->frame & 0xf; super->child->parent = this->unk_84->ent2; @@ -827,7 +827,7 @@ void sub_0802DDD8(GleerokEntity* this) { if (this->unk_84->ent2->field_0xf == 1) { super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, r2); - if (super->child) { + if (super->child != NULL) { super->child->direction = this->unk_84->filler[0x15]; super->child->type2 = this->unk_84->ent2->frame & 0xf; super->child->parent = this->unk_84->ent2; @@ -1094,7 +1094,7 @@ void sub_0802E300(GleerokEntity* this) { InitializeAnimation(super, 0x4d); ent = CreateEnemy(GLEEROK, 5); super->child = ent; - if (super->child) { + if (super->child != NULL) { super->child->parent = super; heap->ent = super->child; ((GleerokEntity*)super->child)->unk_84 = heap; diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 5d34065a..731e24bb 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -98,7 +98,7 @@ void sub_0802BCA8(Entity* this) { this->field_0x3a = this->field_0x3a & 0xfb; this->field_0x1c = 0x12; ent = CreateEnemy(HELMASAUR, 1); - if (ent) { + if (ent != NULL) { ent->animationState = this->animationState; CopyPosition(this, ent); } @@ -356,7 +356,7 @@ void sub_0802C18C(Entity* this) { this->field_0x78.HALF.LO--; if ((this->field_0x78.HALF.LO & 7) == 0) { Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40); - if (ent) { + if (ent != NULL) { PositionRelative(this, ent, 0, Q_16_16(1.0)); } } diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index a73135cd..2e7597ee 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -113,7 +113,7 @@ void sub_08022D40(Entity* this) { } void sub_08022D90(Entity* this) { - if (this->parent->next) { + if (this->parent->next != NULL) { Entity* parent; gUnk_080CBBBC[this->action](this); diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index 03f29e2a..96a3ada3 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -42,7 +42,7 @@ NONMATCH("asm/non_matching/moldworm/Moldworm.inc", void Moldworm(Entity* this)) this->field_0x7c.BYTES.byte1 = this->field_0x7c.BYTES.byte0; EnemyFunctionHandler(this, Moldworm_Functions); } else { - if (this->parent->next) { + if (this->parent->next != NULL) { if (this->type != 8) { sub_080235BC(this); } else { @@ -191,7 +191,7 @@ void sub_08023AB0(Entity*); void sub_08023398(Entity* this) { this->field_0x7c.BYTES.byte0++; - if (this->field_0x7c.BYTES.byte3 && sub_08049FDC(this, 1) == 0) { + if (this->field_0x7c.BYTES.byte3 && !sub_08049FDC(this, 1)) { this->field_0x78.HWORD = 1; } @@ -258,7 +258,7 @@ void sub_080234D8(Entity* this) { } void sub_0802351C(Entity* this) { - if (this->actionDelay != 0 && (this->type2 == 1 || gPlayerEntity.frameIndex == 0xff)) { + if ((this->actionDelay != 0) && ((this->type2 == 1) || (gPlayerEntity.frameIndex == 0xff))) { this->actionDelay = 0; this->child->action = 3; this->child->field_0xf = this->field_0x80.HALF.LO; @@ -377,8 +377,8 @@ void sub_0802376C(Entity* this) { void sub_080237D8(Entity* this) { Entity* parent = this->parent; - if (parent->animIndex == 0x17 && this->actionDelay != 0 && this->x.HALF.HI == parent->x.HALF.HI && - this->y.HALF.HI == parent->y.HALF.HI) { + if ((parent->animIndex == 0x17) && (this->actionDelay != 0) && (this->x.HALF.HI == parent->x.HALF.HI) && + (this->y.HALF.HI == parent->y.HALF.HI)) { this->action = 1; COLLISION_OFF(this); this->spriteSettings.draw = 0; @@ -501,7 +501,7 @@ void sub_08023AB0(Entity* this) { if (this->field_0x7a.HALF.HI == 8) { if (this->field_0x7c.BYTES.byte2) { this->field_0x7c.BYTES.byte2--; - } else if (!sub_08023B38(this) || 0x1d >= this->field_0x78.HWORD) { + } else if (!sub_08023B38(this) || (this->field_0x78.HWORD <= 0x1D)) { this->hitType = 0x85; this->field_0x7a.HALF.HI = 0; this->field_0x7c.BYTES.byte2 = 30; diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index a205d1d6..85ed9aaa 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -129,7 +129,7 @@ void Octorok_ShootNut(Entity* this) { GetNextFrame(this); if (this->frame & 1) { Entity* ent = CreateProjectileWithParent(this, ROCK_PROJECTILE, 0); - if (ent) { + if (ent != NULL) { const s8* off; ent->direction = this->direction; off = &gOctorokNutOffset[this->direction / 4]; diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index c5b944f7..d69fefd0 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -495,7 +495,7 @@ void OctorokBoss_Action1(OctorokBossEntity* this) { sub_08036914(super, angle, radius); this->angle.HALF.HI = -((OctorokBossEntity*)super->parent)->angle.HALF.HI; } - if (IS_FROZEN((OctorokBossEntity*)super->parent) == 0) { + if (!IS_FROZEN((OctorokBossEntity*)super->parent)) { super->spriteSettings.draw |= 1; } break; diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index dc15dbb6..93452e64 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -54,7 +54,7 @@ void Peahat_OnCollision(Entity* this) { if (this->field_0x82.HALF.LO) { if (this->bitfield == 0x94) { Entity* ent = CreateEnemy(PEAHAT, PeahatForm_Propeller); - if (ent) { + if (ent != NULL) { CopyPosition(this, ent); ent->z.HALF.HI -= 8; } diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 7882e8e8..210d8b41 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -171,7 +171,7 @@ void sub_080240B8(Entity* this) { this->field_0x82.HALF.HI = 0; ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); - if (ent) { + if (ent != NULL) { this->child = ent; ent->parent = this; ent->y.HALF.HI += 0x10; @@ -414,7 +414,7 @@ void sub_080244E8(Entity* this) { this->field_0x78.HWORD -= 0xe; ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); - if (ent) { + if (ent != NULL) { ent->parent = this; ent->z.HALF.HI += 0xe; ent->child = this->child; @@ -437,7 +437,7 @@ void sub_080244E8(Entity* this) { this->field_0x78.HWORD -= 0xe; ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); - if (ent) { + if (ent != NULL) { ent->parent = this; ent->z.HALF.HI += 0xe; this->child = ent; @@ -662,7 +662,7 @@ bool32 sub_08024B38(Entity* this) { } ent = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); - if (ent) { + if (ent != NULL) { do { if (ent->action != 2 && ent->z.HALF.HI == 0 && sub_08049F1C(this, ent, 0xa0)) { iVar4 = 1; @@ -679,7 +679,7 @@ bool32 sub_08024B38(Entity* this) { } ent = FindEntityByID(OBJECT, POT, 6); - if (ent) { + if (ent != NULL) { do { if (ent->action == 1 && sub_08049F1C(this, ent, 0xa0)) { iVar4 = 1; diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 76f4858b..3b080dd8 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -529,12 +529,12 @@ void sub_08025AE8(Entity* this) { Entity* ent; ent = CreateFx(this, FX_BROWN_SMOKE, 0); - if (ent) { + if (ent != NULL) { ent->y.WORD--; } ent = CreateFx(this, FX_BROWN_SMOKE_LARGE, 0); - if (ent) { + if (ent != NULL) { ent->y.WORD++; } } @@ -553,7 +553,7 @@ void sub_08025B18(Entity* this) { sub_08025AB8((((x + offset[0]) >> 4) & 0x3fU) | ((((y + offset[1]) >> 4) & 0x3fU) << 6), layer); ent = CreateObject(OBJECT_21, 2, 0); - if (ent) { + if (ent != NULL) { PositionRelative(this, ent, Q_16_16(offset[0]), Q_16_16(offset[1])); ent->x.HALF.HI &= -0x10; ent->x.HALF.HI += 8; @@ -567,7 +567,7 @@ void sub_08025B18(Entity* this) { void sub_08025BD4(Entity* this) { if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) { Entity* ent = CreateObject(OBJECT_21, 0, 0); - if (ent) { + if (ent != NULL) { PositionRelative(this, ent, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]), Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 1])); ent->z.HALF.HI = -10; diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index 22746a16..9f118b2b 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -45,7 +45,7 @@ void RockChuchu_OnCollision(Entity* this) { case 0x1c: CreateFx(this, FX_ROCK, 0); ent = CreateEnemy(CHUCHU, 1); - if (ent) { + if (ent != NULL) { ent->type2 = 1; #ifndef EU ent->iframes = -8; @@ -100,7 +100,7 @@ void sub_080223E4(Entity* this) { Entity* ent; ent = this->child; - if (ent) { + if (ent != NULL) { ent->bitfield = 0x94; ent->iframes = 0x10; #ifndef EU diff --git a/src/enemy/scissorsBeetle.c b/src/enemy/scissorsBeetle.c index 29fddd38..66914591 100644 --- a/src/enemy/scissorsBeetle.c +++ b/src/enemy/scissorsBeetle.c @@ -64,7 +64,7 @@ void ScissorsBeetle_OnGrabbed(ScissorsBeetleEntity* this) { void ScissorsBeetle_Init(ScissorsBeetleEntity* this) { Entity* ent = CreateProjectile(MANDIBLES_PROJECTILE); - if (!ent) + if (ent == NULL) return; sub_0804A720(super); diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 1cf982a0..ddae5cb9 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -114,7 +114,7 @@ void sub_080450A8(Entity* this) { } ent = CreateFx(this, FX_DEATH, 0); - if (ent) + if (ent != NULL) CopyPosition(this, ent); DeleteEntity(this); diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index 06d27af1..759a3c5c 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -132,7 +132,7 @@ void sub_08023CE0(Entity* this) { if (this->frame) { if (this->frame & ANIM_DONE) { Entity* ent = CreateEnemy(SLUGGULA, 1); - if (ent) { + if (ent != NULL) { sub_0804A4E4(this, ent); DeleteThisEntity(); } @@ -163,7 +163,7 @@ void sub_08023E54(Entity* this) { if (this->field_0xf++ > 27) { this->field_0xf = 0; ent = CreateEnemy(SLUGGULA, 2); - if (ent) { + if (ent != NULL) { const s8* ptr = &gUnk_080CBDF7[this->animationState * 2]; PositionRelative(this, ent, Q_16_16(ptr[0]), Q_16_16(ptr[1])); } diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 7a977440..32cb9345 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -31,7 +31,7 @@ void Spark_OnCollision(Entity* this) { this->spriteSettings.draw = 0; this->action = 2; ent = CreateFx(this, FX_DEATH, 0); - if (ent) { + if (ent != NULL) { this->child = ent; this->actionDelay = 14; CopyPosition(this, ent); @@ -122,7 +122,7 @@ void sub_0802B35C(Entity* this) { void sub_0802B4A8(Entity* this) { if (--this->actionDelay == 0) { Entity* ent = CreateObjectWithParent(this, GROUND_ITEM, 0x60, 0); - if (ent) { + if (ent != NULL) { ent->y.HALF.HI -= 4; } DeleteEntity(this); diff --git a/src/enemy/takkuri.c b/src/enemy/takkuri.c index a07b8330..64c61158 100644 --- a/src/enemy/takkuri.c +++ b/src/enemy/takkuri.c @@ -132,7 +132,7 @@ void sub_0803BD08(TakkuriEntity* this) { sub_0803BEE8(this); GetNextFrame(super); ent = sub_08049DF4(1); - if (ent) { + if (ent != NULL) { if (EntityInRectRadius(super, gUnk_020000B0, 0x88, 0x50)) { if (gUnk_020000B0->y.HALF.HI > super->y.HALF.HI + 8) { super->action = 2; @@ -306,7 +306,7 @@ void sub_0803C0AC(Entity* this) { u32 index, rupeeType, rupees; Entity* ent; ent = sub_08049DF4(1); - if (!ent) + if (ent == NULL) return; rupees = gSave.stats.rupees; diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index 629c54cd..2b390879 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -34,7 +34,7 @@ void sub_0802A250(Entity* this) { UpdateSpriteForCollisionLayer(this); ent = CreateObject(OBJECT_66, 0, 0); - if (ent) { + if (ent != NULL) { ent->parent = this; } } |
