diff --git a/src/animation.cc b/src/animation.cc index 2176856..1208ed2 100644 --- a/src/animation.cc +++ b/src/animation.cc @@ -660,8 +660,8 @@ int animationRegisterRunToObject(Object* owner, Object* destination, int actionP animationDescription->owner = owner; animationDescription->destination = destination; - if (FID_TYPE(owner->fid) == OBJ_TYPE_CRITTER && (owner->data.critter.combat.results & DAM_CRIP_LEG_ANY) - || owner == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING) + if ((FID_TYPE(owner->fid) == OBJ_TYPE_CRITTER && (owner->data.critter.combat.results & DAM_CRIP_LEG_ANY) != 0) + || (owner == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING)) || !artExists(buildFid(FID_TYPE(owner->fid), owner->fid & 0xFFF, ANIM_RUNNING, 0, owner->rotation + 1))) { animationDescription->anim = ANIM_WALK; } else { @@ -761,8 +761,8 @@ int animationRegisterRunToTile(Object* owner, int tile, int elevation, int actio animationDescription->tile = tile; animationDescription->elevation = elevation; - if (FID_TYPE(owner->fid) == OBJ_TYPE_CRITTER && (owner->data.critter.combat.results & DAM_CRIP_LEG_ANY) - || owner == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING) + if ((FID_TYPE(owner->fid) == OBJ_TYPE_CRITTER && (owner->data.critter.combat.results & DAM_CRIP_LEG_ANY) != 0) + || (owner == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING)) || !artExists(buildFid(FID_TYPE(owner->fid), owner->fid & 0xFFF, ANIM_RUNNING, 0, owner->rotation + 1))) { animationDescription->anim = ANIM_WALK; } else { @@ -2604,7 +2604,7 @@ static void _object_move(int index) int rotation = sad->rotations[sad->field_20]; int y = dword_51D984[rotation]; int x = _off_tile[rotation]; - if (x > 0 && x <= object->x || x < 0 && x >= object->x || y > 0 && y <= object->y || y < 0 && y >= object->y) { + if ((x > 0 && x <= object->x) || (x < 0 && x >= object->x) || (y > 0 && y <= object->y) || (y < 0 && y >= object->y)) { x = object->x - x; y = object->y - y; diff --git a/src/art.cc b/src/art.cc index fab0165..80b5420 100644 --- a/src/art.cc +++ b/src/art.cc @@ -1048,8 +1048,8 @@ int buildFid(int objectType, int frmId, int animType, int a3, int rotation) goto zero; } - v7 = ((a3 << 12) & 0xF000) | (animType << 16) & 0xFF0000 | 0x1000000; - v8 = (rotation << 28) & 0x70000000 | v7; + v7 = ((a3 << 12) & 0xF000) | ((animType << 16) & 0xFF0000) | 0x1000000; + v8 = ((rotation << 28) & 0x70000000) | v7; v9 = frmId & 0xFFF; if (artExists(v9 | v8) != 0) { @@ -1071,7 +1071,7 @@ zero: out: - return (v10 << 28) & 0x70000000 | (objectType << 24) | (animType << 16) & 0xFF0000 | (a3 << 12) & 0xF000 | frmId & 0xFFF; + return ((v10 << 28) & 0x70000000) | (objectType << 24) | ((animType << 16) & 0xFF0000) | ((a3 << 12) & 0xF000) | (frmId & 0xFFF); } // 0x419D60 diff --git a/src/combat.cc b/src/combat.cc index 4c6740e..a5b2b56 100644 --- a/src/combat.cc +++ b/src/combat.cc @@ -3472,7 +3472,7 @@ static int _shoot_along_path(Attack* attack, int a2, int a3, int anim) Object* critter = attack->attacker; while (critter != NULL) { - if (v5 <= 0 && anim != ANIM_FIRE_CONTINUOUS || v7 == a2 || attack->extrasLength >= 6) { + if ((v5 <= 0 && anim != ANIM_FIRE_CONTINUOUS) || v7 == a2 || attack->extrasLength >= 6) { break; } @@ -3619,7 +3619,7 @@ static int _compute_spray(Attack* attack, int accuracy, int* a3, int* a4, int an int v28 = _tile_num_beyond(attack->attacker->tile, v26, range); *a3 += _shoot_along_path(attack, v28, v30, anim); - if (roll != ROLL_FAILURE || *a3 <= 0 && attack->extrasLength <= 0) { + if (roll != ROLL_FAILURE || (*a3 <= 0 && attack->extrasLength <= 0)) { if (roll >= ROLL_SUCCESS && *a3 == 0 && attack->extrasLength == 0) { roll = ROLL_FAILURE; } @@ -4670,7 +4670,7 @@ static void _damage_object(Object* a1, int damage, bool animated, int a4, Object if (a1 != gDude) { Object* whoHitMe = a1->data.critter.combat.whoHitMe; - if (whoHitMe == gDude || whoHitMe != NULL && whoHitMe->data.critter.combat.team == gDude->data.critter.combat.team) { + if (whoHitMe == gDude || (whoHitMe != NULL && whoHitMe->data.critter.combat.team == gDude->data.critter.combat.team)) { bool scriptOverrides = false; Script* scr; if (scriptGetScript(a1->sid, &scr) != -1) { diff --git a/src/combat_ai.cc b/src/combat_ai.cc index f33ecc1..5958fe3 100644 --- a/src/combat_ai.cc +++ b/src/combat_ai.cc @@ -1045,7 +1045,7 @@ static int _ai_check_drugs(Object* critter) critter->data.critter.combat.ap -= 2; } - if (ai->chem_use == CHEM_USE_SOMETIMES || ai->chem_use == CHEM_USE_ANYTIME && v29 >= 2) { + if (ai->chem_use == CHEM_USE_SOMETIMES || (ai->chem_use == CHEM_USE_ANYTIME && v29 >= 2)) { break; } } @@ -1054,7 +1054,7 @@ static int _ai_check_drugs(Object* critter) } } - if (v3 != NULL || !v28 && v25 == 1) { + if (v3 != NULL || (!v28 && v25 == 1)) { do { if (v3 == NULL) { v3 = _ai_search_environ(critter, ITEM_TYPE_DRUG); @@ -1325,7 +1325,7 @@ static Object* _ai_find_nearest_team(Object* a1, Object* a2, int a3) for (i = 0; i < _curr_crit_num; i++) { obj = _curr_crit_list[i]; - if (a1 != obj && !(obj->data.critter.combat.results & 0x80) && ((a3 & 0x02) && a2->data.critter.combat.team != obj->data.critter.combat.team || (a3 & 0x01) && a2->data.critter.combat.team == obj->data.critter.combat.team)) { + if (a1 != obj && !(obj->data.critter.combat.results & 0x80) && (((a3 & 0x02) && a2->data.critter.combat.team != obj->data.critter.combat.team) || ((a3 & 0x01) && a2->data.critter.combat.team == obj->data.critter.combat.team))) { return obj; } } @@ -1353,8 +1353,8 @@ static Object* _ai_find_nearest_team_in_combat(Object* a1, Object* a2, int a3) Object* obj = _curr_crit_list[index]; if (obj != a1 && (obj->data.critter.combat.results & DAM_DEAD) == 0 - && ((a3 & 0x02) != 0 && team != obj->data.critter.combat.team - || (a3 & 0x01) != 0 && team == obj->data.critter.combat.team)) { + && (((a3 & 0x02) != 0 && team != obj->data.critter.combat.team) + || ((a3 & 0x01) != 0 && team == obj->data.critter.combat.team))) { if (obj->data.critter.combat.whoHitMe != NULL) { return obj; } diff --git a/src/critter.cc b/src/critter.cc index 92910da..abdbb25 100644 --- a/src/critter.cc +++ b/src/critter.cc @@ -967,8 +967,8 @@ bool _critter_is_prone(Object* critter) int anim = FID_ANIM_TYPE(critter->fid); return (critter->data.critter.combat.results & (DAM_KNOCKED_OUT | DAM_KNOCKED_DOWN)) != 0 - || anim >= FIRST_KNOCKDOWN_AND_DEATH_ANIM && anim <= LAST_KNOCKDOWN_AND_DEATH_ANIM - || anim >= FIRST_SF_DEATH_ANIM && anim <= LAST_SF_DEATH_ANIM; + || (anim >= FIRST_KNOCKDOWN_AND_DEATH_ANIM && anim <= LAST_KNOCKDOWN_AND_DEATH_ANIM) + || (anim >= FIRST_SF_DEATH_ANIM && anim <= LAST_SF_DEATH_ANIM); } // critter_body_type @@ -1264,7 +1264,7 @@ int _critter_set_who_hit_me(Object* a1, Object* a2) } if (PID_TYPE(a1->pid) == OBJ_TYPE_CRITTER) { - if (a2 == NULL || a1->data.critter.combat.team != a2->data.critter.combat.team || statRoll(a1, STAT_INTELLIGENCE, -1, NULL) < 2 && (!objectIsPartyMember(a1) || !objectIsPartyMember(a2))) { + if (a2 == NULL || a1->data.critter.combat.team != a2->data.critter.combat.team || (statRoll(a1, STAT_INTELLIGENCE, -1, NULL) < 2 && (!objectIsPartyMember(a1) || !objectIsPartyMember(a2)))) { a1->data.critter.combat.whoHitMe = a2; if (a2 == gDude) { reactionSetValue(a1, -3); diff --git a/src/game_movie.cc b/src/game_movie.cc index 91b2f1e..1376667 100644 --- a/src/game_movie.cc +++ b/src/game_movie.cc @@ -258,7 +258,7 @@ int gameMoviePlay(int movie, int flags) _mouse_get_raw_state(&x, &y, &buttons); v11 |= buttons; - } while ((v11 & 1) == 0 && (v11 & 2) == 0 || (buttons & 1) != 0 || (buttons & 2) != 0); + } while (((v11 & 1) == 0 && (v11 & 2) == 0) || (buttons & 1) != 0 || (buttons & 2) != 0); _movieStop(); _moviefx_stop(); diff --git a/src/graph_lib.cc b/src/graph_lib.cc index 154fc9f..5ef0deb 100644 --- a/src/graph_lib.cc +++ b/src/graph_lib.cc @@ -108,7 +108,7 @@ int graphCompress(unsigned char* a1, unsigned char* a2, int a3) int v11 = v36 + 1; if (_match_length > 2) { v29[v36 + 1] = _match_position; - v29[v36 + 2] = ((_match_length - 3) | (_match_position >> 4) & 0xF0); + v29[v36 + 2] = ((_match_length - 3) | ((_match_position >> 4) & 0xF0)); v36 = v11 + 1; } else { _match_length = 1; diff --git a/src/loadsave.cc b/src/loadsave.cc index 1987489..ca66988 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -987,7 +987,7 @@ int lsgLoadGame(int mode) int v45 = _get_time(); int v44 = v109 + 1; - if (v106 == 0 && v44 == 1 || v106 == 1 && v109 > 14.4) { + if ((v106 == 0 && v44 == 1) || (v106 == 1 && v109 > 14.4)) { v106 = 1; if (v109 > 14.4) { diff --git a/src/map.cc b/src/map.cc index c118cd8..66cba32 100644 --- a/src/map.cc +++ b/src/map.cc @@ -1570,7 +1570,7 @@ static void _square_reset() // check subsequent calls. int fid = *p; fid &= ~0xFFFF; - *p = ((buildFid(OBJ_TYPE_TILE, 1, 0, 0, 0) & 0xFFF | (((fid >> 16) & 0xF000) >> 12)) << 16) | (fid & 0xFFFF); + *p = (((buildFid(OBJ_TYPE_TILE, 1, 0, 0, 0) & 0xFFF) | (((fid >> 16) & 0xF000) >> 12)) << 16) | (fid & 0xFFFF); fid = *p; int v3 = (fid & 0xF000) >> 12; diff --git a/src/pipboy.cc b/src/pipboy.cc index 362913f..5a502c1 100644 --- a/src/pipboy.cc +++ b/src/pipboy.cc @@ -939,7 +939,7 @@ static void pipboyWindowHandleStatus(int a1) return; } - if (gPipboyMouseX > 459 && a1 != 1027 || a1 == 1026) { + if ((gPipboyMouseX > 459 && a1 != 1027) || a1 == 1026) { if (gPipboyHolodiskLastPage <= _view_page) { if (a1 != 1026) { soundPlayFile("ib1p1xx1");