Fix a lot of pointer comparisons to 0 (or nothing) to explicitly use NULL

This commit is contained in:
Elliptic Ellipsis
2022-03-25 05:34:53 +00:00
parent 481079092c
commit 2d37348cb6
42 changed files with 117 additions and 109 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ void sub_0809CC74(Entity* this) {
/* Create steam clouds */
for (i = 0; i < 3; i++) {
ent = CreateObject(BAKER_OVEN, 1, i);
if (ent) {
if (ent != NULL) {
ent->parent = this;
PositionRelative(this, ent, 16 * Q_16_16((i + 1) / 2) - Q_16_16(8.0), Q_16_16(-14.0));
}
+3 -3
View File
@@ -105,7 +105,7 @@ void sub_08088BE0(BigBarrelEntity* this) {
if (CheckLocalFlag(0x15) == 0) {
sub_08088C78(this, 2, 0, 0xffffff88);
ent = sub_08088C78(this, 4, 0x15, 0);
if (ent) {
if (ent != NULL) {
ent->x.HALF.HI = gRoomControls.origin_x + 0x48;
ent->y.HALF.HI = gRoomControls.origin_y + 200;
}
@@ -114,7 +114,7 @@ void sub_08088BE0(BigBarrelEntity* this) {
if (CheckLocalFlag(0x16) == 0) {
sub_08088C78(this, 2, 1, 0x78);
ent = sub_08088C78(this, 4, 0x16, 0);
if (ent) {
if (ent != NULL) {
ent->x.HALF.HI = gRoomControls.origin_x + 0x188;
ent->y.HALF.HI = gRoomControls.origin_y + 200;
}
@@ -249,7 +249,7 @@ void sub_08088E74(BigBarrelEntity* this) {
} else {
if ((gRoomTransition.frameCount & 7U) == 0) {
ent = CreateObjectWithParent(super, OBJECT_2A, 0, 0x1e);
if (ent) {
if (ent != NULL) {
ent->updatePriority = 3;
ent->spriteRendering.b3 = 0;
ent->spritePriority.b0 = 0;
+1 -1
View File
@@ -242,7 +242,7 @@ u32 sub_08081F7C(Entity* this, u32 r7) {
if (this->actionDelay == 0)
return 1;
if (--this->actionDelay > 6) {
if (this->child)
if (this->child != NULL)
this->child->spriteOffsetY = -4;
} else {
if (this->actionDelay == 6) {
+2 -2
View File
@@ -252,7 +252,7 @@ void sub_0808EABC(Entity* this) {
void sub_0808EB74(Entity* this) {
Entity* entity = sub_0808EC80(gMapDataBottomSpecial.unk6);
if (entity) {
if (entity != NULL) {
this->x.WORD = entity->x.WORD;
this->y.WORD = entity->y.WORD;
this->spriteRendering.b3 = entity->spriteRendering.b3;
@@ -305,7 +305,7 @@ void sub_0808EBB8(Entity* this) {
// Fall through
default:
entity = sub_0808EC80(var0);
if (entity) {
if (entity != NULL) {
SortEntityBelow(entity, this);
this->spriteRendering.b3 = entity->spriteRendering.b3;
x = entity->x.HALF.HI;
+2 -2
View File
@@ -53,7 +53,7 @@ void sub_080866D8(Entity* this) {
if ((*((u32*)(&this->field_0x68)) & mask) == 0 && sub_080867CC(prop->unk5) &&
CheckRegionOnScreen(prop->unk0, prop->unk2, 32, 32)) {
entity = CreateObject(HOUSE_DOOR_EXT, prop->unk7, prop->unk6);
if (entity) {
if (entity != NULL) {
entity->field_0x6c.HALF.LO = i;
entity->x.HALF.HI = gRoomControls.origin_x + prop->unk0 + 16;
entity->y.HALF.HI = gRoomControls.origin_y + prop->unk2 + 32;
@@ -157,7 +157,7 @@ static void sub_080868EC(Entity* entity, unk_80868EC* arg1) {
void sub_0808692C(Entity* this) {
this->flags &= ~ENT_SCRIPTED;
this->type2 = 2;
this->action = this->frameIndex == 0 ? 1 : 2;
this->action = (this->frameIndex == 0) ? 1 : 2;
this->subAction = 0;
this->actionDelay = 8;
}
+4 -4
View File
@@ -195,7 +195,7 @@ void sub_0808F3DC(Entity* this) {
if (this->type == 5 && (this->frame & 1)) {
Entity* entity = CreateObjectWithParent(this->child, 0x49, 8, 0);
if (entity) {
if (entity != NULL) {
entity->parent = this->parent;
entity->child = this->parent->parent;
}
@@ -262,19 +262,19 @@ void sub_0808F554(Entity* this) {
void sub_0808F5EC(Entity* this) {
Entity* entity = CreateObjectWithParent(this->child, 0x49, 5, 0);
if (entity) {
if (entity != NULL) {
entity->parent = this;
entity->child = this->child;
}
entity = CreateObjectWithParent(this->child, 0x49, 6, 0);
if (entity) {
if (entity != NULL) {
entity->parent = this;
entity->child = this->child;
}
entity = CreateObjectWithParent(this->child, 0x49, 7, 0);
if (entity) {
if (entity != NULL) {
entity->parent = this;
entity->child = this->child;
}
+1 -1
View File
@@ -283,7 +283,7 @@ u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) {
break;
default:
entity = CreateObjectWithParent(this, GROUND_ITEM, form, arg2);
if (entity) {
if (entity != NULL) {
if (arg3 == 2) {
entity->actionDelay = 5;
entity->field_0x86.HWORD = this->field_0x86.HWORD;