Reduced compile warnings (especially on clang)

This commit is contained in:
L 2023-02-07 20:49:31 +01:00
parent de40d640d5
commit f9e7f344be
15 changed files with 60 additions and 56 deletions

View file

@ -6632,7 +6632,7 @@ void Actor::VoiceSound
{
bool bFriendly;
//FIXME: macros
if (m_ThinkStates[THINKLEVEL_NORMAL] != THINKSTATE_IDLE && m_ThinkStates[THINKLEVEL_NORMAL] != THINKSTATE_CURIOUS || !m_bEnableEnemy)
if ((m_ThinkStates[THINKLEVEL_NORMAL] != THINKSTATE_IDLE && m_ThinkStates[THINKLEVEL_NORMAL] != THINKSTATE_CURIOUS) || !m_bEnableEnemy)
return;
bFriendly = m_Team == TEAM_GERMAN;
@ -9673,7 +9673,7 @@ void Actor::MovePath
VectorCopy2D(mm.obstacle_normal, m_PrevObstacleNormal);
if (m_WallDir == uint8_t(~0u))
if (m_WallDir == char(-1))
{
mm.desired_dir[0] = -mm.obstacle_normal[1];
mm.desired_dir[1] = mm.obstacle_normal[0];

View file

@ -634,13 +634,13 @@ void Actor::Turret_SideStep
AimAtEnemyBehavior();
//v3 = iStepSize;
StrafeToAttack(iStepSize, vDir);
if (PathExists()
&& !PathComplete()
&& PathAvoidsSquadMates()
|| (StrafeToAttack(-iStepSize, vDir),
PathExists())
if ((PathExists()
&& !PathComplete()
&& PathAvoidsSquadMates())
|| ((StrafeToAttack(-iStepSize, vDir),
PathExists())
&& !PathComplete()
&& PathAvoidsSquadMates()))
{
TransitionState(101, 0);
}
@ -1055,11 +1055,11 @@ void Actor::State_Turret_Retarget_Step_Side_Small
iRand = (rand() & 64) - 32;
AimAtEnemyBehavior();
StrafeToAttack(iRand, orientation[1]);
if (PathExists() && !PathComplete() && PathAvoidsSquadMates()
|| (Actor::StrafeToAttack(-iRand, orientation[1]),
if ((PathExists() && !PathComplete() && PathAvoidsSquadMates())
|| ((Actor::StrafeToAttack(-iRand, orientation[1]),
PathExists())
&& !PathComplete()
&& PathAvoidsSquadMates())
&& PathAvoidsSquadMates()))
{
TransitionState(101, 0);
}
@ -1080,11 +1080,11 @@ void Actor::State_Turret_Retarget_Step_Side_Medium
iRand = (rand() & 256) - 128;
AimAtEnemyBehavior();
StrafeToAttack(iRand, orientation[1]);
if (PathExists() && !PathComplete() && PathAvoidsSquadMates()
|| (Actor::StrafeToAttack(-iRand, orientation[1]),
if ((PathExists() && !PathComplete() && PathAvoidsSquadMates())
|| ((Actor::StrafeToAttack(-iRand, orientation[1]),
PathExists())
&& !PathComplete()
&& PathAvoidsSquadMates())
&& PathAvoidsSquadMates()))
{
TransitionState(101, 0);
}
@ -1105,11 +1105,11 @@ void Actor::State_Turret_Retarget_Step_Side_Large
iRand = (rand() & 512) - 256;
AimAtEnemyBehavior();
StrafeToAttack(iRand, orientation[1]);
if (PathExists() && !PathComplete() && PathAvoidsSquadMates()
|| (Actor::StrafeToAttack(-iRand, orientation[1]),
if ((PathExists() && !PathComplete() && PathAvoidsSquadMates())
|| ((Actor::StrafeToAttack(-iRand, orientation[1]),
PathExists())
&& !PathComplete()
&& PathAvoidsSquadMates())
&& PathAvoidsSquadMates()))
{
TransitionState(101, 0);
}
@ -1130,11 +1130,11 @@ void Actor::State_Turret_Retarget_Step_Face_Medium
iRand = (rand() & 256) - 128;
AimAtEnemyBehavior();
StrafeToAttack(iRand, orientation[0]);
if (PathExists() && !PathComplete() && PathAvoidsSquadMates()
|| (Actor::StrafeToAttack(-iRand, orientation[0]),
if ((PathExists() && !PathComplete() && PathAvoidsSquadMates())
|| ((Actor::StrafeToAttack(-iRand, orientation[0]),
PathExists())
&& !PathComplete()
&& PathAvoidsSquadMates())
&& PathAvoidsSquadMates()))
{
TransitionState(101, 0);
}
@ -1155,11 +1155,11 @@ void Actor::State_Turret_Retarget_Step_Face_Large
iRand = (rand() & 512) - 256;
AimAtEnemyBehavior();
StrafeToAttack(iRand, orientation[0]);
if (PathExists() && !PathComplete() && PathAvoidsSquadMates()
|| (Actor::StrafeToAttack(-iRand, orientation[0]),
if ((PathExists() && !PathComplete() && PathAvoidsSquadMates())
|| ((Actor::StrafeToAttack(-iRand, orientation[0]),
PathExists())
&& !PathComplete()
&& PathAvoidsSquadMates())
&& PathAvoidsSquadMates()))
{
TransitionState(101, 0);
}

View file

@ -566,7 +566,7 @@ void ActorEnemySet::CheckEnemies
{
pActorEnemy = &m_Enemies[i-1];
pActorEnemy->UpdateThreat(pSelf);
if (m_iCurrentThreat < pActorEnemy->m_iThreat || m_iCheckCount == pActorEnemy->m_iThreat && fRangeSquared > pActorEnemy->m_fCurrentRangeSquared)
if (m_iCurrentThreat < pActorEnemy->m_iThreat || (m_iCheckCount == pActorEnemy->m_iThreat && fRangeSquared > pActorEnemy->m_fCurrentRangeSquared))
{
m_iCurrentThreat = pActorEnemy->m_iThreat;
m_pCurrentEnemy = pActorEnemy->m_pEnemy;

View file

@ -579,7 +579,8 @@ void Animate::PostAnimate( void )
if( animtimes[ i ] == 0.0f )
{
animFlags[ i ] = animFlags[ i ] & ~ANIM_NODELTA | ANIM_FINISHED;
animFlags[i] &= ~ANIM_NODELTA;
animFlags[i] |= ANIM_FINISHED;
edict->s.frameInfo[ i ].time = 0.0f;
}
else

View file

@ -1203,7 +1203,7 @@ void Hud::SetBroadcast( int clientNumber )
clientNumber = clientnum;
}
if(clientnum == uint8_t(~0u)) {
if(clientnum == char(-1)) {
gi.SetBroadcastAll();
} else {
gi.MSG_SetClient( clientnum );

View file

@ -1428,17 +1428,17 @@ PathNode *PathSearch::NearestStartNode
}
}
if (ent->m_NearestNode &&
if ((ent->m_NearestNode &&
(G_SightTrace(
Vector(start),
vMins,
vMaxs,
ent->m_vNearestNodePos,
(gentity_t *)ent,
(gentity_t *)NULL,
(gentity_t*)ent,
(gentity_t*)NULL,
1073883393, //FIXME: macro
qtrue,
"PathSearch::NearestStartNode 2"))
"PathSearch::NearestStartNode 2")))
|| node_count <= 0
)
{

View file

@ -7268,7 +7268,7 @@ void Player::Think
if (dmManager.AllowRespawn())
{
if (((server_new_buttons & BUTTON_ATTACK) || (server_new_buttons & BUTTON_ATTACK2)) ||
g_forcerespawn->integer > 0 && level.time > g_forcerespawn->integer + respawn_time)
(g_forcerespawn->integer > 0 && level.time > g_forcerespawn->integer + respawn_time))
{
m_bSpectator = false;
m_bTempSpectator = false;
@ -10365,8 +10365,9 @@ void Player::UpdateStats
{
if( iItem <= 3 )
{
client->ps.activeItems[ iItem + 2 ] = weapon->getIndex();
weapon->weapon_class = ( 256 << iItem ) & WEAPON_CLASS_ITEMINDEX | weapon->weapon_class & ~WEAPON_CLASS_ITEMINDEX;
client->ps.activeItems[iItem + 2] = weapon->getIndex();
weapon->weapon_class = (256 << iItem) & WEAPON_CLASS_ITEMINDEX;
weapon->weapon_class |= weapon->weapon_class & ~WEAPON_CLASS_ITEMINDEX;
if( activeweap && weapon == activeweap )
{
@ -10425,9 +10426,9 @@ void Player::UpdateStats
client->ps.stats[ STAT_INZOOM ] = 0;
}
client->ps.stats[ STAT_CROSSHAIR ] = ( !client->ps.stats[ STAT_INZOOM ] || client->ps.stats[ STAT_INZOOM ] > 30 ) &&
( activeweap && !activeweap->IsSubclassOfInventoryItem() && activeweap->HasCrosshair() ) ||
pTurret || ( m_pVehicle && m_pVehicle->IsSubclassOfVehicleTank() );
client->ps.stats[STAT_CROSSHAIR] = ((!client->ps.stats[STAT_INZOOM] || client->ps.stats[STAT_INZOOM] > 30) &&
(activeweap && !activeweap->IsSubclassOfInventoryItem() && activeweap->HasCrosshair())) ||
pTurret || (m_pVehicle && m_pVehicle->IsSubclassOfVehicleTank());
client->ps.stats[ STAT_COMPASSNORTH ] = ANGLE2SHORT( world->m_fNorth );
@ -11487,7 +11488,8 @@ void Player::SetPlayerSpectate( void )
if( !pPlayer->IsDead() && !pPlayer->IsSpectator() && IsValidSpectatePlayer( pPlayer ) )
{
m_iPlayerSpectating = i + 1;
client->ps.camera_flags = client->ps.camera_flags & ~CF_CAMERA_CUT_BIT | client->ps.camera_flags & CF_CAMERA_CUT_BIT ^ CF_CAMERA_CUT_BIT;
client->ps.camera_flags &= ~CF_CAMERA_CUT_BIT;
client->ps.camera_flags |= (client->ps.camera_flags & CF_CAMERA_CUT_BIT) ^ CF_CAMERA_CUT_BIT;
return;
}
}
@ -11754,9 +11756,9 @@ void Player::CallVote
}
}
if( i == game.maxclients )
if (i == game.maxclients)
{
HUDPrint(va("%s %s", gi.LV_ConvertString("is not a valid player name to kick.")));
HUDPrint(va("%s %s", ent->client->pers.netname, gi.LV_ConvertString("is not a valid player name to kick.")));
}
}
else if( !Q_stricmp( arg1.c_str(), "map" ) && *sv_nextmap->string )

View file

@ -4837,8 +4837,8 @@ void ScriptThread::FadeSound
time = delaytime * 1000.0f;
gi.SendServerCommand( player != NULL ? player->edict - g_entities : NULL,
"fadesound2 %0.2f %f", time, min_vol );
gi.SendServerCommand(player != nullptr ? player->edict - g_entities : 0,
"fadesound2 %0.2f %f", time, min_vol);
}
void ScriptThread::RestoreSound

View file

@ -2278,14 +2278,14 @@ void Sentient::ArmorDamage
return;
}
if( ( takedamage == DAMAGE_NO ) || ( movetype == MOVETYPE_NOCLIP ) )
if ((takedamage == DAMAGE_NO) || (movetype == MOVETYPE_NOCLIP))
{
return;
}
if( client && !g_gametype->integer || location < 0 || location > 18 )
if ((client && !g_gametype->integer) || (location < 0 || location > 18))
{
if( attacker && attacker->IsSubclassOfActor() )
if (attacker && attacker->IsSubclassOfActor())
{
damage *= AIDamageMult->value;
}

View file

@ -327,8 +327,8 @@ void SimpleActor::SetPath
{
if (description)
{
int thinkState = ((Actor *)this)->m_ThinkState;
if (g_patherror->integer == 1 || g_patherror->integer == 2 && (thinkState == THINKSTATE_IDLE || thinkState == THINKSTATE_CURIOUS))
int thinkState = ((Actor*)this)->m_ThinkState;
if (g_patherror->integer == 1 || (g_patherror->integer == 2 && (thinkState == THINKSTATE_IDLE || thinkState == THINKSTATE_CURIOUS)))
{
if (m_bPathErrorTime + 5000 < level.inttime)
{

View file

@ -3935,8 +3935,8 @@ void Vehicle::MoveVehicle
tr.ent->entity->CheckGround();
if( !tr.ent->entity->groundentity || tr.ent->entity->groundentity == edict &&
( !m_pCollisionEntity || tr.ent->entity != m_pCollisionEntity ) )
if (!tr.ent->entity->groundentity || (tr.ent->entity->groundentity == edict &&
(!m_pCollisionEntity || tr.ent->entity != m_pCollisionEntity)))
{
Event *event = new Event( EV_Touch );
event->AddEntity( this );
@ -4131,8 +4131,8 @@ _label1:
tr.ent->entity->CheckGround();
if( !tr.ent->entity->groundentity || tr.ent->entity->groundentity == edict &&
( !m_pCollisionEntity || tr.ent->entity != m_pCollisionEntity ) )
if (!tr.ent->entity->groundentity || (tr.ent->entity->groundentity == edict &&
(!m_pCollisionEntity || tr.ent->entity != m_pCollisionEntity)))
{
Event *event = new Event( EV_Touch );
event->AddEntity( this );

View file

@ -737,7 +737,7 @@ void TurretGun::Think
)
{
if( owner || !m_bHadOwner && aim_target )
if (owner || (!m_bHadOwner && aim_target))
{
ThinkActive();
}

View file

@ -245,7 +245,7 @@ unsigned int cLZ77::CompressData( unsigned char *in, size_t in_len, unsigned cha
}
else
{
v13 = this->dindex & 0x7FF ^ 0x201F;
v13 = (this->dindex & 0x7FF) ^ 0x201F;
this->dindex = v13;
v14 = m_pDictionary[v13];
this->m_off = v14;
@ -378,7 +378,7 @@ unsigned int cLZ77::CompressData( unsigned char *in, size_t in_len, unsigned cha
this->m_off = v48;
if (v44 <= 9)
{
*this->op = (this->m_len - 2) | (v48 >> 11) & 8 | 0x10;
*this->op = (this->m_len - 2) | ((v48 >> 11) & 8) | 0x10;
LABEL_65:
v57 = this->op + 1;
v58 = 4 * this->m_off;
@ -389,7 +389,7 @@ unsigned int cLZ77::CompressData( unsigned char *in, size_t in_len, unsigned cha
}
v49 = this->m_off >> 11;
this->m_len = v44 - 9;
*this->op = v49 & 8 | 0x10;
*this->op = (v49 & 8) | 0x10;
m_len = this->m_len;
v51 = this->op + 1;
this->op = v51;
@ -454,7 +454,7 @@ unsigned int cLZ77::CompressData( unsigned char *in, size_t in_len, unsigned cha
v56 = this->m_len;
v44 -= 0x4000;
this->m_off = v44;
v44 = (v56 - 2) | (v44 >> 11) & 8 | 0x10;
v44 = (v56 - 2) | ((v44 >> 11) & 8) | 0x10;
}
else
{

View file

@ -1180,7 +1180,7 @@ inline int operator==( const Quat &a, const Quat &b )
inline int operator!=( const Quat &a, const Quat &b )
{
return ( ( a.x != b.x ) || ( a.y != b.y ) || ( a.z != b.z ) && ( a.w != b.w ) );
return (((a.x != b.x) || (a.y != b.y)) || ((a.z != b.z) && (a.w != b.w)));
}
inline float Quat::length( void ) const

View file

@ -251,6 +251,7 @@ bool SkelQuat::IsValid() const
inline
void Slerp( SkelQuat &from, SkelQuat &to, float t, SkelQuat *out )
{
static_assert(sizeof(float) == sizeof(int), "Float must be the same size as Int");
float f;
float f2;
@ -258,7 +259,7 @@ void Slerp( SkelQuat &from, SkelQuat &to, float t, SkelQuat *out )
f2 = 1.0 - t;
// little hack because I don't know how can this operation be converted to float...
*( int * )&f = *( int * )&f & 0x80000000 ^ *( int * )&f2;
*(int*)&f = (*(int*)&f & 0x80000000) ^ *(int*)&f2;
out->x = to.x * t + from.x * f;
out->y = to.y * t + from.y * f;