From e4df452f64ff6ef82462ffeab236b34118494ef0 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin Date: Thu, 2 Jan 2020 22:07:41 +0500 Subject: [PATCH] Double promotion fixes. --- dlls/client.cpp | 2 +- dlls/eftd/ak47.cpp | 26 +++++++++++++------------- dlls/eftd/diablo.cpp | 2 +- dlls/eftd/mac10.cpp | 18 +++++++++--------- dlls/glock.cpp | 20 ++++++++++---------- dlls/mp5.cpp | 2 +- dlls/player.cpp | 24 ++++++++++++------------ 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index 5ada8166..78bff8a0 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -529,7 +529,7 @@ void ClientCommand( edict_t *pEntity ) } else if( FStrEq( pcmd, "imacheater" ) ) { - if( g_flWeaponCheat != 0.0 ) + if( g_flWeaponCheat != 0.0f ) { CBasePlayer *pPlayer = GetClassPtr( (CBasePlayer *)pev ); gEvilImpulse101 = TRUE; diff --git a/dlls/eftd/ak47.cpp b/dlls/eftd/ak47.cpp index 7e310776..01d5697f 100644 --- a/dlls/eftd/ak47.cpp +++ b/dlls/eftd/ak47.cpp @@ -113,14 +113,14 @@ void CAK47::PrimaryAttack() if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound(); - m_flNextPrimaryAttack = 0.15; + m_flNextPrimaryAttack = 0.15f; return; } if (m_iClip <= 0) { PlayEmptySound(); - m_flNextPrimaryAttack = 0.15; + m_flNextPrimaryAttack = 0.15f; return; } @@ -143,23 +143,23 @@ void CAK47::PrimaryAttack() // Allow for higher accuracy when the player is crouching. if( m_pPlayer->pev->flags & FL_DUCKING ) { - vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 1.6 + 0.01, m_pPlayer->m_flBulletSpreadCoefficient * 1.4 + 0.01, 0 ); - if( m_pPlayer->m_flBulletSpreadCoefficient < 0.045 ) - m_pPlayer->m_flBulletSpreadCoefficient += 0.006; + vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 1.6f + 0.01f, m_pPlayer->m_flBulletSpreadCoefficient * 1.4f + 0.01f, 0 ); + if( m_pPlayer->m_flBulletSpreadCoefficient < 0.045f ) + m_pPlayer->m_flBulletSpreadCoefficient += 0.006f; } else { if( m_pPlayer->pev->button & IN_JUMP ) { - vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 8.0 + 0.3, m_pPlayer->m_flBulletSpreadCoefficient * 6.0 + 0.2, 0 ); - if( m_pPlayer->m_flBulletSpreadCoefficient < 0.1 ) - m_pPlayer->m_flBulletSpreadCoefficient += 0.012; + vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 8.0f + 0.3f, m_pPlayer->m_flBulletSpreadCoefficient * 6.0f + 0.2f, 0 ); + if( m_pPlayer->m_flBulletSpreadCoefficient < 0.1f ) + m_pPlayer->m_flBulletSpreadCoefficient += 0.012f; } else { - vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 2.4 + 0.065, m_pPlayer->m_flBulletSpreadCoefficient * 2.1 + 0.05, 0 ); - if( m_pPlayer->m_flBulletSpreadCoefficient < 0.08 ) - m_pPlayer->m_flBulletSpreadCoefficient += 0.009; + vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 2.4f + 0.065f, m_pPlayer->m_flBulletSpreadCoefficient * 2.1f + 0.05f, 0 ); + if( m_pPlayer->m_flBulletSpreadCoefficient < 0.08f ) + m_pPlayer->m_flBulletSpreadCoefficient += 0.009f; } } @@ -175,10 +175,10 @@ void CAK47::PrimaryAttack() PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usAK47, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0); - m_flNextPrimaryAttack = GetNextAttackDelay(0.1); + m_flNextPrimaryAttack = GetNextAttackDelay(0.1f); if (m_flNextPrimaryAttack < UTIL_WeaponTimeBase()) - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1; + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1f; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); } diff --git a/dlls/eftd/diablo.cpp b/dlls/eftd/diablo.cpp index fed3e251..9b913ba0 100644 --- a/dlls/eftd/diablo.cpp +++ b/dlls/eftd/diablo.cpp @@ -240,7 +240,7 @@ void CDiablo::HandleAnimEvent(MonsterEvent_t *pEvent) case DIABLO_AE_ATTACK_BOTH: { // do stuff for this event. - CBaseEntity *pHurt = CheckTraceHullAttack(70, gSkillData.diabloDmgBothSlash * 2.2 + RANDOM_LONG( 0, 9 ), DMG_SLASH ); + CBaseEntity *pHurt = CheckTraceHullAttack(70, gSkillData.diabloDmgBothSlash * 2.2f + RANDOM_LONG( 0, 9 ), DMG_SLASH ); if (pHurt) { if (pHurt->pev->flags & (FL_MONSTER | FL_CLIENT)) diff --git a/dlls/eftd/mac10.cpp b/dlls/eftd/mac10.cpp index 653c5c60..2caf81fe 100644 --- a/dlls/eftd/mac10.cpp +++ b/dlls/eftd/mac10.cpp @@ -113,14 +113,14 @@ void CMac10::PrimaryAttack() if (m_pPlayer->pev->waterlevel == 3) { PlayEmptySound(); - m_flNextPrimaryAttack = 0.15; + m_flNextPrimaryAttack = 0.15f; return; } if (m_iClip <= 0) { PlayEmptySound(); - m_flNextPrimaryAttack = 0.15; + m_flNextPrimaryAttack = 0.15f; return; } @@ -140,13 +140,13 @@ void CMac10::PrimaryAttack() Vector vecDir; Vector vecSpread; - vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 1.2 + 0.03, m_pPlayer->m_flBulletSpreadCoefficient * 0.9 + 0.02, 0 ); + vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 1.2f + 0.03f, m_pPlayer->m_flBulletSpreadCoefficient * 0.9f + 0.02f, 0 ); - if( m_pPlayer->m_flBulletSpreadCoefficient < 0.06 ) - m_pPlayer->m_flBulletSpreadCoefficient += 0.0027; + if( m_pPlayer->m_flBulletSpreadCoefficient < 0.06f ) + m_pPlayer->m_flBulletSpreadCoefficient += 0.0027f; - if( m_pPlayer->m_flBulletSpreadCoefficient < 0.1 ) - m_pPlayer->m_flBulletSpreadCoefficient += 0.002; + if( m_pPlayer->m_flBulletSpreadCoefficient < 0.1f ) + m_pPlayer->m_flBulletSpreadCoefficient += 0.002f; // single player spread vecDir = m_pPlayer->FireBulletsPlayer(1, vecSrc, vecAiming, vecSpread, 8192, BULLET_PLAYER_MAC10, 2, 0, m_pPlayer->pev, m_pPlayer->random_seed); @@ -160,10 +160,10 @@ void CMac10::PrimaryAttack() PLAYBACK_EVENT_FULL(flags, m_pPlayer->edict(), m_usMac10, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0); - m_flNextPrimaryAttack = GetNextAttackDelay(0.075); + m_flNextPrimaryAttack = GetNextAttackDelay(0.075f); if (m_flNextPrimaryAttack < UTIL_WeaponTimeBase()) - m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.075; + m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.075f; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat(m_pPlayer->random_seed, 10, 15); } diff --git a/dlls/glock.cpp b/dlls/glock.cpp index c7d59c1b..f5d2a7ec 100644 --- a/dlls/glock.cpp +++ b/dlls/glock.cpp @@ -107,7 +107,7 @@ void CGlock::Holster(int skiplocal /*= 0*/) { m_fInReload = FALSE;// cancel any reload in progress. - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; SendWeaponAnim( GLOCK_HOLSTER ); } @@ -183,23 +183,23 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim ) // Allow for higher accuracy when the player is crouching. if( m_pPlayer->pev->flags & FL_DUCKING ) { - vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 2.3 + 0.012, m_pPlayer->m_flBulletSpreadCoefficient * 1.5 + 0.01, 0 ); - if( m_pPlayer->m_flBulletSpreadCoefficient < 0.05 ) - m_pPlayer->m_flBulletSpreadCoefficient += 0.003; + vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 2.3f + 0.012f, m_pPlayer->m_flBulletSpreadCoefficient * 1.5f + 0.01f, 0 ); + if( m_pPlayer->m_flBulletSpreadCoefficient < 0.05f ) + m_pPlayer->m_flBulletSpreadCoefficient += 0.003f; } else { if( m_pPlayer->pev->button & IN_JUMP ) { - vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 8.0 + 0.1, m_pPlayer->m_flBulletSpreadCoefficient * 5.0 + 0.1, 0 ); - if( m_pPlayer->m_flBulletSpreadCoefficient < 0.8 ) - m_pPlayer->m_flBulletSpreadCoefficient += 0.009; + vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 8.0f + 0.1f, m_pPlayer->m_flBulletSpreadCoefficient * 5.0f + 0.1f, 0 ); + if( m_pPlayer->m_flBulletSpreadCoefficient < 0.8f ) + m_pPlayer->m_flBulletSpreadCoefficient += 0.009f; } else { - vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 3.0 + 0.065, m_pPlayer->m_flBulletSpreadCoefficient * 2.0 + 0.055, 0 ); - if( m_pPlayer->m_flBulletSpreadCoefficient < 0.06 ) - m_pPlayer->m_flBulletSpreadCoefficient += 0.0045; + vecSpread = Vector( m_pPlayer->m_flBulletSpreadCoefficient * 3.0f + 0.065f, m_pPlayer->m_flBulletSpreadCoefficient * 2.0f + 0.055f, 0 ); + if( m_pPlayer->m_flBulletSpreadCoefficient < 0.06f ) + m_pPlayer->m_flBulletSpreadCoefficient += 0.0045f; } } diff --git a/dlls/mp5.cpp b/dlls/mp5.cpp index ba9aba71..49338b3c 100644 --- a/dlls/mp5.cpp +++ b/dlls/mp5.cpp @@ -130,7 +130,7 @@ void CMP5::Holster( int skiplocal /*= 0*/ ) { m_fInReload = FALSE;// cancel any reload in progress. - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; #ifndef CLIENT_DLL if( m_pSpot ) diff --git a/dlls/player.cpp b/dlls/player.cpp index 0691b021..734db5cf 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -415,7 +415,7 @@ void CBasePlayer::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector ve TraceBleed( flDamage, vecDir, ptr, bitsDamageType ); AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType ); - if( flDamage >= pev->health * 0.333 ) + if( flDamage >= pev->health * 0.333f ) { switch( ptr->iHitgroup ) { @@ -2630,37 +2630,37 @@ pt_end: if( pev->flags & FL_DUCKING ) { - if( gpGlobals->frametime > m_flNextBulletSpreadRandTime + 0.44 ) + if( gpGlobals->frametime > m_flNextBulletSpreadRandTime + 0.44f ) { m_flNextBulletSpreadRandTime = gpGlobals->frametime; - m_flBulletSpreadCoefficient -= 0.0025; + m_flBulletSpreadCoefficient -= 0.0025f; if( !( m_afButtonPressed | m_afButtonReleased ) ) - m_flBulletSpreadCoefficient -= 0.015; + m_flBulletSpreadCoefficient -= 0.015f; } } else { if( pev->button & IN_JUMP ) { - if( gpGlobals->frametime > m_flNextBulletSpreadRandTime + 0.6 ) + if( gpGlobals->frametime > m_flNextBulletSpreadRandTime + 0.6f ) { m_flNextBulletSpreadRandTime = gpGlobals->frametime; - m_flBulletSpreadCoefficient -= 0.0015; + m_flBulletSpreadCoefficient -= 0.0015f; if( !( m_afButtonPressed | m_afButtonReleased ) ) - m_flBulletSpreadCoefficient -= 0.004; + m_flBulletSpreadCoefficient -= 0.004f; } } - else if( gpGlobals->frametime > m_flNextBulletSpreadRandTime + 0.47 ) + else if( gpGlobals->frametime > m_flNextBulletSpreadRandTime + 0.47f ) { m_flNextBulletSpreadRandTime = gpGlobals->frametime; - m_flBulletSpreadCoefficient -= 0.001; + m_flBulletSpreadCoefficient -= 0.001f; if( !( m_afButtonPressed | m_afButtonReleased ) ) - m_flBulletSpreadCoefficient -= 0.012; + m_flBulletSpreadCoefficient -= 0.012f; } } - if( m_flBulletSpreadCoefficient < 0.001 ) - m_flBulletSpreadCoefficient = 0.001; + if( m_flBulletSpreadCoefficient < 0.001f ) + m_flBulletSpreadCoefficient = 0.001f; #else return; #endif