Fix parentesis warnings

This commit is contained in:
Alexander Batalov 2022-08-01 19:47:09 +03:00
parent 2c69834a12
commit 28a433ea76
10 changed files with 24 additions and 24 deletions

View File

@ -660,8 +660,8 @@ int animationRegisterRunToObject(Object* owner, Object* destination, int actionP
animationDescription->owner = owner; animationDescription->owner = owner;
animationDescription->destination = destination; animationDescription->destination = destination;
if (FID_TYPE(owner->fid) == OBJ_TYPE_CRITTER && (owner->data.critter.combat.results & DAM_CRIP_LEG_ANY) 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) || (owner == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING))
|| !artExists(buildFid(FID_TYPE(owner->fid), owner->fid & 0xFFF, ANIM_RUNNING, 0, owner->rotation + 1))) { || !artExists(buildFid(FID_TYPE(owner->fid), owner->fid & 0xFFF, ANIM_RUNNING, 0, owner->rotation + 1))) {
animationDescription->anim = ANIM_WALK; animationDescription->anim = ANIM_WALK;
} else { } else {
@ -761,8 +761,8 @@ int animationRegisterRunToTile(Object* owner, int tile, int elevation, int actio
animationDescription->tile = tile; animationDescription->tile = tile;
animationDescription->elevation = elevation; animationDescription->elevation = elevation;
if (FID_TYPE(owner->fid) == OBJ_TYPE_CRITTER && (owner->data.critter.combat.results & DAM_CRIP_LEG_ANY) 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) || (owner == gDude && dudeHasState(0) && !perkGetRank(gDude, PERK_SILENT_RUNNING))
|| !artExists(buildFid(FID_TYPE(owner->fid), owner->fid & 0xFFF, ANIM_RUNNING, 0, owner->rotation + 1))) { || !artExists(buildFid(FID_TYPE(owner->fid), owner->fid & 0xFFF, ANIM_RUNNING, 0, owner->rotation + 1))) {
animationDescription->anim = ANIM_WALK; animationDescription->anim = ANIM_WALK;
} else { } else {
@ -2604,7 +2604,7 @@ static void _object_move(int index)
int rotation = sad->rotations[sad->field_20]; int rotation = sad->rotations[sad->field_20];
int y = dword_51D984[rotation]; int y = dword_51D984[rotation];
int x = _off_tile[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; x = object->x - x;
y = object->y - y; y = object->y - y;

View File

@ -1048,8 +1048,8 @@ int buildFid(int objectType, int frmId, int animType, int a3, int rotation)
goto zero; goto zero;
} }
v7 = ((a3 << 12) & 0xF000) | (animType << 16) & 0xFF0000 | 0x1000000; v7 = ((a3 << 12) & 0xF000) | ((animType << 16) & 0xFF0000) | 0x1000000;
v8 = (rotation << 28) & 0x70000000 | v7; v8 = ((rotation << 28) & 0x70000000) | v7;
v9 = frmId & 0xFFF; v9 = frmId & 0xFFF;
if (artExists(v9 | v8) != 0) { if (artExists(v9 | v8) != 0) {
@ -1071,7 +1071,7 @@ zero:
out: 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 // 0x419D60

View File

@ -3472,7 +3472,7 @@ static int _shoot_along_path(Attack* attack, int a2, int a3, int anim)
Object* critter = attack->attacker; Object* critter = attack->attacker;
while (critter != NULL) { 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; 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); int v28 = _tile_num_beyond(attack->attacker->tile, v26, range);
*a3 += _shoot_along_path(attack, v28, v30, anim); *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) { if (roll >= ROLL_SUCCESS && *a3 == 0 && attack->extrasLength == 0) {
roll = ROLL_FAILURE; roll = ROLL_FAILURE;
} }
@ -4670,7 +4670,7 @@ static void _damage_object(Object* a1, int damage, bool animated, int a4, Object
if (a1 != gDude) { if (a1 != gDude) {
Object* whoHitMe = a1->data.critter.combat.whoHitMe; 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; bool scriptOverrides = false;
Script* scr; Script* scr;
if (scriptGetScript(a1->sid, &scr) != -1) { if (scriptGetScript(a1->sid, &scr) != -1) {

View File

@ -1045,7 +1045,7 @@ static int _ai_check_drugs(Object* critter)
critter->data.critter.combat.ap -= 2; 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; 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 { do {
if (v3 == NULL) { if (v3 == NULL) {
v3 = _ai_search_environ(critter, ITEM_TYPE_DRUG); 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++) { for (i = 0; i < _curr_crit_num; i++) {
obj = _curr_crit_list[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; 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]; Object* obj = _curr_crit_list[index];
if (obj != a1 if (obj != a1
&& (obj->data.critter.combat.results & DAM_DEAD) == 0 && (obj->data.critter.combat.results & DAM_DEAD) == 0
&& ((a3 & 0x02) != 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)) { || ((a3 & 0x01) != 0 && team == obj->data.critter.combat.team))) {
if (obj->data.critter.combat.whoHitMe != NULL) { if (obj->data.critter.combat.whoHitMe != NULL) {
return obj; return obj;
} }

View File

@ -967,8 +967,8 @@ bool _critter_is_prone(Object* critter)
int anim = FID_ANIM_TYPE(critter->fid); int anim = FID_ANIM_TYPE(critter->fid);
return (critter->data.critter.combat.results & (DAM_KNOCKED_OUT | DAM_KNOCKED_DOWN)) != 0 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_KNOCKDOWN_AND_DEATH_ANIM && anim <= LAST_KNOCKDOWN_AND_DEATH_ANIM)
|| anim >= FIRST_SF_DEATH_ANIM && anim <= LAST_SF_DEATH_ANIM; || (anim >= FIRST_SF_DEATH_ANIM && anim <= LAST_SF_DEATH_ANIM);
} }
// critter_body_type // 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 (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; a1->data.critter.combat.whoHitMe = a2;
if (a2 == gDude) { if (a2 == gDude) {
reactionSetValue(a1, -3); reactionSetValue(a1, -3);

View File

@ -258,7 +258,7 @@ int gameMoviePlay(int movie, int flags)
_mouse_get_raw_state(&x, &y, &buttons); _mouse_get_raw_state(&x, &y, &buttons);
v11 |= 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(); _movieStop();
_moviefx_stop(); _moviefx_stop();

View File

@ -108,7 +108,7 @@ int graphCompress(unsigned char* a1, unsigned char* a2, int a3)
int v11 = v36 + 1; int v11 = v36 + 1;
if (_match_length > 2) { if (_match_length > 2) {
v29[v36 + 1] = _match_position; 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; v36 = v11 + 1;
} else { } else {
_match_length = 1; _match_length = 1;

View File

@ -987,7 +987,7 @@ int lsgLoadGame(int mode)
int v45 = _get_time(); int v45 = _get_time();
int v44 = v109 + 1; 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; v106 = 1;
if (v109 > 14.4) { if (v109 > 14.4) {

View File

@ -1570,7 +1570,7 @@ static void _square_reset()
// check subsequent calls. // check subsequent calls.
int fid = *p; int fid = *p;
fid &= ~0xFFFF; 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; fid = *p;
int v3 = (fid & 0xF000) >> 12; int v3 = (fid & 0xF000) >> 12;

View File

@ -939,7 +939,7 @@ static void pipboyWindowHandleStatus(int a1)
return; return;
} }
if (gPipboyMouseX > 459 && a1 != 1027 || a1 == 1026) { if ((gPipboyMouseX > 459 && a1 != 1027) || a1 == 1026) {
if (gPipboyHolodiskLastPage <= _view_page) { if (gPipboyHolodiskLastPage <= _view_page) {
if (a1 != 1026) { if (a1 != 1026) {
soundPlayFile("ib1p1xx1"); soundPlayFile("ib1p1xx1");