From b8825c2039d91670abc7415733111e89e7ea2e4f Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Sat, 16 Nov 2019 13:54:30 +0500 Subject: [PATCH] Fix some potential troubles. Comment some useless code. --- cl_dll/MOTD.cpp | 4 ++-- cl_dll/StudioModelRenderer.cpp | 4 ++-- cl_dll/cdll_int.cpp | 2 +- cl_dll/demo.cpp | 4 ++-- cl_dll/geiger.cpp | 2 +- cl_dll/health.cpp | 5 +++-- cl_dll/hl/hl_weapons.cpp | 2 +- cl_dll/message.cpp | 2 +- cl_dll/saytext.cpp | 2 +- cl_dll/view.cpp | 2 +- dlls/apache.cpp | 4 ++-- dlls/combat.cpp | 4 ++-- dlls/func_break.cpp | 4 ++-- dlls/hgrunt.cpp | 12 ++++++------ dlls/hornet.cpp | 4 ++-- dlls/islave.cpp | 11 +++++++---- dlls/monsters.cpp | 26 +++++++++++++++----------- dlls/nihilanth.cpp | 4 ++-- dlls/nodes.cpp | 4 ++-- dlls/osprey.cpp | 15 ++++++++++----- dlls/plats.cpp | 2 +- dlls/sound.cpp | 4 ++-- dlls/squeakgrenade.cpp | 4 ++-- dlls/talkmonster.cpp | 23 +++++++++++++---------- pm_shared/pm_debug.c | 6 +++--- 25 files changed, 86 insertions(+), 70 deletions(-) diff --git a/cl_dll/MOTD.cpp b/cl_dll/MOTD.cpp index 7059948a..7947a15f 100644 --- a/cl_dll/MOTD.cpp +++ b/cl_dll/MOTD.cpp @@ -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; } diff --git a/cl_dll/StudioModelRenderer.cpp b/cl_dll/StudioModelRenderer.cpp index 5350ad10..1994c2a7 100644 --- a/cl_dll/StudioModelRenderer.cpp +++ b/cl_dll/StudioModelRenderer.cpp @@ -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; } diff --git a/cl_dll/cdll_int.cpp b/cl_dll/cdll_int.cpp index 45bbcd67..29edfbde 100644 --- a/cl_dll/cdll_int.cpp +++ b/cl_dll/cdll_int.cpp @@ -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 diff --git a/cl_dll/demo.cpp b/cl_dll/demo.cpp index f114ead0..63e333be 100644 --- a/cl_dll/demo.cpp +++ b/cl_dll/demo.cpp @@ -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" ); diff --git a/cl_dll/geiger.cpp b/cl_dll/geiger.cpp index 339c8ee1..89d2b951 100644 --- a/cl_dll/geiger.cpp +++ b/cl_dll/geiger.cpp @@ -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 ) { diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index 6540671e..e14182b8 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -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]; } } diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 63e6f6d8..f305f321 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -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; } } diff --git a/cl_dll/message.cpp b/cl_dll/message.cpp index 15e62188..29834a13 100644 --- a/cl_dll/message.cpp +++ b/cl_dll/message.cpp @@ -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 } diff --git a/cl_dll/saytext.cpp b/cl_dll/saytext.cpp index b084f44b..bf8eca80 100644 --- a/cl_dll/saytext.cpp +++ b/cl_dll/saytext.cpp @@ -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; diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index f67a994d..9ce6208e 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -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 ); diff --git a/dlls/apache.cpp b/dlls/apache.cpp index a863e3c2..e69d72e9 100644 --- a/dlls/apache.cpp +++ b/dlls/apache.cpp @@ -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 ); } diff --git a/dlls/combat.cpp b/dlls/combat.cpp index c6ab3efe..df079af7 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -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 ); diff --git a/dlls/func_break.cpp b/dlls/func_break.cpp index 27324260..98432d06 100644 --- a/dlls/func_break.cpp +++ b/dlls/func_break.cpp @@ -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 diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index bcb71005..7f7e39e5 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -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; } diff --git a/dlls/hornet.cpp b/dlls/hornet.cpp index 6fc79aa7..782e1a27 100644 --- a/dlls/hornet.cpp +++ b/dlls/hornet.cpp @@ -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 ) ) { diff --git a/dlls/islave.cpp b/dlls/islave.cpp index f66a57aa..51883be3 100644 --- a/dlls/islave.cpp +++ b/dlls/islave.cpp @@ -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 ) diff --git a/dlls/monsters.cpp b/dlls/monsters.cpp index 72eb331d..e14dbace 100644 --- a/dlls/monsters.cpp +++ b/dlls/monsters.cpp @@ -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(); + + if( flDist < flBestDist ) + { + iBestSound = iThisSound; + flBestDist = flDist; + } } - } - iThisSound = pSound->m_iNextAudible; + 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; } diff --git a/dlls/nihilanth.cpp b/dlls/nihilanth.cpp index 5a789f2b..29e1073e 100644 --- a/dlls/nihilanth.cpp +++ b/dlls/nihilanth.cpp @@ -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 ); diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index c8d6296c..c8e5649c 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -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++ ) { diff --git a/dlls/osprey.cpp b/dlls/osprey.cpp index 8cd8ed1e..670ad3b7 100644 --- a/dlls/osprey.cpp +++ b/dlls/osprey.cpp @@ -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(); } diff --git a/dlls/plats.cpp b/dlls/plats.cpp index d74129e7..0f2dbe70 100644 --- a/dlls/plats.cpp +++ b/dlls/plats.cpp @@ -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 diff --git a/dlls/sound.cpp b/dlls/sound.cpp index 51f37fbb..c5061da9 100644 --- a/dlls/sound.cpp +++ b/dlls/sound.cpp @@ -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 diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index f6e2d636..7e8a9d92 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -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 ) { diff --git a/dlls/talkmonster.cpp b/dlls/talkmonster.cpp index 295a3260..581d87a9 100644 --- a/dlls/talkmonster.cpp +++ b/dlls/talkmonster.cpp @@ -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(); + } } } diff --git a/pm_shared/pm_debug.c b/pm_shared/pm_debug.c index fbe1e288..a11e0516 100644 --- a/pm_shared/pm_debug.c +++ b/pm_shared/pm_debug.c @@ -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++) {