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;
height = ROW_RANGE_MAX;
}
int ymax = ypos + height;
// int ymax = ypos + height;
if( xmax > ScreenWidth - 30 ) xmax = ScreenWidth - 30;
gHUD.DrawDarkRectangle( xpos - 5, ypos_r - 5, xmax - xpos + 10, height + 10 );
while( *ch )
@ -157,7 +157,7 @@ int CHudMOTD::MsgFunc_MOTD( const char *pszName, int iSize, void *pbuf )
if( length > m_iMaxLength )
{
m_iMaxLength = length;
length = 0;
// length = 0;
}
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 )
{
float offset;
int axis = gEngfuncs.pfnRandomLong(0,1);
/*int axis = gEngfuncs.pfnRandomLong(0,1);
if( axis == 1 ) // Choose between x & z
axis = 2;
axis = 2;*/
offset = gEngfuncs.pfnRandomFloat( -10.0f, 10.0f );
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 )
{
// 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.
// 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];
i += sizeof(float);
g_demosniperorg[2] = *(float *)&buffer[i];
i += sizeof(float);
// i += sizeof(float);
}
break;
case TYPE_ZOOM:
g_demozoom = *(float *)&buffer[i];
i += sizeof(float);
// i += sizeof(float);
break;
default:
gEngfuncs.Con_DPrintf( "Unknown demo buffer type, skipping.\n" );

View File

@ -66,7 +66,7 @@ int CHudGeiger::Draw( float flTime )
int pct;
float flvol = 0.0f;
//int rg[3];
int i;
int i = 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
void CHudHealth::GetPainColor( int &r, int &g, int &b )
{
#if 0
int iHealth = m_iHealth;
if( iHealth > 25 )
iHealth -= 25;
else if( iHealth < 0 )
iHealth = 0;
#if 0
g = iHealth * 255 / 100;
r = 255 - g;
b = 0;
@ -461,7 +462,7 @@ void CHudHealth::UpdateTiles( float flTime, long bitsDamage )
if( pdmg->y )
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
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 );
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
if( m_pMessages[i] )
{
pMessage = m_pMessages[i];
// pMessage = m_pMessages[i];
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
}

View File

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

View File

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

View File

@ -717,9 +717,9 @@ void CApache::Flight( void )
if( pitch == 100.0f )
pitch = 101.0f;
float flVol = ( m_flForce / 100.0f ) + 0.1f;
/*float flVol = ( m_flForce / 100.0f ) + 0.1f;
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 );
}

View File

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

View File

@ -710,11 +710,11 @@ void CBreakable::Die( void )
WRITE_BYTE( cFlag );
MESSAGE_END();
float size = pev->size.x;
/*float size = pev->size.x;
if( size < pev->size.y )
size = pev->size.y;
if( size < pev->size.z )
size = pev->size.z;
size = pev->size.z;*/
// !!! HACK This should work!
// 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;
}
}
if( flDist <= 64.0f && flDot >= 0.7f &&
pEnemy->Classify() != CLASS_ALIEN_BIOWEAPON &&
pEnemy->Classify() != CLASS_PLAYER_BIOWEAPON )
{
return TRUE;
if( flDist <= 64.0f && flDot >= 0.7f &&
pEnemy->Classify() != CLASS_ALIEN_BIOWEAPON &&
pEnemy->Classify() != CLASS_PLAYER_BIOWEAPON )
{
return TRUE;
}
}
return FALSE;
}

View File

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

View File

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

View File

@ -262,7 +262,8 @@ void CBaseMonster::Listen( void )
}
//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 );
if( pSound && pSound->FIsSound() )
if( pSound )
{
flDist = ( pSound->m_vecOrigin - EarPosition() ).Length();
if( flDist < flBestDist )
if( pSound->FIsSound() )
{
iBestSound = iThisSound;
flBestDist = flDist;
}
}
flDist = ( pSound->m_vecOrigin - EarPosition() ).Length();
iThisSound = pSound->m_iNextAudible;
if( flDist < flBestDist )
{
iBestSound = iThisSound;
flBestDist = flDist;
}
}
iThisSound = pSound->m_iNextAudible;
}
}
if( iBestSound >= 0 )
{
@ -2367,7 +2371,7 @@ BOOL CBaseMonster::BuildNearestRoute( Vector vecThreat, Vector vecViewOffset, fl
// try to actually get there
if( BuildRoute( node.m_vecOrigin, bits_MF_TO_LOCATION, NULL ) )
{
flMaxDist = flDist;
// flMaxDist = flDist;
m_vecMoveGoal = node.m_vecOrigin;
return TRUE; // UNDONE: keep looking for something closer!
}
@ -3278,7 +3282,7 @@ BOOL CBaseMonster::BBoxFlat( void )
{
return FALSE;
}
flLength = flLength2;
// flLength = flLength2;
return TRUE;
}

View File

@ -944,10 +944,10 @@ void CNihilanth::Flight( void )
m_velocity.y += gpGlobals->v_up.y * 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 ) );
if( flDir < 0 )
flSpeed = -flSpeed;
flSpeed = -flSpeed;*/
//float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward );

View File

@ -2533,7 +2533,7 @@ int CGraph::FLoadGraph( const char *szMapName )
if( length < 0 )
goto ShortFile;
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
//
@ -3641,7 +3641,7 @@ void CNodeViewer::Spawn()
int start = 0;
int end;
do{
end = m_nVisited;
// end = m_nVisited;
// ALERT( at_console, "%d :", m_nVisited );
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( 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();
}

View File

@ -1750,7 +1750,7 @@ void CFuncTrackChange::Find( void )
else
{
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

View File

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

View File

@ -266,9 +266,9 @@ void CSqueakGrenade::HuntThink( void )
}
// 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 )
flpitch = 80.0f;
flpitch = 80.0f;*/
if( m_hEnemy != 0 )
{

View File

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

View File

@ -289,7 +289,7 @@ void PM_ViewEntity( void )
int i;
pmtrace_t trace;
int pcolor = 77;
float fup;
// float fup;
#if 0
if ( !pm_showclip.value )
@ -300,9 +300,9 @@ void PM_ViewEntity( void )
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 -= 4;
fup -= 4;*/
for (i = 0; i < 3; i++)
{