Fix some potential troubles.

Comment some useless code.
This commit is contained in:
Andrey Akhmichin 2019-11-16 13:54:30 +05:00
parent b4d3b5d8be
commit b8825c2039
25 changed files with 87 additions and 71 deletions

View File

@ -86,7 +86,7 @@ int CHudMOTD::Draw( float fTime )
ypos_r = ROW_RANGE_MIN; ypos_r = ROW_RANGE_MIN;
height = ROW_RANGE_MAX; height = ROW_RANGE_MAX;
} }
int ymax = ypos + height; // int ymax = ypos + height;
if( xmax > ScreenWidth - 30 ) xmax = ScreenWidth - 30; if( xmax > ScreenWidth - 30 ) xmax = ScreenWidth - 30;
gHUD.DrawDarkRectangle( xpos - 5, ypos_r - 5, xmax - xpos + 10, height + 10 ); gHUD.DrawDarkRectangle( xpos - 5, ypos_r - 5, xmax - xpos + 10, height + 10 );
while( *ch ) while( *ch )
@ -157,7 +157,7 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
if( length > m_iMaxLength ) if( length > m_iMaxLength )
{ {
m_iMaxLength = length; m_iMaxLength = length;
length = 0; // length = 0;
} }
m_bShow = true; m_bShow = true;
} }

View File

@ -684,9 +684,9 @@ void CStudioModelRenderer::StudioFxTransform( cl_entity_t *ent, float transform[
else if( gEngfuncs.pfnRandomLong( 0, 49 ) == 0 ) else if( gEngfuncs.pfnRandomLong( 0, 49 ) == 0 )
{ {
float offset; float offset;
int axis = gEngfuncs.pfnRandomLong(0,1); /*int axis = gEngfuncs.pfnRandomLong(0,1);
if( axis == 1 ) // Choose between x & z if( axis == 1 ) // Choose between x & z
axis = 2; axis = 2;*/
offset = gEngfuncs.pfnRandomFloat( -10.0f, 10.0f ); offset = gEngfuncs.pfnRandomFloat( -10.0f, 10.0f );
transform[gEngfuncs.pfnRandomLong( 0, 2 )][3] += offset; transform[gEngfuncs.pfnRandomLong( 0, 2 )][3] += offset;
} }

View File

@ -124,7 +124,7 @@ HUD_ConnectionlessPacket
int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ) int DLLEXPORT HUD_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size )
{ {
// Parse stuff from args // Parse stuff from args
int max_buffer_size = *response_buffer_size; // int max_buffer_size = *response_buffer_size;
// Zero it out since we aren't going to respond. // Zero it out since we aren't going to respond.
// If we wanted to response, we'd write data into response_buffer // If we wanted to response, we'd write data into response_buffer

View File

@ -88,12 +88,12 @@ void DLLEXPORT Demo_ReadBuffer( int size, unsigned char *buffer )
g_demosniperorg[1] = *(float *)&buffer[i]; g_demosniperorg[1] = *(float *)&buffer[i];
i += sizeof(float); i += sizeof(float);
g_demosniperorg[2] = *(float *)&buffer[i]; g_demosniperorg[2] = *(float *)&buffer[i];
i += sizeof(float); // i += sizeof(float);
} }
break; break;
case TYPE_ZOOM: case TYPE_ZOOM:
g_demozoom = *(float *)&buffer[i]; g_demozoom = *(float *)&buffer[i];
i += sizeof(float); // i += sizeof(float);
break; break;
default: default:
gEngfuncs.Con_DPrintf( "Unknown demo buffer type, skipping.\n" ); gEngfuncs.Con_DPrintf( "Unknown demo buffer type, skipping.\n" );

View File

@ -66,7 +66,7 @@ int CHudGeiger::Draw( float flTime )
int pct; int pct;
float flvol = 0.0f; float flvol = 0.0f;
//int rg[3]; //int rg[3];
int i; int i = 0;
if( m_iGeigerRange < 1000 && m_iGeigerRange > 0 ) if( m_iGeigerRange < 1000 && m_iGeigerRange > 0 )
{ {

View File

@ -152,13 +152,14 @@ int CHudHealth::MsgFunc_Damage( const char *pszName, int iSize, void *pbuf )
// Green <-> Yellow <-> Red ramp // Green <-> Yellow <-> Red ramp
void CHudHealth::GetPainColor( int &r, int &g, int &b ) void CHudHealth::GetPainColor( int &r, int &g, int &b )
{ {
#if 0
int iHealth = m_iHealth; int iHealth = m_iHealth;
if( iHealth > 25 ) if( iHealth > 25 )
iHealth -= 25; iHealth -= 25;
else if( iHealth < 0 ) else if( iHealth < 0 )
iHealth = 0; iHealth = 0;
#if 0
g = iHealth * 255 / 100; g = iHealth * 255 / 100;
r = 255 - g; r = 255 - g;
b = 0; b = 0;
@ -461,7 +462,7 @@ void CHudHealth::UpdateTiles( float flTime, long bitsDamage )
if( pdmg->y ) if( pdmg->y )
pdmg->y -= giDmgHeight; pdmg->y -= giDmgHeight;
} }
pdmg = &m_dmg[i]; // pdmg = &m_dmg[i];
} }
} }

View File

@ -307,7 +307,7 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
// get circular gaussian spread // get circular gaussian spread
x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5f, 0.5f ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5f, 0.5f ); x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5f, 0.5f ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5f, 0.5f );
y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5f, 0.5f ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5f, 0.5f ); y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5f, 0.5f ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5f, 0.5f );
z = x * x + y * y; // z = x * x + y * y;
} }
} }

View File

@ -352,7 +352,7 @@ int CHudMessage::Draw( float fTime )
// Assume m_parms.time contains last time // Assume m_parms.time contains last time
if( m_pMessages[i] ) if( m_pMessages[i] )
{ {
pMessage = m_pMessages[i]; // pMessage = m_pMessages[i];
if( m_startTime[i] > gHUD.m_flTime ) if( m_startTime[i] > gHUD.m_flTime )
m_startTime[i] = gHUD.m_flTime + m_parms.time - m_startTime[i] + 0.2f; // Server takes 0.2 seconds to spawn, adjust for this m_startTime[i] = gHUD.m_flTime + m_parms.time - m_startTime[i] + 0.2f; // Server takes 0.2 seconds to spawn, adjust for this
} }

View File

@ -259,7 +259,7 @@ void CHudSayText::EnsureTextFitsInOneLineAndWrapIfHaveTo( int line )
if( !last_break ) if( !last_break )
last_break = x - 1; last_break = x - 1;
x = last_break; // x = last_break;
// find an empty string slot // find an empty string slot
int j; int j;

View File

@ -491,7 +491,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
} }
else else
{ {
waterEntity = 0; // Don't need this in software // waterEntity = 0; // Don't need this in software
} }
VectorCopy( pparams->vieworg, point ); VectorCopy( pparams->vieworg, point );

View File

@ -717,9 +717,9 @@ void CApache::Flight( void )
if( pitch == 100.0f ) if( pitch == 100.0f )
pitch = 101.0f; pitch = 101.0f;
float flVol = ( m_flForce / 100.0f ) + 0.1f; /*float flVol = ( m_flForce / 100.0f ) + 0.1f;
if( flVol > 1.0f ) if( flVol > 1.0f )
flVol = 1.0f; flVol = 1.0f;*/
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "apache/ap_rotor2.wav", 1.0f, 0.3f, SND_CHANGE_PITCH | SND_CHANGE_VOL, pitch ); EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "apache/ap_rotor2.wav", 1.0f, 0.3f, SND_CHANGE_PITCH | SND_CHANGE_VOL, pitch );
} }

View File

@ -459,10 +459,10 @@ Activity CBaseMonster::GetDeathActivity( void )
Activity CBaseMonster::GetSmallFlinchActivity( void ) Activity CBaseMonster::GetSmallFlinchActivity( void )
{ {
Activity flinchActivity; Activity flinchActivity;
BOOL fTriedDirection; // BOOL fTriedDirection;
//float flDot; //float flDot;
fTriedDirection = FALSE; // fTriedDirection = FALSE;
UTIL_MakeVectors( pev->angles ); UTIL_MakeVectors( pev->angles );
//flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1.0f ); //flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1.0f );

View File

@ -710,11 +710,11 @@ void CBreakable::Die( void )
WRITE_BYTE( cFlag ); WRITE_BYTE( cFlag );
MESSAGE_END(); MESSAGE_END();
float size = pev->size.x; /*float size = pev->size.x;
if( size < pev->size.y ) if( size < pev->size.y )
size = pev->size.y; size = pev->size.y;
if( size < pev->size.z ) if( size < pev->size.z )
size = pev->size.z; size = pev->size.z;*/
// !!! HACK This should work! // !!! HACK This should work!
// Build a box above the entity that looks like an 8 pixel high sheet // Build a box above the entity that looks like an 8 pixel high sheet

View File

@ -423,13 +423,13 @@ BOOL CHGrunt::CheckMeleeAttack1( float flDot, float flDist )
{ {
return FALSE; return FALSE;
} }
}
if( flDist <= 64.0f && flDot >= 0.7f && if( flDist <= 64.0f && flDot >= 0.7f &&
pEnemy->Classify() != CLASS_ALIEN_BIOWEAPON && pEnemy->Classify() != CLASS_ALIEN_BIOWEAPON &&
pEnemy->Classify() != CLASS_PLAYER_BIOWEAPON ) pEnemy->Classify() != CLASS_PLAYER_BIOWEAPON )
{ {
return TRUE; return TRUE;
}
} }
return FALSE; return FALSE;
} }

View File

@ -95,9 +95,9 @@ void CHornet::Spawn( void )
SetTouch( &CHornet::DieTouch ); SetTouch( &CHornet::DieTouch );
SetThink( &CHornet::StartTrack ); SetThink( &CHornet::StartTrack );
edict_t *pSoundEnt = pev->owner; /*edict_t *pSoundEnt = pev->owner;
if( !pSoundEnt ) if( !pSoundEnt )
pSoundEnt = edict(); pSoundEnt = edict();*/
if( !FNullEnt( pev->owner ) && ( pev->owner->v.flags & FL_CLIENT ) ) if( !FNullEnt( pev->owner ) && ( pev->owner->v.flags & FL_CLIENT ) )
{ {

View File

@ -639,10 +639,13 @@ Schedule_t *CISlave::GetSchedule( void )
ASSERT( pSound != NULL ); ASSERT( pSound != NULL );
if( pSound && ( pSound->m_iType & bits_SOUND_DANGER ) ) if( pSound )
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_BEST_SOUND ); {
if( pSound->m_iType & bits_SOUND_COMBAT ) if( pSound->m_iType & bits_SOUND_DANGER )
m_afMemory |= bits_MEMORY_PROVOKED; return GetScheduleOfType( SCHED_TAKE_COVER_FROM_BEST_SOUND );
if( pSound->m_iType & bits_SOUND_COMBAT )
m_afMemory |= bits_MEMORY_PROVOKED;
}
} }
switch( m_MonsterState ) switch( m_MonsterState )

View File

@ -262,7 +262,8 @@ void CBaseMonster::Listen( void )
} }
//iSound = g_pSoundEnt->m_SoundPool[iSound].m_iNext; //iSound = g_pSoundEnt->m_SoundPool[iSound].m_iNext;
iSound = pCurrentSound->m_iNext; if( pCurrentSound )
iSound = pCurrentSound->m_iNext;
} }
} }
@ -431,18 +432,21 @@ CSound *CBaseMonster::PBestSound( void )
{ {
pSound = CSoundEnt::SoundPointerForIndex( iThisSound ); pSound = CSoundEnt::SoundPointerForIndex( iThisSound );
if( pSound && pSound->FIsSound() ) if( pSound )
{ {
flDist = ( pSound->m_vecOrigin - EarPosition() ).Length(); if( pSound->FIsSound() )
if( flDist < flBestDist )
{ {
iBestSound = iThisSound; flDist = ( pSound->m_vecOrigin - EarPosition() ).Length();
flBestDist = flDist;
}
}
iThisSound = pSound->m_iNextAudible; if( flDist < flBestDist )
{
iBestSound = iThisSound;
flBestDist = flDist;
}
}
iThisSound = pSound->m_iNextAudible;
}
} }
if( iBestSound >= 0 ) if( iBestSound >= 0 )
{ {
@ -2367,7 +2371,7 @@ BOOL CBaseMonster::BuildNearestRoute( Vector vecThreat, Vector vecViewOffset, fl
// try to actually get there // try to actually get there
if( BuildRoute( node.m_vecOrigin, bits_MF_TO_LOCATION, NULL ) ) if( BuildRoute( node.m_vecOrigin, bits_MF_TO_LOCATION, NULL ) )
{ {
flMaxDist = flDist; // flMaxDist = flDist;
m_vecMoveGoal = node.m_vecOrigin; m_vecMoveGoal = node.m_vecOrigin;
return TRUE; // UNDONE: keep looking for something closer! return TRUE; // UNDONE: keep looking for something closer!
} }
@ -3278,7 +3282,7 @@ BOOL CBaseMonster::BBoxFlat( void )
{ {
return FALSE; return FALSE;
} }
flLength = flLength2; // flLength = flLength2;
return TRUE; return TRUE;
} }

View File

@ -944,10 +944,10 @@ void CNihilanth::Flight( void )
m_velocity.y += gpGlobals->v_up.y * m_flForce; m_velocity.y += gpGlobals->v_up.y * m_flForce;
m_velocity.z += gpGlobals->v_up.z * m_flForce; m_velocity.z += gpGlobals->v_up.z * m_flForce;
float flSpeed = m_velocity.Length(); /*float flSpeed = m_velocity.Length();
float flDir = DotProduct( Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, 0 ), Vector( m_velocity.x, m_velocity.y, 0 ) ); float flDir = DotProduct( Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, 0 ), Vector( m_velocity.x, m_velocity.y, 0 ) );
if( flDir < 0 ) if( flDir < 0 )
flSpeed = -flSpeed; flSpeed = -flSpeed;*/
//float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward ); //float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward );

View File

@ -2533,7 +2533,7 @@ int CGraph::FLoadGraph( const char *szMapName )
if( length < 0 ) if( length < 0 )
goto ShortFile; goto ShortFile;
memcpy( m_pHashLinks, pMemFile, sizeof(short) * m_nHashLinks ); memcpy( m_pHashLinks, pMemFile, sizeof(short) * m_nHashLinks );
pMemFile += sizeof(short) * m_nHashLinks; // pMemFile += sizeof(short) * m_nHashLinks;
// Set the graph present flag, clear the pointers set flag // Set the graph present flag, clear the pointers set flag
// //
@ -3641,7 +3641,7 @@ void CNodeViewer::Spawn()
int start = 0; int start = 0;
int end; int end;
do{ do{
end = m_nVisited; // end = m_nVisited;
// ALERT( at_console, "%d :", m_nVisited ); // ALERT( at_console, "%d :", m_nVisited );
for( end = m_nVisited; start < end; start++ ) for( end = m_nVisited; start < end; start++ )
{ {

View File

@ -384,13 +384,18 @@ void COsprey::FlyThink( void )
if( gpGlobals->time > m_startTime + m_dTime ) if( gpGlobals->time > m_startTime + m_dTime )
{ {
if( m_pGoalEnt->pev->speed == 0 ) if( m_pGoalEnt )
{ {
SetThink( &COsprey::DeployThink ); if( m_pGoalEnt->pev->speed == 0 )
{
SetThink( &COsprey::DeployThink );
}
do{
m_pGoalEnt = CBaseEntity::Instance( FIND_ENTITY_BY_TARGETNAME( NULL, STRING( m_pGoalEnt->pev->target ) ) );
} while( m_pGoalEnt && m_pGoalEnt->pev->speed < 400 && !HasDead() );
} }
do{
m_pGoalEnt = CBaseEntity::Instance( FIND_ENTITY_BY_TARGETNAME( NULL, STRING( m_pGoalEnt->pev->target ) ) );
} while( m_pGoalEnt->pev->speed < 400 && !HasDead() );
UpdateGoal(); UpdateGoal();
} }

View File

@ -1750,7 +1750,7 @@ void CFuncTrackChange::Find( void )
else else
{ {
ALERT( at_error, "Can't find train for track change! %s\n", STRING( m_trainName ) ); ALERT( at_error, "Can't find train for track change! %s\n", STRING( m_trainName ) );
target = FIND_ENTITY_BY_TARGETNAME( NULL, STRING( m_trainName ) ); // target = FIND_ENTITY_BY_TARGETNAME( NULL, STRING( m_trainName ) );
} }
} }
else else

View File

@ -280,7 +280,7 @@ void CAmbientGeneric::RampThink( void )
if( pitch < m_dpv.pitchstart ) if( pitch < m_dpv.pitchstart )
{ {
pitch = m_dpv.pitchstart; // pitch = m_dpv.pitchstart;
m_dpv.spindown = 0; // done with ramp down m_dpv.spindown = 0; // done with ramp down
// shut sound off // shut sound off
@ -324,7 +324,7 @@ void CAmbientGeneric::RampThink( void )
if( vol < m_dpv.volstart ) if( vol < m_dpv.volstart )
{ {
vol = m_dpv.volstart; // vol = m_dpv.volstart;
m_dpv.fadeout = 0; // done with ramp down m_dpv.fadeout = 0; // done with ramp down
// shut sound off // shut sound off

View File

@ -266,9 +266,9 @@ void CSqueakGrenade::HuntThink( void )
} }
// higher pitch as squeeker gets closer to detonation time // higher pitch as squeeker gets closer to detonation time
float flpitch = 155.0f - 60.0f * ( ( m_flDie - gpGlobals->time ) / SQUEEK_DETONATE_DELAY ); /*float flpitch = 155.0f - 60.0f * ( ( m_flDie - gpGlobals->time ) / SQUEEK_DETONATE_DELAY );
if( flpitch < 80.0f ) if( flpitch < 80.0f )
flpitch = 80.0f; flpitch = 80.0f;*/
if( m_hEnemy != 0 ) if( m_hEnemy != 0 )
{ {

View File

@ -494,18 +494,21 @@ void CTalkMonster::RunTask( Task_t *pTask )
if( pTask->iTask == TASK_TLK_CLIENT_STARE ) if( pTask->iTask == TASK_TLK_CLIENT_STARE )
{ {
// fail out if the player looks away or moves away. if( pPlayer )
if( ( pPlayer->v.origin - pev->origin ).Length2D() > TLK_STARE_DIST )
{ {
// player moved away. // fail out if the player looks away or moves away.
TaskFail(); if( ( pPlayer->v.origin - pev->origin ).Length2D() > TLK_STARE_DIST )
} {
// player moved away.
TaskFail();
}
UTIL_MakeVectors( pPlayer->v.angles ); UTIL_MakeVectors( pPlayer->v.angles );
if( UTIL_DotPoints( pPlayer->v.origin, pev->origin, gpGlobals->v_forward ) < m_flFieldOfView ) if( UTIL_DotPoints( pPlayer->v.origin, pev->origin, gpGlobals->v_forward ) < m_flFieldOfView )
{ {
// player looked away // player looked away
TaskFail(); TaskFail();
}
} }
} }

View File

@ -289,7 +289,7 @@ void PM_ViewEntity( void )
int i; int i;
pmtrace_t trace; pmtrace_t trace;
int pcolor = 77; int pcolor = 77;
float fup; // float fup;
#if 0 #if 0
if ( !pm_showclip.value ) if ( !pm_showclip.value )
@ -300,9 +300,9 @@ void PM_ViewEntity( void )
VectorCopy( pmove->origin, origin); VectorCopy( pmove->origin, origin);
fup = 0.5f * ( pmove->player_mins[pmove->usehull][2] + pmove->player_maxs[pmove->usehull][2] ); /*fup = 0.5f * ( pmove->player_mins[pmove->usehull][2] + pmove->player_maxs[pmove->usehull][2] );
fup += pmove->view_ofs[2]; fup += pmove->view_ofs[2];
fup -= 4; fup -= 4;*/
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {