Double promotion fixes.

This commit is contained in:
Andrey Akhmichin 2020-01-02 20:55:06 +05:00
parent 3c515fd603
commit 1fa4177d90
8 changed files with 53 additions and 54 deletions

View File

@ -87,7 +87,7 @@ void CDisplacerBall::Spawn(void)
SetTouch( &CDisplacerBall::Touch ); SetTouch( &CDisplacerBall::Touch );
SetThink( &CDisplacerBall::FlyThink ); SetThink( &CDisplacerBall::FlyThink );
pev->nextthink = gpGlobals->time + 0.2; pev->nextthink = gpGlobals->time + 0.2f;
UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0));
m_iBeams = 0; m_iBeams = 0;
@ -97,7 +97,7 @@ void CDisplacerBall::FlyThink()
{ {
ArmBeam( -1 ); ArmBeam( -1 );
ArmBeam( 1 ); ArmBeam( 1 );
pev->nextthink = gpGlobals->time + 0.05; pev->nextthink = gpGlobals->time + 0.05f;
} }
void CDisplacerBall::ArmBeam( int iSide ) void CDisplacerBall::ArmBeam( int iSide )
@ -110,16 +110,16 @@ void CDisplacerBall::ArmBeam( int iSide )
float flDist = 1.0; float flDist = 1.0;
UTIL_MakeAimVectors( pev->angles ); UTIL_MakeAimVectors( pev->angles );
Vector vecSrc = gpGlobals->v_forward * 32.0 + iSide * gpGlobals->v_right * 16.0 + gpGlobals->v_up * 36.0 + pev->origin; Vector vecSrc = gpGlobals->v_forward * 32.0f + iSide * gpGlobals->v_right * 16.0f + gpGlobals->v_up * 36.0f + pev->origin;
Vector vecAim = gpGlobals->v_up * RANDOM_FLOAT( -1.0, 1.0 ); Vector vecAim = gpGlobals->v_up * RANDOM_FLOAT( -1.0, 1.0 );
Vector vecEnd = (iSide * gpGlobals->v_right * RANDOM_FLOAT( 0.0, 1.0 ) + vecAim) * 512.0 + vecSrc; Vector vecEnd = (iSide * gpGlobals->v_right * RANDOM_FLOAT( 0.0, 1.0 ) + vecAim) * 512.0f + vecSrc;
UTIL_TraceLine( &vecSrc.x, &vecEnd.x, dont_ignore_monsters, ENT( pev ), &tr ); UTIL_TraceLine( &vecSrc.x, &vecEnd.x, dont_ignore_monsters, ENT( pev ), &tr );
if( flDist > tr.flFraction ) if( flDist > tr.flFraction )
flDist = tr.flFraction; flDist = tr.flFraction;
// Couldn't find anything close enough // Couldn't find anything close enough
if( flDist == 1.0 ) if( flDist == 1.0f )
return; return;
// The beam might already exist if we've created all beams before. // The beam might already exist if we've created all beams before.
@ -458,7 +458,7 @@ void CDisplacer::SecondaryAttack(void)
SetThink (&CDisplacer::SpinUp); SetThink (&CDisplacer::SpinUp);
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 4.0; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 4.0f;
pev->nextthink = gpGlobals->time; pev->nextthink = gpGlobals->time;
} }
@ -476,7 +476,7 @@ void CDisplacer::PrimaryAttack()
m_iFireMode = FIREMODE_FORWARD; m_iFireMode = FIREMODE_FORWARD;
SetThink (&CDisplacer::SpinUp); SetThink (&CDisplacer::SpinUp);
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.6; m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 1.6f;
pev->nextthink = gpGlobals->time; pev->nextthink = gpGlobals->time;
} }
@ -494,7 +494,7 @@ void CDisplacer::WeaponIdle(void)
int iAnim; int iAnim;
float flRand = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 0, 1); float flRand = UTIL_SharedRandomFloat(m_pPlayer->random_seed, 0, 1);
if (flRand <= 0.5) if (flRand <= 0.5f)
{ {
iAnim = DISPLACER_IDLE1; iAnim = DISPLACER_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;
@ -544,8 +544,8 @@ void CDisplacer::SpinUp( void )
EMIT_SOUND( edict(), CHAN_WEAPON, "weapons/displacer_spin2.wav", 1, ATTN_NORM ); EMIT_SOUND( edict(), CHAN_WEAPON, "weapons/displacer_spin2.wav", 1, ATTN_NORM );
SetThink (&CDisplacer::Teleport); SetThink (&CDisplacer::Teleport);
} }
pev->nextthink = gpGlobals->time + 0.9; pev->nextthink = gpGlobals->time + 0.9f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.3; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.3f;
} }
//========================================================= //=========================================================
@ -639,16 +639,16 @@ void CDisplacer::Teleport( void )
{ {
m_pPlayer->m_fInXen = !m_pPlayer->m_fInXen; m_pPlayer->m_fInXen = !m_pPlayer->m_fInXen;
/*if (m_pPlayer->m_fInXen) /*if (m_pPlayer->m_fInXen)
m_pPlayer->pev->gravity = 0.5; m_pPlayer->pev->gravity = 0.5f;
else else
m_pPlayer->pev->gravity = 1.0;*/ m_pPlayer->pev->gravity = 1.0f;*/
} }
} }
else else
{ {
EMIT_SOUND( edict(), CHAN_BODY, "buttons/button10.wav", 1, ATTN_NORM ); EMIT_SOUND( edict(), CHAN_BODY, "buttons/button10.wav", 1, ATTN_NORM );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 3.0; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 3.0f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.9; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.9f;
} }
SetThink( NULL ); SetThink( NULL );

View File

@ -1,9 +1,9 @@
//========= Copyright (c) 2004-2008, Raven City Team, All rights reserved. ============// //========= Copyright (c) 2004-2008, Raven City Team, All rights reserved. =========//
// // // //
// Purpose: // // Purpose: //
// // // //
// $NoKeywords: $ // // $NoKeywords: $ //
//===================================================================================// //==================================================================================//
//Modifided by Lost_Gamer_ //Modifided by Lost_Gamer_
#include "extdll.h" #include "extdll.h"
@ -100,7 +100,7 @@ BOOL CEagle::Deploy( )
void CEagle::Holster( int skiplocal /* = 0 */ ) void CEagle::Holster( int skiplocal /* = 0 */ )
{ {
m_fInReload = FALSE;// cancel any reload in progress. 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( DEAGLE_HOLSTER ); SendWeaponAnim( DEAGLE_HOLSTER );
if (m_pEagleLaser) if (m_pEagleLaser)
@ -123,7 +123,7 @@ void CEagle::SecondaryAttack()
{ {
EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight.wav", 1.0, ATTN_NORM, 0, PITCH_NORM); EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_ITEM, "weapons/desert_eagle_sight.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
} }
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
} }
void CEagle::PrimaryAttack() void CEagle::PrimaryAttack()
@ -133,7 +133,7 @@ void CEagle::PrimaryAttack()
if (m_fFireOnEmpty) if (m_fFireOnEmpty)
{ {
PlayEmptySound(); PlayEmptySound();
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2; m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2f;
} }
return; return;
} }
@ -141,9 +141,9 @@ void CEagle::PrimaryAttack()
// don't fire underwater // don't fire underwater
if (m_pPlayer->pev->waterlevel == 3) if (m_pPlayer->pev->waterlevel == 3)
{ {
UpdateSpot( ); UpdateSpot();
PlayEmptySound( ); PlayEmptySound();
m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.15; m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15f;
return; return;
} }
@ -177,7 +177,7 @@ void CEagle::PrimaryAttack()
if (m_pEagleLaser) if (m_pEagleLaser)
{ {
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.5; m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f;
#ifndef CLIENT_DLL #ifndef CLIENT_DLL
m_pEagleLaser->Suspend( 0.6 ); m_pEagleLaser->Suspend( 0.6 );
#endif #endif
@ -187,7 +187,7 @@ void CEagle::PrimaryAttack()
{ {
flSpread = 0.1; flSpread = 0.1;
vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 8192, BULLET_PLAYER_357, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
m_flNextPrimaryAttack = UTIL_WeaponTimeBase()+ 0.22; m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.22f;
m_fLaserOn = FALSE; m_fLaserOn = FALSE;
} }
@ -209,9 +209,9 @@ void CEagle::Reload( void )
if ( m_pEagleLaser && m_fEagleLaserActive ) if ( m_pEagleLaser && m_fEagleLaserActive )
{ {
#ifndef CLIENT_DLL #ifndef CLIENT_DLL
m_pEagleLaser->Suspend( 1.6 ); m_pEagleLaser->Suspend( 1.6f );
#endif #endif
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5; m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5f;
} }
int iResult; int iResult;
@ -251,14 +251,13 @@ void CEagle::UpdateSpot( void )
#endif #endif
} }
void CEagle::WeaponIdle( void ) void CEagle::WeaponIdle( void )
{ {
UpdateSpot( ); UpdateSpot();
if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase() ) if (m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
{ {
ResetEmptySound( ); ResetEmptySound();
m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES ); m_pPlayer->GetAutoaimVector( AUTOAIM_10DEGREES );
// only idle if the slid isn't back // only idle if the slid isn't back
@ -269,7 +268,7 @@ void CEagle::WeaponIdle( void )
if (m_pEagleLaser) if (m_pEagleLaser)
{ {
if (flRand > 0.5 ) if (flRand > 0.5f )
{ {
iAnim = DEAGLE_IDLE5;//Done iAnim = DEAGLE_IDLE5;//Done
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;
@ -282,12 +281,12 @@ void CEagle::WeaponIdle( void )
} }
else else
{ {
if (flRand <= 0.3 ) if (flRand <= 0.3f )
{ {
iAnim = DEAGLE_IDLE1;//Done iAnim = DEAGLE_IDLE1;//Done
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f;
} }
else if (flRand <= 0.6 ) else if (flRand <= 0.6f )
{ {
iAnim = DEAGLE_IDLE2; iAnim = DEAGLE_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.5f;

View File

@ -34,8 +34,8 @@
#define GONOME_TOLERANCE_MELEE1_RANGE 85 #define GONOME_TOLERANCE_MELEE1_RANGE 85
#define GONOME_TOLERANCE_MELEE2_RANGE 48 #define GONOME_TOLERANCE_MELEE2_RANGE 48
#define GONOME_TOLERANCE_MELEE1_DOT 0.7 #define GONOME_TOLERANCE_MELEE1_DOT 0.7f
#define GONOME_TOLERANCE_MELEE2_DOT 0.7 #define GONOME_TOLERANCE_MELEE2_DOT 0.7f
#define GONOME_MELEE_ATTACK_RADIUS 70 #define GONOME_MELEE_ATTACK_RADIUS 70
@ -97,7 +97,7 @@ void CGonomeGuts::Shoot( entvars_t *pevOwner, Vector vecStart, Vector vecVelocit
pSpit->pev->owner = ENT( pevOwner ); pSpit->pev->owner = ENT( pevOwner );
pSpit->SetThink( &CSquidSpit::Animate ); pSpit->SetThink( &CSquidSpit::Animate );
pSpit->pev->nextthink = gpGlobals->time + 0.1; pSpit->pev->nextthink = gpGlobals->time + 0.1f;
} }
void CGonomeGuts::Touch( CBaseEntity *pOther ) void CGonomeGuts::Touch( CBaseEntity *pOther )
@ -315,11 +315,11 @@ int CGonome::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float f
// Take 15% damage from bullets // Take 15% damage from bullets
if( bitsDamageType == DMG_BULLET ) if( bitsDamageType == DMG_BULLET )
{ {
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5; Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5f;
vecDir = vecDir.Normalize(); vecDir = vecDir.Normalize();
float flForce = DamageForce( flDamage ); float flForce = DamageForce( flDamage );
pev->velocity = pev->velocity + vecDir * flForce; pev->velocity = pev->velocity + vecDir * flForce;
flDamage *= 0.15; flDamage *= 0.15f;
} }
// HACK HACK -- until we fix this. // HACK HACK -- until we fix this.
@ -340,7 +340,7 @@ BOOL CGonome::CheckRangeAttack1(float flDot, float flDist)
return FALSE; return FALSE;
} }
if (flDist > 64 && flDist <= 784 && flDot >= 0.5 && gpGlobals->time >= m_flNextSpitTime) if (flDist > 64 && flDist <= 784 && flDot >= 0.5f && gpGlobals->time >= m_flNextSpitTime)
{ {
if (m_hEnemy != 0) if (m_hEnemy != 0)
{ {
@ -354,12 +354,12 @@ BOOL CGonome::CheckRangeAttack1(float flDot, float flDist)
if (IsMoving()) if (IsMoving())
{ {
// don't spit again for a long time, resume chasing enemy. // don't spit again for a long time, resume chasing enemy.
m_flNextSpitTime = gpGlobals->time + 5; m_flNextSpitTime = gpGlobals->time + 5.0f;
} }
else else
{ {
// not moving, so spit again pretty soon. // not moving, so spit again pretty soon.
m_flNextSpitTime = gpGlobals->time + 0.5; m_flNextSpitTime = gpGlobals->time + 0.5f;
} }
return TRUE; return TRUE;
@ -508,7 +508,7 @@ void CGonome::Spawn()
pev->movetype = MOVETYPE_STEP; pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_GREEN; m_bloodColor = BLOOD_COLOR_GREEN;
pev->effects = 0; pev->effects = 0;
pev->health = gSkillData.bullsquidHealth * 2; pev->health = gSkillData.bullsquidHealth * 2.0f;
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result ) m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE; m_MonsterState = MONSTERSTATE_NONE;

View File

@ -245,7 +245,7 @@ static BOOL IsFacing( entvars_t *pevTest, const Vector &reference )
UTIL_MakeVectorsPrivate( angle, forward, NULL, NULL ); UTIL_MakeVectorsPrivate( angle, forward, NULL, NULL );
// He's facing me, he meant it // He's facing me, he meant it
if( DotProduct( forward, vecDir ) > 0.96 ) // +/- 15 degrees or so if( DotProduct( forward, vecDir ) > 0.96f ) // +/- 15 degrees or so
{ {
return TRUE; return TRUE;
} }
@ -353,7 +353,7 @@ void CHelmet::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
if( flDamage <= 0 ) if( flDamage <= 0 )
{ {
UTIL_Ricochet( ptr->vecEndPos, 1.0 ); UTIL_Ricochet( ptr->vecEndPos, 1.0 );
flDamage = 0.01; flDamage = 0.01f;
} }
} }

View File

@ -936,7 +936,7 @@ void CMassnRepel::RepelUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
pBeam->SetFlags( BEAM_FSOLID ); pBeam->SetFlags( BEAM_FSOLID );
pBeam->SetColor( 255, 255, 255 ); pBeam->SetColor( 255, 255, 255 );
pBeam->SetThink( &CBaseEntity::SUB_Remove ); pBeam->SetThink( &CBaseEntity::SUB_Remove );
pBeam->pev->nextthink = gpGlobals->time + -4096.0 * tr.flFraction / pGrunt->pev->velocity.z + 0.5; pBeam->pev->nextthink = gpGlobals->time + -4096.0f * tr.flFraction / pGrunt->pev->velocity.z + 0.5f;
UTIL_Remove( this ); UTIL_Remove( this );
} }

View File

@ -282,7 +282,7 @@ static BOOL IsFacing(entvars_t *pevTest, const Vector &reference)
angle.x = 0; angle.x = 0;
UTIL_MakeVectorsPrivate(angle, forward, NULL, NULL); UTIL_MakeVectorsPrivate(angle, forward, NULL, NULL);
// He's facing me, he meant it // He's facing me, he meant it
if (DotProduct(forward, vecDir) > 0.96) // +/- 15 degrees or so if (DotProduct(forward, vecDir) > 0.96f) // +/- 15 degrees or so
{ {
return TRUE; return TRUE;
} }

View File

@ -237,7 +237,7 @@ class CItemBattery : public CItem
char szcharge[64]; char szcharge[64];
if( FClassnameIs( pev, "item_armor" ) ) if( FClassnameIs( pev, "item_armor" ) )
pPlayer->pev->armorvalue += gSkillData.batteryCapacity * 1.5; pPlayer->pev->armorvalue += gSkillData.batteryCapacity * 1.5f;
else else
pPlayer->pev->armorvalue += gSkillData.batteryCapacity; pPlayer->pev->armorvalue += gSkillData.batteryCapacity;
pPlayer->pev->armorvalue = Q_min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY ); pPlayer->pev->armorvalue = Q_min( pPlayer->pev->armorvalue, MAX_NORMAL_BATTERY );

View File

@ -143,18 +143,18 @@ void CZombie::Killed( entvars_t *pevAttacker, int iGib )
float height = ( m_hEnemy->pev->origin.z + m_hEnemy->pev->view_ofs.z - pCrab->pev->origin.z ); float height = ( m_hEnemy->pev->origin.z + m_hEnemy->pev->view_ofs.z - pCrab->pev->origin.z );
if( height < 4 ) if( height < 4 )
height = 4; height = 4;
float speed = sqrt( 1.5 * gravity * height ); float speed = sqrt( 1.5f * gravity * height );
float time = speed / gravity; float time = speed / gravity;
vecJumpDir = ( m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs - pCrab->pev->origin ); vecJumpDir = ( m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs - pCrab->pev->origin );
vecJumpDir = vecJumpDir * ( 1.0 / time ); vecJumpDir = vecJumpDir * ( 1.0f / time );
vecJumpDir.z = speed; vecJumpDir.z = speed;
float distance = vecJumpDir.Length(); float distance = vecJumpDir.Length();
if( distance > 100 ) if( distance > 100 )
vecJumpDir = vecJumpDir * ( 100.0 / distance ); vecJumpDir = vecJumpDir * ( 100.0f / distance );
} }
else else
vecJumpDir = Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, gpGlobals->v_up.z ) * 20; vecJumpDir = Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, gpGlobals->v_up.z ) * 20;