1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 22:44:30 +00:00

Remove many redundant parentheses (eg. in boolean conditions) (#1220)

* Remove many unnecessary parens around boolean conditions

* Remove duplicate parens in some expressions

* Apply review suggestions

* Update src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
This commit is contained in:
Roman971 2022-05-12 15:04:37 +02:00 committed by GitHub
parent c799176a30
commit 92aef346f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 67 additions and 67 deletions

View file

@ -716,7 +716,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
: (setscissor.pad == G_SC_EVEN_INTERLACE) ? "G_SC_EVEN_INTERLACE"
: "???";
if ((setscissor.x0frac | setscissor.y0frac | setscissor.x1frac | setscissor.y1frac)) {
if (setscissor.x0frac | setscissor.y0frac | setscissor.x1frac | setscissor.y1frac) {
if (1) {}
DISAS_LOG("gsDPSetScissorFrac(%s, %d, %d, %d, %d),", modeStr,
(setscissor.x0 << 2) + setscissor.x0frac, (setscissor.y0 << 2) + setscissor.y0frac,
@ -1189,7 +1189,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
} break;
case G_MV_LIGHT: {
switch ((movemem.offset * 8)) {
switch (movemem.offset * 8) {
case G_MVO_LOOKATX: {
DISAS_LOG("gsSPLookAtX(0x%08x),", movemem.data);
} break;

View file

@ -353,7 +353,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) {
func_8002BE64(targetCtx, targetCtx->unk_4C, projTargetCenter.x, projTargetCenter.y, projTargetCenter.z);
if ((!(player->stateFlags1 & PLAYER_STATE1_6)) || (actor != player->unk_664)) {
if (!(player->stateFlags1 & PLAYER_STATE1_6) || (actor != player->unk_664)) {
OVERLAY_DISP = Gfx_CallSetupDL(OVERLAY_DISP, 0x39);
for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) {
@ -3888,7 +3888,7 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) {
Player* player = GET_PLAYER(globalCtx);
f32 var;
if ((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) {
if ((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) {
var = Math_Vec3f_DistXYZ(&actor->world.pos, &globalCtx->view.eye) * 0.25f;
} else {
var = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos);
@ -5550,7 +5550,7 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar
actor->focus.pos = actor->world.pos;
actor->focus.pos.y += arg4;
if (!(((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) &&
if (!(((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) &&
(gSaveContext.entranceIndex == ENTR_SPOT04_0))) {
var = actor->yawTowardsPlayer - actor->shape.rot.y;
abs_var = ABS(var);
@ -5560,7 +5560,7 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar
}
}
if (((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) &&
if (((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) &&
(gSaveContext.entranceIndex == ENTR_SPOT04_0)) {
sp2C = globalCtx->view.eye;
} else {
@ -5581,7 +5581,7 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar
actor->focus.pos = arg4;
if (!(((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) &&
if (!(((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) &&
(gSaveContext.entranceIndex == ENTR_SPOT04_0))) {
var = actor->yawTowardsPlayer - actor->shape.rot.y;
abs_var = ABS(var);
@ -5591,7 +5591,7 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar
}
}
if (((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) &&
if (((globalCtx->csCtx.state != CS_STATE_IDLE) || gDbgCamEnabled) &&
(gSaveContext.entranceIndex == ENTR_SPOT04_0)) {
sp24 = globalCtx->view.eye;
} else {

View file

@ -2920,7 +2920,7 @@ void func_8003F8EC(GlobalContext* globalCtx, DynaCollisionContext* dyna, Actor*
s32 i;
for (i = 0; i < BG_ACTOR_MAX; i++) {
if ((dyna->bgActorFlags[i] & 1)) {
if (dyna->bgActorFlags[i] & 1) {
dynaActor = DynaPoly_GetActor(&globalCtx->colCtx, i);
if (dynaActor != NULL && &dynaActor->actor == actor) {
func_800434A0((DynaPolyActor*)actor);
@ -4245,7 +4245,7 @@ s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec
if (!(room == globalCtx->roomCtx.curRoom.num || room == 0x3F)) {
continue;
}
if ((waterBox->properties & 0x80000)) {
if (waterBox->properties & 0x80000) {
continue;
}
if (!(waterBox->xMin < pos->x && pos->x < waterBox->xMin + waterBox->xLength)) {

View file

@ -1604,7 +1604,7 @@ s32 Camera_Normal1(Camera* camera) {
}
Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment);
if ((camera->status == CAM_STAT_ACTIVE) && (!(roData->interfaceFlags & 0x10))) {
if ((camera->status == CAM_STAT_ACTIVE) && !(roData->interfaceFlags & 0x10)) {
rwData->swingYawTarget = BINANG_ROT180(camera->playerPosRot.rot.y);
if (rwData->startSwingTimer > 0) {
func_80046E20(camera, &eyeAdjustment, roData->distMin, roData->unk_0C, &sp98, &rwData->swing);
@ -4881,7 +4881,7 @@ s32 Camera_Unique0(Camera* camera) {
if (rwData->animTimer > 0) {
rwData->animTimer--;
rwData->initalPos = playerPosRot->pos;
} else if ((!(player->stateFlags1 & PLAYER_STATE1_29)) &&
} else if (!(player->stateFlags1 & PLAYER_STATE1_29) &&
((OLib_Vec3fDistXZ(&playerPosRot->pos, &rwData->initalPos) >= 10.0f) ||
CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_A) ||
CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_B) ||
@ -4909,7 +4909,7 @@ s32 Camera_Unique0(Camera* camera) {
rwData->initalPos = playerPosRot->pos;
}
if ((!(player->stateFlags1 & PLAYER_STATE1_29)) &&
if (!(player->stateFlags1 & PLAYER_STATE1_29) &&
((0.001f < camera->xzSpeed) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_A) ||
CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_B) ||
CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_CLEFT) ||
@ -7444,7 +7444,7 @@ Vec3s Camera_Update(Camera* camera) {
camera->nextCamDataIdx = -1;
}
if ((camera->unk_14C & 1) && (camera->unk_14C & 4) && (!(camera->unk_14C & 0x400)) &&
if ((camera->unk_14C & 1) && (camera->unk_14C & 4) && !(camera->unk_14C & 0x400) &&
(!(camera->unk_14C & 0x200) || (player->currentBoots == PLAYER_BOOTS_IRON)) &&
(!(camera->unk_14C & (s16)0x8000)) && (playerGroundY != BGCHECK_Y_MIN)) {
camDataIdx = Camera_GetDataIdxForPoly(camera, &bgId, playerFloorPoly);
@ -7833,7 +7833,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) {
return -99;
}
if ((setting == camera->setting) && (!(flags & 1))) {
if ((setting == camera->setting) && !(flags & 1)) {
camera->unk_14A |= 0x10;
if (!(flags & 2)) {
camera->unk_14A |= 1;

View file

@ -67,7 +67,7 @@ void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) {
i = 0;
bufText = buf->text;
while ((*bufText++ = *text++)) {
while ((*bufText++ = *text++) != '\0') {
if (i++ > 0x14) {
break;
}

View file

@ -3711,7 +3711,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
} else if (gSaveContext.timer2Value > 10) {
if ((timerDigits[4] & 1)) {
if (timerDigits[4] & 1) {
Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_N, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);

View file

@ -1043,7 +1043,7 @@ skip:
LOG_NUM("1", 1, "../z_play.c", 3801);
}
if ((sp80 == 0) || (gDbgCamEnabled)) {
if ((sp80 == 0) || gDbgCamEnabled) {
s32 pad3[5];
s32 i;

View file

@ -56,7 +56,7 @@ void ViMode_Configure(ViMode* viMode, s32 mode, s32 type, s32 unk_70, s32 unk_74
unk_top &= ~1;
unk_bottom &= ~1;
yScaleLo = (cond_4C ? 2 : 1) * (((height << 11)) / (SCREEN_HEIGHT * 2 + unk_bottom - unk_top) / (unk_70 ? 1 : 2));
yScaleLo = (cond_4C ? 2 : 1) * ((height << 11) / (SCREEN_HEIGHT * 2 + unk_bottom - unk_top) / (unk_70 ? 1 : 2));
yScaleHi0 = not_78 ? (cond_40 ? 0x1000000 : 0x2000000) : 0;
yScaleHi1 = not_78 ? (cond_40 ? 0x3000000 : 0x2000000) : 0;