Merge branch 'double_promotion'

This commit is contained in:
Andrey Akhmichin 2019-11-05 02:48:47 +05:00
commit 4a02cfc012
113 changed files with 2974 additions and 2906 deletions

View File

@ -25,6 +25,11 @@ project (CLDLL)
set (CLDLL_LIBRARY client)
include(CheckIncludeFile)
check_include_file("tgmath.h" HAVE_TGMATH_H)
if(HAVE_TGMATH_H)
add_definitions(-DHAVE_TGMATH_H)
endif()
add_definitions(-DCLIENT_WEAPONS -DCLIENT_DLL)

View File

@ -19,7 +19,7 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <cmath>
#include "studio_util.h"
#include "r_studioint.h"

View File

@ -19,7 +19,7 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <cmath>
#include "studio_util.h"
#include "r_studioint.h"

View File

@ -80,9 +80,9 @@ int CHudMOTD::Draw( float fTime )
{
ypos = ROW_RANGE_MIN + 7 + scroll;
if( ypos > ROW_RANGE_MIN + 4 )
scroll-= ( ypos - ( ROW_RANGE_MIN + 4 ) ) / 3.0;
scroll-= ( ypos - ( ROW_RANGE_MIN + 4 ) ) / 3.0f;
if( ypos + height < ROW_RANGE_MAX )
scroll+= ( ROW_RANGE_MAX - ( ypos + height ) ) / 3.0;
scroll+= ( ROW_RANGE_MAX - ( ypos + height ) ) / 3.0f;
ypos_r = ROW_RANGE_MIN;
height = ROW_RANGE_MAX;
}

View File

@ -21,7 +21,7 @@
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <cmath>
#include "studio_util.h"
#include "r_studioint.h"
@ -138,27 +138,27 @@ void CStudioModelRenderer::StudioCalcBoneAdj( float dadt, float *adj, const byte
int a, b;
a = ( pcontroller1[j] + 128 ) % 256;
b = ( pcontroller2[j] + 128 ) % 256;
value = ( ( a * dadt ) + ( b * ( 1 - dadt ) ) - 128 ) * ( 360.0 / 256.0 ) + pbonecontroller[j].start;
value = ( ( a * dadt ) + ( b * ( 1.0f - dadt ) ) - 128.0f ) * ( 360.0f / 256.0f ) + pbonecontroller[j].start;
}
else
{
value = ( ( pcontroller1[i] * dadt + ( pcontroller2[i] ) * ( 1.0 - dadt ) ) ) * ( 360.0 / 256.0 ) + pbonecontroller[j].start;
value = ( ( pcontroller1[i] * dadt + ( pcontroller2[i] ) * ( 1.0f - dadt ) ) ) * ( 360.0f / 256.0f ) + pbonecontroller[j].start;
}
}
else
{
value = ( pcontroller1[i] * dadt + pcontroller2[i] * ( 1.0 - dadt ) ) / 255.0;
if( value < 0 ) value = 0;
if( value > 1.0 ) value = 1.0;
value = ( 1.0 - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
value = ( pcontroller1[i] * dadt + pcontroller2[i] * ( 1.0f - dadt ) ) / 255.0f;
if( value < 0.0f ) value = 0.0f;
if( value > 1.0f ) value = 1.0f;
value = ( 1.0f - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
}
// Con_DPrintf( "%d %d %f : %f\n", m_pCurrentEntity->curstate.controller[j], m_pCurrentEntity->latched.prevcontroller[j], value, dadt );
}
else
{
value = mouthopen / 64.0;
if( value > 1.0 ) value = 1.0;
value = ( 1.0 - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
value = mouthopen / 64.0f;
if( value > 1.0f ) value = 1.0f;
value = ( 1.0f - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
// Con_DPrintf( "%d %f\n", mouthopen, value );
}
switch( pbonecontroller[j].type & STUDIO_TYPES )
@ -166,7 +166,7 @@ void CStudioModelRenderer::StudioCalcBoneAdj( float dadt, float *adj, const byte
case STUDIO_XR:
case STUDIO_YR:
case STUDIO_ZR:
adj[j] = value * ( M_PI / 180.0 );
adj[j] = value * ( M_PI_F / 180.0f );
break;
case STUDIO_X:
case STUDIO_Y:
@ -305,7 +305,7 @@ void CStudioModelRenderer::StudioCalcBonePosition( int frame, float s, mstudiobo
// and there's more data in the span
if( panimvalue->num.valid > k + 1 )
{
pos[j] += ( panimvalue[k + 1].value * ( 1.0 - s ) + s * panimvalue[k + 2].value ) * pbone->scale[j];
pos[j] += ( panimvalue[k + 1].value * ( 1.0f - s ) + s * panimvalue[k + 2].value ) * pbone->scale[j];
}
else
{
@ -317,7 +317,7 @@ void CStudioModelRenderer::StudioCalcBonePosition( int frame, float s, mstudiobo
// are we at the end of the repeating values section and there's another section with data?
if( panimvalue->num.total <= k + 1 )
{
pos[j] += ( panimvalue[panimvalue->num.valid].value * ( 1.0 - s ) + s * panimvalue[panimvalue->num.valid + 2].value ) * pbone->scale[j];
pos[j] += ( panimvalue[panimvalue->num.valid].value * ( 1.0f - s ) + s * panimvalue[panimvalue->num.valid + 2].value ) * pbone->scale[j];
}
else
{
@ -344,12 +344,12 @@ void CStudioModelRenderer::StudioSlerpBones( vec4_t q1[], float pos1[][3], vec4_
vec4_t q3;
float s1;
if( s < 0 )
s = 0;
else if( s > 1.0 )
s = 1.0;
if( s < 0.0f )
s = 0.0f;
else if( s > 1.0f )
s = 1.0f;
s1 = 1.0 - s;
s1 = 1.0f - s;
for( i = 0; i < m_pStudioHeader->numbones; i++ )
{
@ -410,17 +410,17 @@ void CStudioModelRenderer::StudioPlayerBlend( mstudioseqdesc_t *pseqdesc, int *p
*pBlend = ( *pPitch * 3 );
if( *pBlend < pseqdesc->blendstart[0] )
{
*pPitch -= pseqdesc->blendstart[0] / 3.0;
*pPitch -= pseqdesc->blendstart[0] / 3.0f;
*pBlend = 0;
}
else if( *pBlend > pseqdesc->blendend[0] )
{
*pPitch -= pseqdesc->blendend[0] / 3.0;
*pPitch -= pseqdesc->blendend[0] / 3.0f;
*pBlend = 255;
}
else
{
if( pseqdesc->blendend[0] - pseqdesc->blendstart[0] < 0.1 ) // catch qc error
if( pseqdesc->blendend[0] - pseqdesc->blendstart[0] < 0.1f ) // catch qc error
*pBlend = 127;
else
*pBlend = 255 * ( *pBlend - pseqdesc->blendstart[0] ) / ( pseqdesc->blendend[0] - pseqdesc->blendstart[0] );
@ -475,11 +475,11 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
if( m_fDoInterp )
{
// ugly hack to interpolate angle, position. current is reached 0.1 seconds after being set
f = f - 1.0;
f = f - 1.0f;
}
else
{
f = 0;
f = 0.0f;
}
for( i = 0; i < 3; i++ )
@ -489,7 +489,7 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
// NOTE: Because multiplayer lag can be relatively large, we don't want to cap
// f at 1.5 anymore.
//if( f > -1.0 && f < 1.5 ) {}
//if( f > -1.0f && f < 1.5f ) {}
//Con_DPrintf( "%.0f %.0f\n",m_pCurrentEntity->msg_angles[0][YAW], m_pCurrentEntity->msg_angles[1][YAW] );
for( i = 0; i < 3; i++ )
{
@ -499,13 +499,13 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
ang2 = m_pCurrentEntity->latched.prevangles[i];
d = ang1 - ang2;
if( d > 180 )
if( d > 180.0f )
{
d -= 360;
d -= 360.0f;
}
else if( d < -180 )
else if( d < -180.0f )
{
d += 360;
d += 360.0f;
}
angles[i] += d * f;
@ -547,9 +547,9 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
{
for( i = 0; i < 4; i++ )
{
(*m_paliastransform)[0][i] *= m_fSoftwareXScale * ( 1.0 / ( ZISCALE * 0x10000 ) );
(*m_paliastransform)[1][i] *= m_fSoftwareYScale * ( 1.0 / ( ZISCALE * 0x10000 ) );
(*m_paliastransform)[2][i] *= 1.0 / ( ZISCALE * 0x10000 );
(*m_paliastransform)[0][i] *= m_fSoftwareXScale * ( 1.0f / ( ZISCALE * 0x10000 ) );
(*m_paliastransform)[1][i] *= m_fSoftwareYScale * ( 1.0f / ( ZISCALE * 0x10000 ) );
(*m_paliastransform)[2][i] *= 1.0f / ( ZISCALE * 0x10000 );
}
}
}
@ -567,14 +567,14 @@ StudioEstimateInterpolant
*/
float CStudioModelRenderer::StudioEstimateInterpolant( void )
{
float dadt = 1.0;
float dadt = 1.0f;
if( m_fDoInterp && ( m_pCurrentEntity->curstate.animtime >= m_pCurrentEntity->latched.prevanimtime + 0.01 ) )
if( m_fDoInterp && ( m_pCurrentEntity->curstate.animtime >= m_pCurrentEntity->latched.prevanimtime + 0.01f ) )
{
dadt = ( m_clTime - m_pCurrentEntity->curstate.animtime ) / 0.1;
if( dadt > 2.0 )
dadt = ( m_clTime - m_pCurrentEntity->curstate.animtime ) / 0.1f;
if( dadt > 2.0f )
{
dadt = 2.0;
dadt = 2.0f;
}
}
return dadt;
@ -598,14 +598,14 @@ void CStudioModelRenderer::StudioCalcRotations( float pos[][3], vec4_t *q, mstud
if( f > pseqdesc->numframes - 1 )
{
f = 0; // bah, fix this bug with changing sequences too fast
f = 0.0f; // bah, fix this bug with changing sequences too fast
}
// BUG ( somewhere else ) but this code should validate this data.
// This could cause a crash if the frame # is negative, so we'll go ahead
// and clamp it here
else if( f < -0.01 )
else if( f < -0.01f )
{
f = -0.01;
f = -0.01f;
}
frame = (int)f;
@ -635,18 +635,18 @@ void CStudioModelRenderer::StudioCalcRotations( float pos[][3], vec4_t *q, mstud
if( pseqdesc->motiontype & STUDIO_X )
{
pos[pseqdesc->motionbone][0] = 0.0;
pos[pseqdesc->motionbone][0] = 0.0f;
}
if( pseqdesc->motiontype & STUDIO_Y )
{
pos[pseqdesc->motionbone][1] = 0.0;
pos[pseqdesc->motionbone][1] = 0.0f;
}
if( pseqdesc->motiontype & STUDIO_Z )
{
pos[pseqdesc->motionbone][2] = 0.0;
pos[pseqdesc->motionbone][2] = 0.0f;
}
s = 0 * ( ( 1.0 - ( f - (int)( f ) ) ) / ( pseqdesc->numframes ) ) * m_pCurrentEntity->curstate.framerate;
s = 0 * ( ( 1.0f - ( f - (int)( f ) ) ) / ( pseqdesc->numframes ) ) * m_pCurrentEntity->curstate.framerate;
if( pseqdesc->motiontype & STUDIO_LX )
{
@ -679,7 +679,7 @@ void CStudioModelRenderer::StudioFxTransform( cl_entity_t *ent, float transform[
int axis = gEngfuncs.pfnRandomLong( 0, 1 );
if( axis == 1 ) // Choose between x & z
axis = 2;
VectorScale( transform[axis], gEngfuncs.pfnRandomFloat( 1, 1.484 ), transform[axis] );
VectorScale( transform[axis], gEngfuncs.pfnRandomFloat( 1.0f, 1.484f ), transform[axis] );
}
else if( gEngfuncs.pfnRandomLong( 0, 49 ) == 0 )
{
@ -687,7 +687,7 @@ void CStudioModelRenderer::StudioFxTransform( cl_entity_t *ent, float transform[
int axis = gEngfuncs.pfnRandomLong(0,1);
if( axis == 1 ) // Choose between x & z
axis = 2;
offset = gEngfuncs.pfnRandomFloat( -10, 10 );
offset = gEngfuncs.pfnRandomFloat( -10.0f, 10.0f );
transform[gEngfuncs.pfnRandomLong( 0, 2 )][3] += offset;
}
break;
@ -695,7 +695,7 @@ void CStudioModelRenderer::StudioFxTransform( cl_entity_t *ent, float transform[
{
float scale;
scale = 1.0 + ( m_clTime - ent->curstate.animtime ) * 10.0;
scale = 1.0f + ( m_clTime - ent->curstate.animtime ) * 10.0f;
if( scale > 2 ) // Don't blow up more than 200%
scale = 2;
transform[0][1] *= scale;
@ -734,7 +734,7 @@ float CStudioModelRenderer::StudioEstimateFrame( mstudioseqdesc_t *pseqdesc )
if( pseqdesc->numframes <= 1 )
{
f = 0;
f = 0.0;
}
else
{
@ -1188,10 +1188,10 @@ void CStudioModelRenderer::StudioEstimateGait( entity_state_t *pplayer )
vec3_t est_velocity;
dt = ( m_clTime - m_clOldTime );
if( dt < 0 )
dt = 0;
else if( dt > 1.0 )
dt = 1;
if( dt < 0.0f )
dt = 0.0f;
else if( dt > 1.0f )
dt = 1.0f;
if( dt == 0 || m_pPlayerInfo->renderframe == m_nFrameCount )
{
@ -1221,29 +1221,29 @@ void CStudioModelRenderer::StudioEstimateGait( entity_state_t *pplayer )
if( est_velocity[1] == 0 && est_velocity[0] == 0 )
{
float flYawDiff = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;
flYawDiff = flYawDiff - (int)( flYawDiff / 360 ) * 360;
if( flYawDiff > 180 )
flYawDiff -= 360;
if( flYawDiff < -180 )
flYawDiff += 360;
flYawDiff = flYawDiff - (int)( flYawDiff / 360.0f ) * 360.0f;
if( flYawDiff > 180.0f )
flYawDiff -= 360.0f;
if( flYawDiff < -180.0f )
flYawDiff += 360.0f;
if( dt < 0.25 )
flYawDiff *= dt * 4;
if( dt < 0.25f )
flYawDiff *= dt * 4.0f;
else
flYawDiff *= dt;
m_pPlayerInfo->gaityaw += flYawDiff;
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - (int)( m_pPlayerInfo->gaityaw / 360 ) * 360;
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - (int)( m_pPlayerInfo->gaityaw / 360.0f ) * 360.0f;
m_flGaitMovement = 0;
}
else
{
m_pPlayerInfo->gaityaw = ( atan2( est_velocity[1], est_velocity[0] ) * 180 / M_PI );
if( m_pPlayerInfo->gaityaw > 180 )
m_pPlayerInfo->gaityaw = 180;
if( m_pPlayerInfo->gaityaw < -180 )
m_pPlayerInfo->gaityaw = -180;
m_pPlayerInfo->gaityaw = ( atan2( est_velocity[1], est_velocity[0] ) * 180.0f / M_PI_F );
if( m_pPlayerInfo->gaityaw > 180.0f )
m_pPlayerInfo->gaityaw = 180.0f;
if( m_pPlayerInfo->gaityaw < -180.0f )
m_pPlayerInfo->gaityaw = -180.0f;
}
}
@ -1277,10 +1277,10 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
// Con_DPrintf( "%f %d\n", m_pCurrentEntity->angles[PITCH], m_pCurrentEntity->blending[0] );
dt = ( m_clTime - m_clOldTime );
if( dt < 0 )
dt = 0;
else if( dt > 1.0 )
dt = 1;
if( dt < 0.0f )
dt = 0.0f;
else if( dt > 1.0f )
dt = 1.0f;
StudioEstimateGait( pplayer );
@ -1288,38 +1288,38 @@ void CStudioModelRenderer::StudioProcessGait( entity_state_t *pplayer )
// calc side to side turning
flYaw = m_pCurrentEntity->angles[YAW] - m_pPlayerInfo->gaityaw;
flYaw = flYaw - (int)( flYaw / 360 ) * 360;
if( flYaw < -180 )
flYaw = flYaw + 360;
if( flYaw > 180 )
flYaw = flYaw - 360;
flYaw = flYaw - (int)( flYaw / 360.0f ) * 360.0f;
if( flYaw < -180.0f )
flYaw = flYaw + 360.0f;
if( flYaw > 180.0f )
flYaw = flYaw - 360.0f;
if( flYaw > 120 )
if( flYaw > 120.0f )
{
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - 180;
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw - 180.0f;
m_flGaitMovement = -m_flGaitMovement;
flYaw = flYaw - 180;
flYaw = flYaw - 180.0f;
}
else if( flYaw < -120 )
else if( flYaw < -120.0f )
{
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw + 180;
m_pPlayerInfo->gaityaw = m_pPlayerInfo->gaityaw + 180.0f;
m_flGaitMovement = -m_flGaitMovement;
flYaw = flYaw + 180;
flYaw = flYaw + 180.0f;
}
// adjust torso
m_pCurrentEntity->curstate.controller[0] = ( ( flYaw / 4.0 ) + 30 ) / ( 60.0 / 255.0 );
m_pCurrentEntity->curstate.controller[1] = ( ( flYaw / 4.0 ) + 30 ) / ( 60.0 / 255.0 );
m_pCurrentEntity->curstate.controller[2] = ( ( flYaw / 4.0 ) + 30 ) / ( 60.0 / 255.0 );
m_pCurrentEntity->curstate.controller[3] = ( ( flYaw / 4.0 ) + 30 ) / ( 60.0 / 255.0 );
m_pCurrentEntity->curstate.controller[0] = ( ( flYaw / 4.0f ) + 30.0f ) / ( 60.0f / 255.0f );
m_pCurrentEntity->curstate.controller[1] = ( ( flYaw / 4.0f ) + 30.0f ) / ( 60.0f / 255.0f );
m_pCurrentEntity->curstate.controller[2] = ( ( flYaw / 4.0f ) + 30.0f ) / ( 60.0f / 255.0f );
m_pCurrentEntity->curstate.controller[3] = ( ( flYaw / 4.0f ) + 30.0f ) / ( 60.0f / 255.0f );
m_pCurrentEntity->latched.prevcontroller[0] = m_pCurrentEntity->curstate.controller[0];
m_pCurrentEntity->latched.prevcontroller[1] = m_pCurrentEntity->curstate.controller[1];
m_pCurrentEntity->latched.prevcontroller[2] = m_pCurrentEntity->curstate.controller[2];
m_pCurrentEntity->latched.prevcontroller[3] = m_pCurrentEntity->curstate.controller[3];
m_pCurrentEntity->angles[YAW] = m_pPlayerInfo->gaityaw;
if( m_pCurrentEntity->angles[YAW] < -0 )
m_pCurrentEntity->angles[YAW] += 360;
if( m_pCurrentEntity->angles[YAW] < -0.0f )
m_pCurrentEntity->angles[YAW] += 360.0f;
m_pCurrentEntity->latched.prevangles[YAW] = m_pCurrentEntity->angles[YAW];
if( pplayer->gaitsequence >= m_pStudioHeader->numseq )

View File

@ -864,7 +864,7 @@ int CHudAmmo::Draw( float flTime )
a = (int)Q_max( MIN_ALPHA, m_fFade );
if( m_fFade > 0 )
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f );
UnpackRGB( r, g, b, RGB_YELLOWISH );

View File

@ -63,7 +63,7 @@ int CHudAmmoSecondary::Draw( float flTime )
UnpackRGB( r, g, b, RGB_YELLOWISH );
a = (int)Q_max( MIN_ALPHA, m_fFade );
if( m_fFade > 0 )
m_fFade -= ( gHUD.m_flTimeDelta * 20 ); // slowly lower alpha to fade out icons
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f ); // slowly lower alpha to fade out icons
ScaleColors( r, g, b, a );
AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;

View File

@ -78,7 +78,7 @@ int CHudBattery::Draw( float flTime )
wrect_t rc;
rc = *m_prc2;
rc.top += m_iHeight * ( (float)( 100 - ( Q_min( 100, m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
rc.top += m_iHeight * ( (float)( 100 - ( Q_min( 100, m_iBat ) ) ) * 0.01f ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
UnpackRGB( r, g, b, RGB_YELLOWISH );
@ -91,7 +91,7 @@ int CHudBattery::Draw( float flTime )
if( m_fFade > FADE_TIME )
m_fFade = FADE_TIME;
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f );
if( m_fFade <= 0 )
{
a = 128;

View File

@ -161,7 +161,7 @@ Always 0.0 on client, even if not predicting weapons ( won't get called
*/
float UTIL_WeaponTimeBase( void )
{
return 0.0;
return 0.0f;
}
static unsigned int glSeed = 0;
@ -254,7 +254,7 @@ float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
tensixrand = U_Random() & 65535;
offset = (float)tensixrand / 65536.0;
offset = (float)tensixrand / 65536.0f;
return ( low + offset * range );
}

View File

@ -319,12 +319,12 @@ void Particles( void )
curtime = gEngfuncs.GetClientTime();
if( ( curtime - lasttime ) < 2.0 )
if( ( curtime - lasttime ) < 2.0f )
return;
if( !color )
{
color = gEngfuncs.pfnRegisterVariable ( "color","255 0 0", 0 );
color = gEngfuncs.pfnRegisterVariable( "color", "255 0 0", 0 );
}
lasttime = curtime;
@ -342,8 +342,8 @@ void Particles( void )
for( j = 0; j < 3; j++ )
{
p->org[j] = v_origin[j] + gEngfuncs.pfnRandomFloat( -32.0, 32.0 );
p->vel[j] = gEngfuncs.pfnRandomFloat( -100.0, 100.0 );
p->org[j] = v_origin[j] + gEngfuncs.pfnRandomFloat( -32.0f, 32.0f );
p->vel[j] = gEngfuncs.pfnRandomFloat( -100.0f, 100.0f );
}
if( color )
@ -361,7 +361,7 @@ void Particles( void )
gEngfuncs.pEfxAPI->R_GetPackedColor( &p->packedColor, p->color );
// p->die is set to current time so all you have to do is add an additional time to it
p->die += 3.0;
p->die += 3.0f;
}
}
*/
@ -384,7 +384,7 @@ void TempEnts( void )
curtime = gEngfuncs.GetClientTime();
if( ( curtime - lasttime ) < 10.0 )
if( ( curtime - lasttime ) < 10.0f )
return;
lasttime = curtime;
@ -417,11 +417,11 @@ void TempEnts( void )
p->entity.curstate.origin[j] = origin[j];
// Store velocity in baseline origin
p->entity.baseline.origin[j] = gEngfuncs.pfnRandomFloat( -100, 100 );
p->entity.baseline.origin[j] = gEngfuncs.pfnRandomFloat( -100.0f, 100.0f );
}
// p->die is set to current time so all you have to do is add an additional time to it
p->die += 10.0;
p->die += 10.0f;
}
}
*/
@ -626,7 +626,7 @@ void DLLEXPORT HUD_TempEntUpdate (
//freq = client_time * 0.01;
fastFreq = client_time * 5.5;
gravity = -frametime * cl_gravity;
gravitySlow = gravity * 0.5;
gravitySlow = gravity * 0.5f;
while( pTemp )
{
@ -634,7 +634,7 @@ void DLLEXPORT HUD_TempEntUpdate (
active = 1;
life = pTemp->die - client_time;
life = pTemp->die - (float)client_time;
pnext = pTemp->next;
if( life < 0 )
{
@ -674,9 +674,9 @@ void DLLEXPORT HUD_TempEntUpdate (
gEngfuncs.pEfxAPI->R_SparkEffect( pTemp->entity.origin, 8, -200, 200 );
// Reduce life
pTemp->entity.baseline.framerate -= 0.1;
pTemp->entity.baseline.framerate -= 0.1f;
if( pTemp->entity.baseline.framerate <= 0.0 )
if( pTemp->entity.baseline.framerate <= 0.0f )
{
pTemp->die = client_time;
}
@ -700,11 +700,11 @@ void DLLEXPORT HUD_TempEntUpdate (
}
else if( pTemp->flags & FTENT_SINEWAVE )
{
pTemp->x += pTemp->entity.baseline.origin[0] * frametime;
pTemp->y += pTemp->entity.baseline.origin[1] * frametime;
pTemp->x += pTemp->entity.baseline.origin[0] * (float)frametime;
pTemp->y += pTemp->entity.baseline.origin[1] * (float)frametime;
pTemp->entity.origin[0] = pTemp->x + sin( pTemp->entity.baseline.origin[2] + client_time * pTemp->entity.prevstate.frame ) * ( 10 * pTemp->entity.curstate.framerate );
pTemp->entity.origin[1] = pTemp->y + sin( pTemp->entity.baseline.origin[2] + fastFreq + 0.7 ) * ( 8 * pTemp->entity.curstate.framerate );
pTemp->entity.origin[1] = pTemp->y + sin( pTemp->entity.baseline.origin[2] + fastFreq + 0.7f ) * ( 8 * pTemp->entity.curstate.framerate );
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
}
else if( pTemp->flags & FTENT_SPIRAL )
@ -713,19 +713,19 @@ void DLLEXPORT HUD_TempEntUpdate (
s = sin( pTemp->entity.baseline.origin[2] + fastFreq );
c = cos( pTemp->entity.baseline.origin[2] + fastFreq );*/
pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * frametime + 8 * sin( client_time * 20 + (size_t)pTemp );
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * frametime + 4 * sin( client_time * 30 + (size_t)pTemp );
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * frametime;
pTemp->entity.origin[0] += pTemp->entity.baseline.origin[0] * (float)frametime + 8 * sin( client_time * 20 + (size_t)pTemp );
pTemp->entity.origin[1] += pTemp->entity.baseline.origin[1] * (float)frametime + 4 * sin( client_time * 30 + (size_t)pTemp );
pTemp->entity.origin[2] += pTemp->entity.baseline.origin[2] * (float)frametime;
}
else
{
for( i = 0; i < 3; i++ )
pTemp->entity.origin[i] += pTemp->entity.baseline.origin[i] * frametime;
pTemp->entity.origin[i] += pTemp->entity.baseline.origin[i] * (float)frametime;
}
if( pTemp->flags & FTENT_SPRANIMATE )
{
pTemp->entity.curstate.frame += frametime * pTemp->entity.curstate.framerate;
pTemp->entity.curstate.frame += (float)frametime * pTemp->entity.curstate.framerate;
if( pTemp->entity.curstate.frame >= pTemp->frameMax )
{
pTemp->entity.curstate.frame = pTemp->entity.curstate.frame - (int)( pTemp->entity.curstate.frame );
@ -755,9 +755,9 @@ void DLLEXPORT HUD_TempEntUpdate (
if( pTemp->flags & FTENT_ROTATE )
{
pTemp->entity.angles[0] += pTemp->entity.baseline.angles[0] * frametime;
pTemp->entity.angles[1] += pTemp->entity.baseline.angles[1] * frametime;
pTemp->entity.angles[2] += pTemp->entity.baseline.angles[2] * frametime;
pTemp->entity.angles[0] += pTemp->entity.baseline.angles[0] * (float)frametime;
pTemp->entity.angles[1] += pTemp->entity.baseline.angles[1] * (float)frametime;
pTemp->entity.angles[2] += pTemp->entity.baseline.angles[2] * (float)frametime;
VectorCopy( pTemp->entity.angles, pTemp->entity.latched.prevangles );
}
@ -809,7 +809,7 @@ void DLLEXPORT HUD_TempEntUpdate (
{
// Chop spark speeds a bit more
//
VectorScale( pTemp->entity.baseline.origin, 0.6, pTemp->entity.baseline.origin );
VectorScale( pTemp->entity.baseline.origin, 0.6f, pTemp->entity.baseline.origin );
if( Length( pTemp->entity.baseline.origin ) < 10 )
{
@ -829,13 +829,13 @@ void DLLEXPORT HUD_TempEntUpdate (
float proj, damp;
// Place at contact point
VectorMA( pTemp->entity.prevstate.origin, traceFraction * frametime, pTemp->entity.baseline.origin, pTemp->entity.origin );
VectorMA( pTemp->entity.prevstate.origin, traceFraction * (float)frametime, pTemp->entity.baseline.origin, pTemp->entity.origin );
// Damp velocity
damp = pTemp->bounceFactor;
if( pTemp->flags & ( FTENT_GRAVITY | FTENT_SLOWGRAVITY ) )
{
damp *= 0.5;
if( traceNormal[2] > 0.9 ) // Hit floor?
damp *= 0.5f;
if( traceNormal[2] > 0.9f ) // Hit floor?
{
if( pTemp->entity.baseline.origin[2] <= 0 && pTemp->entity.baseline.origin[2] >= gravity*3 )
{

View File

@ -72,18 +72,18 @@ void EV_SnarkFire( struct event_args_s *args );
void EV_TrainPitchAdjust( struct event_args_s *args );
}
#define VECTOR_CONE_1DEGREES Vector( 0.00873, 0.00873, 0.00873 )
#define VECTOR_CONE_2DEGREES Vector( 0.01745, 0.01745, 0.01745 )
#define VECTOR_CONE_3DEGREES Vector( 0.02618, 0.02618, 0.02618 )
#define VECTOR_CONE_4DEGREES Vector( 0.03490, 0.03490, 0.03490 )
#define VECTOR_CONE_5DEGREES Vector( 0.04362, 0.04362, 0.04362 )
#define VECTOR_CONE_6DEGREES Vector( 0.05234, 0.05234, 0.05234 )
#define VECTOR_CONE_7DEGREES Vector( 0.06105, 0.06105, 0.06105 )
#define VECTOR_CONE_8DEGREES Vector( 0.06976, 0.06976, 0.06976 )
#define VECTOR_CONE_9DEGREES Vector( 0.07846, 0.07846, 0.07846 )
#define VECTOR_CONE_10DEGREES Vector( 0.08716, 0.08716, 0.08716 )
#define VECTOR_CONE_15DEGREES Vector( 0.13053, 0.13053, 0.13053 )
#define VECTOR_CONE_20DEGREES Vector( 0.17365, 0.17365, 0.17365 )
#define VECTOR_CONE_1DEGREES Vector( 0.00873f, 0.00873f, 0.00873f )
#define VECTOR_CONE_2DEGREES Vector( 0.01745f, 0.01745f, 0.01745f )
#define VECTOR_CONE_3DEGREES Vector( 0.02618f, 0.02618f, 0.02618f )
#define VECTOR_CONE_4DEGREES Vector( 0.03490f, 0.03490f, 0.03490f )
#define VECTOR_CONE_5DEGREES Vector( 0.04362f, 0.04362f, 0.04362f )
#define VECTOR_CONE_6DEGREES Vector( 0.05234f, 0.05234f, 0.05234f )
#define VECTOR_CONE_7DEGREES Vector( 0.06105f, 0.06105f, 0.06105f )
#define VECTOR_CONE_8DEGREES Vector( 0.06976f, 0.06976f, 0.06976f )
#define VECTOR_CONE_9DEGREES Vector( 0.07846f, 0.07846f, 0.07846f )
#define VECTOR_CONE_10DEGREES Vector( 0.08716f, 0.08716f, 0.08716f )
#define VECTOR_CONE_15DEGREES Vector( 0.13053f, 0.13053f, 0.13053f )
#define VECTOR_CONE_20DEGREES Vector( 0.17365f, 0.17365f, 0.17365f )
// play a strike sound based on the texture that was hit by the attack traceline. VecSrc/VecEnd are the
// original traceline endpoints used by the attacker, iBulletType is the type of bullet that hit the texture.
@ -425,7 +425,7 @@ void EV_HLDM_FireBullets( int idx, float *forward, float *right, float *up, int
tracer = EV_HLDM_CheckTracer( idx, vecSrc, tr.endpos, forward, right, iBulletType, iTracerFreq, tracerCount );
// do damage, paint decals
if( tr.fraction != 1.0 )
if( tr.fraction != 1.0f )
{
switch( iBulletType )
{
@ -901,14 +901,14 @@ void EV_FireGauss( event_args_t *args )
if( EV_IsLocal( idx ) )
{
V_PunchAxis( 0, -2.0 );
V_PunchAxis( 0.0f, -2.0f );
gEngfuncs.pEventAPI->EV_WeaponAnimation( GAUSS_FIRE2, 2 );
if( m_fPrimaryFire == false )
g_flApplyVel = flDamage;
}
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/gauss2.wav", 0.5 + flDamage * ( 1.0 / 400.0 ), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/gauss2.wav", 0.5f + flDamage * ( 1.0f / 400.0f ), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong( 0, 0x1f ) );
while( flDamage > 10 && nMaxHits > 0 )
{
@ -943,10 +943,10 @@ void EV_FireGauss( event_args_t *args )
idx | 0x1000,
tr.endpos,
m_iBeam,
0.1,
m_fPrimaryFire ? 1.0 : 2.5,
0.0,
m_fPrimaryFire ? 128.0 : flDamage,
0.1f,
m_fPrimaryFire ? 1.0f : 2.5f,
0.0f,
m_fPrimaryFire ? 128.0f : flDamage,
0,
0,
0,
@ -960,10 +960,10 @@ void EV_FireGauss( event_args_t *args )
gEngfuncs.pEfxAPI->R_BeamPoints( vecSrc,
tr.endpos,
m_iBeam,
0.1,
m_fPrimaryFire ? 1.0 : 2.5,
0.0,
m_fPrimaryFire ? 128.0 : flDamage,
0.1f,
m_fPrimaryFire ? 1.0f : 2.5f,
0.0f,
m_fPrimaryFire ? 128.0f : flDamage,
0,
0,
0,
@ -985,13 +985,13 @@ void EV_FireGauss( event_args_t *args )
n = -DotProduct( tr.plane.normal, forward );
if( n < 0.5 ) // 60 degrees
if( n < 0.5f ) // 60 degrees
{
// ALERT( at_console, "reflect %f\n", n );
// reflect
vec3_t r;
VectorMA( forward, 2.0 * n, tr.plane.normal, r );
VectorMA( forward, 2.0f * n, tr.plane.normal, r );
flMaxFrac = flMaxFrac - tr.fraction;
@ -1000,18 +1000,18 @@ void EV_FireGauss( event_args_t *args )
VectorMA( tr.endpos, 8.0, forward, vecSrc );
VectorMA( vecSrc, 8192.0, forward, vecDest );
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage * n / 255.0, flDamage * n * 0.5 * 0.1, FTENT_FADEOUT );
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage * n / 255.0f, flDamage * n * 0.5f * 0.1f, FTENT_FADEOUT );
vec3_t fwd;
VectorAdd( tr.endpos, tr.plane.normal, fwd );
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10.0f, 20.0f ) / 100.0f, 100,
255, 100 );
// lose energy
if( n == 0 )
if( n == 0.0f )
{
n = 0.1;
n = 0.1f;
}
flDamage = flDamage * ( 1 - n );
@ -1021,7 +1021,7 @@ void EV_FireGauss( event_args_t *args )
// tunnel
EV_HLDM_DecalGunshot( &tr, BULLET_MONSTER_12MM );
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 1.0, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0, 6.0, FTENT_FADEOUT );
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 1.0, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0f, 6.0f, FTENT_FADEOUT );
// limit it to one hole punch
if( fHasPunched )
@ -1067,7 +1067,7 @@ void EV_FireGauss( event_args_t *args )
{
vec3_t fwd;
VectorSubtract( tr.endpos, forward, fwd );
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 3, 0.1, gEngfuncs.pfnRandomFloat( 10.0f, 20.0f ) / 100.0f, 100,
255, 100 );
}
@ -1076,13 +1076,13 @@ void EV_FireGauss( event_args_t *args )
EV_HLDM_DecalGunshot( &beam_tr, BULLET_MONSTER_12MM );
gEngfuncs.pEfxAPI->R_TempSprite( beam_tr.endpos, vec3_origin, 0.1, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0, 6.0, FTENT_FADEOUT );
gEngfuncs.pEfxAPI->R_TempSprite( beam_tr.endpos, vec3_origin, 0.1, m_iGlow, kRenderGlow, kRenderFxNoDissipation, flDamage / 255.0f, 6.0f, FTENT_FADEOUT );
// balls
{
vec3_t fwd;
VectorSubtract( beam_tr.endpos, forward, fwd );
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, beam_tr.endpos, fwd, m_iBalls, (int)( flDamage * 0.3 ), 0.1, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 200,
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, beam_tr.endpos, fwd, m_iBalls, (int)( flDamage * 0.3f ), 0.1, gEngfuncs.pfnRandomFloat( 10.0f, 20.0f ) / 100.0f, 200,
255, 40 );
}
@ -1102,11 +1102,11 @@ void EV_FireGauss( event_args_t *args )
{
// slug doesn't punch through ever with primary
// fire, so leave a little glowy bit and make some balls
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, 200.0 / 255.0, 0.3, FTENT_FADEOUT );
gEngfuncs.pEfxAPI->R_TempSprite( tr.endpos, vec3_origin, 0.2, m_iGlow, kRenderGlow, kRenderFxNoDissipation, 200.0f / 255.0f, 0.3, FTENT_FADEOUT );
{
vec3_t fwd;
VectorAdd( tr.endpos, tr.plane.normal, fwd );
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 8, 0.6, gEngfuncs.pfnRandomFloat( 10, 20 ) / 100.0, 100,
gEngfuncs.pEfxAPI->R_Sprite_Trail( TE_SPRITETRAIL, tr.endpos, fwd, m_iBalls, 8, 0.6, gEngfuncs.pfnRandomFloat( 10.0f, 20.0f ) / 100.0f, 100,
255, 200 );
}
}
@ -1238,7 +1238,7 @@ void EV_FireCrossbow2( event_args_t *args )
VectorMA( vecSrc, 8192, forward, vecEnd );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/xbow_fire1.wav", 1, ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, "weapons/xbow_reload1.wav", gEngfuncs.pfnRandomFloat( 0.95, 1.0 ), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, "weapons/xbow_reload1.wav", gEngfuncs.pfnRandomFloat( 0.95f, 1.0f ), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
if( EV_IsLocal( idx ) )
{
@ -1257,7 +1257,7 @@ void EV_FireCrossbow2( event_args_t *args )
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecEnd, PM_STUDIO_BOX, -1, &tr );
//We hit something
if( tr.fraction < 1.0 )
if( tr.fraction < 1.0f )
{
physent_t *pe = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent );
@ -1277,7 +1277,7 @@ void EV_FireCrossbow2( event_args_t *args )
//Stick to world but don't stick to glass, it might break and leave the bolt floating. It can still stick to other non-transparent breakables though.
else if( pe->rendermode == kRenderNormal )
{
gEngfuncs.pEventAPI->EV_PlaySound( 0, tr.endpos, CHAN_BODY, "weapons/xbow_hit1.wav", gEngfuncs.pfnRandomFloat( 0.95, 1.0 ), ATTN_NORM, 0, PITCH_NORM );
gEngfuncs.pEventAPI->EV_PlaySound( 0, tr.endpos, CHAN_BODY, "weapons/xbow_hit1.wav", gEngfuncs.pfnRandomFloat( 0.95f, 1.0f ), ATTN_NORM, 0, PITCH_NORM );
//Not underwater, do some sparks...
if( gEngfuncs.PM_PointContents( tr.endpos, NULL ) != CONTENTS_WATER )
@ -1313,7 +1313,7 @@ void EV_FireCrossbow( event_args_t *args )
VectorCopy( args->origin, origin );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/xbow_fire1.wav", 1, ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, "weapons/xbow_reload1.wav", gEngfuncs.pfnRandomFloat( 0.95, 1.0 ), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_ITEM, "weapons/xbow_reload1.wav", gEngfuncs.pfnRandomFloat( 0.95f, 1.0f ), ATTN_NORM, 0, 93 + gEngfuncs.pfnRandomLong( 0, 0xF ) );
//Only play the weapon anims if I shot it.
if( EV_IsLocal( idx ) )
@ -1323,7 +1323,7 @@ void EV_FireCrossbow( event_args_t *args )
else if ( args->iparam2 )
gEngfuncs.pEventAPI->EV_WeaponAnimation( CROSSBOW_FIRE3, 1 );
V_PunchAxis( 0, -2.0 );
V_PunchAxis( 0.0f, -2.0f );
}
}
//======================
@ -1541,13 +1541,13 @@ void EV_EgonStop( event_args_t *args )
{
if( pBeam )
{
pBeam->die = 0.0;
pBeam->die = 0.0f;
pBeam = NULL;
}
if( pBeam2 )
{
pBeam2->die = 0.0;
pBeam2->die = 0.0f;
pBeam2 = NULL;
}
@ -1667,10 +1667,10 @@ void EV_TripmineFire( event_args_t *args )
// Now add in all of the players.
gEngfuncs.pEventAPI->EV_SetSolidPlayers ( idx - 1 );
gEngfuncs.pEventAPI->EV_SetTraceHull( 2 );
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecSrc + forward * 128, PM_NORMAL, -1, &tr );
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc, vecSrc + forward * 128.0f, PM_NORMAL, -1, &tr );
//Hit something solid
if( tr.fraction < 1.0 )
if( tr.fraction < 1.0f )
gEngfuncs.pEventAPI->EV_WeaponAnimation ( TRIPMINE_DRAW, 0 );
gEngfuncs.pEventAPI->EV_PopPMStates();
@ -1722,7 +1722,7 @@ void EV_SnarkFire( event_args_t *args )
gEngfuncs.pEventAPI->EV_PlayerTrace( vecSrc + forward * 20, vecSrc + forward * 64, PM_NORMAL, -1, &tr );
//Find space to drop the thing.
if( tr.allsolid == 0 && tr.startsolid == 0 && tr.fraction > 0.25 )
if( tr.allsolid == 0 && tr.startsolid == 0 && tr.fraction > 0.25f )
gEngfuncs.pEventAPI->EV_WeaponAnimation( SQUEAK_THROW, 0 );
gEngfuncs.pEventAPI->EV_PopPMStates();
@ -1751,9 +1751,9 @@ void EV_TrainPitchAdjust( event_args_t *args )
us_params = (unsigned short)args->iparam1;
stop = args->bparam1;
m_flVolume = (float)( us_params & 0x003f ) / 40.0;
m_flVolume = (float)( us_params & 0x003f ) / 40.0f;
noise = (int)( ( ( us_params ) >> 12 ) & 0x0007 );
pitch = (int)( 10.0 * (float)( ( us_params >> 6 ) & 0x003f ) );
pitch = (int)( 10.0f * (float)( ( us_params >> 6 ) & 0x003f ) );
switch( noise )
{

View File

@ -50,7 +50,7 @@ void CHudFlashlight::Reset( void )
m_fFade = 0;
m_fOn = 0;
m_iBat = 100;
m_flBat = 1.0;
m_flBat = 1.0f;
}
int CHudFlashlight::VidInit( void )
@ -75,7 +75,7 @@ int CHudFlashlight::MsgFunc_FlashBat( const char *pszName, int iSize, void *pbu
BEGIN_READ( pbuf, iSize );
int x = READ_BYTE();
m_iBat = x;
m_flBat = ( (float)x ) / 100.0;
m_flBat = ( (float)x ) / 100.0f;
return 1;
}
@ -86,7 +86,7 @@ int CHudFlashlight::MsgFunc_Flashlight( const char *pszName, int iSize, void *p
m_fOn = READ_BYTE();
int x = READ_BYTE();
m_iBat = x;
m_flBat = ( (float)x ) / 100.0;
m_flBat = ( (float)x ) / 100.0f;
return 1;
}
@ -119,7 +119,7 @@ int CHudFlashlight::Draw( float flTime )
else
a = MIN_ALPHA;
if( m_flBat < 0.20 )
if( m_flBat < 0.20f )
UnpackRGB( r,g,b, RGB_REDISH );
else
UnpackRGB( r,g,b, RGB_YELLOWISH );
@ -144,7 +144,7 @@ int CHudFlashlight::Draw( float flTime )
// draw the flashlight energy level
x = ScreenWidth - m_iWidth - m_iWidth / 2;
int iOffset = m_iWidth * ( 1.0 - m_flBat );
int iOffset = m_iWidth * ( 1.0f - m_flBat );
if( iOffset < m_iWidth )
{
rc = *m_prc2;

View File

@ -78,7 +78,7 @@ int CHudGeiger::Draw( float flTime )
else if( m_iGeigerRange > 600 )
{
pct = 2;
flvol = 0.4; //Con_Printf( "range > 600\n" );
flvol = 0.4f; //Con_Printf( "range > 600\n" );
//rg[0] = 1;
//rg[1] = 1;
i = 2;
@ -86,7 +86,7 @@ int CHudGeiger::Draw( float flTime )
else if( m_iGeigerRange > 500 )
{
pct = 4;
flvol = 0.5; //Con_Printf( "range > 500\n" );
flvol = 0.5f; //Con_Printf( "range > 500\n" );
//rg[0] = 1;
//rg[1] = 2;
i = 2;
@ -94,7 +94,7 @@ int CHudGeiger::Draw( float flTime )
else if( m_iGeigerRange > 400 )
{
pct = 8;
flvol = 0.6; //Con_Printf( "range > 400\n" );
flvol = 0.6f; //Con_Printf( "range > 400\n" );
//rg[0] = 1;
//rg[1] = 2;
//rg[2] = 3;
@ -103,7 +103,7 @@ int CHudGeiger::Draw( float flTime )
else if( m_iGeigerRange > 300 )
{
pct = 8;
flvol = 0.7; //Con_Printf( "range > 300\n" );
flvol = 0.7f; //Con_Printf( "range > 300\n" );
//rg[0] = 2;
//rg[1] = 3;
//rg[2] = 4;
@ -112,7 +112,7 @@ int CHudGeiger::Draw( float flTime )
else if( m_iGeigerRange > 200 )
{
pct = 28;
flvol = 0.78; //Con_Printf( "range > 200\n" );
flvol = 0.78f; //Con_Printf( "range > 200\n" );
//rg[0] = 2;
//rg[1] = 3;
//rg[2] = 4;
@ -121,7 +121,7 @@ int CHudGeiger::Draw( float flTime )
else if( m_iGeigerRange > 150 )
{
pct = 40;
flvol = 0.80; //Con_Printf( "range > 150\n" );
flvol = 0.80f; //Con_Printf( "range > 150\n" );
//rg[0] = 3;
//rg[1] = 4;
//rg[2] = 5;
@ -139,7 +139,7 @@ int CHudGeiger::Draw( float flTime )
else if( m_iGeigerRange > 75 )
{
pct = 80;
flvol = 0.9; //Con_Printf( "range > 75\n" );
flvol = 0.9f; //Con_Printf( "range > 75\n" );
//gflGeigerDelay = cl.time + GEIGERDELAY * 0.75;
//rg[0] = 4;
//rg[1] = 5;
@ -149,7 +149,7 @@ int CHudGeiger::Draw( float flTime )
else if( m_iGeigerRange > 50 )
{
pct = 90;
flvol = 0.95; //Con_Printf( "range > 50\n" );
flvol = 0.95f; //Con_Printf( "range > 50\n" );
//rg[0] = 5;
//rg[1] = 6;
i = 2;
@ -157,17 +157,17 @@ int CHudGeiger::Draw( float flTime )
else
{
pct = 95;
flvol = 1.0; //Con_Printf( "range < 50\n" );
flvol = 1.0f; //Con_Printf( "range < 50\n" );
//rg[0] = 5;
//rg[1] = 6;
i = 2;
}
flvol = ( flvol * ( ( rand() & 127 ) ) / 255 ) + 0.25; // UTIL_RandomFloat( 0.25, 0.5 );
flvol = ( flvol * ( ( rand() & 127 ) ) / 255 ) + 0.25f; // UTIL_RandomFloat( 0.25f, 0.5f );
if( ( rand() & 127 ) < pct || ( rand() & 127 ) < pct )
{
//S_StartDynamicSound( -1, 0, rgsfx[rand() % i], r_origin, flvol, 1.0, 0, 100 );
//S_StartDynamicSound( -1, 0, rgsfx[rand() % i], r_origin, flvol, 1.0f, 0, 100 );
char sz[256];
int j = rand() & 1;

View File

@ -18,9 +18,9 @@
// implementation of CHudHealth class
//
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include "hud.h"
#include "cl_util.h"
@ -191,7 +191,7 @@ int CHudHealth::Draw( float flTime )
// Has health changed? Flash the health #
if( m_fFade )
{
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f );
if( m_fFade <= 0 )
{
a = MIN_ALPHA;
@ -270,27 +270,27 @@ void CHudHealth::CalcDamageDirection( vec3_t vecFrom )
}
else
{
if( side > 0 )
if( side > 0.0f )
{
if( side > 0.3 )
if( side > 0.3f )
m_fAttackFront = Q_max( m_fAttackFront, side );
}
else
{
float f = fabs( side );
if( f > 0.3 )
if( f > 0.3f )
m_fAttackRear = Q_max( m_fAttackRear, f );
}
if( front > 0 )
if( front > 0.0f )
{
if( front > 0.3 )
if( front > 0.3f )
m_fAttackRight = Q_max( m_fAttackRight, front );
}
else
{
float f = fabs( front );
if( f > 0.3 )
if( f > 0.3f )
m_fAttackLeft = Q_max( m_fAttackLeft, f );
}
}
@ -310,10 +310,10 @@ int CHudHealth::DrawPain( float flTime )
float fFade = gHUD.m_flTimeDelta * 2;
// SPR_Draw top
if( m_fAttackFront > 0.4 )
if( m_fAttackFront > 0.4f )
{
GetPainColor( r, g, b );
shade = a * Q_max( m_fAttackFront, 0.5 );
shade = a * Q_max( m_fAttackFront, 0.5f );
ScaleColors( r, g, b, shade );
SPR_Set( m_hSprite, r, g, b );
@ -324,10 +324,10 @@ int CHudHealth::DrawPain( float flTime )
} else
m_fAttackFront = 0;
if( m_fAttackRight > 0.4 )
if( m_fAttackRight > 0.4f )
{
GetPainColor( r, g, b );
shade = a * Q_max( m_fAttackRight, 0.5 );
shade = a * Q_max( m_fAttackRight, 0.5f );
ScaleColors( r, g, b, shade );
SPR_Set( m_hSprite, r, g, b );
@ -339,10 +339,10 @@ int CHudHealth::DrawPain( float flTime )
else
m_fAttackRight = 0;
if( m_fAttackRear > 0.4 )
if( m_fAttackRear > 0.4f )
{
GetPainColor( r, g, b );
shade = a * Q_max( m_fAttackRear, 0.5 );
shade = a * Q_max( m_fAttackRear, 0.5f );
ScaleColors( r, g, b, shade );
SPR_Set( m_hSprite, r, g, b );
@ -354,10 +354,10 @@ int CHudHealth::DrawPain( float flTime )
else
m_fAttackRear = 0;
if( m_fAttackLeft > 0.4 )
if( m_fAttackLeft > 0.4f )
{
GetPainColor( r, g, b );
shade = a * Q_max( m_fAttackLeft, 0.5 );
shade = a * Q_max( m_fAttackLeft, 0.5f );
ScaleColors( r, g, b, shade );
SPR_Set( m_hSprite, r, g, b );
@ -382,7 +382,7 @@ int CHudHealth::DrawDamage( float flTime )
UnpackRGB( r, g, b, RGB_YELLOWISH );
a = (int)( fabs( sin( flTime * 2 ) ) * 256.0 );
a = (int)( fabs( sin( flTime * 2.0f ) ) * 256.0f );
ScaleColors( r, g, b, a );

View File

@ -68,25 +68,25 @@ void UpdateBeams( void )
if( pBeam )
{
pBeam->target = tr.endpos;
pBeam->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
pBeam->die = gEngfuncs.GetClientTime() + 0.1f; // We keep it alive just a little bit forward in the future, just in case.
}
if( pBeam2 )
{
pBeam2->target = tr.endpos;
pBeam2->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
pBeam2->die = gEngfuncs.GetClientTime() + 0.1f; // We keep it alive just a little bit forward in the future, just in case.
}
if( pFlare ) // Vit_amiN: beam flare
{
pFlare->entity.origin = tr.endpos;
pFlare->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
pFlare->die = gEngfuncs.GetClientTime() + 0.1f; // We keep it alive just a little bit forward in the future, just in case.
if( gEngfuncs.GetMaxClients() != 1 ) // Singleplayer always draws the egon's energy beam flare
{
pFlare->flags |= FTENT_NOMODEL;
if( !( tr.allsolid || tr.ent <= 0 || tr.fraction == 1.0 ) ) // Beam hit some non-world entity
if( !( tr.allsolid || tr.ent <= 0 || tr.fraction == 1.0f ) ) // Beam hit some non-world entity
{
physent_t *pEntity = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent );

View File

@ -163,7 +163,7 @@ BOOL CBasePlayerWeapon::DefaultReload( int iClipSize, int iAnim, float fDelay, i
m_fInReload = TRUE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;
return TRUE;
}
@ -218,8 +218,8 @@ BOOL CBasePlayerWeapon::DefaultDeploy( const char *szViewModel, const char *szWe
SendWeaponAnim( iAnim, skiplocal, body );
g_irunninggausspred = false;
m_pPlayer->m_flNextAttack = 0.5;
m_flTimeWeaponIdle = 1.0;
m_pPlayer->m_flNextAttack = 0.5f;
m_flTimeWeaponIdle = 1.0f;
return TRUE;
}
@ -233,7 +233,7 @@ BOOL CBasePlayerWeapon::PlayEmptySound( void )
{
if( m_iPlayEmptySound )
{
HUD_PlaySound( "weapons/357_cock1.wav", 0.8 );
HUD_PlaySound( "weapons/357_cock1.wav", 0.8f );
m_iPlayEmptySound = 0;
return 0;
}
@ -296,8 +296,8 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
{
// get circular gaussian spread
do {
x = RANDOM_FLOAT( -0.5, 0.5 ) + RANDOM_FLOAT( -0.5, 0.5 );
y = RANDOM_FLOAT( -0.5, 0.5 ) + RANDOM_FLOAT( -0.5, 0.5 );
x = RANDOM_FLOAT( -0.5f, 0.5f ) + RANDOM_FLOAT( -0.5f, 0.5f );
y = RANDOM_FLOAT( -0.5f, 0.5f ) + RANDOM_FLOAT( -0.5f, 0.5f );
z = x * x + y * y;
} while( z > 1 );
}
@ -305,13 +305,13 @@ Vector CBaseEntity::FireBulletsPlayer ( ULONG cShots, Vector vecSrc, Vector vecD
{
//Use player's random seed.
// get circular gaussian spread
x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5, 0.5 );
y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5, 0.5 );
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;
}
}
return Vector( x * vecSpread.x, y * vecSpread.y, 0.0 );
return Vector( x * vecSpread.x, y * vecSpread.y, 0.0f );
}
/*
@ -323,7 +323,7 @@ Handles weapon firing, reloading, etc.
*/
void CBasePlayerWeapon::ItemPostFrame( void )
{
if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= 0.0 ) )
if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= 0.0f ) )
{
#if 0 // FIXME, need ammo on client to make this work right
// complete the reload.
@ -338,7 +338,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_fInReload = FALSE;
}
if( ( m_pPlayer->pev->button & IN_ATTACK2 ) && ( m_flNextSecondaryAttack <= 0.0 ) )
if( ( m_pPlayer->pev->button & IN_ATTACK2 ) && ( m_flNextSecondaryAttack <= 0.0f ) )
{
if( pszAmmo2() && !m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] )
{
@ -348,7 +348,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
SecondaryAttack();
m_pPlayer->pev->button &= ~IN_ATTACK2;
}
else if( ( m_pPlayer->pev->button & IN_ATTACK ) && ( m_flNextPrimaryAttack <= 0.0 ) )
else if( ( m_pPlayer->pev->button & IN_ATTACK ) && ( m_flNextPrimaryAttack <= 0.0f ) )
{
if( ( m_iClip == 0 && pszAmmo1() ) || ( iMaxClip() == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) )
{
@ -368,7 +368,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_fFireOnEmpty = FALSE;
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack < 0.0 )
if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack < 0.0f )
{
Reload();
return;
@ -483,7 +483,7 @@ Don't actually trace, but act like the trace didn't hit anything.
void UTIL_TraceLine( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, edict_t *pentIgnore, TraceResult *ptr )
{
memset( ptr, 0, sizeof(*ptr) );
ptr->flFraction = 1.0;
ptr->flFraction = 1.0f;
}
/*
@ -944,73 +944,73 @@ void HUD_WeaponsPostThink( local_state_s *from, local_state_s *to, usercmd_t *cm
pto->iuser3 = pCurrent->m_fireState;
// Decrement weapon counters, server does this at same time ( during post think, after doing everything else )
pto->m_flNextReload -= cmd->msec / 1000.0;
pto->m_fNextAimBonus -= cmd->msec / 1000.0;
pto->m_flNextPrimaryAttack -= cmd->msec / 1000.0;
pto->m_flNextSecondaryAttack -= cmd->msec / 1000.0;
pto->m_flTimeWeaponIdle -= cmd->msec / 1000.0;
pto->fuser1 -= cmd->msec / 1000.0;
pto->m_flNextReload -= cmd->msec / 1000.0f;
pto->m_fNextAimBonus -= cmd->msec / 1000.0f;
pto->m_flNextPrimaryAttack -= cmd->msec / 1000.0f;
pto->m_flNextSecondaryAttack -= cmd->msec / 1000.0f;
pto->m_flTimeWeaponIdle -= cmd->msec / 1000.0f;
pto->fuser1 -= cmd->msec / 1000.0f;
to->client.vuser3[2] = pCurrent->m_iSecondaryAmmoType;
to->client.vuser4[0] = pCurrent->m_iPrimaryAmmoType;
to->client.vuser4[1] = player.m_rgAmmo[pCurrent->m_iPrimaryAmmoType];
to->client.vuser4[2] = player.m_rgAmmo[pCurrent->m_iSecondaryAmmoType];
/* if( pto->m_flPumpTime != -9999 )
/* if( pto->m_flPumpTime != -9999.0f )
{
pto->m_flPumpTime -= cmd->msec / 1000.0;
if( pto->m_flPumpTime < -0.001 )
pto->m_flPumpTime = -0.001;
pto->m_flPumpTime -= cmd->msec / 1000.0f;
if( pto->m_flPumpTime < -0.001f )
pto->m_flPumpTime = -0.001f;
}*/
if( pto->m_fNextAimBonus < -1.0 )
if( pto->m_fNextAimBonus < -1.0f )
{
pto->m_fNextAimBonus = -1.0;
pto->m_fNextAimBonus = -1.0f;
}
if( pto->m_flNextPrimaryAttack < -1.0 )
if( pto->m_flNextPrimaryAttack < -1.0f )
{
pto->m_flNextPrimaryAttack = -1.0;
pto->m_flNextPrimaryAttack = -1.0f;
}
if( pto->m_flNextSecondaryAttack < -0.001 )
if( pto->m_flNextSecondaryAttack < -0.001f )
{
pto->m_flNextSecondaryAttack = -0.001;
pto->m_flNextSecondaryAttack = -0.001f;
}
if( pto->m_flTimeWeaponIdle < -0.001 )
if( pto->m_flTimeWeaponIdle < -0.001f )
{
pto->m_flTimeWeaponIdle = -0.001;
pto->m_flTimeWeaponIdle = -0.001f;
}
if( pto->m_flNextReload < -0.001 )
if( pto->m_flNextReload < -0.001f )
{
pto->m_flNextReload = -0.001;
pto->m_flNextReload = -0.001f;
}
if( pto->fuser1 < -0.001 )
if( pto->fuser1 < -0.001f )
{
pto->fuser1 = -0.001;
pto->fuser1 = -0.001f;
}
}
// m_flNextAttack is now part of the weapons, but is part of the player instead
to->client.m_flNextAttack -= cmd->msec / 1000.0;
if( to->client.m_flNextAttack < -0.001 )
to->client.m_flNextAttack -= cmd->msec / 1000.0f;
if( to->client.m_flNextAttack < -0.001f )
{
to->client.m_flNextAttack = -0.001;
to->client.m_flNextAttack = -0.001f;
}
to->client.fuser2 -= cmd->msec / 1000.0;
if( to->client.fuser2 < -0.001 )
to->client.fuser2 -= cmd->msec / 1000.0f;
if( to->client.fuser2 < -0.001f )
{
to->client.fuser2 = -0.001;
to->client.fuser2 = -0.001f;
}
to->client.fuser3 -= cmd->msec / 1000.0;
if( to->client.fuser3 < -0.001 )
to->client.fuser3 -= cmd->msec / 1000.0f;
if( to->client.fuser3 < -0.001f )
{
to->client.fuser3 = -0.001;
to->client.fuser3 = -0.001f;
}
// Store off the last position from the predicted state.

View File

@ -15,7 +15,8 @@
//
// hud_redraw.cpp
//
#include <math.h>
#include <cmath>
#include "hud.h"
#include "cl_util.h"
//#include "triangleapi.h"
@ -86,7 +87,7 @@ int CHud::Redraw( float flTime, int intermission )
{
m_fOldTime = m_flTime; // save time of previous redraw
m_flTime = flTime;
m_flTimeDelta = (double)m_flTime - m_fOldTime;
m_flTimeDelta = (double)( m_flTime - m_fOldTime );
static float m_flShotTime = 0;
// Clock was reset, reset delta
@ -97,7 +98,7 @@ int CHud::Redraw( float flTime, int intermission )
{
// Take a screenshot if the client's got the cvar set
if( CVAR_GET_FLOAT( "hud_takesshots" ) != 0 )
m_flShotTime = flTime + 1.0; // Take a screenshot in a second
m_flShotTime = flTime + 1.0f; // Take a screenshot in a second
}
if( m_flShotTime && m_flShotTime < flTime )

View File

@ -69,10 +69,10 @@ void SpectatorSpray( void )
VectorScale( forward, 128, forward );
VectorAdd( forward, v_origin, forward );
pmtrace_t * trace = gEngfuncs.PM_TraceLine( v_origin, forward, PM_TRACELINE_PHYSENTSONLY, 2, -1 );
if( trace->fraction != 1.0 )
if( trace->fraction != 1.0f )
{
sprintf( string, "drc_spray %.2f %.2f %.2f %i",
trace->endpos[0], trace->endpos[1], trace->endpos[2], trace->ent );
(double)trace->endpos[0], (double)trace->endpos[1], (double)trace->endpos[2], trace->ent );
gEngfuncs.pfnServerCmd( string );
}
}
@ -355,7 +355,7 @@ int CHudSpectator::Draw( float flTime )
int lx;
char string[256];
float * color;
float *color;
// draw only in spectator mode
if( !g_iUser1 )
@ -821,7 +821,7 @@ bool CHudSpectator::IsActivePlayer( cl_entity_t *ent )
bool CHudSpectator::ParseOverviewFile()
{
char filename[512] = { 0 };
char levelname[255] = { 0 };
char levelname[256] = { 0 };
char token[1024] = { 0 };
float height;
@ -987,15 +987,15 @@ void CHudSpectator::DrawOverviewLayer()
float screenaspect, xs, ys, xStep, yStep, x, y, z;
int ix, iy, i, xTiles, yTiles, frame;
qboolean hasMapImage = m_MapSprite?TRUE:FALSE;
model_t * dummySprite = (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprUnkownMap);
qboolean hasMapImage = m_MapSprite ? TRUE : FALSE;
model_t *dummySprite = (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprUnkownMap );
if ( hasMapImage)
if( hasMapImage )
{
i = m_MapSprite->numframes / (4*3);
i = sqrt(float(i));
xTiles = i*4;
yTiles = i*3;
i = m_MapSprite->numframes / ( 4 * 3 );
i = sqrt( float( i ) );
xTiles = i * 4;
yTiles = i * 3;
}
else
{
@ -1014,7 +1014,7 @@ void CHudSpectator::DrawOverviewLayer()
gEngfuncs.pTriAPI->RenderMode( kRenderTransTexture );
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
gEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 );
gEngfuncs.pTriAPI->Color4f( 1.0f, 1.0f, 1.0f, 1.0f );
frame = 0;
@ -1143,7 +1143,7 @@ void CHudSpectator::DrawOverviewEntities()
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
gEngfuncs.pTriAPI->Color4f( 1.0, 1.0, 1.0, 1.0 );
gEngfuncs.pTriAPI->Color4f( 1.0f, 1.0f, 1.0f, 1.0f );
gEngfuncs.pTriAPI->TexCoord2f(1, 0);
VectorMA( origin, 16.0f * sizeScale, up, point );
@ -1183,28 +1183,28 @@ void CHudSpectator::DrawOverviewEntities()
hSpriteModel = (struct model_s *)gEngfuncs.GetSpritePointer( m_hsprBeam );
gEngfuncs.pTriAPI->SpriteTexture( hSpriteModel, 0 );
gEngfuncs.pTriAPI->Color4f( r, g, b, 0.3 );
gEngfuncs.pTriAPI->Color4f( r, g, b, 0.3f );
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4, origin[1] + 4, origin[2] - zScale );
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4, origin[1] - 4, origin[2] - zScale );
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4, origin[1] - 4, z );
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4, origin[1] + 4, z );
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 0.0f );
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4.0f, origin[1] + 4.0f, origin[2] - zScale );
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 0.0f );
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4.0f, origin[1] - 4.0f, origin[2] - zScale );
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 1.0f );
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4.0f, origin[1] - 4.0f, z );
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 1.0f );
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4.0f, origin[1] + 4.0f, z );
gEngfuncs.pTriAPI->End();
gEngfuncs.pTriAPI->Begin( TRI_QUADS );
gEngfuncs.pTriAPI->TexCoord2f( 1, 0 );
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4, origin[1] + 4, origin[2] - zScale );
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4, origin[1] - 4, origin[2] - zScale );
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4, origin[1] - 4, z );
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4, origin[1] + 4, z );
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 0.0f );
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4.0f, origin[1] + 4.0f, origin[2] - zScale );
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 0.0f );
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4.0f, origin[1] - 4.0f, origin[2] - zScale );
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 1.0f );
gEngfuncs.pTriAPI->Vertex3f( origin[0] + 4.0f, origin[1] - 4.0f, z );
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 1.0f );
gEngfuncs.pTriAPI->Vertex3f( origin[0] - 4.0f, origin[1] + 4.0f, z );
gEngfuncs.pTriAPI->End();
// calculate screen position for name and infromation in hud::draw()
@ -1265,7 +1265,7 @@ void CHudSpectator::DrawOverviewEntities()
gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
gEngfuncs.pTriAPI->SpriteTexture( hSpriteModel, 0 );
gEngfuncs.pTriAPI->Color4f( r, g, b, 1.0 );
gEngfuncs.pTriAPI->Color4f( r, g, b, 1.0f );
AngleVectors( angles, forward, NULL, NULL );
VectorScale( forward, 512.0f, forward );
@ -1282,13 +1282,13 @@ void CHudSpectator::DrawOverviewEntities()
VectorTransform( forward, rmatrix , left );
gEngfuncs.pTriAPI->Begin( TRI_TRIANGLES );
gEngfuncs.pTriAPI->TexCoord2f( 0, 0 );
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 0.0f );
gEngfuncs.pTriAPI->Vertex3f( x + right[0], y + right[1], ( z + right[2] ) * zScale);
gEngfuncs.pTriAPI->TexCoord2f( 0, 1 );
gEngfuncs.pTriAPI->TexCoord2f( 0.0f, 1.0f );
gEngfuncs.pTriAPI->Vertex3f( x, y, z * zScale );
gEngfuncs.pTriAPI->TexCoord2f( 1, 1 );
gEngfuncs.pTriAPI->TexCoord2f( 1.0f, 1.0f );
gEngfuncs.pTriAPI->Vertex3f( x + left[0], y + left[1], ( z + left[2] ) * zScale );
gEngfuncs.pTriAPI->End ();
}
@ -1329,7 +1329,7 @@ void CHudSpectator::CheckOverviewEntities()
bool CHudSpectator::AddOverviewEntity( int type, struct cl_entity_s *ent, const char *modelname)
{
HSPRITE hSprite = 0;
double duration = -1.0f; // duration -1 means show it only this frame;
double duration = -1.0; // duration -1 means show it only this frame;
if( !ent )
return false;

View File

@ -16,7 +16,7 @@
// hud_update.cpp
//
#include <math.h>
#include <cmath>
#include "hud.h"
#include "cl_util.h"
#include <stdlib.h>

View File

@ -28,16 +28,16 @@ extern cl_enginefunc_t gEngfuncs;
//-------------------------------------------------- Constants
#define CAM_DIST_DELTA 1.0
#define CAM_ANGLE_DELTA 2.5
#define CAM_ANGLE_SPEED 2.5
#define CAM_MIN_DIST 30.0
#define CAM_ANGLE_MOVE .5
#define MAX_ANGLE_DIFF 10.0
#define PITCH_MAX 90.0
#define PITCH_MIN 0
#define YAW_MAX 135.0
#define YAW_MIN -135.0
#define CAM_DIST_DELTA 1.0f
#define CAM_ANGLE_DELTA 2.5f
#define CAM_ANGLE_SPEED 2.5f
#define CAM_MIN_DIST 30.0f
#define CAM_ANGLE_MOVE 0.5f
#define MAX_ANGLE_DIFF 10.0f
#define PITCH_MAX 90.0f
#define PITCH_MIN 0.0f
#define YAW_MAX 135.0f
#define YAW_MIN -135.0f
enum ECAM_Command
{
@ -91,35 +91,35 @@ float MoveToward( float cur, float goal, float maxspeed )
{
if( cur != goal )
{
if( fabs( cur - goal ) > 180.0 )
if( fabs( cur - goal ) > 180.0f )
{
if( cur < goal )
cur += 360.0;
cur += 360.0f;
else
cur -= 360.0;
cur -= 360.0f;
}
if( cur < goal )
{
if( cur < goal - 1.0 )
cur += ( goal - cur ) / 4.0;
if( cur < goal - 1.0f )
cur += ( goal - cur ) * 0.25f;
else
cur = goal;
}
else
{
if( cur > goal + 1.0 )
cur -= ( cur - goal ) / 4.0;
if( cur > goal + 1.0f )
cur -= ( cur - goal ) * 0.25f;
else
cur = goal;
}
}
// bring cur back into range
if( cur < 0 )
cur += 360.0;
else if( cur >= 360 )
cur -= 360;
if( cur < 0.0f )
cur += 360.0f;
else if( cur >= 360.0f )
cur -= 360.0f;
return cur;
}
@ -172,7 +172,7 @@ void DLLEXPORT CAM_Think( void )
if( cam_contain->value )
{
gEngfuncs.GetClientOrigin( origin );
ext[0] = ext[1] = ext[2] = 0.0;
ext[0] = ext[1] = ext[2] = 0.0f;
}
#endif
camAngles[PITCH] = cam_idealpitch->value;
@ -195,7 +195,7 @@ void DLLEXPORT CAM_Think( void )
//keep the camera within certain limits around the player (ie avoid certain bad viewing angles)
if( cam_mouse.x>gEngfuncs.GetWindowCenterX() )
{
//if( ( camAngles[YAW] >= 225.0 ) || ( camAngles[YAW] < 135.0 ) )
//if( ( camAngles[YAW] >= 225.0f ) || ( camAngles[YAW] < 135.0f ) )
if( camAngles[YAW] < c_maxyaw->value )
{
camAngles[YAW] += CAM_ANGLE_MOVE * ( ( cam_mouse.x - gEngfuncs.GetWindowCenterX() ) / 2 );
@ -207,7 +207,7 @@ void DLLEXPORT CAM_Think( void )
}
else if( cam_mouse.x<gEngfuncs.GetWindowCenterX() )
{
//if( ( camAngles[YAW] <= 135.0 ) || ( camAngles[YAW] > 225.0 ) )
//if( ( camAngles[YAW] <= 135.0f ) || ( camAngles[YAW] > 225.0f ) )
if( camAngles[YAW] > c_minyaw->value )
{
camAngles[YAW] -= CAM_ANGLE_MOVE * ( ( gEngfuncs.GetWindowCenterX() - cam_mouse.x ) / 2 );
@ -363,10 +363,10 @@ void DLLEXPORT CAM_Think( void )
if( camAngles[PITCH] - viewangles[PITCH] != cam_idealpitch->value )
camAngles[PITCH] = MoveToward( camAngles[PITCH], cam_idealpitch->value + viewangles[PITCH], CAM_ANGLE_SPEED );
if( fabs( camAngles[2] - cam_idealdist->value ) < 2.0 )
if( fabs( camAngles[2] - cam_idealdist->value ) < 2.0f )
camAngles[2] = cam_idealdist->value;
else
camAngles[2] += ( cam_idealdist->value - camAngles[2] ) / 4.0;
camAngles[2] += ( cam_idealdist->value - camAngles[2] ) * 0.25f;
}
#ifdef LATER
if( cam_contain->value )
@ -382,9 +382,9 @@ void DLLEXPORT CAM_Think( void )
// check line from r_refdef.vieworg to pnt
memset( &clip, 0, sizeof(moveclip_t) );
ext[0] = ext[1] = ext[2] = 0.0;
ext[0] = ext[1] = ext[2] = 0.0f;
clip.trace = SV_ClipMoveToEntity( sv.edicts, r_refdef.vieworg, ext, ext, pnt );
if( clip.trace.fraction != 1.0 )
if( clip.trace.fraction != 1.0f )
return;
}
#endif

View File

@ -819,7 +819,7 @@ void DLLEXPORT CL_CreateMove( float frametime, struct usercmd_s *cmd, int active
// clip to maxspeed
spd = gEngfuncs.GetClientMaxspeed();
if( spd != 0.0 )
if( spd != 0.0f )
{
// scale the 3 speeds so that the total velocity is not > cl.maxspeed
float fmov = sqrt( ( cmd->forwardmove * cmd->forwardmove ) + ( cmd->sidemove * cmd->sidemove ) + ( cmd->upmove * cmd->upmove ) );

View File

@ -82,42 +82,42 @@ void IN_ToggleButtons( float forwardmove, float sidemove )
}
}
if( forwardmove > 0.7 && !( moveflags & F ) )
if( forwardmove > 0.7f && !( moveflags & F ) )
{
moveflags |= F;
in_forward.state |= BUTTON_DOWN;
}
if( forwardmove < 0.7 && ( moveflags & F ) )
if( forwardmove < 0.7f && ( moveflags & F ) )
{
moveflags &= ~F;
in_forward.state &= ~BUTTON_DOWN;
}
if( forwardmove < -0.7 && !( moveflags & B ) )
if( forwardmove < -0.7f && !( moveflags & B ) )
{
moveflags |= B;
in_back.state |= BUTTON_DOWN;
}
if( forwardmove > -0.7 && ( moveflags & B ) )
if( forwardmove > -0.7f && ( moveflags & B ) )
{
moveflags &= ~B;
in_back.state &= ~BUTTON_DOWN;
}
if( sidemove > 0.9 && !( moveflags & R ) )
if( sidemove > 0.9f && !( moveflags & R ) )
{
moveflags |= R;
in_moveright.state |= BUTTON_DOWN;
}
if( sidemove < 0.9 && ( moveflags & R ) )
if( sidemove < 0.9f && ( moveflags & R ) )
{
moveflags &= ~R;
in_moveright.state &= ~BUTTON_DOWN;
}
if( sidemove < -0.9 && !( moveflags & L ) )
if( sidemove < -0.9f && !( moveflags & L ) )
{
moveflags |= L;
in_moveleft.state |= BUTTON_DOWN;
}
if( sidemove > -0.9 && ( moveflags & L ) )
if( sidemove > -0.9f && ( moveflags & L ) )
{
moveflags &= ~L;
in_moveleft.state &= ~BUTTON_DOWN;

View File

@ -66,22 +66,22 @@ float CHudMessage::FadeBlend( float fadein, float fadeout, float hold, float loc
float fadeTime = fadein + hold;
float fadeBlend;
if( localTime < 0 )
if( localTime < 0.0f )
return 0;
if( localTime < fadein )
{
fadeBlend = 1 - ( ( fadein - localTime ) / fadein );
fadeBlend = 1.0f - ( ( fadein - localTime ) / fadein );
}
else if( localTime > fadeTime )
{
if( fadeout > 0 )
fadeBlend = 1 - ( ( localTime - fadeTime ) / fadeout );
if( fadeout > 0.0f )
fadeBlend = 1.0f - ( ( localTime - fadeTime ) / fadeout );
else
fadeBlend = 0;
fadeBlend = 0.0f;
}
else
fadeBlend = 1;
fadeBlend = 1.0f;
return fadeBlend;
}
@ -91,14 +91,14 @@ int CHudMessage::XPosition( float x, int width, int totalWidth )
{
int xPos;
if( x == -1 )
if( x == -1.0f )
{
xPos = ( ScreenWidth - width ) / 2;
}
else
{
if( x < 0 )
xPos = ( 1.0 + x ) * ScreenWidth - totalWidth; // Alight right
if( x < 0.0f )
xPos = ( 1.0f + x ) * ScreenWidth - totalWidth; // Alight right
else
xPos = x * ScreenWidth;
}
@ -116,12 +116,12 @@ int CHudMessage::YPosition( float y, int height )
int yPos;
if( y == -1 ) // Centered?
yPos = ( ScreenHeight - height ) * 0.5;
yPos = ( ScreenHeight - height ) * 0.5f;
else
{
// Alight bottom?
if ( y < 0 )
yPos = ( 1.0 + y ) * ScreenHeight - height; // Alight bottom
yPos = ( 1.0f + y ) * ScreenHeight - height; // Alight bottom
else // align top
yPos = y * ScreenHeight;
}
@ -164,18 +164,20 @@ void CHudMessage::MessageScanNextChar( void )
float deltaTime = m_parms.time - m_parms.charTime;
destRed = destGreen = destBlue = 0;
if ( m_parms.time > m_parms.fadeTime )
if( m_parms.time > m_parms.fadeTime )
{
blend = m_parms.fadeBlend;
}
else if ( deltaTime > m_parms.pMessage->fxtime )
else if( deltaTime > m_parms.pMessage->fxtime )
{
blend = 0; // pure dest
}
else
{
destRed = m_parms.pMessage->r2;
destGreen = m_parms.pMessage->g2;
destBlue = m_parms.pMessage->b2;
blend = 255 - (deltaTime * (1.0/m_parms.pMessage->fxtime) * 255.0 + 0.5);
blend = 255 - ( deltaTime * ( 1.0f / m_parms.pMessage->fxtime) * 255.0f + 0.5f );
}
}
break;
@ -208,7 +210,7 @@ void CHudMessage::MessageScanStart( void )
if( m_parms.time < m_parms.pMessage->fadein )
{
m_parms.fadeBlend = ( ( m_parms.pMessage->fadein - m_parms.time ) * ( 1.0 / m_parms.pMessage->fadein ) * 255 );
m_parms.fadeBlend = ( ( m_parms.pMessage->fadein - m_parms.time ) * ( 1.0f / m_parms.pMessage->fadein ) * 255 );
}
else if( m_parms.time > m_parms.fadeTime )
{
@ -352,7 +354,7 @@ int CHudMessage::Draw( float fTime )
{
pMessage = m_pMessages[i];
if( m_startTime[i] > gHUD.m_flTime )
m_startTime[i] = gHUD.m_flTime + m_parms.time - m_startTime[i] + 0.2; // 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
}
}
@ -428,11 +430,11 @@ void CHudMessage::MessageAdd( const char *pName, float time )
g_pCustomMessage.g2 = 110;
g_pCustomMessage.b2 = 0;
g_pCustomMessage.a2 = 0;
g_pCustomMessage.x = -1; // Centered
g_pCustomMessage.y = 0.7;
g_pCustomMessage.fadein = 0.01;
g_pCustomMessage.fadeout = 1.5;
g_pCustomMessage.fxtime = 0.25;
g_pCustomMessage.x = -1.0f; // Centered
g_pCustomMessage.y = 0.7f;
g_pCustomMessage.fadein = 0.01f;
g_pCustomMessage.fadeout = 1.5f;
g_pCustomMessage.fxtime = 0.25f;
g_pCustomMessage.holdtime = 5;
g_pCustomMessage.pName = g_pCustomName;
strcpy( g_pCustomText, pName );
@ -452,9 +454,9 @@ void CHudMessage::MessageAdd( const char *pName, float time )
}
// get rid of any other messages in same location (only one displays at a time)
if( fabs( tempMessage->y - m_pMessages[j]->y ) < 0.0001 )
if( fabs( tempMessage->y - m_pMessages[j]->y ) < 0.0001f )
{
if ( fabs( tempMessage->x - m_pMessages[j]->x ) < 0.0001 )
if( fabs( tempMessage->x - m_pMessages[j]->x ) < 0.0001f )
{
m_pMessages[j] = NULL;
}

View File

@ -171,12 +171,12 @@ int CHudScoreboard::Draw( float fTime )
DrawUtfString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
}
list_slot += 1.2;
list_slot += 1.2f;
ypos = ROW_RANGE_MIN + ( list_slot * ROW_GAP );
// xpos = NAME_RANGE_MIN + xpos_rel;
FillRGBA( xpos - 4, ypos, FAR_RIGHT -2, 1, 255, 140, 0, 255 ); // draw the seperator line
list_slot += 0.8;
list_slot += 0.8f;
if( !gHUD.m_Teamplay )
{
@ -328,7 +328,7 @@ int CHudScoreboard::Draw( float fTime )
}
// draw all the players who are not in a team
list_slot += 0.5;
list_slot += 0.5f;
DrawPlayers( xpos_rel, list_slot, 0, "" );
return 1;

View File

@ -23,13 +23,13 @@ void AngleMatrix( const float *angles, float (*matrix)[4] )
float angle;
float sr, sp, sy, cr, cp, cy;
angle = angles[YAW] * ( M_PI*2 / 360 );
angle = angles[YAW] * ( M_PI_F * 2.0f / 360.0f );
sy = sin( angle );
cy = cos( angle );
angle = angles[PITCH] * ( M_PI*2 / 360 );
angle = angles[PITCH] * ( M_PI_F * 2.0f / 360.0f );
sp = sin( angle );
cp = cos( angle );
angle = angles[ROLL] * ( M_PI*2 / 360 );
angle = angles[ROLL] * ( M_PI_F * 2.0f / 360.0f );
sr = sin( angle );
cr = cos( angle );
@ -43,9 +43,9 @@ void AngleMatrix( const float *angles, float (*matrix)[4] )
matrix[0][2] = (cr * sp * cy + -sr * -sy);
matrix[1][2] = (cr * sp * sy + -sr* cy);
matrix[2][2] = cr * cp;
matrix[0][3] = 0.0;
matrix[1][3] = 0.0;
matrix[2][3] = 0.0;
matrix[0][3] = 0.0f;
matrix[1][3] = 0.0f;
matrix[2][3] = 0.0f;
}
/*
@ -73,9 +73,9 @@ CrossProduct
*/
void CrossProduct( const float *v1, const float *v2, float *cross )
{
cross[0] = v1[1]*v2[2] - v1[2]*v2[1];
cross[1] = v1[2]*v2[0] - v1[0]*v2[2];
cross[2] = v1[0]*v2[1] - v1[1]*v2[0];
cross[0] = v1[1] * v2[2] - v1[2] * v2[1];
cross[1] = v1[2] * v2[0] - v1[0] * v2[2];
cross[2] = v1[0] * v2[1] - v1[1] * v2[0];
}
/*
@ -139,13 +139,13 @@ void AngleQuaternion( float *angles, vec4_t quaternion )
float sr, sp, sy, cr, cp, cy;
// FIXME: rescale the inputs to 1/2 angle
angle = angles[2] * 0.5;
angle = angles[2] * 0.5f;
sy = sin( angle );
cy = cos( angle );
angle = angles[1] * 0.5;
angle = angles[1] * 0.5f;
sp = sin( angle );
cp = cos( angle );
angle = angles[0] * 0.5;
angle = angles[0] * 0.5f;
sr = sin( angle );
cr = cos( angle );
@ -185,18 +185,18 @@ void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt )
cosom = p[0] * q[0] + p[1] * q[1] + p[2] * q[2] + p[3] * q[3];
if( ( 1.0 + cosom ) > 0.000001 )
if( ( 1.0f + cosom ) > 0.000001f )
{
if( ( 1.0 - cosom ) > 0.000001 )
if( ( 1.0f - cosom ) > 0.000001f )
{
omega = acos( cosom );
sinom = sin( omega );
sclp = sin( ( 1.0 - t ) * omega ) / sinom;
sclp = sin( ( 1.0f - t ) * omega ) / sinom;
sclq = sin( t * omega ) / sinom;
}
else
{
sclp = 1.0 - t;
sclp = 1.0f - t;
sclq = t;
}
for( i = 0; i < 4; i++ )
@ -210,8 +210,8 @@ void QuaternionSlerp( vec4_t p, vec4_t q, float t, vec4_t qt )
qt[1] = q[0];
qt[2] = -q[3];
qt[3] = q[2];
sclp = sin( ( 1.0 - t ) * ( 0.5 * M_PI ) );
sclq = sin( t * ( 0.5 * M_PI ) );
sclp = sin( ( 1.0f - t ) * ( 0.5f * M_PI_F ) );
sclq = sin( t * ( 0.5f * M_PI_F ) );
for( i = 0; i < 3; i++ )
{
qt[i] = sclp * p[i] + sclq * qt[i];
@ -227,17 +227,17 @@ QuaternionMatrix
*/
void QuaternionMatrix( vec4_t quaternion, float (*matrix)[4] )
{
matrix[0][0] = 1.0 - 2.0 * quaternion[1] * quaternion[1] - 2.0 * quaternion[2] * quaternion[2];
matrix[1][0] = 2.0 * quaternion[0] * quaternion[1] + 2.0 * quaternion[3] * quaternion[2];
matrix[2][0] = 2.0 * quaternion[0] * quaternion[2] - 2.0 * quaternion[3] * quaternion[1];
matrix[0][0] = 1.0f - 2.0f * quaternion[1] * quaternion[1] - 2.0f * quaternion[2] * quaternion[2];
matrix[1][0] = 2.0f * quaternion[0] * quaternion[1] + 2.0f * quaternion[3] * quaternion[2];
matrix[2][0] = 2.0f * quaternion[0] * quaternion[2] - 2.0f * quaternion[3] * quaternion[1];
matrix[0][1] = 2.0 * quaternion[0] * quaternion[1] - 2.0 * quaternion[3] * quaternion[2];
matrix[1][1] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[2] * quaternion[2];
matrix[2][1] = 2.0 * quaternion[1] * quaternion[2] + 2.0 * quaternion[3] * quaternion[0];
matrix[0][1] = 2.0f * quaternion[0] * quaternion[1] - 2.0f * quaternion[3] * quaternion[2];
matrix[1][1] = 1.0f - 2.0f * quaternion[0] * quaternion[0] - 2.0f * quaternion[2] * quaternion[2];
matrix[2][1] = 2.0f * quaternion[1] * quaternion[2] + 2.0f * quaternion[3] * quaternion[0];
matrix[0][2] = 2.0 * quaternion[0] * quaternion[2] + 2.0 * quaternion[3] * quaternion[1];
matrix[1][2] = 2.0 * quaternion[1] * quaternion[2] - 2.0 * quaternion[3] * quaternion[0];
matrix[2][2] = 1.0 - 2.0 * quaternion[0] * quaternion[0] - 2.0 * quaternion[1] * quaternion[1];
matrix[0][2] = 2.0f * quaternion[0] * quaternion[2] + 2.0f * quaternion[3] * quaternion[1];
matrix[1][2] = 2.0f * quaternion[1] * quaternion[2] - 2.0f * quaternion[3] * quaternion[0];
matrix[2][2] = 1.0f - 2.0f * quaternion[0] * quaternion[0] - 2.0f * quaternion[1] * quaternion[1];
}
/*

View File

@ -13,6 +13,10 @@
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
#ifndef M_PI_F
#define M_PI_F (float)M_PI
#endif
#ifndef PITCH
// MOVEMENT INFO
// up / down

View File

@ -18,9 +18,9 @@
// implementation of class-less helper functions
//
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include "hud.h"
#include "cl_util.h"
@ -30,20 +30,22 @@
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
#ifndef M_PI_F
#define M_PI_F (float)M_PI
#endif
extern vec3_t vec3_origin;
#ifdef _MSC_VER
vec3_t vec3_origin;
#endif
double sqrt( double x );
float Length( const float *v )
{
int i;
float length;
length = 0;
length = 0.0f;
for( i = 0; i < 3; i++ )
length += v[i] * v[i];
length = sqrt( length ); // FIXME
@ -55,29 +57,29 @@ void VectorAngles( const float *forward, float *angles )
{
float tmp, yaw, pitch;
if( forward[1] == 0 && forward[0] == 0 )
if( forward[1] == 0.0f && forward[0] == 0.0f )
{
yaw = 0;
if( forward[2] > 0 )
pitch = 90;
yaw = 0.0f;
if( forward[2] > 0.0f )
pitch = 90.0f;
else
pitch = 270;
pitch = 270.0f;
}
else
{
yaw = ( atan2( forward[1], forward[0]) * 180 / M_PI );
if( yaw < 0 )
yaw += 360;
yaw = ( atan2( forward[1], forward[0]) * 180.0f / M_PI_F );
if( yaw < 0.0f )
yaw += 360.0f;
tmp = sqrt( forward[0] * forward[0] + forward[1] * forward[1] );
pitch = ( atan2( forward[2], tmp ) * 180 / M_PI );
if( pitch < 0 )
pitch += 360;
pitch = ( atan2( forward[2], tmp ) * 180.0f / M_PI_F );
if( pitch < 0.0f )
pitch += 360.0f;
}
angles[0] = pitch;
angles[1] = yaw;
angles[2] = 0;
angles[2] = 0.0f;
}
float VectorNormalize( float *v )
@ -89,7 +91,7 @@ float VectorNormalize( float *v )
if( length )
{
ilength = 1 / length;
ilength = 1.0f / length;
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;

View File

@ -20,9 +20,9 @@
#define UTIL_VECTOR_H
// Misc C-runtime library headers
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
// Header file containing definition of globalvars_t and entvars_t
typedef unsigned int func_t; //

View File

@ -40,6 +40,10 @@ extern "C"
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
#ifndef M_PI_F
#define M_PI_F (float)M_PI
#endif
extern "C"
{
int CL_IsThirdPerson( void );
@ -126,13 +130,13 @@ void V_NormalizeAngles( float *angles )
// Normalize angles
for( i = 0; i < 3; i++ )
{
if( angles[i] > 180.0 )
if( angles[i] > 180.0f )
{
angles[i] -= 360.0;
angles[i] -= 360.0f;
}
else if( angles[i] < -180.0 )
else if( angles[i] < -180.0f )
{
angles[i] += 360.0;
angles[i] += 360.0f;
}
}
}
@ -160,13 +164,13 @@ void V_InterpolateAngles( float *start, float *end, float *output, float frac )
ang2 = end[i];
d = ang2 - ang1;
if( d > 180 )
if( d > 180.0f )
{
d -= 360;
d -= 360.0f;
}
else if( d < -180 )
else if( d < -180.0f )
{
d += 360;
d += 360.0f;
}
output[i] = ang1 + d * frac;
@ -199,11 +203,11 @@ float V_CalcBob( struct ref_params_s *pparams )
if( cycle < cl_bobup->value )
{
cycle = M_PI * cycle / cl_bobup->value;
cycle = M_PI_F * cycle / cl_bobup->value;
}
else
{
cycle = M_PI + M_PI * ( cycle - cl_bobup->value )/( 1.0 - cl_bobup->value );
cycle = M_PI_F + M_PI_F * ( cycle - cl_bobup->value )/( 1.0f - cl_bobup->value );
}
// bob is proportional to simulated velocity in the xy plane
@ -212,9 +216,9 @@ float V_CalcBob( struct ref_params_s *pparams )
vel[2] = 0;
bob = sqrt( vel[0] * vel[0] + vel[1] * vel[1] ) * cl_bob->value;
bob = bob * 0.3 + bob * 0.7 * sin(cycle);
bob = Q_min( bob, 4 );
bob = Q_max( bob, -7 );
bob = bob * 0.3f + bob * 0.7f * sin(cycle);
bob = Q_min( bob, 4.0f );
bob = Q_max( bob, -7.0f );
return bob;
}
@ -234,7 +238,7 @@ float V_CalcRoll( vec3_t angles, vec3_t velocity, float rollangle, float rollspe
AngleVectors( angles, forward, right, up );
side = DotProduct( velocity, right );
sign = side < 0 ? -1 : 1;
sign = side < 0.0f ? -1.0f : 1.0f;
side = fabs( side );
value = rollangle;
@ -290,11 +294,11 @@ void V_CalcGunAngle( struct ref_params_s *pparams )
return;
viewent->angles[YAW] = pparams->viewangles[YAW] + pparams->crosshairangle[YAW];
viewent->angles[PITCH] = -pparams->viewangles[PITCH] + pparams->crosshairangle[PITCH] * 0.25;
viewent->angles[PITCH] = -pparams->viewangles[PITCH] + pparams->crosshairangle[PITCH] * 0.25f;
viewent->angles[ROLL] -= v_idlescale * sin( pparams->time * v_iroll_cycle.value ) * v_iroll_level.value;
// don't apply all of the v_ipitch to prevent normally unseen parts of viewmodel from coming into view.
viewent->angles[PITCH] -= v_idlescale * sin( pparams->time * v_ipitch_cycle.value ) * ( v_ipitch_level.value * 0.5 );
viewent->angles[PITCH] -= v_idlescale * sin( pparams->time * v_ipitch_cycle.value ) * ( v_ipitch_level.value * 0.5f );
viewent->angles[YAW] -= v_idlescale * sin( pparams->time * v_iyaw_cycle.value ) * v_iyaw_level.value;
VectorCopy( viewent->angles, viewent->curstate.angles );
@ -453,15 +457,15 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
}
gEngfuncs.V_CalcShake();
gEngfuncs.V_ApplyShake( pparams->vieworg, pparams->viewangles, 1.0 );
gEngfuncs.V_ApplyShake( pparams->vieworg, pparams->viewangles, 1.0f );
// never let view origin sit exactly on a node line, because a water plane can
// dissapear when viewed with the eye exactly on it.
// FIXME, we send origin at 1/128 now, change this?
// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
pparams->vieworg[0] += 1.0 / 32;
pparams->vieworg[1] += 1.0 / 32;
pparams->vieworg[2] += 1.0 / 32;
pparams->vieworg[0] += 1.0f / 32.0f;
pparams->vieworg[1] += 1.0f / 32.0f;
pparams->vieworg[2] += 1.0f / 32.0f;
// Check for problems around water, move the viewer artificially if necessary
// -- this prevents drawing errors in GL due to waves
@ -481,7 +485,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
pwater = gEngfuncs.GetEntityByIndex( waterEntity );
if( pwater && ( pwater->model != NULL ) )
{
waterDist += ( pwater->curstate.scale * 16 ); // Add in wave height
waterDist += ( pwater->curstate.scale * 16.0f ); // Add in wave height
}
}
}
@ -553,7 +557,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
{
vec3_t ofs;
ofs[0] = ofs[1] = ofs[2] = 0.0;
ofs[0] = ofs[1] = ofs[2] = 0.0f;
CL_CameraOffset( (float *)&ofs );
@ -586,18 +590,18 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
VectorAdd( view->origin, pparams->viewheight, view->origin );
// Let the viewmodel shake at about 10% of the amplitude
gEngfuncs.V_ApplyShake( view->origin, view->angles, 0.9 );
gEngfuncs.V_ApplyShake( view->origin, view->angles, 0.9f );
for( i = 0; i < 3; i++ )
{
view->origin[i] += bob * 0.4 * pparams->forward[i];
view->origin[i] += bob * 0.4f * pparams->forward[i];
}
view->origin[2] += bob;
// throw in a little tilt.
view->angles[YAW] -= bob * 0.5;
view->angles[ROLL] -= bob * 1;
view->angles[PITCH] -= bob * 0.3;
view->angles[YAW] -= bob * 0.5f;
view->angles[ROLL] -= bob * 1.0f;
view->angles[PITCH] -= bob * 0.3f;
if( cl_viewbob && cl_viewbob->value )
VectorCopy( view->angles, view->curstate.angles );
@ -605,25 +609,25 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
// pushing the view origin down off of the same X/Z plane as the ent's origin will give the
// gun a very nice 'shifting' effect when the player looks up/down. If there is a problem
// with view model distortion, this may be a cause. (SJB).
view->origin[2] -= 1;
view->origin[2] -= 1.0f;
// fudge position around to keep amount of weapon visible
// roughly equal with different FOV
if( pparams->viewsize == 110 )
if( pparams->viewsize == 110.0f )
{
view->origin[2] += 1;
view->origin[2] += 1.0f;
}
else if( pparams->viewsize == 100 )
else if( pparams->viewsize == 100.0f )
{
view->origin[2] += 2;
view->origin[2] += 2.0f;
}
else if( pparams->viewsize == 90 )
else if( pparams->viewsize == 90.0f )
{
view->origin[2] += 1;
view->origin[2] += 1.0f;
}
else if( pparams->viewsize == 80 )
else if( pparams->viewsize == 80.0f )
{
view->origin[2] += 0.5;
view->origin[2] += 0.5f;
}
// Add in the punchangle, if any
@ -636,7 +640,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
// smooth out stair step ups
#if 1
if( !pparams->smoothing && pparams->onground && pparams->simorg[2] - oldz > 0 )
if( !pparams->smoothing && pparams->onground && pparams->simorg[2] - oldz > 0.0f )
{
float steptime;
@ -646,11 +650,11 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
//FIXME I_Error( "steptime < 0" );
steptime = 0;
oldz += steptime * 150;
oldz += steptime * 150.0f;
if( oldz > pparams->simorg[2] )
oldz = pparams->simorg[2];
if( pparams->simorg[2] - oldz > 18 )
oldz = pparams->simorg[2]- 18;
if( pparams->simorg[2] - oldz > 18.0f )
oldz = pparams->simorg[2]- 18.0f;
pparams->vieworg[2] += oldz - pparams->simorg[2];
view->origin[2] += oldz - pparams->simorg[2];
}
@ -665,7 +669,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
VectorSubtract( pparams->simorg, lastorg, delta );
if( Length( delta ) != 0.0 )
if( Length( delta ) != 0.0f )
{
VectorCopy( pparams->simorg, ViewInterp.Origins[ViewInterp.CurrentOrigin & ORIGIN_MASK] );
ViewInterp.OriginTime[ViewInterp.CurrentOrigin & ORIGIN_MASK] = pparams->time;
@ -682,9 +686,9 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
int foundidx;
float t;
if( cl_vsmoothing->value < 0.0 )
if( cl_vsmoothing->value < 0.0f )
{
gEngfuncs.Cvar_SetValue( "cl_vsmoothing", 0.0 );
gEngfuncs.Cvar_SetValue( "cl_vsmoothing", 0.0f );
}
t = pparams->time - cl_vsmoothing->value;
@ -696,7 +700,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
break;
}
if( i < ORIGIN_MASK && ViewInterp.OriginTime[foundidx & ORIGIN_MASK] != 0.0 )
if( i < ORIGIN_MASK && ViewInterp.OriginTime[foundidx & ORIGIN_MASK] != 0.0f )
{
// Interpolate
vec3_t delta;
@ -713,7 +717,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
VectorMA( ViewInterp.Origins[foundidx & ORIGIN_MASK], frac, delta, neworg );
// Dont interpolate large changes
if( Length( delta ) < 64 )
if( Length( delta ) < 64.0f )
{
VectorSubtract( neworg, pparams->simorg, delta );
@ -735,13 +739,13 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
float pitch = camAngles[0];
// Normalize angles
if( pitch > 180 )
pitch -= 360.0;
else if( pitch < -180 )
pitch += 360;
if( pitch > 180.0f )
pitch -= 360.0f;
else if( pitch < -180.0f )
pitch += 360.0f;
// Player pitch is inverted
pitch /= -3.0;
pitch /= -3.0f;
// Slam local player's pitch value
ent->angles[0] = pitch;
@ -796,7 +800,7 @@ void V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * fi
{
frac = degreesPerSec * v_frametime;
threshhold= degreesPerSec / 4;
threshhold= degreesPerSec / 4.0f;
if( absd < threshhold )
{
@ -811,7 +815,7 @@ void V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * fi
}
else
{
if( d > 0 )
if( d > 0.0f )
finalAngle[i] = startAngle[i] + frac;
else
finalAngle[i] = startAngle[i] - frac;
@ -907,7 +911,7 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
VectorCopy( ent1->origin, newOrigin );
if( ent1->player )
newOrigin[2] += 17; // head level of living player
newOrigin[2] += 17.0f; // head level of living player
// get new angle towards second target
if( ent2 )
@ -921,7 +925,7 @@ void V_GetChaseOrigin( float * angles, float * origin, float distance, float * r
// if no second target is given, look down to dead player
newAngle[0] = 90.0f;
newAngle[1] = 0.0f;
newAngle[2] = 0;
newAngle[2] = 0.0f;
}
// and smooth view
@ -962,12 +966,12 @@ void V_GetSingleTargetCam( cl_entity_t * ent1, float * angle, float * origin )
if( ent1->player )
{
if( deadPlayer )
newOrigin[2] += 2; //laying on ground
newOrigin[2] += 2.0f; //laying on ground
else
newOrigin[2] += 17; // head level of living player
newOrigin[2] += 17.0f; // head level of living player
}
else
newOrigin[2]+= 8; // object, tricky, must be above bomb in CS
newOrigin[2]+= 8.0f; // object, tricky, must be above bomb in CS
// we have no second target, choose view direction based on
// show front of primary target
@ -1005,13 +1009,13 @@ float MaxAngleBetweenAngles( float *a1, float *a2 )
for( int i = 0; i < 3; i++ )
{
d = a2[i] - a1[i];
if( d > 180 )
if( d > 180.0f )
{
d -= 360;
d -= 360.0f;
}
else if( d < -180 )
else if( d < -180.0f )
{
d += 360;
d += 360.0f;
}
d = fabs( d );
@ -1046,9 +1050,9 @@ void V_GetDoubleTargetsCam( cl_entity_t *ent1, cl_entity_t *ent2, float *angle,
VectorCopy( ent1->origin, newOrigin );
if( ent1->player )
newOrigin[2] += 17; // head level of living player
newOrigin[2] += 17.0f; // head level of living player
else
newOrigin[2] += 8; // object, tricky, must be above bomb in CS
newOrigin[2] += 8.0f; // object, tricky, must be above bomb in CS
// get new angle towards second target
VectorSubtract( ent2->origin, ent1->origin, newAngle );
@ -1151,9 +1155,9 @@ void V_GetDirectedChasePosition(cl_entity_t *ent1, cl_entity_t *ent2,float *angl
VectorCopy( ent1->origin, newOrigin );
if( ent1->player )
newOrigin[2] += 17; // head level of living player
newOrigin[2] += 17.0f; // head level of living player
else
newOrigin[2] += 8; // object, tricky, must be above bomb in CS
newOrigin[2] += 8.0f; // object, tricky, must be above bomb in CS
V_GetChaseOrigin( angle, newOrigin, distance, origin );
}
@ -1192,14 +1196,14 @@ void V_GetChasePos( int target, float *cl_angles, float *origin, float *angles )
if( cl_angles == NULL ) // no mouse angles given, use entity angles ( locked mode )
{
VectorCopy( ent->angles, angles);
angles[0] *= -1;
angles[0] *= -1.0f;
}
else
VectorCopy( cl_angles, angles );
VectorCopy( ent->origin, origin );
origin[2] += 28; // DEFAULT_VIEWHEIGHT - some offset
origin[2] += 28.0f; // DEFAULT_VIEWHEIGHT - some offset
V_GetChaseOrigin( angles, origin, cl_chasedist->value, origin );
}
@ -1234,15 +1238,15 @@ void V_GetInEyePos( int target, float *origin, float *angles )
if( ent->curstate.solid == SOLID_NOT )
{
angles[ROLL] = 80; // dead view angle
origin[2] += -8 ; // PM_DEAD_VIEWHEIGHT
angles[ROLL] = 80.0f; // dead view angle
origin[2] += -8.0f; // PM_DEAD_VIEWHEIGHT
}
else if( ent->curstate.usehull == 1 )
origin[2] += 12; // VEC_DUCK_VIEW;
origin[2] += 12.0f; // VEC_DUCK_VIEW;
else
// exacty eye position can't be caluculated since it depends on
// client values like cl_bobcycle, this offset matches the default values
origin[2] += 28; // DEFAULT_VIEWHEIGHT
origin[2] += 28.0f; // DEFAULT_VIEWHEIGHT
}
void V_GetMapFreePosition( float *cl_angles, float *origin, float *angles )
@ -1306,7 +1310,7 @@ void V_GetMapChasePosition( int target, float *cl_angles, float *origin, float *
VectorNormalize( forward );
VectorMA( origin, -1536, forward, origin );
VectorMA( origin, -1536.0f, forward, origin );
}
int V_FindViewModelByWeaponModel( int weaponindex )
@ -1565,8 +1569,8 @@ void V_DropPunchAngle( float frametime, float *ev_punchangle )
float len;
len = VectorNormalize( ev_punchangle );
len -= ( 10.0 + len * 0.5 ) * frametime;
len = Q_max( len, 0.0 );
len -= ( 10.0f + len * 0.5f ) * (float)frametime;
len = Q_max( len, 0.0f );
VectorScale( ev_punchangle, len, ev_punchangle );
}
@ -1617,14 +1621,14 @@ float CalcFov( float fov_x, float width, float height )
float a;
float x;
if( fov_x < 1 || fov_x > 179 )
fov_x = 90; // error, set to 90
if( fov_x < 1.0f || fov_x > 179.0f )
fov_x = 90.0f; // error, set to 90
x = width / tan( fov_x / 360 * M_PI );
x = width / tan( fov_x / 360.0f * M_PI_F );
a = atan ( height / x );
a = a * 360 / M_PI;
a = a * 360.0f / M_PI_F;
return a;
}
@ -1646,8 +1650,8 @@ void V_Move( int mx, int my )
fov = CalcFov( in_fov, (float)ScreenWidth, (float)ScreenHeight );
c_x = (float)ScreenWidth / 2.0;
c_y = (float)ScreenHeight / 2.0;
c_x = (float)ScreenWidth / 2.0f;
c_y = (float)ScreenHeight / 2.0f;
dx = (float)mx - c_x;
dy = (float)my - c_y;
@ -1656,8 +1660,8 @@ void V_Move( int mx, int my )
fx = dx / c_x;
fy = dy / c_y;
dX = fx * in_fov / 2.0 ;
dY = fy * fov / 2.0;
dX = fx * in_fov / 2.0f;
dY = fy * fov / 2.0f;
newangles = v_angles;
@ -1672,10 +1676,10 @@ void V_Move( int mx, int my )
// Trace
tr = *( gEngfuncs.PM_TraceLine( (float *)&v_origin, (float *)&farpoint, PM_TRACELINE_PHYSENTSONLY, 2 /*point sized hull*/, -1 ) );
if( tr.fraction != 1.0 && tr.ent != 0 )
if( tr.fraction != 1.0f && tr.ent != 0 )
{
hitent = PM_GetPhysEntInfo( tr.ent );
PM_ParticleLine( (float *)&v_origin, (float *)&tr.endpos, 5, 1.0, 0.0 );
PM_ParticleLine( (float *)&v_origin, (float *)&tr.endpos, 5, 1.0f, 0.0f );
}
else
{

View File

@ -16,7 +16,14 @@
#pragma once
#ifndef MATHLIB_H
#define MATHLIB_H
#ifndef __cplusplus
#include <math.h>
#ifdef HAVE_TGMATH_H
#include <tgmath.h>
#endif // HAVE_TGMATH_H
#else // __cplusplus
#include <cmath>
#endif // __cplusplus
typedef float vec_t;
@ -30,6 +37,10 @@ typedef vec_t vec3_t[3];
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif
#ifndef M_PI_F
#define M_PI_F (float)M_PI
#endif
struct mplane_s;
extern vec3_t vec3_origin;

View File

@ -25,6 +25,12 @@ project (SVDLL)
set (SVDLL_LIBRARY server)
include(CheckIncludeFile)
check_include_file("tgmath.h" HAVE_TGMATH_H)
if(HAVE_TGMATH_H)
add_definitions(-DHAVE_TGMATH_H)
endif()
add_definitions(-DCLIENT_WEAPONS)
if(NOT MSVC)

View File

@ -22,7 +22,7 @@
#include "squadmonster.h"
#define AFLOCK_MAX_RECRUIT_RADIUS 1024
#define AFLOCK_FLY_SPEED 125
#define AFLOCK_FLY_SPEED 125.0f
#define AFLOCK_TURN_RATE 75
#define AFLOCK_ACCELERATE 10
#define AFLOCK_CHECK_DIST 192
@ -200,7 +200,7 @@ void CFlockingFlyerFlock::SpawnFlock( void )
vecSpot.x = RANDOM_FLOAT( -R, R );
vecSpot.y = RANDOM_FLOAT( -R, R );
vecSpot.z = RANDOM_FLOAT( 0, 16 );
vecSpot.z = RANDOM_FLOAT( 0.0f, 16.0f );
vecSpot = pev->origin + vecSpot;
UTIL_SetOrigin( pBoid->pev, vecSpot );
@ -211,7 +211,7 @@ void CFlockingFlyerFlock::SpawnFlock( void )
pBoid->pev->angles = pev->angles;
pBoid->pev->frame = 0;
pBoid->pev->nextthink = gpGlobals->time + 0.2;
pBoid->pev->nextthink = gpGlobals->time + 0.2f;
pBoid->SetThink( &CFlockingFlyer::IdleThink );
if( pBoid != pLeader )
@ -229,7 +229,7 @@ void CFlockingFlyer::Spawn()
SpawnCommonCode();
pev->frame = 0;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
SetThink( &CFlockingFlyer::IdleThink );
}
@ -284,7 +284,7 @@ void CFlockingFlyer::Killed( entvars_t *pevAttacker, int iGib )
while( pSquad )
{
pSquad->m_flAlertTime = gpGlobals->time + 15;
pSquad->m_flAlertTime = gpGlobals->time + 15.0f;
pSquad = (CFlockingFlyer *)pSquad->m_pSquadNext;
}
@ -302,7 +302,7 @@ void CFlockingFlyer::Killed( entvars_t *pevAttacker, int iGib )
pev->movetype = MOVETYPE_TOSS;
SetThink( &CFlockingFlyer::FallHack );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
void CFlockingFlyer::FallHack( void )
@ -312,7 +312,7 @@ void CFlockingFlyer::FallHack( void )
if( !FClassnameIs ( pev->groundentity, "worldspawn" ) )
{
pev->flags &= ~FL_ONGROUND;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
else
{
@ -334,13 +334,13 @@ void CFlockingFlyer::SpawnCommonCode()
pev->health = 1;
m_fPathBlocked = FALSE;// obstacles will be detected
m_flFieldOfView = 0.2;
m_flFieldOfView = 0.2f;
//SET_MODEL( ENT( pev ), "models/aflock.mdl" );
SET_MODEL( ENT( pev ), "models/boid.mdl" );
//UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
UTIL_SetSize( pev, Vector( -5, -5, 0 ), Vector( 5, 5, 2 ) );
//UTIL_SetSize( pev, Vector( 0.0f, 0.0f, 0.0f ), Vector( 0.0f, 0.0f, 0.0f ) );
UTIL_SetSize( pev, Vector( -5.0f, -5.0f, 0.0f ), Vector( 5.0f, 5.0f, 2.0f ) );
}
//=========================================================
@ -348,38 +348,38 @@ void CFlockingFlyer::SpawnCommonCode()
void CFlockingFlyer::BoidAdvanceFrame()
{
float flapspeed = ( pev->speed - pev->armorvalue ) / AFLOCK_ACCELERATE;
pev->armorvalue = pev->armorvalue * .8 + pev->speed * .2;
pev->armorvalue = pev->armorvalue * 0.8f + pev->speed * 0.2f;
if( flapspeed < 0 )
if( flapspeed < 0.0f )
flapspeed = -flapspeed;
if( flapspeed < 0.25 )
flapspeed = 0.25;
if( flapspeed > 1.9 )
flapspeed = 1.9;
if( flapspeed < 0.25f )
flapspeed = 0.25f;
if( flapspeed > 1.9f )
flapspeed = 1.9f;
pev->framerate = flapspeed;
// lean
pev->avelocity.x = -( pev->angles.x + flapspeed * 5 );
pev->avelocity.x = -( pev->angles.x + flapspeed * 5.0f );
// bank
pev->avelocity.z = -( pev->angles.z + pev->avelocity.y );
// pev->framerate = flapspeed;
StudioFrameAdvance( 0.1 );
StudioFrameAdvance( 0.1f );
}
//=========================================================
//=========================================================
void CFlockingFlyer::IdleThink( void )
{
pev->nextthink = gpGlobals->time + 0.2;
pev->nextthink = gpGlobals->time + 0.2f;
// see if there's a client in the same pvs as the monster
if( !FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) )
{
SetThink( &CFlockingFlyer::Start );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
}
@ -388,7 +388,7 @@ void CFlockingFlyer::IdleThink( void )
//=========================================================
void CFlockingFlyer::Start( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( IsLeader() )
{
@ -473,7 +473,7 @@ void CFlockingFlyer::SpreadFlock()
// can average in a course that points away from the leader.
flSpeed = pList->pev->velocity.Length();
pList->pev->velocity = pList->pev->velocity.Normalize();
pList->pev->velocity = ( pList->pev->velocity + vecDir ) * 0.5;
pList->pev->velocity = ( pList->pev->velocity + vecDir ) * 0.5f;
pList->pev->velocity = pList->pev->velocity * flSpeed;
}
@ -529,28 +529,28 @@ BOOL CFlockingFlyer::FPathBlocked()
// check for obstacle ahead
UTIL_TraceLine( pev->origin, pev->origin + gpGlobals->v_forward * AFLOCK_CHECK_DIST, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
m_flLastBlockedTime = gpGlobals->time;
fBlocked = TRUE;
}
// extra wide checks
UTIL_TraceLine( pev->origin + gpGlobals->v_right * 12, pev->origin + gpGlobals->v_right * 12 + gpGlobals->v_forward * AFLOCK_CHECK_DIST, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
UTIL_TraceLine( pev->origin + gpGlobals->v_right * 12.0f, pev->origin + gpGlobals->v_right * 12.0f + gpGlobals->v_forward * AFLOCK_CHECK_DIST, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0f )
{
m_flLastBlockedTime = gpGlobals->time;
fBlocked = TRUE;
}
UTIL_TraceLine( pev->origin - gpGlobals->v_right * 12, pev->origin - gpGlobals->v_right * 12 + gpGlobals->v_forward * AFLOCK_CHECK_DIST, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
UTIL_TraceLine( pev->origin - gpGlobals->v_right * 12.0f, pev->origin - gpGlobals->v_right * 12.0f + gpGlobals->v_forward * AFLOCK_CHECK_DIST, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0f )
{
m_flLastBlockedTime = gpGlobals->time;
fBlocked = TRUE;
}
if( !fBlocked && gpGlobals->time - m_flLastBlockedTime > 6 )
if( !fBlocked && gpGlobals->time - m_flLastBlockedTime > 6.0f )
{
// not blocked, and it's been a few seconds since we've actually been blocked.
m_flFakeBlockedTime = gpGlobals->time + RANDOM_LONG( 1, 3 );
@ -570,7 +570,7 @@ void CFlockingFlyer::FlockLeaderThink( void )
float flLeftSide;
float flRightSide;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
UTIL_MakeVectors( pev->angles );
@ -587,7 +587,7 @@ void CFlockingFlyer::FlockLeaderThink( void )
m_fPathBlocked = FALSE;
if( pev->speed <= AFLOCK_FLY_SPEED )
pev->speed += 5;
pev->speed += 5.0f;
pev->velocity = gpGlobals->v_forward * pev->speed;
@ -643,8 +643,8 @@ void CFlockingFlyer::FlockLeaderThink( void )
// check and make sure we aren't about to plow into the ground, don't let it happen
UTIL_TraceLine( pev->origin, pev->origin - gpGlobals->v_up * 16, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 && pev->velocity.z < 0 )
pev->velocity.z = 0;
if( tr.flFraction != 1.0f && pev->velocity.z < 0.0f )
pev->velocity.z = 0.0f;
// maybe it did, though.
if( FBitSet( pev->flags, FL_ONGROUND ) )
@ -675,7 +675,7 @@ void CFlockingFlyer::FlockFollowerThink( void )
Vector vecDirToLeader;
float flDistToLeader;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( IsLeader() || !InSquad() )
{
@ -698,19 +698,19 @@ void CFlockingFlyer::FlockFollowerThink( void )
// if we're too far away, speed up
if( flDistToLeader > AFLOCK_TOO_FAR )
{
m_flGoalSpeed = m_pSquadLeader->pev->velocity.Length() * 1.5;
m_flGoalSpeed = m_pSquadLeader->pev->velocity.Length() * 1.5f;
}
// if we're too close, slow down
else if( flDistToLeader < AFLOCK_TOO_CLOSE )
{
m_flGoalSpeed = m_pSquadLeader->pev->velocity.Length() * 0.5;
m_flGoalSpeed = m_pSquadLeader->pev->velocity.Length() * 0.5f;
}
}
else
{
// wait up! the leader isn't out in front, so we slow down to let him pass
m_flGoalSpeed = m_pSquadLeader->pev->velocity.Length() * 0.5;
m_flGoalSpeed = m_pSquadLeader->pev->velocity.Length() * 0.5f;
}
SpreadFlock2();
@ -722,13 +722,13 @@ void CFlockingFlyer::FlockFollowerThink( void )
if( flDistToLeader > AFLOCK_TOO_FAR )
{
vecDirToLeader = vecDirToLeader.Normalize();
pev->velocity = (pev->velocity + vecDirToLeader) * 0.5;
pev->velocity = (pev->velocity + vecDirToLeader) * 0.5f;
}
// clamp speeds and handle acceleration
if( m_flGoalSpeed > AFLOCK_FLY_SPEED * 2 )
if( m_flGoalSpeed > AFLOCK_FLY_SPEED * 2.0f )
{
m_flGoalSpeed = AFLOCK_FLY_SPEED * 2;
m_flGoalSpeed = AFLOCK_FLY_SPEED * 2.0f;
}
if( pev->speed < m_flGoalSpeed )
@ -783,7 +783,7 @@ void CFlockingFlyer::FlockFollowerThink( void )
// else slide left
else
{
m_vecAdjustedVelocity = gpGlobals->v_right * -1;
m_vecAdjustedVelocity = gpGlobals->v_right * -1.0f;
}
}
return;

View File

@ -64,7 +64,7 @@ int iAgruntMuzzleFlash;
#define AGRUNT_AE_LEFT_PUNCH ( 12 )
#define AGRUNT_AE_RIGHT_PUNCH ( 13 )
#define AGRUNT_MELEE_DIST 100
#define AGRUNT_MELEE_DIST 100.0f
class CAGrunt : public CSquadMonster
{
@ -77,8 +77,8 @@ public:
void HandleAnimEvent( MonsterEvent_t *pEvent );
void SetObjectCollisionBox( void )
{
pev->absmin = pev->origin + Vector( -32, -32, 0 );
pev->absmax = pev->origin + Vector( 32, 32, 85 );
pev->absmin = pev->origin + Vector( -32.0f, -32.0f, 0.0f );
pev->absmax = pev->origin + Vector( 32.0f, 32.0f, 85.0f );
}
Schedule_t *GetSchedule( void );
@ -219,7 +219,7 @@ void CAGrunt::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
// hit armor
if( pev->dmgtime != gpGlobals->time || ( RANDOM_LONG( 0, 10 ) < 1 ) )
{
UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 1, 2 ) );
UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 1.0f, 2.0f ) );
pev->dmgtime = gpGlobals->time;
}
@ -227,11 +227,11 @@ void CAGrunt::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
{
Vector vecTracerDir = vecDir;
vecTracerDir.x += RANDOM_FLOAT( -0.3, 0.3 );
vecTracerDir.y += RANDOM_FLOAT( -0.3, 0.3 );
vecTracerDir.z += RANDOM_FLOAT( -0.3, 0.3 );
vecTracerDir.x += RANDOM_FLOAT( -0.3f, 0.3f );
vecTracerDir.y += RANDOM_FLOAT( -0.3f, 0.3f );
vecTracerDir.z += RANDOM_FLOAT( -0.3f, 0.3f );
vecTracerDir = vecTracerDir * -512;
vecTracerDir = vecTracerDir * -512.0f;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, ptr->vecEndPos );
WRITE_BYTE( TE_TRACER );
@ -245,9 +245,9 @@ void CAGrunt::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
MESSAGE_END();
}
flDamage -= 20;
if( flDamage <= 0 )
flDamage = 0.1;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated
flDamage -= 20.0f;
if( flDamage <= 0.0f )
flDamage = 0.1f;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated
}
else
{
@ -263,7 +263,7 @@ void CAGrunt::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
//=========================================================
void CAGrunt::StopTalking( void )
{
m_flNextWordTime = m_flNextSpeakTime = gpGlobals->time + 10 + RANDOM_LONG( 0, 10 );
m_flNextWordTime = m_flNextSpeakTime = gpGlobals->time + 10.0f + RANDOM_LONG( 0, 10 );
}
//=========================================================
@ -285,7 +285,7 @@ BOOL CAGrunt::ShouldSpeak( void )
// if not going to talk because of this, put the talk time
// into the future a bit, so we don't talk immediately after
// going into combat
m_flNextSpeakTime = gpGlobals->time + 3;
m_flNextSpeakTime = gpGlobals->time + 3.0f;
return FALSE;
}
}
@ -312,7 +312,7 @@ void CAGrunt::PrescheduleThink( void )
m_iLastWord = num;
// play a new sound
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pIdleSounds[num], 1.0, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pIdleSounds[num], 1.0f, ATTN_NORM );
// is this word our last?
if( RANDOM_LONG( 1, 10 ) <= 1 )
@ -322,7 +322,7 @@ void CAGrunt::PrescheduleThink( void )
}
else
{
m_flNextWordTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 1 );
m_flNextWordTime = gpGlobals->time + RANDOM_FLOAT( 0.5f, 1.0f );
}
}
}
@ -335,7 +335,7 @@ void CAGrunt::DeathSound( void )
{
StopTalking();
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pDieSounds[RANDOM_LONG( 0, ARRAYSIZE( pDieSounds ) - 1 )], 1.0, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pDieSounds[RANDOM_LONG( 0, ARRAYSIZE( pDieSounds ) - 1 )], 1.0f, ATTN_NORM );
}
//=========================================================
@ -345,7 +345,7 @@ void CAGrunt::AlertSound( void )
{
StopTalking();
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pAlertSounds[RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pAlertSounds[RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0f, ATTN_NORM );
}
//=========================================================
@ -355,7 +355,7 @@ void CAGrunt::AttackSound( void )
{
StopTalking();
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0f, ATTN_NORM );
}
//=========================================================
@ -368,11 +368,11 @@ void CAGrunt::PainSound( void )
return;
}
m_flNextPainTime = gpGlobals->time + 0.6;
m_flNextPainTime = gpGlobals->time + 0.6f;
StopTalking();
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, pPainSounds[RANDOM_LONG( 0, ARRAYSIZE( pPainSounds ) - 1 )], 1.0f, ATTN_NORM );
}
//=========================================================
@ -443,15 +443,15 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
pev->effects = EF_MUZZLEFLASH;
// make angles +-180
if( angDir.x > 180 )
if( angDir.x > 180.0f )
{
angDir.x = angDir.x - 360;
angDir.x = angDir.x - 360.0f;
}
SetBlending( 0, angDir.x );
GetAttachment( 0, vecArmPos, vecArmDir );
vecArmPos = vecArmPos + vecDirToEnemy * 32;
vecArmPos = vecArmPos + vecDirToEnemy * 32.0f;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecArmPos );
WRITE_BYTE( TE_SPRITE );
WRITE_COORD( vecArmPos.x ); // pos
@ -463,10 +463,10 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
MESSAGE_END();
CBaseEntity *pHornet = CBaseEntity::Create( "hornet", vecArmPos, UTIL_VecToAngles( vecDirToEnemy ), edict() );
UTIL_MakeVectors ( pHornet->pev->angles );
pHornet->pev->velocity = gpGlobals->v_forward * 300;
UTIL_MakeVectors( pHornet->pev->angles );
pHornet->pev->velocity = gpGlobals->v_forward * 300.0f;
switch( RANDOM_LONG ( 0 , 2 ) )
switch( RANDOM_LONG( 0, 2 ) )
{
case 0:
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "agrunt/ag_fire1.wav", 1.0, ATTN_NORM, 0, 100 );
@ -507,7 +507,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "player/pl_ladder1.wav", 1, ATTN_NORM, 0, 70 );
break;
case 1:
EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "player/pl_ladder3.wav", 1, ATTN_NORM, 0 ,70);
EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "player/pl_ladder3.wav", 1, ATTN_NORM, 0, 70 );
break;
}
break;
@ -518,17 +518,17 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
if( pHurt )
{
pHurt->pev->punchangle.y = -25;
pHurt->pev->punchangle.x = 8;
pHurt->pev->punchangle.y = -25.0f;
pHurt->pev->punchangle.x = 8.0f;
// OK to use gpGlobals without calling MakeVectors, cause CheckTraceHullAttack called it above.
if( pHurt->IsPlayer() )
{
// this is a player. Knock him around.
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 250;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 250.0f;
}
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
Vector vecArmPos, vecArmAng;
GetAttachment( 0, vecArmPos, vecArmAng );
@ -537,7 +537,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
else
{
// Play a random attack miss sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
}
break;
@ -547,17 +547,17 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
if( pHurt )
{
pHurt->pev->punchangle.y = 25;
pHurt->pev->punchangle.x = 8;
pHurt->pev->punchangle.y = 25.0f;
pHurt->pev->punchangle.x = 8.0f;
// OK to use gpGlobals without calling MakeVectors, cause CheckTraceHullAttack called it above.
if( pHurt->IsPlayer() )
{
// this is a player. Knock him around.
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -250;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * -250.0f;
}
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackHitSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackHitSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
Vector vecArmPos, vecArmAng;
GetAttachment( 0, vecArmPos, vecArmAng );
@ -566,7 +566,7 @@ void CAGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
else
{
// Play a random attack miss sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, pAttackMissSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackMissSounds ) - 1 )], 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
}
break;
@ -584,21 +584,21 @@ void CAGrunt::Spawn()
Precache();
SET_MODEL( ENT( pev ), "models/agrunt.mdl" );
UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) );
UTIL_SetSize( pev, Vector( -32.0f, -32.0f, 0.0f ), Vector( 32.0f, 32.0f, 64.0f ) );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_GREEN;
pev->effects = 0;
pev->health = gSkillData.agruntHealth;
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_flFieldOfView = 0.2f;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
m_afCapability = 0;
m_afCapability |= bits_CAP_SQUAD;
m_HackedGunPos = Vector( 24, 64, 48 );
m_HackedGunPos = Vector( 24.0f, 64.0f, 48.0f );
m_flNextSpeakTime = m_flNextWordTime = gpGlobals->time + 10 + RANDOM_LONG( 0, 10 );
m_flNextSpeakTime = m_flNextWordTime = gpGlobals->time + 10.0f + RANDOM_LONG( 0, 10 );
MonsterInit();
}
@ -651,8 +651,8 @@ Task_t tlAGruntFail[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT, (float)2 },
{ TASK_WAIT_PVS, (float)0 },
{ TASK_WAIT, 2.0f },
{ TASK_WAIT_PVS, 0.0f },
};
Schedule_t slAGruntFail[] =
@ -674,8 +674,8 @@ Task_t tlAGruntCombatFail[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT_FACE_ENEMY, (float)2 },
{ TASK_WAIT_PVS, (float)0 },
{ TASK_WAIT_FACE_ENEMY, 2.0f },
{ TASK_WAIT_PVS, 0.0f },
};
Schedule_t slAGruntCombatFail[] =
@ -697,9 +697,9 @@ Schedule_t slAGruntCombatFail[] =
//=========================================================
Task_t tlAGruntStandoff[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT_FACE_ENEMY, (float)2 },
{ TASK_WAIT_FACE_ENEMY, 2.0f },
};
Schedule_t slAGruntStandoff[] =
@ -722,8 +722,8 @@ Schedule_t slAGruntStandoff[] =
//=========================================================
Task_t tlAGruntSuppressHornet[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_RANGE_ATTACK1, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_RANGE_ATTACK1, 0.0f },
};
Schedule_t slAGruntSuppress[] =
@ -742,9 +742,9 @@ Schedule_t slAGruntSuppress[] =
//=========================================================
Task_t tlAGruntRangeAttack1[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_RANGE_ATTACK1, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_FACE_ENEMY, 0.0f },
{ TASK_RANGE_ATTACK1, 0.0f },
};
Schedule_t slAGruntRangeAttack1[] =
@ -788,13 +788,13 @@ Schedule_t slAGruntHiddenRangeAttack[] =
//=========================================================
Task_t tlAGruntTakeCoverFromEnemy[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_WAIT, (float)0.2 },
{ TASK_FIND_COVER_FROM_ENEMY, (float)0 },
{ TASK_RUN_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_WAIT, 0.2f },
{ TASK_FIND_COVER_FROM_ENEMY, 0.0f },
{ TASK_RUN_PATH, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_REMEMBER, (float)bits_MEMORY_INCOVER },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_FACE_ENEMY, 0.0f },
};
Schedule_t slAGruntTakeCoverFromEnemy[] =
@ -813,13 +813,13 @@ Schedule_t slAGruntTakeCoverFromEnemy[] =
//=========================================================
Task_t tlAGruntVictoryDance[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_AGRUNT_THREAT_DISPLAY },
{ TASK_WAIT, (float)0.2 },
{ TASK_AGRUNT_GET_PATH_TO_ENEMY_CORPSE, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_WAIT, 0.2f },
{ TASK_AGRUNT_GET_PATH_TO_ENEMY_CORPSE, 0.0f },
{ TASK_WALK_PATH, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_FACE_ENEMY, 0.0f },
{ TASK_PLAY_SEQUENCE, (float)ACT_CROUCH },
{ TASK_PLAY_SEQUENCE, (float)ACT_VICTORY_DANCE },
{ TASK_PLAY_SEQUENCE, (float)ACT_VICTORY_DANCE },
@ -851,8 +851,8 @@ Schedule_t slAGruntVictoryDance[] =
//=========================================================
Task_t tlAGruntThreatDisplay[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_FACE_ENEMY, 0.0f },
{ TASK_PLAY_SEQUENCE, (float)ACT_THREAT_DISPLAY },
};
@ -909,7 +909,7 @@ BOOL CAGrunt::FCanCheckAttacks( void )
//=========================================================
BOOL CAGrunt::CheckMeleeAttack1( float flDot, float flDist )
{
if( HasConditions( bits_COND_SEE_ENEMY ) && flDist <= AGRUNT_MELEE_DIST && flDot >= 0.6 && m_hEnemy != 0 )
if( HasConditions( bits_COND_SEE_ENEMY ) && flDist <= AGRUNT_MELEE_DIST && flDot >= 0.6f && m_hEnemy != 0 )
{
return TRUE;
}
@ -930,7 +930,7 @@ BOOL CAGrunt::CheckRangeAttack1( float flDot, float flDist )
return m_fCanHornetAttack;
}
if( HasConditions( bits_COND_SEE_ENEMY ) && flDist >= AGRUNT_MELEE_DIST && flDist <= 1024 && flDot >= 0.5 && NoFriendlyFire() )
if( HasConditions( bits_COND_SEE_ENEMY ) && flDist >= AGRUNT_MELEE_DIST && flDist <= 1024.0f && flDot >= 0.5f && NoFriendlyFire() )
{
TraceResult tr;
Vector vecArmPos, vecArmDir;
@ -939,18 +939,18 @@ BOOL CAGrunt::CheckRangeAttack1( float flDot, float flDist )
// !!!LATER - we may wish to do something different for projectile weapons as opposed to instant-hit
UTIL_MakeVectors( pev->angles );
GetAttachment( 0, vecArmPos, vecArmDir );
//UTIL_TraceLine( vecArmPos, vecArmPos + gpGlobals->v_forward * 256, ignore_monsters, ENT( pev ), &tr );
//UTIL_TraceLine( vecArmPos, vecArmPos + gpGlobals->v_forward * 256.0f, ignore_monsters, ENT( pev ), &tr );
UTIL_TraceLine( vecArmPos, m_hEnemy->BodyTarget( vecArmPos ), dont_ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 || tr.pHit == m_hEnemy->edict() )
if( tr.flFraction == 1.0f || tr.pHit == m_hEnemy->edict() )
{
m_flNextHornetAttackCheck = gpGlobals->time + RANDOM_FLOAT( 2, 5 );
m_flNextHornetAttackCheck = gpGlobals->time + RANDOM_FLOAT( 2.0f, 5.0f );
m_fCanHornetAttack = TRUE;
return m_fCanHornetAttack;
}
}
m_flNextHornetAttackCheck = gpGlobals->time + 0.2;// don't check for half second if this check wasn't successful
m_flNextHornetAttackCheck = gpGlobals->time + 0.2f;// don't check for half second if this check wasn't successful
m_fCanHornetAttack = FALSE;
return m_fCanHornetAttack;
}
@ -965,7 +965,7 @@ void CAGrunt::StartTask( Task_t *pTask )
case TASK_AGRUNT_GET_PATH_TO_ENEMY_CORPSE:
{
UTIL_MakeVectors( pev->angles );
if( BuildRoute( m_vecEnemyLKP - gpGlobals->v_forward * 50, bits_MF_TO_LOCATION, NULL ) )
if( BuildRoute( m_vecEnemyLKP - gpGlobals->v_forward * 50.0f, bits_MF_TO_LOCATION, NULL ) )
{
TaskComplete();
}
@ -995,20 +995,20 @@ void CAGrunt::StartTask( Task_t *pTask )
UTIL_VecToAngles( m_vecEnemyLKP - pev->origin );
UTIL_TraceLine( Center() + gpGlobals->v_forward * 128, m_vecEnemyLKP, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 )
UTIL_TraceLine( Center() + gpGlobals->v_forward * 128.0f, m_vecEnemyLKP, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0f )
{
MakeIdealYaw( pev->origin + gpGlobals->v_right * 128 );
MakeIdealYaw( pev->origin + gpGlobals->v_right * 128.0f );
fSkip = TRUE;
TaskComplete();
}
if( !fSkip )
{
UTIL_TraceLine( Center() - gpGlobals->v_forward * 128, m_vecEnemyLKP, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 )
UTIL_TraceLine( Center() - gpGlobals->v_forward * 128.0f, m_vecEnemyLKP, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0f )
{
MakeIdealYaw( pev->origin - gpGlobals->v_right * 128 );
MakeIdealYaw( pev->origin - gpGlobals->v_right * 128.0f );
fSkip = TRUE;
TaskComplete();
}
@ -1016,10 +1016,10 @@ void CAGrunt::StartTask( Task_t *pTask )
if( !fSkip )
{
UTIL_TraceLine( Center() + gpGlobals->v_forward * 256, m_vecEnemyLKP, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 )
UTIL_TraceLine( Center() + gpGlobals->v_forward * 256.0f, m_vecEnemyLKP, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0f )
{
MakeIdealYaw( pev->origin + gpGlobals->v_right * 256 );
MakeIdealYaw( pev->origin + gpGlobals->v_right * 256.0f );
fSkip = TRUE;
TaskComplete();
}
@ -1027,10 +1027,10 @@ void CAGrunt::StartTask( Task_t *pTask )
if( !fSkip )
{
UTIL_TraceLine( Center() - gpGlobals->v_forward * 256, m_vecEnemyLKP, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 )
UTIL_TraceLine( Center() - gpGlobals->v_forward * 256.0f, m_vecEnemyLKP, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0f )
{
MakeIdealYaw( pev->origin - gpGlobals->v_right * 256 );
MakeIdealYaw( pev->origin - gpGlobals->v_right * 256.0f );
fSkip = TRUE;
TaskComplete();
}

View File

@ -43,27 +43,27 @@ IMPLEMENT_SAVERESTORE( CBaseAnimating, CBaseDelay )
//=========================================================
float CBaseAnimating::StudioFrameAdvance( float flInterval )
{
if( flInterval == 0.0 )
if( flInterval == 0.0f )
{
flInterval = gpGlobals->time - pev->animtime;
if( flInterval <= 0.001 )
if( flInterval <= 0.001f )
{
pev->animtime = gpGlobals->time;
return 0.0;
return 0.0f;
}
}
if( !pev->animtime )
flInterval = 0.0;
flInterval = 0.0f;
pev->frame += flInterval * m_flFrameRate * pev->framerate;
pev->animtime = gpGlobals->time;
if( pev->frame < 0.0 || pev->frame >= 256.0 )
if( pev->frame < 0.0f || pev->frame >= 256.0f )
{
if( m_fSequenceLoops )
pev->frame -= (int)( pev->frame / 256.0 ) * 256.0;
pev->frame -= (int)( pev->frame / 256.0f ) * 256.0f;
else
pev->frame = ( pev->frame < 0.0 ) ? 0 : 255;
pev->frame = ( pev->frame < 0.0f ) ? 0.0f : 255.0f;
m_fSequenceFinished = TRUE; // just in case it wasn't caught in GetEvents
}
@ -142,7 +142,7 @@ void CBaseAnimating::DispatchAnimEvents( float flInterval )
}
// FIXME: I have to do this or some events get missed, and this is probably causing the problem below
flInterval = 0.1;
flInterval = 0.1f;
// FIX: this still sometimes hits events twice
float flStart = pev->frame + ( m_flLastEventCheck - pev->animtime ) * m_flFrameRate * pev->framerate;
@ -150,7 +150,7 @@ void CBaseAnimating::DispatchAnimEvents( float flInterval )
m_flLastEventCheck = pev->animtime + flInterval;
m_fSequenceFinished = FALSE;
if( flEnd >= 256 || flEnd <= 0.0 )
if( flEnd >= 256.0f || flEnd <= 0.0f )
m_fSequenceFinished = TRUE;
int index = 0;
@ -258,7 +258,7 @@ void CBaseAnimating::SetSequenceBox( void )
{
// expand box for rotation
// find min / max for rotations
float yaw = pev->angles.y * ( M_PI / 180.0 );
float yaw = pev->angles.y * ( M_PI_F / 180.0f );
Vector xvector, yvector;
xvector.x = cos( yaw );
@ -270,8 +270,8 @@ void CBaseAnimating::SetSequenceBox( void )
bounds[0] = mins;
bounds[1] = maxs;
Vector rmin( 9999, 9999, 9999 );
Vector rmax( -9999, -9999, -9999 );
Vector rmin( 9999.0f, 9999.0f, 9999.0f );
Vector rmax( -9999.0f, -9999.0f, -9999.0f );
Vector base, transformed;
for( int i = 0; i <= 1; i++ )
@ -304,8 +304,8 @@ void CBaseAnimating::SetSequenceBox( void )
}
}
}
rmin.z = 0;
rmax.z = rmin.z + 1;
rmin.z = 0.0f;
rmax.z = rmin.z + 1.0f;
UTIL_SetSize( pev, rmin, rmax );
}
}

View File

@ -226,8 +226,8 @@ void GetSequenceInfo( void *pmodel, entvars_t *pev, float *pflFrameRate, float *
if( pev->sequence >= pstudiohdr->numseq )
{
*pflFrameRate = 0.0;
*pflGroundSpeed = 0.0;
*pflFrameRate = 0.0f;
*pflGroundSpeed = 0.0f;
return;
}
@ -235,14 +235,14 @@ void GetSequenceInfo( void *pmodel, entvars_t *pev, float *pflFrameRate, float *
if( pseqdesc->numframes > 1 )
{
*pflFrameRate = 256 * pseqdesc->fps / ( pseqdesc->numframes - 1 );
*pflFrameRate = 256.0f * pseqdesc->fps / ( pseqdesc->numframes - 1 );
*pflGroundSpeed = sqrt( pseqdesc->linearmovement[0] * pseqdesc->linearmovement[0] + pseqdesc->linearmovement[1] * pseqdesc->linearmovement[1] + pseqdesc->linearmovement[2] * pseqdesc->linearmovement[2] );
*pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / ( pseqdesc->numframes - 1 );
}
else
{
*pflFrameRate = 256.0;
*pflGroundSpeed = 0.0;
*pflFrameRate = 256.0f;
*pflGroundSpeed = 0.0f;
}
}
@ -279,13 +279,13 @@ int GetAnimationEvent( void *pmodel, entvars_t *pev, MonsterEvent_t *pMonsterEve
if( pseqdesc->numframes > 1 )
{
flStart *= ( pseqdesc->numframes - 1 ) / 256.0;
flEnd *= (pseqdesc->numframes - 1) / 256.0;
flStart *= ( pseqdesc->numframes - 1 ) / 256.0f;
flEnd *= (pseqdesc->numframes - 1) / 256.0f;
}
else
{
flStart = 0;
flEnd = 1.0;
flStart = 0.0f;
flEnd = 1.0f;
}
for( ; index < pseqdesc->numevents; index++ )
@ -333,19 +333,19 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu
flValue = -flValue;
// does the controller not wrap?
if( pbonecontroller->start + 359.0 >= pbonecontroller->end )
if( pbonecontroller->start + 359.0f >= pbonecontroller->end )
{
if( flValue > ( ( pbonecontroller->start + pbonecontroller->end ) / 2.0 ) + 180 )
flValue = flValue - 360;
if( flValue < ( ( pbonecontroller->start + pbonecontroller->end) / 2.0 ) - 180 )
flValue = flValue + 360;
if( flValue > ( ( pbonecontroller->start + pbonecontroller->end ) * 0.5f ) + 180.0f )
flValue = flValue - 360.0f;
if( flValue < ( ( pbonecontroller->start + pbonecontroller->end ) * 0.5f ) - 180.0f )
flValue = flValue + 360.0f;
}
else
{
if( flValue > 360 )
flValue = flValue - (int)( flValue / 360.0 ) * 360.0;
else if( flValue < 0 )
flValue = flValue + (int)( ( flValue / -360.0 ) + 1 ) * 360.0;
if( flValue > 360.0f )
flValue = flValue - (int)( flValue / 360.0f ) * 360.0f;
else if( flValue < 0.0f )
flValue = flValue + (int)( ( flValue / -360.0f ) + 1.0f ) * 360.0f;
}
}
@ -357,7 +357,7 @@ float SetController( void *pmodel, entvars_t *pev, int iController, float flValu
setting = 255;
pev->controller[iController] = setting;
return setting * ( 1.0 / 255.0 ) * (pbonecontroller->end - pbonecontroller->start ) + pbonecontroller->start;
return setting * ( 1.0f / 255.0f ) * (pbonecontroller->end - pbonecontroller->start ) + pbonecontroller->start;
}
float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue )
@ -382,12 +382,12 @@ float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue )
flValue = -flValue;
// does the controller not wrap?
if( pseqdesc->blendstart[iBlender] + 359.0 >= pseqdesc->blendend[iBlender] )
if( pseqdesc->blendstart[iBlender] + 359.0f >= pseqdesc->blendend[iBlender] )
{
if( flValue > ( ( pseqdesc->blendstart[iBlender] + pseqdesc->blendend[iBlender] ) / 2.0 ) + 180 )
flValue = flValue - 360;
if( flValue < ( ( pseqdesc->blendstart[iBlender] + pseqdesc->blendend[iBlender] ) / 2.0 ) - 180 )
flValue = flValue + 360;
if( flValue > ( ( pseqdesc->blendstart[iBlender] + pseqdesc->blendend[iBlender] ) * 0.5f ) + 180.0f )
flValue = flValue - 360.0f;
if( flValue < ( ( pseqdesc->blendstart[iBlender] + pseqdesc->blendend[iBlender] ) * 0.5f ) - 180.0f )
flValue = flValue + 360.0f;
}
}
@ -400,7 +400,7 @@ float SetBlending( void *pmodel, entvars_t *pev, int iBlender, float flValue )
pev->blending[iBlender] = setting;
return setting * ( 1.0 / 255.0 ) * ( pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender] ) + pseqdesc->blendstart[iBlender];
return setting * ( 1.0f / 255.0f ) * ( pseqdesc->blendend[iBlender] - pseqdesc->blendstart[iBlender] ) + pseqdesc->blendstart[iBlender];
}
int FindTransition( void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir )

View File

@ -42,8 +42,8 @@ class CApache : public CBaseMonster
void SetObjectCollisionBox( void )
{
pev->absmin = pev->origin + Vector( -300, -300, -172 );
pev->absmax = pev->origin + Vector( 300, 300, 8 );
pev->absmin = pev->origin + Vector( -300.0f, -300.0f, -172.0f );
pev->absmax = pev->origin + Vector( 300.0f, 300.0f, 8.0f );
}
void EXPORT HuntThink( void );
@ -123,14 +123,14 @@ void CApache::Spawn( void )
pev->solid = SOLID_BBOX;
SET_MODEL( ENT( pev ), "models/apache.mdl" );
UTIL_SetSize( pev, Vector( -32, -32, -64 ), Vector( 32, 32, 0 ) );
UTIL_SetSize( pev, Vector( -32.0f, -32.0f, -64.0f ), Vector( 32.0f, 32.0f, 0.0f ) );
UTIL_SetOrigin( pev, pev->origin );
pev->flags |= FL_MONSTER;
pev->takedamage = DAMAGE_AIM;
pev->health = gSkillData.apacheHealth;
m_flFieldOfView = -0.707; // 270 degrees
m_flFieldOfView = -0.707f; // 270 degrees
pev->sequence = 0;
ResetSequenceInfo();
@ -146,7 +146,7 @@ void CApache::Spawn( void )
{
SetThink( &CApache::HuntThink );
SetTouch( &CApache::FlyTouch );
pev->nextthink = gpGlobals->time + 1.0;
pev->nextthink = gpGlobals->time + 1.0f;
}
m_iRockets = 10;
@ -178,47 +178,47 @@ void CApache::Precache( void )
void CApache::NullThink( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.5;
pev->nextthink = gpGlobals->time + 0.5f;
}
void CApache::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
SetThink( &CApache::HuntThink );
SetTouch( &CApache::FlyTouch );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
SetUse( NULL );
}
void CApache::Killed( entvars_t *pevAttacker, int iGib )
{
pev->movetype = MOVETYPE_TOSS;
pev->gravity = 0.3;
pev->gravity = 0.3f;
STOP_SOUND( ENT( pev ), CHAN_STATIC, "apache/ap_rotor2.wav" );
UTIL_SetSize( pev, Vector( -32, -32, -64 ), Vector( 32, 32, 0 ) );
UTIL_SetSize( pev, Vector( -32.0f, -32.0f, -64.0f ), Vector( 32.0f, 32.0f, 0.0f ) );
SetThink( &CApache::DyingThink );
SetTouch( &CApache::CrashTouch );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->health = 0;
pev->takedamage = DAMAGE_NO;
if( pev->spawnflags & SF_NOWRECKAGE )
{
m_flNextRocket = gpGlobals->time + 4.0;
m_flNextRocket = gpGlobals->time + 4.0f;
}
else
{
m_flNextRocket = gpGlobals->time + 15.0;
m_flNextRocket = gpGlobals->time + 15.0f;
}
}
void CApache::DyingThink( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->avelocity = pev->avelocity * 1.02;
pev->avelocity = pev->avelocity * 1.02f;
// still falling?
if( m_flNextRocket > gpGlobals->time )
@ -226,9 +226,9 @@ void CApache::DyingThink( void )
// random explosions
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_EXPLOSION ); // This just makes a dynamic light now
WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -150, 150 ) );
WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -150, 150 ) );
WRITE_COORD( pev->origin.z + RANDOM_FLOAT( -150, -50 ) );
WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -150.0f, 150.0f ) );
WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -150.0f, 150.0f ) );
WRITE_COORD( pev->origin.z + RANDOM_FLOAT( -150.0f, -50.0f ) );
WRITE_SHORT( g_sModelIndexFireball );
WRITE_BYTE( RANDOM_LONG( 0, 29 ) + 30 ); // scale * 10
WRITE_BYTE( 12 ); // framerate
@ -238,15 +238,15 @@ void CApache::DyingThink( void )
// lots of smoke
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -150, 150 ) );
WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -150, 150 ) );
WRITE_COORD( pev->origin.z + RANDOM_FLOAT( -150, -50 ) );
WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -150.0f, 150.0f ) );
WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -150.0f, 150.0f ) );
WRITE_COORD( pev->origin.z + RANDOM_FLOAT( -150.0f, -50.0f ) );
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( 100 ); // scale * 10
WRITE_BYTE( 10 ); // framerate
MESSAGE_END();
Vector vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5;
Vector vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5f;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
WRITE_BYTE( TE_BREAKMODEL );
@ -283,19 +283,19 @@ void CApache::DyingThink( void )
// don't stop it we touch a entity
pev->flags &= ~FL_ONGROUND;
pev->nextthink = gpGlobals->time + 0.2;
pev->nextthink = gpGlobals->time + 0.2f;
return;
}
else
{
Vector vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5;
Vector vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5f;
/*
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_EXPLOSION); // This just makes a dynamic light now
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
WRITE_COORD( vecSpot.z + 300 );
WRITE_COORD( vecSpot.z + 300.0f );
WRITE_SHORT( g_sModelIndexFireball );
WRITE_BYTE( 250 ); // scale * 10
WRITE_BYTE( 8 ); // framerate
@ -307,7 +307,7 @@ void CApache::DyingThink( void )
WRITE_BYTE( TE_SPRITE );
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
WRITE_COORD( vecSpot.z + 256 );
WRITE_COORD( vecSpot.z + 256.0f );
WRITE_SHORT( m_iExplode );
WRITE_BYTE( 120 ); // scale * 10
WRITE_BYTE( 255 ); // brightness
@ -318,7 +318,7 @@ void CApache::DyingThink( void )
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
WRITE_COORD( vecSpot.z + 512 );
WRITE_COORD( vecSpot.z + 512.0f );
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( 250 ); // scale * 10
WRITE_BYTE( 5 ); // framerate
@ -346,7 +346,7 @@ void CApache::DyingThink( void )
WRITE_BYTE( 0 ); // speed
MESSAGE_END();
EMIT_SOUND( ENT( pev ), CHAN_STATIC, "weapons/mortarhit.wav", 1.0, 0.3 );
EMIT_SOUND( ENT( pev ), CHAN_STATIC, "weapons/mortarhit.wav", 1.0f, 0.3f );
RadiusDamage( pev->origin, pev, pev, 300, CLASS_NONE, DMG_BLAST );
@ -354,22 +354,22 @@ void CApache::DyingThink( void )
{
CBaseEntity *pWreckage = Create( "cycler_wreckage", pev->origin, pev->angles );
// SET_MODEL( ENT( pWreckage->pev ), STRING( pev->model ) );
UTIL_SetSize( pWreckage->pev, Vector( -200, -200, -128 ), Vector( 200, 200, -32 ) );
UTIL_SetSize( pWreckage->pev, Vector( -200.0f, -200.0f, -128.0f ), Vector( 200.0f, 200.0f, -32.0f ) );
pWreckage->pev->frame = pev->frame;
pWreckage->pev->sequence = pev->sequence;
pWreckage->pev->framerate = 0;
pWreckage->pev->dmgtime = gpGlobals->time + 5;
pWreckage->pev->dmgtime = gpGlobals->time + 5.0f;
}
// gibs
vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5;
vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5f;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
WRITE_BYTE( TE_BREAKMODEL);
// position
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
WRITE_COORD( vecSpot.z + 64 );
WRITE_COORD( vecSpot.z + 64.0f );
// size
WRITE_COORD( 400 );
@ -398,7 +398,7 @@ void CApache::DyingThink( void )
MESSAGE_END();
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
}
@ -410,7 +410,7 @@ void CApache::FlyTouch( CBaseEntity *pOther )
TraceResult tr = UTIL_GetGlobalTrace();
// UNDONE, do a real bounce
pev->velocity = pev->velocity + tr.vecPlaneNormal * ( pev->velocity.Length() + 200 );
pev->velocity = pev->velocity + tr.vecPlaneNormal * ( pev->velocity.Length() + 200.0f );
}
}
@ -427,13 +427,13 @@ void CApache::CrashTouch( CBaseEntity *pOther )
void CApache::GibMonster( void )
{
// EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "common/bodysplat.wav", 0.75, ATTN_NORM, 0, 200 );
// EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "common/bodysplat.wav", 0.75f, ATTN_NORM, 0, 200 );
}
void CApache::HuntThink( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
ShowDamage();
@ -455,15 +455,15 @@ void CApache::HuntThink( void )
}
// generic speed up
if( m_flGoalSpeed < 800 )
m_flGoalSpeed += 5;
if( m_flGoalSpeed < 800.0f )
m_flGoalSpeed += 5.0f;
if( m_hEnemy != 0 )
{
// ALERT( at_console, "%s\n", STRING( m_hEnemy->pev->classname ) );
if( FVisible( m_hEnemy ) )
{
if( m_flLastSeen < gpGlobals->time - 5 )
if( m_flLastSeen < gpGlobals->time - 5.0f )
m_flPrevSeen = gpGlobals->time;
m_flLastSeen = gpGlobals->time;
m_posTarget = m_hEnemy->Center();
@ -482,7 +482,7 @@ void CApache::HuntThink( void )
{
// ALERT( at_console, "%.0f\n", flLength );
if( flLength < 128 )
if( flLength < 128.0f )
{
m_pGoalEnt = UTIL_FindEntityByTargetname( NULL, STRING( m_pGoalEnt->pev->target ) );
if( m_pGoalEnt )
@ -499,11 +499,11 @@ void CApache::HuntThink( void )
m_posDesired = pev->origin;
}
if( flLength > 250 ) // 500
if( flLength > 250.0f ) // 500
{
// float flLength2 = ( m_posTarget - pev->origin ).Length() * ( 1.5 - DotProduct( ( m_posTarget - pev->origin ).Normalize(), pev->velocity.Normalize() ) );
// float flLength2 = ( m_posTarget - pev->origin ).Length() * ( 1.5f - DotProduct( ( m_posTarget - pev->origin ).Normalize(), pev->velocity.Normalize() ) );
// if( flLength2 < flLength )
if( m_flLastSeen + 90 > gpGlobals->time && DotProduct( ( m_posTarget - pev->origin ).Normalize(), ( m_posDesired - pev->origin ).Normalize() ) > 0.25 )
if( m_flLastSeen + 90.0f > gpGlobals->time && DotProduct( ( m_posTarget - pev->origin ).Normalize(), ( m_posDesired - pev->origin ).Normalize() ) > 0.25f )
{
m_vecDesired = ( m_posTarget - pev->origin ).Normalize();
}
@ -520,47 +520,47 @@ void CApache::HuntThink( void )
Flight();
// ALERT( at_console, "%.0f %.0f %.0f\n", gpGlobals->time, m_flLastSeen, m_flPrevSeen );
if( ( m_flLastSeen + 1 > gpGlobals->time ) && ( m_flPrevSeen + 2 < gpGlobals->time ) )
if( ( m_flLastSeen + 1.0f > gpGlobals->time ) && ( m_flPrevSeen + 2.0f < gpGlobals->time ) )
{
if( FireGun() )
{
// slow down if we're fireing
if( m_flGoalSpeed > 400 )
m_flGoalSpeed = 400;
if( m_flGoalSpeed > 400.0f )
m_flGoalSpeed = 400.0f;
}
// don't fire rockets and gun on easy mode
if( g_iSkillLevel == SKILL_EASY )
m_flNextRocket = gpGlobals->time + 10.0;
m_flNextRocket = gpGlobals->time + 10.0f;
}
UTIL_MakeAimVectors( pev->angles );
Vector vecEst = ( gpGlobals->v_forward * 800 + pev->velocity ).Normalize();
// ALERT( at_console, "%d %d %d %4.2f\n", pev->angles.x < 0, DotProduct( pev->velocity, gpGlobals->v_forward ) > -100, m_flNextRocket < gpGlobals->time, DotProduct( m_vecTarget, vecEst ) );
Vector vecEst = ( gpGlobals->v_forward * 800.0f + pev->velocity ).Normalize();
// ALERT( at_console, "%d %d %d %4.2f\n", pev->angles.x < 0.0f, DotProduct( pev->velocity, gpGlobals->v_forward ) > -100.0f, m_flNextRocket < gpGlobals->time, DotProduct( m_vecTarget, vecEst ) );
if( ( m_iRockets % 2 ) == 1 )
{
FireRocket();
m_flNextRocket = gpGlobals->time + 0.5;
m_flNextRocket = gpGlobals->time + 0.5f;
if( m_iRockets <= 0 )
{
m_flNextRocket = gpGlobals->time + 10;
m_flNextRocket = gpGlobals->time + 10.0f;
m_iRockets = 10;
}
}
else if( pev->angles.x < 0 && DotProduct( pev->velocity, gpGlobals->v_forward ) > -100 && m_flNextRocket < gpGlobals->time )
else if( pev->angles.x < 0.0f && DotProduct( pev->velocity, gpGlobals->v_forward ) > -100.0f && m_flNextRocket < gpGlobals->time )
{
if( m_flLastSeen + 60 > gpGlobals->time )
if( m_flLastSeen + 60.0f > gpGlobals->time )
{
if( m_hEnemy != 0 )
{
// make sure it's a good shot
if( DotProduct( m_vecTarget, vecEst ) > .965 )
if( DotProduct( m_vecTarget, vecEst ) > .965f )
{
TraceResult tr;
UTIL_TraceLine( pev->origin, pev->origin + vecEst * 4096, ignore_monsters, edict(), &tr );
if( (tr.vecEndPos - m_posTarget ).Length() < 512 )
UTIL_TraceLine( pev->origin, pev->origin + vecEst * 4096.0f, ignore_monsters, edict(), &tr );
if( (tr.vecEndPos - m_posTarget ).Length() < 512.0f )
FireRocket();
}
}
@ -568,9 +568,9 @@ void CApache::HuntThink( void )
{
TraceResult tr;
UTIL_TraceLine( pev->origin, pev->origin + vecEst * 4096, dont_ignore_monsters, edict(), &tr );
UTIL_TraceLine( pev->origin, pev->origin + vecEst * 4096.0f, dont_ignore_monsters, edict(), &tr );
// just fire when close
if( ( tr.vecEndPos - m_posTarget ).Length() < 512 )
if( ( tr.vecEndPos - m_posTarget ).Length() < 512.0f )
FireRocket();
}
}
@ -580,34 +580,34 @@ void CApache::HuntThink( void )
void CApache::Flight( void )
{
// tilt model 5 degrees
Vector vecAdj = Vector( 5.0, 0, 0 );
Vector vecAdj = Vector( 5.0f, 0.0f, 0.0f );
// estimate where I'll be facing in one seconds
UTIL_MakeAimVectors( pev->angles + pev->avelocity * 2 + vecAdj );
// Vector vecEst1 = pev->origin + pev->velocity + gpGlobals->v_up * m_flForce - Vector( 0, 0, 384 );
UTIL_MakeAimVectors( pev->angles + pev->avelocity * 2.0f + vecAdj );
// Vector vecEst1 = pev->origin + pev->velocity + gpGlobals->v_up * m_flForce - Vector( 0.0f, 0.0f, 384.0f );
// float flSide = DotProduct( m_posDesired - vecEst1, gpGlobals->v_right );
float flSide = DotProduct( m_vecDesired, gpGlobals->v_right );
if( flSide < 0 )
if( flSide < 0.0f )
{
if( pev->avelocity.y < 60 )
if( pev->avelocity.y < 60.0f )
{
pev->avelocity.y += 8; // 9 * ( 3.0 / 2.0 );
pev->avelocity.y += 8.0f; // 9 * ( 3.0 / 2.0 );
}
}
else
{
if( pev->avelocity.y > -60 )
if( pev->avelocity.y > -60.0f )
{
pev->avelocity.y -= 8; // 9 * ( 3.0 / 2.0 );
pev->avelocity.y -= 8.0f; // 9 * ( 3.0 / 2.0 );
}
}
pev->avelocity.y *= 0.98;
pev->avelocity.y *= 0.98f;
// estimate where I'll be in two seconds
UTIL_MakeAimVectors( pev->angles + pev->avelocity * 1 + vecAdj );
Vector vecEst = pev->origin + pev->velocity * 2.0 + gpGlobals->v_up * m_flForce * 20 - Vector( 0, 0, 384 * 2 );
UTIL_MakeAimVectors( pev->angles + pev->avelocity * 1.0f + vecAdj );
Vector vecEst = pev->origin + pev->velocity * 2.0f + gpGlobals->v_up * m_flForce * 20.0f - Vector( 0.0f, 0.0f, 384.0f * 2.0f );
// add immediate force
UTIL_MakeAimVectors( pev->angles + vecAdj );
@ -615,11 +615,11 @@ void CApache::Flight( void )
pev->velocity.y += gpGlobals->v_up.y * m_flForce;
pev->velocity.z += gpGlobals->v_up.z * m_flForce;
// add gravity
pev->velocity.z -= 38.4; // 32ft/sec
pev->velocity.z -= 38.4f; // 32ft/sec
float flSpeed = pev->velocity.Length();
float flDir = DotProduct( Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, 0 ), Vector( pev->velocity.x, pev->velocity.y, 0 ) );
float flDir = DotProduct( Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, 0.0f ), Vector( pev->velocity.x, pev->velocity.y, 0.0f ) );
if( flDir < 0 )
flSpeed = -flSpeed;
@ -629,62 +629,62 @@ void CApache::Flight( void )
float flSlip = -DotProduct( m_posDesired - vecEst, gpGlobals->v_right );
// fly sideways
if( flSlip > 0 )
if( flSlip > 0.0f )
{
if( pev->angles.z > -30 && pev->avelocity.z > -15 )
pev->avelocity.z -= 4;
if( pev->angles.z > -30.0f && pev->avelocity.z > -15.0f )
pev->avelocity.z -= 4.0f;
else
pev->avelocity.z += 2;
pev->avelocity.z += 2.0f;
}
else
{
if( pev->angles.z < 30 && pev->avelocity.z < 15 )
pev->avelocity.z += 4;
if( pev->angles.z < 30 && pev->avelocity.z < 15.0f )
pev->avelocity.z += 4.0f;
else
pev->avelocity.z -= 2;
pev->avelocity.z -= 2.0f;
}
// sideways drag
pev->velocity.x = pev->velocity.x * ( 1.0 - fabs( gpGlobals->v_right.x ) * 0.05 );
pev->velocity.y = pev->velocity.y * ( 1.0 - fabs( gpGlobals->v_right.y ) * 0.05 );
pev->velocity.z = pev->velocity.z * ( 1.0 - fabs( gpGlobals->v_right.z ) * 0.05 );
pev->velocity.x = pev->velocity.x * ( 1.0f - fabs( gpGlobals->v_right.x ) * 0.05f );
pev->velocity.y = pev->velocity.y * ( 1.0f - fabs( gpGlobals->v_right.y ) * 0.05f );
pev->velocity.z = pev->velocity.z * ( 1.0f - fabs( gpGlobals->v_right.z ) * 0.05f );
// general drag
pev->velocity = pev->velocity * 0.995;
pev->velocity = pev->velocity * 0.995f;
// apply power to stay correct height
if( m_flForce < 80 && vecEst.z < m_posDesired.z )
if( m_flForce < 80.0f && vecEst.z < m_posDesired.z )
{
m_flForce += 12;
m_flForce += 12.0f;
}
else if( m_flForce > 30 )
else if( m_flForce > 30.0f )
{
if( vecEst.z > m_posDesired.z )
m_flForce -= 8;
m_flForce -= 8.0f;
}
// pitch forward or back to get to target
if( flDist > 0 && flSpeed < m_flGoalSpeed /* && flSpeed < flDist */ && pev->angles.x + pev->avelocity.x > -40 )
if( flDist > 0.0f && flSpeed < m_flGoalSpeed /* && flSpeed < flDist */ && pev->angles.x + pev->avelocity.x > -40.0f )
{
// ALERT( at_console, "F " );
// lean forward
pev->avelocity.x -= 12.0;
pev->avelocity.x -= 12.0f;
}
else if( flDist < 0 && flSpeed > -50 && pev->angles.x + pev->avelocity.x < 20 )
else if( flDist < 0.0f && flSpeed > -50.0f && pev->angles.x + pev->avelocity.x < 20.0f )
{
// ALERT( at_console, "B " );
// lean backward
pev->avelocity.x += 12.0;
pev->avelocity.x += 12.0f;
}
else if( pev->angles.x + pev->avelocity.x > 0 )
else if( pev->angles.x + pev->avelocity.x > 0.0f )
{
// ALERT( at_console, "f " );
pev->avelocity.x -= 4.0;
pev->avelocity.x -= 4.0f;
}
else if( pev->angles.x + pev->avelocity.x < 0 )
else if( pev->angles.x + pev->avelocity.x < 0.0f )
{
// ALERT( at_console, "b " );
pev->avelocity.x += 4.0;
pev->avelocity.x += 4.0f;
}
// ALERT( at_console, "%.0f %.0f : %.0f %.0f : %.0f %.0f : %.0f\n", pev->origin.x, pev->velocity.x, flDist, flSpeed, pev->angles.x, pev->avelocity.x, m_flForce );
@ -693,8 +693,8 @@ void CApache::Flight( void )
// make rotor, engine sounds
if( m_iSoundState == 0 )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "apache/ap_rotor2.wav", 1.0, 0.3, 0, 110 );
// EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "apache/ap_whine1.wav", 0.5, 0.2, 0, 110 );
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "apache/ap_rotor2.wav", 1.0f, 0.3f, 0, 110 );
// EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "apache/ap_whine1.wav", 0.5f, 0.2f, 0, 110 );
m_iSoundState = SND_CHANGE_PITCH; // hack for going through level transitions
}
@ -708,22 +708,22 @@ void CApache::Flight( void )
{
float pitch = DotProduct( pev->velocity - pPlayer->pev->velocity, ( pPlayer->pev->origin - pev->origin ).Normalize() );
pitch = (int)( 100 + pitch / 50.0 );
pitch = (int)( 100.0f + pitch / 50.0f );
if( pitch > 250 )
pitch = 250;
if( pitch < 50 )
pitch = 50;
if( pitch == 100 )
pitch = 101;
if( pitch > 250.0f )
pitch = 250.0f;
if( pitch < 50.0f )
pitch = 50.0f;
if( pitch == 100.0f )
pitch = 101.0f;
float flVol = ( m_flForce / 100.0 ) + .1;
if( flVol > 1.0 )
flVol = 1.0;
float flVol = ( m_flForce / 100.0f ) + 0.1f;
if( flVol > 1.0f )
flVol = 1.0f;
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "apache/ap_rotor2.wav", 1.0, 0.3, 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 );
}
// EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "apache/ap_whine1.wav", flVol, 0.2, SND_CHANGE_PITCH | SND_CHANGE_VOL, pitch );
// EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "apache/ap_whine1.wav", flVol, 0.2f, SND_CHANGE_PITCH | SND_CHANGE_VOL, pitch );
// ALERT( at_console, "%.0f %.2f\n", pitch, flVol );
}
@ -731,27 +731,27 @@ void CApache::Flight( void )
void CApache::FireRocket( void )
{
static float side = 1.0;
static float side = 1.0f;
if( m_iRockets <= 0 )
return;
UTIL_MakeAimVectors( pev->angles );
Vector vecSrc = pev->origin + 1.5 * ( gpGlobals->v_forward * 21 + gpGlobals->v_right * 70 * side + gpGlobals->v_up * -79 );
Vector vecSrc = pev->origin + 1.5f * ( gpGlobals->v_forward * 21.0f + gpGlobals->v_right * 70.0f * side + gpGlobals->v_up * -79.0f );
switch( m_iRockets % 5 )
{
case 0:
vecSrc = vecSrc + gpGlobals->v_right * 10;
vecSrc = vecSrc + gpGlobals->v_right * 10.0f;
break;
case 1:
vecSrc = vecSrc - gpGlobals->v_right * 10;
vecSrc = vecSrc - gpGlobals->v_right * 10.0f;
break;
case 2:
vecSrc = vecSrc + gpGlobals->v_up * 10;
vecSrc = vecSrc + gpGlobals->v_up * 10.0f;
break;
case 3:
vecSrc = vecSrc - gpGlobals->v_up * 10;
vecSrc = vecSrc - gpGlobals->v_up * 10.0f;
break;
case 4:
break;
@ -769,7 +769,7 @@ void CApache::FireRocket( void )
CBaseEntity *pRocket = CBaseEntity::Create( "hvr_rocket", vecSrc, pev->angles, edict() );
if( pRocket )
pRocket->pev->velocity = pev->velocity + gpGlobals->v_forward * 100;
pRocket->pev->velocity = pev->velocity + gpGlobals->v_forward * 100.0f;
m_iRockets--;
@ -794,23 +794,23 @@ BOOL CApache::FireGun()
Vector angles = UTIL_VecToAngles( vecOut );
angles.x = -angles.x;
if( angles.y > 180 )
angles.y = angles.y - 360;
if( angles.y < -180 )
angles.y = angles.y + 360;
if( angles.x > 180 )
angles.x = angles.x - 360;
if( angles.x < -180 )
angles.x = angles.x + 360;
if( angles.y > 180.0f )
angles.y = angles.y - 360.0f;
if( angles.y < -180.0f )
angles.y = angles.y + 360.0f;
if( angles.x > 180.0f )
angles.x = angles.x - 360.0f;
if( angles.x < -180.0f )
angles.x = angles.x + 360.0f;
if( angles.x > m_angGun.x )
m_angGun.x = Q_min( angles.x, m_angGun.x + 12 );
m_angGun.x = Q_min( angles.x, m_angGun.x + 12.0f );
if( angles.x < m_angGun.x )
m_angGun.x = Q_max( angles.x, m_angGun.x - 12 );
m_angGun.x = Q_max( angles.x, m_angGun.x - 12.0f );
if( angles.y > m_angGun.y )
m_angGun.y = Q_min( angles.y, m_angGun.y + 12 );
m_angGun.y = Q_min( angles.y, m_angGun.y + 12.0f );
if( angles.y < m_angGun.y )
m_angGun.y = Q_max( angles.y, m_angGun.y - 12 );
m_angGun.y = Q_max( angles.y, m_angGun.y - 12.0f );
m_angGun.y = SetBoneController( 0, m_angGun.y );
m_angGun.x = SetBoneController( 1, m_angGun.x );
@ -819,11 +819,11 @@ BOOL CApache::FireGun()
GetAttachment( 0, posBarrel, angBarrel );
Vector vecGun = ( posBarrel - posGun ).Normalize();
if( DotProduct( vecGun, vecTarget ) > 0.98 )
if( DotProduct( vecGun, vecTarget ) > 0.98f )
{
#if 1
FireBullets( 1, posGun, vecGun, VECTOR_CONE_4DEGREES, 8192, BULLET_MONSTER_12MM, 1 );
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "turret/tu_fire1.wav", 1, 0.3 );
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "turret/tu_fire1.wav", 1, 0.3f );
#else
static float flNext;
TraceResult tr;
@ -840,7 +840,7 @@ BOOL CApache::FireGun()
if( flNext < gpGlobals->time )
{
flNext = gpGlobals->time + 0.5;
flNext = gpGlobals->time + 0.5f;
m_pBeam->SetStartPos( tr.vecEndPos );
}
#endif
@ -882,14 +882,14 @@ int CApache::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
if( bitsDamageType & DMG_BLAST )
{
flDamage *= 2;
flDamage *= 2.0f;
}
/*
if( ( bitsDamageType & DMG_BULLET ) && flDamage > 50 )
if( ( bitsDamageType & DMG_BULLET ) && flDamage > 50.0f )
{
// clip bullet damage at 50
flDamage = 50;
flDamage = 50.0f;
}
*/
@ -910,13 +910,13 @@ void CApache::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
{
// ALERT( at_console, "%.0f\n", flDamage );
AddMultiDamage( pevAttacker, this, flDamage, bitsDamageType );
m_iDoSmokePuff = 3 + ( flDamage / 5.0 );
m_iDoSmokePuff = 3.0f + ( flDamage / 5.0f );
}
else
{
// do half damage in the body
// AddMultiDamage( pevAttacker, this, flDamage / 2.0, bitsDamageType );
UTIL_Ricochet( ptr->vecEndPos, 2.0 );
// AddMultiDamage( pevAttacker, this, flDamage / 2.0f, bitsDamageType );
UTIL_Ricochet( ptr->vecEndPos, 2.0f );
}
}
@ -961,9 +961,9 @@ void CApacheHVR::Spawn( void )
UTIL_MakeAimVectors( pev->angles );
m_vecForward = gpGlobals->v_forward;
pev->gravity = 0.5;
pev->gravity = 0.5f;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->dmg = 150;
}
@ -972,7 +972,7 @@ void CApacheHVR::Precache( void )
{
PRECACHE_MODEL( "models/HVR.mdl" );
m_iTrail = PRECACHE_MODEL( "sprites/smoke.spr" );
PRECACHE_SOUND("weapons/rocket1.wav");
PRECACHE_SOUND( "weapons/rocket1.wav" );
}
void CApacheHVR::IgniteThink( void )
@ -983,7 +983,7 @@ void CApacheHVR::IgniteThink( void )
pev->effects |= EF_LIGHT;
// make rocket sound
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/rocket1.wav", 1, 0.5 );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/rocket1.wav", 1, 0.5f );
// rocket trail
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
@ -1000,13 +1000,13 @@ void CApacheHVR::IgniteThink( void )
// set to accelerate
SetThink( &CApacheHVR::AccelerateThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
void CApacheHVR::AccelerateThink( void )
{
// check world boundaries
if( pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 )
if( pev->origin.x < -4096.0f || pev->origin.x > 4096.0f || pev->origin.y < -4096.0f || pev->origin.y > 4096.0f || pev->origin.z < -4096.0f || pev->origin.z > 4096.0f )
{
UTIL_Remove( this );
return;
@ -1014,14 +1014,14 @@ void CApacheHVR::AccelerateThink( void )
// accelerate
float flSpeed = pev->velocity.Length();
if( flSpeed < 1800 )
if( flSpeed < 1800.0f )
{
pev->velocity = pev->velocity + m_vecForward * 200;
pev->velocity = pev->velocity + m_vecForward * 200.0f;
}
// re-aim
pev->angles = UTIL_VecToAngles( pev->velocity );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
#endif

View File

@ -60,8 +60,8 @@ public:
#ifdef BARNACLE_FIX_VISIBILITY
void SetObjectCollisionBox( void )
{
pev->absmin = pev->origin + Vector( -16, -16, -m_flCachedLength );
pev->absmax = pev->origin + Vector( 16, 16, 0 );
pev->absmin = pev->origin + Vector( -16.0f, -16.0f, -m_flCachedLength );
pev->absmax = pev->origin + Vector( 16.0f, 16.0f, 0.0f );
}
#endif
};
@ -117,7 +117,7 @@ void CBarnacle::Spawn()
Precache();
SET_MODEL( ENT( pev ), "models/barnacle.mdl" );
UTIL_SetSize( pev, Vector( -16, -16, -32 ), Vector( 16, 16, 0 ) );
UTIL_SetSize( pev, Vector( -16.0f, -16.0f, -32.0f ), Vector( 16.0f, 16.0f, 0.0f ) );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_NONE;
@ -125,20 +125,20 @@ void CBarnacle::Spawn()
m_bloodColor = BLOOD_COLOR_RED;
pev->effects = EF_INVLIGHT; // take light from the ceiling
pev->health = 25;
m_flFieldOfView = 0.5;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_flFieldOfView = 0.5f;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
m_flKillVictimTime = 0;
m_flCachedLength = 32; // mins.z
m_flKillVictimTime = 0.0f;
m_flCachedLength = 32.0f; // mins.z
m_cGibs = 0;
m_fLiftingPrey = FALSE;
m_flTongueAdj = -100;
m_flTongueAdj = -100.0f;
InitBoneControllers();
SetActivity( ACT_IDLE );
SetThink( &CBarnacle::BarnacleThink );
pev->nextthink = gpGlobals->time + 0.5;
pev->nextthink = gpGlobals->time + 0.5f;
UTIL_SetOrigin( pev, pev->origin );
}
@ -168,7 +168,7 @@ void CBarnacle::BarnacleThink( void )
UTIL_SetOrigin( pev, pev->origin );
}
#endif
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( m_hEnemy != 0 )
{
@ -197,8 +197,8 @@ void CBarnacle::BarnacleThink( void )
vecNewEnemyOrigin.y = pev->origin.y;
// guess as to where their neck is
vecNewEnemyOrigin.x -= 6 * cos( m_hEnemy->pev->angles.y * M_PI / 180.0 );
vecNewEnemyOrigin.y -= 6 * sin( m_hEnemy->pev->angles.y * M_PI / 180.0 );
vecNewEnemyOrigin.x -= 6.0f * cos( m_hEnemy->pev->angles.y * M_PI_F / 180.0f );
vecNewEnemyOrigin.y -= 6.0f * sin( m_hEnemy->pev->angles.y * M_PI_F / 180.0f );
m_flAltitude -= BARNACLE_PULL_SPEED;
vecNewEnemyOrigin.z += BARNACLE_PULL_SPEED;
@ -212,7 +212,7 @@ void CBarnacle::BarnacleThink( void )
pVictim = m_hEnemy->MyMonsterPointer();
m_flKillVictimTime = gpGlobals->time + 10;// now that the victim is in place, the killing bite will be administered in 10 seconds.
m_flKillVictimTime = gpGlobals->time + 10.0f;// now that the victim is in place, the killing bite will be administered in 10 seconds.
if( pVictim )
{
@ -228,7 +228,7 @@ void CBarnacle::BarnacleThink( void )
// prey is lifted fully into feeding position and is dangling there.
pVictim = m_hEnemy->MyMonsterPointer();
if( m_flKillVictimTime != -1 && gpGlobals->time > m_flKillVictimTime )
if( m_flKillVictimTime != -1.0f && gpGlobals->time > m_flKillVictimTime )
{
// kill!
if( pVictim )
@ -265,7 +265,7 @@ void CBarnacle::BarnacleThink( void )
// barnacle has no prey right now, so just idle and check to see if anything is touching the tongue.
// If idle and no nearby client, don't think so often
if( FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) )
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 1, 1.5 ); // Stagger a bit to keep barnacles from thinking on the same frame
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 1.0f, 1.5f ); // Stagger a bit to keep barnacles from thinking on the same frame
if( m_fSequenceFinished )
{
@ -304,7 +304,7 @@ void CBarnacle::BarnacleThink( void )
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "barnacle/bcl_alert2.wav", 1, ATTN_NORM );
SetSequenceByName( "attack1" );
m_flTongueAdj = -20;
m_flTongueAdj = -20.0f;
m_hEnemy = pTouchEnt;
@ -339,7 +339,7 @@ void CBarnacle::BarnacleThink( void )
// ALERT( at_console, "tounge %f\n", m_flAltitude + m_flTongueAdj );
SetBoneController( 0, -( m_flAltitude + m_flTongueAdj ) );
StudioFrameAdvance( 0.1 );
StudioFrameAdvance( 0.1f );
}
//=========================================================
@ -377,9 +377,9 @@ void CBarnacle::Killed( entvars_t *pevAttacker, int iGib )
SetActivity( ACT_DIESIMPLE );
SetBoneController( 0, 0 );
StudioFrameAdvance( 0.1 );
StudioFrameAdvance( 0.1f );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
SetThink( &CBarnacle::WaitTillDead );
}
@ -387,9 +387,9 @@ void CBarnacle::Killed( entvars_t *pevAttacker, int iGib )
//=========================================================
void CBarnacle::WaitTillDead( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
float flInterval = StudioFrameAdvance( 0.1 );
float flInterval = StudioFrameAdvance( 0.1f );
DispatchAnimEvents( flInterval );
if( m_fSequenceFinished )
@ -421,21 +421,21 @@ void CBarnacle::Precache()
// to see if any entity is touching it. Also stores the length
// of the trace in the int pointer provided.
//=========================================================
#define BARNACLE_CHECK_SPACING 8
#define BARNACLE_CHECK_SPACING 8.0f
CBaseEntity *CBarnacle::TongueTouchEnt( float *pflLength )
{
TraceResult tr;
float length;
// trace once to hit architecture and see if the tongue needs to change position.
UTIL_TraceLine( pev->origin, pev->origin - Vector ( 0, 0, 2048 ), ignore_monsters, ENT( pev ), &tr );
UTIL_TraceLine( pev->origin, pev->origin - Vector ( 0.0f, 0.0f, 2048.0f ), ignore_monsters, ENT( pev ), &tr );
length = fabs( pev->origin.z - tr.vecEndPos.z );
if( pflLength )
{
*pflLength = length;
}
Vector delta = Vector( BARNACLE_CHECK_SPACING, BARNACLE_CHECK_SPACING, 0 );
Vector delta = Vector( BARNACLE_CHECK_SPACING, BARNACLE_CHECK_SPACING, 0.0f );
Vector mins = pev->origin - delta;
Vector maxs = pev->origin + delta;
maxs.z = pev->origin.z;

View File

@ -266,7 +266,7 @@ void CBarney::AlertSound( void )
{
if( FOkToSpeak() )
{
PlaySentence( "BA_ATTACK", RANDOM_FLOAT( 2.8, 3.2 ), VOL_NORM, ATTN_IDLE );
PlaySentence( "BA_ATTACK", RANDOM_FLOAT( 2.8f, 3.2f ), VOL_NORM, ATTN_IDLE );
}
}
}
@ -305,22 +305,22 @@ void CBarney::SetYawSpeed( void )
//=========================================================
BOOL CBarney::CheckRangeAttack1( float flDot, float flDist )
{
if( flDist <= 1024 && flDot >= 0.5 )
if( flDist <= 1024.0f && flDot >= 0.5f )
{
if( gpGlobals->time > m_checkAttackTime )
{
TraceResult tr;
Vector shootOrigin = pev->origin + Vector( 0, 0, 55 );
Vector shootOrigin = pev->origin + Vector( 0.0f, 0.0f, 55.0f );
CBaseEntity *pEnemy = m_hEnemy;
Vector shootTarget = ( ( pEnemy->BodyTarget( shootOrigin ) - pEnemy->pev->origin ) + m_vecEnemyLKP );
UTIL_TraceLine( shootOrigin, shootTarget, dont_ignore_monsters, ENT( pev ), &tr );
m_checkAttackTime = gpGlobals->time + 1;
if( tr.flFraction == 1.0 || ( tr.pHit != NULL && CBaseEntity::Instance( tr.pHit ) == pEnemy ) )
m_checkAttackTime = gpGlobals->time + 1.0f;
if( tr.flFraction == 1.0f || ( tr.pHit != NULL && CBaseEntity::Instance( tr.pHit ) == pEnemy ) )
m_lastAttackCheck = TRUE;
else
m_lastAttackCheck = FALSE;
m_checkAttackTime = gpGlobals->time + 1.5;
m_checkAttackTime = gpGlobals->time + 1.5f;
}
return m_lastAttackCheck;
}
@ -352,9 +352,9 @@ void CBarney::BarneyFirePistol( void )
pitchShift = 0;
else
pitchShift -= 5;
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "barney/ba_attack2.wav", 1, ATTN_NORM, 0, 100 + pitchShift );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "barney/ba_attack2.wav", 1.0f, ATTN_NORM, 0, 100 + pitchShift );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, 384, 0.3 );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, 384, 0.3f );
// UNDONE: Reload?
m_cAmmoLoaded--;// take away a bullet!
@ -402,7 +402,7 @@ void CBarney::Spawn()
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_RED;
pev->health = gSkillData.barneyHealth;
pev->view_ofs = Vector ( 0, 0, 50 );// position of the eyes relative to monster's origin.
pev->view_ofs = Vector( 0.0f, 0.0f, 50.0f );// position of the eyes relative to monster's origin.
m_flFieldOfView = VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello
m_MonsterState = MONSTERSTATE_NONE;
@ -476,15 +476,15 @@ void CBarney::TalkInit()
static BOOL IsFacing( entvars_t *pevTest, const Vector &reference )
{
Vector vecDir = reference - pevTest->origin;
vecDir.z = 0;
vecDir.z = 0.0f;
vecDir = vecDir.Normalize();
Vector forward, angle;
angle = pevTest->v_angle;
angle.x = 0;
angle.x = 0.0f;
UTIL_MakeVectorsPrivate( angle, forward, NULL, NULL );
// 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;
}
@ -539,18 +539,18 @@ void CBarney::PainSound( void )
if( gpGlobals->time < m_painTime )
return;
m_painTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 0.75 );
m_painTime = gpGlobals->time + RANDOM_FLOAT( 0.5f, 0.75f );
switch( RANDOM_LONG( 0, 2 ) )
{
case 0:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain1.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain1.wav", 1.0f, ATTN_NORM, 0, GetVoicePitch() );
break;
case 1:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain2.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain2.wav", 1.0f, ATTN_NORM, 0, GetVoicePitch() );
break;
case 2:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain3.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_pain3.wav", 1.0f, ATTN_NORM, 0, GetVoicePitch() );
break;
}
}
@ -563,10 +563,10 @@ void CBarney::DeathSound( void )
switch( RANDOM_LONG( 0, 2 ) )
{
case 0:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die1.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die1.wav", 1.0f, ATTN_NORM, 0, GetVoicePitch() );
break;
case 1:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die2.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die2.wav", 1.0f, ATTN_NORM, 0, GetVoicePitch() );
break;
case 2:
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "barney/ba_die3.wav", 1, ATTN_NORM, 0, GetVoicePitch() );
@ -582,17 +582,17 @@ void CBarney::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
case HITGROUP_STOMACH:
if (bitsDamageType & ( DMG_BULLET | DMG_SLASH | DMG_BLAST ) )
{
flDamage = flDamage / 2;
flDamage = flDamage * 0.5f;
}
break;
case 10:
if( bitsDamageType & ( DMG_BULLET | DMG_SLASH | DMG_CLUB ) )
{
flDamage -= 20;
if( flDamage <= 0 )
flDamage -= 20.0f;
if( flDamage <= 0.0f )
{
UTIL_Ricochet( ptr->vecEndPos, 1.0 );
flDamage = 0.01;
UTIL_Ricochet( ptr->vecEndPos, 1.0f );
flDamage = 0.01f;
}
}

View File

@ -150,8 +150,8 @@ IMPLEMENT_SAVERESTORE( CBMortar, CBaseEntity )
#define bits_COND_NODE_SEQUENCE ( bits_COND_SPECIAL1 ) // pev->netname contains the name of a sequence to play
// Attack distance constants
#define BIG_ATTACKDIST 170
#define BIG_MORTARDIST 800
#define BIG_ATTACKDIST 170.0f
#define BIG_MORTARDIST 800.0f
#define BIG_MAXCHILDREN 20 // Max # of live headcrab children
#define bits_MEMORY_CHILDPAIR ( bits_MEMORY_CUSTOM1 )
@ -255,8 +255,8 @@ public:
if( m_crabTime < gpGlobals->time && m_crabCount < BIG_MAXCHILDREN )
{
// Don't spawn crabs inside each other
Vector mins = pev->origin - Vector( 32, 32, 0 );
Vector maxs = pev->origin + Vector( 32, 32, 0 );
Vector mins = pev->origin - Vector( 32.0f, 32.0f, 0.0f );
Vector maxs = pev->origin + Vector( 32.0f, 32.0f, 0.0f );
CBaseEntity *pList[2];
int count = UTIL_EntitiesInBox( pList, 2, mins, maxs, FL_MONSTER );
@ -275,8 +275,8 @@ public:
void SetObjectCollisionBox( void )
{
pev->absmin = pev->origin + Vector( -95, -95, 0 );
pev->absmax = pev->origin + Vector( 95, 95, 190 );
pev->absmin = pev->origin + Vector( -95.0f, -95.0f, 0.0f );
pev->absmax = pev->origin + Vector( 95.0f, 95.0f, 190.0f );
}
BOOL CheckMeleeAttack1( float flDot, float flDist ); // Slash
@ -418,6 +418,7 @@ void CBigMomma::SetYawSpeed( void )
break;
default:
ys = 90;
break;
}
pev->yaw_speed = ys;
}
@ -440,9 +441,9 @@ void CBigMomma::HandleAnimEvent( MonsterEvent_t *pEvent )
UTIL_MakeVectorsPrivate( pev->angles, forward, right, NULL );
Vector center = pev->origin + forward * 128;
Vector mins = center - Vector( 64, 64, 0 );
Vector maxs = center + Vector( 64, 64, 64 );
Vector center = pev->origin + forward * 128.0f;
Vector mins = center - Vector( 64.0f, 64.0f, 0.0f );
Vector maxs = center + Vector( 64.0f, 64.0f, 64.0f );
CBaseEntity *pList[8];
int count = UTIL_EntitiesInBox( pList, 8, mins, maxs, FL_MONSTER | FL_CLIENT );
@ -460,22 +461,22 @@ void CBigMomma::HandleAnimEvent( MonsterEvent_t *pEvent )
if( pHurt )
{
pHurt->TakeDamage( pev, pev, gSkillData.bigmommaDmgSlash, DMG_CRUSH | DMG_SLASH );
pHurt->pev->punchangle.x = 15;
pHurt->pev->punchangle.x = 15.0f;
switch( pEvent->event )
{
case BIG_AE_MELEE_ATTACKBR:
pHurt->pev->velocity = pHurt->pev->velocity + ( forward * 150 ) + Vector( 0, 0, 250 ) - ( right * 200 );
pHurt->pev->velocity = pHurt->pev->velocity + ( forward * 150.0f ) + Vector( 0.0f, 0.0f, 250.0f ) - ( right * 200.0f );
break;
case BIG_AE_MELEE_ATTACKBL:
pHurt->pev->velocity = pHurt->pev->velocity + ( forward * 150 ) + Vector( 0, 0, 250 ) + ( right * 200 );
pHurt->pev->velocity = pHurt->pev->velocity + ( forward * 150.0f ) + Vector( 0.0f, 0.0f, 250.0f ) + ( right * 200.0f );
break;
case BIG_AE_MELEE_ATTACK1:
pHurt->pev->velocity = pHurt->pev->velocity + ( forward * 220 ) + Vector( 0, 0, 200 );
pHurt->pev->velocity = pHurt->pev->velocity + ( forward * 220.0f ) + Vector( 0.0f, 0.0f, 200.0f );
break;
}
pHurt->pev->flags &= ~FL_ONGROUND;
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pAttackHitSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
}
}
break;
@ -515,10 +516,10 @@ void CBigMomma::HandleAnimEvent( MonsterEvent_t *pEvent )
case BIG_AE_JUMP_FORWARD:
ClearBits( pev->flags, FL_ONGROUND );
UTIL_SetOrigin( pev, pev->origin + Vector( 0, 0, 1) );// take him off ground so engine doesn't instantly reset onground
UTIL_SetOrigin( pev, pev->origin + Vector( 0.0f, 0.0f, 1.0f ) );// take him off ground so engine doesn't instantly reset onground
UTIL_MakeVectors( pev->angles );
pev->velocity = gpGlobals->v_forward * 200 + gpGlobals->v_up * 500;
pev->velocity = gpGlobals->v_forward * 200.0f + gpGlobals->v_up * 500.0f;
break;
case BIG_AE_EARLY_TARGET:
{
@ -541,11 +542,11 @@ void CBigMomma::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecD
// didn't hit the sack?
if( pev->dmgtime != gpGlobals->time || ( RANDOM_LONG( 0, 10 ) < 1 ) )
{
UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 1, 2) );
UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 1.0f, 2.0f ) );
pev->dmgtime = gpGlobals->time;
}
flDamage = 0.1;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated
flDamage = 0.1f;// don't hurt the monster much, but allow bits_COND_LIGHT_DAMAGE to be generated
}
else if( gpGlobals->time > m_painSoundTime )
{
@ -560,7 +561,7 @@ int CBigMomma::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, floa
{
// Don't take any acid damage -- BigMomma's mortar is acid
if( bitsDamageType & DMG_ACID )
flDamage = 0;
flDamage = 0.0f;
if( !HasMemory( bits_MEMORY_PATH_FINISHED ) )
{
@ -584,20 +585,20 @@ void CBigMomma::LayHeadcrab( void )
// Is this the second crab in a pair?
if( HasMemory( bits_MEMORY_CHILDPAIR ) )
{
m_crabTime = gpGlobals->time + RANDOM_FLOAT( 5, 10 );
m_crabTime = gpGlobals->time + RANDOM_FLOAT( 5.0f, 10.0f );
Forget( bits_MEMORY_CHILDPAIR );
}
else
{
m_crabTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 2.5 );
m_crabTime = gpGlobals->time + RANDOM_FLOAT( 0.5f, 2.5f );
Remember( bits_MEMORY_CHILDPAIR );
}
TraceResult tr;
UTIL_TraceLine( pev->origin, pev->origin - Vector( 0, 0, 100 ), ignore_monsters, edict(), &tr );
UTIL_TraceLine( pev->origin, pev->origin - Vector( 0.0f, 0.0f, 100.0f ), ignore_monsters, edict(), &tr );
UTIL_DecalTrace( &tr, DECAL_MOMMABIRTH );
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pBirthSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pBirthSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
m_crabCount++;
}
@ -614,15 +615,15 @@ void CBigMomma::DeathNotice( entvars_t *pevChild )
void CBigMomma::LaunchMortar( void )
{
m_mortarTime = gpGlobals->time + RANDOM_FLOAT( 2, 15 );
m_mortarTime = gpGlobals->time + RANDOM_FLOAT( 2.0f, 15.0f );
Vector startPos = pev->origin;
startPos.z += 180;
startPos.z += 180.0f;
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pSackSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pSackSounds ), 1.0f, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
CBMortar *pBomb = CBMortar::Shoot( edict(), startPos, pev->movedir );
pBomb->pev->gravity = 1.0;
MortarSpray( startPos, Vector( 0, 0, 1 ), gSpitSprite, 24 );
pBomb->pev->gravity = 1.0f;
MortarSpray( startPos, Vector( 0.0f, 0.0f, 1.0f ), gSpitSprite, 24 );
}
//=========================================================
@ -633,14 +634,14 @@ void CBigMomma::Spawn()
Precache();
SET_MODEL( ENT( pev ), "models/big_mom.mdl" );
UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) );
UTIL_SetSize( pev, Vector( -32.0f, -32.0f, 0.0f ), Vector( 32.0f, 32.0f, 64.0f ) );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_GREEN;
pev->health = 150 * gSkillData.bigmommaHealthFactor;
pev->view_ofs = Vector( 0, 0, 128 );// position of the eyes relative to monster's origin.
m_flFieldOfView = 0.3;// indicates the width of this monster's forward view cone ( as a dotproduct result )
pev->health = 150.0f * gSkillData.bigmommaHealthFactor;
pev->view_ofs = Vector( 0.0f, 0.0f, 128.0f );// position of the eyes relative to monster's origin.
m_flFieldOfView = 0.3f;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
MonsterInit();
@ -732,7 +733,7 @@ void CBigMomma::NodeReach( void )
// Slash
BOOL CBigMomma::CheckMeleeAttack1( float flDot, float flDist )
{
if( flDot >= 0.7 )
if( flDot >= 0.7f )
{
if( flDist <= BIG_ATTACKDIST )
return TRUE;
@ -756,8 +757,8 @@ BOOL CBigMomma::CheckRangeAttack1( float flDot, float flDist )
if( pEnemy )
{
Vector startPos = pev->origin;
startPos.z += 180;
pev->movedir = VecCheckSplatToss( pev, startPos, pEnemy->BodyTarget( pev->origin ), RANDOM_FLOAT( 150, 500 ) );
startPos.z += 180.0f;
pev->movedir = VecCheckSplatToss( pev, startPos, pEnemy->BodyTarget( pev->origin ), RANDOM_FLOAT( 150.0f, 500.0f ) );
if( pev->movedir != g_vecZero )
return TRUE;
}
@ -893,7 +894,7 @@ void CBigMomma::StartTask( Task_t *pTask )
case TASK_NODE_DELAY:
m_nodeTime = gpGlobals->time + pTask->flData;
TaskComplete();
ALERT( at_aiconsole, "BM: FAIL! Delay %.2f\n", pTask->flData );
ALERT( at_aiconsole, "BM: FAIL! Delay %.2f\n", (double)pTask->flData );
break;
case TASK_PROCESS_NODE:
ALERT( at_aiconsole, "BM: Reached node %s\n", STRING( pev->netname ) );
@ -934,7 +935,7 @@ void CBigMomma::StartTask( Task_t *pTask )
if( m_hTargetEnt->pev->spawnflags & SF_INFOBM_WAIT )
ALERT( at_aiconsole, "BM: Wait at node %s forever\n", STRING( pev->netname ) );
else
ALERT( at_aiconsole, "BM: Wait at node %s for %.2f\n", STRING( pev->netname ), GetNodeDelay() );
ALERT( at_aiconsole, "BM: Wait at node %s for %.2f\n", STRING( pev->netname ), (double)GetNodeDelay() );
break;
@ -1034,12 +1035,12 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
float flGravity = g_psv_gravity->value;
// calculate the midpoint and apex of the 'triangle'
vecMidPoint = vecSpot1 + ( vecSpot2 - vecSpot1 ) * 0.5;
UTIL_TraceLine( vecMidPoint, vecMidPoint + Vector( 0, 0, maxHeight ), ignore_monsters, ENT( pev ), &tr );
vecMidPoint = vecSpot1 + ( vecSpot2 - vecSpot1 ) * 0.5f;
UTIL_TraceLine( vecMidPoint, vecMidPoint + Vector( 0.0f, 0.0f, maxHeight ), ignore_monsters, ENT( pev ), &tr );
vecApex = tr.vecEndPos;
UTIL_TraceLine( vecSpot1, vecApex, dont_ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
// fail!
return g_vecZero;
@ -1048,17 +1049,17 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
// Don't worry about actually hitting the target, this won't hurt us!
// How high should the grenade travel (subtract 15 so the grenade doesn't hit the ceiling)?
float height = vecApex.z - vecSpot1.z - 15;
float height = vecApex.z - vecSpot1.z - 15.0f;
// How fast does the grenade need to travel to reach that height given gravity?
float speed = sqrt( 2 * flGravity * height );
float speed = sqrt( 2.0f * flGravity * height );
// How much time does it take to get there?
float time = speed / flGravity;
vecGrenadeVel = vecSpot2 - vecSpot1;
vecGrenadeVel.z = 0;
vecGrenadeVel.z = 0.0f;
// Travel half the distance to the target in that time (apex is at the midpoint)
vecGrenadeVel = vecGrenadeVel * ( 0.5 / time );
vecGrenadeVel = vecGrenadeVel * ( 0.5f / time );
// Speed to offset gravity at the desired height
vecGrenadeVel.z = speed;
@ -1099,26 +1100,26 @@ void CBMortar::Spawn( void )
SET_MODEL( ENT( pev ), "sprites/mommaspit.spr" );
pev->frame = 0;
pev->scale = 0.5;
pev->scale = 0.5f;
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
pev->dmgtime = gpGlobals->time + 0.4;
pev->dmgtime = gpGlobals->time + 0.4f;
}
void CBMortar::Animate( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( gpGlobals->time > pev->dmgtime )
{
pev->dmgtime = gpGlobals->time + 0.2;
pev->dmgtime = gpGlobals->time + 0.2f;
MortarSpray( pev->origin, -pev->velocity.Normalize(), gSpitSprite, 3 );
}
if( pev->frame++ )
{
if ( pev->frame > m_maxFrame )
if( pev->frame > m_maxFrame )
{
pev->frame = 0;
}
@ -1133,9 +1134,9 @@ CBMortar *CBMortar::Shoot( edict_t *pOwner, Vector vecStart, Vector vecVelocity
UTIL_SetOrigin( pSpit->pev, vecStart );
pSpit->pev->velocity = vecVelocity;
pSpit->pev->owner = pOwner;
pSpit->pev->scale = 2.5;
pSpit->pev->scale = 2.5f;
pSpit->SetThink( &CBMortar::Animate );
pSpit->pev->nextthink = gpGlobals->time + 0.1;
pSpit->pev->nextthink = gpGlobals->time + 0.1f;
return pSpit;
}
@ -1164,13 +1165,13 @@ void CBMortar::Touch( CBaseEntity *pOther )
{
// make a splat on the wall
UTIL_TraceLine( pev->origin, pev->origin + pev->velocity * 10, dont_ignore_monsters, ENT( pev ), &tr );
UTIL_TraceLine( pev->origin, pev->origin + pev->velocity * 10.0f, dont_ignore_monsters, ENT( pev ), &tr );
UTIL_DecalTrace( &tr, DECAL_MOMMASPLAT );
}
else
{
tr.vecEndPos = pev->origin;
tr.vecPlaneNormal = -1 * pev->velocity.Normalize();
tr.vecPlaneNormal = -1.0f * pev->velocity.Normalize();
}
// make some flecks

View File

@ -42,7 +42,7 @@ extern DLL_GLOBAL Vector g_vecAttackDir;
//
Vector VecBModelOrigin( entvars_t* pevBModel )
{
return pevBModel->absmin + ( pevBModel->size * 0.5 );
return pevBModel->absmin + ( pevBModel->size * 0.5f );
}
// =================== FUNC_WALL ==============================================
@ -162,8 +162,8 @@ void CFuncConveyor::Spawn( void )
pev->skin = 0; // Don't want the engine thinking we've got special contents on this brush
}
if( pev->speed == 0 )
pev->speed = 100;
if( pev->speed == 0.0f )
pev->speed = 100.0f;
UpdateSpeed( pev->speed );
}
@ -172,7 +172,7 @@ void CFuncConveyor::Spawn( void )
void CFuncConveyor::UpdateSpeed( float speed )
{
// Encode it as an integer with 4 fractional bits
int speedCode = (int)( fabs( speed ) * 16.0 );
int speedCode = (int)( fabs( speed ) * 16.0f );
if( speed < 0 )
pev->rendercolor.x = 1;
@ -303,17 +303,17 @@ void CFuncRotating::KeyValue( KeyValueData* pkvd )
{
if( FStrEq( pkvd->szKeyName, "fanfriction" ) )
{
m_flFanFriction = atof( pkvd->szValue ) / 100;
m_flFanFriction = atof( pkvd->szValue ) * 0.01f;
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "Volume" ) )
{
m_flVolume = atof( pkvd->szValue ) / 10.0;
m_flVolume = atof( pkvd->szValue ) * 0.1f;
if( m_flVolume > 1.0 )
m_flVolume = 1.0;
if( m_flVolume < 0.0 )
m_flVolume = 0.0;
if( m_flVolume > 1.0f )
m_flVolume = 1.0f;
if( m_flVolume < 0.0f )
m_flVolume = 0.0f;
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "spawnorigin" ) )
@ -352,8 +352,8 @@ void CFuncRotating::Spawn()
m_pitch = PITCH_NORM - 1;
// maintain compatibility with previous maps
if( m_flVolume == 0.0 )
m_flVolume = 1.0;
if( m_flVolume == 0.0f )
m_flVolume = 1.0f;
// if the designer didn't set a sound attenuation, default to one.
m_flAttenuation = ATTN_NORM;
@ -372,21 +372,21 @@ void CFuncRotating::Spawn()
}
// prevent divide by zero if level designer forgets friction!
if( m_flFanFriction == 0 )
if( m_flFanFriction == 0.0f )
{
m_flFanFriction = 1;
m_flFanFriction = 1.0f;
}
if( FBitSet( pev->spawnflags, SF_BRUSH_ROTATE_Z_AXIS ) )
pev->movedir = Vector( 0, 0, 1 );
pev->movedir = Vector( 0.0f, 0.0f, 1.0f );
else if( FBitSet( pev->spawnflags, SF_BRUSH_ROTATE_X_AXIS ) )
pev->movedir = Vector( 1, 0, 0 );
pev->movedir = Vector( 1.0f, 0.0f, 0.0f );
else
pev->movedir = Vector( 0, 1, 0 ); // y-axis
pev->movedir = Vector( 0.0f, 1.0f, 0.0f ); // y-axis
// check for reverse rotation
if( FBitSet( pev->spawnflags, SF_BRUSH_ROTATE_BACKWARDS ) )
pev->movedir = pev->movedir * -1;
pev->movedir = pev->movedir * -1.0f;
// some rotating objects like fake volumetric lights will not be solid.
if( FBitSet( pev->spawnflags, SF_ROTATING_NOT_SOLID ) )
@ -406,8 +406,8 @@ void CFuncRotating::Spawn()
SetUse( &CFuncRotating::RotatingUse );
// did level designer forget to assign speed?
if( pev->speed <= 0 )
pev->speed = 0;
if( pev->speed <= 0.0f )
pev->speed = 0.0f;
// Removed this per level designers request. -- JAY
// if( pev->dmg == 0 )
@ -417,7 +417,7 @@ void CFuncRotating::Spawn()
if( FBitSet( pev->spawnflags, SF_BRUSH_ROTATE_INSTANT ) )
{
SetThink( &CBaseEntity::SUB_CallUseToggle );
pev->nextthink = pev->ltime + 1.5; // leave a magic delay for client to start up
pev->nextthink = pev->ltime + 1.5f; // leave a magic delay for client to start up
}
// can this brush inflict pain?
if( FBitSet( pev->spawnflags, SF_BRUSH_HURT ) )
@ -476,7 +476,7 @@ void CFuncRotating::Precache( void )
// make sure we restart the sound. 1.5 sec delay is magic number. KDB
SetThink( &CFuncRotating::SpinUp );
pev->nextthink = pev->ltime + 1.5;
pev->nextthink = pev->ltime + 1.5f;
}
}
@ -527,7 +527,7 @@ void CFuncRotating::RampPitchVol( int fUp )
// calc volume and pitch as % of final vol and pitch
fpct = vecCur / vecFinal;
//if (fUp)
// fvol = m_flVolume * (0.5 + fpct/2.0); // spinup volume ramps up from 50% max vol
// fvol = m_flVolume * (0.5f + fpct/2.0f); // spinup volume ramps up from 50% max vol
//else
fvol = m_flVolume * fpct; // slowdown volume ramps down to 0
@ -549,7 +549,7 @@ void CFuncRotating::SpinUp( void )
{
Vector vecAVel;//rotational velocity
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
pev->avelocity = pev->avelocity + ( pev->movedir * ( pev->speed * m_flFanFriction ) );
vecAVel = pev->avelocity;// cache entity's rotational velocity
@ -580,23 +580,23 @@ void CFuncRotating::SpinDown( void )
Vector vecAVel;//rotational velocity
vec_t vecdir;
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
pev->avelocity = pev->avelocity - ( pev->movedir * ( pev->speed * m_flFanFriction ) );//spin down slower than spinup
vecAVel = pev->avelocity;// cache entity's rotational velocity
if( pev->movedir.x != 0 )
if( pev->movedir.x != 0.0f )
vecdir = pev->movedir.x;
else if( pev->movedir.y != 0 )
else if( pev->movedir.y != 0.0f )
vecdir = pev->movedir.y;
else
vecdir = pev->movedir.z;
// if we've met or exceeded target speed, set target speed and stop thinking
// (note: must check for movedir > 0 or < 0)
if( ( ( vecdir > 0 ) && ( vecAVel.x <= 0 && vecAVel.y <= 0 && vecAVel.z <= 0 ) ) ||
( ( vecdir < 0 ) && ( vecAVel.x >= 0 && vecAVel.y >= 0 && vecAVel.z >= 0 ) ) )
if( ( ( vecdir > 0.0f ) && ( vecAVel.x <= 0.0f && vecAVel.y <= 0.0f && vecAVel.z <= 0.0f ) ) ||
( ( vecdir < 0.0f ) && ( vecAVel.x >= 0.0f && vecAVel.y >= 0.0f && vecAVel.z >= 0.0f ) ) )
{
pev->avelocity = g_vecZero;// set speed in case we overshot
@ -615,7 +615,7 @@ void CFuncRotating::SpinDown( void )
void CFuncRotating::Rotate( void )
{
pev->nextthink = pev->ltime + 10;
pev->nextthink = pev->ltime + 10.0f;
}
//=========================================================
@ -633,15 +633,15 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
//EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, STRING( pev->noiseStop ),
// m_flVolume, m_flAttenuation, 0, m_pitch );
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
}
else// fan is not moving, so start it
{
SetThink( &CFuncRotating::SpinUp );
EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, STRING( pev->noiseRunning ),
0.01, m_flAttenuation, 0, FANPITCHMIN );
0.01f, m_flAttenuation, 0, FANPITCHMIN );
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
}
}
else if( !FBitSet( pev->spawnflags, SF_BRUSH_ACCDCC ) )//this is a normal start/stop brush.
@ -654,7 +654,7 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
// EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, STRING( pev->noiseStop ),
// m_flVolume, m_flAttenuation, 0, m_pitch );
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
// pev->avelocity = g_vecZero;
}
else
@ -729,7 +729,7 @@ void CPendulum::KeyValue( KeyValueData *pkvd )
}
else if( FStrEq( pkvd->szKeyName, "damp" ) )
{
m_damp = atof( pkvd->szValue ) * 0.001;
m_damp = atof( pkvd->szValue ) * 0.001f;
pkvd->fHandled = TRUE;
}
else
@ -752,18 +752,18 @@ void CPendulum::Spawn( void )
if( m_distance == 0 )
return;
if( pev->speed == 0 )
pev->speed = 100;
if( pev->speed == 0.0f )
pev->speed = 100.0f;
m_accel = ( pev->speed * pev->speed ) / ( 2 * fabs( m_distance ) ); // Calculate constant acceleration from speed and distance
m_accel = ( pev->speed * pev->speed ) / ( 2.0f * fabs( m_distance ) ); // Calculate constant acceleration from speed and distance
m_maxSpeed = pev->speed;
m_start = pev->angles;
m_center = pev->angles + ( m_distance * 0.5 ) * pev->movedir;
m_center = pev->angles + ( m_distance * 0.5f ) * pev->movedir;
if( FBitSet( pev->spawnflags, SF_BRUSH_ROTATE_INSTANT ) )
{
SetThink( &CBaseEntity::SUB_CallUseToggle );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
pev->speed = 0;
SetUse( &CPendulum::PendulumUse );
@ -790,14 +790,14 @@ void CPendulum::PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
}
else
{
pev->speed = 0; // Dead stop
pev->speed = 0.0f; // Dead stop
SetThink( NULL );
pev->avelocity = g_vecZero;
}
}
else
{
pev->nextthink = pev->ltime + 0.1; // Start the pendulum moving
pev->nextthink = pev->ltime + 0.1f; // Start the pendulum moving
m_time = gpGlobals->time; // Save time to calculate dt
SetThink( &CPendulum::Swing );
m_dampSpeed = m_maxSpeed;
@ -807,7 +807,7 @@ void CPendulum::PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
void CPendulum::Stop( void )
{
pev->angles = m_start;
pev->speed = 0;
pev->speed = 0.0f;
SetThink( NULL );
pev->avelocity = g_vecZero;
}
@ -825,7 +825,7 @@ void CPendulum::Swing( void )
dt = gpGlobals->time - m_time; // How much time has passed?
m_time = gpGlobals->time; // Remember the last time called
if( delta > 0 && m_accel > 0 )
if( delta > 0.0f && m_accel > 0.0f )
pev->speed -= m_accel * dt; // Integrate velocity
else
pev->speed += m_accel * dt;
@ -838,12 +838,12 @@ void CPendulum::Swing( void )
pev->avelocity = pev->speed * pev->movedir;
// Call this again
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
if( m_damp )
{
m_dampSpeed -= m_damp * m_dampSpeed * dt;
if( m_dampSpeed < 30.0 )
if( m_dampSpeed < 30.0f )
{
pev->angles = m_center;
pev->speed = 0;
@ -869,7 +869,7 @@ void CPendulum::Touch( CBaseEntity *pOther )
return;
// calculate damage based on rotation speed
float damage = pev->dmg * pev->speed * 0.01;
float damage = pev->dmg * pev->speed * 0.01f;
if( damage < 0 )
damage = -damage;

View File

@ -27,7 +27,7 @@
#include "soundent.h"
#include "game.h"
#define SQUID_SPRINT_DIST 256 // how close the squid has to get before starting to sprint and refusing to swerve
#define SQUID_SPRINT_DIST 256.0f // how close the squid has to get before starting to sprint and refusing to swerve
int iSquidSpitSprite;
@ -91,7 +91,7 @@ void CSquidSpit::Spawn( void )
SET_MODEL( ENT( pev ), "sprites/bigspit.spr" );
pev->frame = 0;
pev->scale = 0.5;
pev->scale = 0.5f;
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
@ -100,7 +100,7 @@ void CSquidSpit::Spawn( void )
void CSquidSpit::Animate( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( pev->frame++ )
{
@ -121,7 +121,7 @@ void CSquidSpit::Shoot( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity
pSpit->pev->owner = ENT( pevOwner );
pSpit->SetThink( &CSquidSpit::Animate );
pSpit->pev->nextthink = gpGlobals->time + 0.1;
pSpit->pev->nextthink = gpGlobals->time + 0.1f;
}
void CSquidSpit::Touch( CBaseEntity *pOther )
@ -130,7 +130,7 @@ void CSquidSpit::Touch( CBaseEntity *pOther )
int iPitch;
// splat sound
iPitch = RANDOM_FLOAT( 90, 110 );
iPitch = RANDOM_FLOAT( 90.0f, 110.0f );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "bullchicken/bc_acid1.wav", 1, ATTN_NORM, 0, iPitch );
@ -242,7 +242,7 @@ int CBullsquid::IgnoreConditions( void )
{
int iIgnore = CBaseMonster::IgnoreConditions();
if( gpGlobals->time - m_flLastHurtTime <= 20 )
if( gpGlobals->time - m_flLastHurtTime <= 20.0f )
{
// haven't been hurt in 20 seconds, so let the squid care about stink.
iIgnore = bits_COND_SMELL | bits_COND_SMELL_FOOD;
@ -266,7 +266,7 @@ int CBullsquid::IgnoreConditions( void )
//=========================================================
int CBullsquid::IRelationship( CBaseEntity *pTarget )
{
if( gpGlobals->time - m_flLastHurtTime < 5 && FClassnameIs( pTarget->pev, "monster_headcrab" ) )
if( gpGlobals->time - m_flLastHurtTime < 5.0f && FClassnameIs( pTarget->pev, "monster_headcrab" ) )
{
// if squid has been hurt in the last 5 seconds, and is getting relationship for a headcrab,
// tell squid to disregard crab.
@ -287,7 +287,7 @@ int CBullsquid::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
// if the squid is running, has an enemy, was hurt by the enemy, hasn't been hurt in the last 3 seconds, and isn't too close to the enemy,
// it will swerve. (whew).
if( m_hEnemy != 0 && IsMoving() && pevAttacker == m_hEnemy->pev && gpGlobals->time - m_flLastHurtTime > 3 )
if( m_hEnemy != 0 && IsMoving() && pevAttacker == m_hEnemy->pev && gpGlobals->time - m_flLastHurtTime > 3.0f )
{
flDist = ( pev->origin - m_hEnemy->pev->origin ).Length2D();
@ -295,7 +295,7 @@ int CBullsquid::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
{
flDist = ( pev->origin - m_Route[m_iRouteIndex].vecLocation ).Length2D();// reusing flDist.
if( FTriangulate( pev->origin, m_Route[m_iRouteIndex].vecLocation, flDist * 0.5, m_hEnemy, &vecApex ) )
if( FTriangulate( pev->origin, m_Route[m_iRouteIndex].vecLocation, flDist * 0.5f, m_hEnemy, &vecApex ) )
{
InsertWaypoint( vecApex, bits_MF_TO_DETOUR | bits_MF_DONT_SIMPLIFY );
}
@ -316,17 +316,17 @@ int CBullsquid::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
//=========================================================
BOOL CBullsquid::CheckRangeAttack1( float flDot, float flDist )
{
if( IsMoving() && flDist >= 512 )
if( IsMoving() && flDist >= 512.0f )
{
// squid will far too far behind if he stops running to spit at this distance from the enemy.
return FALSE;
}
if( flDist > 64 && flDist <= 784 && flDot >= 0.5 && gpGlobals->time >= m_flNextSpitTime )
if( flDist > 64.0f && flDist <= 784.0f && flDot >= 0.5f && gpGlobals->time >= m_flNextSpitTime )
{
if( m_hEnemy != 0 )
{
if( fabs( pev->origin.z - m_hEnemy->pev->origin.z ) > 256 )
if( fabs( pev->origin.z - m_hEnemy->pev->origin.z ) > 256.0f )
{
// don't try to spit at someone up really high or down really low.
return FALSE;
@ -336,12 +336,12 @@ BOOL CBullsquid::CheckRangeAttack1( float flDot, float flDist )
if( IsMoving() )
{
// don't spit again for a long time, resume chasing enemy.
m_flNextSpitTime = gpGlobals->time + 5;
m_flNextSpitTime = gpGlobals->time + 5.0f;
}
else
{
// not moving, so spit again pretty soon.
m_flNextSpitTime = gpGlobals->time + 0.5;
m_flNextSpitTime = gpGlobals->time + 0.5f;
}
return TRUE;
@ -356,7 +356,7 @@ BOOL CBullsquid::CheckRangeAttack1( float flDot, float flDist )
//=========================================================
BOOL CBullsquid::CheckMeleeAttack1( float flDot, float flDist )
{
if( m_hEnemy->pev->health <= gSkillData.bullsquidDmgWhip && flDist <= 85 && flDot >= 0.7 )
if( m_hEnemy->pev->health <= gSkillData.bullsquidDmgWhip && flDist <= 85.0f && flDot >= 0.7f )
{
return TRUE;
}
@ -371,7 +371,7 @@ BOOL CBullsquid::CheckMeleeAttack1( float flDot, float flDist )
//=========================================================
BOOL CBullsquid::CheckMeleeAttack2( float flDot, float flDist )
{
if( flDist <= 85 && flDot >= 0.7 && !HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) ) // The player & bullsquid can be as much as their bboxes
if( flDist <= 85.0f && flDot >= 0.7f && !HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) ) // The player & bullsquid can be as much as their bboxes
{ // apart (48 * sqrt(3)) and he can still attack (85 is a little more than 48*sqrt(3))
return TRUE;
}
@ -504,7 +504,7 @@ void CBullsquid::SetYawSpeed( void )
ys = 0;
switch ( m_Activity )
switch( m_Activity )
{
case ACT_WALK:
ys = 90;
@ -543,13 +543,13 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
// !!!HACKHACK - the spot at which the spit originates (in front of the mouth) was measured in 3ds and hardcoded here.
// we should be able to read the position of bones at runtime for this info.
vecSpitOffset = ( gpGlobals->v_right * 8 + gpGlobals->v_forward * 37 + gpGlobals->v_up * 23 );
vecSpitOffset = ( gpGlobals->v_right * 8.0f + gpGlobals->v_forward * 37.0f + gpGlobals->v_up * 23.0f );
vecSpitOffset = ( pev->origin + vecSpitOffset );
vecSpitDir = ( ( m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs ) - vecSpitOffset ).Normalize();
vecSpitDir.x += RANDOM_FLOAT( -0.05, 0.05 );
vecSpitDir.y += RANDOM_FLOAT( -0.05, 0.05 );
vecSpitDir.z += RANDOM_FLOAT( -0.05, 0 );
vecSpitDir.x += RANDOM_FLOAT( -0.05f, 0.05f );
vecSpitDir.y += RANDOM_FLOAT( -0.05f, 0.05f );
vecSpitDir.z += RANDOM_FLOAT( -0.05f, 0.0f );
// do stuff for this event.
AttackSound();
@ -569,7 +569,7 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
WRITE_BYTE( 25 ); // noise ( client will divide by 100 )
MESSAGE_END();
CSquidSpit::Shoot( pev, vecSpitOffset, vecSpitDir * 900 );
CSquidSpit::Shoot( pev, vecSpitOffset, vecSpitDir * 900.0f );
}
break;
case BSQUID_AE_BITE:
@ -579,10 +579,10 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
if( pHurt )
{
//pHurt->pev->punchangle.z = -15;
//pHurt->pev->punchangle.x = -45;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_forward * 100;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100;
//pHurt->pev->punchangle.z = -15.0f;
//pHurt->pev->punchangle.x = -45.0f;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_forward * 100.0f;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100.0f;
}
}
break;
@ -592,10 +592,10 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
if( pHurt )
{
pHurt->pev->punchangle.z = -20;
pHurt->pev->punchangle.x = 20;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 200;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100;
pHurt->pev->punchangle.z = -20.0f;
pHurt->pev->punchangle.x = 20.0f;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_right * 200.0f;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 100.0f;
}
}
break;
@ -616,8 +616,8 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
}
// jump into air for 0.8 (24/30) seconds
//pev->velocity.z += ( 0.875 * flGravity ) * 0.5;
pev->velocity.z += ( 0.625 * flGravity ) * 0.5;
//pev->velocity.z += ( 0.875f * flGravity ) * 0.5f;
pev->velocity.z += ( 0.625f * flGravity ) * 0.5f;
}
break;
case BSQUID_AE_THROW:
@ -630,14 +630,14 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
if( pHurt )
{
// croonchy bite sound
iPitch = RANDOM_FLOAT( 90, 110 );
iPitch = RANDOM_FLOAT( 90.0f, 110.0f );
switch( RANDOM_LONG( 0, 1 ) )
{
case 0:
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "bullchicken/bc_bite2.wav", 1, ATTN_NORM, 0, iPitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "bullchicken/bc_bite2.wav", 1.0f, ATTN_NORM, 0, iPitch );
break;
case 1:
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "bullchicken/bc_bite3.wav", 1, ATTN_NORM, 0, iPitch );
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "bullchicken/bc_bite3.wav", 1.0f, ATTN_NORM, 0, iPitch );
break;
}
@ -646,12 +646,12 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
//pHurt->pev->punchangle.y = RANDOM_LONG( 0, 89 ) - 45;
// screeshake transforms the viewmodel as well as the viewangle. No problems with seeing the ends of the viewmodels.
UTIL_ScreenShake( pHurt->pev->origin, 25.0, 1.5, 0.7, 2 );
UTIL_ScreenShake( pHurt->pev->origin, 25.0f, 1.5f, 0.7f, 2.0f );
if( pHurt->IsPlayer() )
{
UTIL_MakeVectors( pev->angles );
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 300 + gpGlobals->v_up * 300;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_forward * 300.0f + gpGlobals->v_up * 300.0f;
}
}
}
@ -669,14 +669,14 @@ void CBullsquid::Spawn()
Precache();
SET_MODEL( ENT( pev ), "models/bullsquid.mdl" );
UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) );
UTIL_SetSize( pev, Vector( -32.0f, -32.0f, 0.0f ), Vector( 32.0f, 32.0f, 64.0f ) );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_GREEN;
pev->effects = 0;
pev->health = gSkillData.bullsquidHealth;
m_flFieldOfView = 0.2;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_flFieldOfView = 0.2f;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
m_fCanThreatDisplay = TRUE;
@ -789,7 +789,7 @@ void CBullsquid::RunAI( void )
// chasing enemy. Sprint for last bit
if( ( pev->origin - m_hEnemy->pev->origin).Length2D() < SQUID_SPRINT_DIST )
{
pev->framerate = 1.25;
pev->framerate = 1.25f;
}
}
}
@ -802,8 +802,8 @@ void CBullsquid::RunAI( void )
Task_t tlSquidRangeAttack1[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_RANGE_ATTACK1, (float)0 },
{ TASK_FACE_IDEAL, 0.0f },
{ TASK_RANGE_ATTACK1, 0.0f },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
};
@ -826,9 +826,9 @@ Schedule_t slSquidRangeAttack1[] =
Task_t tlSquidChaseEnemy1[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_RANGE_ATTACK1 },// !!!OEM - this will stop nasty squid oscillation.
{ TASK_GET_PATH_TO_ENEMY, (float)0 },
{ TASK_RUN_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_GET_PATH_TO_ENEMY, 0.0f },
{ TASK_RUN_PATH, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
};
Schedule_t slSquidChaseEnemy[] =
@ -852,10 +852,10 @@ Schedule_t slSquidChaseEnemy[] =
Task_t tlSquidHurtHop[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_SOUND_WAKE, (float)0 },
{ TASK_SQUID_HOPTURN, (float)0 },
{ TASK_FACE_ENEMY, (float)0 },// in case squid didn't turn all the way in the air.
{ TASK_STOP_MOVING, 0.0f },
{ TASK_SOUND_WAKE, 0.0f },
{ TASK_SQUID_HOPTURN, 0.0f },
{ TASK_FACE_ENEMY, 0.0f },// in case squid didn't turn all the way in the air.
};
Schedule_t slSquidHurtHop[] =
@ -871,10 +871,10 @@ Schedule_t slSquidHurtHop[] =
Task_t tlSquidSeeCrab[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_SOUND_WAKE, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_SOUND_WAKE, 0.0f },
{ TASK_PLAY_SEQUENCE, (float)ACT_EXCITED },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_FACE_ENEMY, 0.0f },
};
Schedule_t slSquidSeeCrab[] =
@ -892,20 +892,20 @@ Schedule_t slSquidSeeCrab[] =
// squid walks to something tasty and eats it.
Task_t tlSquidEat[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_EAT, (float)10 },// this is in case the squid can't get to the food
{ TASK_STORE_LASTPOSITION, (float)0 },
{ TASK_GET_PATH_TO_BESTSCENT, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_EAT, 10.0f },// this is in case the squid can't get to the food
{ TASK_STORE_LASTPOSITION, 0.0f },
{ TASK_GET_PATH_TO_BESTSCENT, 0.0f },
{ TASK_WALK_PATH, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_PLAY_SEQUENCE, (float)ACT_EAT },
{ TASK_PLAY_SEQUENCE, (float)ACT_EAT },
{ TASK_PLAY_SEQUENCE, (float)ACT_EAT },
{ TASK_EAT, (float)50 },
{ TASK_GET_PATH_TO_LASTPOSITION, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_CLEAR_LASTPOSITION, (float)0 },
{ TASK_EAT, 50.0f },
{ TASK_GET_PATH_TO_LASTPOSITION, 0.0f },
{ TASK_WALK_PATH, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_CLEAR_LASTPOSITION, 0.0f },
};
Schedule_t slSquidEat[] =
@ -928,21 +928,21 @@ Schedule_t slSquidEat[] =
// the squid. This schedule plays a sniff animation before going to the source of food.
Task_t tlSquidSniffAndEat[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_EAT, (float)10 },// this is in case the squid can't get to the food
{ TASK_STOP_MOVING, 0.0f },
{ TASK_EAT, 10.0f },// this is in case the squid can't get to the food
{ TASK_PLAY_SEQUENCE, (float)ACT_DETECT_SCENT },
{ TASK_STORE_LASTPOSITION, (float)0 },
{ TASK_GET_PATH_TO_BESTSCENT, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_STORE_LASTPOSITION, 0.0f },
{ TASK_GET_PATH_TO_BESTSCENT, 0.0f },
{ TASK_WALK_PATH, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_PLAY_SEQUENCE, (float)ACT_EAT },
{ TASK_PLAY_SEQUENCE, (float)ACT_EAT },
{ TASK_PLAY_SEQUENCE, (float)ACT_EAT },
{ TASK_EAT, (float)50 },
{ TASK_GET_PATH_TO_LASTPOSITION, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_CLEAR_LASTPOSITION, (float)0 },
{ TASK_EAT, 50.0f },
{ TASK_GET_PATH_TO_LASTPOSITION, 0.0f },
{ TASK_WALK_PATH, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_CLEAR_LASTPOSITION, 0.0f },
};
Schedule_t slSquidSniffAndEat[] =
@ -964,18 +964,18 @@ Schedule_t slSquidSniffAndEat[] =
// squid does this to stinky things.
Task_t tlSquidWallow[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_EAT, (float)10 },// this is in case the squid can't get to the stinkiness
{ TASK_STORE_LASTPOSITION, (float)0 },
{ TASK_GET_PATH_TO_BESTSCENT, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_EAT, 10.0f },// this is in case the squid can't get to the stinkiness
{ TASK_STORE_LASTPOSITION, 0.0f },
{ TASK_GET_PATH_TO_BESTSCENT, 0.0f },
{ TASK_WALK_PATH, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_PLAY_SEQUENCE, (float)ACT_INSPECT_FLOOR },
{ TASK_EAT, (float)50 },// keeps squid from eating or sniffing anything else for a while.
{ TASK_GET_PATH_TO_LASTPOSITION, (float)0 },
{ TASK_WALK_PATH, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_CLEAR_LASTPOSITION, (float)0 },
{ TASK_EAT, 50.0f },// keeps squid from eating or sniffing anything else for a while.
{ TASK_GET_PATH_TO_LASTPOSITION, 0.0f },
{ TASK_WALK_PATH, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_CLEAR_LASTPOSITION, 0.0f },
};
Schedule_t slSquidWallow[] =

View File

@ -163,7 +163,7 @@ void CMultiSource::Spawn()
pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_NONE;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->spawnflags |= SF_MULTI_INIT; // Until it's initialized
SetThink( &CMultiSource::Register );
}
@ -476,7 +476,7 @@ void CBaseButton::Spawn()
if( FBitSet( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF ) )// this button should spark in OFF state
{
SetThink( &CBaseButton::ButtonSpark );
pev->nextthink = gpGlobals->time + 0.5;// no hurry, make sure everything else spawns
pev->nextthink = gpGlobals->time + 0.5f;// no hurry, make sure everything else spawns
}
SetMovedir( pev );
@ -485,29 +485,29 @@ void CBaseButton::Spawn()
pev->solid = SOLID_BSP;
SET_MODEL( ENT( pev ), STRING( pev->model ) );
if( pev->speed == 0 )
pev->speed = 40;
if( pev->speed == 0.0f )
pev->speed = 40.0f;
if( pev->health > 0 )
{
pev->takedamage = DAMAGE_YES;
}
if( m_flWait == 0 )
m_flWait = 1;
if( m_flLip == 0 )
m_flLip = 4;
if( m_flWait == 0.0f )
m_flWait = 1.0f;
if( m_flLip == 0.0f )
m_flLip = 4.0f;
m_toggle_state = TS_AT_BOTTOM;
m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
m_vecPosition2 = m_vecPosition1 + ( pev->movedir * ( fabs( pev->movedir.x * ( pev->size.x - 2 ) ) + fabs( pev->movedir.y * ( pev->size.y - 2 ) ) + fabs( pev->movedir.z * ( pev->size.z - 2 ) ) - m_flLip ) );
m_vecPosition2 = m_vecPosition1 + ( pev->movedir * ( fabs( pev->movedir.x * ( pev->size.x - 2.0f ) ) + fabs( pev->movedir.y * ( pev->size.y - 2.0f ) ) + fabs( pev->movedir.z * ( pev->size.z - 2.0f ) ) - m_flLip ) );
// Is this a non-moving button?
if( ( ( m_vecPosition2 - m_vecPosition1 ).Length() < 1 ) || ( pev->spawnflags & SF_BUTTON_DONTMOVE ) )
if( ( ( m_vecPosition2 - m_vecPosition1 ).Length() < 1.0f ) || ( pev->spawnflags & SF_BUTTON_DONTMOVE ) )
m_vecPosition2 = m_vecPosition1;
m_fStayPushed = m_flWait == -1 ? TRUE : FALSE;
m_fStayPushed = m_flWait == -1.0f ? TRUE : FALSE;
m_fRotating = FALSE;
// if the button is flagged for USE button activation only, take away it's touch function and add a use function
@ -607,11 +607,11 @@ const char *ButtonSound( int sound )
//
void DoSpark( entvars_t *pev, const Vector &location )
{
Vector tmp = location + pev->size * 0.5;
Vector tmp = location + pev->size * 0.5f;
UTIL_Sparks( tmp );
float flVolume = RANDOM_FLOAT( 0.25 , 0.75 ) * 0.4;//random volume range
switch( (int)( RANDOM_FLOAT( 0, 1 ) * 6 ) )
float flVolume = RANDOM_FLOAT( 0.25f, 0.75f ) * 0.4f;//random volume range
switch( (int)( RANDOM_FLOAT( 0.0f, 1.0f ) * 6.0f ) )
{
case 0:
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "buttons/spark1.wav", flVolume, ATTN_NORM );
@ -637,7 +637,7 @@ void DoSpark( entvars_t *pev, const Vector &location )
void CBaseButton::ButtonSpark( void )
{
SetThink( &CBaseButton::ButtonSpark );
pev->nextthink = gpGlobals->time + 0.1 + RANDOM_FLOAT( 0, 1.5 );// spark again at random interval
pev->nextthink = gpGlobals->time + 0.1f + RANDOM_FLOAT( 0.0f, 1.5f );// spark again at random interval
DoSpark( pev, pev->mins );
}
@ -657,7 +657,7 @@ void CBaseButton::ButtonUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
{
if( !m_fStayPushed && FBitSet( pev->spawnflags, SF_BUTTON_TOGGLE ) )
{
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noise ), 1.0f, ATTN_NORM );
//SUB_UseTargets( m_eoActivator );
ButtonReturn();
@ -852,7 +852,7 @@ void CBaseButton::ButtonBackHome( void )
if( FBitSet( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF ) )
{
SetThink( &CBaseButton::ButtonSpark );
pev->nextthink = gpGlobals->time + 0.5;// no hurry.
pev->nextthink = gpGlobals->time + 0.5f;// no hurry.
}
}
@ -883,7 +883,7 @@ void CRotButton::Spawn( void )
// check for clockwise rotation
if( FBitSet( pev->spawnflags, SF_DOOR_ROTATE_BACKWARDS ) )
pev->movedir = pev->movedir * -1;
pev->movedir = pev->movedir * -1.0f;
pev->movetype = MOVETYPE_PUSH;
@ -894,8 +894,8 @@ void CRotButton::Spawn( void )
SET_MODEL( ENT( pev ), STRING( pev->model ) );
if( pev->speed == 0 )
pev->speed = 40;
if( pev->speed == 0.0f )
pev->speed = 40.0f;
if( m_flWait == 0 )
m_flWait = 1;
@ -910,7 +910,7 @@ void CRotButton::Spawn( void )
m_vecAngle2 = pev->angles + pev->movedir * m_flMoveDistance;
ASSERTSZ( m_vecAngle1 != m_vecAngle2, "rotating button start/end positions are equal" );
m_fStayPushed = m_flWait == -1 ? TRUE : FALSE;
m_fStayPushed = m_flWait == -1.0f ? TRUE : FALSE;
m_fRotating = TRUE;
// if the button is flagged for USE button activation only, take away it's touch function and add a use function
@ -984,10 +984,10 @@ void CMomentaryRotButton::Spawn( void )
{
CBaseToggle::AxisDir( pev );
if( pev->speed == 0 )
pev->speed = 100;
if( pev->speed == 0.0f )
pev->speed = 100.0f;
if( m_flMoveDistance < 0 )
if( m_flMoveDistance < 0.0f )
{
m_start = pev->angles + pev->movedir * m_flMoveDistance;
m_end = pev->angles;
@ -1087,14 +1087,14 @@ void CMomentaryRotButton::UpdateSelf( float value )
}
m_lastUsed = 1;
pev->nextthink = pev->ltime + 0.1;
if( m_direction > 0 && value >= 1.0 )
pev->nextthink = pev->ltime + 0.1f;
if( m_direction > 0 && value >= 1.0f )
{
pev->avelocity = g_vecZero;
pev->angles = m_end;
return;
}
else if( m_direction < 0 && value <= 0 )
else if( m_direction < 0 && value <= 0.0f )
{
pev->avelocity = g_vecZero;
pev->angles = m_start;
@ -1106,9 +1106,9 @@ void CMomentaryRotButton::UpdateSelf( float value )
// HACKHACK -- If we're going slow, we'll get multiple player packets per frame, bump nexthink on each one to avoid stalling
if( pev->nextthink < pev->ltime )
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
else
pev->nextthink += 0.1;
pev->nextthink += 0.1f;
pev->avelocity = m_direction * pev->speed * pev->movedir;
SetThink( &CMomentaryRotButton::Off );
@ -1140,7 +1140,7 @@ void CMomentaryRotButton::Off( void )
if( FBitSet( pev->spawnflags, SF_PENDULUM_AUTO_RETURN ) && m_returnSpeed > 0 )
{
SetThink( &CMomentaryRotButton::Return );
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
m_direction = -1;
}
else
@ -1152,23 +1152,23 @@ void CMomentaryRotButton::Return( void )
float value = CBaseToggle::AxisDelta( pev->spawnflags, pev->angles, m_start ) / m_flMoveDistance;
UpdateAllButtons( value, 0 ); // This will end up calling UpdateSelfReturn() n times, but it still works right
if( value > 0 )
if( value > 0.0f )
UpdateTarget( value );
}
void CMomentaryRotButton::UpdateSelfReturn( float value )
{
if( value <= 0 )
if( value <= 0.0f )
{
pev->avelocity = g_vecZero;
pev->angles = m_start;
pev->nextthink = -1;
pev->nextthink = -1.0f;
SetThink( NULL );
}
else
{
pev->avelocity = -m_returnSpeed * pev->movedir;
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
}
}
@ -1221,10 +1221,10 @@ void CEnvSpark::Spawn( void )
else
SetThink( &CEnvSpark::SparkThink );
pev->nextthink = gpGlobals->time + 0.1 + RANDOM_FLOAT( 0, 1.5 );
pev->nextthink = gpGlobals->time + 0.1f + RANDOM_FLOAT( 0.0f, 1.5f );
if( m_flDelay <= 0 )
m_flDelay = 1.5;
if( m_flDelay <= 0.0f )
m_flDelay = 1.5f;
Precache();
}
@ -1259,7 +1259,7 @@ void CEnvSpark::KeyValue( KeyValueData *pkvd )
void EXPORT CEnvSpark::SparkThink( void )
{
pev->nextthink = gpGlobals->time + 0.1 + RANDOM_FLOAT( 0, m_flDelay );
pev->nextthink = gpGlobals->time + 0.1f + RANDOM_FLOAT( 0.0f, m_flDelay );
DoSpark( pev, pev->origin );
}
@ -1267,7 +1267,7 @@ void EXPORT CEnvSpark::SparkStart( CBaseEntity *pActivator, CBaseEntity *pCaller
{
SetUse( &CEnvSpark::SparkStop );
SetThink( &CEnvSpark::SparkThink );
pev->nextthink = gpGlobals->time + 0.1 + RANDOM_FLOAT( 0, m_flDelay );
pev->nextthink = gpGlobals->time + 0.1f + RANDOM_FLOAT( 0.0f, m_flDelay );
}
void EXPORT CEnvSpark::SparkStop( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
@ -1305,7 +1305,7 @@ void CButtonTarget::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
{
if( !ShouldToggle( useType, (int)pev->frame ) )
return;
pev->frame = 1-pev->frame;
pev->frame = 1 - pev->frame;
if( pev->frame )
SUB_UseTargets( pActivator, USE_ON, 0 );
else

View File

@ -136,8 +136,8 @@ int DispatchSpawn( edict_t *pent )
if( pEntity )
{
// Initialize these or entities who don't link to the world won't have anything in here
pEntity->pev->absmin = pEntity->pev->origin - Vector( 1, 1, 1 );
pEntity->pev->absmax = pEntity->pev->origin + Vector( 1, 1, 1 );
pEntity->pev->absmin = pEntity->pev->origin - Vector( 1.0f, 1.0f, 1.0f );
pEntity->pev->absmax = pEntity->pev->origin + Vector( 1.0f, 1.0f, 1.0f );
pEntity->Spawn();
@ -533,13 +533,13 @@ int CBaseEntity::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
// figure momentum add (don't let hurt brushes or other triggers move player)
if( ( !FNullEnt( pevInflictor ) ) && (pev->movetype == MOVETYPE_WALK || pev->movetype == MOVETYPE_STEP ) && ( pevAttacker->solid != SOLID_TRIGGER ) )
{
Vector vecDir = pev->origin - ( pevInflictor->absmin + pevInflictor->absmax ) * 0.5;
Vector vecDir = pev->origin - ( pevInflictor->absmin + pevInflictor->absmax ) * 0.5f;
vecDir = vecDir.Normalize();
float flForce = flDamage * ( ( 32 * 32 * 72.0 ) / ( pev->size.x * pev->size.y * pev->size.z ) ) * 5;
float flForce = flDamage * ( ( 32.0f * 32.0f * 72.0f ) / ( pev->size.x * pev->size.y * pev->size.z ) ) * 5.0f;
if( flForce > 1000.0 )
flForce = 1000.0;
if( flForce > 1000.0f )
flForce = 1000.0f;
pev->velocity = pev->velocity + vecDir * flForce;
}
@ -681,7 +681,7 @@ void CBaseEntity::MakeDormant( void )
// Don't draw
SetBits( pev->effects, EF_NODRAW );
// Don't think
pev->nextthink = 0;
pev->nextthink = 0.0f;
// Relink
UTIL_SetOrigin( pev, pev->origin );
}
@ -694,30 +694,30 @@ int CBaseEntity::IsDormant( void )
BOOL CBaseEntity::IsInWorld( void )
{
// position
if( pev->origin.x >= 4096 )
if( pev->origin.x >= 4096.0f )
return FALSE;
if( pev->origin.y >= 4096 )
if( pev->origin.y >= 4096.0f )
return FALSE;
if( pev->origin.z >= 4096 )
if( pev->origin.z >= 4096.0f )
return FALSE;
if( pev->origin.x <= -4096 )
if( pev->origin.x <= -4096.0f )
return FALSE;
if( pev->origin.y <= -4096 )
if( pev->origin.y <= -4096.0f )
return FALSE;
if( pev->origin.z <= -4096 )
if( pev->origin.z <= -4096.0f )
return FALSE;
// speed
if( pev->velocity.x >= 2000 )
if( pev->velocity.x >= 2000.0f )
return FALSE;
if( pev->velocity.y >= 2000 )
if( pev->velocity.y >= 2000.0f )
return FALSE;
if( pev->velocity.z >= 2000 )
if( pev->velocity.z >= 2000.0f )
return FALSE;
if( pev->velocity.x <= -2000 )
if( pev->velocity.x <= -2000.0f )
return FALSE;
if( pev->velocity.y <= -2000 )
if( pev->velocity.y <= -2000.0f )
return FALSE;
if( pev->velocity.z <= -2000 )
if( pev->velocity.z <= -2000.0f )
return FALSE;
return TRUE;

View File

@ -73,7 +73,7 @@ void set_suicide_frame( entvars_t *pev )
pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_TOSS;
pev->deadflag = DEAD_DEAD;
pev->nextthink = -1;
pev->nextthink = -1.0f;
}
@ -170,7 +170,7 @@ void ClientKill( edict_t *pEntity )
if( pl->m_fNextSuicideTime > gpGlobals->time )
return; // prevent suiciding too ofter
pl->m_fNextSuicideTime = gpGlobals->time + 1; // don't let them suicide for 5 seconds after suiciding
pl->m_fNextSuicideTime = gpGlobals->time + 1.0f; // don't let them suicide for 5 seconds after suiciding
// have the player kill themself
pev->health = 0;
@ -495,7 +495,7 @@ void ClientCommand( edict_t *pEntity )
}
else if( FStrEq(pcmd, "give" ) )
{
if( g_flWeaponCheat != 0.0 )
if( g_flWeaponCheat != 0.0f )
{
int iszItem = ALLOC_STRING( CMD_ARGV( 1 ) ); // Make a copy of the classname
GetClassPtr( (CBasePlayer *)pev )->GiveNamedItem( STRING( iszItem ) );
@ -503,7 +503,7 @@ void ClientCommand( edict_t *pEntity )
}
else if( FStrEq( pcmd, "fire" ) )
{
if( g_flWeaponCheat != 0.0 )
if( g_flWeaponCheat != 0.0f )
{
CBaseEntity *pPlayer = CBaseEntity::Instance( pEntity );
if( CMD_ARGC() > 1 )
@ -1204,7 +1204,7 @@ int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *h
//
// Round animtime to nearest millisecond
state->animtime = (int)( 1000.0 * ent->v.animtime ) / 1000.0;
state->animtime = (int)( 1000.0f * ent->v.animtime ) / 1000.0f;
memcpy( state->origin, ent->v.origin, 3 * sizeof(float) );
memcpy( state->angles, ent->v.angles, 3 * sizeof(float) );
@ -1662,12 +1662,12 @@ int GetWeaponData( struct edict_s *player, struct weapon_data_s *info )
item->m_iId = II.iId;
item->m_iClip = gun->m_iClip;
item->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle, -0.001 );
item->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack, -0.001 );
item->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack, -0.001 );
item->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle, -0.001f );
item->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack, -0.001f );
item->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack, -0.001f );
item->m_fInReload = gun->m_fInReload;
item->m_fInSpecialReload = gun->m_fInSpecialReload;
item->fuser1 = Q_max( gun->pev->fuser1, -0.001 );
item->fuser1 = Q_max( gun->pev->fuser1, -0.001f );
item->fuser2 = gun->m_flStartThrow;
item->fuser3 = gun->m_flReleaseThrow;
item->iuser1 = gun->m_chargeReady;
@ -1932,7 +1932,7 @@ One of the ENGINE_FORCE_UNMODIFIED files failed the consistency check for the sp
int InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message )
{
// Server doesn't care?
if( CVAR_GET_FLOAT( "mp_consistency" ) != 1 )
if( CVAR_GET_FLOAT( "mp_consistency" ) != 1.0f )
return 0;
// Default behavior is to kick the player

View File

@ -48,8 +48,8 @@ void CGib::LimitVelocity( void )
// ceiling at 1500. The gib velocity equation is not bounded properly. Rather than tune it
// in 3 separate places again, I'll just limit it here.
if( length > 1500.0 )
pev->velocity = pev->velocity.Normalize() * 1500; // This should really be sv_maxvelocity * 0.75 or something
if( length > 1500.0f )
pev->velocity = pev->velocity.Normalize() * 1500.0f; // This should really be sv_maxvelocity * 0.75 or something
}
@ -72,9 +72,9 @@ void CGib::SpawnStickyGibs( entvars_t *pevVictim, Vector vecOrigin, int cGibs )
if( pevVictim )
{
pGib->pev->origin.x = vecOrigin.x + RANDOM_FLOAT( -3, 3 );
pGib->pev->origin.y = vecOrigin.y + RANDOM_FLOAT( -3, 3 );
pGib->pev->origin.z = vecOrigin.z + RANDOM_FLOAT( -3, 3 );
pGib->pev->origin.x = vecOrigin.x + RANDOM_FLOAT( -3.0f, 3.0f );
pGib->pev->origin.y = vecOrigin.y + RANDOM_FLOAT( -3.0f, 3.0f );
pGib->pev->origin.z = vecOrigin.z + RANDOM_FLOAT( -3.0f, 3.0f );
/*
pGib->pev->origin.x = pevVictim->absmin.x + pevVictim->size.x * ( RANDOM_FLOAT( 0, 1 ) );
@ -83,32 +83,32 @@ void CGib::SpawnStickyGibs( entvars_t *pevVictim, Vector vecOrigin, int cGibs )
*/
// make the gib fly away from the attack vector
pGib->pev->velocity = g_vecAttackDir * -1;
pGib->pev->velocity = g_vecAttackDir * -1.0f;
// mix in some noise
pGib->pev->velocity.x += RANDOM_FLOAT( -0.15, 0.15 );
pGib->pev->velocity.y += RANDOM_FLOAT( -0.15, 0.15 );
pGib->pev->velocity.z += RANDOM_FLOAT( -0.15, 0.15 );
pGib->pev->velocity.x += RANDOM_FLOAT( -0.15f, 0.15f );
pGib->pev->velocity.y += RANDOM_FLOAT( -0.15f, 0.15f );
pGib->pev->velocity.z += RANDOM_FLOAT( -0.15f, 0.15f );
pGib->pev->velocity = pGib->pev->velocity * 900;
pGib->pev->velocity = pGib->pev->velocity * 900.0f;
pGib->pev->avelocity.x = RANDOM_FLOAT( 250, 400 );
pGib->pev->avelocity.y = RANDOM_FLOAT( 250, 400 );
pGib->pev->avelocity.x = RANDOM_FLOAT( 250.0f, 400.0f );
pGib->pev->avelocity.y = RANDOM_FLOAT( 250.0f, 400.0f );
// copy owner's blood color
pGib->m_bloodColor = ( CBaseEntity::Instance( pevVictim ) )->BloodColor();
if( pevVictim->health > -50 )
{
pGib->pev->velocity = pGib->pev->velocity * 0.7;
pGib->pev->velocity = pGib->pev->velocity * 0.7f;
}
else if( pevVictim->health > -200 )
{
pGib->pev->velocity = pGib->pev->velocity * 2;
pGib->pev->velocity = pGib->pev->velocity * 2.0f;
}
else
{
pGib->pev->velocity = pGib->pev->velocity * 4;
pGib->pev->velocity = pGib->pev->velocity * 4.0f;
}
pGib->pev->movetype = MOVETYPE_TOSS;
@ -148,31 +148,31 @@ void CGib::SpawnHeadGib( entvars_t *pevVictim )
entvars_t *pevPlayer;
pevPlayer = VARS( pentPlayer );
pGib->pev->velocity = ( ( pevPlayer->origin + pevPlayer->view_ofs ) - pGib->pev->origin ).Normalize() * 300;
pGib->pev->velocity.z += 100;
pGib->pev->velocity = ( ( pevPlayer->origin + pevPlayer->view_ofs ) - pGib->pev->origin ).Normalize() * 300.0f;
pGib->pev->velocity.z += 100.0f;
}
else
{
pGib->pev->velocity = Vector( RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( 200, 300 ) );
pGib->pev->velocity = Vector( RANDOM_FLOAT( -100.0f, 100.0f ), RANDOM_FLOAT( -100.0f, 100.0f ), RANDOM_FLOAT( 200.0f, 300.0f ) );
}
pGib->pev->avelocity.x = RANDOM_FLOAT( 100, 200 );
pGib->pev->avelocity.y = RANDOM_FLOAT( 100, 300 );
pGib->pev->avelocity.x = RANDOM_FLOAT( 100.0f, 200.0f );
pGib->pev->avelocity.y = RANDOM_FLOAT( 100.0f, 300.0f );
// copy owner's blood color
pGib->m_bloodColor = ( CBaseEntity::Instance( pevVictim ) )->BloodColor();
if( pevVictim->health > -50 )
{
pGib->pev->velocity = pGib->pev->velocity * 0.7;
pGib->pev->velocity = pGib->pev->velocity * 0.7f;
}
else if( pevVictim->health > -200 )
{
pGib->pev->velocity = pGib->pev->velocity * 2;
pGib->pev->velocity = pGib->pev->velocity * 2.0f;
}
else
{
pGib->pev->velocity = pGib->pev->velocity * 4;
pGib->pev->velocity = pGib->pev->velocity * 4.0f;
}
}
pGib->LimitVelocity();
@ -210,37 +210,37 @@ void CGib::SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int human )
if( pevVictim )
{
// spawn the gib somewhere in the monster's bounding volume
pGib->pev->origin.x = pevVictim->absmin.x + pevVictim->size.x * (RANDOM_FLOAT ( 0 , 1 ) );
pGib->pev->origin.y = pevVictim->absmin.y + pevVictim->size.y * (RANDOM_FLOAT ( 0 , 1 ) );
pGib->pev->origin.z = pevVictim->absmin.z + pevVictim->size.z * (RANDOM_FLOAT ( 0 , 1 ) ) + 1; // absmin.z is in the floor because the engine subtracts 1 to enlarge the box
pGib->pev->origin.x = pevVictim->absmin.x + pevVictim->size.x * ( RANDOM_FLOAT( 0.0f, 1.0f ) );
pGib->pev->origin.y = pevVictim->absmin.y + pevVictim->size.y * ( RANDOM_FLOAT( 0.0f, 1.0f ) );
pGib->pev->origin.z = pevVictim->absmin.z + pevVictim->size.z * ( RANDOM_FLOAT( 0.0f, 1.0f ) ) + 1.0f; // absmin.z is in the floor because the engine subtracts 1 to enlarge the box
// make the gib fly away from the attack vector
pGib->pev->velocity = g_vecAttackDir * -1;
pGib->pev->velocity = g_vecAttackDir * -1.0f;
// mix in some noise
pGib->pev->velocity.x += RANDOM_FLOAT( -0.25, 0.25 );
pGib->pev->velocity.y += RANDOM_FLOAT( -0.25, 0.25 );
pGib->pev->velocity.z += RANDOM_FLOAT( -0.25, 0.25 );
pGib->pev->velocity.x += RANDOM_FLOAT( -0.25f, 0.25f );
pGib->pev->velocity.y += RANDOM_FLOAT( -0.25f, 0.25f );
pGib->pev->velocity.z += RANDOM_FLOAT( -0.25f, 0.25f );
pGib->pev->velocity = pGib->pev->velocity * RANDOM_FLOAT( 300, 400 );
pGib->pev->velocity = pGib->pev->velocity * RANDOM_FLOAT( 300.0f, 400.0f );
pGib->pev->avelocity.x = RANDOM_FLOAT( 100, 200 );
pGib->pev->avelocity.y = RANDOM_FLOAT( 100, 300 );
pGib->pev->avelocity.x = RANDOM_FLOAT( 100.0f, 200.0f );
pGib->pev->avelocity.y = RANDOM_FLOAT( 100.0f, 300.0f );
// copy owner's blood color
pGib->m_bloodColor = ( CBaseEntity::Instance( pevVictim ) )->BloodColor();
if( pevVictim->health > -50 )
{
pGib->pev->velocity = pGib->pev->velocity * 0.7;
pGib->pev->velocity = pGib->pev->velocity * 0.7f;
}
else if( pevVictim->health > -200 )
{
pGib->pev->velocity = pGib->pev->velocity * 2;
pGib->pev->velocity = pGib->pev->velocity * 2.0f;
}
else
{
pGib->pev->velocity = pGib->pev->velocity * 4;
pGib->pev->velocity = pGib->pev->velocity * 4.0f;
}
pGib->pev->solid = SOLID_BBOX;
@ -360,7 +360,7 @@ Activity CBaseMonster::GetDeathActivity( void )
deathActivity = ACT_DIESIMPLE;// in case we can't find any special deaths to do.
UTIL_MakeVectors( pev->angles );
flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1 );
flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1.0f );
switch( m_LastHitGroup )
{
@ -374,11 +374,11 @@ Activity CBaseMonster::GetDeathActivity( void )
case HITGROUP_GENERIC:
// try to pick a death based on attack direction
fTriedDirection = TRUE;
if( flDot > 0.3 )
if( flDot > 0.3f )
{
deathActivity = ACT_DIEFORWARD;
}
else if( flDot <= -0.3 )
else if( flDot <= -0.3f )
{
deathActivity = ACT_DIEBACKWARD;
}
@ -387,11 +387,11 @@ Activity CBaseMonster::GetDeathActivity( void )
// try to pick a death based on attack direction
fTriedDirection = TRUE;
if( flDot > 0.3 )
if( flDot > 0.3f )
{
deathActivity = ACT_DIEFORWARD;
}
else if( flDot <= -0.3 )
else if( flDot <= -0.3f )
{
deathActivity = ACT_DIEBACKWARD;
}
@ -410,11 +410,11 @@ Activity CBaseMonster::GetDeathActivity( void )
else
{
// cannot perform the ideal region-specific death, so try a direction.
if( flDot > 0.3 )
if( flDot > 0.3f )
{
deathActivity = ACT_DIEFORWARD;
}
else if( flDot <= -0.3 )
else if( flDot <= -0.3f )
{
deathActivity = ACT_DIEBACKWARD;
}
@ -430,9 +430,9 @@ Activity CBaseMonster::GetDeathActivity( void )
if( deathActivity == ACT_DIEFORWARD )
{
// make sure there's room to fall forward
UTIL_TraceHull( vecSrc, vecSrc + gpGlobals->v_forward * 64, dont_ignore_monsters, head_hull, edict(), &tr );
UTIL_TraceHull( vecSrc, vecSrc + gpGlobals->v_forward * 64.0f, dont_ignore_monsters, head_hull, edict(), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
deathActivity = ACT_DIESIMPLE;
}
@ -441,9 +441,9 @@ Activity CBaseMonster::GetDeathActivity( void )
if( deathActivity == ACT_DIEBACKWARD )
{
// make sure there's room to fall backward
UTIL_TraceHull( vecSrc, vecSrc - gpGlobals->v_forward * 64, dont_ignore_monsters, head_hull, edict(), &tr );
UTIL_TraceHull( vecSrc, vecSrc - gpGlobals->v_forward * 64.0f, dont_ignore_monsters, head_hull, edict(), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
deathActivity = ACT_DIESIMPLE;
}
@ -464,7 +464,7 @@ Activity CBaseMonster::GetSmallFlinchActivity( void )
fTriedDirection = FALSE;
UTIL_MakeVectors( pev->angles );
//flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1 );
//flDot = DotProduct( gpGlobals->v_forward, g_vecAttackDir * -1.0f );
switch( m_LastHitGroup )
{
@ -515,9 +515,9 @@ void CBaseMonster::BecomeDead( void )
// make the corpse fly away from the attack vector
pev->movetype = MOVETYPE_TOSS;
//pev->flags &= ~FL_ONGROUND;
//pev->origin.z += 2;
//pev->velocity = g_vecAttackDir * -1;
//pev->velocity = pev->velocity * RANDOM_FLOAT( 300, 400 );
//pev->origin.z += 2.0f;
//pev->velocity = g_vecAttackDir * -1.0f;
//pev->velocity = pev->velocity * RANDOM_FLOAT( 300.0f, 400.0f );
}
BOOL CBaseMonster::ShouldGibMonster( int iGib )
@ -534,12 +534,12 @@ void CBaseMonster::CallGibMonster( void )
if( HasHumanGibs() )
{
if( CVAR_GET_FLOAT( "violence_hgibs" ) == 0 )
if( CVAR_GET_FLOAT( "violence_hgibs" ) == 0.0f )
fade = TRUE;
}
else if( HasAlienGibs() )
{
if( CVAR_GET_FLOAT( "violence_agibs" ) == 0 )
if( CVAR_GET_FLOAT( "violence_agibs" ) == 0.0f )
fade = TRUE;
}
@ -639,7 +639,7 @@ void CBaseEntity::SUB_StartFadeOut( void )
pev->solid = SOLID_NOT;
pev->avelocity = g_vecZero;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
SetThink( &CBaseEntity::SUB_FadeOut );
}
@ -648,12 +648,12 @@ void CBaseEntity::SUB_FadeOut( void )
if( pev->renderamt > 7 )
{
pev->renderamt -= 7;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
else
{
pev->renderamt = 0;
pev->nextthink = gpGlobals->time + 0.2;
pev->nextthink = gpGlobals->time + 0.2f;
SetThink( &CBaseEntity::SUB_Remove );
}
}
@ -687,7 +687,7 @@ void CGib::WaitTillLand( void )
else
{
// wait and check again in another half second.
pev->nextthink = gpGlobals->time + 0.5;
pev->nextthink = gpGlobals->time + 0.5f;
}
}
@ -704,18 +704,18 @@ void CGib::BounceGibTouch( CBaseEntity *pOther )
if( pev->flags & FL_ONGROUND )
{
pev->velocity = pev->velocity * 0.9;
pev->angles.x = 0;
pev->angles.z = 0;
pev->avelocity.x = 0;
pev->avelocity.z = 0;
pev->velocity = pev->velocity * 0.9f;
pev->angles.x = 0.0f;
pev->angles.z = 0.0f;
pev->avelocity.x = 0.0f;
pev->avelocity.z = 0.0f;
}
else
{
if( g_Language != LANGUAGE_GERMAN && m_cBloodDecals > 0 && m_bloodColor != DONT_BLEED )
{
vecSpot = pev->origin + Vector( 0, 0, 8 );//move up a bit, and trace down.
UTIL_TraceLine( vecSpot, vecSpot + Vector( 0, 0, -24 ), ignore_monsters, ENT( pev ), &tr );
vecSpot = pev->origin + Vector( 0.0f, 0.0f, 8.0f );//move up a bit, and trace down.
UTIL_TraceLine( vecSpot, vecSpot + Vector( 0.0f, 0.0f, -24.0f ), ignore_monsters, ENT( pev ), &tr );
UTIL_BloodDecalTrace( &tr, m_bloodColor );
@ -727,7 +727,7 @@ void CGib::BounceGibTouch( CBaseEntity *pOther )
float volume;
float zvel = fabs( pev->velocity.z );
volume = 0.8 * Q_min( 1.0, ( (float)zvel ) / 450.0 );
volume = 0.8f * Q_min( 1.0f, zvel / 450.0f );
CBreakable::MaterialSoundRandom( edict(), (Materials)m_material, volume );
}
@ -743,7 +743,7 @@ void CGib::StickyGibTouch( CBaseEntity *pOther )
TraceResult tr;
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time + 10;
pev->nextthink = gpGlobals->time + 10.0f;
if( !FClassnameIs( pOther->pev, "worldspawn" ) )
{
@ -751,11 +751,11 @@ void CGib::StickyGibTouch( CBaseEntity *pOther )
return;
}
UTIL_TraceLine( pev->origin, pev->origin + pev->velocity * 32, ignore_monsters, ENT( pev ), &tr );
UTIL_TraceLine( pev->origin, pev->origin + pev->velocity * 32.0f, ignore_monsters, ENT( pev ), &tr );
UTIL_BloodDecalTrace( &tr, m_bloodColor );
pev->velocity = tr.vecPlaneNormal * -1;
pev->velocity = tr.vecPlaneNormal * -1.0f;
pev->angles = UTIL_VecToAngles( pev->velocity );
pev->velocity = g_vecZero;
pev->avelocity = g_vecZero;
@ -768,7 +768,7 @@ void CGib::StickyGibTouch( CBaseEntity *pOther )
void CGib::Spawn( const char *szGibModel )
{
pev->movetype = MOVETYPE_BOUNCE;
pev->friction = 0.55; // deading the bounce a bit
pev->friction = 0.55f; // deading the bounce a bit
// sometimes an entity inherits the edict from a former piece of glass,
// and will spawn using the same render FX or rendermode! bad!
@ -781,7 +781,7 @@ void CGib::Spawn( const char *szGibModel )
SET_MODEL( ENT( pev ), szGibModel );
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
pev->nextthink = gpGlobals->time + 4;
pev->nextthink = gpGlobals->time + 4.0f;
m_lifeTime = 25;
SetThink( &CGib::WaitTillLand );
SetTouch( &CGib::BounceGibTouch );
@ -927,7 +927,7 @@ int CBaseMonster::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, f
}
else
{
m_vecEnemyLKP = pev->origin + ( g_vecAttackDir * 64 );
m_vecEnemyLKP = pev->origin + ( g_vecAttackDir * 64.0f );
}
MakeIdealYaw( m_vecEnemyLKP );
@ -935,12 +935,12 @@ int CBaseMonster::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, f
// add pain to the conditions
// !!!HACKHACK - fudged for now. Do we want to have a virtual function to determine what is light and
// heavy damage per monster class?
if( flDamage > 0 )
if( flDamage > 0.0f )
{
SetConditions( bits_COND_LIGHT_DAMAGE );
}
if( flDamage >= 20 )
if( flDamage >= 20.0f )
{
SetConditions( bits_COND_HEAVY_DAMAGE );
}
@ -965,7 +965,7 @@ int CBaseMonster::DeadTakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacke
CBaseEntity *pInflictor = CBaseEntity::Instance( pevInflictor );
if( pInflictor )
{
vecDir = ( pInflictor->Center() - Vector ( 0, 0, 10 ) - Center() ).Normalize();
vecDir = ( pInflictor->Center() - Vector ( 0.0f, 0.0f, 10.0f ) - Center() ).Normalize();
vecDir = g_vecAttackDir = vecDir.Normalize();
}
}
@ -973,7 +973,7 @@ int CBaseMonster::DeadTakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacke
#if 0// turn this back on when the bounding box issues are resolved.
pev->flags &= ~FL_ONGROUND;
pev->origin.z += 1;
pev->origin.z += 1.0f;
// let the damage scoot the corpse around a bit.
if( !FNullEnt( pevInflictor ) && ( pevAttacker->solid != SOLID_TRIGGER ) )
@ -991,7 +991,7 @@ int CBaseMonster::DeadTakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacke
return 0;
}
// Accumulate corpse gibbing damage, so you can gib with multiple hits
pev->health -= flDamage * 0.1;
pev->health -= flDamage * 0.1f;
}
return 1;
@ -999,11 +999,11 @@ int CBaseMonster::DeadTakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacke
float CBaseMonster::DamageForce( float damage )
{
float force = damage * ( ( 32 * 32 * 72.0 ) / ( pev->size.x * pev->size.y * pev->size.z ) ) * 5;
float force = damage * ( ( 32.0f * 32.0f * 72.0f ) / ( pev->size.x * pev->size.y * pev->size.z ) ) * 5.0f;
if( force > 1000.0 )
if( force > 1000.0f )
{
force = 1000.0;
force = 1000.0f;
}
return force;
@ -1023,11 +1023,11 @@ void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke
if( flRadius )
falloff = flDamage / flRadius;
else
falloff = 1.0;
falloff = 1.0f;
int bInWater = ( UTIL_PointContents( vecSrc ) == CONTENTS_WATER );
vecSrc.z += 1;// in case grenade is lying on the ground
vecSrc.z += 1.0f;// in case grenade is lying on the ground
if( !pevAttacker )
pevAttacker = pevInflictor;
@ -1054,27 +1054,27 @@ void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke
UTIL_TraceLine( vecSrc, vecSpot, dont_ignore_monsters, ENT( pevInflictor ), &tr );
if( tr.flFraction == 1.0 || tr.pHit == pEntity->edict() )
if( tr.flFraction == 1.0f || tr.pHit == pEntity->edict() )
{
// the explosion can 'see' this entity, so hurt them!
if( tr.fStartSolid )
{
// if we're stuck inside them, fixup the position and distance
tr.vecEndPos = vecSrc;
tr.flFraction = 0.0;
tr.flFraction = 0.0f;
}
// decrease damage for an ent that's farther from the bomb.
flAdjustedDamage = ( vecSrc - tr.vecEndPos ).Length() * falloff;
flAdjustedDamage = flDamage - flAdjustedDamage;
if( flAdjustedDamage < 0 )
if( flAdjustedDamage < 0.0f )
{
flAdjustedDamage = 0;
flAdjustedDamage = 0.0f;
}
// ALERT( at_console, "hit %s\n", STRING( pEntity->pev->classname ) );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
ClearMultiDamage();
pEntity->TraceAttack( pevInflictor, flAdjustedDamage, ( tr.vecEndPos - vecSrc ).Normalize(), &tr, bitsDamageType );
@ -1091,12 +1091,12 @@ void RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke
void CBaseMonster::RadiusDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType )
{
::RadiusDamage( pev->origin, pevInflictor, pevAttacker, flDamage, flDamage * 2.5, iClassIgnore, bitsDamageType );
::RadiusDamage( pev->origin, pevInflictor, pevAttacker, flDamage, flDamage * 2.5f, iClassIgnore, bitsDamageType );
}
void CBaseMonster::RadiusDamage( Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int iClassIgnore, int bitsDamageType )
{
::RadiusDamage( vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * 2.5, iClassIgnore, bitsDamageType );
::RadiusDamage( vecSrc, pevInflictor, pevAttacker, flDamage, flDamage * 2.5f, iClassIgnore, bitsDamageType );
}
//=========================================================
@ -1117,7 +1117,7 @@ CBaseEntity* CBaseMonster::CheckTraceHullAttack( float flDist, int iDamage, int
UTIL_MakeAimVectors( pev->angles );
Vector vecStart = pev->origin;
vecStart.z += pev->size.z * 0.5;
vecStart.z += pev->size.z * 0.5f;
Vector vecEnd = vecStart + ( gpGlobals->v_forward * flDist );
UTIL_TraceHull( vecStart, vecEnd, dont_ignore_monsters, head_hull, ENT( pev ), &tr );
@ -1219,7 +1219,7 @@ BOOL CBaseEntity::FVisible( CBaseEntity *pEntity )
UTIL_TraceLine( vecLookerOrigin, vecTargetOrigin, ignore_monsters, ignore_glass, ENT( pev )/*pentIgnore*/, &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
return FALSE;// Line of sight is not established
}
@ -1242,7 +1242,7 @@ BOOL CBaseEntity::FVisible( const Vector &vecOrigin )
UTIL_TraceLine( vecLookerOrigin, vecOrigin, ignore_monsters, ignore_glass, ENT( pev )/*pentIgnore*/, &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
return FALSE;// Line of sight is not established
}
@ -1259,7 +1259,7 @@ TraceAttack
*/
void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType)
{
Vector vecOrigin = ptr->vecEndPos - vecDir * 4;
Vector vecOrigin = ptr->vecEndPos - vecDir * 4.0f;
if( pev->takedamage )
{
@ -1281,7 +1281,7 @@ void CBaseEntity::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vec
//=========================================================
void CBaseMonster::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType )
{
Vector vecOrigin = ptr->vecEndPos - vecDir * 4;
Vector vecOrigin = ptr->vecEndPos - vecDir * 4.0f;
ALERT( at_console, "%d\n", ptr->iHitgroup );
@ -1367,8 +1367,8 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin
// get circular gaussian spread
float x, y, z;
do {
x = RANDOM_FLOAT( -0.5, 0.5 ) + RANDOM_FLOAT( -0.5, 0.5 );
y = RANDOM_FLOAT( -0.5, 0.5 ) + RANDOM_FLOAT( -0.5, 0.5 );
x = RANDOM_FLOAT( -0.5f, 0.5f ) + RANDOM_FLOAT( -0.5f, 0.5f );
y = RANDOM_FLOAT( -0.5f, 0.5f ) + RANDOM_FLOAT( -0.5f, 0.5f );
z = x * x + y * y;
} while (z > 1);
@ -1388,7 +1388,7 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin
if( IsPlayer() )
{
// adjust tracer position for player
vecTracerSrc = vecSrc + Vector( 0, 0, -4 ) + gpGlobals->v_right * 2 + gpGlobals->v_forward * 16;
vecTracerSrc = vecSrc + Vector( 0.0f, 0.0f, -4.0f ) + gpGlobals->v_right * 2.0f + gpGlobals->v_forward * 16.0f;
}
else
{
@ -1416,7 +1416,7 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin
}
}
// do damage, paint decals
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
@ -1463,7 +1463,7 @@ void CBaseEntity::FireBullets( ULONG cShots, Vector vecSrc, Vector vecDirShootin
}
}
// make bullet trails
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (int)( ( flDistance * tr.flFraction ) / 64.0 ) );
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (int)( ( flDistance * tr.flFraction ) / 64.0f ) );
}
ApplyMultiDamage( pev, pevAttacker );
}
@ -1496,8 +1496,8 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
{
//Use player's random seed.
// get circular gaussian spread
x = UTIL_SharedRandomFloat( shared_rand + iShot, -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 1 + iShot ) , -0.5, 0.5 );
y = UTIL_SharedRandomFloat( shared_rand + ( 2 + iShot ), -0.5, 0.5 ) + UTIL_SharedRandomFloat( shared_rand + ( 3 + iShot ), -0.5, 0.5 );
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;
Vector vecDir = vecDirShooting +
@ -1509,7 +1509,7 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( pev )/*pentIgnore*/, &tr );
// do damage, paint decals
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
@ -1549,7 +1549,7 @@ Vector CBaseEntity::FireBulletsPlayer( ULONG cShots, Vector vecSrc, Vector vecDi
}
}
// make bullet trails
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (int)( ( flDistance * tr.flFraction ) / 64.0 ) );
UTIL_BubbleTrail( vecSrc, tr.vecEndPos, (int)( ( flDistance * tr.flFraction ) / 64.0f ) );
}
ApplyMultiDamage( pev, pevAttacker );
@ -1589,33 +1589,33 @@ void CBaseEntity::TraceBleed( float flDamage, Vector vecDir, TraceResult *ptr, i
}
}
*/
if( flDamage < 10 )
if( flDamage < 10.0f )
{
flNoise = 0.1;
flNoise = 0.1f;
cCount = 1;
}
else if( flDamage < 25 )
else if( flDamage < 25.0f )
{
flNoise = 0.2;
flNoise = 0.2f;
cCount = 2;
}
else
{
flNoise = 0.3;
flNoise = 0.3f;
cCount = 4;
}
for( i = 0; i < cCount; i++ )
{
vecTraceDir = vecDir * -1;// trace in the opposite direction the shot came from (the direction the shot is going)
vecTraceDir = vecDir * -1.0f;// trace in the opposite direction the shot came from (the direction the shot is going)
vecTraceDir.x += RANDOM_FLOAT( -flNoise, flNoise );
vecTraceDir.y += RANDOM_FLOAT( -flNoise, flNoise );
vecTraceDir.z += RANDOM_FLOAT( -flNoise, flNoise );
UTIL_TraceLine( ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * -172, ignore_monsters, ENT( pev ), &Bloodtr );
UTIL_TraceLine( ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * -172.0f, ignore_monsters, ENT( pev ), &Bloodtr );
if( Bloodtr.flFraction != 1.0 )
if( Bloodtr.flFraction != 1.0f )
{
UTIL_BloodDecalTrace( &Bloodtr, BloodColor() );
}
@ -1653,7 +1653,7 @@ void CBaseMonster::MakeDamageBloodDecal( int cCount, float flNoise, TraceResult
vecTraceDir.y += RANDOM_FLOAT( -flNoise, flNoise );
vecTraceDir.z += RANDOM_FLOAT( -flNoise, flNoise );
UTIL_TraceLine( ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * 172, ignore_monsters, ENT( pev ), &Bloodtr );
UTIL_TraceLine( ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * 172.0f, ignore_monsters, ENT( pev ), &Bloodtr );
/*
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
@ -1668,7 +1668,7 @@ void CBaseMonster::MakeDamageBloodDecal( int cCount, float flNoise, TraceResult
MESSAGE_END();
*/
if( Bloodtr.flFraction != 1.0 )
if( Bloodtr.flFraction != 1.0f )
{
UTIL_BloodDecalTrace( &Bloodtr, BloodColor() );
}

View File

@ -190,9 +190,9 @@ void CController::Killed( entvars_t *pevAttacker, int iGib )
// shut off balls
/*
m_iBall[0] = 0;
m_iBallTime[0] = gpGlobals->time + 4.0;
m_iBallTime[0] = gpGlobals->time + 4.0f;
m_iBall[1] = 0;
m_iBallTime[1] = gpGlobals->time + 4.0;
m_iBallTime[1] = gpGlobals->time + 4.0f;
*/
// fade balls
@ -281,9 +281,9 @@ void CController::HandleAnimEvent( MonsterEvent_t *pEvent )
MESSAGE_END();
m_iBall[0] = 192;
m_iBallTime[0] = gpGlobals->time + atoi( pEvent->options ) / 15.0;
m_iBallTime[0] = gpGlobals->time + atoi( pEvent->options ) / 15.0f;
m_iBall[1] = 255;
m_iBallTime[1] = gpGlobals->time + atoi( pEvent->options ) / 15.0;
m_iBallTime[1] = gpGlobals->time + atoi( pEvent->options ) / 15.0f;
}
break;
case CONTROLLER_AE_BALL_SHOOT:
@ -308,7 +308,7 @@ void CController::HandleAnimEvent( MonsterEvent_t *pEvent )
CBaseMonster *pBall = (CBaseMonster*)Create( "controller_head_ball", vecStart, pev->angles, edict() );
pBall->pev->velocity = Vector( 0, 0, 32 );
pBall->pev->velocity = Vector( 0.0f, 0.0f, 32.0f );
pBall->m_hEnemy = m_hEnemy;
m_iBall[0] = 0;
@ -319,23 +319,23 @@ void CController::HandleAnimEvent( MonsterEvent_t *pEvent )
{
AttackSound();
m_flShootTime = gpGlobals->time;
m_flShootEnd = m_flShootTime + atoi( pEvent->options ) / 15.0;
m_flShootEnd = m_flShootTime + atoi( pEvent->options ) / 15.0f;
}
break;
case CONTROLLER_AE_POWERUP_FULL:
{
m_iBall[0] = 255;
m_iBallTime[0] = gpGlobals->time + atoi( pEvent->options ) / 15.0;
m_iBallTime[0] = gpGlobals->time + atoi( pEvent->options ) / 15.0f;
m_iBall[1] = 255;
m_iBallTime[1] = gpGlobals->time + atoi( pEvent->options ) / 15.0;
m_iBallTime[1] = gpGlobals->time + atoi( pEvent->options ) / 15.0f;
}
break;
case CONTROLLER_AE_POWERUP_HALF:
{
m_iBall[0] = 192;
m_iBallTime[0] = gpGlobals->time + atoi( pEvent->options ) / 15.0;
m_iBallTime[0] = gpGlobals->time + atoi( pEvent->options ) / 15.0f;
m_iBall[1] = 192;
m_iBallTime[1] = gpGlobals->time + atoi( pEvent->options ) / 15.0;
m_iBallTime[1] = gpGlobals->time + atoi( pEvent->options ) / 15.0f;
}
break;
default:
@ -352,14 +352,14 @@ void CController::Spawn()
Precache();
SET_MODEL( ENT( pev ), "models/controller.mdl" );
UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) );
UTIL_SetSize( pev, Vector( -32.0f, -32.0f, 0.0f ), Vector( 32.0f, 32.0f, 64.0f ) );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_FLY;
pev->flags |= FL_FLY;
m_bloodColor = BLOOD_COLOR_GREEN;
pev->health = gSkillData.controllerHealth;
pev->view_ofs = Vector( 0, 0, -2 );// position of the eyes relative to monster's origin.
pev->view_ofs = Vector( 0.0f, 0.0f, -2.0f );// position of the eyes relative to monster's origin.
m_flFieldOfView = VIEW_FIELD_FULL;// indicates the width of this monster's forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
@ -409,8 +409,8 @@ void CController::UpdateOnRemove()
// Chase enemy schedule
Task_t tlControllerChaseEnemy[] =
{
{ TASK_GET_PATH_TO_ENEMY, (float)128 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_GET_PATH_TO_ENEMY, 128.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
};
Schedule_t slControllerChaseEnemy[] =
@ -427,10 +427,10 @@ Schedule_t slControllerChaseEnemy[] =
Task_t tlControllerStrafe[] =
{
{ TASK_WAIT, (float)0.2 },
{ TASK_GET_PATH_TO_ENEMY, (float)128 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_WAIT, (float)1 },
{ TASK_WAIT, 0.2f },
{ TASK_GET_PATH_TO_ENEMY, 128.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_WAIT, 1.0f },
};
Schedule_t slControllerStrafe[] =
@ -446,10 +446,10 @@ Schedule_t slControllerStrafe[] =
Task_t tlControllerTakeCover[] =
{
{ TASK_WAIT, (float)0.2 },
{ TASK_FIND_COVER_FROM_ENEMY, (float)0 },
{ TASK_WAIT_FOR_MOVEMENT, (float)0 },
{ TASK_WAIT, (float)1 },
{ TASK_WAIT, 0.2f },
{ TASK_FIND_COVER_FROM_ENEMY, 0.0f },
{ TASK_WAIT_FOR_MOVEMENT, 0.0f },
{ TASK_WAIT, 1.0f },
};
Schedule_t slControllerTakeCover[] =
@ -504,7 +504,7 @@ void CController::StartTask( Task_t *pTask )
break;
case TASK_GET_PATH_TO_ENEMY_LKP:
{
if( BuildNearestRoute( m_vecEnemyLKP, pev->view_ofs, pTask->flData, (m_vecEnemyLKP - pev->origin).Length() + 1024 ) )
if( BuildNearestRoute( m_vecEnemyLKP, pev->view_ofs, pTask->flData, (m_vecEnemyLKP - pev->origin).Length() + 1024.0f ) )
{
TaskComplete();
}
@ -526,7 +526,7 @@ void CController::StartTask( Task_t *pTask )
return;
}
if( BuildNearestRoute( pEnemy->pev->origin, pEnemy->pev->view_ofs, pTask->flData, ( pEnemy->pev->origin - pev->origin).Length() + 1024 ) )
if( BuildNearestRoute( pEnemy->pev->origin, pEnemy->pev->view_ofs, pTask->flData, ( pEnemy->pev->origin - pev->origin).Length() + 1024.0f ) )
{
TaskComplete();
}
@ -559,8 +559,8 @@ Vector Intersect( Vector vecSrc, Vector vecDst, Vector vecMove, float flSpeed )
}
else
{
t = b * b - 4 * a * c;
t = sqrt( t ) / ( 2.0 * a );
t = b * b - 4.0f * a * c;
t = sqrt( t ) / ( 2.0f * a );
float t1 = -b +t;
float t2 = -b -t;
@ -572,10 +572,10 @@ Vector Intersect( Vector vecSrc, Vector vecDst, Vector vecMove, float flSpeed )
// ALERT( at_console, "Intersect %f\n", t );
if( t < 0.1 )
t = 0.1;
if( t > 10.0 )
t = 10.0;
if( t < 0.1f )
t = 0.1f;
if( t > 10.0f )
t = 10.0f;
Vector vecHit = vecTo + vecMove * t;
return vecHit.Normalize() * flSpeed;
@ -583,7 +583,7 @@ Vector Intersect( Vector vecSrc, Vector vecDst, Vector vecMove, float flSpeed )
int CController::LookupFloat()
{
if( m_velocity.Length() < 32.0 )
if( m_velocity.Length() < 32.0f )
{
return LookupSequence( "up" );
}
@ -636,21 +636,21 @@ void CController::RunTask( Task_t *pTask )
{
if( HasConditions( bits_COND_SEE_ENEMY ) )
{
m_vecEstVelocity = m_vecEstVelocity * 0.5 + m_hEnemy->pev->velocity * 0.5;
m_vecEstVelocity = m_vecEstVelocity * 0.5f + m_hEnemy->pev->velocity * 0.5f;
}
else
{
m_vecEstVelocity = m_vecEstVelocity * 0.8;
m_vecEstVelocity = m_vecEstVelocity * 0.8f;
}
vecDir = Intersect( vecSrc, m_hEnemy->BodyTarget( pev->origin ), m_vecEstVelocity, gSkillData.controllerSpeedBall );
float delta = 0.03490; // +-2 degree
float delta = 0.03490f; // +-2 degree
vecDir = vecDir + Vector( RANDOM_FLOAT( -delta, delta ), RANDOM_FLOAT( -delta, delta ), RANDOM_FLOAT( -delta, delta ) ) * gSkillData.controllerSpeedBall;
vecSrc = vecSrc + vecDir * ( gpGlobals->time - m_flShootTime );
CBaseMonster *pBall = (CBaseMonster*)Create( "controller_energy_ball", vecSrc, pev->angles, edict() );
pBall->pev->velocity = vecDir;
}
m_flShootTime += 0.2;
m_flShootTime += 0.2f;
}
if( m_flShootTime > m_flShootEnd )
@ -725,7 +725,7 @@ Schedule_t *CController::GetSchedule( void )
{
case MONSTERSTATE_COMBAT:
{
// Vector vecTmp = Intersect( Vector( 0, 0, 0 ), Vector( 100, 4, 7 ), Vector( 2, 10, -3 ), 20.0 );
// Vector vecTmp = Intersect( Vector( 0, 0, 0 ), Vector( 100, 4, 7 ), Vector( 2, 10, -3 ), 20.0f );
// dead enemy
if( HasConditions( bits_COND_LIGHT_DAMAGE ) )
@ -777,7 +777,7 @@ Schedule_t *CController::GetScheduleOfType( int Type )
//=========================================================
BOOL CController::CheckRangeAttack1( float flDot, float flDist )
{
if( flDot > 0.5 && flDist > 256 && flDist <= 2048 )
if( flDot > 0.5f && flDist > 256.0f && flDist <= 2048.0f )
{
return TRUE;
}
@ -786,7 +786,7 @@ BOOL CController::CheckRangeAttack1( float flDot, float flDist )
BOOL CController::CheckRangeAttack2( float flDot, float flDist )
{
if( flDot > 0.5 && flDist > 64 && flDist <= 2048 )
if( flDot > 0.5f && flDist > 64.0f && flDist <= 2048.0f )
{
return TRUE;
}
@ -805,10 +805,10 @@ void CController::SetActivity( Activity NewActivity )
switch( m_Activity )
{
case ACT_WALK:
m_flGroundSpeed = 100;
m_flGroundSpeed = 100.0f;
break;
default:
m_flGroundSpeed = 100;
m_flGroundSpeed = 100.0f;
break;
}
}
@ -831,14 +831,14 @@ void CController::RunAI( void )
m_pBall[i] = CSprite::SpriteCreate( "sprites/xspark4.spr", pev->origin, TRUE );
m_pBall[i]->SetTransparency( kRenderGlow, 255, 255, 255, 255, kRenderFxNoDissipation );
m_pBall[i]->SetAttachment( edict(), ( i + 3 ) );
m_pBall[i]->SetScale( 1.0 );
m_pBall[i]->SetScale( 1.0f );
}
float t = m_iBallTime[i] - gpGlobals->time;
if( t > 0.1 )
t = 0.1 / t;
if( t > 0.1f )
t = 0.1f / t;
else
t = 1.0;
t = 1.0f;
m_iBallCurrent[i] += ( m_iBall[i] - m_iBallCurrent[i] ) * t;
@ -912,9 +912,9 @@ void CController::Move( float flInterval )
// to that entity for the CheckLocalMove and Triangulate functions.
pTargetEnt = NULL;
if( m_flGroundSpeed == 0 )
if( m_flGroundSpeed == 0.0f )
{
m_flGroundSpeed = 100;
m_flGroundSpeed = 100.0f;
// TaskFail();
// return;
}
@ -966,7 +966,8 @@ void CController::Move( float flInterval )
{
DispatchBlocked( edict(), pBlocker->edict() );
}
if( pBlocker && m_moveWaitTime > 0 && pBlocker->IsMoving() && !pBlocker->IsPlayer() && (gpGlobals->time-m_flMoveWaitFinished) > 3.0 )
if( pBlocker && m_moveWaitTime > 0 && pBlocker->IsMoving() && !pBlocker->IsPlayer() && (gpGlobals->time-m_flMoveWaitFinished) > 3.0f )
{
// Can we still move toward our target?
if( flDist < m_flGroundSpeed )
@ -992,7 +993,7 @@ void CController::Move( float flInterval )
if( m_moveWaitTime > 0 )
{
FRefreshRoute();
m_flMoveWaitFinished = gpGlobals->time + m_moveWaitTime * 0.5;
m_flMoveWaitFinished = gpGlobals->time + m_moveWaitTime * 0.5f;
}
else
{
@ -1030,10 +1031,10 @@ void CController::Move( float flInterval )
Stop();
RouteClear();
}
} while( flMoveDist > 0 && flCheckDist > 0 );
} while( flMoveDist > 0.0f && flCheckDist > 0.0f );
// cut corner?
if( flWaypointDist < 128 )
if( flWaypointDist < 128.0f )
{
if( m_movementGoal == MOVEGOAL_ENEMY )
RouteSimplify( m_hEnemy );
@ -1041,19 +1042,19 @@ void CController::Move( float flInterval )
RouteSimplify( m_hTargetEnt );
FRefreshRoute();
if( m_flGroundSpeed > 100 )
m_flGroundSpeed -= 40;
if( m_flGroundSpeed > 100.0f )
m_flGroundSpeed -= 40.0f;
}
else
{
if( m_flGroundSpeed < 400 )
m_flGroundSpeed += 10;
if( m_flGroundSpeed < 400.0f )
m_flGroundSpeed += 10.0f;
}
}
BOOL CController::ShouldAdvanceRoute( float flWaypointDist )
{
if( flWaypointDist <= 32 )
if( flWaypointDist <= 32.0f )
{
return TRUE;
}
@ -1076,7 +1077,7 @@ int CController::CheckLocalMove( const Vector &vecStart, const Vector &vecEnd, C
}
// ALERT( at_console, "check %d %d %f\n", tr.fStartSolid, tr.fAllSolid, tr.flFraction );
if( tr.fStartSolid || tr.flFraction < 1.0 )
if( tr.fStartSolid || tr.flFraction < 1.0f )
{
if( pTarget && pTarget->edict() == gpGlobals->trace_ent )
return LOCALMOVE_VALID;
@ -1096,7 +1097,7 @@ void CController::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, fl
// float flTotal = m_flGroundSpeed * pev->framerate * flInterval;
// UTIL_MoveToOrigin ( ENT( pev ), m_Route[m_iRouteIndex].vecLocation, flTotal, MOVE_STRAFE );
m_velocity = m_velocity * 0.8 + m_flGroundSpeed * vecDir * 0.2;
m_velocity = m_velocity * 0.8f + m_flGroundSpeed * vecDir * 0.2f;
UTIL_MoveToOrigin( ENT( pev ), pev->origin + m_velocity, m_velocity.Length() * flInterval, MOVE_STRAFE );
}
@ -1133,7 +1134,7 @@ void CControllerHeadBall::Spawn( void )
pev->rendercolor.y = 255;
pev->rendercolor.z = 255;
pev->renderamt = 255;
pev->scale = 2.0;
pev->scale = 2.0f;
UTIL_SetSize(pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
UTIL_SetOrigin( pev, pev->origin );
@ -1143,7 +1144,7 @@ void CControllerHeadBall::Spawn( void )
m_vecIdeal = Vector( 0, 0, 0 );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_hOwner = Instance( pev->owner );
pev->dmgtime = gpGlobals->time;
@ -1158,7 +1159,7 @@ void CControllerHeadBall::Precache( void )
void CControllerHeadBall::HuntThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->renderamt -= 5;
@ -1219,12 +1220,12 @@ void CControllerHeadBall::HuntThink( void )
WRITE_BYTE( 10 ); // speed
MESSAGE_END();
UTIL_EmitAmbientSound( ENT( pev ), tr.vecEndPos, "weapons/electro4.wav", 0.5, ATTN_NORM, 0, RANDOM_LONG( 140, 160 ) );
UTIL_EmitAmbientSound( ENT( pev ), tr.vecEndPos, "weapons/electro4.wav", 0.5f, ATTN_NORM, 0, RANDOM_LONG( 140, 160 ) );
m_flNextAttack = gpGlobals->time + 3.0;
m_flNextAttack = gpGlobals->time + 3.0f;
SetThink( &CControllerHeadBall::DieThink );
pev->nextthink = gpGlobals->time + 0.3;
pev->nextthink = gpGlobals->time + 0.3f;
}
//Crawl();
@ -1239,31 +1240,31 @@ void CControllerHeadBall::MovetoTarget( Vector vecTarget )
{
// accelerate
float flSpeed = m_vecIdeal.Length();
if( flSpeed == 0 )
if( flSpeed == 0.0f )
{
m_vecIdeal = pev->velocity;
flSpeed = m_vecIdeal.Length();
}
if( flSpeed > 400 )
if( flSpeed > 400.0f )
{
m_vecIdeal = m_vecIdeal.Normalize() * 400;
m_vecIdeal = m_vecIdeal.Normalize() * 400.0f;
}
m_vecIdeal = m_vecIdeal + ( vecTarget - pev->origin ).Normalize() * 100;
m_vecIdeal = m_vecIdeal + ( vecTarget - pev->origin ).Normalize() * 100.0f;
pev->velocity = m_vecIdeal;
}
void CControllerHeadBall::Crawl( void )
{
Vector vecAim = Vector( RANDOM_FLOAT( -1, 1 ), RANDOM_FLOAT( -1, 1 ), RANDOM_FLOAT( -1, 1 ) ).Normalize();
Vector vecPnt = pev->origin + pev->velocity * 0.3 + vecAim * 64;
Vector vecAim = Vector( RANDOM_FLOAT( -1.0f, 1.0f ), RANDOM_FLOAT( -1.0f, 1.0f ), RANDOM_FLOAT( -1.0f, 1.0f ) ).Normalize();
Vector vecPnt = pev->origin + pev->velocity * 0.3f + vecAim * 64.0f;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMENTPOINT );
WRITE_SHORT( entindex() );
WRITE_COORD( vecPnt.x);
WRITE_COORD( vecPnt.y);
WRITE_COORD( vecPnt.z);
WRITE_COORD( vecPnt.x );
WRITE_COORD( vecPnt.y );
WRITE_COORD( vecPnt.z );
WRITE_SHORT( g_sModelIndexLaser );
WRITE_BYTE( 0 ); // frame start
WRITE_BYTE( 10 ); // framerate
@ -1286,7 +1287,7 @@ void CControllerHeadBall::BounceTouch( CBaseEntity *pOther )
float n = -DotProduct( tr.vecPlaneNormal, vecDir );
vecDir = 2.0 * tr.vecPlaneNormal * n + vecDir;
vecDir = 2.0f * tr.vecPlaneNormal * n + vecDir;
m_vecIdeal = vecDir * m_vecIdeal.Length();
}
@ -1316,7 +1317,7 @@ void CControllerZapBall::Spawn( void )
pev->rendercolor.y = 255;
pev->rendercolor.z = 255;
pev->renderamt = 255;
pev->scale = 0.5;
pev->scale = 0.5f;
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
UTIL_SetOrigin( pev, pev->origin );
@ -1326,7 +1327,7 @@ void CControllerZapBall::Spawn( void )
m_hOwner = Instance( pev->owner );
pev->dmgtime = gpGlobals->time; // keep track of when ball spawned
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
void CControllerZapBall::Precache( void )
@ -1338,11 +1339,11 @@ void CControllerZapBall::Precache( void )
void CControllerZapBall::AnimateThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->frame = ( (int)pev->frame + 1 ) % 11;
if( gpGlobals->time - pev->dmgtime > 5 || pev->velocity.Length() < 10 )
if( gpGlobals->time - pev->dmgtime > 5 || pev->velocity.Length() < 10.0f )
{
SetTouch( NULL );
UTIL_Remove( this );
@ -1367,10 +1368,10 @@ void CControllerZapBall::ExplodeTouch( CBaseEntity *pOther )
}
ClearMultiDamage();
pOther->TraceAttack(pevOwner, gSkillData.controllerDmgBall, pev->velocity.Normalize(), &tr, DMG_ENERGYBEAM );
pOther->TraceAttack( pevOwner, gSkillData.controllerDmgBall, pev->velocity.Normalize(), &tr, DMG_ENERGYBEAM );
ApplyMultiDamage( pevOwner, pevOwner );
UTIL_EmitAmbientSound( ENT( pev ), tr.vecEndPos, "weapons/electro4.wav", 0.3, ATTN_NORM, 0, RANDOM_LONG( 90, 99 ) );
UTIL_EmitAmbientSound( ENT( pev ), tr.vecEndPos, "weapons/electro4.wav", 0.3f, ATTN_NORM, 0, RANDOM_LONG( 90, 99 ) );
}
UTIL_Remove( this );

View File

@ -67,7 +67,7 @@ void CCrossbowBolt::Spawn()
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_BBOX;
pev->gravity = 0.5;
pev->gravity = 0.5f;
SET_MODEL( ENT( pev ), "models/crossbow_bolt.mdl" );
@ -76,7 +76,7 @@ void CCrossbowBolt::Spawn()
SetTouch( &CCrossbowBolt::BoltTouch );
SetThink( &CCrossbowBolt::BubbleThink );
pev->nextthink = gpGlobals->time + 0.2;
pev->nextthink = gpGlobals->time + 0.2f;
}
void CCrossbowBolt::Precache()
@ -140,7 +140,7 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther )
}
else
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "weapons/xbow_hit1.wav", RANDOM_FLOAT( 0.95, 1.0 ), ATTN_NORM, 0, 98 + RANDOM_LONG( 0, 7 ) );
EMIT_SOUND_DYN( ENT( pev ), CHAN_BODY, "weapons/xbow_hit1.wav", RANDOM_FLOAT( 0.95f, 1.0f ), ATTN_NORM, 0, 98 + RANDOM_LONG( 0, 7 ) );
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time;// this will get changed below if the bolt is allowed to stick in what it hit.
@ -149,25 +149,25 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther )
{
// if what we hit is static architecture, can stay around for a while.
Vector vecDir = pev->velocity.Normalize();
UTIL_SetOrigin( pev, pev->origin - vecDir * 12 );
UTIL_SetOrigin( pev, pev->origin - vecDir * 12.0f );
pev->angles = UTIL_VecToAngles( vecDir );
pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_FLY;
pev->velocity = Vector( 0, 0, 0 );
pev->avelocity.z = 0;
pev->angles.z = RANDOM_LONG( 0, 360 );
pev->nextthink = gpGlobals->time + 10.0;
pev->nextthink = gpGlobals->time + 10.0f;
}
else if( pOther->pev->movetype == MOVETYPE_PUSH || pOther->pev->movetype == MOVETYPE_PUSHSTEP )
{
Vector vecDir = pev->velocity.Normalize();
UTIL_SetOrigin( pev, pev->origin - vecDir * 12 );
UTIL_SetOrigin( pev, pev->origin - vecDir * 12.0f );
pev->angles = UTIL_VecToAngles( vecDir );
pev->solid = SOLID_NOT;
pev->velocity = Vector( 0, 0, 0 );
pev->avelocity.z = 0;
pev->angles.z = RANDOM_LONG( 0, 360 );
pev->nextthink = gpGlobals->time + 10.0;
pev->nextthink = gpGlobals->time + 10.0f;
if (gPhysicsInterfaceInitialized) {
// g-cont. Setup movewith feature
@ -185,18 +185,18 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther )
if( g_pGameRules->IsMultiplayer() )
{
SetThink( &CCrossbowBolt::ExplodeThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
}
void CCrossbowBolt::BubbleThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( pev->waterlevel == 0 )
return;
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1, pev->origin, 1 );
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1f, pev->origin, 1 );
}
void CCrossbowBolt::ExplodeThink( void )
@ -328,7 +328,7 @@ void CCrossbow::Holster( int skiplocal /* = 0 */ )
SecondaryAttack();
}
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
if( m_iClip )
SendWeaponAnim( CROSSBOW_HOLSTER1 );
else
@ -353,7 +353,7 @@ void CCrossbow::PrimaryAttack( void )
// this function only gets called in multiplayer
void CCrossbow::FireSniperBolt()
{
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 );
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75f );
if( m_iClip == 0 )
{
@ -373,14 +373,14 @@ void CCrossbow::FireSniperBolt()
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow2, 0.0, g_vecZero, g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow2, 0.0f, g_vecZero, g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
UTIL_MakeVectors( anglesAim );
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2;
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2.0f;
Vector vecDir = gpGlobals->v_forward;
UTIL_TraceLine( vecSrc, vecSrc + vecDir * 8192, dont_ignore_monsters, m_pPlayer->edict(), &tr );
@ -416,7 +416,7 @@ void CCrossbow::FireBolt()
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow, 0.0, g_vecZero, g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow, 0.0f, g_vecZero, g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
@ -427,7 +427,7 @@ void CCrossbow::FireBolt()
anglesAim.x = -anglesAim.x;
#ifndef CLIENT_DLL
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2;
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2.0f;
Vector vecDir = gpGlobals->v_forward;
CCrossbowBolt *pBolt = CCrossbowBolt::BoltCreate();
@ -445,21 +445,21 @@ void CCrossbow::FireBolt()
pBolt->pev->velocity = vecDir * BOLT_AIR_VELOCITY;
pBolt->pev->speed = BOLT_AIR_VELOCITY;
}
pBolt->pev->avelocity.z = 10;
pBolt->pev->avelocity.z = 10.0f;
#endif
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 );
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75f;
if( m_iClip != 0 )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0f;
else
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75f;
}
void CCrossbow::SecondaryAttack()
@ -475,8 +475,8 @@ void CCrossbow::SecondaryAttack()
m_fInZoom = 1;
}
pev->nextthink = UTIL_WeaponTimeBase() + 0.1;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
pev->nextthink = UTIL_WeaponTimeBase() + 0.1f;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0f;
}
void CCrossbow::Reload( void )
@ -489,9 +489,9 @@ void CCrossbow::Reload( void )
SecondaryAttack();
}
if( DefaultReload( CROSSBOW_MAX_CLIP, CROSSBOW_RELOAD, 4.5 ) )
if( DefaultReload( CROSSBOW_MAX_CLIP, CROSSBOW_RELOAD, 4.5f ) )
{
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/xbow_reload1.wav", RANDOM_FLOAT( 0.95, 1.0 ), ATTN_NORM, 0, 93 + RANDOM_LONG( 0, 0xF ) );
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/xbow_reload1.wav", RANDOM_FLOAT( 0.95f, 1.0f ), ATTN_NORM, 0, 93 + RANDOM_LONG( 0, 0xF ) );
}
}
@ -504,7 +504,7 @@ void CCrossbow::WeaponIdle( void )
if( m_flTimeWeaponIdle < UTIL_WeaponTimeBase() )
{
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand <= 0.75 )
if( flRand <= 0.75f )
{
if( m_iClip )
{
@ -521,12 +521,12 @@ void CCrossbow::WeaponIdle( void )
if( m_iClip )
{
SendWeaponAnim( CROSSBOW_FIDGET1 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0 / 30.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0f / 30.0f;
}
else
{
SendWeaponAnim( CROSSBOW_FIDGET2 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0 / 30.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0f / 30.0f;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
}

View File

@ -105,7 +105,7 @@ BOOL CCrowbar::Deploy()
void CCrowbar::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
SendWeaponAnim( CROWBAR_HOLSTER );
}
@ -120,9 +120,9 @@ void FindHullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, f
distance = 1e6f;
vecHullEnd = vecSrc + ( ( vecHullEnd - vecSrc ) * 2 );
vecHullEnd = vecSrc + ( ( vecHullEnd - vecSrc ) * 2.0f );
UTIL_TraceLine( vecSrc, vecHullEnd, dont_ignore_monsters, pEntity, &tmpTrace );
if( tmpTrace.flFraction < 1.0 )
if( tmpTrace.flFraction < 1.0f )
{
tr = tmpTrace;
return;
@ -139,7 +139,7 @@ void FindHullIntersection( const Vector &vecSrc, TraceResult &tr, float *mins, f
vecEnd.z = vecHullEnd.z + minmaxs[k][2];
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, pEntity, &tmpTrace );
if( tmpTrace.flFraction < 1.0 )
if( tmpTrace.flFraction < 1.0f )
{
float thisDistance = ( tmpTrace.vecEndPos - vecSrc ).Length();
if( thisDistance < distance )
@ -159,7 +159,7 @@ void CCrowbar::PrimaryAttack()
{
#ifndef CLIENT_DLL
SetThink( &CCrowbar::SwingAgain );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
#endif
}
}
@ -182,15 +182,15 @@ int CCrowbar::Swing( int fFirst )
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
Vector vecSrc = m_pPlayer->GetGunPosition();
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32;
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32.0f;
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
#ifndef CLIENT_DLL
if( tr.flFraction >= 1.0 )
if( tr.flFraction >= 1.0f )
{
UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr );
if( tr.flFraction < 1.0 )
if( tr.flFraction < 1.0f )
{
// Calculate the point of intersection of the line (or hull) and the object we hit
// This is and approximation of the "best" intersection
@ -204,11 +204,11 @@ int CCrowbar::Swing( int fFirst )
if( fFirst )
{
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar,
0.0, g_vecZero, g_vecZero, 0, 0, 0,
0.0f, g_vecZero, g_vecZero, 0, 0, 0,
0, 0, 0 );
}
if( tr.flFraction >= 1.0 )
if( tr.flFraction >= 1.0f )
{
if( fFirst )
{
@ -245,7 +245,7 @@ int CCrowbar::Swing( int fFirst )
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
// play thwack, smack, or dong sound
float flVol = 1.0;
float flVol = 1.0f;
int fHitWorld = TRUE;
if( pEntity )
@ -255,9 +255,9 @@ int CCrowbar::Swing( int fFirst )
// UTIL_WeaponTimeBase() is always 0 and m_flNextPrimaryAttack is >= -1.0f, thus making
// m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() always evaluate to false.
#ifdef CLIENT_WEAPONS
if( ( m_flNextPrimaryAttack + 1 == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
if( ( m_flNextPrimaryAttack + 1.0f == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
#else
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
if( ( m_flNextPrimaryAttack + 1.0f < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
#endif
{
// first swing does full damage
@ -266,7 +266,7 @@ int CCrowbar::Swing( int fFirst )
else
{
// subsequent swings do half
pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar / 2, gpGlobals->v_forward, &tr, DMG_CLUB );
pEntity->TraceAttack( m_pPlayer->pev, gSkillData.plrDmgCrowbar * 0.5f, gpGlobals->v_forward, &tr, DMG_CLUB );
}
ApplyMultiDamage( m_pPlayer->pev, m_pPlayer->pev );
@ -276,16 +276,18 @@ int CCrowbar::Swing( int fFirst )
switch( RANDOM_LONG( 0, 2 ) )
{
case 0:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1, ATTN_NORM );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod1.wav", 1.0f, ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1, ATTN_NORM );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod2.wav", 1.0f, ATTN_NORM );
break;
case 2:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1, ATTN_NORM );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/cbar_hitbod3.wav", 1.0f, ATTN_NORM );
break;
}
m_pPlayer->m_iWeaponVolume = CROWBAR_BODYHIT_VOLUME;
if( !pEntity->IsAlive() )
{
#ifdef CROWBAR_FIX_RAPID_CROWBAR
@ -294,7 +296,7 @@ int CCrowbar::Swing( int fFirst )
return TRUE;
}
else
flVol = 0.1;
flVol = 0.1f;
fHitWorld = FALSE;
}
@ -305,14 +307,14 @@ int CCrowbar::Swing( int fFirst )
if( fHitWorld )
{
float fvolbar = TEXTURETYPE_PlaySound( &tr, vecSrc, vecSrc + ( vecEnd - vecSrc ) * 2, BULLET_PLAYER_CROWBAR );
float fvolbar = TEXTURETYPE_PlaySound( &tr, vecSrc, vecSrc + ( vecEnd - vecSrc ) * 2.0f, BULLET_PLAYER_CROWBAR );
if( g_pGameRules->IsMultiplayer() )
{
// override the volume here, cause we don't play texture sounds in multiplayer,
// and fvolbar is going to be 0 from the above call.
fvolbar = 1;
fvolbar = 1.0f;
}
// also play crowbar strike
@ -333,12 +335,12 @@ int CCrowbar::Swing( int fFirst )
m_pPlayer->m_iWeaponVolume = (int)( flVol * CROWBAR_WALLHIT_VOLUME );
SetThink( &CCrowbar::Smack );
pev->nextthink = UTIL_WeaponTimeBase() + 0.2;
pev->nextthink = UTIL_WeaponTimeBase() + 0.2f;
#endif
#if CROWBAR_DELAY_FIX
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f;
#else
m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 );
m_flNextPrimaryAttack = GetNextAttackDelay( 0.25f );
#endif
}
#ifdef CROWBAR_IDLE_ANIM
@ -354,22 +356,22 @@ void CCrowbar::WeaponIdle( void )
{
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand > 0.9 )
if( flRand > 0.9f )
{
iAnim = CROWBAR_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0f / 30.0f;
}
else
{
if( flRand > 0.5 )
if( flRand > 0.5f )
{
iAnim = CROWBAR_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0 / 30.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 30.0f;
}
else
{
iAnim = CROWBAR_IDLE3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0 / 30.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 160.0f / 30.0f;
}
}
SendWeaponAnim( iAnim );

View File

@ -89,9 +89,9 @@ TYPEDESCRIPTION CBaseDoor::m_SaveData[] =
IMPLEMENT_SAVERESTORE( CBaseDoor, CBaseToggle )
#define DOOR_SENTENCEWAIT 6
#define DOOR_SOUNDWAIT 3
#define BUTTON_SOUNDWAIT 0.5
#define DOOR_SENTENCEWAIT 6.0f
#define DOOR_SOUNDWAIT 3.0f
#define BUTTON_SOUNDWAIT 0.5f
// play door or button locked or unlocked sounds.
// pass in pointer to valid locksound struct.
@ -119,9 +119,9 @@ void PlayLockSounds( entvars_t *pev, locksound_t *pls, int flocked, int fbutton
float fvol;
if( fplaysound && fplaysentence )
fvol = 0.25;
fvol = 0.25f;
else
fvol = 1.0;
fvol = 1.0f;
// if there is a locked sound, and we've debounced, play sound
if( fplaysound )
@ -138,7 +138,7 @@ void PlayLockSounds( entvars_t *pev, locksound_t *pls, int flocked, int fbutton
int iprev = pls->iLockedSentence;
pls->iLockedSentence = SENTENCEG_PlaySequentialSz( ENT( pev ), STRING( pls->sLockedSentence ),
0.85, ATTN_NORM, 0, 100, pls->iLockedSentence, FALSE );
0.85f, ATTN_NORM, 0, 100, pls->iLockedSentence, FALSE );
pls->iUnlockedSentence = 0;
// make sure we don't keep calling last sentence in list
@ -157,9 +157,9 @@ void PlayLockSounds( entvars_t *pev, locksound_t *pls, int flocked, int fbutton
// if playing both sentence and sound, lower sound volume so we hear sentence
if( fplaysound && fplaysentence )
fvol = 0.25;
fvol = 0.25f;
else
fvol = 1.0;
fvol = 1.0f;
// play 'door unlocked' sound if set
if( fplaysound )
@ -174,7 +174,7 @@ void PlayLockSounds( entvars_t *pev, locksound_t *pls, int flocked, int fbutton
int iprev = pls->iUnlockedSentence;
pls->iUnlockedSentence = SENTENCEG_PlaySequentialSz( ENT( pev ), STRING( pls->sUnlockedSentence ),
0.85, ATTN_NORM, 0, 100, pls->iUnlockedSentence, FALSE );
0.85f, ATTN_NORM, 0, 100, pls->iUnlockedSentence, FALSE );
pls->iLockedSentence = 0;
// make sure we don't keep calling last sentence in list
@ -231,7 +231,7 @@ void CBaseDoor::KeyValue( KeyValueData *pkvd )
}
else if( FStrEq( pkvd->szKeyName, "WaveHeight" ) )
{
pev->scale = atof( pkvd->szValue ) * ( 1.0 / 8.0 );
pev->scale = atof( pkvd->szValue ) * ( 1.0f / 8.0f );
pkvd->fHandled = TRUE;
}
else
@ -293,13 +293,13 @@ void CBaseDoor::Spawn()
UTIL_SetOrigin( pev, pev->origin );
SET_MODEL( ENT( pev ), STRING( pev->model ) );
if( pev->speed == 0 )
pev->speed = 100;
if( pev->speed == 0.0f )
pev->speed = 100.0f;
m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
m_vecPosition2 = m_vecPosition1 + ( pev->movedir * ( fabs( pev->movedir.x * ( pev->size.x - 2 ) ) + fabs( pev->movedir.y * ( pev->size.y - 2 ) ) + fabs( pev->movedir.z * ( pev->size.z - 2 ) ) - m_flLip ) );
m_vecPosition2 = m_vecPosition1 + ( pev->movedir * ( fabs( pev->movedir.x * ( pev->size.x - 2.0f ) ) + fabs( pev->movedir.y * ( pev->size.y - 2.0f ) ) + fabs( pev->movedir.z * ( pev->size.z - 2.0f ) ) - m_flLip ) );
ASSERTSZ( m_vecPosition1 != m_vecPosition2, "door start/end positions are equal" );
if( FBitSet( pev->spawnflags, SF_DOOR_START_OPEN ) )
{
@ -611,7 +611,7 @@ void CBaseDoor::DoorGoUp( void )
SetMoveDone( &CBaseDoor::DoorHitTop );
if( FClassnameIs( pev, "func_door_rotating" ) ) // !!! BUGBUG Triggered doors don't work with this yet
{
float sign = 1.0;
float sign = 1.0f;
if( m_hActivator != 0 )
{
@ -621,14 +621,14 @@ void CBaseDoor::DoorGoUp( void )
{
Vector vec = pevActivator->origin - pev->origin;
Vector angles = pevActivator->angles;
angles.x = 0;
angles.z = 0;
angles.x = 0.0f;
angles.z = 0.0f;
UTIL_MakeVectors( angles );
//Vector vnext = ( pevToucher->origin + ( pevToucher->velocity * 10 ) ) - pev->origin;
//Vector vnext = ( pevToucher->origin + ( pevToucher->velocity * 10.f ) ) - pev->origin;
UTIL_MakeVectors( pevActivator->angles );
Vector vnext = ( pevActivator->origin + ( gpGlobals->v_forward * 10 ) ) - pev->origin;
if( ( vec.x * vnext.y - vec.y * vnext.x ) < 0 )
sign = -1.0;
Vector vnext = ( pevActivator->origin + ( gpGlobals->v_forward * 10.f ) ) - pev->origin;
if( ( vec.x * vnext.y - vec.y * vnext.x ) < 0.0f )
sign = -1.0f;
}
}
AngularMove( m_vecAngle2*sign, pev->speed );
@ -645,7 +645,7 @@ void CBaseDoor::DoorHitTop( void )
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
{
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1.0f, ATTN_NORM );
}
ASSERT( m_toggle_state == TS_GOING_UP );
@ -664,9 +664,9 @@ void CBaseDoor::DoorHitTop( void )
pev->nextthink = pev->ltime + m_flWait;
SetThink( &CBaseDoor::DoorGoDown );
if( m_flWait == -1 )
if( m_flWait == -1.0f )
{
pev->nextthink = -1;
pev->nextthink = -1.0f;
}
}
@ -684,7 +684,7 @@ void CBaseDoor::DoorGoDown( void )
{
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
if( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ), 1, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ), 1.0f, ATTN_NORM );
#ifdef DOOR_ASSERT
ASSERT( m_toggle_state == TS_AT_TOP );
#endif // DOOR_ASSERT
@ -705,7 +705,7 @@ void CBaseDoor::DoorHitBottom( void )
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
{
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1.0f, ATTN_NORM );
}
ASSERT( m_toggle_state == TS_GOING_DOWN );
@ -745,7 +745,7 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
if( m_flWait >= 0 )
if( m_flWait >= 0.0f )
{
// BMod Start - Door sound fix.
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
@ -778,7 +778,7 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
{
pDoor = GetClassPtr( (CBaseDoor *)VARS( pentTarget ) );
if( pDoor->m_flWait >= 0 )
if( pDoor->m_flWait >= 0.0f )
{
if( pDoor->pev->velocity == pev->velocity && pDoor->pev->avelocity == pev->velocity )
{
@ -866,7 +866,7 @@ void CRotDoor::Spawn( void )
// check for clockwise rotation
if( FBitSet( pev->spawnflags, SF_DOOR_ROTATE_BACKWARDS ) )
pev->movedir = pev->movedir * -1;
pev->movedir = pev->movedir * -1.0f;
//m_flWait = 2; who the hell did this? (sjb)
m_vecAngle1 = pev->angles;
@ -883,8 +883,8 @@ void CRotDoor::Spawn( void )
UTIL_SetOrigin( pev, pev->origin );
SET_MODEL( ENT( pev ), STRING( pev->model ) );
if( pev->speed == 0 )
pev->speed = 100;
if( pev->speed == 0.0f )
pev->speed = 100.0f;
// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
// but spawn in the open position
@ -895,7 +895,7 @@ void CRotDoor::Spawn( void )
Vector vecSav = m_vecAngle1;
m_vecAngle2 = m_vecAngle1;
m_vecAngle1 = vecSav;
pev->movedir = pev->movedir * -1;
pev->movedir = pev->movedir * -1.0f;
}
m_toggle_state = TS_AT_BOTTOM;
@ -958,14 +958,14 @@ void CMomentaryDoor::Spawn( void )
UTIL_SetOrigin( pev, pev->origin );
SET_MODEL( ENT( pev ), STRING( pev->model ) );
if( pev->speed == 0 )
pev->speed = 100;
if( pev->dmg == 0 )
pev->dmg = 2;
if( pev->speed == 0.0f )
pev->speed = 100.0f;
if( pev->dmg == 0.0f )
pev->dmg = 2.0f;
m_vecPosition1 = pev->origin;
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
m_vecPosition2 = m_vecPosition1 + ( pev->movedir * ( fabs( pev->movedir.x * ( pev->size.x - 2 ) ) + fabs( pev->movedir.y * ( pev->size.y - 2 ) ) + fabs( pev->movedir.z * ( pev->size.z - 2 ) ) - m_flLip ) );
m_vecPosition2 = m_vecPosition1 + ( pev->movedir * ( fabs( pev->movedir.x * ( pev->size.x - 2.0f ) ) + fabs( pev->movedir.y * ( pev->size.y - 2.0f ) ) + fabs( pev->movedir.z * ( pev->size.z - 2.0f ) ) - m_flLip ) );
ASSERTSZ( m_vecPosition1 != m_vecPosition2, "door start/end positions are equal" );
if( FBitSet( pev->spawnflags, SF_DOOR_START_OPEN ) )
@ -1089,23 +1089,23 @@ void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
if( useType != USE_SET ) // Momentary buttons will pass down a float in here
return;
if( value > 1.0 )
value = 1.0;
if( value < 0.0 )
value = 0.0;
if( value > 1.0f )
value = 1.0f;
if( value < 0.0f )
value = 0.0f;
Vector move = m_vecPosition1 + ( value * ( m_vecPosition2 - m_vecPosition1 ) );
Vector delta = move - pev->origin;
//float speed = delta.Length() * 10;
float speed = delta.Length() / 0.1; // move there in 0.1 sec
//float speed = delta.Length() * 10.0f;
float speed = delta.Length() / 0.1f; // move there in 0.1 sec
if( speed != 0 )
{
// This entity only thinks when it moves, so if it's thinking, it's in the process of moving
// play the sound when it starts moving(not yet thinking)
if( pev->nextthink < pev->ltime || pev->nextthink == 0 )
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ), 1, ATTN_NORM );
if( pev->nextthink < pev->ltime || pev->nextthink == 0.0f )
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ), 1.0f, ATTN_NORM );
// If we already moving to designated point, return
else if( move == m_vecFinalDest )
return;
@ -1118,13 +1118,13 @@ void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
void CMomentaryDoor::MomentaryMoveDone( void )
{
SetThink(&CMomentaryDoor::StopMoveSound);
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
}
void CMomentaryDoor::StopMoveSound()
{
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM );
pev->nextthink = -1;
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1.0f, ATTN_NORM );
pev->nextthink = -1.0f;
ResetThink();
}

View File

@ -85,7 +85,7 @@ void CBubbling::Spawn( void )
if( !( pev->spawnflags & SF_BUBBLES_STARTOFF ) )
{
SetThink( &CBubbling::FizzThink );
pev->nextthink = gpGlobals->time + 2.0;
pev->nextthink = gpGlobals->time + 2.0f;
m_state = 1;
}
else
@ -105,7 +105,7 @@ void CBubbling::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
if( m_state )
{
SetThink( &CBubbling::FizzThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
else
{
@ -145,9 +145,9 @@ void CBubbling::FizzThink( void )
MESSAGE_END();
if( m_frequency > 19 )
pev->nextthink = gpGlobals->time + 0.5;
pev->nextthink = gpGlobals->time + 0.5f;
else
pev->nextthink = gpGlobals->time + 2.5 - ( 0.1 * m_frequency );
pev->nextthink = gpGlobals->time + 2.5f - ( 0.1f * m_frequency );
}
// --------------------------------------------------
@ -453,7 +453,7 @@ void CLightning::Spawn( void )
if( pev->dmg > 0 )
{
SetThink( &CLightning::DamageThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
if( pev->targetname )
{
@ -479,7 +479,7 @@ void CLightning::Spawn( void )
if( FStringNull( pev->targetname ) || FBitSet( pev->spawnflags, SF_BEAM_STARTON ) )
{
SetThink( &CLightning::StrikeThink );
pev->nextthink = gpGlobals->time + 1.0;
pev->nextthink = gpGlobals->time + 1.0f;
}
}
}
@ -593,7 +593,7 @@ void CLightning::StrikeUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
else
{
SetThink( &CLightning::StrikeThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
if( !FBitSet( pev->spawnflags, SF_BEAM_TOGGLE ) )
@ -615,7 +615,7 @@ void CLightning::StrikeThink( void )
if( m_life != 0 )
{
if( pev->spawnflags & SF_BEAM_RANDOM )
pev->nextthink = gpGlobals->time + m_life + RANDOM_FLOAT( 0, m_restrike );
pev->nextthink = gpGlobals->time + m_life + RANDOM_FLOAT( 0.0f, m_restrike );
else
pev->nextthink = gpGlobals->time + m_life + m_restrike;
}
@ -695,7 +695,7 @@ void CLightning::StrikeThink( void )
WRITE_SHORT( m_spriteTexture );
WRITE_BYTE( m_frameStart ); // framestart
WRITE_BYTE( (int)pev->framerate ); // framerate
WRITE_BYTE( (int)( m_life * 10.0 ) ); // life
WRITE_BYTE( (int)( m_life * 10.0f ) ); // life
WRITE_BYTE( m_boltWidth ); // width
WRITE_BYTE( m_noiseAmplitude ); // noise
WRITE_BYTE( (int)pev->rendercolor.x ); // r, g, b
@ -717,7 +717,7 @@ void CLightning::StrikeThink( void )
void CBeam::BeamDamage( TraceResult *ptr )
{
RelinkBeam();
if( ptr->flFraction != 1.0 && ptr->pHit != NULL )
if( ptr->flFraction != 1.0f && ptr->pHit != NULL )
{
CBaseEntity *pHit = CBaseEntity::Instance( ptr->pHit );
if( pHit )
@ -737,7 +737,7 @@ void CBeam::BeamDamage( TraceResult *ptr )
void CLightning::DamageThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
TraceResult tr;
UTIL_TraceLine( GetStartPos(), GetEndPos(), dont_ignore_monsters, NULL, &tr );
BeamDamage( &tr );
@ -757,7 +757,7 @@ void CLightning::Zap( const Vector &vecSrc, const Vector &vecDest )
WRITE_SHORT( m_spriteTexture );
WRITE_BYTE( m_frameStart ); // framestart
WRITE_BYTE( (int)pev->framerate ); // framerate
WRITE_BYTE( (int)( m_life * 10.0) ); // life
WRITE_BYTE( (int)( m_life * 10.0f ) ); // life
WRITE_BYTE( m_boltWidth ); // width
WRITE_BYTE( m_noiseAmplitude ); // noise
WRITE_BYTE( (int)pev->rendercolor.x ); // r, g, b
@ -792,32 +792,32 @@ void CLightning::RandomArea( void )
{
Vector vecSrc = pev->origin;
Vector vecDir1 = Vector( RANDOM_FLOAT( -1.0, 1.0 ), RANDOM_FLOAT( -1.0, 1.0 ),RANDOM_FLOAT( -1.0, 1.0 ) );
Vector vecDir1 = Vector( RANDOM_FLOAT( -1.0f, 1.0f ), RANDOM_FLOAT( -1.0f, 1.0f ),RANDOM_FLOAT( -1.0f, 1.0f ) );
vecDir1 = vecDir1.Normalize();
TraceResult tr1;
UTIL_TraceLine( vecSrc, vecSrc + vecDir1 * m_radius, ignore_monsters, ENT( pev ), &tr1 );
if( tr1.flFraction == 1.0 )
if( tr1.flFraction == 1.0f )
continue;
Vector vecDir2;
do
{
vecDir2 = Vector( RANDOM_FLOAT( -1.0, 1.0 ), RANDOM_FLOAT( -1.0, 1.0 ),RANDOM_FLOAT( -1.0, 1.0 ) );
} while( DotProduct( vecDir1, vecDir2 ) > 0 );
vecDir2 = Vector( RANDOM_FLOAT( -1.0f, 1.0f ), RANDOM_FLOAT( -1.0f, 1.0f ),RANDOM_FLOAT( -1.0f, 1.0f ) );
} while( DotProduct( vecDir1, vecDir2 ) > 0.0f );
vecDir2 = vecDir2.Normalize();
TraceResult tr2;
UTIL_TraceLine( vecSrc, vecSrc + vecDir2 * m_radius, ignore_monsters, ENT( pev ), &tr2 );
if( tr2.flFraction == 1.0 )
if( tr2.flFraction == 1.0f )
continue;
if( ( tr1.vecEndPos - tr2.vecEndPos ).Length() < m_radius * 0.1 )
if( ( tr1.vecEndPos - tr2.vecEndPos ).Length() < m_radius * 0.1f )
continue;
UTIL_TraceLine( tr1.vecEndPos, tr2.vecEndPos, ignore_monsters, ENT( pev ), &tr2 );
if( tr2.flFraction != 1.0 )
if( tr2.flFraction != 1.0f )
continue;
Zap( tr1.vecEndPos, tr2.vecEndPos );
@ -832,15 +832,15 @@ void CLightning::RandomPoint( Vector &vecSrc )
for( iLoops = 0; iLoops < 10; iLoops++ )
{
Vector vecDir1 = Vector( RANDOM_FLOAT( -1.0, 1.0 ), RANDOM_FLOAT( -1.0, 1.0 ),RANDOM_FLOAT( -1.0, 1.0 ) );
Vector vecDir1 = Vector( RANDOM_FLOAT( -1.0f, 1.0f ), RANDOM_FLOAT( -1.0f, 1.0f ), RANDOM_FLOAT( -1.0f, 1.0f ) );
vecDir1 = vecDir1.Normalize();
TraceResult tr1;
UTIL_TraceLine( vecSrc, vecSrc + vecDir1 * m_radius, ignore_monsters, ENT( pev ), &tr1 );
if( ( tr1.vecEndPos - vecSrc ).Length() < m_radius * 0.1 )
if( ( tr1.vecEndPos - vecSrc ).Length() < m_radius * 0.1f )
continue;
if( tr1.flFraction == 1.0 )
if( tr1.flFraction == 1.0f )
continue;
Zap( vecSrc, tr1.vecEndPos );
@ -1066,7 +1066,7 @@ void CLaser::StrikeThink( void )
UTIL_TraceLine( pev->origin, m_firePosition, dont_ignore_monsters, NULL, &tr );
FireAtPoint( tr );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
class CGlow : public CPointEntity
@ -1104,8 +1104,8 @@ void CGlow::Spawn( void )
SET_MODEL( ENT( pev ), STRING( pev->model ) );
m_maxFrame = (float) MODEL_FRAMES( pev->modelindex ) - 1;
if( m_maxFrame > 1.0 && pev->framerate != 0 )
pev->nextthink = gpGlobals->time + 0.1;
if( m_maxFrame > 1.0f && pev->framerate != 0 )
pev->nextthink = gpGlobals->time + 0.1f;
m_lastTime = gpGlobals->time;
}
@ -1114,7 +1114,7 @@ void CGlow::Think( void )
{
Animate( pev->framerate * ( gpGlobals->time - m_lastTime ) );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_lastTime = gpGlobals->time;
}
@ -1197,7 +1197,7 @@ void CSprite::AnimateThink( void )
{
Animate( pev->framerate * ( gpGlobals->time - m_lastTime ) );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_lastTime = gpGlobals->time;
}
@ -1234,7 +1234,7 @@ void CSprite::ExpandThink( void )
}
else
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_lastTime = gpGlobals->time;
}
}
@ -1265,7 +1265,7 @@ void CSprite::TurnOff( void )
void CSprite::TurnOn( void )
{
pev->effects = 0;
if( ( pev->framerate && m_maxFrame > 1.0 ) || ( pev->spawnflags & SF_SPRITE_ONCE ) )
if( ( pev->framerate && m_maxFrame > 1.0f ) || ( pev->spawnflags & SF_SPRITE_ONCE ) )
{
SetThink( &CSprite::AnimateThink );
pev->nextthink = gpGlobals->time;
@ -1422,9 +1422,9 @@ void CGibShooter::ShootThink( void )
vecShootDir = pev->movedir;
vecShootDir = vecShootDir + gpGlobals->v_right * RANDOM_FLOAT( -1, 1 ) * m_flVariance;;
vecShootDir = vecShootDir + gpGlobals->v_forward * RANDOM_FLOAT( -1, 1 ) * m_flVariance;;
vecShootDir = vecShootDir + gpGlobals->v_up * RANDOM_FLOAT( -1, 1 ) * m_flVariance;;
vecShootDir = vecShootDir + gpGlobals->v_right * RANDOM_FLOAT( -1.0f, 1.0f ) * m_flVariance;;
vecShootDir = vecShootDir + gpGlobals->v_forward * RANDOM_FLOAT( -1.0f, 1.0f ) * m_flVariance;;
vecShootDir = vecShootDir + gpGlobals->v_up * RANDOM_FLOAT( -1.0f, 1.0f ) * m_flVariance;;
vecShootDir = vecShootDir.Normalize();
CGib *pGib = CreateGib();
@ -1434,12 +1434,12 @@ void CGibShooter::ShootThink( void )
pGib->pev->origin = pev->origin;
pGib->pev->velocity = vecShootDir * m_flGibVelocity;
pGib->pev->avelocity.x = RANDOM_FLOAT( 100, 200 );
pGib->pev->avelocity.y = RANDOM_FLOAT( 100, 300 );
pGib->pev->avelocity.x = RANDOM_FLOAT( 100.0f, 200.0f );
pGib->pev->avelocity.y = RANDOM_FLOAT( 100.0f, 300.0f );
float thinkTime = pGib->pev->nextthink - gpGlobals->time;
pGib->m_lifeTime = ( m_flGibLife * RANDOM_FLOAT( 0.95, 1.05 ) ); // +/- 5%
pGib->m_lifeTime = ( m_flGibLife * RANDOM_FLOAT( 0.95f, 1.05f ) ); // +/- 5%
if( pGib->m_lifeTime < thinkTime )
{
pGib->pev->nextthink = gpGlobals->time + pGib->m_lifeTime;
@ -1584,7 +1584,7 @@ void CTestEffect::TestThink( void )
TraceResult tr;
Vector vecSrc = pev->origin;
Vector vecDir = Vector( RANDOM_FLOAT( -1.0, 1.0 ), RANDOM_FLOAT( -1.0, 1.0 ),RANDOM_FLOAT( -1.0, 1.0 ) );
Vector vecDir = Vector( RANDOM_FLOAT( -1.0f, 1.0f ), RANDOM_FLOAT( -1.0f, 1.0f ),RANDOM_FLOAT( -1.0f, 1.0f ) );
vecDir = vecDir.Normalize();
UTIL_TraceLine( vecSrc, vecSrc + vecDir * 128, ignore_monsters, ENT( pev ), &tr );
@ -1598,7 +1598,7 @@ void CTestEffect::TestThink( void )
m_pBeam[m_iBeam] = pbeam;
m_iBeam++;
#if 0
Vector vecMid = ( vecSrc + tr.vecEndPos ) * 0.5;
Vector vecMid = ( vecSrc + tr.vecEndPos ) * 0.5f;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecMid.x ); // X
@ -1614,15 +1614,15 @@ void CTestEffect::TestThink( void )
#endif
}
if( t < 3.0 )
if( t < 3.0f )
{
for( i = 0; i < m_iBeam; i++ )
{
t = ( gpGlobals->time - m_flBeamTime[i] ) / ( 3 + m_flStartTime - m_flBeamTime[i] );
m_pBeam[i]->SetBrightness( (int)( 255 * t ) );
t = ( gpGlobals->time - m_flBeamTime[i] ) / ( 3.0f + m_flStartTime - m_flBeamTime[i] );
m_pBeam[i]->SetBrightness( (int)( 255.0f * t ) );
// m_pBeam[i]->SetScrollRate( 20 * t );
}
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
else
{
@ -1640,7 +1640,7 @@ void CTestEffect::TestThink( void )
void CTestEffect::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
SetThink( &CTestEffect::TestThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_flStartTime = gpGlobals->time;
}
@ -1740,7 +1740,7 @@ Vector CBlood::BloodPosition( CBaseEntity *pActivator )
else
pPlayer = g_engfuncs.pfnPEntityOfEntIndex( 1 );
if( pPlayer )
return( pPlayer->v.origin + pPlayer->v.view_ofs ) + Vector( RANDOM_FLOAT( -10, 10 ), RANDOM_FLOAT( -10, 10 ), RANDOM_FLOAT( -10, 10 ) );
return( pPlayer->v.origin + pPlayer->v.view_ofs ) + Vector( RANDOM_FLOAT( -10.0f, 10.0f ), RANDOM_FLOAT( -10.0f, 10.0f ), RANDOM_FLOAT( -10.0f, 10.0f ) );
}
return pev->origin;
@ -1760,7 +1760,7 @@ void CBlood::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTyp
TraceResult tr;
UTIL_TraceLine( start, start + forward * BloodAmount() * 2, ignore_monsters, NULL, &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
UTIL_BloodDecalTrace( &tr, Color() );
}
}
@ -1998,8 +1998,8 @@ void CMessage::Spawn( void )
pev->impulse = 0;
// No volume, use normal
if( pev->scale <= 0 )
pev->scale = 1.0;
if( pev->scale <= 0.0f )
pev->scale = 1.0f;
}
void CMessage::Precache( void )
@ -2197,7 +2197,7 @@ void CItemSoda::Spawn( void )
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
SetThink( &CItemSoda::CanThink );
pev->nextthink = gpGlobals->time + 0.5;
pev->nextthink = gpGlobals->time + 0.5f;
}
void CItemSoda::CanThink( void )

View File

@ -32,8 +32,8 @@
#define EGON_SOUND_RUN "weapons/egon_run3.wav"
#define EGON_SOUND_STARTUP "weapons/egon_windup2.wav"
#define EGON_SWITCH_NARROW_TIME 0.75 // Time it takes to switch fire modes
#define EGON_SWITCH_WIDE_TIME 1.5
#define EGON_SWITCH_NARROW_TIME 0.75f // Time it takes to switch fire modes
#define EGON_SWITCH_WIDE_TIME 1.5f
enum egon_e {
EGON_IDLE1 = 0,
@ -105,7 +105,7 @@ int CEgon::AddToPlayer( CBasePlayer *pPlayer )
void CEgon::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
SendWeaponAnim( EGON_HOLSTER );
EndAttack();
@ -190,20 +190,20 @@ void CEgon::Attack( void )
{
if( !HasAmmo() )
{
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.25;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.25f;
PlayEmptySound( );
return;
}
m_flAmmoUseTime = gpGlobals->time;// start using ammo ASAP.
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, m_fireState, m_fireMode, 1, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, m_fireState, m_fireMode, 1, 0 );
m_shakeTime = 0;
m_pPlayer->m_iWeaponVolume = EGON_PRIMARY_VOLUME;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1;
pev->fuser1 = UTIL_WeaponTimeBase() + 2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1f;
pev->fuser1 = UTIL_WeaponTimeBase() + 2.0f;
pev->dmgtime = gpGlobals->time + GetPulseInterval();
m_fireState = FIRE_CHARGE;
@ -216,14 +216,14 @@ void CEgon::Attack( void )
if( pev->fuser1 <= UTIL_WeaponTimeBase() )
{
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0, g_vecZero, g_vecZero, 0.0, 0.0, m_fireState, m_fireMode, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, m_fireState, m_fireMode, 0, 0 );
pev->fuser1 = 1000;
}
if( !HasAmmo() )
{
EndAttack();
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0f;
}
break;
}
@ -238,12 +238,12 @@ void CEgon::PrimaryAttack( void )
void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
{
Vector vecDest = vecOrigSrc + vecDir * 2048;
Vector vecDest = vecOrigSrc + vecDir * 2048.0f;
edict_t *pentIgnore;
TraceResult tr;
pentIgnore = m_pPlayer->edict();
Vector tmpSrc = vecOrigSrc + gpGlobals->v_up * -8 + gpGlobals->v_right * 3;
Vector tmpSrc = vecOrigSrc + gpGlobals->v_up * -8.0f + gpGlobals->v_right * 3.0f;
// ALERT( at_console, "." );
@ -292,7 +292,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
if( gpGlobals->time >= m_flAmmoUseTime )
{
UseAmmo( 1 );
m_flAmmoUseTime = gpGlobals->time + 0.1;
m_flAmmoUseTime = gpGlobals->time + 0.1f;
}
}
else
@ -301,7 +301,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
if( gpGlobals->time >= m_flAmmoUseTime )
{
UseAmmo( 1 );
m_flAmmoUseTime = gpGlobals->time + 0.166;
m_flAmmoUseTime = gpGlobals->time + 0.166f;
}
}
@ -325,7 +325,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
if( g_pGameRules->IsMultiplayer() )
{
// radius damage a little more potent in multiplayer.
::RadiusDamage( tr.vecEndPos, pev, m_pPlayer->pev, gSkillData.plrDmgEgonWide/4, 128, CLASS_NONE, DMG_ENERGYBEAM | DMG_BLAST | DMG_ALWAYSGIB );
::RadiusDamage( tr.vecEndPos, pev, m_pPlayer->pev, gSkillData.plrDmgEgonWide * 0.25f, 128, CLASS_NONE, DMG_ENERGYBEAM | DMG_BLAST | DMG_ALWAYSGIB );
}
if( !m_pPlayer->IsAlive() )
@ -337,7 +337,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
if( gpGlobals->time >= m_flAmmoUseTime )
{
UseAmmo( 1 );
m_flAmmoUseTime = gpGlobals->time + 0.2;
m_flAmmoUseTime = gpGlobals->time + 0.2f;
}
}
else
@ -346,15 +346,15 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
if( gpGlobals->time >= m_flAmmoUseTime )
{
UseAmmo( 1 );
m_flAmmoUseTime = gpGlobals->time + 0.1;
m_flAmmoUseTime = gpGlobals->time + 0.1f;
}
}
pev->dmgtime = gpGlobals->time + GetDischargeInterval();
if( m_shakeTime < gpGlobals->time )
{
UTIL_ScreenShake( tr.vecEndPos, 5.0, 150.0, 0.75, 250.0 );
m_shakeTime = gpGlobals->time + 1.5;
UTIL_ScreenShake( tr.vecEndPos, 5.0f, 150.0f, 0.75f, 250.0f );
m_shakeTime = gpGlobals->time + 1.5f;
}
}
#endif
@ -384,12 +384,12 @@ void CEgon::UpdateEffect( const Vector &startPoint, const Vector &endPoint, floa
m_pBeam->SetWidth( (int)( 40 - ( timeBlend * 20 ) ) );
if( m_fireMode == FIRE_WIDE )
m_pBeam->SetColor( (int)( 30 + ( 25 * timeBlend ) ), (int)( 30 + ( 30 * timeBlend ) ), (int)( 64 + 80 * fabs( sin( gpGlobals->time * 10 ) ) ) );
m_pBeam->SetColor( (int)( 30 + ( 25 * timeBlend ) ), (int)( 30 + ( 30 * timeBlend ) ), (int)( 64 + 80 * fabs( sin( gpGlobals->time * 10.0f ) ) ) );
else
m_pBeam->SetColor( (int)( 60 + ( 25 * timeBlend ) ), (int)( 120 + ( 30 * timeBlend ) ), (int)( 64 + 80 * fabs( sin( gpGlobals->time *10 ) ) ) );
m_pBeam->SetColor( (int)( 60 + ( 25 * timeBlend ) ), (int)( 120 + ( 30 * timeBlend ) ), (int)( 64 + 80 * fabs( sin( gpGlobals->time * 10.0f ) ) ) );
UTIL_SetOrigin( m_pSprite->pev, endPoint );
m_pSprite->pev->frame += 8 * gpGlobals->frametime;
m_pSprite->pev->frame += 8.0f * gpGlobals->frametime;
if( m_pSprite->pev->frame > m_pSprite->Frames() )
m_pSprite->pev->frame = 0;
@ -480,17 +480,17 @@ void CEgon::WeaponIdle( void )
int iAnim;
float flRand = RANDOM_FLOAT( 0, 1 );
float flRand = RANDOM_FLOAT( 0.0f, 1.0f );
if( flRand <= 0.5 )
if( flRand <= 0.5f )
{
iAnim = EGON_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
}
else
{
iAnim = EGON_FIDGET1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;
}
SendWeaponAnim( iAnim );
@ -504,10 +504,10 @@ void CEgon::EndAttack( void )
if( m_fireState != FIRE_OFF ) //Checking the button just in case!.
bMakeNoise = true;
PLAYBACK_EVENT_FULL( FEV_GLOBAL | FEV_RELIABLE, m_pPlayer->edict(), m_usEgonStop, 0, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, bMakeNoise, 0, 0, 0 );
PLAYBACK_EVENT_FULL( FEV_GLOBAL | FEV_RELIABLE, m_pPlayer->edict(), m_usEgonStop, 0.0f, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0f, 0.0f, bMakeNoise, 0, 0, 0 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
m_fireState = FIRE_OFF;

View File

@ -38,21 +38,21 @@ LINK_ENTITY_TO_CLASS( spark_shower, CShower )
void CShower::Spawn( void )
{
pev->velocity = RANDOM_FLOAT( 200, 300 ) * pev->angles;
pev->velocity.x += RANDOM_FLOAT( -100.f, 100.f );
pev->velocity.y += RANDOM_FLOAT( -100.f, 100.f );
pev->velocity = RANDOM_FLOAT( 200.0f, 300.0f ) * pev->angles;
pev->velocity.x += RANDOM_FLOAT( -100.0f, 100.0f );
pev->velocity.y += RANDOM_FLOAT( -100.0f, 100.0f );
if( pev->velocity.z >= 0 )
pev->velocity.z += 200;
pev->velocity.z += 200.0f;
else
pev->velocity.z -= 200;
pev->velocity.z -= 200.0f;
pev->movetype = MOVETYPE_BOUNCE;
pev->gravity = 0.5;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->solid = SOLID_NOT;
SET_MODEL( edict(), "models/grenade.mdl" ); // Need a model, just use the grenade, we don't draw it anyway
UTIL_SetSize( pev, g_vecZero, g_vecZero );
pev->effects |= EF_NODRAW;
pev->speed = RANDOM_FLOAT( 0.5, 1.5 );
pev->speed = RANDOM_FLOAT( 0.5f, 1.5f );
pev->angles = g_vecZero;
}
@ -61,9 +61,9 @@ void CShower::Think( void )
{
UTIL_Sparks( pev->origin );
pev->speed -= 0.1;
if( pev->speed > 0 )
pev->nextthink = gpGlobals->time + 0.1;
pev->speed -= 0.1f;
if( pev->speed > 0.0f )
pev->nextthink = gpGlobals->time + 0.1f;
else
UTIL_Remove( this );
pev->flags &= ~FL_ONGROUND;
@ -72,12 +72,12 @@ void CShower::Think( void )
void CShower::Touch( CBaseEntity *pOther )
{
if( pev->flags & FL_ONGROUND )
pev->velocity = pev->velocity * 0.1;
pev->velocity = pev->velocity * 0.1f;
else
pev->velocity = pev->velocity * 0.6;
pev->velocity = pev->velocity * 0.6f;
if( ( pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y ) < 10.0 )
pev->speed = 0;
if( ( pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y ) < 10.0f )
pev->speed = 0.0f;
}
class CEnvExplosion : public CBaseMonster
@ -130,17 +130,17 @@ void CEnvExplosion::Spawn( void )
*/
float flSpriteScale;
flSpriteScale = ( m_iMagnitude - 50 ) * 0.6;
flSpriteScale = ( m_iMagnitude - 50 ) * 0.6f;
/*
if( flSpriteScale > 50 )
if( flSpriteScale > 50.0f )
{
flSpriteScale = 50;
flSpriteScale = 50.0f;
}
*/
if( flSpriteScale < 10 )
if( flSpriteScale < 10.0f )
{
flSpriteScale = 10;
flSpriteScale = 10.0f;
}
m_spriteScale = (int)flSpriteScale;
@ -155,14 +155,14 @@ void CEnvExplosion::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
Vector vecSpot;// trace starts here!
vecSpot = pev->origin + Vector( 0, 0, 8 );
vecSpot = pev->origin + Vector( 0.0f, 0.0f, 8.0f );
UTIL_TraceLine( vecSpot, vecSpot + Vector( 0, 0, -40 ), ignore_monsters, ENT( pev ), &tr );
UTIL_TraceLine( vecSpot, vecSpot + Vector( 0.0f, 0.0f, -40.0f ), ignore_monsters, ENT( pev ), &tr );
// Pull out of the wall a bit
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
pev->origin = tr.vecEndPos + ( tr.vecPlaneNormal * ( m_iMagnitude - 24 ) * 0.6 );
pev->origin = tr.vecEndPos + ( tr.vecPlaneNormal * ( m_iMagnitude - 24 ) * 0.6f );
}
else
{
@ -172,7 +172,7 @@ void CEnvExplosion::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
// draw decal
if( !( pev->spawnflags & SF_ENVEXPLOSION_NODECAL ) )
{
if( RANDOM_FLOAT( 0, 1 ) < 0.5 )
if( RANDOM_FLOAT( 0.0f, 1.0f ) < 0.5f )
{
UTIL_DecalTrace( &tr, DECAL_SCORCH1 );
}
@ -217,7 +217,7 @@ void CEnvExplosion::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
}
SetThink( &CEnvExplosion::Smoke );
pev->nextthink = gpGlobals->time + 0.3;
pev->nextthink = gpGlobals->time + 0.3f;
// draw sparks
if( !( pev->spawnflags & SF_ENVEXPLOSION_NOSPARKS ) )

View File

@ -63,10 +63,14 @@ typedef int BOOL;
#endif //_WIN32
// Misc C-runtime library headers
#include "stdio.h"
#include "stdlib.h"
#include "stddef.h"
#include "math.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <cmath>
#ifndef M_PI_F
#define M_PI_F (float)M_PI
#endif
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
#define XASH_64BIT

View File

@ -36,18 +36,18 @@ int CFlyingMonster::CheckLocalMove( const Vector &vecStart, const Vector &vecEnd
TraceResult tr;
UTIL_TraceHull( vecStart + Vector( 0, 0, 32 ), vecEnd + Vector( 0, 0, 32 ), dont_ignore_monsters, large_hull, edict(), &tr );
UTIL_TraceHull( vecStart + Vector( 0.0f, 0.0f, 32.0f ), vecEnd + Vector( 0.0f, 0.0f, 32.0f ), dont_ignore_monsters, large_hull, edict(), &tr );
// ALERT( at_console, "%.0f %.0f %.0f : ", vecStart.x, vecStart.y, vecStart.z );
// ALERT( at_console, "%.0f %.0f %.0f\n", vecEnd.x, vecEnd.y, vecEnd.z );
if( pflDist )
{
*pflDist = ( ( tr.vecEndPos - Vector( 0, 0, 32 ) ) - vecStart ).Length();// get the distance.
*pflDist = ( ( tr.vecEndPos - Vector( 0.0f, 0.0f, 32.0f ) ) - vecStart ).Length();// get the distance.
}
// ALERT( at_console, "check %d %d %f\n", tr.fStartSolid, tr.fAllSolid, tr.flFraction );
if( tr.fStartSolid || tr.flFraction < 1.0 )
if( tr.fStartSolid || tr.flFraction < 1.0f )
{
if( pTarget && pTarget->edict() == gpGlobals->trace_ent )
return LOCALMOVE_VALID;
@ -78,8 +78,8 @@ void CFlyingMonster::Stop( void )
m_flightSpeed = 0;
m_IdealActivity = stopped;
}
pev->angles.z = 0;
pev->angles.x = 0;
pev->angles.z = 0.0f;
pev->angles.x = 0.0f;
m_vecTravel = g_vecZero;
}
@ -88,16 +88,16 @@ float CFlyingMonster::ChangeYaw( int speed )
if( pev->movetype == MOVETYPE_FLY )
{
float diff = FlYawDiff();
float target = 0;
float target = 0.0f;
if( m_IdealActivity != GetStoppedActivity() )
{
if( diff < -20 )
target = 90;
else if( diff > 20 )
target = -90;
if( diff < -20.0f )
target = 90.0f;
else if( diff > 20.0f )
target = -90.0f;
}
pev->angles.z = UTIL_Approach( target, pev->angles.z, 220.0 * gpGlobals->frametime );
pev->angles.z = UTIL_Approach( target, pev->angles.z, 220.0f * gpGlobals->frametime );
}
return CBaseMonster::ChangeYaw( speed );
}
@ -141,7 +141,7 @@ BOOL CFlyingMonster::ShouldAdvanceRoute( float flWaypointDist )
if( m_Route[m_iRouteIndex].iType & bits_MF_IS_GOAL )
flWaypointDist = ( m_Route[m_iRouteIndex].vecLocation - pev->origin ).Length();
if( flWaypointDist <= 64 + ( m_flGroundSpeed * gpGlobals->frametime ) )
if( flWaypointDist <= 64.0f + ( m_flGroundSpeed * gpGlobals->frametime ) )
return TRUE;
return FALSE;
@ -151,7 +151,7 @@ void CFlyingMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir,
{
if( pev->movetype == MOVETYPE_FLY )
{
if( gpGlobals->time - m_stopTime > 1.0 )
if( gpGlobals->time - m_stopTime > 1.0f )
{
if( m_IdealActivity != m_movementActivity )
{
@ -163,12 +163,12 @@ void CFlyingMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir,
if( m_IdealActivity != m_movementActivity )
{
m_flightSpeed = UTIL_Approach( 100, m_flightSpeed, 75 * gpGlobals->frametime );
m_flightSpeed = UTIL_Approach( 100, m_flightSpeed, 75.0f * gpGlobals->frametime );
if( m_flightSpeed < 100 )
m_stopTime = gpGlobals->time;
}
else
m_flightSpeed = UTIL_Approach( 20, m_flightSpeed, 300 * gpGlobals->frametime );
m_flightSpeed = UTIL_Approach( 20, m_flightSpeed, 300.0f * gpGlobals->frametime );
if( CheckLocalMove( pev->origin, vecMove, pTargetEnt, NULL ) )
{
@ -193,10 +193,10 @@ float CFlyingMonster::CeilingZ( const Vector &position )
Vector minUp = position;
Vector maxUp = position;
maxUp.z += 4096.0;
maxUp.z += 4096.0f;
UTIL_TraceLine( position, maxUp, ignore_monsters, NULL, &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
maxUp.z = tr.vecEndPos.z;
if( ( pev->flags ) & FL_SWIM )
@ -214,7 +214,7 @@ BOOL CFlyingMonster::ProbeZ( const Vector &position, const Vector &probe, float
// SWIMING & !WATER
// or FLYING & WATER
//
*pFraction = 0.0;
*pFraction = 0.0f;
return TRUE; // We hit a water boundary because we are where we don't belong.
}
int conProbe = UTIL_PointContents( probe );
@ -223,7 +223,7 @@ BOOL CFlyingMonster::ProbeZ( const Vector &position, const Vector &probe, float
// The probe is either entirely inside the water (for fish) or entirely
// outside the water (for birds).
//
*pFraction = 1.0;
*pFraction = 1.0f;
return FALSE;
}
@ -233,9 +233,9 @@ BOOL CFlyingMonster::ProbeZ( const Vector &position, const Vector &probe, float
float minProbeLength = 0;
float diff = maxProbeLength - minProbeLength;
while( diff > 1.0 )
while( diff > 1.0f )
{
float midProbeLength = minProbeLength + diff / 2.0;
float midProbeLength = minProbeLength + diff / 2.0f;
Vector midProbeVec = midProbeLength * ProbeUnit;
if( UTIL_PointContents( position + midProbeVec ) == conPosition )
{
@ -257,11 +257,11 @@ float CFlyingMonster::FloorZ( const Vector &position )
TraceResult tr;
Vector down = position;
down.z -= 2048;
down.z -= 2048.0f;
UTIL_TraceLine( position, down, ignore_monsters, NULL, &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
return tr.vecEndPos.z;
return down.z;

View File

@ -271,7 +271,7 @@ void CBreakable::MaterialSoundRandom( edict_t *pEdict, Materials soundMaterial,
pSoundList = MaterialSoundList( soundMaterial, soundCount );
if( soundCount )
EMIT_SOUND( pEdict, CHAN_BODY, pSoundList[RANDOM_LONG( 0, soundCount - 1 )], volume, 1.0 );
EMIT_SOUND( pEdict, CHAN_BODY, pSoundList[RANDOM_LONG( 0, soundCount - 1 )], volume, 1.0f );
}
void CBreakable::Precache( void )
@ -432,7 +432,7 @@ void CBreakable::BreakTouch( CBaseEntity *pOther )
if( FBitSet( pev->spawnflags, SF_BREAK_TOUCH ) )
{
// can be broken when run into
flDamage = pevToucher->velocity.Length() * 0.01;
flDamage = pevToucher->velocity.Length() * 0.01f;
if( flDamage >= pev->health )
{
@ -453,10 +453,10 @@ void CBreakable::BreakTouch( CBaseEntity *pOther )
SetThink( &CBreakable::Die );
SetTouch( NULL );
if( m_flDelay == 0 )
if( m_flDelay == 0.0f )
{
// !!!BUGBUG - why doesn't zero delay work?
m_flDelay = 0.1;
m_flDelay = 0.1f;
}
pev->nextthink = pev->ltime + m_flDelay;
@ -491,7 +491,7 @@ void CBreakable::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec
{
UTIL_Sparks( ptr->vecEndPos );
float flVolume = RANDOM_FLOAT( 0.7 , 1.0 );//random volume range
float flVolume = RANDOM_FLOAT( 0.7f, 1.0f );//random volume range
switch( RANDOM_LONG( 0, 1 ) )
{
case 0:
@ -504,7 +504,7 @@ void CBreakable::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vec
}
break;
case matUnbreakableGlass:
UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 0.5, 1.5 ) );
UTIL_Ricochet( ptr->vecEndPos, RANDOM_FLOAT( 0.5f, 1.5f ) );
break;
default:
break;
@ -527,7 +527,7 @@ int CBreakable::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
// (that is, no actual entity projectile was involved in the attack so use the shooter's origin).
if( pevAttacker == pevInflictor )
{
vecTemp = pevInflictor->origin - ( pev->absmin + ( pev->size * 0.5 ) );
vecTemp = pevInflictor->origin - ( pev->absmin + ( pev->size * 0.5f ) );
// if a client hit the breakable with a crowbar, and breakable is crowbar-sensitive, break it now.
if( FBitSet ( pevAttacker->flags, FL_CLIENT ) &&
@ -537,7 +537,7 @@ int CBreakable::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
else
// an actual missile was involved.
{
vecTemp = pevInflictor->origin - ( pev->absmin + ( pev->size * 0.5 ) );
vecTemp = pevInflictor->origin - ( pev->absmin + ( pev->size * 0.5f ) );
}
if( !IsBreakable() )
@ -545,11 +545,11 @@ int CBreakable::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
// Breakables take double damage from the crowbar
if( bitsDamageType & DMG_CLUB )
flDamage *= 2;
flDamage *= 2.0f;
// Boxes / glass / etc. don't take much poison damage, just the impact of the dart - consider that 10%
if( bitsDamageType & DMG_POISON )
flDamage *= 0.1;
flDamage *= 0.1f;
// this global is still used for glass and other non-monster killables, along with decals.
g_vecAttackDir = vecTemp.Normalize();
@ -586,10 +586,10 @@ void CBreakable::Die( void )
// The more negative pev->health, the louder
// the sound should be.
fvol = RANDOM_FLOAT( 0.85, 1.0 ) + ( fabs( pev->health ) / 100.0 );
fvol = RANDOM_FLOAT( 0.85f, 1.0 ) + ( fabs( pev->health ) / 100.0f );
if( fvol > 1.0 )
fvol = 1.0;
if( fvol > 1.0f )
fvol = 1.0f;
switch( m_Material )
{
@ -667,7 +667,7 @@ void CBreakable::Die( void )
}
if( m_Explosion == expDirected )
vecVelocity = g_vecAttackDir * 200;
vecVelocity = g_vecAttackDir * 200.0f;
else
{
vecVelocity.x = 0;
@ -675,7 +675,7 @@ void CBreakable::Die( void )
vecVelocity.z = 0;
}
vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5;
vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5f;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
WRITE_BYTE( TE_BREAKMODEL );
@ -744,7 +744,7 @@ void CBreakable::Die( void )
SUB_UseTargets( NULL, USE_TOGGLE, 0 );
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
if( m_iszSpawnObject )
CBaseEntity::Create( STRING( m_iszSpawnObject ), VecBModelOrigin( pev ), pev->angles, edict() );
@ -838,7 +838,7 @@ void CPushable::Spawn( void )
UTIL_SetOrigin( pev, pev->origin );
// Multiply by area of the box's cross-section (assume 1000 units^3 standard volume)
pev->skin = (int)( ( pev->skin * ( pev->maxs.x - pev->mins.x ) * ( pev->maxs.y - pev->mins.y ) ) * 0.0005 );
pev->skin = (int)( ( pev->skin * ( pev->maxs.x - pev->mins.x ) * ( pev->maxs.y - pev->mins.y ) ) * 0.0005f );
m_soundTime = 0;
}
@ -862,11 +862,11 @@ void CPushable::KeyValue( KeyValueData *pkvd )
{
case 0:
// Point
UTIL_SetSize( pev, Vector( -8, -8, -8 ), Vector( 8, 8, 8 ) );
UTIL_SetSize( pev, Vector( -8.0f, -8.0f, -8.0f ), Vector( 8.0f, 8.0f, 8.0f ) );
break;
case 2:
// Big Hull!?!? !!!BUGBUG Figure out what this hull really is
UTIL_SetSize( pev, VEC_DUCK_HULL_MIN*2, VEC_DUCK_HULL_MAX * 2 );
UTIL_SetSize( pev, VEC_DUCK_HULL_MIN * 2.0f, VEC_DUCK_HULL_MAX * 2.0f );
break;
case 3:
// Player duck
@ -920,7 +920,7 @@ void CPushable::Move( CBaseEntity *pOther, int push )
{
// Only push if floating
if( pev->waterlevel > 0 )
pev->velocity.z += pevToucher->velocity.z * 0.1;
pev->velocity.z += pevToucher->velocity.z * 0.1f;
return;
}
@ -943,13 +943,13 @@ void CPushable::Move( CBaseEntity *pOther, int push )
if( pev->waterlevel < 1 )
return;
else
factor = 0.1;
factor = 0.1f;
}
else
factor = 1;
factor = 1.0f;
}
else
factor = 0.25;
factor = 0.25f;
pev->velocity.x += pevToucher->velocity.x * factor;
pev->velocity.y += pevToucher->velocity.y * factor;
@ -964,15 +964,15 @@ void CPushable::Move( CBaseEntity *pOther, int push )
{
pevToucher->velocity.x = pev->velocity.x;
pevToucher->velocity.y = pev->velocity.y;
if( ( gpGlobals->time - m_soundTime ) > 0.7 )
if( ( gpGlobals->time - m_soundTime ) > 0.7f )
{
m_soundTime = gpGlobals->time;
if( length > 0 && FBitSet( pev->flags,FL_ONGROUND ) )
{
m_lastSound = RANDOM_LONG( 0, 2 );
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, m_soundNames[m_lastSound], 0.5, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, m_soundNames[m_lastSound], 0.5f, ATTN_NORM );
//SetThink( &StopSound );
//pev->nextthink = pev->ltime + 0.1;
//pev->nextthink = pev->ltime + 0.1f;
}
else
STOP_SOUND( ENT( pev ), CHAN_WEAPON, m_soundNames[m_lastSound] );

View File

@ -66,7 +66,7 @@ public:
virtual int ObjectCaps( void ) { return CBaseEntity :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
inline BOOL IsActive( void ) { return (pev->spawnflags & SF_TANK_ACTIVE)?TRUE:FALSE; }
inline void TankActivate( void ) { pev->spawnflags |= SF_TANK_ACTIVE; pev->nextthink = pev->ltime + 0.1; m_fireLast = 0; }
inline void TankActivate( void ) { pev->spawnflags |= SF_TANK_ACTIVE; pev->nextthink = pev->ltime + 0.1f; m_fireLast = 0; }
inline void TankDeactivate( void ) { pev->spawnflags &= ~SF_TANK_ACTIVE; m_fireLast = 0; StopRotSound(); }
inline BOOL CanFire( void ) { return (gpGlobals->time - m_lastSightTime) < m_persist; }
BOOL InRange( float range );
@ -185,7 +185,7 @@ void CFuncTank::Spawn( void )
m_pitchCenter = pev->angles.x;
if( IsActive() )
pev->nextthink = pev->ltime + 1.0;
pev->nextthink = pev->ltime + 1.0f;
m_sightOrigin = BarrelPosition(); // Point at the end of the barrel
@ -363,7 +363,7 @@ BOOL CFuncTank::StartControl( CBasePlayer *pController )
m_pController->m_iHideHUD |= HIDEHUD_WEAPONS;
m_vecControllerUsePos = m_pController->pev->origin;
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
return TRUE;
}
@ -389,7 +389,7 @@ void CFuncTank::StopControl()
m_pController = NULL;
if( IsActive() )
pev->nextthink = pev->ltime + 1.0;
pev->nextthink = pev->ltime + 1.0f;
}
// Called each frame by the player's ItemPostFrame
@ -405,7 +405,7 @@ void CFuncTank::ControllerPostFrame( void )
Vector vecForward;
UTIL_MakeVectorsPrivate( pev->angles, vecForward, NULL, NULL );
m_fireLast = gpGlobals->time - ( 1 / m_fireRate ) - 0.01; // to make sure the gun doesn't fire too many bullets
m_fireLast = gpGlobals->time - ( 1.0f / m_fireRate ) - 0.01f; // to make sure the gun doesn't fire too many bullets
Fire( BarrelPosition(), vecForward, m_pController->pev );
@ -413,7 +413,7 @@ void CFuncTank::ControllerPostFrame( void )
if( m_pController && m_pController->IsPlayer() )
( (CBasePlayer *)m_pController )->m_iWeaponVolume = LOUD_GUN_VOLUME;
m_flNextAttack = gpGlobals->time + ( 1 / m_fireRate );
m_flNextAttack = gpGlobals->time + ( 1.0f / m_fireRate );
}
}
////////////// END NEW STUFF //////////////
@ -491,19 +491,19 @@ void CFuncTank::TrackTarget( void )
// Tanks attempt to mirror the player's angles
angles = m_pController->pev->v_angle;
angles[0] = 0 - angles[0];
pev->nextthink = pev->ltime + 0.05;
pev->nextthink = pev->ltime + 0.05f;
}
else
{
if( IsActive() )
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
else
return;
if( FNullEnt( pPlayer ) )
{
if( IsActive() )
pev->nextthink = pev->ltime + 2; // Wait 2 secs
pev->nextthink = pev->ltime + 2.0f; // Wait 2 secs
return;
}
pTarget = FindTarget( pPlayer );
@ -520,7 +520,7 @@ void CFuncTank::TrackTarget( void )
UTIL_TraceLine( barrelEnd, targetPosition, dont_ignore_monsters, edict(), &tr );
if( tr.flFraction == 1.0 || tr.pHit == pTarget )
if( tr.flFraction == 1.0f || tr.pHit == pTarget )
{
CBaseEntity *pInstance = CBaseEntity::Instance(pTarget);
if( InRange( range ) && pInstance && pInstance->IsAlive() )
@ -626,12 +626,12 @@ void CFuncTank::AdjustAnglesForBarrel( Vector &angles, float distance )
if( m_barrelPos.y )
{
r2 = m_barrelPos.y * m_barrelPos.y;
angles.y += ( 180.0 / M_PI ) * atan2( m_barrelPos.y, sqrt( d2 - r2 ) );
angles.y += ( 180.0f / M_PI_F ) * atan2( m_barrelPos.y, sqrt( d2 - r2 ) );
}
if( m_barrelPos.z )
{
r2 = m_barrelPos.z * m_barrelPos.z;
angles.x += ( 180.0 / M_PI ) * atan2( -m_barrelPos.z, sqrt( d2 - r2 ) );
angles.x += ( 180.0f / M_PI_F ) * atan2( -m_barrelPos.z, sqrt( d2 - r2 ) );
}
}
}
@ -644,9 +644,9 @@ void CFuncTank::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t
if( m_iszSpriteSmoke )
{
CSprite *pSprite = CSprite::SpriteCreate( STRING( m_iszSpriteSmoke ), barrelEnd, TRUE );
pSprite->AnimateAndDie( RANDOM_FLOAT( 15.0, 20.0 ) );
pSprite->AnimateAndDie( RANDOM_FLOAT( 15.0f, 20.0f ) );
pSprite->SetTransparency( kRenderTransAlpha, (int)pev->rendercolor.x, (int)pev->rendercolor.y, (int)pev->rendercolor.z, 255, kRenderFxNone );
pSprite->pev->velocity.z = RANDOM_FLOAT( 40, 80 );
pSprite->pev->velocity.z = RANDOM_FLOAT( 40.0f, 80.0f );
pSprite->SetScale( m_spriteScale );
}
if( m_iszSpriteFlash )
@ -657,7 +657,7 @@ void CFuncTank::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t
pSprite->SetScale( m_spriteScale );
// Hack Hack, make it stick around for at least 100 ms.
pSprite->pev->nextthink += 0.1;
pSprite->pev->nextthink += 0.1f;
}
SUB_UseTargets( this, USE_TOGGLE, 0 );
}
@ -670,8 +670,8 @@ void CFuncTank::TankTrace( const Vector &vecStart, const Vector &vecForward, con
float x, y, z;
do
{
x = RANDOM_FLOAT( -0.5, 0.5 ) + RANDOM_FLOAT( -0.5, 0.5 );
y = RANDOM_FLOAT( -0.5, 0.5 ) + RANDOM_FLOAT( -0.5, 0.5 );
x = RANDOM_FLOAT( -0.5f, 0.5f ) + RANDOM_FLOAT( -0.5f, 0.5f );
y = RANDOM_FLOAT( -0.5f, 0.5f ) + RANDOM_FLOAT( -0.5f, 0.5f );
z = x * x + y * y;
} while( z > 1 );
Vector vecDir = vecForward +
@ -847,7 +847,7 @@ void CFuncTankLaser::Fire( const Vector &barrelEnd, const Vector &forward, entva
m_laserTime = gpGlobals->time;
m_pLaser->TurnOn();
m_pLaser->pev->dmgtime = gpGlobals->time - 1.0;
m_pLaser->pev->dmgtime = gpGlobals->time - 1.0f;
m_pLaser->FireAtPoint( tr );
m_pLaser->pev->nextthink = 0;
}
@ -1014,7 +1014,7 @@ void CFuncTankControls::Spawn( void )
UTIL_SetSize( pev, pev->mins, pev->maxs );
UTIL_SetOrigin( pev, pev->origin );
pev->nextthink = gpGlobals->time + 0.3; // After all the func_tank's have spawned
pev->nextthink = gpGlobals->time + 0.3f; // After all the func_tank's have spawned
CBaseEntity::Spawn();
}

View File

@ -34,7 +34,7 @@
//=========================================================
// Gargantua Monster
//=========================================================
const float GARG_ATTACKDIST = 80.0;
const float GARG_ATTACKDIST = 80.0f;
// Garg animation events
#define GARG_AE_SLASH_LEFT 1
@ -43,7 +43,7 @@ const float GARG_ATTACKDIST = 80.0;
#define GARG_AE_RIGHT_FOOT 4
#define GARG_AE_STOMP 5
#define GARG_AE_BREATHE 6
#define STOMP_FRAMETIME 0.015 // gpGlobals->frametime
#define STOMP_FRAMETIME 0.015f // gpGlobals->frametime
// Gargantua is immune to any damage but this
#define GARG_DAMAGE (DMG_ENERGYBEAM|DMG_CRUSH|DMG_MORTAR|DMG_BLAST)
@ -114,16 +114,16 @@ void CStomp::Spawn( void )
pev->model = MAKE_STRING( GARG_STOMP_SPRITE_NAME );
pev->rendermode = kRenderTransTexture;
pev->renderamt = 0;
EMIT_SOUND_DYN( edict(), CHAN_BODY, GARG_STOMP_BUZZ_SOUND, 1, ATTN_NORM, 0, PITCH_NORM * 0.55 );
EMIT_SOUND_DYN( edict(), CHAN_BODY, GARG_STOMP_BUZZ_SOUND, 1, ATTN_NORM, 0, PITCH_NORM * 0.55f );
}
#define STOMP_INTERVAL 0.025
#define STOMP_INTERVAL 0.025f
void CStomp::Think( void )
{
TraceResult tr;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
// Do damage for this frame
Vector vecStart = pev->origin;
@ -145,7 +145,7 @@ void CStomp::Think( void )
// Accelerate the effect
pev->speed = pev->speed + ( STOMP_FRAMETIME ) * pev->framerate;
pev->framerate = pev->framerate + ( STOMP_FRAMETIME ) * 1500;
pev->framerate = pev->framerate + ( STOMP_FRAMETIME ) * 1500.0f;
// Move and spawn trails
while( gpGlobals->time - pev->dmgtime > STOMP_INTERVAL )
@ -158,9 +158,9 @@ void CStomp::Think( void )
{
UTIL_TraceLine( pev->origin, pev->origin - Vector( 0, 0, 500 ), ignore_monsters, edict(), &tr );
pSprite->pev->origin = tr.vecEndPos;
pSprite->pev->velocity = Vector( RANDOM_FLOAT( -200, 200 ), RANDOM_FLOAT( -200, 200 ), 175 );
// pSprite->AnimateAndDie( RANDOM_FLOAT( 8.0, 12.0 ) );
pSprite->pev->nextthink = gpGlobals->time + 0.3;
pSprite->pev->velocity = Vector( RANDOM_FLOAT( -200.0f, 200.0f ), RANDOM_FLOAT( -200.0f, 200.0f ), 175 );
// pSprite->AnimateAndDie( RANDOM_FLOAT( 8.0f, 12.0f ) );
pSprite->pev->nextthink = gpGlobals->time + 0.3f;
pSprite->SetThink( &CBaseEntity::SUB_Remove );
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxFadeFast );
}
@ -474,7 +474,7 @@ void CGargantua::StompAttack( void )
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, pStompSounds[RANDOM_LONG( 0, ARRAYSIZE( pStompSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
UTIL_TraceLine( pev->origin, pev->origin - Vector(0,0,20), ignore_monsters, edict(), &trace );
if( trace.flFraction < 1.0 )
if( trace.flFraction < 1.0f )
UTIL_DecalTrace( &trace, DECAL_GARGSTOMP1 );
}
@ -559,9 +559,9 @@ void CGargantua::FlameUpdate( void )
UTIL_TraceLine( vecStart, vecEnd, dont_ignore_monsters, edict(), &trace );
m_pFlame[i]->SetStartPos( trace.vecEndPos );
m_pFlame[i+2]->SetStartPos( ( vecStart * 0.6 ) + ( trace.vecEndPos * 0.4 ) );
m_pFlame[i+2]->SetStartPos( ( vecStart * 0.6f ) + ( trace.vecEndPos * 0.4f ) );
if( trace.flFraction != 1.0 && gpGlobals->time > m_streakTime )
if( trace.flFraction != 1.0f && gpGlobals->time > m_streakTime )
{
StreakSplash( trace.vecEndPos, trace.vecPlaneNormal, 6, 20, 50, 400 );
streaks = TRUE;
@ -577,7 +577,7 @@ void CGargantua::FlameUpdate( void )
WRITE_COORD( vecStart.x ); // origin
WRITE_COORD( vecStart.y );
WRITE_COORD( vecStart.z );
WRITE_COORD( RANDOM_FLOAT( 32, 48 ) ); // radius
WRITE_COORD( RANDOM_FLOAT( 32.0f, 48.0f ) ); // radius
WRITE_BYTE( 255 ); // R
WRITE_BYTE( 255 ); // G
WRITE_BYTE( 255 ); // B
@ -597,7 +597,7 @@ void CGargantua::FlameDamage( Vector vecStart, Vector vecEnd, entvars_t *pevInfl
float flAdjustedDamage;
Vector vecSpot;
Vector vecMid = ( vecStart + vecEnd ) * 0.5;
Vector vecMid = ( vecStart + vecEnd ) * 0.5f;
float searchRadius = ( vecStart - vecMid).Length();
@ -627,15 +627,15 @@ void CGargantua::FlameDamage( Vector vecStart, Vector vecEnd, entvars_t *pevInfl
UTIL_TraceLine( vecSrc, vecSpot, dont_ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 || tr.pHit == pEntity->edict() )
if( tr.flFraction == 1.0f || tr.pHit == pEntity->edict() )
{
// the explosion can 'see' this entity, so hurt them!
// decrease damage for an ent that's farther from the flame.
dist = ( vecSrc - tr.vecEndPos ).Length();
if( dist > 64 )
if( dist > 64.0f )
{
flAdjustedDamage = flDamage - ( dist - 64 ) * 0.4;
flAdjustedDamage = flDamage - ( dist - 64.0f ) * 0.4f;
if( flAdjustedDamage <= 0 )
continue;
}
@ -645,7 +645,7 @@ void CGargantua::FlameDamage( Vector vecStart, Vector vecEnd, entvars_t *pevInfl
}
// ALERT( at_console, "hit %s\n", STRING( pEntity->pev->classname ) );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
ClearMultiDamage();
pEntity->TraceAttack( pevInflictor, flAdjustedDamage, ( tr.vecEndPos - vecSrc ).Normalize(), &tr, bitsDamageType );
@ -679,7 +679,7 @@ void CGargantua::PrescheduleThink( void )
{
if( !HasConditions( bits_COND_SEE_ENEMY ) )
{
m_seeTime = gpGlobals->time + 5;
m_seeTime = gpGlobals->time + 5.0f;
EyeOff();
}
else
@ -860,7 +860,7 @@ int CGargantua::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, flo
if( IsAlive() )
{
if( !( bitsDamageType & GARG_DAMAGE ) )
flDamage *= 0.01;
flDamage *= 0.01f;
if( bitsDamageType & DMG_BLAST )
SetConditions( bits_COND_LIGHT_DAMAGE );
}
@ -875,13 +875,13 @@ void CGargantua::DeathEffect( void )
Vector deathPos = pev->origin + gpGlobals->v_forward * 100;
// Create a spiral of streaks
CSpiral::Create( deathPos, ( pev->absmax.z - pev->absmin.z ) * 0.6, 125, 1.5 );
CSpiral::Create( deathPos, ( pev->absmax.z - pev->absmin.z ) * 0.6f, 125, 1.5 );
Vector position = pev->origin;
position.z += 32;
for( i = 0; i < 7; i+=2 )
{
SpawnExplosion( position, 70, ( i * 0.3 ), 60 + ( i * 20 ) );
SpawnExplosion( position, 70, ( i * 0.3f ), 60 + ( i * 20 ) );
position.z += 15;
}
@ -889,7 +889,7 @@ void CGargantua::DeathEffect( void )
pSmoker->pev->health = 1; // 1 smoke balls
pSmoker->pev->scale = 46; // 4.6X normal size
pSmoker->pev->dmg = 0; // 0 radial distribution
pSmoker->pev->nextthink = gpGlobals->time + 2.5; // Start in 2.5 seconds
pSmoker->pev->nextthink = gpGlobals->time + 2.5f; // Start in 2.5 seconds
}
void CGargantua::Killed( entvars_t *pevAttacker, int iGib )
@ -909,7 +909,7 @@ BOOL CGargantua::CheckMeleeAttack1( float flDot, float flDist )
{
//ALERT( at_aiconsole, "CheckMelee(%f, %f)\n", flDot, flDist );
if( flDot >= 0.7 )
if( flDot >= 0.7f )
{
if( flDist <= GARG_ATTACKDIST )
return TRUE;
@ -924,7 +924,7 @@ BOOL CGargantua::CheckMeleeAttack2( float flDot, float flDist )
if( gpGlobals->time > m_flameTime )
{
if( flDot >= 0.8 && flDist > GARG_ATTACKDIST )
if( flDot >= 0.8f && flDist > GARG_ATTACKDIST )
{
if ( flDist <= GARG_FLAME_LENGTH )
return TRUE;
@ -946,7 +946,7 @@ BOOL CGargantua::CheckRangeAttack1( float flDot, float flDist )
{
if( gpGlobals->time > m_seeTime )
{
if( flDot >= 0.7 && flDist > GARG_ATTACKDIST )
if( flDot >= 0.7f && flDist > GARG_ATTACKDIST )
{
return TRUE;
}
@ -965,7 +965,7 @@ void CGargantua::HandleAnimEvent( MonsterEvent_t *pEvent )
case GARG_AE_SLASH_LEFT:
{
// HACKHACK!!!
CBaseEntity *pHurt = GargantuaCheckTraceHullAttack( GARG_ATTACKDIST + 10.0, gSkillData.gargantuaDmgSlash, DMG_SLASH );
CBaseEntity *pHurt = GargantuaCheckTraceHullAttack( GARG_ATTACKDIST + 10.0f, gSkillData.gargantuaDmgSlash, DMG_SLASH );
if( pHurt )
{
if( pHurt->pev->flags & ( FL_MONSTER | FL_CLIENT ) )
@ -992,7 +992,7 @@ void CGargantua::HandleAnimEvent( MonsterEvent_t *pEvent )
break;
case GARG_AE_STOMP:
StompAttack();
m_seeTime = gpGlobals->time + 12;
m_seeTime = gpGlobals->time + 12.0f;
break;
case GARG_AE_BREATHE:
EMIT_SOUND_DYN( edict(), CHAN_VOICE, pBreatheSounds[RANDOM_LONG( 0, ARRAYSIZE( pBreatheSounds ) - 1 )], 1.0, ATTN_GARG, 0, PITCH_NORM + RANDOM_LONG( -10, 10 ) );
@ -1021,7 +1021,7 @@ CBaseEntity* CGargantua::GargantuaCheckTraceHullAttack(float flDist, int iDamage
UTIL_MakeVectors( pev->angles );
Vector vecStart = pev->origin;
vecStart.z += 64;
Vector vecEnd = vecStart + ( gpGlobals->v_forward * flDist ) - ( gpGlobals->v_up * flDist * 0.3 );
Vector vecEnd = vecStart + ( gpGlobals->v_forward * flDist ) - ( gpGlobals->v_up * flDist * 0.3f );
UTIL_TraceHull( vecStart, vecEnd, dont_ignore_monsters, head_hull, ENT( pev ), &tr );
@ -1065,7 +1065,7 @@ void CGargantua::StartTask( Task_t *pTask )
case TASK_FLAME_SWEEP:
FlameCreate();
m_flWaitFinished = gpGlobals->time + pTask->flData;
m_flameTime = gpGlobals->time + 6;
m_flameTime = gpGlobals->time + 6.0f;
m_flameX = 0;
m_flameY = 0;
break;
@ -1075,7 +1075,7 @@ void CGargantua::StartTask( Task_t *pTask )
TaskComplete();
break;
case TASK_DIE:
m_flWaitFinished = gpGlobals->time + 1.6;
m_flWaitFinished = gpGlobals->time + 1.6f;
DeathEffect();
// FALL THROUGH
default:
@ -1099,7 +1099,7 @@ void CGargantua::RunTask( Task_t *pTask )
pev->rendercolor.y = 0;
pev->rendercolor.z = 0;
StopAnimation();
pev->nextthink = gpGlobals->time + 0.15;
pev->nextthink = gpGlobals->time + 0.15f;
SetThink( &CBaseEntity::SUB_Remove );
int i;
int parts = MODEL_FRAMES( gGargGibModel );
@ -1118,7 +1118,7 @@ void CGargantua::RunTask( Task_t *pTask )
pGib->m_material = matNone;
pGib->pev->origin = pev->origin;
pGib->pev->velocity = UTIL_RandomBloodVector() * RANDOM_FLOAT( 300, 500 );
pGib->pev->nextthink = gpGlobals->time + 1.25;
pGib->pev->nextthink = gpGlobals->time + 1.25f;
pGib->SetThink( &CBaseEntity::SUB_FadeOut );
}
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
@ -1194,10 +1194,10 @@ void CGargantua::RunTask( Task_t *pTask )
if( cancel )
{
m_flWaitFinished -= 0.5;
m_flameTime -= 0.5;
m_flWaitFinished -= 0.5f;
m_flameTime -= 0.5f;
}
// FlameControls( angles.x + 2 * sin( gpGlobals->time * 8 ), angles.y + 28 * sin( gpGlobals->time * 8.5 ) );
// FlameControls( angles.x + 2.0f * sin( gpGlobals->time * 8.0f ), angles.y + 28.0f * sin( gpGlobals->time * 8.5f ) );
FlameControls( angles.x, angles.y );
}
break;
@ -1235,13 +1235,13 @@ void CSmoker::Think( void )
WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -pev->dmg, pev->dmg ) );
WRITE_COORD( pev->origin.z);
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( RANDOM_LONG(pev->scale, pev->scale * 1.1 ) );
WRITE_BYTE( RANDOM_LONG(pev->scale, pev->scale * 1.1f ) );
WRITE_BYTE( RANDOM_LONG( 8, 14 ) ); // framerate
MESSAGE_END();
pev->health--;
if( pev->health > 0 )
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1, 0.2 );
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1f, 0.2f );
else
UTIL_Remove( this );
}
@ -1274,7 +1274,7 @@ CSpiral *CSpiral::Create( const Vector &origin, float height, float radius, floa
return pSpiral;
}
#define SPIRAL_INTERVAL 0.1 //025
#define SPIRAL_INTERVAL 0.1f //025
void CSpiral::Think( void )
{
@ -1285,7 +1285,7 @@ void CSpiral::Think( void )
Vector position = pev->origin;
Vector direction = Vector(0,0,1);
float fraction = 1.0 / pev->speed;
float fraction = 1.0f / pev->speed;
float radius = ( pev->scale * pev->health ) * fraction;

View File

@ -52,10 +52,10 @@ float CGauss::GetFullChargeTime( void )
if( g_pGameRules->IsMultiplayer() )
#endif
{
return 1.5;
return 1.5f;
}
return 4;
return 4.0f;
}
#ifdef CLIENT_DLL
@ -138,9 +138,9 @@ BOOL CGauss::Deploy()
void CGauss::Holster( int skiplocal /* = 0 */ )
{
PLAYBACK_EVENT_FULL( FEV_RELIABLE | FEV_GLOBAL, m_pPlayer->edict(), m_usGaussFire, 0.01, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 );
PLAYBACK_EVENT_FULL( FEV_RELIABLE | FEV_GLOBAL, m_pPlayer->edict(), m_usGaussFire, 0.01f, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 );
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
SendWeaponAnim( GAUSS_HOLSTER );
m_fInAttack = 0;
@ -152,14 +152,14 @@ void CGauss::PrimaryAttack()
if( m_pPlayer->pev->waterlevel == 3 )
{
PlayEmptySound();
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.15 );
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.15f );
return;
}
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < 2 )
{
PlayEmptySound();
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
return;
}
@ -170,8 +170,8 @@ void CGauss::PrimaryAttack()
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.2f;
}
void CGauss::SecondaryAttack()
@ -190,7 +190,7 @@ void CGauss::SecondaryAttack()
PlayEmptySound();
}
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5f );
return;
}
@ -199,7 +199,7 @@ void CGauss::SecondaryAttack()
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
{
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/357_cock1.wav", 0.8, ATTN_NORM );
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
return;
}
@ -213,11 +213,11 @@ void CGauss::SecondaryAttack()
SendWeaponAnim( GAUSS_SPINUP );
m_fInAttack = 1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;
m_pPlayer->m_flStartCharge = gpGlobals->time;
m_pPlayer->m_flAmmoStartCharge = UTIL_WeaponTimeBase() + GetFullChargeTime();
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, 110, 0, 0, 0 );
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 110, 0, 0, 0 );
m_iSoundState = SND_CHANGE_PITCH;
}
@ -242,7 +242,7 @@ void CGauss::SecondaryAttack()
// out of ammo! force the gun to fire
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
return;
}
@ -257,12 +257,12 @@ void CGauss::SecondaryAttack()
#endif
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.1;
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.1f;
}
else
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.3;
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.3f;
}
}
@ -281,25 +281,25 @@ void CGauss::SecondaryAttack()
if( m_iSoundState == 0 )
ALERT( at_console, "sound state %d\n", m_iSoundState );
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 );
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 );
m_iSoundState = SND_CHANGE_PITCH; // hack for going through level transitions
m_pPlayer->m_iWeaponVolume = GAUSS_PRIMARY_CHARGE_VOLUME;
// m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1;
if( m_pPlayer->m_flStartCharge < gpGlobals->time - 10 )
// m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1f;
if( m_pPlayer->m_flStartCharge < gpGlobals->time - 10.0f )
{
// Player charged up too long. Zap him.
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", 1.0, ATTN_NORM, 0, 80 + RANDOM_LONG( 0, 0x3f ) );
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/electro6.wav", 1.0, ATTN_NORM, 0, 75 + RANDOM_LONG( 0, 0x3f ) );
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", 1.0f, ATTN_NORM, 0, 80 + RANDOM_LONG( 0, 0x3f ) );
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/electro6.wav", 1.0f, ATTN_NORM, 0, 75 + RANDOM_LONG( 0, 0x3f ) );
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f;
#ifndef CLIENT_DLL
m_pPlayer->TakeDamage( VARS( eoNullEntity ), VARS( eoNullEntity ), 50, DMG_SHOCK );
UTIL_ScreenFade( m_pPlayer, Vector( 255, 128, 0 ), 2, 0.5, 128, FFADE_IN );
UTIL_ScreenFade( m_pPlayer, Vector( 255, 128, 0 ), 2, 0.5f, 128, FFADE_IN );
#endif
SendWeaponAnim( GAUSS_IDLE );
@ -325,18 +325,18 @@ void CGauss::StartFire( void )
if( gpGlobals->time - m_pPlayer->m_flStartCharge > GetFullChargeTime() )
{
flDamage = 200;
flDamage = 200.0f;
}
else
{
flDamage = 200 * ( ( gpGlobals->time - m_pPlayer->m_flStartCharge ) / GetFullChargeTime() );
flDamage = 200.0f * ( ( gpGlobals->time - m_pPlayer->m_flStartCharge ) / GetFullChargeTime() );
}
if( m_fPrimaryFire )
{
// fixed damage on primary attack
#ifdef CLIENT_DLL
flDamage = 20;
flDamage = 20.0f;
#else
flDamage = gSkillData.plrDmgGauss;
#endif
@ -350,7 +350,7 @@ void CGauss::StartFire( void )
if( !m_fPrimaryFire )
{
m_pPlayer->pev->velocity = m_pPlayer->pev->velocity - gpGlobals->v_forward * flDamage * 5;
m_pPlayer->pev->velocity = m_pPlayer->pev->velocity - gpGlobals->v_forward * flDamage * 5.0f;
}
if( !g_pGameRules->IsMultiplayer() )
@ -364,7 +364,7 @@ void CGauss::StartFire( void )
}
// time until aftershock 'static discharge' sound
m_pPlayer->m_flPlayAftershock = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.3, 0.8 );
m_pPlayer->m_flPlayAftershock = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.3f, 0.8f );
Fire( vecSrc, vecAiming, flDamage );
}
@ -375,9 +375,9 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
TraceResult tr, beam_tr;
#ifndef CLIENT_DLL
Vector vecSrc = vecOrigSrc;
Vector vecDest = vecSrc + vecDir * 8192;
Vector vecDest = vecSrc + vecDir * 8192.0f;
edict_t *pentIgnore;
float flMaxFrac = 1.0;
float flMaxFrac = 1.0f;
int nTotal = 0;
int fHasPunched = 0;
int fFirstBeam = 1;
@ -389,13 +389,13 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
g_irunninggausspred = true;
#endif
// The main firing event is sent unreliably so it won't be delayed.
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussFire, 0.0, m_pPlayer->pev->origin, m_pPlayer->pev->angles, flDamage, 0.0, 0, 0, m_fPrimaryFire ? 1 : 0, 0 );
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussFire, 0.0f, m_pPlayer->pev->origin, m_pPlayer->pev->angles, flDamage, 0.0, 0, 0, m_fPrimaryFire ? 1 : 0, 0 );
// This reliable event is used to stop the spinning sound
// It's delayed by a fraction of second to make sure it is delayed by 1 frame on the client
// It's sent reliably anyway, which could lead to other delays
PLAYBACK_EVENT_FULL( FEV_NOTHOST | FEV_RELIABLE, m_pPlayer->edict(), m_usGaussFire, 0.01, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 );
PLAYBACK_EVENT_FULL( FEV_NOTHOST | FEV_RELIABLE, m_pPlayer->edict(), m_usGaussFire, 0.01f, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 );
/*ALERT( at_console, "%f %f %f\n%f %f %f\n",
vecSrc.x, vecSrc.y, vecSrc.z,
@ -442,7 +442,7 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
n = -DotProduct( tr.vecPlaneNormal, vecDir );
if( n < 0.5 ) // 60 degrees
if( n < 0.5f ) // 60 degrees
{
// ALERT( at_console, "reflect %f\n", n );
// reflect
@ -451,8 +451,8 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
r = 2.0 * tr.vecPlaneNormal * n + vecDir;
flMaxFrac = flMaxFrac - tr.flFraction;
vecDir = r;
vecSrc = tr.vecEndPos + vecDir * 8;
vecDest = vecSrc + vecDir * 8192;
vecSrc = tr.vecEndPos + vecDir * 8.0f;
vecDest = vecSrc + vecDir * 8192.0f;
// explode a bit
m_pPlayer->RadiusDamage( tr.vecEndPos, pev, m_pPlayer->pev, flDamage * n, CLASS_NONE, DMG_BLAST );
@ -460,8 +460,8 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
nTotal += 34;
// lose energy
if( n == 0 ) n = 0.1;
flDamage = flDamage * ( 1 - n );
if( n == 0.0f ) n = 0.1f;
flDamage = flDamage * ( 1.0f - n );
}
else
{
@ -485,8 +485,8 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
if( n < flDamage )
{
if( n == 0 )
n = 1;
if( n == 0.0f )
n = 1.0f;
flDamage -= n;
// ALERT( at_console, "punch %f\n", n );
@ -498,16 +498,16 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
if( g_pGameRules->IsMultiplayer() )
{
damage_radius = flDamage * 1.75; // Old code == 2.5
damage_radius = flDamage * 1.75f; // Old code == 2.5
}
else
{
damage_radius = flDamage * 2.5;
damage_radius = flDamage * 2.5f;
}
::RadiusDamage( beam_tr.vecEndPos + vecDir * 8, pev, m_pPlayer->pev, flDamage, damage_radius, CLASS_NONE, DMG_BLAST );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0 );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0f );
nTotal += 53;
@ -553,18 +553,18 @@ void CGauss::WeaponIdle( void )
switch( RANDOM_LONG( 0, 3 ) )
{
case 0:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", RANDOM_FLOAT( 0.7, 0.8 ), ATTN_NORM );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", RANDOM_FLOAT( 0.7f, 0.8f ), ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro5.wav", RANDOM_FLOAT( 0.7, 0.8 ), ATTN_NORM );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro5.wav", RANDOM_FLOAT( 0.7f, 0.8f ), ATTN_NORM );
break;
case 2:
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro6.wav", RANDOM_FLOAT( 0.7, 0.8 ), ATTN_NORM );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro6.wav", RANDOM_FLOAT( 0.7f, 0.8f ), ATTN_NORM );
break;
case 3:
break; // no sound
}
m_pPlayer->m_flPlayAftershock = 0.0;
m_pPlayer->m_flPlayAftershock = 0.0f;
}
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
@ -574,30 +574,30 @@ void CGauss::WeaponIdle( void )
{
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;
// Need to set m_flNextPrimaryAttack so the weapon gets a chance to complete its secondary fire animation. - Solokiller
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f;
}
else
{
int iAnim;
float flRand = RANDOM_FLOAT( 0, 1 );
if( flRand <= 0.5 )
float flRand = RANDOM_FLOAT( 0.0f, 1.0f );
if( flRand <= 0.5f )
{
iAnim = GAUSS_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
}
else if( flRand <= 0.75 )
else if( flRand <= 0.75f )
{
iAnim = GAUSS_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
}
else
{
iAnim = GAUSS_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;
}
#ifndef CLIENT_DLL
SendWeaponAnim( iAnim );

View File

@ -57,9 +57,9 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
pev->takedamage = DAMAGE_NO;
// Pull out of the wall a bit
if( pTrace->flFraction != 1.0 )
if( pTrace->flFraction != 1.0f )
{
pev->origin = pTrace->vecEndPos + ( pTrace->vecPlaneNormal * ( pev->dmg - 24 ) * 0.6 );
pev->origin = pTrace->vecEndPos + ( pTrace->vecPlaneNormal * ( pev->dmg - 24 ) * 0.6f );
}
int iContents = UTIL_PointContents( pev->origin );
@ -77,7 +77,7 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
{
WRITE_SHORT( g_sModelIndexWExplosion );
}
WRITE_BYTE( ( pev->dmg - 50 ) * .60 ); // scale * 10
WRITE_BYTE( ( pev->dmg - 50 ) * 0.6f ); // scale * 10
WRITE_BYTE( 15 ); // framerate
WRITE_BYTE( TE_EXPLFLAG_NONE );
MESSAGE_END();
@ -93,7 +93,7 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
RadiusDamage( pev, pevOwner, pev->dmg, CLASS_NONE, bitsDamageType );
if( RANDOM_FLOAT( 0, 1 ) < 0.5 )
if( RANDOM_FLOAT( 0, 1 ) < 0.5f )
{
UTIL_DecalTrace( pTrace, DECAL_SCORCH1 );
}
@ -120,7 +120,7 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
pev->effects |= EF_NODRAW;
SetThink( &CGrenade::Smoke );
pev->velocity = g_vecZero;
pev->nextthink = gpGlobals->time + 0.3;
pev->nextthink = gpGlobals->time + 0.3f;
if( iContents != CONTENTS_WATER )
{
@ -144,7 +144,7 @@ void CGrenade::Smoke( void )
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z );
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( (int)( ( pev->dmg - 50 ) * 0.80 ) ); // scale * 10
WRITE_BYTE( (int)( ( pev->dmg - 50 ) * 0.8f ) ); // scale * 10
WRITE_BYTE( 12 ); // framerate
MESSAGE_END();
}
@ -207,12 +207,12 @@ void CGrenade::DangerSoundThink( void )
return;
}
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin + pev->velocity * 0.5, (int)pev->velocity.Length(), 0.2 );
pev->nextthink = gpGlobals->time + 0.2;
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin + pev->velocity * 0.5f, (int)pev->velocity.Length(), 0.2 );
pev->nextthink = gpGlobals->time + 0.2f;
if( pev->waterlevel != 0 )
{
pev->velocity = pev->velocity * 0.5;
pev->velocity = pev->velocity * 0.5f;
}
}
@ -233,7 +233,7 @@ void CGrenade::BounceTouch( CBaseEntity *pOther )
pOther->TraceAttack( pevOwner, 1, gpGlobals->v_forward, &tr, DMG_CLUB );
ApplyMultiDamage( pev, pevOwner );
}
m_flNextAttack = gpGlobals->time + 1.0; // debounce
m_flNextAttack = gpGlobals->time + 1.0f; // debounce
}
Vector vecTestVelocity;
@ -243,7 +243,7 @@ void CGrenade::BounceTouch( CBaseEntity *pOther )
// or thrown very far tend to slow down too quickly for me to always catch just by testing velocity.
// trimming the Z velocity a bit seems to help quite a bit.
vecTestVelocity = pev->velocity;
vecTestVelocity.z *= 0.45;
vecTestVelocity.z *= 0.45f;
if( !m_fRegisteredSound && vecTestVelocity.Length() <= 60 )
{
@ -253,14 +253,14 @@ void CGrenade::BounceTouch( CBaseEntity *pOther )
// go ahead and emit the danger sound.
// register a radius louder than the explosion, so we make sure everyone gets out of the way
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin, (int)( pev->dmg / 0.4 ), 0.3 );
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin, (int)( pev->dmg / 0.4f ), 0.3f );
m_fRegisteredSound = TRUE;
}
if( pev->flags & FL_ONGROUND )
{
// add a bit of static friction
pev->velocity = pev->velocity * 0.8;
pev->velocity = pev->velocity * 0.8f;
pev->sequence = RANDOM_LONG( 1, 1 );
}
@ -269,11 +269,11 @@ void CGrenade::BounceTouch( CBaseEntity *pOther )
// play bounce sound
BounceSound();
}
pev->framerate = pev->velocity.Length() / 200.0;
if( pev->framerate > 1.0 )
pev->framerate = 1;
else if( pev->framerate < 0.5 )
pev->framerate = 0;
pev->framerate = pev->velocity.Length() / 200.0f;
if( pev->framerate > 1.0f )
pev->framerate = 1.0f;
else if( pev->framerate < 0.5f )
pev->framerate = 0.0f;
}
void CGrenade::SlideTouch( CBaseEntity *pOther )
@ -286,7 +286,7 @@ void CGrenade::SlideTouch( CBaseEntity *pOther )
if( pev->flags & FL_ONGROUND )
{
// add a bit of static friction
pev->velocity = pev->velocity * 0.95;
pev->velocity = pev->velocity * 0.95f;
if( pev->velocity.x != 0 || pev->velocity.y != 0 )
{
@ -324,7 +324,7 @@ void CGrenade::TumbleThink( void )
}
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( pev->dmgtime - 1 < gpGlobals->time )
{
@ -337,8 +337,8 @@ void CGrenade::TumbleThink( void )
}
if( pev->waterlevel != 0 )
{
pev->velocity = pev->velocity * 0.5;
pev->framerate = 0.2;
pev->velocity = pev->velocity * 0.5f;
pev->framerate = 0.2f;
}
}
@ -399,21 +399,21 @@ CGrenade *CGrenade::ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vec
pGrenade->pev->dmgtime = gpGlobals->time + time;
pGrenade->SetThink( &CGrenade::TumbleThink );
pGrenade->pev->nextthink = gpGlobals->time + 0.1;
if( time < 0.1 )
pGrenade->pev->nextthink = gpGlobals->time + 0.1f;
if( time < 0.1f )
{
pGrenade->pev->nextthink = gpGlobals->time;
pGrenade->pev->velocity = Vector( 0, 0, 0 );
}
pGrenade->pev->sequence = RANDOM_LONG( 3, 6 );
pGrenade->pev->framerate = 1.0;
pGrenade->pev->framerate = 1.0f;
// Tumble through the air
// pGrenade->pev->avelocity.x = -400;
pGrenade->pev->gravity = 0.5;
pGrenade->pev->friction = 0.8;
pGrenade->pev->gravity = 0.5f;
pGrenade->pev->friction = 0.8f;
SET_MODEL( ENT( pGrenade->pev ), "models/w_grenade.mdl" );
pGrenade->pev->dmg = 100;
@ -445,7 +445,7 @@ CGrenade *CGrenade::ShootSatchelCharge( entvars_t *pevOwner, Vector vecStart, Ve
pGrenade->SetTouch( &CGrenade::SlideTouch );
pGrenade->pev->spawnflags = SF_DETONATE;
pGrenade->pev->friction = 0.9;
pGrenade->pev->friction = 0.9f;
return pGrenade;
}

View File

@ -106,12 +106,12 @@ BOOL CGlock::Deploy()
void CGlock::SecondaryAttack( void )
{
GlockFire( 0.1, 0.2, FALSE );
GlockFire( 0.1f, 0.2f, FALSE );
}
void CGlock::PrimaryAttack( void )
{
GlockFire( 0.01, 0.3, TRUE );
GlockFire( 0.01f, 0.3f, TRUE );
}
void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
@ -121,7 +121,7 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
if( m_fFireOnEmpty )
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay( 0.2 );
m_flNextPrimaryAttack = GetNextAttackDelay( 0.2f );
}
return;
@ -187,9 +187,9 @@ void CGlock::Reload( void )
int iResult;
if( m_iClip == 0 )
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 1.5 );
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 1.5f );
else
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 1.5 );
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 1.5f );
if( iResult )
{
@ -212,20 +212,20 @@ void CGlock::WeaponIdle( void )
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0, 1.0 );
if( flRand <= 0.3 + 0 * 0.75 )
if( flRand <= 0.3f + 0 * 0.75f )
{
iAnim = GLOCK_IDLE3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 49.0 / 16;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 49.0f / 16.0f;
}
else if( flRand <= 0.6 + 0 * 0.875 )
else if( flRand <= 0.6f + 0 * 0.875f )
{
iAnim = GLOCK_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0 / 16.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f / 16.0f;
}
else
{
iAnim = GLOCK_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0 / 16.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0f / 16.0f;
}
SendWeaponAnim( iAnim, 1 );
}

View File

@ -62,7 +62,7 @@ BOOL FBoxVisible( entvars_t *pevLooker, entvars_t *pevTarget, Vector &vecTargetO
UTIL_TraceLine( vecLookerOrigin, vecTarget, ignore_monsters, ignore_glass, ENT( pevLooker )/*pentIgnore*/, &tr );
if( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0f )
{
vecTargetOrigin = vecTarget;
return TRUE;// line of sight is valid.
@ -120,10 +120,10 @@ Vector VecCheckToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, fl
float distance2 = vecMidPoint.z - vecSpot2.z;
// How long will it take for the grenade to travel this distance
float time1 = sqrt( distance1 / ( 0.5 * flGravity ) );
float time2 = sqrt( distance2 / ( 0.5 * flGravity ) );
float time1 = sqrt( distance1 / ( 0.5f * flGravity ) );
float time2 = sqrt( distance2 / ( 0.5f * flGravity ) );
if( time1 < 0.1 )
if( time1 < 0.1f )
{
// too close
return g_vecZero;
@ -139,7 +139,7 @@ Vector VecCheckToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, fl
vecApex.z = vecMidPoint.z;
UTIL_TraceLine( vecSpot1, vecApex, dont_ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
// fail!
return g_vecZero;
@ -147,7 +147,7 @@ Vector VecCheckToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, fl
// UNDONE: either ignore monsters or change it to not care if we hit our enemy
UTIL_TraceLine( vecSpot2, vecApex, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
// fail!
return g_vecZero;
@ -168,24 +168,24 @@ Vector VecCheckThrow( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot2, f
// throw at a constant time
float time = vecGrenadeVel.Length() / flSpeed;
vecGrenadeVel = vecGrenadeVel * ( 1.0 / time );
vecGrenadeVel = vecGrenadeVel * ( 1.0f / time );
// adjust upward toss to compensate for gravity loss
vecGrenadeVel.z += flGravity * time * 0.5;
vecGrenadeVel.z += flGravity * time * 0.5f;
Vector vecApex = vecSpot1 + ( vecSpot2 - vecSpot1 ) * 0.5;
vecApex.z += 0.5 * flGravity * ( time * 0.5 ) * ( time * 0.5 );
Vector vecApex = vecSpot1 + ( vecSpot2 - vecSpot1 ) * 0.5f;
vecApex.z += 0.5f * flGravity * ( time * 0.5f ) * ( time * 0.5f );
TraceResult tr;
UTIL_TraceLine( vecSpot1, vecApex, dont_ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
// fail!
return g_vecZero;
}
UTIL_TraceLine( vecSpot2, vecApex, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
// fail!
return g_vecZero;

View File

@ -126,13 +126,13 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
{
if( m_flSoundTime <= gpGlobals->time )
{
m_flSoundTime = gpGlobals->time + 0.62;
m_flSoundTime = gpGlobals->time + 0.62f;
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/suitchargeno1.wav", 0.85, ATTN_NORM );
}
return;
}
pev->nextthink = pev->ltime + 0.25;
pev->nextthink = pev->ltime + 0.25f;
SetThink( &CRecharge::Off );
// Time to recharge yet?
@ -146,7 +146,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
{
m_iOn++;
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/suitchargeok1.wav", 0.85, ATTN_NORM );
m_flSoundTime = 0.56 + gpGlobals->time;
m_flSoundTime = 0.56f + gpGlobals->time;
}
if( ( m_iOn == 1 ) && ( m_flSoundTime <= gpGlobals->time ) )
@ -166,7 +166,7 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
}
// govern the rate of charge
m_flNextCharge = gpGlobals->time + 0.1;
m_flNextCharge = gpGlobals->time + 0.1f;
}
void CRecharge::Recharge( void )

View File

@ -126,7 +126,7 @@ void CLegacyCineMonster :: CineSpawn( const char *szModel )
if ( FStringNull(pev->targetname) )
{
SetThink( &CLegacyCineMonster::CineThink );
pev->nextthink += 1.0;
pev->nextthink += 1.0f;
}
}
@ -167,7 +167,7 @@ void CLegacyCineMonster :: CineThink( void )
if (!pev->animtime)
ResetSequenceInfo( );
pev->nextthink = gpGlobals->time + 1.0;
pev->nextthink = gpGlobals->time + 1.0f;
if (pev->spawnflags != 0 && m_fSequenceFinished)
{
@ -196,14 +196,14 @@ void CCineBlood :: BloodGush ( void )
{
Vector vecSplatDir;
TraceResult tr;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
UTIL_MakeVectors(pev->angles);
if ( pev->health-- < 0 )
REMOVE_ENTITY(ENT(pev));
UTIL_MakeVectors( pev->angles );
if( pev->health-- < 0 )
REMOVE_ENTITY( ENT( pev ) );
// CHANGE_METHOD ( ENT(pev), em_think, SUB_Remove );
if ( RANDOM_FLOAT ( 0 , 1 ) < 0.7 )// larger chance of globs
if ( RANDOM_FLOAT ( 0.0f, 1.0f ) < 0.7f )// larger chance of globs
{
UTIL_BloodDrips( pev->origin, UTIL_RandomBloodVector(), BLOOD_COLOR_RED, 10 );
}
@ -212,13 +212,13 @@ void CCineBlood :: BloodGush ( void )
UTIL_BloodStream( pev->origin, UTIL_RandomBloodVector(), BLOOD_COLOR_RED, RANDOM_LONG(50, 150) );
}
if ( RANDOM_FLOAT ( 0, 1 ) < 0.75 )
if ( RANDOM_FLOAT ( 0, 1 ) < 0.75f )
{
// decals the floor with blood.
vecSplatDir = Vector ( 0 , 0 , -1 );
vecSplatDir = vecSplatDir + (RANDOM_FLOAT(-1,1) * 0.6 * gpGlobals->v_right) + (RANDOM_FLOAT(-1,1) * 0.6 * gpGlobals->v_forward);// randomize a bit
vecSplatDir = vecSplatDir + (RANDOM_FLOAT(-1,1) * 0.6f * gpGlobals->v_right) + (RANDOM_FLOAT(-1,1) * 0.6f * gpGlobals->v_forward);// randomize a bit
UTIL_TraceLine( pev->origin + Vector ( 0, 0 , 64) , pev->origin + vecSplatDir * 256, ignore_monsters, ENT(pev), &tr);
if ( tr.flFraction != 1.0 )
if ( tr.flFraction != 1.0f )
{
// Decal with a bloodsplat
UTIL_BloodDecalTrace( &tr, BLOOD_COLOR_RED );

View File

@ -96,7 +96,7 @@ void CCycler::GenericCyclerSpawn( const char *szModel, Vector vecMin, Vector vec
{
if( !szModel || !*szModel )
{
ALERT( at_error, "cycler at %.0f %.0f %0.f missing modelname", pev->origin.x, pev->origin.y, pev->origin.z );
ALERT( at_error, "cycler at %.0f %.0f %0.f missing modelname", (double)pev->origin.x, (double)pev->origin.y, (double)pev->origin.z );
REMOVE_ENTITY( ENT( pev ) );
return;
}
@ -125,7 +125,7 @@ void CCycler::Spawn()
m_flFrameRate = 75;
m_flGroundSpeed = 0;
pev->nextthink += 1.0;
pev->nextthink += 1.0f;
ResetSequenceInfo();
@ -145,7 +145,7 @@ void CCycler::Spawn()
//
void CCycler::Think( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( m_animate )
{
@ -161,7 +161,7 @@ void CCycler::Think( void )
m_flLastEventCheck = gpGlobals->time;
pev->frame = 0;
if( !m_animate )
pev->framerate = 0.0; // FIX: don't reset framerate
pev->framerate = 0.0f; // FIX: don't reset framerate
}
}
@ -172,9 +172,9 @@ void CCycler::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
{
m_animate = !m_animate;
if( m_animate )
pev->framerate = 1.0;
pev->framerate = 1.0f;
else
pev->framerate = 0.0;
pev->framerate = 0.0f;
}
//
@ -189,7 +189,7 @@ int CCycler::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
ResetSequenceInfo();
if( m_flFrameRate == 0.0 )
if( m_flFrameRate == 0.0f )
{
pev->sequence = 0;
ResetSequenceInfo();
@ -198,10 +198,10 @@ int CCycler::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
}
else
{
pev->framerate = 1.0;
StudioFrameAdvance( 0.1 );
pev->framerate = 1.0f;
StudioFrameAdvance( 0.1f );
pev->framerate = 0;
ALERT( at_console, "sequence: %d, frame %.0f\n", pev->sequence, pev->frame );
ALERT( at_console, "sequence: %d, frame %.0f\n", pev->sequence, (double)pev->frame );
}
return 0;
@ -224,7 +224,7 @@ public:
inline int ShouldAnimate( void )
{
return m_animate && m_maxFrame > 1.0;
return m_animate && m_maxFrame > 1.0f;
}
int m_animate;
@ -251,7 +251,7 @@ void CCyclerSprite::Spawn( void )
pev->effects = 0;
pev->frame = 0;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_animate = 1;
m_lastTime = gpGlobals->time;
@ -266,7 +266,7 @@ void CCyclerSprite::Think( void )
if( ShouldAnimate() )
Animate( pev->framerate * ( gpGlobals->time - m_lastTime ) );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_lastTime = gpGlobals->time;
}
@ -278,9 +278,9 @@ void CCyclerSprite::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
int CCyclerSprite::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType )
{
if( m_maxFrame > 1.0 )
if( m_maxFrame > 1.0f )
{
Animate( 1.0 );
Animate( 1.0f );
}
return 1;
}
@ -327,7 +327,7 @@ void CWeaponCycler::Spawn()
BOOL CWeaponCycler::Deploy()
{
m_pPlayer->pev->viewmodel = m_iszModel;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f;
SendWeaponAnim( 0 );
m_iClip = 0;
return TRUE;
@ -335,14 +335,14 @@ BOOL CWeaponCycler::Deploy()
void CWeaponCycler::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
}
void CWeaponCycler::PrimaryAttack()
{
SendWeaponAnim( pev->sequence );
m_flNextPrimaryAttack = gpGlobals->time + 0.3;
m_flNextPrimaryAttack = gpGlobals->time + 0.3f;
}
void CWeaponCycler::SecondaryAttack( void )
@ -356,14 +356,14 @@ void CWeaponCycler::SecondaryAttack( void )
GetSequenceInfo( pmodel, pev, &flFrameRate, &flGroundSpeed );
pev->modelindex = 0;
if( flFrameRate == 0.0 )
if( flFrameRate == 0.0f )
{
pev->sequence = 0;
}
SendWeaponAnim( pev->sequence );
m_flNextSecondaryAttack = gpGlobals->time + 0.3;
m_flNextSecondaryAttack = gpGlobals->time + 0.3f;
}
// Flaming Wreakage
@ -397,7 +397,7 @@ void CWreckage::Spawn( void )
pev->effects = 0;
pev->frame = 0;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( pev->model )
{
@ -418,7 +418,7 @@ void CWreckage::Precache()
void CWreckage::Think( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.2;
pev->nextthink = gpGlobals->time + 0.2f;
if( pev->dmgtime )
{

View File

@ -89,7 +89,7 @@ BOOL CHandGrenade::CanHolster( void )
void CHandGrenade::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{
@ -104,11 +104,11 @@ void CHandGrenade::Holster( int skiplocal /* = 0 */ )
if( m_flStartThrow )
{
m_flStartThrow = 0;
m_flReleaseThrow = 0;
m_flStartThrow = 0.0f;
m_flReleaseThrow = 0.0f;
}
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0f, ATTN_NORM );
}
void CHandGrenade::PrimaryAttack()
@ -116,16 +116,16 @@ void CHandGrenade::PrimaryAttack()
if( !m_flStartThrow && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] > 0 )
{
m_flStartThrow = gpGlobals->time;
m_flReleaseThrow = 0;
m_flReleaseThrow = 0.0f;
SendWeaponAnim( HANDGRENADE_PINPULL );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;
}
}
void CHandGrenade::WeaponIdle( void )
{
if( m_flReleaseThrow == 0 && m_flStartThrow )
if( m_flReleaseThrow == 0.0f && m_flStartThrow )
m_flReleaseThrow = gpGlobals->time;
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
@ -135,33 +135,33 @@ void CHandGrenade::WeaponIdle( void )
{
Vector angThrow = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
if( angThrow.x < 0 )
angThrow.x = -10 + angThrow.x * ( ( 90 - 10 ) / 90.0 );
if( angThrow.x < 0.0f )
angThrow.x = -10.0f + angThrow.x * ( ( 90.0f - 10.0f ) / 90.0f );
else
angThrow.x = -10 + angThrow.x * ( ( 90 + 10 ) / 90.0 );
angThrow.x = -10.0f + angThrow.x * ( ( 90.0f + 10.0f ) / 90.0f );
float flVel = ( 90 - angThrow.x ) * 4;
if( flVel > 500 )
flVel = 500;
float flVel = ( 90.0f - angThrow.x ) * 4.0f;
if( flVel > 500.0f )
flVel = 500.0f;
UTIL_MakeVectors( angThrow );
Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16;
Vector vecSrc = m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16.0f;
Vector vecThrow = gpGlobals->v_forward * flVel + m_pPlayer->pev->velocity;
// alway explode 3 seconds after the pin was pulled
float time = m_flStartThrow - gpGlobals->time + 3.0;
if( time < 0 )
time = 0;
float time = m_flStartThrow - gpGlobals->time + 3.0f;
if( time < 0.0f )
time = 0.0f;
CGrenade::ShootTimed( m_pPlayer->pev, vecSrc, vecThrow, time );
if( flVel < 500 )
if( flVel < 500.0f )
{
SendWeaponAnim( HANDGRENADE_THROW1 );
}
else if( flVel < 1000 )
else if( flVel < 1000.0f )
{
SendWeaponAnim( HANDGRENADE_THROW2 );
}
@ -173,10 +173,10 @@ void CHandGrenade::WeaponIdle( void )
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
m_flReleaseThrow = 0;
m_flStartThrow = 0;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
m_flReleaseThrow = 0.0f;
m_flStartThrow = 0.0f;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5f );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
@ -185,14 +185,14 @@ void CHandGrenade::WeaponIdle( void )
// just threw last grenade
// set attack times in the future, and weapon idle in the future so we can see the whole throw
// animation, weapon idle will automatically retire the weapon for us.
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );// ensure that the animation can finish playing
m_flTimeWeaponIdle = m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5f );// ensure that the animation can finish playing
}
return;
}
else if( m_flReleaseThrow > 0 )
else if( m_flReleaseThrow > 0.0f )
{
// we've finished the throw, restart.
m_flStartThrow = 0;
m_flStartThrow = 0.0f;
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{
@ -204,24 +204,24 @@ void CHandGrenade::WeaponIdle( void )
return;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_flReleaseThrow = -1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
m_flReleaseThrow = -1.0f;
return;
}
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand <= 0.75 )
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0f, 1.0f );
if( flRand <= 0.75f )
{
iAnim = HANDGRENADE_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );// how long till we do this again.
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );// how long till we do this again.
}
else
{
iAnim = HANDGRENADE_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0 / 30.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 75.0f / 30.0f;
}
SendWeaponAnim( iAnim );

View File

@ -193,15 +193,15 @@ void CHAssassin::Shoot( void )
Vector vecShootOrigin = GetGunPosition();
Vector vecShootDir = ShootAtEnemy( vecShootOrigin );
if( m_flLastShot + 2 < gpGlobals->time )
if( m_flLastShot + 2.0f < gpGlobals->time )
{
m_flDiviation = 0.10;
m_flDiviation = 0.10f;
}
else
{
m_flDiviation -= 0.01;
if( m_flDiviation < 0.02 )
m_flDiviation = 0.02;
m_flDiviation -= 0.01f;
if( m_flDiviation < 0.02f )
m_flDiviation = 0.02f;
}
m_flLastShot = gpGlobals->time;
@ -214,10 +214,10 @@ void CHAssassin::Shoot( void )
switch( RANDOM_LONG( 0, 1 ) )
{
case 0:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "weapons/pl_gun1.wav", RANDOM_FLOAT( 0.6, 0.8 ), ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "weapons/pl_gun1.wav", RANDOM_FLOAT( 0.6f, 0.8f ), ATTN_NORM );
break;
case 1:
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "weapons/pl_gun2.wav", RANDOM_FLOAT( 0.6, 0.8 ), ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_WEAPON, "weapons/pl_gun2.wav", RANDOM_FLOAT( 0.6f, 0.8f ), ATTN_NORM );
break;
}
@ -247,7 +247,7 @@ void CHAssassin::HandleAnimEvent( MonsterEvent_t *pEvent )
UTIL_MakeVectors( pev->angles );
CGrenade::ShootTimed( pev, pev->origin + gpGlobals->v_forward * 34 + Vector( 0, 0, 32 ), m_vecTossVelocity, 2.0 );
m_flNextGrenadeCheck = gpGlobals->time + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
m_flNextGrenadeCheck = gpGlobals->time + 6.0f;// wait six seconds before even looking again to see if a grenade can be thrown.
m_fThrowGrenade = FALSE;
// !!!LATER - when in a group, only try to throw grenade if ordered.
}
@ -259,7 +259,7 @@ void CHAssassin::HandleAnimEvent( MonsterEvent_t *pEvent )
pev->movetype = MOVETYPE_TOSS;
pev->flags &= ~FL_ONGROUND;
pev->velocity = m_vecJumpVelocity;
m_flNextJump = gpGlobals->time + 3.0;
m_flNextJump = gpGlobals->time + 3.0f;
}
return;
default:
@ -597,7 +597,7 @@ IMPLEMENT_CUSTOM_SCHEDULES( CHAssassin, CBaseMonster )
//=========================================================
BOOL CHAssassin::CheckMeleeAttack1( float flDot, float flDist )
{
if( m_flNextJump < gpGlobals->time && ( flDist <= 128 || HasMemory( bits_MEMORY_BADJUMP ) ) && m_hEnemy != 0 )
if( m_flNextJump < gpGlobals->time && ( flDist <= 128.0f || HasMemory( bits_MEMORY_BADJUMP ) ) && m_hEnemy != 0 )
{
TraceResult tr;
@ -605,15 +605,15 @@ BOOL CHAssassin::CheckMeleeAttack1( float flDot, float flDist )
UTIL_TraceHull( pev->origin + Vector( 0, 0, 36 ), vecDest + Vector( 0, 0, 36 ), dont_ignore_monsters, human_hull, ENT( pev ), &tr );
if( tr.fStartSolid || tr.flFraction < 1.0 )
if( tr.fStartSolid || tr.flFraction < 1.0f )
{
return FALSE;
}
float flGravity = g_psv_gravity->value;
float time = sqrt( 160 / ( 0.5 * flGravity ) );
float speed = flGravity * time / 160;
float time = sqrt( 160.0f / ( 0.5f * flGravity ) );
float speed = flGravity * time / 160.0f;
m_vecJumpVelocity = ( vecDest - pev->origin ) * speed;
return TRUE;

View File

@ -170,7 +170,7 @@ int CHeadCrab::Classify( void )
//=========================================================
Vector CHeadCrab::Center( void )
{
return Vector( pev->origin.x, pev->origin.y, pev->origin.z + 6 );
return Vector( pev->origin.x, pev->origin.y, pev->origin.z + 6.0f );
}
Vector CHeadCrab::BodyTarget( const Vector &posSrc )
@ -241,7 +241,7 @@ void CHeadCrab::HandleAnimEvent( MonsterEvent_t *pEvent )
// Scale the sideways velocity to get there at the right time
vecJumpDir = m_hEnemy->pev->origin + m_hEnemy->pev->view_ofs - pev->origin;
vecJumpDir = vecJumpDir * ( 1.0 / time );
vecJumpDir = vecJumpDir * ( 1.0f / time );
// Speed to offset gravity at the desired height
vecJumpDir.z = speed;
@ -249,23 +249,23 @@ void CHeadCrab::HandleAnimEvent( MonsterEvent_t *pEvent )
// Don't jump too far/fast
float distance = vecJumpDir.Length();
if( distance > 650 )
if( distance > 650.0f )
{
vecJumpDir = vecJumpDir * ( 650.0 / distance );
vecJumpDir = vecJumpDir * ( 650.0f / distance );
}
}
else
{
// jump hop, don't care where
vecJumpDir = Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, gpGlobals->v_up.z ) * 350;
vecJumpDir = Vector( gpGlobals->v_forward.x, gpGlobals->v_forward.y, gpGlobals->v_up.z ) * 350.0f;
}
int iSound = RANDOM_LONG(0,2);
int iSound = RANDOM_LONG( 0, 2 );
if( iSound != 0 )
EMIT_SOUND_DYN( edict(), CHAN_VOICE, pAttackSounds[iSound], GetSoundVolue(), ATTN_IDLE, 0, GetVoicePitch() );
pev->velocity = vecJumpDir;
m_flNextAttack = gpGlobals->time + 2;
m_flNextAttack = gpGlobals->time + 2.0f;
}
break;
default:
@ -370,7 +370,7 @@ void CHeadCrab::LeapTouch( CBaseEntity *pOther )
void CHeadCrab::PrescheduleThink( void )
{
// make the crab coo a little bit in combat state
if( m_MonsterState == MONSTERSTATE_COMBAT && RANDOM_FLOAT( 0, 5 ) < 0.1 )
if( m_MonsterState == MONSTERSTATE_COMBAT && RANDOM_FLOAT( 0, 5 ) < 0.1f )
{
IdleSound();
}
@ -401,7 +401,7 @@ void CHeadCrab::StartTask( Task_t *pTask )
//=========================================================
BOOL CHeadCrab::CheckRangeAttack1( float flDot, float flDist )
{
if( FBitSet( pev->flags, FL_ONGROUND ) && flDist <= 256 && flDot >= 0.65 )
if( FBitSet( pev->flags, FL_ONGROUND ) && flDist <= 256 && flDot >= 0.65f )
{
return TRUE;
}
@ -416,7 +416,7 @@ BOOL CHeadCrab::CheckRangeAttack2( float flDot, float flDist )
return FALSE;
// BUGBUG: Why is this code here? There is no ACT_RANGE_ATTACK2 animation. I've disabled it for now.
#if 0
if( FBitSet( pev->flags, FL_ONGROUND ) && flDist > 64 && flDist <= 256 && flDot >= 0.5 )
if( FBitSet( pev->flags, FL_ONGROUND ) && flDist > 64 && flDist <= 256 && flDot >= 0.5f )
{
return TRUE;
}
@ -487,11 +487,11 @@ public:
void Spawn( void );
void Precache( void );
void SetYawSpeed( void );
float GetDamageAmount( void ) { return gSkillData.headcrabDmgBite * 0.3; }
float GetDamageAmount( void ) { return gSkillData.headcrabDmgBite * 0.3f; }
BOOL CheckRangeAttack1( float flDot, float flDist );
Schedule_t *GetScheduleOfType ( int Type );
virtual int GetVoicePitch( void ) { return PITCH_NORM + RANDOM_LONG( 40, 50 ); }
virtual float GetSoundVolue( void ) { return 0.8; }
virtual float GetSoundVolue( void ) { return 0.8f; }
};
LINK_ENTITY_TO_CLASS( monster_babycrab, CBabyCrab )
@ -504,7 +504,7 @@ void CBabyCrab::Spawn( void )
pev->renderamt = 192;
UTIL_SetSize( pev, Vector( -12, -12, 0 ), Vector( 12, 12, 24 ) );
pev->health = gSkillData.headcrabHealth * 0.25; // less health than full grown
pev->health = gSkillData.headcrabHealth * 0.25f; // less health than full grown
}
void CBabyCrab::Precache( void )
@ -526,7 +526,7 @@ BOOL CBabyCrab::CheckRangeAttack1( float flDot, float flDist )
return TRUE;
// A little less accurate, but jump from closer
if( flDist <= 180 && flDot >= 0.55 )
if( flDist <= 180.0f && flDot >= 0.55f )
return TRUE;
}

View File

@ -192,13 +192,13 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
{
if( m_flSoundTime <= gpGlobals->time )
{
m_flSoundTime = gpGlobals->time + 0.62;
m_flSoundTime = gpGlobals->time + 0.62f;
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/medshotno1.wav", 1.0, ATTN_NORM );
}
return;
}
pev->nextthink = pev->ltime + 0.25;
pev->nextthink = pev->ltime + 0.25f;
SetThink( &CWallHealth::Off );
// Time to recharge yet?
@ -210,7 +210,7 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
{
m_iOn++;
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/medshot4.wav", 1.0, ATTN_NORM );
m_flSoundTime = 0.56 + gpGlobals->time;
m_flSoundTime = 0.56f + gpGlobals->time;
}
if( ( m_iOn == 1 ) && ( m_flSoundTime <= gpGlobals->time ) )
{
@ -225,7 +225,7 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
}
// govern the rate of charge
m_flNextCharge = gpGlobals->time + 0.1;
m_flNextCharge = gpGlobals->time + 0.1f;
}
void CWallHealth::Recharge( void )

View File

@ -356,7 +356,7 @@ BOOL CHGrunt::FOkToSpeak( void )
//=========================================================
void CHGrunt::JustSpoke( void )
{
CTalkMonster::g_talkWaitTime = gpGlobals->time + RANDOM_FLOAT( 1.5, 2.0 );
CTalkMonster::g_talkWaitTime = gpGlobals->time + RANDOM_FLOAT( 1.5f, 2.0f );
m_iSentence = HGRUNT_SENT_NONE;
}
@ -375,7 +375,7 @@ void CHGrunt::PrescheduleThink( void )
}
else
{
if( gpGlobals->time - MySquadLeader()->m_flLastEnemySightTime > 5 )
if( gpGlobals->time - MySquadLeader()->m_flLastEnemySightTime > 5.0f )
{
// been a while since we've seen the enemy
MySquadLeader()->m_fEnemyEluded = TRUE;
@ -425,7 +425,7 @@ BOOL CHGrunt::CheckMeleeAttack1( float flDot, float flDist )
}
}
if( flDist <= 64 && flDot >= 0.7 &&
if( flDist <= 64.0f && flDot >= 0.7f &&
pEnemy->Classify() != CLASS_ALIEN_BIOWEAPON &&
pEnemy->Classify() != CLASS_PLAYER_BIOWEAPON )
{
@ -444,7 +444,7 @@ BOOL CHGrunt::CheckMeleeAttack1( float flDot, float flDist )
//=========================================================
BOOL CHGrunt::CheckRangeAttack1( float flDot, float flDist )
{
if( !HasConditions( bits_COND_ENEMY_OCCLUDED ) && flDist <= 2048 && flDot >= 0.5 && NoFriendlyFire() )
if( !HasConditions( bits_COND_ENEMY_OCCLUDED ) && flDist <= 2048.0f && flDot >= 0.5f && NoFriendlyFire() )
{
TraceResult tr;
@ -459,7 +459,7 @@ BOOL CHGrunt::CheckRangeAttack1( float flDot, float flDist )
// verify that a bullet fired from the gun will hit the enemy before the world.
UTIL_TraceLine( vecSrc, m_hEnemy->BodyTarget( vecSrc ), ignore_monsters, ignore_glass, ENT( pev ), &tr );
if( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0f )
{
return TRUE;
}
@ -541,7 +541,7 @@ BOOL CHGrunt::CheckRangeAttack2( float flDot, float flDist )
}
}
if( ( vecTarget - pev->origin ).Length2D() <= 256 )
if( ( vecTarget - pev->origin ).Length2D() <= 256.0f )
{
// crap, I don't want to blow myself up
m_flNextGrenadeCheck = gpGlobals->time + 1; // one full second.
@ -567,7 +567,7 @@ BOOL CHGrunt::CheckRangeAttack2( float flDot, float flDist )
// don't throw
m_fThrowGrenade = FALSE;
// don't check again for a while.
m_flNextGrenadeCheck = gpGlobals->time + 1; // one full second.
m_flNextGrenadeCheck = gpGlobals->time + 1.0f; // one full second.
}
}
else
@ -581,14 +581,14 @@ BOOL CHGrunt::CheckRangeAttack2( float flDot, float flDist )
// throw a hand grenade
m_fThrowGrenade = TRUE;
// don't check again for a while.
m_flNextGrenadeCheck = gpGlobals->time + 0.3; // 1/3 second.
m_flNextGrenadeCheck = gpGlobals->time + 0.3f; // 1/3 second.
}
else
{
// don't throw
m_fThrowGrenade = FALSE;
// don't check again for a while.
m_flNextGrenadeCheck = gpGlobals->time + 1; // one full second.
m_flNextGrenadeCheck = gpGlobals->time + 1.0f; // one full second.
}
}
@ -611,7 +611,7 @@ void CHGrunt::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
if( flDamage <= 0 )
{
UTIL_Ricochet( ptr->vecEndPos, 1.0 );
flDamage = 0.01;
flDamage = 0.01f;
}
}
// it's head shot anyways
@ -752,7 +752,7 @@ CBaseEntity *CHGrunt::Kick( void )
UTIL_MakeVectors( pev->angles );
Vector vecStart = pev->origin;
vecStart.z += pev->size.z * 0.5;
vecStart.z += pev->size.z * 0.5f;
Vector vecEnd = vecStart + ( gpGlobals->v_forward * 70 );
UTIL_TraceHull( vecStart, vecEnd, dont_ignore_monsters, head_hull, ENT( pev ), &tr );
@ -895,9 +895,9 @@ void CHGrunt::HandleAnimEvent( MonsterEvent_t *pEvent )
CGrenade::ShootContact( pev, GetGunPosition(), m_vecTossVelocity );
m_fThrowGrenade = FALSE;
if( g_iSkillLevel == SKILL_HARD )
m_flNextGrenadeCheck = gpGlobals->time + RANDOM_FLOAT( 2, 5 );// wait a random amount of time before shooting again
m_flNextGrenadeCheck = gpGlobals->time + RANDOM_FLOAT( 2.0f, 5.0f );// wait a random amount of time before shooting again
else
m_flNextGrenadeCheck = gpGlobals->time + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
m_flNextGrenadeCheck = gpGlobals->time + 6.0f;// wait six seconds before even looking again to see if a grenade can be thrown.
}
break;
case HGRUNT_AE_GREN_DROP:
@ -2392,7 +2392,7 @@ void CHGruntRepel::RepelUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
pBeam->SetFlags( BEAM_FSOLID );
pBeam->SetColor( 255, 255, 255 );
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 );
}

View File

@ -69,14 +69,14 @@ void CHornet::Spawn( void )
if( g_pGameRules->IsMultiplayer() )
{
// hornets don't live as long in multiplayer
m_flStopAttack = gpGlobals->time + 3.5;
m_flStopAttack = gpGlobals->time + 3.5f;
}
else
{
m_flStopAttack = gpGlobals->time + 5.0;
m_flStopAttack = gpGlobals->time + 5.0f;
}
m_flFieldOfView = 0.9; // +- 25 degrees
m_flFieldOfView = 0.9f; // +- 25 degrees
if( RANDOM_LONG( 1, 5 ) <= 2 )
{
@ -109,7 +109,7 @@ void CHornet::Spawn( void )
pev->dmg = gSkillData.monDmgHornet;
}
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
ResetSequenceInfo();
}
@ -169,7 +169,7 @@ void CHornet::StartTrack( void )
SetTouch( &CHornet::TrackTouch );
SetThink( &CHornet::TrackTarget );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
//=========================================================
@ -182,7 +182,7 @@ void CHornet::StartDart( void )
SetTouch( &CHornet::DartTouch );
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time + 4;
pev->nextthink = gpGlobals->time + 4.0f;
}
void CHornet::IgniteTrail( void )
@ -253,7 +253,7 @@ void CHornet::TrackTarget( void )
{
SetTouch( NULL );
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
return;
}
@ -271,12 +271,12 @@ void CHornet::TrackTarget( void )
}
else
{
m_vecEnemyLKP = m_vecEnemyLKP + pev->velocity * m_flFlySpeed * 0.1;
m_vecEnemyLKP = m_vecEnemyLKP + pev->velocity * m_flFlySpeed * 0.1f;
}
vecDirToEnemy = ( m_vecEnemyLKP - pev->origin ).Normalize();
if( pev->velocity.Length() < 0.1 )
if( pev->velocity.Length() < 0.1f )
vecFlightDir = vecDirToEnemy;
else
vecFlightDir = pev->velocity.Normalize();
@ -284,7 +284,7 @@ void CHornet::TrackTarget( void )
// measure how far the turn is, the wider the turn, the slow we'll go this time.
flDelta = DotProduct( vecFlightDir, vecDirToEnemy );
if( flDelta < 0.5 )
if( flDelta < 0.5f )
{
// hafta turn wide again. play sound
switch( RANDOM_LONG( 0, 2 ) )
@ -304,7 +304,7 @@ void CHornet::TrackTarget( void )
if( flDelta <= 0 && m_iHornetType == HORNET_TYPE_RED )
{
// no flying backwards, but we don't want to invert this, cause we'd go fast when we have to turn REAL far.
flDelta = 0.25;
flDelta = 0.25f;
}
pev->velocity = ( vecFlightDir + vecDirToEnemy ).Normalize();
@ -312,20 +312,20 @@ void CHornet::TrackTarget( void )
if( pev->owner && ( pev->owner->v.flags & FL_MONSTER ) )
{
// random pattern only applies to hornets fired by monsters, not players.
pev->velocity.x += RANDOM_FLOAT( -0.10, 0.10 );// scramble the flight dir a bit.
pev->velocity.y += RANDOM_FLOAT( -0.10, 0.10 );
pev->velocity.z += RANDOM_FLOAT( -0.10, 0.10 );
pev->velocity.x += RANDOM_FLOAT( -0.10f, 0.10f );// scramble the flight dir a bit.
pev->velocity.y += RANDOM_FLOAT( -0.10f, 0.10f );
pev->velocity.z += RANDOM_FLOAT( -0.10f, 0.10f );
}
switch( m_iHornetType )
{
case HORNET_TYPE_RED:
pev->velocity = pev->velocity * ( m_flFlySpeed * flDelta );// scale the dir by the ( speed * width of turn )
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1, 0.3 );
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1f, 0.3f );
break;
case HORNET_TYPE_ORANGE:
pev->velocity = pev->velocity * m_flFlySpeed;// do not have to slow down to turn.
pev->nextthink = gpGlobals->time + 0.1;// fixed think time
pev->nextthink = gpGlobals->time + 0.1f;// fixed think time
break;
}
@ -337,7 +337,7 @@ void CHornet::TrackTarget( void )
// (only in the single player game)
if( m_hEnemy != 0 && !g_pGameRules->IsMultiplayer() )
{
if( flDelta >= 0.4 && ( pev->origin - m_vecEnemyLKP ).Length() <= 300 )
if( flDelta >= 0.4f && ( pev->origin - m_vecEnemyLKP ).Length() <= 300 )
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_SPRITE );
@ -362,8 +362,8 @@ void CHornet::TrackTarget( void )
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "hornet/ag_buzz3.wav", HORNET_BUZZ_VOLUME, ATTN_NORM );
break;
}
pev->velocity = pev->velocity * 2;
pev->nextthink = gpGlobals->time + 1.0;
pev->velocity = pev->velocity * 2.0f;
pev->nextthink = gpGlobals->time + 1.0f;
// don't attack again
m_flStopAttack = gpGlobals->time;
}
@ -388,10 +388,10 @@ void CHornet::TrackTouch( CBaseEntity *pOther )
pev->velocity = pev->velocity.Normalize();
pev->velocity.x *= -1;
pev->velocity.y *= -1;
pev->velocity.x *= -1.0f;
pev->velocity.y *= -1.0f;
pev->origin = pev->origin + pev->velocity * 4; // bounce the hornet off a bit.
pev->origin = pev->origin + pev->velocity * 4.0f; // bounce the hornet off a bit.
pev->velocity = pev->velocity * m_flFlySpeed;
return;
@ -431,5 +431,5 @@ void CHornet::DieTouch( CBaseEntity *pOther )
pev->solid = SOLID_NOT;
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time + 1;// stick around long enough for the sound to finish!
pev->nextthink = gpGlobals->time + 1.0f;// stick around long enough for the sound to finish!
}

View File

@ -113,7 +113,7 @@ BOOL CHgun::Deploy()
void CHgun::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
SendWeaponAnim( HGUN_DOWN );
//!!!HACKHACK - can't select hornetgun if it's empty! no way to get ammo for it, either.
@ -127,17 +127,17 @@ void CHgun::PrimaryAttack()
{
Reload();
if(m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
{
return;
}
#ifndef CLIENT_DLL
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
CBaseEntity *pHornet = CBaseEntity::Create( "hornet", m_pPlayer->GetGunPosition( ) + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12, m_pPlayer->pev->v_angle, m_pPlayer->edict() );
pHornet->pev->velocity = gpGlobals->v_forward * 300;
CBaseEntity *pHornet = CBaseEntity::Create( "hornet", m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16.0f + gpGlobals->v_right * 8.0f + gpGlobals->v_up * -12.0f, m_pPlayer->pev->v_angle, m_pPlayer->edict() );
pHornet->pev->velocity = gpGlobals->v_forward * 300.0f;
m_flRechargeTime = gpGlobals->time + 0.5;
m_flRechargeTime = gpGlobals->time + 0.5f;
#endif
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
@ -150,16 +150,16 @@ void CHgun::PrimaryAttack()
#else
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, FIREMODE_TRACK, 0, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, FIREMODE_TRACK, 0, 0, 0 );
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.25;
m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.25f;
if( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
{
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f;
}
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
@ -181,49 +181,49 @@ void CHgun::SecondaryAttack( void )
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12;
vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16.0f + gpGlobals->v_right * 8.0f + gpGlobals->v_up * -12.0f;
m_iFirePhase++;
switch( m_iFirePhase )
{
case 1:
vecSrc = vecSrc + gpGlobals->v_up * 8;
vecSrc = vecSrc + gpGlobals->v_up * 8.0f;
break;
case 2:
vecSrc = vecSrc + gpGlobals->v_up * 8;
vecSrc = vecSrc + gpGlobals->v_right * 8;
vecSrc = vecSrc + gpGlobals->v_up * 8.0f;
vecSrc = vecSrc + gpGlobals->v_right * 8.0f;
break;
case 3:
vecSrc = vecSrc + gpGlobals->v_right * 8;
vecSrc = vecSrc + gpGlobals->v_right * 8.0f;
break;
case 4:
vecSrc = vecSrc + gpGlobals->v_up * -8;
vecSrc = vecSrc + gpGlobals->v_right * 8;
vecSrc = vecSrc + gpGlobals->v_up * -8.0f;
vecSrc = vecSrc + gpGlobals->v_right * 8.0f;
break;
case 5:
vecSrc = vecSrc + gpGlobals->v_up * -8;
vecSrc = vecSrc + gpGlobals->v_up * -8.0f;
break;
case 6:
vecSrc = vecSrc + gpGlobals->v_up * -8;
vecSrc = vecSrc + gpGlobals->v_right * -8;
vecSrc = vecSrc + gpGlobals->v_up * -8.0f;
vecSrc = vecSrc + gpGlobals->v_right * -8.0f;
break;
case 7:
vecSrc = vecSrc + gpGlobals->v_right * -8;
vecSrc = vecSrc + gpGlobals->v_right * -8.0f;
break;
case 8:
vecSrc = vecSrc + gpGlobals->v_up * 8;
vecSrc = vecSrc + gpGlobals->v_right * -8;
vecSrc = vecSrc + gpGlobals->v_up * 8.0f;
vecSrc = vecSrc + gpGlobals->v_right * -8.0f;
m_iFirePhase = 0;
break;
}
pHornet = CBaseEntity::Create( "hornet", vecSrc, m_pPlayer->pev->v_angle, m_pPlayer->edict() );
pHornet->pev->velocity = gpGlobals->v_forward * 1200;
pHornet->pev->velocity = gpGlobals->v_forward * 1200.0f;
pHornet->pev->angles = UTIL_VecToAngles( pHornet->pev->velocity );
pHornet->SetThink( &CHornet::StartDart );
m_flRechargeTime = gpGlobals->time + 0.5;
m_flRechargeTime = gpGlobals->time + 0.5f;
#endif
int flags;
#if defined( CLIENT_WEAPONS )
@ -231,7 +231,7 @@ void CHgun::SecondaryAttack( void )
#else
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, FIREMODE_FAST, 0, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, FIREMODE_FAST, 0, 0, 0 );
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
@ -240,8 +240,8 @@ void CHgun::SecondaryAttack( void )
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
}
void CHgun::Reload( void )
@ -252,7 +252,7 @@ void CHgun::Reload( void )
while( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time )
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++;
m_flRechargeTime += 0.5;
m_flRechargeTime += 0.5f;
}
}
@ -264,21 +264,21 @@ void CHgun::WeaponIdle( void )
return;
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand <= 0.75 )
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0f, 1.0f );
if( flRand <= 0.75f )
{
iAnim = HGUN_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 30.0 / 16 * ( 2 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 30.0f / 16.0f * 2.0f;
}
else if( flRand <= 0.875 )
else if( flRand <= 0.875f )
{
iAnim = HGUN_FIDGETSWAY;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0 / 16.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0f / 16.0f;
}
else
{
iAnim = HGUN_FIDGETSHAKE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 35.0 / 16.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 35.0f / 16.0f;
}
SendWeaponAnim( iAnim );
}

View File

@ -32,8 +32,8 @@ extern CGraph WorldGraph;
// houndeye does 20 points of damage spread over a sphere 384 units in diameter, and each additional
// squad member increases the BASE damage by 110%, per the spec.
#define HOUNDEYE_MAX_SQUAD_SIZE 4
#define HOUNDEYE_MAX_ATTACK_RADIUS 384
#define HOUNDEYE_SQUAD_BONUS (float)1.1
#define HOUNDEYE_MAX_ATTACK_RADIUS 384.0f
#define HOUNDEYE_SQUAD_BONUS 1.1f
#define HOUNDEYE_EYE_FRAMES 4 // how many different switchable maps for the eye
@ -192,7 +192,7 @@ BOOL CHoundeye::FCanActiveIdle( void )
//=========================================================
BOOL CHoundeye::CheckRangeAttack1( float flDot, float flDist )
{
if( flDist <= ( HOUNDEYE_MAX_ATTACK_RADIUS * 0.5 ) && flDot >= 0.3 )
if( flDist <= ( HOUNDEYE_MAX_ATTACK_RADIUS * 0.5f ) && flDot >= 0.3f )
{
return TRUE;
}
@ -285,8 +285,8 @@ void CHoundeye::HandleAnimEvent( MonsterEvent_t *pEvent )
pev->flags &= ~FL_ONGROUND;
pev->velocity = gpGlobals->v_forward * -200;
pev->velocity.z += ( 0.6 * flGravity ) * 0.5;
pev->velocity = gpGlobals->v_forward * -200.0f;
pev->velocity.z += ( 0.6f * flGravity ) * 0.5f;
break;
}
case HOUND_AE_THUMP:
@ -565,10 +565,10 @@ void CHoundeye::SonicAttack( void )
WRITE_BYTE( TE_BEAMCYLINDER );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z + 16 );
WRITE_COORD( pev->origin.z + 16.0f );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z + 16 + HOUNDEYE_MAX_ATTACK_RADIUS / .2 ); // reach damage radius over .3 seconds
WRITE_COORD( pev->origin.z + 16.0f + HOUNDEYE_MAX_ATTACK_RADIUS / 0.2f ); // reach damage radius over .3 seconds
WRITE_SHORT( m_iSpriteTexture );
WRITE_BYTE( 0 ); // startframe
WRITE_BYTE( 0 ); // framerate
@ -586,10 +586,10 @@ void CHoundeye::SonicAttack( void )
WRITE_BYTE( TE_BEAMCYLINDER );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z + 16 );
WRITE_COORD( pev->origin.z + 16.0f );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z + 16 + ( HOUNDEYE_MAX_ATTACK_RADIUS / 2 ) / .2 ); // reach damage radius over .3 seconds
WRITE_COORD( pev->origin.z + 16.0f + ( HOUNDEYE_MAX_ATTACK_RADIUS / 2.0f ) / 0.2f ); // reach damage radius over .3 seconds
WRITE_SHORT( m_iSpriteTexture );
WRITE_BYTE( 0 ); // startframe
WRITE_BYTE( 0 ); // framerate
@ -638,7 +638,7 @@ void CHoundeye::SonicAttack( void )
// if this entity is a client, and is not in full view, inflict half damage. We do this so that players still
// take the residual damage if they don't totally leave the houndeye's effective radius. We restrict it to clients
// so that monsters in other parts of the level don't take the damage and get pissed.
flAdjustedDamage *= 0.5;
flAdjustedDamage *= 0.5f;
}
else if( !FClassnameIs( pEntity->pev, "func_breakable" ) && !FClassnameIs( pEntity->pev, "func_pushable" ) )
{
@ -802,17 +802,17 @@ void CHoundeye::RunTask( Task_t *pTask )
float life;
life = ( ( 255 - pev->frame ) / ( pev->framerate * m_flFrameRate ) );
if( life < 0.1 )
life = 0.1;
if( life < 0.1f )
life = 0.1f;
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_IMPLOSION );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z + 16 );
WRITE_BYTE( 50 * life + 100 ); // radius
WRITE_BYTE( pev->frame / 25.0 ); // count
WRITE_BYTE( life * 10 ); // life
WRITE_COORD( pev->origin.z + 16.0f );
WRITE_BYTE( 50.0f * life + 100.0f ); // radius
WRITE_BYTE( pev->frame / 25.0f ); // count
WRITE_BYTE( life * 10.0f ); // life
MESSAGE_END();
if( m_fSequenceFinished )
@ -836,7 +836,7 @@ void CHoundeye::RunTask( Task_t *pTask )
void CHoundeye::PrescheduleThink( void )
{
// if the hound is mad and is running, make hunt noises.
if( m_MonsterState == MONSTERSTATE_COMBAT && m_Activity == ACT_RUN && RANDOM_FLOAT( 0, 1 ) < 0.2 )
if( m_MonsterState == MONSTERSTATE_COMBAT && m_Activity == ACT_RUN && RANDOM_FLOAT( 0, 1 ) < 0.2f )
{
WarnSound();
}
@ -882,8 +882,8 @@ void CHoundeye::PrescheduleThink( void )
//=========================================================
Task_t tlHoundGuardPack[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_GUARD, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_GUARD, 0.0f },
};
Schedule_t slHoundGuardPack[] =
@ -1079,14 +1079,14 @@ Task_t tlHoundCombatFailPVS[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_HOUND_THREAT_DISPLAY, 0 },
{ TASK_WAIT_FACE_ENEMY, (float)1 },
{ TASK_WAIT_FACE_ENEMY, 1.0f },
};
Schedule_t slHoundCombatFailPVS[] =
{
{
tlHoundCombatFailPVS,
ARRAYSIZE ( tlHoundCombatFailPVS ),
ARRAYSIZE( tlHoundCombatFailPVS ),
bits_COND_NEW_ENEMY |
bits_COND_LIGHT_DAMAGE |
bits_COND_HEAVY_DAMAGE,
@ -1260,13 +1260,13 @@ Schedule_t *CHoundeye::GetSchedule( void )
if( HasConditions( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ) )
{
if( RANDOM_FLOAT( 0, 1 ) <= 0.4 )
if( RANDOM_FLOAT( 0.0f, 1.0f ) <= 0.4f )
{
TraceResult tr;
UTIL_MakeVectors( pev->angles );
UTIL_TraceHull( pev->origin, pev->origin + gpGlobals->v_forward * -128, dont_ignore_monsters, head_hull, ENT( pev ), &tr );
if( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0f )
{
// it's clear behind, so the hound will jump
return GetScheduleOfType( SCHED_HOUND_HOP_RETREAT );

View File

@ -32,7 +32,7 @@
#define SEARCH_RETRY 16
#define ICHTHYOSAUR_SPEED 150
#define ICHTHYOSAUR_SPEED 150.0f
extern CGraph WorldGraph;
@ -328,7 +328,7 @@ int CIchthyosaur::Classify( void )
//=========================================================
BOOL CIchthyosaur::CheckMeleeAttack1( float flDot, float flDist )
{
if( flDot >= 0.7 && m_flEnemyTouched > gpGlobals->time - 0.2 )
if( flDot >= 0.7f && m_flEnemyTouched > gpGlobals->time - 0.2f )
{
return TRUE;
}
@ -366,7 +366,7 @@ void CIchthyosaur::CombatUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE
//=========================================================
BOOL CIchthyosaur::CheckRangeAttack1( float flDot, float flDist )
{
if( flDot > -0.7 && (m_bOnAttack || ( flDist <= 192 && m_idealDist <= 192 ) ) )
if( flDot > -0.7f && (m_bOnAttack || ( flDist <= 192 && m_idealDist <= 192 ) ) )
{
return TRUE;
}
@ -420,22 +420,22 @@ void CIchthyosaur::HandleAnimEvent( MonsterEvent_t *pEvent )
{
CBaseEntity *pHurt = m_hEnemy;
if( m_flEnemyTouched < gpGlobals->time - 0.2 && ( m_hEnemy->BodyTarget( pev->origin ) - pev->origin).Length() > ( 32 + 16 + 32 ) )
if( m_flEnemyTouched < gpGlobals->time - 0.2f && ( m_hEnemy->BodyTarget( pev->origin ) - pev->origin).Length() > ( 32.0f + 16.0f + 32.0f ) )
break;
Vector vecShootDir = ShootAtEnemy( pev->origin );
UTIL_MakeAimVectors( pev->angles );
if( DotProduct( vecShootDir, gpGlobals->v_forward ) > 0.707 )
if( DotProduct( vecShootDir, gpGlobals->v_forward ) > 0.707f )
{
m_bOnAttack = TRUE;
pHurt->pev->punchangle.z = -18;
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 300;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 300.0f;
if( pHurt->IsPlayer() )
{
pHurt->pev->angles.x += RANDOM_FLOAT( -35, 35 );
pHurt->pev->angles.y += RANDOM_FLOAT( -90, 90 );
pHurt->pev->angles.x += RANDOM_FLOAT( -35.0f, 35.0f );
pHurt->pev->angles.y += RANDOM_FLOAT( -90.0f, 90.0f );
pHurt->pev->angles.z = 0;
pHurt->pev->fixangle = TRUE;
}
@ -454,7 +454,7 @@ void CIchthyosaur::HandleAnimEvent( MonsterEvent_t *pEvent )
if( bDidAttack )
{
Vector vecSrc = pev->origin + gpGlobals->v_forward * 32;
Vector vecSrc = pev->origin + gpGlobals->v_forward * 32.0f;
UTIL_Bubbles( vecSrc - Vector( 8, 8, 8 ), vecSrc + Vector( 8, 8, 8 ), 16 );
}
}
@ -478,7 +478,7 @@ void CIchthyosaur::Spawn()
m_MonsterState = MONSTERSTATE_NONE;
SetBits(pev->flags, FL_SWIM);
SetFlyingSpeed( ICHTHYOSAUR_SPEED );
SetFlyingMomentum( 2.5 ); // Set momentum constant
SetFlyingMomentum( 2.5f ); // Set momentum constant
m_afCapability = bits_CAP_RANGE_ATTACK1 | bits_CAP_SWIM;
@ -634,9 +634,9 @@ void CIchthyosaur::RunTask( Task_t *pTask )
Vector vecSwim = CrossProduct( vecDelta, Vector( 0, 0, 1 ) ).Normalize();
if( DotProduct( vecSwim, m_SaveVelocity ) < 0 )
vecSwim = vecSwim * -1.0;
vecSwim = vecSwim * -1.0f;
Vector vecPos = vecFrom + vecDelta * m_idealDist + vecSwim * 32;
Vector vecPos = vecFrom + vecDelta * m_idealDist + vecSwim * 32.0f;
// ALERT( at_console, "vecPos %.0f %.0f %.0f\n", vecPos.x, vecPos.y, vecPos.z );
@ -644,16 +644,16 @@ void CIchthyosaur::RunTask( Task_t *pTask )
UTIL_TraceHull( vecFrom, vecPos, ignore_monsters, large_hull, m_hEnemy->edict(), &tr );
if( tr.flFraction > 0.5 )
if( tr.flFraction > 0.5f )
vecPos = tr.vecEndPos;
m_SaveVelocity = m_SaveVelocity * 0.8 + 0.2 * ( vecPos - pev->origin ).Normalize() * m_flightSpeed;
m_SaveVelocity = m_SaveVelocity * 0.8f + 0.2f * ( vecPos - pev->origin ).Normalize() * m_flightSpeed;
// ALERT( at_console, "m_SaveVelocity %.2f %.2f %.2f\n", m_SaveVelocity.x, m_SaveVelocity.y, m_SaveVelocity.z );
if( HasConditions( bits_COND_ENEMY_FACING_ME ) && m_hEnemy->FVisible( this ) )
{
m_flNextAlert -= 0.1;
m_flNextAlert -= 0.1f;
if( m_idealDist < m_flMaxDist )
{
@ -670,12 +670,12 @@ void CIchthyosaur::RunTask( Task_t *pTask )
}
if( m_flMinSpeed < m_flMaxSpeed )
{
m_flMinSpeed += 0.5;
m_flMinSpeed += 0.5f;
}
}
else
{
m_flNextAlert += 0.1;
m_flNextAlert += 0.1f;
if( m_idealDist > 128 )
{
@ -690,7 +690,7 @@ void CIchthyosaur::RunTask( Task_t *pTask )
}
else
{
m_flNextAlert = gpGlobals->time + 0.2;
m_flNextAlert = gpGlobals->time + 0.2f;
}
if( m_flNextAlert < gpGlobals->time )
@ -716,7 +716,7 @@ void CIchthyosaur::RunTask( Task_t *pTask )
break;
case TASK_ICHTHYOSAUR_FLOAT:
pev->angles.x = UTIL_ApproachAngle( 0, pev->angles.x, 20 );
pev->velocity = pev->velocity * 0.8;
pev->velocity = pev->velocity * 0.8f;
if( pev->waterlevel > 1 && pev->velocity.z < 64 )
{
pev->velocity.z += 8;
@ -740,7 +740,7 @@ float CIchthyosaur::VectorToPitch( const Vector &vec )
pitch = 0;
else
{
pitch = (int) ( atan2( vec.z, sqrt( vec.x * vec.x + vec.y * vec.y ) ) * 180 / M_PI );
pitch = (int) ( atan2( vec.z, sqrt( vec.x * vec.x + vec.y * vec.y ) ) * 180.0f / M_PI_F );
if( pitch < 0 )
pitch += 360;
}
@ -793,7 +793,7 @@ float CIchthyosaur::ChangePitch( int speed )
else if( diff > 20 )
target = -45;
}
pev->angles.x = UTIL_Approach(target, pev->angles.x, 220.0 * 0.1 );
pev->angles.x = UTIL_Approach(target, pev->angles.x, 220.0f * 0.1f );
}
return 0;
}
@ -812,7 +812,7 @@ float CIchthyosaur::ChangeYaw( int speed )
else if( diff > 20 )
target = -20;
}
pev->angles.z = UTIL_Approach( target, pev->angles.z, 220.0 * 0.1 );
pev->angles.z = UTIL_Approach( target, pev->angles.z, 220.0f * 0.1f );
}
return CFlyingMonster::ChangeYaw( speed );
}
@ -843,9 +843,9 @@ void CIchthyosaur::MonsterThink( void )
if( m_flBlink < gpGlobals->time )
{
pev->skin = EYE_CLOSED;
if( m_flBlink + 0.2 < gpGlobals->time )
if( m_flBlink + 0.2f < gpGlobals->time )
{
m_flBlink = gpGlobals->time + RANDOM_FLOAT( 3, 4 );
m_flBlink = gpGlobals->time + RANDOM_FLOAT( 3.0f, 4.0f );
if( m_bOnAttack )
pev->skin = EYE_MAD;
else
@ -873,7 +873,7 @@ void CIchthyosaur::Swim()
if( FBitSet( pev->flags, FL_ONGROUND ) )
{
pev->angles.x = 0;
pev->angles.x = 0.0f;
pev->angles.y += RANDOM_FLOAT( -45, 45 );
ClearBits( pev->flags, FL_ONGROUND );
@ -894,15 +894,15 @@ void CIchthyosaur::Swim()
if( m_IdealActivity == ACT_RUN )
SetActivity( ACT_WALK );
if( m_IdealActivity == ACT_WALK )
pev->framerate = m_flightSpeed / 150.0;
pev->framerate = m_flightSpeed / 150.0f;
// ALERT( at_console, "walk %.2f\n", pev->framerate );
}
else
{
if( m_IdealActivity == ACT_WALK )
SetActivity( ACT_RUN );
if( m_IdealActivity == ACT_RUN)
pev->framerate = m_flightSpeed / 150.0;
if( m_IdealActivity == ACT_RUN )
pev->framerate = m_flightSpeed / 150.0f;
// ALERT( at_console, "run %.2f\n", pev->framerate );
}
/*
@ -935,10 +935,10 @@ void CIchthyosaur::Swim()
// ALERT( at_console, "%f : %f\n", Angles.x, Forward.z );
float flDot = DotProduct( Forward, m_SaveVelocity );
if( flDot > 0.5 )
if( flDot > 0.5f )
pev->velocity = m_SaveVelocity = m_SaveVelocity * m_flightSpeed;
else if( flDot > 0 )
pev->velocity = m_SaveVelocity = m_SaveVelocity * m_flightSpeed * ( flDot + 0.5 );
pev->velocity = m_SaveVelocity = m_SaveVelocity * m_flightSpeed * ( flDot + 0.5f );
else
pev->velocity = m_SaveVelocity = m_SaveVelocity * 80;
@ -957,7 +957,7 @@ void CIchthyosaur::Swim()
//
if( Angles.x > 180 )
Angles.x = Angles.x - 360;
pev->angles.x = UTIL_Approach( Angles.x, pev->angles.x, 50 * 0.1 );
pev->angles.x = UTIL_Approach( Angles.x, pev->angles.x, 50 * 0.1f );
if( pev->angles.x < -80 )
pev->angles.x = -80;
if( pev->angles.x > 80 )
@ -981,12 +981,12 @@ void CIchthyosaur::Swim()
turn = Angles.y - pev->angles.y - 360;
}
float speed = m_flightSpeed * 0.1;
float speed = m_flightSpeed * 0.1f;
// ALERT( at_console, "speed %.0f %f\n", turn, speed );
if( fabs( turn ) > speed )
{
if( turn < 0.0 )
if( turn < 0.0f )
{
turn = -speed;
}
@ -997,15 +997,15 @@ void CIchthyosaur::Swim()
}
pev->angles.y += turn;
pev->angles.z -= turn;
pev->angles.y = fmod( ( pev->angles.y + 360.0 ), 360.0 );
pev->angles.y = fmod( ( pev->angles.y + 360.0f ), 360.0f );
static float yaw_adj;
yaw_adj = yaw_adj * 0.8 + turn;
yaw_adj = yaw_adj * 0.8f + turn;
// ALERT( at_console, "yaw %f : %f\n", turn, yaw_adj );
SetBoneController( 0, -yaw_adj / 4.0 );
SetBoneController( 0, -yaw_adj * 0.25f );
// Roll Smoothing
//
@ -1022,7 +1022,7 @@ void CIchthyosaur::Swim()
{
turn = Angles.z - pev->angles.z - 360;
}
speed = m_flightSpeed / 2 * 0.1;
speed = m_flightSpeed / 2 * 0.1f;
if( fabs( turn ) < speed )
{
@ -1030,7 +1030,7 @@ void CIchthyosaur::Swim()
}
else
{
if( turn < 0.0 )
if( turn < 0.0f )
{
pev->angles.z -= speed;
}
@ -1058,12 +1058,12 @@ Vector CIchthyosaur::DoProbe( const Vector &Probe )
TraceResult tr;
TRACE_MONSTER_HULL( edict(), pev->origin, Probe, dont_ignore_monsters, edict(), &tr );
if( tr.fAllSolid || tr.flFraction < 0.99 )
if( tr.fAllSolid || tr.flFraction < 0.99f )
{
if( tr.flFraction < 0.0 )
tr.flFraction = 0.0;
if( tr.flFraction > 1.0 )
tr.flFraction = 1.0;
if( tr.flFraction < 0.0f )
tr.flFraction = 0.0f;
if( tr.flFraction > 1.0f )
tr.flFraction = 1.0f;
if( tr.flFraction < frac )
{
frac = tr.flFraction;
@ -1080,7 +1080,7 @@ Vector CIchthyosaur::DoProbe( const Vector &Probe )
Vector SteeringVector = CrossProduct( NormalToProbeAndWallNormal, ProbeDir );
float SteeringForce = m_flightSpeed * ( 1 -frac ) * ( DotProduct( WallNormal.Normalize(), m_SaveVelocity.Normalize() ) );
if( SteeringForce < 0.0 )
if( SteeringForce < 0.0f )
{
SteeringForce = -SteeringForce;
}

View File

@ -467,7 +467,7 @@ BOOL CISlave::CheckRangeAttack2( float flDot, float flDist )
TraceResult tr;
UTIL_TraceLine( EyePosition(), pEntity->EyePosition(), ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 || tr.pHit == pEntity->edict() )
if( tr.flFraction == 1.0f || tr.pHit == pEntity->edict() )
{
if( pEntity->pev->deadflag == DEAD_DEAD )
{
@ -723,7 +723,7 @@ void CISlave::ArmBeam( int side )
}
// Couldn't find anything close enough
if( flDist == 1.0 )
if( flDist == 1.0f )
return;
DecalGunshot( &tr, BULLET_PLAYER_CROWBAR );

View File

@ -96,7 +96,7 @@ void CItem::Spawn( void )
if( DROP_TO_FLOOR(ENT( pev ) ) == 0 )
{
ALERT(at_error, "Item %s fell out of level at %f,%f,%f\n", STRING( pev->classname ), pev->origin.x, pev->origin.y, pev->origin.z);
ALERT(at_error, "Item %s fell out of level at %f,%f,%f\n", STRING( pev->classname ), (double)pev->origin.x, (double)pev->origin.y, (double)pev->origin.z);
UTIL_Remove( this );
return;
}
@ -237,7 +237,7 @@ class CItemBattery : public CItem
// Suit reports new power level
// For some reason this wasn't working in release build -- round it.
pct = (int)( (float)( pPlayer->pev->armorvalue * 100.0 ) * ( 1.0 / MAX_NORMAL_BATTERY ) + 0.5 );
pct = (int)( (float)( pPlayer->pev->armorvalue * 100.0f ) * ( 1.0f / MAX_NORMAL_BATTERY ) + 0.5f );
pct = ( pct / 5 );
if( pct > 0 )
pct--;

View File

@ -48,12 +48,12 @@
#define LEECH_ACCELERATE 10
#define LEECH_CHECK_DIST 45
#define LEECH_SWIM_SPEED 50
#define LEECH_SWIM_ACCEL 80
#define LEECH_SWIM_DECEL 10
#define LEECH_SWIM_SPEED 50.0f
#define LEECH_SWIM_ACCEL 80.0f
#define LEECH_SWIM_DECEL 10.0f
#define LEECH_TURN_RATE 90
#define LEECH_SIZEX 10
#define LEECH_FRAMETIME 0.1
#define LEECH_FRAMETIME 0.1f
#define DEBUG_BEAMS 0
@ -209,16 +209,16 @@ void CLeech::RecalculateWaterlevel( void )
TraceResult tr;
UTIL_TraceLine( pev->origin, vecTest, missile, edict(), &tr );
if( tr.flFraction != 1.0 )
m_bottom = tr.vecEndPos.z + 1;
if( tr.flFraction != 1.0f )
m_bottom = tr.vecEndPos.z + 1.0f;
else
m_bottom = vecTest.z;
m_top = UTIL_WaterLevel( pev->origin, pev->origin.z, pev->origin.z + 400 ) - 1;
// Chop off 20% of the outside range
float newBottom = m_bottom * 0.8 + m_top * 0.2;
m_top = m_bottom * 0.2 + m_top * 0.8;
float newBottom = m_bottom * 0.8f + m_top * 0.2f;
m_top = m_bottom * 0.2f + m_top * 0.8f;
m_bottom = newBottom;
m_height = RANDOM_FLOAT( m_bottom, m_top );
m_waterTime = gpGlobals->time + RANDOM_FLOAT( 5, 7 );
@ -259,14 +259,14 @@ void CLeech::AttackSound( void )
{
if( gpGlobals->time > m_attackSoundTime )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0, ATTN_NORM, 0, PITCH_NORM );
m_attackSoundTime = gpGlobals->time + 0.5;
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAttackSounds[RANDOM_LONG( 0, ARRAYSIZE( pAttackSounds ) - 1 )], 1.0f, ATTN_NORM, 0, PITCH_NORM );
m_attackSoundTime = gpGlobals->time + 0.5f;
}
}
void CLeech::AlertSound( void )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0, ATTN_NORM * 0.5, 0, PITCH_NORM );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, pAlertSounds[RANDOM_LONG( 0, ARRAYSIZE( pAlertSounds ) - 1 )], 1.0f, ATTN_NORM * 0.5f, 0, PITCH_NORM );
}
void CLeech::Precache( void )
@ -289,7 +289,7 @@ int CLeech::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float f
// Nudge the leech away from the damage
if( pevInflictor )
{
pev->velocity = ( pev->origin - pevInflictor->origin ).Normalize() * 25;
pev->velocity = ( pev->origin - pevInflictor->origin ).Normalize() * 25.0f;
}
return CBaseMonster::TakeDamage( pevInflictor, pevAttacker, flDamage, bitsDamageType );
@ -315,7 +315,7 @@ void CLeech::HandleAnimEvent( MonsterEvent_t *pEvent )
dir = dir.Normalize();
face = face.Normalize();
if( DotProduct( dir, face ) > 0.9 ) // Only take damage if the leech is facing the prey
if( DotProduct( dir, face ) > 0.9f ) // Only take damage if the leech is facing the prey
pEnemy->TakeDamage( pev, pev, gSkillData.leechDmgBite, DMG_SLASH );
}
m_stateTime -= 2;
@ -354,12 +354,12 @@ float CLeech::ObstacleDistance( CBaseEntity *pTarget )
if( tr.fStartSolid )
{
pev->speed = -LEECH_SWIM_SPEED * 0.5;
pev->speed = -LEECH_SWIM_SPEED * 0.5f;
//ALERT( at_console, "Stuck from (%f %f %f) to (%f %f %f)\n", pev->oldorigin.x, pev->oldorigin.y, pev->oldorigin.z, pev->origin.x, pev->origin.y, pev->origin.z );
//UTIL_SetOrigin( pev, pev->oldorigin );
}
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
if( ( pTarget == NULL || tr.pHit != pTarget->edict() ) )
{
@ -377,16 +377,16 @@ float CLeech::ObstacleDistance( CBaseEntity *pTarget )
// extra wide checks
vecTest = pev->origin + gpGlobals->v_right * LEECH_SIZEX * 2 + gpGlobals->v_forward * LEECH_CHECK_DIST;
UTIL_TraceLine( pev->origin, vecTest, missile, edict(), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
return tr.flFraction;
vecTest = pev->origin - gpGlobals->v_right * LEECH_SIZEX * 2 + gpGlobals->v_forward * LEECH_CHECK_DIST;
UTIL_TraceLine( pev->origin, vecTest, missile, edict(), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
return tr.flFraction;
// Didn't hit either side, so stop testing for another 0.5 - 1 seconds
m_sideTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 1 );
m_sideTime = gpGlobals->time + RANDOM_FLOAT( 0.5f, 1.0f );
}
return 1.0;
}
@ -408,7 +408,7 @@ void CLeech::DeadThink( void )
}
}
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
// Apply damage velocity, but keep out of the walls
if( pev->velocity.x != 0 || pev->velocity.y != 0 )
@ -416,11 +416,11 @@ void CLeech::DeadThink( void )
TraceResult tr;
// Look 0.5 seconds ahead
UTIL_TraceLine( pev->origin, pev->origin + pev->velocity * 0.5, missile, edict(), &tr );
if( tr.flFraction != 1.0 )
UTIL_TraceLine( pev->origin, pev->origin + pev->velocity * 0.5f, missile, edict(), &tr );
if( tr.flFraction != 1.0f )
{
pev->velocity.x = 0;
pev->velocity.y = 0;
pev->velocity.x = 0.0f;
pev->velocity.y = 0.0f;
}
}
}
@ -428,15 +428,15 @@ void CLeech::DeadThink( void )
void CLeech::UpdateMotion( void )
{
float flapspeed = ( pev->speed - m_flAccelerate ) / LEECH_ACCELERATE;
m_flAccelerate = m_flAccelerate * 0.8 + pev->speed * 0.2;
m_flAccelerate = m_flAccelerate * 0.8f + pev->speed * 0.2f;
if( flapspeed < 0 )
flapspeed = -flapspeed;
flapspeed += 1.0;
if( flapspeed < 0.5 )
flapspeed = 0.5;
if( flapspeed > 1.9 )
flapspeed = 1.9;
flapspeed += 1.0f;
if( flapspeed < 0.5f )
flapspeed = 0.5f;
if( flapspeed > 1.9f )
flapspeed = 1.9f;
pev->framerate = flapspeed;
@ -445,9 +445,9 @@ void CLeech::UpdateMotion( void )
else
pev->avelocity.y = pev->ideal_yaw * m_obstacle;
if( pev->avelocity.y > 150 )
if( pev->avelocity.y > 150.0f )
m_IdealActivity = ACT_TURN_LEFT;
else if( pev->avelocity.y < -150 )
else if( pev->avelocity.y < -150.0f )
m_IdealActivity = ACT_TURN_RIGHT;
else
m_IdealActivity = ACT_SWIM;
@ -463,10 +463,10 @@ void CLeech::UpdateMotion( void )
else
targetPitch = 0;
pev->angles.x = UTIL_Approach( targetPitch, pev->angles.x, 60 * LEECH_FRAMETIME );
pev->angles.x = UTIL_Approach( targetPitch, pev->angles.x, 60.0f * LEECH_FRAMETIME );
// bank
pev->avelocity.z = -( pev->angles.z + ( pev->avelocity.y * 0.25 ) );
pev->avelocity.z = -( pev->angles.z + ( pev->avelocity.y * 0.25f ) );
if( m_MonsterState == MONSTERSTATE_COMBAT && HasConditions( bits_COND_CAN_MELEE_ATTACK1 ) )
m_IdealActivity = ACT_MELEE_ATTACK1;
@ -479,11 +479,11 @@ void CLeech::UpdateMotion( void )
pev->velocity = g_vecZero;
// Animation will intersect the floor if either of these is non-zero
pev->angles.z = 0;
pev->angles.x = 0;
pev->angles.z = 0.0f;
pev->angles.x = 0.0f;
if( pev->framerate < 1.0 )
pev->framerate = 1.0;
if( pev->framerate < 1.0f )
pev->framerate = 1.0f;
}
else if( pev->movetype == MOVETYPE_TOSS )
{
@ -505,11 +505,11 @@ void CLeech::UpdateMotion( void )
if( !m_pt )
m_pt = CBeam::BeamCreate( "sprites/laserbeam.spr", 5 );
m_pb->PointsInit( pev->origin, pev->origin + gpGlobals->v_forward * LEECH_CHECK_DIST );
m_pt->PointsInit( pev->origin, pev->origin - gpGlobals->v_right * ( pev->avelocity.y * 0.25 ) );
m_pt->PointsInit( pev->origin, pev->origin - gpGlobals->v_right * ( pev->avelocity.y * 0.25f ) );
if( m_fPathBlocked )
{
float color = m_obstacle * 30;
if( m_obstacle == 1.0 )
if( m_obstacle == 1.0f )
color = 0;
if( color > 255 )
color = 255;
@ -532,12 +532,12 @@ void CLeech::SwimThink( void )
if( FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) )
{
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 1, 1.5 );
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 1.0f, 1.5f );
pev->velocity = g_vecZero;
return;
}
else
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
targetSpeed = LEECH_SWIM_SPEED;
@ -572,10 +572,10 @@ void CLeech::SwimThink( void )
targetYaw = UTIL_AngleDiff( targetYaw, UTIL_AngleMod( pev->angles.y ) );
if( targetYaw < ( -LEECH_TURN_RATE * 0.75 ) )
targetYaw = ( -LEECH_TURN_RATE * 0.75 );
else if( targetYaw > ( LEECH_TURN_RATE * 0.75 ) )
targetYaw = ( LEECH_TURN_RATE * 0.75 );
if( targetYaw < ( -LEECH_TURN_RATE * 0.75f ) )
targetYaw = ( -LEECH_TURN_RATE * 0.75f );
else if( targetYaw > ( LEECH_TURN_RATE * 0.75f ) )
targetYaw = ( LEECH_TURN_RATE * 0.75f );
else
targetSpeed *= 2;
}
@ -584,7 +584,7 @@ void CLeech::SwimThink( void )
if( m_zTime < gpGlobals->time )
{
float newHeight = RANDOM_FLOAT( m_bottom, m_top );
m_height = 0.5 * m_height + 0.5 * newHeight;
m_height = 0.5f * m_height + 0.5f * newHeight;
m_zTime = gpGlobals->time + RANDOM_FLOAT( 1, 4 );
}
if( RANDOM_LONG( 0, 100 ) < 10 )
@ -602,11 +602,11 @@ void CLeech::SwimThink( void )
m_obstacle = ObstacleDistance( pTarget );
pev->oldorigin = pev->origin;
if( m_obstacle < 0.1 )
m_obstacle = 0.1;
if( m_obstacle < 0.1f )
m_obstacle = 0.1f;
// is the way ahead clear?
if( m_obstacle == 1.0 )
if( m_obstacle == 1.0f )
{
// if the leech is turning, stop the trend.
if( m_flTurning != 0 )
@ -621,7 +621,7 @@ void CLeech::SwimThink( void )
}
else
{
m_obstacle = 1.0 / m_obstacle;
m_obstacle = 1.0f / m_obstacle;
// IF we get this far in the function, the leader's path is blocked!
m_fPathBlocked = TRUE;
@ -639,12 +639,12 @@ void CLeech::SwimThink( void )
// turn left, right or random depending on clearance ratio
float delta = ( flRightSide - flLeftSide );
if( delta > 0.1 || ( delta > -0.1 && RANDOM_LONG( 0, 100 ) < 50 ) )
if( delta > 0.1f || ( delta > -0.1f && RANDOM_LONG( 0, 100 ) < 50 ) )
m_flTurning = -LEECH_TURN_RATE;
else
m_flTurning = LEECH_TURN_RATE;
}
pev->speed = UTIL_Approach( -( LEECH_SWIM_SPEED * 0.5 ), pev->speed, LEECH_SWIM_DECEL * LEECH_FRAMETIME * m_obstacle );
pev->speed = UTIL_Approach( -( LEECH_SWIM_SPEED * 0.5f ), pev->speed, LEECH_SWIM_DECEL * LEECH_FRAMETIME * m_obstacle );
pev->velocity = gpGlobals->v_forward * pev->speed;
}
pev->ideal_yaw = m_flTurning + targetYaw;

View File

@ -162,9 +162,9 @@ void CEnvLight::KeyValue( KeyValueData* pkvd )
}
// simulate qrad direct, ambient,and gamma adjustments, as well as engine scaling
r = (int)( pow( r / 114.0, 0.6 ) * 264.0 );
g = (int)( pow( g / 114.0, 0.6 ) * 264.0 );
b = (int)( pow( b / 114.0, 0.6 ) * 264.0 );
r = (int)( pow( r / 114.0f, 0.6f ) * 264.0f );
g = (int)( pow( g / 114.0f, 0.6f ) * 264.0f );
b = (int)( pow( b / 114.0f, 0.6f ) * 264.0f );
pkvd->fHandled = TRUE;
sprintf( szColor, "%d", r );
@ -185,11 +185,11 @@ void CEnvLight::Spawn( void )
char szVector[64];
UTIL_MakeAimVectors( pev->angles );
sprintf( szVector, "%f", gpGlobals->v_forward.x );
sprintf( szVector, "%f", (double)gpGlobals->v_forward.x );
CVAR_SET_STRING( "sv_skyvec_x", szVector );
sprintf( szVector, "%f", gpGlobals->v_forward.y );
sprintf( szVector, "%f", (double)gpGlobals->v_forward.y );
CVAR_SET_STRING( "sv_skyvec_y", szVector );
sprintf( szVector, "%f", gpGlobals->v_forward.z );
sprintf( szVector, "%f", (double)gpGlobals->v_forward.z );
CVAR_SET_STRING( "sv_skyvec_z", szVector );
CLight::Spawn();

View File

@ -513,7 +513,7 @@ CSound *CBaseMonster::PBestScent( void )
//=========================================================
void CBaseMonster::MonsterThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;// keep monster thinking.
pev->nextthink = gpGlobals->time + 0.1f;// keep monster thinking.
RunAI();
@ -850,10 +850,10 @@ void CBaseMonster::RouteSimplify( CBaseEntity *pTargetEnt )
Vector vecTest, vecSplit;
// Halfway between this and next
vecTest = ( m_Route[m_iRouteIndex + i + 1].vecLocation + m_Route[m_iRouteIndex + i].vecLocation ) * 0.5;
vecTest = ( m_Route[m_iRouteIndex + i + 1].vecLocation + m_Route[m_iRouteIndex + i].vecLocation ) * 0.5f;
// Halfway between this and previous
vecSplit = ( m_Route[m_iRouteIndex + i].vecLocation + vecStart ) * 0.5;
vecSplit = ( m_Route[m_iRouteIndex + i].vecLocation + vecStart ) * 0.5f;
int iType = ( m_Route[m_iRouteIndex + i].iType | bits_MF_TO_DETOUR ) & ~bits_MF_NOT_TO_MASK;
if( CheckLocalMove( vecStart, vecTest, pTargetEnt, NULL ) == LOCALMOVE_VALID )
@ -927,7 +927,7 @@ BOOL CBaseMonster::FBecomeProne( void )
//=========================================================
BOOL CBaseMonster::CheckRangeAttack1( float flDot, float flDist )
{
if( flDist > 64 && flDist <= 784 && flDot >= 0.5 )
if( flDist > 64.0f && flDist <= 784.0f && flDot >= 0.5f )
{
return TRUE;
}
@ -939,7 +939,7 @@ BOOL CBaseMonster::CheckRangeAttack1( float flDot, float flDist )
//=========================================================
BOOL CBaseMonster::CheckRangeAttack2( float flDot, float flDist )
{
if( flDist > 64 && flDist <= 512 && flDot >= 0.5 )
if( flDist > 64.0f && flDist <= 512.0f && flDot >= 0.5f )
{
return TRUE;
}
@ -952,7 +952,7 @@ BOOL CBaseMonster::CheckRangeAttack2( float flDot, float flDist )
BOOL CBaseMonster::CheckMeleeAttack1( float flDot, float flDist )
{
// Decent fix to keep folks from kicking/punching hornets and snarks is to check the onground flag(sjb)
if( flDist <= 64 && flDot >= 0.7 && m_hEnemy != 0 && FBitSet( m_hEnemy->pev->flags, FL_ONGROUND ) )
if( flDist <= 64.0f && flDot >= 0.7f && m_hEnemy != 0 && FBitSet( m_hEnemy->pev->flags, FL_ONGROUND ) )
{
return TRUE;
}
@ -964,7 +964,7 @@ BOOL CBaseMonster::CheckMeleeAttack1( float flDot, float flDist )
//=========================================================
BOOL CBaseMonster::CheckMeleeAttack2( float flDot, float flDist )
{
if( flDist <= 64 && flDot >= 0.7 )
if( flDist <= 64.0f && flDot >= 0.7f )
{
return TRUE;
}
@ -1062,7 +1062,7 @@ int CBaseMonster::CheckEnemy( CBaseEntity *pEnemy )
// distance to enemy's origin
flDistToEnemy = ( vecEnemyPos - pev->origin ).Length();
vecEnemyPos.z += pEnemy->pev->size.z * 0.5;
vecEnemyPos.z += pEnemy->pev->size.z * 0.5f;
// distance to enemy's head
float flDistToEnemy2 = ( vecEnemyPos - pev->origin ).Length();
@ -1099,7 +1099,7 @@ int CBaseMonster::CheckEnemy( CBaseEntity *pEnemy )
if( pEnemy->pev->velocity != Vector( 0, 0, 0 ) )
{
// trail the enemy a bit
m_vecEnemyLKP = m_vecEnemyLKP - pEnemy->pev->velocity * RANDOM_FLOAT( -0.05, 0 );
m_vecEnemyLKP = m_vecEnemyLKP - pEnemy->pev->velocity * RANDOM_FLOAT( -0.05f, 0.0f );
}
else
{
@ -1135,7 +1135,7 @@ int CBaseMonster::CheckEnemy( CBaseEntity *pEnemy )
if( m_Route[i].iType == ( bits_MF_IS_GOAL | bits_MF_TO_ENEMY ) )
{
// UNDONE: Should we allow monsters to override this distance (80?)
if( ( m_Route[i].vecLocation - m_vecEnemyLKP ).Length() > 80 )
if( ( m_Route[i].vecLocation - m_vecEnemyLKP ).Length() > 80.0f )
{
// Refresh
FRefreshRoute();
@ -1357,7 +1357,7 @@ int CBaseMonster::CheckLocalMove( const Vector &vecStart, const Vector &vecEnd,
{
// The monster can move to a spot UNDER the target, but not to it. Don't try to triangulate, go directly to the node graph.
// UNDONE: Magic # 64 -- this used to be pev->size.z but that won't work for small creatures like the headcrab
if( fabs( vecEnd.z - pev->origin.z ) > 64 )
if( fabs( vecEnd.z - pev->origin.z ) > 64.0f )
{
iReturn = LOCALMOVE_INVALID_DONT_TRIANGULATE;
}
@ -1478,7 +1478,7 @@ void CBaseMonster::AdvanceRoute( float distance )
}
else // At goal!!!
{
if( distance < m_flGroundSpeed * 0.2 /* FIX */ )
if( distance < m_flGroundSpeed * 0.2f /* FIX */ )
{
MovementComplete();
}
@ -1612,13 +1612,13 @@ BOOL CBaseMonster::FTriangulate( const Vector &vecStart, const Vector &vecEnd, f
// If the hull width is less than 24, use 24 because CheckLocalMove uses a min of
// 24.
sizeX = pev->size.x;
if( sizeX < 24.0 )
sizeX = 24.0;
else if( sizeX > 48.0 )
sizeX = 48.0;
if( sizeX < 24.0f )
sizeX = 24.0f;
else if( sizeX > 48.0f )
sizeX = 48.0f;
sizeZ = pev->size.z;
//if( sizeZ < 24.0 )
// sizeZ = 24.0;
//if( sizeZ < 24.0f )
// sizeZ = 24.0f;
vecForward = ( vecEnd - vecStart ).Normalize();
@ -1856,7 +1856,7 @@ void CBaseMonster::Move( float flInterval )
DispatchBlocked( edict(), pBlocker->edict() );
}
if( pBlocker && m_moveWaitTime > 0 && pBlocker->IsMoving() && !pBlocker->IsPlayer() && ( gpGlobals->time-m_flMoveWaitFinished ) > 3.0 )
if( pBlocker && m_moveWaitTime > 0 && pBlocker->IsMoving() && !pBlocker->IsPlayer() && ( gpGlobals->time-m_flMoveWaitFinished ) > 3.0f )
{
// Can we still move toward our target?
if( flDist < m_flGroundSpeed )
@ -1891,10 +1891,10 @@ void CBaseMonster::Move( float flInterval )
else
{
// Don't get stuck
if( ( gpGlobals->time - m_flMoveWaitFinished ) < 0.2 )
if( ( gpGlobals->time - m_flMoveWaitFinished ) < 0.2f )
Remember( bits_MEMORY_MOVE_FAILED );
m_flMoveWaitFinished = gpGlobals->time + 0.1;
m_flMoveWaitFinished = gpGlobals->time + 0.1f;
}
}
else
@ -1957,10 +1957,10 @@ void CBaseMonster::MoveExecute( CBaseEntity *pTargetEnt, const Vector &vecDir, f
float flTotal = m_flGroundSpeed * pev->framerate * flInterval;
float flStep;
while( flTotal > 0.001 )
while( flTotal > 0.001f )
{
// don't walk more than 16 units or stairs stop working
flStep = Q_min( 16.0, flTotal );
flStep = Q_min( 16.0f, flTotal );
UTIL_MoveToOrigin( ENT( pev ), m_Route[m_iRouteIndex].vecLocation, flStep, MOVE_NORMAL );
flTotal -= flStep;
}
@ -2008,14 +2008,14 @@ void CBaseMonster::MonsterInit( void )
m_hEnemy = NULL;
m_flDistTooFar = 1024.0;
m_flDistLook = 2048.0;
m_flDistTooFar = 1024.0f;
m_flDistLook = 2048.0f;
// set eye position
SetEyePosition();
SetThink( &CBaseMonster::MonsterInitThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
SetUse( &CBaseMonster::MonsterUse );
}
@ -2117,7 +2117,7 @@ void CBaseMonster::StartMonster( void )
// Delay drop to floor to make sure each door in the level has had its chance to spawn
// Spread think times so that they don't all happen at the same time (Carmack)
SetThink( &CBaseMonster::CallMonsterThink );
pev->nextthink += RANDOM_FLOAT( 0.1, 0.4 ); // spread think times.
pev->nextthink += RANDOM_FLOAT( 0.1f, 0.4f ); // spread think times.
// Vit_amiN: fixed -- now it doesn't touch any scripted_sequence target
if( !FStringNull( pev->targetname ) && !m_pCine )// wait until triggered
@ -2214,12 +2214,12 @@ BOOL CBaseMonster::FindCover( Vector vecThreat, Vector vecViewOffset, float flMi
flMaxDist = 784;
}
if( flMinDist > 0.5 * flMaxDist )
if( flMinDist > 0.5f * flMaxDist )
{
#if _DEBUG
ALERT( at_console, "FindCover MinDist (%.0f) too close to MaxDist (%.0f)\n", flMinDist, flMaxDist );
#endif
flMinDist = 0.5 * flMaxDist;
flMinDist = 0.5f * flMaxDist;
}
if( !WorldGraph.m_fGraphPresent || !WorldGraph.m_fGraphPointersSet )
@ -2264,7 +2264,7 @@ BOOL CBaseMonster::FindCover( Vector vecThreat, Vector vecViewOffset, float flMi
UTIL_TraceLine( node.m_vecOrigin + vecViewOffset, vecLookersOffset, ignore_monsters, ignore_glass, ENT( pev ), &tr );
// if this node will block the threat's line of sight to me...
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
// ..and is also closer to me than the threat, or the same distance from myself and the threat the node is good.
if( ( iMyNode == iThreatNode ) || WorldGraph.PathLength( iMyNode, nodeNumber, iMyHullIndex, m_afCapability ) <= WorldGraph.PathLength( iThreatNode, nodeNumber, iMyHullIndex, m_afCapability ) )
@ -2318,12 +2318,12 @@ BOOL CBaseMonster::BuildNearestRoute( Vector vecThreat, Vector vecViewOffset, fl
flMaxDist = 784;
}
if( flMinDist > 0.5 * flMaxDist )
if( flMinDist > 0.5f * flMaxDist )
{
#if _DEBUG
ALERT( at_console, "FindCover MinDist (%.0f) too close to MaxDist (%.0f)\n", flMinDist, flMaxDist );
#endif
flMinDist = 0.5 * flMaxDist;
flMinDist = 0.5f * flMaxDist;
}
if( !WorldGraph.m_fGraphPresent || !WorldGraph.m_fGraphPointersSet )
@ -2362,7 +2362,7 @@ BOOL CBaseMonster::BuildNearestRoute( Vector vecThreat, Vector vecViewOffset, fl
// can I see where I want to be from there?
UTIL_TraceLine( node.m_vecOrigin + pev->view_ofs, vecLookersOffset, ignore_monsters, edict(), &tr );
if( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0f )
{
// try to actually get there
if( BuildRoute( node.m_vecOrigin, bits_MF_TO_LOCATION, NULL ) )
@ -2814,7 +2814,7 @@ int CBaseMonster::FindHintNode( void )
{
UTIL_TraceLine( pev->origin + pev->view_ofs, node.m_vecOrigin + pev->view_ofs, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0f )
{
WorldGraph.m_iLastActiveIdleSearch = nodeNumber + 1; // next monster that searches for hint nodes will start where we left off.
return nodeNumber;// take it!
@ -2872,7 +2872,7 @@ void CBaseMonster::ReportAIState( void )
{
ALERT( level, " Moving " );
if( m_flMoveWaitFinished > gpGlobals->time )
ALERT( level, ": Stopped for %.2f. ", m_flMoveWaitFinished - gpGlobals->time );
ALERT( level, ": Stopped for %.2f. ", (double)(m_flMoveWaitFinished - gpGlobals->time) );
else if( m_IdealActivity == GetStoppedActivity() )
ALERT( level, ": In stopped anim. " );
}
@ -2897,7 +2897,7 @@ void CBaseMonster::ReportAIState( void )
}
ALERT( level, "\n" );
ALERT( level, "Yaw speed:%3.1f,Health: %3.1f\n", pev->yaw_speed, pev->health );
ALERT( level, "Yaw speed:%3.1f,Health: %3.1f\n", (double)pev->yaw_speed, (double)pev->health );
if( pev->spawnflags & SF_MONSTER_PRISONER )
ALERT( level, " PRISONER! " );
if( pev->spawnflags & SF_MONSTER_PREDISASTER )
@ -3095,7 +3095,7 @@ BOOL CBaseMonster::FindLateralCover( const Vector &vecThreat, const Vector &vecV
// it's faster to check the SightEnt's visibility to the potential spot than to check the local move, so we do that first.
UTIL_TraceLine( vecThreat + vecViewOffset, vecLeftTest + pev->view_ofs, ignore_monsters, ignore_glass, ENT( pev )/*pentIgnore*/, &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
if( FValidateCover( vecLeftTest ) && CheckLocalMove( pev->origin, vecLeftTest, NULL, NULL ) == LOCALMOVE_VALID )
{
@ -3109,7 +3109,7 @@ BOOL CBaseMonster::FindLateralCover( const Vector &vecThreat, const Vector &vecV
// it's faster to check the SightEnt's visibility to the potential spot than to check the local move, so we do that first.
UTIL_TraceLine( vecThreat + vecViewOffset, vecRightTest + pev->view_ofs, ignore_monsters, ignore_glass, ENT(pev)/*pentIgnore*/, &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
if( FValidateCover( vecRightTest ) && CheckLocalMove( pev->origin, vecRightTest, NULL, NULL ) == LOCALMOVE_VALID )
{
@ -3145,7 +3145,7 @@ Vector CBaseMonster::ShootAtEnemy( const Vector &shootOrigin )
//=========================================================
BOOL CBaseMonster::FacingIdeal( void )
{
if( fabs( FlYawDiff() ) <= 0.006 )//!!!BUGBUG - no magic numbers!!!
if( fabs( FlYawDiff() ) <= 0.006f )//!!!BUGBUG - no magic numbers!!!
{
return TRUE;
}
@ -3198,7 +3198,7 @@ void CBaseMonster::CorpseFallThink( void )
UTIL_SetOrigin( pev, pev->origin );// link into world.
}
else
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
// Call after animation/pose is set up
@ -3223,7 +3223,7 @@ void CBaseMonster::MonsterInitDead( void )
// Setup health counters, etc.
BecomeDead();
SetThink( &CBaseMonster::CorpseFallThink );
pev->nextthink = gpGlobals->time + 0.5;
pev->nextthink = gpGlobals->time + 0.5f;
}
//=========================================================

View File

@ -126,14 +126,14 @@ void CMP5::PrimaryAttack()
if( m_pPlayer->pev->waterlevel == 3 )
{
PlayEmptySound();
m_flNextPrimaryAttack = 0.15;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15f;
return;
}
if( m_iClip <= 0 )
{
PlayEmptySound();
m_flNextPrimaryAttack = 0.15;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15f;
return;
}
@ -171,16 +171,16 @@ void CMP5::PrimaryAttack()
#else
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMP5, 0.0, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMP5, 0.0f, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 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 );
}
@ -191,7 +191,7 @@ void CMP5::SecondaryAttack( void )
if( m_pPlayer->pev->waterlevel == 3 )
{
PlayEmptySound( );
m_flNextPrimaryAttack = 0.15;
m_flNextPrimaryAttack = 0.15f;
return;
}
@ -205,7 +205,7 @@ void CMP5::SecondaryAttack( void )
m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH;
m_pPlayer->m_iExtraSoundTypes = bits_SOUND_DANGER;
m_pPlayer->m_flStopExtraSoundTime = UTIL_WeaponTimeBase() + 0.2;
m_pPlayer->m_flStopExtraSoundTime = UTIL_WeaponTimeBase() + 0.2f;
m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType]--;
@ -216,8 +216,8 @@ void CMP5::SecondaryAttack( void )
// we don't add in player velocity anymore.
CGrenade::ShootContact( m_pPlayer->pev,
m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16,
gpGlobals->v_forward * 800 );
m_pPlayer->pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_forward * 16.0f,
gpGlobals->v_forward * 800.0f );
int flags;
#if defined( CLIENT_WEAPONS )
@ -227,9 +227,9 @@ void CMP5::SecondaryAttack( void )
#endif
PLAYBACK_EVENT( flags, m_pPlayer->edict(), m_usMP52 );
m_flNextPrimaryAttack = GetNextAttackDelay( 1 );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5;// idle pretty soon after shooting.
m_flNextPrimaryAttack = GetNextAttackDelay( 1.0f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0f;// idle pretty soon after shooting.
if( !m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] )
// HEV suit - indicate out of ammo condition
@ -241,7 +241,7 @@ void CMP5::Reload( void )
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 || m_iClip == MP5_MAX_CLIP )
return;
DefaultReload( MP5_MAX_CLIP, MP5_RELOAD, 1.5 );
DefaultReload( MP5_MAX_CLIP, MP5_RELOAD, 1.5f );
}
void CMP5::WeaponIdle( void )

View File

@ -298,7 +298,7 @@ void CNihilanth::Spawn( void )
InitBoneControllers();
SetThink( &CNihilanth::StartupThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_vecDesired = Vector( 1, 0, 0 );
m_posDesired = Vector( pev->origin.x, pev->origin.y, 512 );
@ -391,13 +391,13 @@ void CNihilanth::DeathSound( void )
void CNihilanth::NullThink( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.5;
pev->nextthink = gpGlobals->time + 0.5f;
}
void CNihilanth::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
SetThink( &CNihilanth::HuntThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
SetUse( &CNihilanth::CommandUse );
}
@ -429,7 +429,7 @@ void CNihilanth::StartupThink( void )
SetThink( &CNihilanth::HuntThink );
SetUse( &CNihilanth::CommandUse );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
void CNihilanth::Killed( entvars_t *pevAttacker, int iGib )
@ -439,7 +439,7 @@ void CNihilanth::Killed( entvars_t *pevAttacker, int iGib )
void CNihilanth::DyingThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
DispatchAnimEvents();
StudioFrameAdvance();
@ -494,13 +494,13 @@ void CNihilanth::DyingThink( void )
do {
vecDir = Vector( RANDOM_FLOAT( -1, 1 ), RANDOM_FLOAT( -1, 1 ), RANDOM_FLOAT( -1, 1 ) );
} while( DotProduct( vecDir, vecDir ) > 1.0 );
} while( DotProduct( vecDir, vecDir ) > 1.0f );
switch( RANDOM_LONG( 1, 4 ) )
{
case 1:
// head
vecDir.z = fabs( vecDir.z ) * 0.5;
vecDir.z = fabs( vecDir.z ) * 0.5f;
vecDir = vecDir + 2 * gpGlobals->v_up;
break;
case 2:
@ -551,7 +551,7 @@ void CNihilanth::DyingThink( void )
GetAttachment( 0, vecSrc, vecAngles );
CNihilanthHVR *pEntity = (CNihilanthHVR *)Create( "nihilanth_energy_ball", vecSrc, pev->angles, edict() );
pEntity->pev->velocity = Vector( RANDOM_FLOAT( -0.7, 0.7 ), RANDOM_FLOAT( -0.7, 0.7 ), 1.0 ) * 600.0;
pEntity->pev->velocity = Vector( RANDOM_FLOAT( -0.7f, 0.7f ), RANDOM_FLOAT( -0.7f, 0.7f ), 1.0f ) * 600.0f;
pEntity->GreenBallInit();
return;
@ -619,7 +619,7 @@ void CNihilanth::ShootBalls( void )
vecDir = ( m_posTarget - pev->origin ).Normalize();
vecSrc = vecSrc + vecDir * ( gpGlobals->time - m_flShootTime );
pEntity = (CNihilanthHVR *)Create( "nihilanth_energy_ball", vecSrc, pev->angles, edict() );
pEntity->pev->velocity = vecDir * 200.0;
pEntity->pev->velocity = vecDir * 200.0f;
pEntity->ZapInit( m_hEnemy );
GetAttachment( 3, vecHand, vecAngle );
@ -628,10 +628,10 @@ void CNihilanth::ShootBalls( void )
vecDir = ( m_posTarget - pev->origin ).Normalize();
vecSrc = vecSrc + vecDir * ( gpGlobals->time - m_flShootTime );
pEntity = (CNihilanthHVR *)Create( "nihilanth_energy_ball", vecSrc, pev->angles, edict() );
pEntity->pev->velocity = vecDir * 200.0;
pEntity->pev->velocity = vecDir * 200.0f;
pEntity->ZapInit( m_hEnemy );
}
m_flShootTime += 0.2;
m_flShootTime += 0.2f;
}
}
}
@ -698,8 +698,8 @@ void CNihilanth::NextActivity()
{
m_pBall->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
m_pBall->SetAttachment( edict(), 1 );
m_pBall->SetScale( 4.0 );
m_pBall->pev->framerate = 10.0;
m_pBall->SetScale( 4.0f );
m_pBall->pev->framerate = 10.0f;
m_pBall->TurnOn();
}
}
@ -766,7 +766,7 @@ void CNihilanth::NextActivity()
if( m_hRecharger != 0 )
{
// at we at power up yet?
if( flDist < 128.0 )
if( flDist < 128.0f )
{
int iseq = LookupSequence( "recharge" );
@ -808,7 +808,7 @@ void CNihilanth::NextActivity()
{
if( m_flLastSeen + 5 > gpGlobals->time && flDist < 256 && flDot > 0 )
{
if( m_irritation >= 2 && pev->health < gSkillData.nihilanthHealth / 2.0 )
if( m_irritation >= 2 && pev->health < gSkillData.nihilanthHealth / 2.0f )
{
pev->sequence = LookupSequence( "attack1_open" );
}
@ -848,7 +848,7 @@ void CNihilanth::NextActivity()
void CNihilanth::HuntThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
DispatchAnimEvents();
StudioFrameAdvance();
@ -877,7 +877,7 @@ void CNihilanth::HuntThink( void )
pev->frame = 0;
NextActivity();
ResetSequenceInfo();
pev->framerate = 2.0 - 1.0 * ( pev->health / gSkillData.nihilanthHealth );
pev->framerate = 2.0f - 1.0f * ( pev->health / gSkillData.nihilanthHealth );
}
// look for current enemy
@ -885,7 +885,7 @@ void CNihilanth::HuntThink( void )
{
if( FVisible( m_hEnemy ) )
{
if( m_flLastSeen < gpGlobals->time - 5 )
if( m_flLastSeen < gpGlobals->time - 5.0f )
m_flPrevSeen = gpGlobals->time;
m_flLastSeen = gpGlobals->time;
m_posTarget = m_hEnemy->pev->origin;
@ -933,7 +933,7 @@ void CNihilanth::Flight( void )
m_avelocity.y -= 6; // 9 * ( 3.0 / 2.0 );
}
}
m_avelocity.y *= 0.98;
m_avelocity.y *= 0.98f;
// estimate where I'll be in two seconds
Vector vecEst = pev->origin + m_velocity * 2.0 + gpGlobals->v_up * m_flForce * 20;
@ -952,12 +952,12 @@ void CNihilanth::Flight( void )
//float flDist = DotProduct( m_posDesired - vecEst, gpGlobals->v_forward );
// sideways drag
m_velocity.x = m_velocity.x * ( 1.0 - fabs( gpGlobals->v_right.x ) * 0.05 );
m_velocity.y = m_velocity.y * ( 1.0 - fabs( gpGlobals->v_right.y ) * 0.05 );
m_velocity.z = m_velocity.z * ( 1.0 - fabs( gpGlobals->v_right.z ) * 0.05 );
m_velocity.x = m_velocity.x * ( 1.0f - fabs( gpGlobals->v_right.x ) * 0.05f );
m_velocity.y = m_velocity.y * ( 1.0f - fabs( gpGlobals->v_right.y ) * 0.05f );
m_velocity.z = m_velocity.z * ( 1.0f - fabs( gpGlobals->v_right.z ) * 0.05f );
// general drag
m_velocity = m_velocity * 0.995;
m_velocity = m_velocity * 0.995f;
// apply power to stay correct height
if( m_flForce < 100 && vecEst.z < m_posDesired.z )
@ -970,8 +970,8 @@ void CNihilanth::Flight( void )
m_flForce -= 10;
}
UTIL_SetOrigin( pev, pev->origin + m_velocity * 0.1 );
pev->angles = pev->angles + m_avelocity * 0.1;
UTIL_SetOrigin( pev, pev->origin + m_velocity * 0.1f );
pev->angles = pev->angles + m_avelocity * 0.1f;
// ALERT( at_console, "%5.0f %5.0f : %4.0f : %3.0f : %2.0f\n", m_posDesired.z, pev->origin.z, m_velocity.z, m_avelocity.y, m_flForce );
}
@ -1093,7 +1093,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
MESSAGE_END();
m_flShootTime = gpGlobals->time;
m_flShootEnd = gpGlobals->time + 1.0;
m_flShootEnd = gpGlobals->time + 1.0f;
}
break;
case 3:
@ -1155,7 +1155,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
MESSAGE_END();
m_flShootTime = gpGlobals->time;
m_flShootEnd = gpGlobals->time + 1.0;
m_flShootEnd = gpGlobals->time + 1.0f;
}
}
break;
@ -1192,7 +1192,7 @@ void CNihilanth::HandleAnimEvent( MonsterEvent_t *pEvent )
Vector vecSrc, vecAngles;
GetAttachment( 0, vecSrc, vecAngles );
CNihilanthHVR *pEntity = (CNihilanthHVR *)Create( "nihilanth_energy_ball", vecSrc, pev->angles, edict() );
pEntity->pev->velocity = Vector( RANDOM_FLOAT( -0.7, 0.7 ), RANDOM_FLOAT( -0.7, 0.7 ), 1.0 ) * 600.0;
pEntity->pev->velocity = Vector( RANDOM_FLOAT( -0.7f, 0.7f ), RANDOM_FLOAT( -0.7f, 0.7f ), 1.0f ) * 600.0f;
pEntity->GreenBallInit();
*/
break;
@ -1299,7 +1299,7 @@ void CNihilanthHVR::Spawn( void )
pev->rendermode = kRenderTransAdd;
pev->renderamt = 255;
pev->scale = 3.0;
pev->scale = 3.0f;
}
void CNihilanthHVR::Precache( void )
@ -1328,7 +1328,7 @@ void CNihilanthHVR::CircleInit( CBaseEntity *pTarget )
pev->rendercolor.x = 255;
pev->rendercolor.y = 224;
pev->rendercolor.z = 192;
pev->scale = 2.0;
pev->scale = 2.0f;
m_nFrames = 1;
pev->renderamt = 255;
@ -1337,7 +1337,7 @@ void CNihilanthHVR::CircleInit( CBaseEntity *pTarget )
SetThink( &CNihilanthHVR::HoverThink );
SetTouch( &CNihilanthHVR::BounceTouch );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_hTargetEnt = pTarget;
}
@ -1359,7 +1359,7 @@ CBaseEntity *CNihilanthHVR::RandomClassname( const char *szName )
void CNihilanthHVR::HoverThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( m_hTargetEnt != 0 )
{
@ -1428,21 +1428,21 @@ void CNihilanthHVR::ZapInit( CBaseEntity *pEnemy )
pev->rendercolor.x = 255;
pev->rendercolor.y = 255;
pev->rendercolor.z = 255;
pev->scale = 2.0;
pev->scale = 2.0f;
pev->velocity = ( pEnemy->pev->origin - pev->origin ).Normalize() * 200;
pev->velocity = ( pEnemy->pev->origin - pev->origin ).Normalize() * 200.0f;
m_hEnemy = pEnemy;
SetThink( &CNihilanthHVR::ZapThink );
SetTouch( &CNihilanthHVR::ZapTouch );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0, 100 );
}
void CNihilanthHVR::ZapThink( void )
{
pev->nextthink = gpGlobals->time + 0.05;
pev->nextthink = gpGlobals->time + 0.05f;
// check world boundaries
if( m_hEnemy == 0 || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 )
@ -1454,7 +1454,7 @@ void CNihilanthHVR::ZapThink( void )
if( pev->velocity.Length() < 2000 )
{
pev->velocity = pev->velocity * 1.2;
pev->velocity = pev->velocity * 1.2f;
}
// MovetoTarget( m_hEnemy->Center() );
@ -1496,7 +1496,7 @@ void CNihilanthHVR::ZapThink( void )
SetTouch( NULL );
UTIL_Remove( this );
pev->nextthink = gpGlobals->time + 0.2;
pev->nextthink = gpGlobals->time + 0.2f;
return;
}
@ -1535,7 +1535,7 @@ void CNihilanthHVR::ZapTouch( CBaseEntity *pOther )
SetTouch( NULL );
UTIL_Remove( this );
pev->nextthink = gpGlobals->time + 0.2;
pev->nextthink = gpGlobals->time + 0.2f;
}
void CNihilanthHVR::TeleportInit( CNihilanth *pOwner, CBaseEntity *pEnemy, CBaseEntity *pTarget, CBaseEntity *pTouch )
@ -1546,7 +1546,7 @@ void CNihilanthHVR::TeleportInit( CNihilanth *pOwner, CBaseEntity *pEnemy, CBase
pev->rendercolor.x = 255;
pev->rendercolor.y = 255;
pev->rendercolor.z = 255;
pev->velocity.z *= 0.2;
pev->velocity.z *= 0.2f;
SET_MODEL( edict(), "sprites/exit1.spr" );
@ -1557,7 +1557,7 @@ void CNihilanthHVR::TeleportInit( CNihilanth *pOwner, CBaseEntity *pEnemy, CBase
SetThink( &CNihilanthHVR::TeleportThink );
SetTouch( &CNihilanthHVR::TeleportTouch );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "x/x_teleattack1.wav", 1, 0.2, 0, 100 );
}
@ -1570,7 +1570,7 @@ void CNihilanthHVR::GreenBallInit()
pev->rendercolor.x = 255;
pev->rendercolor.y = 255;
pev->rendercolor.z = 255;
pev->scale = 1.0;
pev->scale = 1.0f;
SET_MODEL( edict(), "sprites/exit1.spr" );
@ -1579,7 +1579,7 @@ void CNihilanthHVR::GreenBallInit()
void CNihilanthHVR::TeleportThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
// check world boundaries
if( m_hEnemy == 0 || !m_hEnemy->IsAlive() || pev->origin.x < -4096 || pev->origin.x > 4096 || pev->origin.y < -4096 || pev->origin.y > 4096 || pev->origin.z < -4096 || pev->origin.z > 4096 )
@ -1669,13 +1669,13 @@ void CNihilanthHVR::TeleportTouch( CBaseEntity *pOther )
void CNihilanthHVR::DissipateThink( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( pev->scale > 5.0 )
if( pev->scale > 5.0f )
UTIL_Remove( this );
pev->renderamt -= 2;
pev->scale += 0.1;
pev->scale += 0.1f;
if( m_hTargetEnt != 0 )
{
@ -1811,7 +1811,7 @@ void CNihilanthHVR::BounceTouch( CBaseEntity *pOther )
float n = -DotProduct( tr.vecPlaneNormal, vecDir );
vecDir = 2.0 * tr.vecPlaneNormal * n + vecDir;
vecDir = 2.0f * tr.vecPlaneNormal * n + vecDir;
m_vecIdeal = vecDir * m_vecIdeal.Length();
}

View File

@ -667,7 +667,7 @@ int CGraph::FindShortestPath( int *piPath, int iStart, int iDest, int iHull, int
//
for ( i = 0; i < m_cNodes; i++)
{
m_pNodes[i].m_flClosestSoFar = -1.0;
m_pNodes[i].m_flClosestSoFar = -1.0f;
}
m_pNodes[iStart].m_flClosestSoFar = 0.0;
@ -709,8 +709,8 @@ int CGraph::FindShortestPath( int *piPath, int iStart, int iDest, int iHull, int
}
}
float flOurDistance = flCurrentDistance + m_pLinkPool[m_pNodes[iCurrentNode].m_iFirstLink + i].m_flWeight;
if( m_pNodes[iVisitNode].m_flClosestSoFar < -0.5
|| flOurDistance < m_pNodes[iVisitNode].m_flClosestSoFar - 0.001 )
if( m_pNodes[iVisitNode].m_flClosestSoFar < -0.5f
|| flOurDistance < m_pNodes[iVisitNode].m_flClosestSoFar - 0.001f )
{
m_pNodes[iVisitNode].m_flClosestSoFar = flOurDistance;
m_pNodes[iVisitNode].m_iPreviousNode = iCurrentNode;
@ -719,7 +719,7 @@ int CGraph::FindShortestPath( int *piPath, int iStart, int iDest, int iHull, int
}
}
}
if( m_pNodes[iDest].m_flClosestSoFar < -0.5 )
if( m_pNodes[iDest].m_flClosestSoFar < -0.5f )
{
// Destination is unreachable, no path found.
return 0;
@ -837,7 +837,7 @@ void CGraph::CheckNode( Vector vecOrigin, int iNode )
// make sure that vecOrigin can trace to this node!
UTIL_TraceLine( vecOrigin, m_pNodes[iNode].m_vecOriginPeek, ignore_monsters, 0, &tr );
if( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0f )
{
m_iNearest = iNode;
m_flShortest = flDist;
@ -907,7 +907,7 @@ int CGraph::FindNearestNode( const Vector &vecOrigin, int afNodeTypes )
}
m_iNearest = -1;
m_flShortest = 999999.0; // just a big number.
m_flShortest = 999999.0f; // just a big number.
// If we can find a visible point, then let CalcBounds set the limits, but if
// we have no visible point at all to start with, then don't restrict the limits.
@ -1276,7 +1276,7 @@ int CGraph::LinkVisibleNodes( CLink *pLinkPool, FILE *file, int *piBadNode )
if( tr.fStartSolid )
continue;
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
// trace hit a brush ent, trace backwards to make sure that this ent is the only thing in the way.
pTraceEnt = tr.pHit;// store the ent that the trace hit, for comparison
@ -1442,14 +1442,14 @@ int CGraph::RejectInlineLinks( CLink *pLinkPool, FILE *file )
flDistToTestNode = vec2DirToTestNode.Length();
vec2DirToTestNode = vec2DirToTestNode.Normalize();
if( DotProduct( vec2DirToCheckNode, vec2DirToTestNode ) >= 0.998 )
if( DotProduct( vec2DirToCheckNode, vec2DirToTestNode ) >= 0.998f )
{
// there's a chance that TestNode intersects the line to CheckNode. If so, we should disconnect the link to CheckNode.
if( flDistToTestNode < flDistToCheckNode )
{
if( file )
{
fprintf( file, "REJECTED NODE %3d through Node %3d, Dot = %8f\n", pLinkPool[pSrcNode->m_iFirstLink + j].m_iDestNode, pLinkPool[pSrcNode->m_iFirstLink + k].m_iDestNode, DotProduct( vec2DirToCheckNode, vec2DirToTestNode ) );
fprintf( file, "REJECTED NODE %3d through Node %3d, Dot = %8f\n", pLinkPool[pSrcNode->m_iFirstLink + j].m_iDestNode, pLinkPool[pSrcNode->m_iFirstLink + k].m_iDestNode, (double)DotProduct( vec2DirToCheckNode, vec2DirToTestNode ) );
}
pLinkPool[pSrcNode->m_iFirstLink + j] = pLinkPool[pSrcNode->m_iFirstLink + ( pSrcNode->m_cNumLinks - 1 )];
@ -1516,7 +1516,7 @@ void CTestHull::Spawn( entvars_t *pevMasterNode )
else
{
SetThink( &CTestHull::DropDelay );
pev->nextthink = gpGlobals->time + 1;
pev->nextthink = gpGlobals->time + 1.0f;
}
// Make this invisible
@ -1537,7 +1537,7 @@ void CTestHull::DropDelay( void )
SetThink( &CTestHull::CallBuildNodeGraph );
pev->nextthink = gpGlobals->time + 1;
pev->nextthink = gpGlobals->time + 1.0f;
}
//=========================================================
@ -1623,7 +1623,7 @@ void CTestHull::ShowBadNode( void )
UTIL_ParticleEffect( pev->origin + gpGlobals->v_right * 64, g_vecZero, 255, 25 );
UTIL_ParticleEffect( pev->origin - gpGlobals->v_right * 64, g_vecZero, 255, 25 );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
extern BOOL gTouchDisabled;
@ -1737,7 +1737,7 @@ void CTestHull::BuildNodeGraph( void )
fprintf( file, "Location %4d,%4d,%4d\n",(int)WorldGraph.m_pNodes[i].m_vecOrigin.x, (int)WorldGraph.m_pNodes[i].m_vecOrigin.y, (int)WorldGraph.m_pNodes[i].m_vecOrigin.z );
fprintf( file, "HintType: %4d\n", WorldGraph.m_pNodes[i].m_sHintType );
fprintf( file, "HintActivity: %4d\n", WorldGraph.m_pNodes[i].m_sHintActivity );
fprintf( file, "HintYaw: %4f\n", WorldGraph.m_pNodes[i].m_flHintYaw );
fprintf( file, "HintYaw: %4f\n", (double)WorldGraph.m_pNodes[i].m_flHintYaw );
fprintf( file, "-------------------------------------------------------------------------------\n" );
}
fprintf( file, "\n\n" );
@ -1959,7 +1959,7 @@ void CTestHull::BuildNodeGraph( void )
TraceResult tr;
UTIL_TraceHull( pSrcNode->m_vecOrigin + Vector( 0, 0, 32 ), pDestNode->m_vecOriginPeek + Vector( 0, 0, 32 ), ignore_monsters, large_hull, ENT( pev ), &tr );
if( tr.fStartSolid || tr.flFraction < 1.0 )
if( tr.fStartSolid || tr.flFraction < 1.0f )
{
pTempPool[pSrcNode->m_iFirstLink + j].m_afLinkInfo &= ~bits_LINK_FLY_HULL;
}
@ -3517,7 +3517,7 @@ void CGraph::TestRoutingTables( void )
ALERT( at_aiconsole, "No link.\n" );
}
}
if( fabs( flDistance1 - flDistance2 ) > 0.10 )
if( fabs( flDistance1 - flDistance2 ) > 0.1f )
{
#else
if( cPathSize1 != cPathSize2 || memcmp( pMyPath, pMyPath2, sizeof(int) * cPathSize1 ) != 0 )

View File

@ -103,7 +103,7 @@ void CBasePlayer::Observer_HandleButtons()
else
Observer_SetMode( OBS_CHASE_FREE ); // don't use OBS_CHASE_LOCKED anymore
m_flNextObserverInput = gpGlobals->time + 0.2;
m_flNextObserverInput = gpGlobals->time + 0.2f;
}
// Attack moves to the next player
@ -111,7 +111,7 @@ void CBasePlayer::Observer_HandleButtons()
{
Observer_FindNextPlayer( false );
m_flNextObserverInput = gpGlobals->time + 0.2;
m_flNextObserverInput = gpGlobals->time + 0.2f;
}
// Attack2 moves to the prev player
@ -119,7 +119,7 @@ void CBasePlayer::Observer_HandleButtons()
{
Observer_FindNextPlayer( true );
m_flNextObserverInput = gpGlobals->time + 0.2;
m_flNextObserverInput = gpGlobals->time + 0.2f;
}
}

View File

@ -170,7 +170,7 @@ void COsprey::Spawn( void )
if( !( pev->spawnflags & SF_WAITFORTRIGGER ) )
{
pev->nextthink = gpGlobals->time + 1.0;
pev->nextthink = gpGlobals->time + 1.0f;
}
m_pos2 = pev->origin;
@ -198,7 +198,7 @@ void COsprey::Precache( void )
void COsprey::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
void COsprey::FindAllThink( void )
@ -223,7 +223,7 @@ void COsprey::FindAllThink( void )
return;
}
SetThink( &COsprey::FlyThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
m_startTime = gpGlobals->time;
}
@ -238,8 +238,8 @@ void COsprey::DeployThink( void )
Vector vecSrc;
TraceResult tr;
UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, -4096.0 ), ignore_monsters, ENT( pev ), &tr );
CSoundEnt::InsertSound( bits_SOUND_DANGER, tr.vecEndPos, 400, 0.3 );
UTIL_TraceLine( pev->origin, pev->origin + Vector( 0.0f, 0.0f, -4096.0f ), ignore_monsters, ENT( pev ), &tr );
CSoundEnt::InsertSound( bits_SOUND_DANGER, tr.vecEndPos, 400, 0.3f );
vecSrc = pev->origin + vecForward * 32 + vecRight * 100 + vecUp * -96;
m_hRepel[0] = MakeGrunt( vecSrc );
@ -254,7 +254,7 @@ void COsprey::DeployThink( void )
m_hRepel[3] = MakeGrunt( vecSrc );
SetThink( &COsprey::HoverThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
BOOL COsprey::HasDead()
@ -279,7 +279,7 @@ CBaseMonster *COsprey::MakeGrunt( Vector vecSrc )
CBaseMonster *pGrunt;
TraceResult tr;
UTIL_TraceLine( vecSrc, vecSrc + Vector( 0, 0, -4096.0 ), dont_ignore_monsters, ENT( pev ), &tr );
UTIL_TraceLine( vecSrc, vecSrc + Vector( 0.0f, 0.0f, -4096.0f ), dont_ignore_monsters, ENT( pev ), &tr );
if( tr.pHit && Instance( tr.pHit )->pev->solid != SOLID_BSP )
return NULL;
@ -302,7 +302,7 @@ CBaseMonster *COsprey::MakeGrunt( Vector vecSrc )
pBeam->SetFlags( BEAM_FSOLID );
pBeam->SetColor( 255, 255, 255 );
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;
// ALERT( at_console, "%d at %.0f %.0f %.0f\n", i, m_vecOrigin[i].x, m_vecOrigin[i].y, m_vecOrigin[i].z );
pGrunt->m_vecLastPosition = m_vecOrigin[i];
@ -331,7 +331,7 @@ void COsprey::HoverThink( void )
SetThink( &COsprey::FlyThink );
}
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
UTIL_MakeAimVectors( pev->angles );
ShowDamage();
}
@ -349,7 +349,7 @@ void COsprey::UpdateGoal()
m_vel2 = gpGlobals->v_forward * m_pGoalEnt->pev->speed;
m_startTime = m_startTime + m_dTime;
m_dTime = 2.0 * ( m_pos1 - m_pos2 ).Length() / ( m_vel1.Length() + m_pGoalEnt->pev->speed );
m_dTime = 2.0f * ( m_pos1 - m_pos2 ).Length() / ( m_vel1.Length() + m_pGoalEnt->pev->speed );
if( m_ang1.y - m_ang2.y < -180 )
{
@ -374,7 +374,7 @@ void COsprey::UpdateGoal()
void COsprey::FlyThink( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( m_pGoalEnt == NULL && !FStringNull( pev->target) )// this monster has a target
{
@ -401,13 +401,13 @@ void COsprey::FlyThink( void )
void COsprey::Flight()
{
float t = ( gpGlobals->time - m_startTime );
float scale = 1.0 / m_dTime;
float scale = 1.0f / m_dTime;
float f = UTIL_SplineFraction( t * scale, 1.0 );
float f = UTIL_SplineFraction( t * scale, 1.0f );
Vector pos = ( m_pos1 + m_vel1 * t ) * ( 1.0 - f ) + ( m_pos2 - m_vel2 * ( m_dTime - t ) ) * f;
Vector ang = ( m_ang1 ) * ( 1.0 - f ) + ( m_ang2 ) * f;
m_velocity = m_vel1 * ( 1.0 - f ) + m_vel2 * f;
Vector pos = ( m_pos1 + m_vel1 * t ) * ( 1.0f - f ) + ( m_pos2 - m_vel2 * ( m_dTime - t ) ) * f;
Vector ang = ( m_ang1 ) * ( 1.0f - f ) + ( m_ang2 ) * f;
m_velocity = m_vel1 * ( 1.0f - f ) + m_vel2 * f;
UTIL_SetOrigin( pev, pos );
pev->angles = ang;
@ -416,18 +416,18 @@ void COsprey::Flight()
// float flSpeed = DotProduct( gpGlobals->v_forward, pev->velocity );
float m_flIdealtilt = ( 160 - flSpeed ) / 10.0;
float m_flIdealtilt = ( 160.0f - flSpeed ) / 10.0f;
// ALERT( at_console, "%f %f\n", flSpeed, flIdealtilt );
if( m_flRotortilt < m_flIdealtilt )
{
m_flRotortilt += 0.5;
m_flRotortilt += 0.5f;
if ( m_flRotortilt > 0 )
m_flRotortilt = 0;
}
if( m_flRotortilt > m_flIdealtilt )
{
m_flRotortilt -= 0.5;
m_flRotortilt -= 0.5f;
if( m_flRotortilt < -90 )
m_flRotortilt = -90;
}
@ -450,7 +450,7 @@ void COsprey::Flight()
{
float pitch = DotProduct( m_velocity - pPlayer->pev->velocity, ( pPlayer->pev->origin - pev->origin ).Normalize() );
pitch = (int)( 100 + pitch / 75.0 );
pitch = (int)( 100 + pitch / 75.0f );
if( pitch > 250 )
pitch = 250;
@ -474,7 +474,7 @@ void COsprey::Flight()
void COsprey::HitTouch( CBaseEntity *pOther )
{
pev->nextthink = gpGlobals->time + 2.0;
pev->nextthink = gpGlobals->time + 2.0f;
}
/*
@ -496,7 +496,7 @@ int COsprey::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float
void COsprey::Killed( entvars_t *pevAttacker, int iGib )
{
pev->movetype = MOVETYPE_TOSS;
pev->gravity = 0.3;
pev->gravity = 0.3f;
pev->velocity = m_velocity;
pev->avelocity = Vector( RANDOM_FLOAT( -20, 20 ), 0, RANDOM_FLOAT( -50, 50 ) );
STOP_SOUND( ENT( pev ), CHAN_STATIC, "apache/ap_rotor4.wav" );
@ -504,11 +504,11 @@ void COsprey::Killed( entvars_t *pevAttacker, int iGib )
UTIL_SetSize( pev, Vector( -32, -32, -64 ), Vector( 32, 32, 0 ) );
SetThink( &COsprey::DyingThink );
SetTouch( &COsprey::CrashTouch );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->health = 0;
pev->takedamage = DAMAGE_NO;
m_startTime = gpGlobals->time + 4.0;
m_startTime = gpGlobals->time + 4.0f;
}
void COsprey::CrashTouch( CBaseEntity *pOther )
@ -526,9 +526,9 @@ void COsprey::CrashTouch( CBaseEntity *pOther )
void COsprey::DyingThink( void )
{
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->avelocity = pev->avelocity * 1.02;
pev->avelocity = pev->avelocity * 1.02f;
// still falling?
if( m_startTime > gpGlobals->time )
@ -536,14 +536,14 @@ void COsprey::DyingThink( void )
UTIL_MakeAimVectors( pev->angles );
ShowDamage();
Vector vecSpot = pev->origin + pev->velocity * 0.2;
Vector vecSpot = pev->origin + pev->velocity * 0.2f;
// random explosions
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
WRITE_BYTE( TE_EXPLOSION ); // This just makes a dynamic light now
WRITE_COORD( vecSpot.x + RANDOM_FLOAT( -150, 150 ) );
WRITE_COORD( vecSpot.y + RANDOM_FLOAT( -150, 150 ) );
WRITE_COORD( vecSpot.z + RANDOM_FLOAT( -150, -50 ) );
WRITE_COORD( vecSpot.x + RANDOM_FLOAT( -150.0f, 150.0f ) );
WRITE_COORD( vecSpot.y + RANDOM_FLOAT( -150.0f, 150.0f ) );
WRITE_COORD( vecSpot.z + RANDOM_FLOAT( -150.0f, -50.0f ) );
WRITE_SHORT( g_sModelIndexFireball );
WRITE_BYTE( RANDOM_LONG( 0, 29 ) + 30 ); // scale * 10
WRITE_BYTE( 12 ); // framerate
@ -553,15 +553,15 @@ void COsprey::DyingThink( void )
// lots of smoke
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSpot.x + RANDOM_FLOAT( -150, 150 ) );
WRITE_COORD( vecSpot.y + RANDOM_FLOAT( -150, 150 ) );
WRITE_COORD( vecSpot.z + RANDOM_FLOAT( -150, -50 ) );
WRITE_COORD( vecSpot.x + RANDOM_FLOAT( -150.0f, 150.0f ) );
WRITE_COORD( vecSpot.y + RANDOM_FLOAT( -150.0f, 150.0f ) );
WRITE_COORD( vecSpot.z + RANDOM_FLOAT( -150.0f, -50.0f ) );
WRITE_SHORT( g_sModelIndexSmoke );
WRITE_BYTE( 100 ); // scale * 10
WRITE_BYTE( 10 ); // framerate
MESSAGE_END();
vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5;
vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5f;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
WRITE_BYTE( TE_BREAKMODEL);
@ -598,12 +598,12 @@ void COsprey::DyingThink( void )
// don't stop it we touch a entity
pev->flags &= ~FL_ONGROUND;
pev->nextthink = gpGlobals->time + 0.2;
pev->nextthink = gpGlobals->time + 0.2f;
return;
}
else
{
Vector vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5;
Vector vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5f;
/*
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
@ -662,12 +662,12 @@ void COsprey::DyingThink( void )
WRITE_BYTE( 0 ); // speed
MESSAGE_END();
EMIT_SOUND( ENT( pev ), CHAN_STATIC, "weapons/mortarhit.wav", 1.0, 0.3 );
EMIT_SOUND( ENT( pev ), CHAN_STATIC, "weapons/mortarhit.wav", 1.0, 0.3f );
RadiusDamage( pev->origin, pev, pev, 300, CLASS_NONE, DMG_BLAST );
// gibs
vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5;
vecSpot = pev->origin + ( pev->mins + pev->maxs ) * 0.5f;
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, vecSpot );
WRITE_BYTE( TE_BREAKMODEL);
@ -684,7 +684,7 @@ void COsprey::DyingThink( void )
// velocity
WRITE_COORD( m_velocity.x );
WRITE_COORD( m_velocity.y );
WRITE_COORD( fabs( m_velocity.z ) * 0.25 );
WRITE_COORD( fabs( m_velocity.z ) * 0.25f );
// randomization
WRITE_BYTE( 40 );
@ -751,7 +751,7 @@ void COsprey::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
return;
else
m_flRightHealth -= flDamage;
m_iDoLeftSmokePuff = 3 + ( flDamage / 5.0 );
m_iDoLeftSmokePuff = 3 + ( flDamage / 5.0f );
}
if( ptr->iHitgroup == 2 )
@ -760,7 +760,7 @@ void COsprey::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir
return;
else
m_flLeftHealth -= flDamage;
m_iDoRightSmokePuff = 3 + ( flDamage / 5.0 );
m_iDoRightSmokePuff = 3 + ( flDamage / 5.0f );
}
// hit hard, hits cockpit, hits engines

View File

@ -585,7 +585,7 @@ void CFuncPlatRot::RotMove( Vector &destAngle, float time )
Vector vecDestDelta = destAngle - pev->angles;
// Travel time is so short, we're practically there already; so make it so.
if( time >= 0.1 )
if( time >= 0.1f )
pev->avelocity = vecDestDelta / time;
else
{
@ -647,7 +647,7 @@ void CFuncTrain::Blocked( CBaseEntity *pOther )
if( gpGlobals->time < m_flActivateFinished )
return;
m_flActivateFinished = gpGlobals->time + 0.5;
m_flActivateFinished = gpGlobals->time + 0.5f;
pOther->TakeDamage( pev, pev, pev->dmg, DMG_CRUSH );
}
@ -744,7 +744,7 @@ void CFuncTrain::Next( void )
{
// don't copy speed from target if it is 0 (uninitialized)
pev->speed = m_pevCurrentTarget->speed;
ALERT( at_aiconsole, "Train %s speed to %4.2f\n", STRING( pev->targetname ), pev->speed );
ALERT( at_aiconsole, "Train %s speed to %4.2f\n", STRING( pev->targetname ), (double)pev->speed );
}
m_pevCurrentTarget = pTarg->pev;// keep track of this since path corners change our target for us.
@ -754,7 +754,7 @@ void CFuncTrain::Next( void )
{
// Path corner has indicated a teleport to the next corner.
SetBits( pev->effects, EF_NOINTERP );
UTIL_SetOrigin( pev, pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5 );
UTIL_SetOrigin( pev, pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5f );
Wait(); // Get on with doing the next path corner.
}
else
@ -772,7 +772,7 @@ void CFuncTrain::Next( void )
ClearBits( pev->effects, EF_NOINTERP );
SetMoveDone( &CFuncTrain::Wait );
LinearMove( pTarg->pev->origin - ( pev->mins + pev->maxs )* 0.5, pev->speed );
LinearMove( pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5f, pev->speed );
}
}
@ -791,7 +791,7 @@ void CFuncTrain::Activate( void )
if( FStringNull( pev->targetname ) )
{ // not triggered, so start immediately
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
SetThink( &CFuncTrain::Next );
}
else
@ -835,7 +835,7 @@ void CFuncTrain::Spawn( void )
m_activated = FALSE;
if( m_volume == 0 )
m_volume = 0.85;
m_volume = 0.85f;
}
void CFuncTrain::Precache( void )
@ -883,7 +883,7 @@ void CFuncTrain::OverrideReset( void )
else // Keep moving for 0.1 secs, then find path_corner again and restart
{
SetThink( &CFuncTrain::Next );
pev->nextthink = pev->ltime + 0.1;
pev->nextthink = pev->ltime + 0.1f;
}
}
}
@ -938,7 +938,7 @@ void CFuncTrackTrain::KeyValue( KeyValueData *pkvd )
else if( FStrEq( pkvd->szKeyName, "volume" ) )
{
m_flVolume = (float)atoi( pkvd->szValue );
m_flVolume *= 0.1;
m_flVolume *= 0.1f;
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "bank" ) )
@ -977,7 +977,7 @@ void CFuncTrackTrain::Blocked( CBaseEntity *pOther )
else
pevOther->velocity = ( pevOther->origin - pev->origin ).Normalize() * pev->dmg;
ALERT( at_aiconsole, "TRAIN(%s): Blocked by %s (dmg:%.2f)\n", STRING( pev->targetname ), STRING( pOther->pev->classname ), pev->dmg );
ALERT( at_aiconsole, "TRAIN(%s): Blocked by %s (dmg:%.2f)\n", STRING( pev->targetname ), STRING( pOther->pev->classname ), (double)pev->dmg );
if( pev->dmg <= 0 )
return;
// we can't hurt this thing, so we're not concerned with it
@ -1010,7 +1010,7 @@ void CFuncTrackTrain::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
{
float delta = value;
delta = ( (int)( pev->speed * 4 ) / (int)m_speed )*0.25 + 0.25 * delta;
delta = ( (int)( pev->speed * 4 ) / (int)m_speed ) * 0.25f + 0.25f * delta;
if( delta > 1 )
delta = 1;
else if ( delta < -1 )
@ -1022,7 +1022,7 @@ void CFuncTrackTrain::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
}
pev->speed = m_speed * delta;
Next();
ALERT( at_aiconsole, "TRAIN(%s), speed to %.2f\n", STRING( pev->targetname ), pev->speed );
ALERT( at_aiconsole, "TRAIN(%s), speed to %.2f\n", STRING( pev->targetname ), (double)pev->speed );
}
}
@ -1100,13 +1100,13 @@ void CFuncTrackTrain::UpdateSound( void )
unsigned short us_encode;
unsigned short us_sound = ( ( unsigned short )( m_sounds ) & 0x0007 ) << 12;
unsigned short us_pitch = ( ( unsigned short )( flpitch / 10.0 ) & 0x003f ) << 6;
unsigned short us_volume = ( ( unsigned short )( m_flVolume * 40.0 ) & 0x003f );
unsigned short us_pitch = ( ( unsigned short )( flpitch / 10.0f ) & 0x003f ) << 6;
unsigned short us_volume = ( ( unsigned short )( m_flVolume * 40.0f ) & 0x003f );
us_encode = us_sound | us_pitch | us_volume;
PLAYBACK_EVENT_FULL( FEV_RELIABLE | FEV_UPDATE, edict(), m_usAdjustPitch, 0.0,
g_vecZero, g_vecZero, 0.0, 0.0, us_encode, 0, 0, 0 );
PLAYBACK_EVENT_FULL( FEV_RELIABLE | FEV_UPDATE, edict(), m_usAdjustPitch, 0.0f,
g_vecZero, g_vecZero, 0.0f, 0.0f, us_encode, 0, 0, 0 );
}
}
@ -1135,7 +1135,7 @@ void CFuncTrackTrain::Next( void )
Vector nextPos = pev->origin;
nextPos.z -= m_height;
CPathTrack *pnext = m_ppath->LookAhead( &nextPos, pev->speed * 0.1, 1 );
CPathTrack *pnext = m_ppath->LookAhead( &nextPos, pev->speed * 0.1f, 1 );
nextPos.z += m_height;
pev->velocity = ( nextPos - pev->origin ) * 10;
@ -1209,7 +1209,7 @@ void CFuncTrackTrain::Next( void )
{
// don't copy speed from target if it is 0 (uninitialized)
pev->speed = pFire->pev->speed;
ALERT( at_aiconsole, "TrackTrain %s speed to %4.2f\n", STRING( pev->targetname ), pev->speed );
ALERT( at_aiconsole, "TrackTrain %s speed to %4.2f\n", STRING( pev->targetname ), (double)pev->speed );
}
}
@ -1348,7 +1348,7 @@ void CFuncTrackTrain::Find( void )
if( pev->spawnflags & SF_TRACKTRAIN_NOPITCH )
pev->angles.x = 0;
UTIL_SetOrigin( pev, nextPos );
NextThink( pev->ltime + 0.1, FALSE );
NextThink( pev->ltime + 0.1f, FALSE );
SetThink( &CFuncTrackTrain::Next );
pev->speed = m_startSpeed;
@ -1397,14 +1397,14 @@ void CFuncTrackTrain::NearestPath( void )
if( pev->speed != 0 )
{
NextThink( pev->ltime + 0.1, FALSE );
NextThink( pev->ltime + 0.1f, FALSE );
SetThink( &CFuncTrackTrain::Next );
}
}
void CFuncTrackTrain::OverrideReset( void )
{
NextThink( pev->ltime + 0.1, FALSE );
NextThink( pev->ltime + 0.1f, FALSE );
SetThink( &CFuncTrackTrain::NearestPath );
}
@ -1463,7 +1463,7 @@ void CFuncTrackTrain::Spawn( void )
// start trains on the next frame, to make sure their targets have had
// a chance to spawn/activate
NextThink( pev->ltime + 0.1, FALSE );
NextThink( pev->ltime + 0.1f, FALSE );
SetThink( &CFuncTrackTrain::Find );
Precache();
}
@ -1472,8 +1472,8 @@ void CFuncTrackTrain::Precache( void )
{
const char *pszSound;
if( m_flVolume == 0.0 )
m_flVolume = 1.0;
if( m_flVolume == 0.0f )
m_flVolume = 1.0f;
switch( m_sounds )
{
@ -1667,7 +1667,7 @@ void CFuncTrackChange::Spawn( void )
}
EnableUse();
pev->nextthink = pev->ltime + 2.0;
pev->nextthink = pev->ltime + 2.0f;
SetThink( &CFuncTrackChange::Find );
Precache();
}
@ -1714,7 +1714,7 @@ void CFuncTrackChange::KeyValue( KeyValueData *pkvd )
void CFuncTrackChange::OverrideReset( void )
{
pev->nextthink = pev->ltime + 1.0;
pev->nextthink = pev->ltime + 1.0f;
SetThink( &CFuncTrackChange::Find );
}
@ -1740,7 +1740,7 @@ void CFuncTrackChange::Find( void )
ALERT( at_error, "Can't find train for track change! %s\n", STRING( m_trainName ) );
return;
}
Vector center = ( pev->absmin + pev->absmax ) * 0.5;
Vector center = ( pev->absmin + pev->absmax ) * 0.5f;
m_trackBottom = m_trackBottom->Nearest( center );
m_trackTop = m_trackTop->Nearest( center );
UpdateAutoTargets( m_toggle_state );
@ -1807,7 +1807,7 @@ void CFuncTrackChange::UpdateTrain( Vector &dest )
local.z = DotProduct( offset, gpGlobals->v_up );
local = local - offset;
m_train->pev->velocity = pev->velocity + ( local * ( 1.0 / time ) );
m_train->pev->velocity = pev->velocity + ( local * ( 1.0f / time ) );
}
void CFuncTrackChange::GoDown( void )
@ -2108,7 +2108,7 @@ void CGunTarget::Spawn( void )
if( pev->spawnflags & FGUNTARGET_START_ON )
{
SetThink( &CGunTarget::Start );
pev->nextthink = pev->ltime + 0.3;
pev->nextthink = pev->ltime + 0.3f;
}
}
@ -2121,7 +2121,7 @@ void CGunTarget::Activate( void )
if( pTarg )
{
m_hTargetEnt = pTarg;
UTIL_SetOrigin( pev, pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5 );
UTIL_SetOrigin( pev, pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5f );
}
}
@ -2143,7 +2143,7 @@ void CGunTarget::Next( void )
return;
}
SetMoveDone( &CGunTarget::Wait );
LinearMove( pTarget->pev->origin - ( pev->mins + pev->maxs ) * 0.5, pev->speed );
LinearMove( pTarget->pev->origin - ( pev->mins + pev->maxs ) * 0.5f, pev->speed );
}
void CGunTarget::Wait( void )

View File

@ -66,8 +66,8 @@ extern CGraph WorldGraph;
#define TRAIN_FAST 0x04
#define TRAIN_BACK 0x05
#define FLASH_DRAIN_TIME 1.2 //100 units/3 minutes
#define FLASH_CHARGE_TIME 0.2 // 100 units/20 seconds (seconds per unit)
#define FLASH_DRAIN_TIME 1.2f //100 units/3 minutes
#define FLASH_CHARGE_TIME 0.2f // 100 units/20 seconds (seconds per unit)
// Global Savedata for player
TYPEDESCRIPTION CBasePlayer::m_playerSaveData[] =
@ -242,11 +242,11 @@ void CBasePlayer::Pain( void )
{
float flRndSound;//sound randomizer
flRndSound = RANDOM_FLOAT( 0, 1 );
flRndSound = RANDOM_FLOAT( 0.0f, 1.0f );
if( flRndSound <= 0.33 )
if( flRndSound <= 0.33f )
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "player/pl_pain5.wav", 1, ATTN_NORM );
else if( flRndSound <= 0.66 )
else if( flRndSound <= 0.66f )
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "player/pl_pain6.wav", 1, ATTN_NORM );
else
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "player/pl_pain7.wav", 1, ATTN_NORM );
@ -257,7 +257,7 @@ Vector VecVelocityForDamage( float flDamage )
Vector vec( RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( -100, 100 ), RANDOM_FLOAT( 200, 300 ) );
if( flDamage > -50 )
vec = vec * 0.7;
vec = vec * 0.7f;
else if( flDamage > -200 )
vec = vec * 2;
else
@ -314,15 +314,15 @@ int TrainSpeed( int iSpeed, int iMax )
fMax = (float)iMax;
fSpeed = iSpeed;
fSpeed = fSpeed/fMax;
fSpeed = fSpeed / fMax;
if( iSpeed < 0 )
iRet = TRAIN_BACK;
else if( iSpeed == 0 )
else if( iSpeed == 0.0f )
iRet = TRAIN_NEUTRAL;
else if( fSpeed < 0.33 )
else if( fSpeed < 0.33f )
iRet = TRAIN_SLOW;
else if( fSpeed < 0.66 )
else if( fSpeed < 0.66f )
iRet = TRAIN_MEDIUM;
else
iRet = TRAIN_FAST;
@ -921,7 +921,7 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
pev->angles.z = 0;
SetThink( &CBasePlayer::PlayerDeathThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
// Set the activity based on an event or current state
@ -1722,7 +1722,7 @@ void CBasePlayer::UpdateStatusBar()
Vector vecEnd = vecSrc + ( gpGlobals->v_forward * MAX_ID_RANGE );
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, edict(), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
if( !FNullEnt( tr.pHit ) )
{
@ -1740,7 +1740,7 @@ void CBasePlayer::UpdateStatusBar()
newSBarState[SBAR_ID_TARGETARMOR] = (int)pEntity->pev->armorvalue; //No need to get it % based since 100 it's the max.
}
m_flStatusBarDisappearDelay = gpGlobals->time + 1.0;
m_flStatusBarDisappearDelay = gpGlobals->time + 1.0f;
}
}
else if( m_flStatusBarDisappearDelay > gpGlobals->time )
@ -1869,7 +1869,7 @@ void CBasePlayer::PreThink( void )
UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, -38 ), ignore_monsters, ENT( pev ), &trainTrace );
// HACKHACK - Just look for the func_tracktrain classname
if( trainTrace.flFraction != 1.0 && trainTrace.pHit )
if( trainTrace.flFraction != 1.0f && trainTrace.pHit )
pTrain = CBaseEntity::Instance( trainTrace.pHit );
if( !pTrain || !( pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE ) || !pTrain->OnControls( pev ) )
@ -2022,7 +2022,7 @@ void CBasePlayer::CheckTimeBasedDamage()
return;
// only check for time based damage approx. every 2 seconds
if( fabs( gpGlobals->time - m_tbdPrev ) < 2.0 )
if( fabs( gpGlobals->time - m_tbdPrev ) < 2.0f )
return;
m_tbdPrev = gpGlobals->time;
@ -2176,7 +2176,7 @@ Things powered by the battery
// if in range of radiation source, ping geiger counter
#define GEIGERDELAY 0.25
#define GEIGERDELAY 0.25f
void CBasePlayer::UpdateGeigerCounter( void )
{
@ -2213,8 +2213,8 @@ Play suit update if it's time
================
*/
#define SUITUPDATETIME 3.5
#define SUITFIRSTUPDATETIME 0.1
#define SUITUPDATETIME 3.5f
#define SUITFIRSTUPDATETIME 0.1f
void CBasePlayer::CheckSuitUpdate()
{
@ -2617,23 +2617,23 @@ pt_end:
if( gun && gun->UseDecrement() )
{
gun->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0 );
gun->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001 );
gun->m_flNextPrimaryAttack = Q_max( gun->m_flNextPrimaryAttack - gpGlobals->frametime, -1.0f );
gun->m_flNextSecondaryAttack = Q_max( gun->m_flNextSecondaryAttack - gpGlobals->frametime, -0.001f );
if( gun->m_flTimeWeaponIdle != 1000 )
if( gun->m_flTimeWeaponIdle != 1000.0f )
{
gun->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001 );
gun->m_flTimeWeaponIdle = Q_max( gun->m_flTimeWeaponIdle - gpGlobals->frametime, -0.001f );
}
if( gun->pev->fuser1 != 1000 )
if( gun->pev->fuser1 != 1000.0f )
{
gun->pev->fuser1 = Q_max( gun->pev->fuser1 - gpGlobals->frametime, -0.001 );
gun->pev->fuser1 = Q_max( gun->pev->fuser1 - gpGlobals->frametime, -0.001f );
}
// Only decrement if not flagged as NO_DECREMENT
/*if( gun->m_flPumpTime != 1000 )
/*if( gun->m_flPumpTime != 1000.0f )
{
gun->m_flPumpTime = Q_max( gun->m_flPumpTime - gpGlobals->frametime, -0.001 );
gun->m_flPumpTime = Q_max( gun->m_flPumpTime - gpGlobals->frametime, -0.001f );
}*/
}
@ -2643,23 +2643,23 @@ pt_end:
}
m_flNextAttack -= gpGlobals->frametime;
if( m_flNextAttack < -0.001 )
m_flNextAttack = -0.001;
if( m_flNextAttack < -0.001f )
m_flNextAttack = -0.001f;
if( m_flNextAmmoBurn != 1000 )
if( m_flNextAmmoBurn != 1000.0f )
{
m_flNextAmmoBurn -= gpGlobals->frametime;
if( m_flNextAmmoBurn < -0.001 )
m_flNextAmmoBurn = -0.001;
if( m_flNextAmmoBurn < -0.001f )
m_flNextAmmoBurn = -0.001f;
}
if( m_flAmmoStartCharge != 1000 )
if( m_flAmmoStartCharge != 1000.0f )
{
m_flAmmoStartCharge -= gpGlobals->frametime;
if( m_flAmmoStartCharge < -0.001 )
m_flAmmoStartCharge = -0.001;
if( m_flAmmoStartCharge < -0.001f )
m_flAmmoStartCharge = -0.001f;
}
#else
return;
@ -2803,8 +2803,8 @@ void CBasePlayer::Spawn( void )
pev->deadflag = DEAD_NO;
pev->dmg_take = 0;
pev->dmg_save = 0;
pev->friction = 1.0;
pev->gravity = 1.0;
pev->friction = 1.0f;
pev->gravity = 1.0f;
m_bitsHUDDamage = -1;
m_bitsDamageType = 0;
m_afPhysicsFlags = 0;
@ -2818,12 +2818,12 @@ void CBasePlayer::Spawn( void )
m_flNextDecalTime = 0;// let this player decal as soon as he spawns.
m_flgeigerDelay = gpGlobals->time + 2.0; // wait a few seconds until user-defined message registrations
m_flgeigerDelay = gpGlobals->time + 2.0f; // wait a few seconds until user-defined message registrations
// are recieved by all clients
m_flTimeStepSound = 0;
m_iStepLeft = 0;
m_flFieldOfView = 0.5;// some monsters use this to determine whether or not the player is looking at them.
m_flFieldOfView = 0.5f;// some monsters use this to determine whether or not the player is looking at them.
m_bloodColor = BLOOD_COLOR_RED;
m_flNextAttack = UTIL_WeaponTimeBase();
@ -3175,7 +3175,7 @@ void CSprayCan::Spawn( entvars_t *pevOwner )
pev->owner = ENT( pevOwner );
pev->frame = 0;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "player/sprayer.wav", 1, ATTN_NORM );
}
@ -3214,7 +3214,7 @@ void CSprayCan::Think( void )
UTIL_Remove( this );
}
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
class CBloodSplat : public CBaseEntity
@ -3231,7 +3231,7 @@ void CBloodSplat::Spawn( entvars_t *pevOwner )
pev->owner = ENT( pevOwner );
SetThink( &CBloodSplat::Spray );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
void CBloodSplat::Spray( void )
@ -3246,7 +3246,7 @@ void CBloodSplat::Spray( void )
UTIL_BloodDecalTrace( &tr, BLOOD_COLOR_RED );
}
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
//==============================================
@ -3275,7 +3275,7 @@ CBaseEntity *FindEntityForward( CBaseEntity *pMe )
UTIL_MakeVectors( pMe->pev->v_angle );
UTIL_TraceLine( pMe->pev->origin + pMe->pev->view_ofs,pMe->pev->origin + pMe->pev->view_ofs + gpGlobals->v_forward * 8192,dont_ignore_monsters, pMe->edict(), &tr );
if( tr.flFraction != 1.0 && !FNullEnt( tr.pHit ) )
if( tr.flFraction != 1.0f && !FNullEnt( tr.pHit ) )
{
CBaseEntity *pHit = CBaseEntity::Instance( tr.pHit );
return pHit;
@ -3411,7 +3411,7 @@ void CBasePlayer::ImpulseCommands()
UTIL_MakeVectors( pev->v_angle );
UTIL_TraceLine( pev->origin + pev->view_ofs, pev->origin + pev->view_ofs + gpGlobals->v_forward * 128, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
// line hit something, so paint a decal
m_flNextDecalTime = gpGlobals->time + decalfrequency.value;
@ -3433,7 +3433,7 @@ void CBasePlayer::ImpulseCommands()
void CBasePlayer::CheatImpulseCommands( int iImpulse )
{
#if !defined( HLDEMO_BUILD )
if( g_flWeaponCheat == 0.0 )
if( g_flWeaponCheat == 0.0f )
{
return;
}
@ -3582,7 +3582,7 @@ void CBasePlayer::CheatImpulseCommands( int iImpulse )
UTIL_MakeVectors( pev->v_angle );
UTIL_TraceLine( pev->origin + pev->view_ofs, pev->origin + pev->view_ofs + gpGlobals->v_forward * 128, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction != 1.0 )
if( tr.flFraction != 1.0f )
{
// line hit something, so paint a decal
CBloodSplat *pBlood = GetClassPtr( (CBloodSplat *)NULL );
@ -4104,7 +4104,7 @@ void CBasePlayer::UpdateClientData( void )
if( m_flNextSBarUpdateTime < gpGlobals->time )
{
UpdateStatusBar();
m_flNextSBarUpdateTime = gpGlobals->time + 0.2;
m_flNextSBarUpdateTime = gpGlobals->time + 0.2f;
}
// Send the current bhopcap state.
@ -4207,7 +4207,7 @@ Vector CBasePlayer::GetAutoaimVector( float flDelta )
}
Vector vecSrc = GetGunPosition();
float flDist = 8192;
float flDist = 8192.0f;
// always use non-sticky autoaim
// UNDONE: use sever variable to chose!
@ -4250,11 +4250,11 @@ Vector CBasePlayer::GetAutoaimVector( float flDelta )
// UNDONE: use sever variable to chose!
if( 0 || g_iSkillLevel == SKILL_EASY )
{
m_vecAutoAim = m_vecAutoAim * 0.67 + angles * 0.33;
m_vecAutoAim = m_vecAutoAim * 0.67f + angles * 0.33f;
}
else
{
m_vecAutoAim = angles * 0.9;
m_vecAutoAim = angles * 0.9f;
}
// m_vecAutoAim = m_vecAutoAim * 0.99;
@ -4352,16 +4352,16 @@ Vector CBasePlayer::AutoaimDeflection( Vector &vecSrc, float flDist, float flDel
if( DotProduct( dir, gpGlobals->v_forward ) < 0 )
continue;
dot = fabs( DotProduct( dir, gpGlobals->v_right ) ) + fabs( DotProduct( dir, gpGlobals->v_up ) ) * 0.5;
dot = fabs( DotProduct( dir, gpGlobals->v_right ) ) + fabs( DotProduct( dir, gpGlobals->v_up ) ) * 0.5f;
// tweek for distance
dot *= 1.0 + 0.2 * ( ( center - vecSrc ).Length() / flDist );
dot *= 1.0f + 0.2f * ( ( center - vecSrc ).Length() / flDist );
if( dot > bestdot )
continue; // to far to turn
UTIL_TraceLine( vecSrc, center, dont_ignore_monsters, edict(), &tr );
if( tr.flFraction != 1.0 && tr.pHit != pEdict )
if( tr.flFraction != 1.0f && tr.pHit != pEdict )
{
// ALERT( at_console, "hit %s, can't see %s\n", STRING( tr.pHit->v.classname ), STRING( pEdict->v.classname ) );
continue;
@ -4798,7 +4798,7 @@ void CInfoIntermission::Spawn( void )
pev->effects = EF_NODRAW;
pev->v_angle = g_vecZero;
pev->nextthink = gpGlobals->time + 2;// let targets spawn!
pev->nextthink = gpGlobals->time + 2.0f;// let targets spawn!
}
void CInfoIntermission::Think( void )

View File

@ -123,8 +123,8 @@ void CPython::Holster( int skiplocal /* = 0 */ )
SecondaryAttack();
}
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
SendWeaponAnim( PYTHON_HOLSTER );
}
@ -150,7 +150,7 @@ void CPython::SecondaryAttack( void )
m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 40;
}
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
}
void CPython::PrimaryAttack()
@ -159,7 +159,7 @@ void CPython::PrimaryAttack()
if( m_pPlayer->pev->waterlevel == 3 )
{
PlayEmptySound();
m_flNextPrimaryAttack = 0.15;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15f;
return;
}
@ -170,7 +170,7 @@ void CPython::PrimaryAttack()
else
{
PlayEmptySound();
m_flNextPrimaryAttack = 0.15;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15f;
}
return;
@ -206,8 +206,8 @@ void CPython::PrimaryAttack()
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
m_flNextPrimaryAttack = 0.75;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_flNextPrimaryAttack = 0.75f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
}
void CPython::Reload( void )
@ -227,9 +227,9 @@ void CPython::Reload( void )
#else
bUseScope = g_pGameRules->IsMultiplayer();
#endif
if( DefaultReload( PYTHON_MAX_CLIP, PYTHON_RELOAD, 2.0, bUseScope ) )
if( DefaultReload( PYTHON_MAX_CLIP, PYTHON_RELOAD, 2.0f, bUseScope ) )
{
m_flSoundDelay = 1.5;
m_flSoundDelay = 1.5f;
}
}
@ -242,8 +242,8 @@ void CPython::WeaponIdle( void )
// ALERT( at_console, "%.2f\n", gpGlobals->time - m_flSoundDelay );
if( m_flSoundDelay != 0 && m_flSoundDelay <= UTIL_WeaponTimeBase() )
{
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/357_reload1.wav", RANDOM_FLOAT( 0.8, 0.9 ), ATTN_NORM );
m_flSoundDelay = 0;
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/357_reload1.wav", RANDOM_FLOAT( 0.8f, 0.9f ), ATTN_NORM );
m_flSoundDelay = 0.0f;
}
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
@ -251,25 +251,25 @@ void CPython::WeaponIdle( void )
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0f, 1.0f );
if( flRand <= 0.5 )
if( flRand <= 0.5f )
{
iAnim = PYTHON_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 70.0 / 30.0 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 70.0f / 30.0f );
}
else if( flRand <= 0.7 )
else if( flRand <= 0.7f )
{
iAnim = PYTHON_IDLE2;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 60.0 / 30.0 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 60.0f / 30.0f );
}
else if( flRand <= 0.9 )
else if( flRand <= 0.9f )
{
iAnim = PYTHON_IDLE3;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 88.0 / 30.0 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 88.0f / 30.0f );
}
else
{
iAnim = PYTHON_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 170.0 / 30.0 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 170.0f / 30.0f );
}
int bUseScope = FALSE;

View File

@ -190,7 +190,7 @@ void CRoach::MonsterThink( void )
if( FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) )
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 1, 1.5 );
else
pev->nextthink = gpGlobals->time + 0.1;// keep monster thinking
pev->nextthink = gpGlobals->time + 0.1f;// keep monster thinking
float flInterval = StudioFrameAdvance(); // animate
@ -262,7 +262,7 @@ void CRoach::MonsterThink( void )
pSound = CSoundEnt::SoundPointerForIndex( m_iAudibleList );
// roach smells food and is just standing around. Go to food unless food isn't on same z-plane.
if( pSound && fabs( pSound->m_vecOrigin.z - pev->origin.z ) <= 3.0 )
if( pSound && fabs( pSound->m_vecOrigin.z - pev->origin.z ) <= 3.0f )
{
PickNewDest( ROACH_SMELL_FOOD );
SetActivity( ACT_WALK );

View File

@ -134,14 +134,14 @@ void CRpgRocket::Spawn( void )
SetThink( &CRpgRocket::IgniteThink );
SetTouch( &CGrenade::ExplodeTouch );
pev->angles.x -= 30;
pev->angles.x -= 30.0f;
UTIL_MakeVectors( pev->angles );
pev->angles.x = -( pev->angles.x + 30 );
pev->angles.x = -( pev->angles.x + 30.0f );
pev->velocity = gpGlobals->v_forward * 250;
pev->gravity = 0.5;
pev->velocity = gpGlobals->v_forward * 250.0f;
pev->gravity = 0.5f;
pev->nextthink = gpGlobals->time + 0.4;
pev->nextthink = gpGlobals->time + 0.4f;
pev->dmg = gSkillData.plrDmgRPG;
}
@ -177,7 +177,7 @@ void CRpgRocket::IgniteThink( void )
pev->effects |= EF_LIGHT;
// make rocket sound
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/rocket1.wav", 1, 0.5 );
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "weapons/rocket1.wav", 1, 0.5f );
// rocket trail
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
@ -196,7 +196,7 @@ void CRpgRocket::IgniteThink( void )
// set to follow laser spot
SetThink( &CRpgRocket::FollowThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
void CRpgRocket::FollowThink( void )
@ -217,7 +217,7 @@ void CRpgRocket::FollowThink( void )
{
UTIL_TraceLine( pev->origin, pOther->pev->origin, dont_ignore_monsters, ENT( pev ), &tr );
// ALERT( at_console, "%f\n", tr.flFraction );
if( tr.flFraction >= 0.90 )
if( tr.flFraction >= 0.9f )
{
vecDir = pOther->pev->origin - pev->origin;
flDist = vecDir.Length();
@ -235,23 +235,23 @@ void CRpgRocket::FollowThink( void )
// this acceleration and turning math is totally wrong, but it seems to respond well so don't change it.
float flSpeed = pev->velocity.Length();
if( gpGlobals->time - m_flIgniteTime < 1.0 )
if( gpGlobals->time - m_flIgniteTime < 1.0f )
{
pev->velocity = pev->velocity * 0.2 + vecTarget * ( flSpeed * 0.8 + 400 );
pev->velocity = pev->velocity * 0.2f + vecTarget * ( flSpeed * 0.8f + 400.0f );
if( pev->waterlevel == 3 )
{
// go slow underwater
if( pev->velocity.Length() > 300 )
if( pev->velocity.Length() > 300.0f )
{
pev->velocity = pev->velocity.Normalize() * 300;
pev->velocity = pev->velocity.Normalize() * 300.0f;
}
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1, pev->origin, 4 );
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1f, pev->origin, 4 );
}
else
{
if( pev->velocity.Length() > 2000 )
if( pev->velocity.Length() > 2000.0f )
{
pev->velocity = pev->velocity.Normalize() * 2000;
pev->velocity = pev->velocity.Normalize() * 2000.0f;
}
}
}
@ -262,8 +262,8 @@ void CRpgRocket::FollowThink( void )
pev->effects = 0;
STOP_SOUND( ENT( pev ), CHAN_VOICE, "weapons/rocket1.wav" );
}
pev->velocity = pev->velocity * 0.2 + vecTarget * flSpeed * 0.798;
if( pev->waterlevel == 0 && pev->velocity.Length() < 1500 )
pev->velocity = pev->velocity * 0.2f + vecTarget * flSpeed * 0.798f;
if( pev->waterlevel == 0 && pev->velocity.Length() < 1500.0f )
{
if( CRpg *pLauncher = (CRpg*)( (CBaseEntity*)( m_hLauncher ) ) )
{
@ -275,7 +275,7 @@ void CRpgRocket::FollowThink( void )
}
// ALERT( at_console, "%.0f\n", flSpeed );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
#endif
@ -297,7 +297,7 @@ void CRpg::Reload( void )
// Set the next attack time into the future so that WeaponIdle will get called more often
// than reload, allowing the RPG LTD to be updated
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5f );
if( m_cActiveRockets && m_fSpotActive )
{
@ -309,8 +309,8 @@ void CRpg::Reload( void )
#ifndef CLIENT_DLL
if( m_pSpot && m_fSpotActive )
{
m_pSpot->Suspend( 2.1 );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.1;
m_pSpot->Suspend( 2.1f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 2.1f;
}
#endif
@ -417,7 +417,7 @@ void CRpg::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( RPG_HOLSTER1 );
@ -442,7 +442,7 @@ void CRpg::PrimaryAttack()
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
Vector vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -8;
Vector vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16.0f + gpGlobals->v_right * 8.0f + gpGlobals->v_up * -8.0f;
CRpgRocket *pRocket = CRpgRocket::CreateRpgRocket( vecSrc, m_pPlayer->pev->v_angle, m_pPlayer, this );
@ -463,15 +463,15 @@ void CRpg::PrimaryAttack()
m_iClip--;
m_flNextPrimaryAttack = GetNextAttackDelay( 1.5 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
m_flNextPrimaryAttack = GetNextAttackDelay( 1.5f );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5f;
ResetEmptySound();
}
else
{
PlayEmptySound();
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2;
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.2f;
}
UpdateSpot();
}
@ -487,7 +487,7 @@ void CRpg::SecondaryAttack()
m_pSpot = NULL;
}
#endif
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.2;
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.2f;
}
void CRpg::WeaponIdle( void )
@ -502,15 +502,15 @@ void CRpg::WeaponIdle( void )
ResetEmptySound();
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand <= 0.75 || m_fSpotActive )
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0f, 1.0f );
if( flRand <= 0.75f || m_fSpotActive )
{
if( m_iClip == 0 )
iAnim = RPG_IDLE_UL;
else
iAnim = RPG_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0 / 15.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0f / 15.0f;
}
else
{
@ -519,14 +519,14 @@ void CRpg::WeaponIdle( void )
else
iAnim = RPG_FIDGET;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;
}
SendWeaponAnim( iAnim );
}
else
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
}
}
@ -548,7 +548,7 @@ void CRpg::UpdateSpot( void )
Vector vecAiming = gpGlobals->v_forward;
TraceResult tr;
UTIL_TraceLine( vecSrc, vecSrc + vecAiming * 8192, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
UTIL_TraceLine( vecSrc, vecSrc + vecAiming * 8192.0f, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
UTIL_SetOrigin( m_pSpot->pev, tr.vecEndPos );
}

View File

@ -88,10 +88,10 @@ void CSatchelCharge::Spawn( void )
SetTouch( &CSatchelCharge::SatchelSlide );
SetUse( &CGrenade::DetonateUse );
SetThink( &CSatchelCharge::SatchelThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
pev->gravity = 0.5;
pev->friction = 0.8;
pev->gravity = 0.5f;
pev->friction = 0.8f;
pev->dmg = gSkillData.plrDmgSatchel;
// ResetSequenceInfo();
@ -113,14 +113,14 @@ void CSatchelCharge::SatchelSlide( CBaseEntity *pOther )
TraceResult tr;
UTIL_TraceLine( pev->origin, pev->origin - Vector( 0, 0, 10 ), ignore_monsters, edict(), &tr );
if( tr.flFraction < 1.0 )
if( tr.flFraction < 1.0f )
{
// add a bit of static friction
pev->velocity = pev->velocity * 0.95;
pev->avelocity = pev->avelocity * 0.9;
// play sliding sound, volume based on velocity
}
if( !( pev->flags & FL_ONGROUND ) && pev->velocity.Length2D() > 10 )
if( !( pev->flags & FL_ONGROUND ) && pev->velocity.Length2D() > 10.0f )
{
// Fix for a bug in engine: when object isn't moving, but its speed isn't 0 and on ground isn't set
if( pev->origin != m_lastBounceOrigin )
@ -135,7 +135,7 @@ void CSatchelCharge::SatchelThink( void )
{
// There is no model animation so commented this out to prevent net traffic
// StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
if( !IsInWorld() )
{
@ -146,8 +146,8 @@ void CSatchelCharge::SatchelThink( void )
if( pev->waterlevel == 3 )
{
pev->movetype = MOVETYPE_FLY;
pev->velocity = pev->velocity * 0.8;
pev->avelocity = pev->avelocity * 0.9;
pev->velocity = pev->velocity * 0.8f;
pev->avelocity = pev->avelocity * 0.9f;
pev->velocity.z += 8;
}
else if( pev->waterlevel == 0 )
@ -156,7 +156,7 @@ void CSatchelCharge::SatchelThink( void )
}
else
{
pev->velocity.z -= 8;
pev->velocity.z -= 8.0f;
}
}
@ -292,8 +292,8 @@ BOOL CSatchel::CanDeploy( void )
BOOL CSatchel::Deploy()
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
if( m_chargeReady )
return DefaultDeploy( "models/v_satchel_radio.mdl", "models/p_satchel_radio.mdl", SATCHEL_RADIO_DRAW, "hive" );
@ -305,7 +305,7 @@ BOOL CSatchel::Deploy()
void CSatchel::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
if( m_chargeReady )
{
@ -315,7 +315,7 @@ void CSatchel::Holster( int skiplocal /* = 0 */ )
{
SendWeaponAnim( SATCHEL_DROP );
}
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0f, ATTN_NORM );
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] && m_chargeReady != SATCHEL_READY )
{
@ -353,9 +353,9 @@ void CSatchel::PrimaryAttack()
}
m_chargeReady = SATCHEL_RELOAD;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;
break;
}
case SATCHEL_RELOAD:
@ -400,8 +400,8 @@ void CSatchel::Throw( void )
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
m_flNextPrimaryAttack = GetNextAttackDelay( 1.0 );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
m_flNextPrimaryAttack = GetNextAttackDelay( 1.0f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
}
}
@ -441,8 +441,8 @@ void CSatchel::WeaponIdle( void )
// use tripmine animations
strcpy( m_pPlayer->m_szAnimExtention, "trip" );
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.5f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
m_chargeReady = SATCHEL_IDLE;
break;
}

View File

@ -414,7 +414,7 @@ void CBaseMonster::RunTask( Task_t *pTask )
distance = ( m_vecMoveGoal - pev->origin ).Length2D();
// Re-evaluate when you think your finished, or the target has moved too far
if( ( distance < pTask->flData ) || ( m_vecMoveGoal - m_hTargetEnt->pev->origin ).Length() > pTask->flData * 0.5 )
if( ( distance < pTask->flData ) || ( m_vecMoveGoal - m_hTargetEnt->pev->origin ).Length() > pTask->flData * 0.5f )
{
m_vecMoveGoal = m_hTargetEnt->pev->origin;
distance = ( m_vecMoveGoal - pev->origin ).Length2D();
@ -1378,7 +1378,7 @@ Schedule_t *CBaseMonster::GetSchedule( void )
if( HasConditions( bits_COND_LIGHT_DAMAGE | bits_COND_HEAVY_DAMAGE ) )
{
if( fabs( FlYawDiff() ) < ( 1.0 - m_flFieldOfView ) * 60 ) // roughly in the correct direction
if( fabs( FlYawDiff() ) < ( 1.0f - m_flFieldOfView ) * 60.0f ) // roughly in the correct direction
{
return GetScheduleOfType( SCHED_TAKE_COVER_FROM_ORIGIN );
}

View File

@ -135,7 +135,7 @@ IMPLEMENT_SAVERESTORE( CScientist, CTalkMonster )
Task_t tlFollow[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_CANT_FOLLOW }, // If you fail, bail out of follow
{ TASK_MOVE_TO_TARGET_RANGE, (float)128 }, // Move within 128 of target ent (client)
{ TASK_MOVE_TO_TARGET_RANGE, 128.0f }, // Move within 128 of target ent (client)
//{ TASK_SET_SCHEDULE, (float)SCHED_TARGET_FACE },
};
@ -157,7 +157,7 @@ Schedule_t slFollow[] =
Task_t tlFollowScared[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_TARGET_CHASE },// If you fail, follow normally
{ TASK_MOVE_TO_TARGET_RANGE_SCARED, (float)128 }, // Move within 128 of target ent (client)
{ TASK_MOVE_TO_TARGET_RANGE_SCARED, 128.0f }, // Move within 128 of target ent (client)
//{ TASK_SET_SCHEDULE, (float)SCHED_TARGET_FACE_SCARED },
};
@ -177,7 +177,7 @@ Schedule_t slFollowScared[] =
Task_t tlFaceTargetScared[] =
{
{ TASK_FACE_TARGET, (float)0 },
{ TASK_FACE_TARGET, 0.0f },
{ TASK_SET_ACTIVITY, (float)ACT_CROUCHIDLE },
{ TASK_SET_SCHEDULE, (float)SCHED_TARGET_CHASE_SCARED },
};
@ -196,7 +196,7 @@ Schedule_t slFaceTargetScared[] =
Task_t tlStopFollowing[] =
{
{ TASK_CANT_FOLLOW, (float)0 },
{ TASK_CANT_FOLLOW, 0.0f },
};
Schedule_t slStopFollowing[] =
@ -212,12 +212,12 @@ Schedule_t slStopFollowing[] =
Task_t tlHeal[] =
{
{ TASK_MOVE_TO_TARGET_RANGE, (float)50 }, // Move within 60 of target ent (client)
{ TASK_MOVE_TO_TARGET_RANGE, 50.0f }, // Move within 60 of target ent (client)
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_TARGET_CHASE }, // If you fail, catch up with that guy! (change this to put syringe away and then chase)
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_SAY_HEAL, (float)0 },
{ TASK_FACE_IDEAL, 0.0f },
{ TASK_SAY_HEAL, 0.0f },
{ TASK_PLAY_SEQUENCE_FACE_TARGET, (float)ACT_ARM }, // Whip out the needle
{ TASK_HEAL, (float)0 }, // Put it in the player
{ TASK_HEAL, 0.0f }, // Put it in the player
{ TASK_PLAY_SEQUENCE_FACE_TARGET, (float)ACT_DISARM }, // Put away the needle
};
@ -234,8 +234,8 @@ Schedule_t slHeal[] =
Task_t tlFaceTarget[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FACE_TARGET, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_FACE_TARGET, 0.0f },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_SET_SCHEDULE, (float)SCHED_TARGET_CHASE },
};
@ -256,9 +256,9 @@ Schedule_t slFaceTarget[] =
Task_t tlSciPanic[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_SCREAM, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_FACE_ENEMY, 0.0f },
{ TASK_SCREAM, 0.0f },
{ TASK_PLAY_SEQUENCE_FACE_ENEMY, (float)ACT_EXCITED }, // This is really fear-stricken excitement
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
};
@ -278,7 +278,7 @@ Task_t tlIdleSciStand[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_WAIT, (float)2 }, // repick IDLESTAND every two seconds.
{ TASK_WAIT, 2.0f }, // repick IDLESTAND every two seconds.
{ TASK_TLK_HEADRESET, (float)0 }, // reset head position
};
@ -309,10 +309,10 @@ Schedule_t slIdleSciStand[] =
Task_t tlScientistCover[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_PANIC }, // If you fail, just panic!
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FIND_COVER_FROM_ENEMY, (float)0 },
{ TASK_RUN_PATH_SCARED, (float)0 },
{ TASK_TURN_LEFT, (float)179 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_FIND_COVER_FROM_ENEMY, 0.0f },
{ TASK_RUN_PATH_SCARED, 0.0f },
{ TASK_TURN_LEFT, 179.0f },
{ TASK_SET_SCHEDULE, (float)SCHED_HIDE },
};
@ -330,10 +330,10 @@ Schedule_t slScientistCover[] =
Task_t tlScientistHide[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_PANIC }, // If you fail, just panic!
{ TASK_STOP_MOVING, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_PLAY_SEQUENCE, (float)ACT_CROUCH },
{ TASK_SET_ACTIVITY, (float)ACT_CROUCHIDLE }, // FIXME: This looks lame
{ TASK_WAIT_RANDOM, (float)10.0 },
{ TASK_WAIT_RANDOM, 10.0f },
};
Schedule_t slScientistHide[] =
@ -355,12 +355,12 @@ Schedule_t slScientistHide[] =
Task_t tlScientistStartle[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_PANIC }, // If you fail, just panic!
{ TASK_RANDOM_SCREAM, (float)0.3 }, // Scream 30% of the time
{ TASK_STOP_MOVING, (float)0 },
{ TASK_RANDOM_SCREAM, 0.3f }, // Scream 30% of the time
{ TASK_STOP_MOVING, 0.0f },
{ TASK_PLAY_SEQUENCE_FACE_ENEMY, (float)ACT_CROUCH },
{ TASK_RANDOM_SCREAM, (float)0.1 }, // Scream again 10% of the time
{ TASK_RANDOM_SCREAM, 0.1f }, // Scream again 10% of the time
{ TASK_PLAY_SEQUENCE_FACE_ENEMY, (float)ACT_CROUCHIDLE },
{ TASK_WAIT_RANDOM, (float)1.0 },
{ TASK_WAIT_RANDOM, 1.0f },
};
Schedule_t slScientistStartle[] =
@ -380,9 +380,9 @@ Schedule_t slScientistStartle[] =
Task_t tlFear[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FACE_ENEMY, (float)0 },
{ TASK_SAY_FEAR, (float)0 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_FACE_ENEMY, 0.0f },
{ TASK_SAY_FEAR, 0.0f },
//{ TASK_PLAY_SEQUENCE, (float)ACT_FEAR_DISPLAY },
};
@ -428,7 +428,7 @@ void CScientist::Scream( void )
{
Talk( 10 );
m_hTalkTarget = m_hEnemy;
PlaySentence( "SC_SCREAM", RANDOM_FLOAT( 3, 6 ), VOL_NORM, ATTN_NORM );
PlaySentence( "SC_SCREAM", RANDOM_FLOAT( 3.0f, 6.0f ), VOL_NORM, ATTN_NORM );
}
}
@ -455,7 +455,7 @@ void CScientist::StartTask( Task_t *pTask )
TaskComplete();
break;
case TASK_RANDOM_SCREAM:
if( RANDOM_FLOAT( 0, 1 ) < pTask->flData )
if( RANDOM_FLOAT( 0.0f, 1.0f ) < pTask->flData )
Scream();
TaskComplete();
break;
@ -482,8 +482,10 @@ void CScientist::StartTask( Task_t *pTask )
break;
case TASK_MOVE_TO_TARGET_RANGE_SCARED:
{
if( ( m_hTargetEnt->pev->origin - pev->origin).Length() < 1 )
if( ( m_hTargetEnt->pev->origin - pev->origin ).Length() < 1.0f )
{
TaskComplete();
}
else
{
m_vecMoveGoal = m_hTargetEnt->pev->origin;
@ -523,7 +525,7 @@ void CScientist::RunTask( Task_t *pTask )
distance = ( m_vecMoveGoal - pev->origin ).Length2D();
// Re-evaluate when you think your finished, or the target has moved too far
if( ( distance < pTask->flData ) || ( m_vecMoveGoal - m_hTargetEnt->pev->origin ).Length() > pTask->flData * 0.5 )
if( ( distance < pTask->flData ) || ( m_vecMoveGoal - m_hTargetEnt->pev->origin ).Length() > pTask->flData * 0.5f )
{
m_vecMoveGoal = m_hTargetEnt->pev->origin;
distance = ( m_vecMoveGoal - pev->origin ).Length2D();
@ -771,7 +773,7 @@ void CScientist::PainSound( void )
if( gpGlobals->time < m_painTime )
return;
m_painTime = gpGlobals->time + RANDOM_FLOAT( 0.5, 0.75 );
m_painTime = gpGlobals->time + RANDOM_FLOAT( 0.5f, 0.75f );
switch( RANDOM_LONG( 0, 4 ) )
{
@ -1047,7 +1049,7 @@ MONSTERSTATE CScientist::GetIdealState( void )
BOOL CScientist::CanHeal( void )
{
if( ( m_healTime > gpGlobals->time ) || ( m_hTargetEnt == 0 ) || ( m_hTargetEnt->pev->health > ( m_hTargetEnt->pev->max_health * 0.5 ) ) )
if( ( m_healTime > gpGlobals->time ) || ( m_hTargetEnt == 0 ) || ( m_hTargetEnt->pev->health > ( m_hTargetEnt->pev->max_health * 0.5f ) ) )
return FALSE;
return TRUE;
@ -1059,7 +1061,7 @@ void CScientist::Heal( void )
return;
Vector target = m_hTargetEnt->pev->origin - pev->origin;
if( target.Length() > 100 )
if( target.Length() > 100.0f )
return;
m_hTargetEnt->TakeHealth( gSkillData.scientistHeal, DMG_GENERIC );
@ -1238,7 +1240,7 @@ void CSittingScientist::Spawn()
ResetSequenceInfo();
SetThink( &CSittingScientist::SittingThink );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
DROP_TO_FLOOR( ENT( pev ) );
}
@ -1366,13 +1368,13 @@ void CSittingScientist::SittingThink( void )
pev->frame = 0;
SetBoneController( 0, m_headTurn );
}
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
// prepare sitting scientist to answer a question
void CSittingScientist::SetAnswerQuestion( CTalkMonster *pSpeaker )
{
m_flResponseDelay = gpGlobals->time + RANDOM_FLOAT( 3, 4 );
m_flResponseDelay = gpGlobals->time + RANDOM_FLOAT( 3.0f, 4.0f );
m_hTalkTarget = (CBaseMonster *)pSpeaker;
}

View File

@ -136,10 +136,10 @@ void CCineMonster::Spawn( void )
if( FStringNull( pev->targetname ) || !FStringNull( m_iszIdle ) )
{
SetThink( &CCineMonster::CineThink );
pev->nextthink = gpGlobals->time + 1.0;
pev->nextthink = gpGlobals->time + 1.0f;
// Wait to be used?
if( pev->targetname )
m_startTime = gpGlobals->time + 1E6;
m_startTime = gpGlobals->time + (float)1E6;
}
if( pev->spawnflags & SF_SCRIPT_NOINTERRUPT )
m_interruptable = FALSE;
@ -185,7 +185,7 @@ void CCineMonster::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
if( pTarget->m_scriptState == SCRIPT_PLAYING )
return;
m_startTime = gpGlobals->time + 0.05;
m_startTime = gpGlobals->time + 0.05f;
}
else
{
@ -356,7 +356,7 @@ void CCineMonster::PossessEntity( void )
pTarget->pev->effects |= EF_NOINTERP;
pTarget->pev->angles.y = pev->angles.y;
pTarget->m_scriptState = SCRIPT_WAIT;
m_startTime = gpGlobals->time + 1E6;
m_startTime = gpGlobals->time + (float)1E6;
// UNDONE: Add a flag to do this so people can fixup physics after teleporting monsters
// pTarget->pev->flags &= ~FL_ONGROUND;
break;
@ -424,7 +424,7 @@ void CCineAI::PossessEntity( void )
pTarget->pev->effects |= EF_NOINTERP;
pTarget->pev->angles.y = pev->angles.y;
pTarget->m_scriptState = SCRIPT_WAIT;
m_startTime = gpGlobals->time + 1E6;
m_startTime = gpGlobals->time + (float)1E6;
// UNDONE: Add a flag to do this so people can fixup physics after teleporting monsters
pTarget->pev->flags &= ~FL_ONGROUND;
break;
@ -466,7 +466,7 @@ void CCineMonster::CineThink( void )
{
CancelScript();
ALERT( at_aiconsole, "script \"%s\" can't find monster \"%s\"\n", STRING( pev->targetname ), STRING( m_iszEntity ) );
pev->nextthink = gpGlobals->time + 1.0;
pev->nextthink = gpGlobals->time + 1.0f;
}
}
@ -544,7 +544,7 @@ void CCineMonster::SequenceDone( CBaseMonster *pMonster )
if( !( pev->spawnflags & SF_SCRIPT_REPEATABLE ) )
{
SetThink( &CBaseEntity::SUB_Remove );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
// This is done so that another sequence can take over the monster when triggered by the first
@ -713,7 +713,7 @@ void CCineMonster::DelayStart( int state )
{
pTarget->m_iDelay--;
if( pTarget->m_iDelay <= 0 )
pTarget->m_startTime = gpGlobals->time + 0.05;
pTarget->m_startTime = gpGlobals->time + 0.05f;
}
}
pentCine = FIND_ENTITY_BY_TARGETNAME( pentCine, STRING( pev->targetname ) );
@ -836,7 +836,7 @@ BOOL CBaseMonster::CineCleanup()
// UNDONE: ugly hack. Don't move monster if they don't "seem" to move
// this really needs to be done with the AX,AY,etc. flags, but that aren't consistantly
// being set, so animations that really do move won't be caught.
if( ( oldOrigin - new_origin).Length2D() < 8.0 )
if( ( oldOrigin - new_origin).Length2D() < 8.0f )
new_origin = oldOrigin;
pev->origin.x = new_origin.x;
@ -974,7 +974,7 @@ void CScriptedSentence::KeyValue( KeyValueData *pkvd )
}
else if( FStrEq( pkvd->szKeyName, "volume" ) )
{
m_flVolume = atof( pkvd->szValue ) * 0.1;
m_flVolume = atof( pkvd->szValue ) * 0.1f;
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "listener" ) )
@ -1004,7 +1004,7 @@ void CScriptedSentence::Spawn( void )
if( !pev->targetname )
{
SetThink( &CScriptedSentence::FindThink );
pev->nextthink = gpGlobals->time + 1.0;
pev->nextthink = gpGlobals->time + 1.0f;
}
switch( pev->impulse )
@ -1030,8 +1030,8 @@ void CScriptedSentence::Spawn( void )
pev->impulse = 0;
// No volume, use normal
if( m_flVolume <= 0 )
m_flVolume = 1.0;
if( m_flVolume <= 0.0f )
m_flVolume = 1.0f;
}
void CScriptedSentence::FindThink( void )
@ -1050,7 +1050,7 @@ void CScriptedSentence::FindThink( void )
else
{
//ALERT( at_console, "%s: can't find monster %s\n", STRING( m_iszSentence ), STRING( m_iszEntity ) );
pev->nextthink = gpGlobals->time + m_flRepeat + 0.5;
pev->nextthink = gpGlobals->time + m_flRepeat + 0.5f;
}
}
@ -1058,7 +1058,7 @@ void CScriptedSentence::DelayThink( void )
{
m_active = TRUE;
if( !pev->targetname )
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
SetThink( &CScriptedSentence::FindThink );
}
@ -1146,7 +1146,7 @@ BOOL CScriptedSentence::StartSentence( CBaseMonster *pTarget )
}
pTarget->PlayScriptedSentence( STRING( m_iszSentence ), m_flDuration, m_flVolume, m_flAttenuation, bConcurrent, pListener );
ALERT( at_aiconsole, "Playing sentence %s (%.1f)\n", STRING( m_iszSentence ), m_flDuration );
ALERT( at_aiconsole, "Playing sentence %s (%.1f)\n", STRING( m_iszSentence ), (double)m_flDuration );
SUB_UseTargets( NULL, USE_TOGGLE, 0 );
return TRUE;
}
@ -1192,7 +1192,7 @@ void CFurniture::Spawn()
pev->sequence = 0;
pev->frame = 0;
//pev->nextthink += 1.0;
//pev->nextthink += 1.0f;
//SetThink( &WalkMonsterDelay );
ResetSequenceInfo();

View File

@ -119,7 +119,7 @@ void CShotgun::PrimaryAttack()
if( m_pPlayer->pev->waterlevel == 3 )
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay( 0.15 );
m_flNextPrimaryAttack = GetNextAttackDelay( 0.15f );
return;
}
@ -173,14 +173,14 @@ void CShotgun::PrimaryAttack()
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
//if( m_iClip != 0 )
m_flPumpTime = gpGlobals->time + 0.5;
m_flPumpTime = gpGlobals->time + 0.5f;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75f;
if( m_iClip != 0 )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0f;
else
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75f;
m_fInSpecialReload = 0;
}
@ -190,7 +190,7 @@ void CShotgun::SecondaryAttack( void )
if( m_pPlayer->pev->waterlevel == 3 )
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay( 0.15 );
m_flNextPrimaryAttack = GetNextAttackDelay( 0.15f );
return;
}
@ -237,19 +237,19 @@ void CShotgun::SecondaryAttack( void )
vecDir = m_pPlayer->FireBulletsPlayer( 12, vecSrc, vecAiming, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_BUCKSHOT, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed );
}
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usDoubleFire, 0.0, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usDoubleFire, 0.0f, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
// HEV suit - indicate out of ammo condition
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
//if( m_iClip != 0 )
m_flPumpTime = gpGlobals->time + 0.95;
m_flPumpTime = gpGlobals->time + 0.95f;
m_flNextPrimaryAttack = GetNextAttackDelay( 1.5 );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5;
m_flNextPrimaryAttack = GetNextAttackDelay( 1.5f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.5f;
if( m_iClip != 0 )
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 6.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 6.0f;
else
m_flTimeWeaponIdle = 1.5;
@ -270,10 +270,10 @@ void CShotgun::Reload( void )
{
SendWeaponAnim( SHOTGUN_START_RELOAD );
m_fInSpecialReload = 1;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.6;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6;
m_flNextPrimaryAttack = GetNextAttackDelay( 1.0 );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.6f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.6f;
m_flNextPrimaryAttack = GetNextAttackDelay( 1.0f );
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0f;
return;
}
else if( m_fInSpecialReload == 1 )
@ -290,8 +290,8 @@ void CShotgun::Reload( void )
SendWeaponAnim( SHOTGUN_RELOAD );
m_flNextReload = UTIL_WeaponTimeBase() + 0.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
m_flNextReload = UTIL_WeaponTimeBase() + 0.5f;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;
}
else
{
@ -338,27 +338,27 @@ void CShotgun::WeaponIdle( void )
// play cocking sound
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/scock1.wav", 1, ATTN_NORM, 0, 95 + RANDOM_LONG( 0, 0x1f ) );
m_fInSpecialReload = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.5f;
}
}
else
{
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand <= 0.8 )
if( flRand <= 0.8f )
{
iAnim = SHOTGUN_IDLE_DEEP;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 60.0 / 12.0 );// * RANDOM_LONG( 2, 5 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 60.0f / 12.0f );// * RANDOM_LONG( 2, 5 );
}
else if( flRand <= 0.95 )
else if( flRand <= 0.95f )
{
iAnim = SHOTGUN_IDLE;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 20.0 / 9.0 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 20.0f / 9.0f );
}
else
{
iAnim = SHOTGUN_IDLE4;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 20.0 / 9.0 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 20.0f / 9.0f );
}
SendWeaponAnim( iAnim );
}

View File

@ -186,8 +186,8 @@ void CAmbientGeneric::Spawn( void )
if( FStringNull( pev->message ) || szSoundFile[0] == '\0' )
{
ALERT( at_error, "EMPTY AMBIENT AT: %f, %f, %f\n", pev->origin.x, pev->origin.y, pev->origin.z );
pev->nextthink = gpGlobals->time + 0.1;
ALERT( at_error, "EMPTY AMBIENT AT: %f, %f, %f\n", (double)pev->origin.x, (double)pev->origin.y, (double)pev->origin.z );
pev->nextthink = gpGlobals->time + 0.1f;
SetThink( &CBaseEntity::SUB_Remove );
return;
}
@ -199,7 +199,7 @@ void CAmbientGeneric::Spawn( void )
// start thinking yet.
SetThink( &CAmbientGeneric::RampThink );
pev->nextthink = 0;
pev->nextthink = 0.0f;
// allow on/off switching via 'use' function.
@ -236,9 +236,9 @@ void CAmbientGeneric::Precache( void )
if( m_fActive )
{
UTIL_EmitAmbientSound( ENT( pev ), pev->origin, szSoundFile,
( m_dpv.vol * 0.01 ), m_flAttenuation, SND_SPAWNING, m_dpv.pitch );
( m_dpv.vol * 0.01f ), m_flAttenuation, SND_SPAWNING, m_dpv.pitch );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
}
@ -433,11 +433,11 @@ void CAmbientGeneric::RampThink( void )
pitch = PITCH_NORM + 1; // don't send 'no pitch' !
UTIL_EmitAmbientSound( ENT( pev ), pev->origin, szSoundFile,
( vol * 0.01 ), m_flAttenuation, flags, pitch );
( vol * 0.01f ), m_flAttenuation, flags, pitch );
}
// update ramps at 5hz
pev->nextthink = gpGlobals->time + 0.2;
pev->nextthink = gpGlobals->time + 0.2f;
return;
}
@ -548,12 +548,12 @@ void CAmbientGeneric::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
fraction = value;
if( fraction > 1.0 )
fraction = 1.0;
if( fraction < 0.0 )
fraction = 0.01;
if( fraction > 1.0f )
fraction = 1.0f;
if( fraction < 0.0f )
fraction = 0.01f;
m_dpv.pitch = (int)( fraction * 255 );
m_dpv.pitch = (int)( fraction * 255.0f );
UTIL_EmitAmbientSound( ENT( pev ), pev->origin, szSoundFile, 0, 0, SND_CHANGE_PITCH, m_dpv.pitch );
return;
@ -584,7 +584,7 @@ void CAmbientGeneric::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
if( m_dpv.pitchrun > 255 )
m_dpv.pitchrun = 255;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
}
else
@ -602,7 +602,7 @@ void CAmbientGeneric::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
m_dpv.fadeout = m_dpv.fadeoutsav;
m_dpv.fadein = 0;
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
else
UTIL_EmitAmbientSound( ENT( pev ), pev->origin, szSoundFile, 0, 0, SND_STOP, 0 );
@ -625,9 +625,9 @@ void CAmbientGeneric::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
// init all ramp params for startup
InitModulationParms();
UTIL_EmitAmbientSound( ENT( pev ), pev->origin, szSoundFile, ( m_dpv.vol * 0.01 ), m_flAttenuation, 0, m_dpv.pitch );
UTIL_EmitAmbientSound( ENT( pev ), pev->origin, szSoundFile, ( m_dpv.vol * 0.01f ), m_flAttenuation, 0, m_dpv.pitch );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
}
@ -962,10 +962,10 @@ void CEnvSound::Think( void )
// not in range. do nothing, fall through to think_fast...
env_sound_Think_fast:
pev->nextthink = gpGlobals->time + 0.25;
pev->nextthink = gpGlobals->time + 0.25f;
return;
env_sound_Think_slow:
pev->nextthink = gpGlobals->time + 0.75;
pev->nextthink = gpGlobals->time + 0.75f;
return;
}
@ -977,7 +977,7 @@ env_sound_Think_slow:
void CEnvSound::Spawn()
{
// spread think times
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.0, 0.5 );
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.0f, 0.5f );
}
// ==================== SENTENCE GROUPS, UTILITY FUNCTIONS ======================================
@ -1400,7 +1400,7 @@ void EMIT_SOUND_SUIT( edict_t *entity, const char *sample )
if( RANDOM_LONG( 0, 1 ) )
pitch = RANDOM_LONG( 0, 6 ) + 98;
if( fvol > 0.05 )
if( fvol > 0.05f )
EMIT_SOUND_DYN( entity, CHAN_STATIC, sample, fvol, ATTN_NORM, 0, pitch );
}
@ -1415,7 +1415,7 @@ void EMIT_GROUPID_SUIT( edict_t *entity, int isentenceg )
if( RANDOM_LONG( 0, 1 ) )
pitch = RANDOM_LONG( 0, 6 ) + 98;
if( fvol > 0.05 )
if( fvol > 0.05f )
SENTENCEG_PlayRndI( entity, isentenceg, fvol, ATTN_NORM, 0, pitch );
}
@ -1430,7 +1430,7 @@ void EMIT_GROUPNAME_SUIT( edict_t *entity, const char *groupname )
if( RANDOM_LONG( 0, 1 ) )
pitch = RANDOM_LONG( 0, 6 ) + 98;
if( fvol > 0.05 )
if( fvol > 0.05f )
SENTENCEG_PlayRndSz( entity, groupname, fvol, ATTN_NORM, 0, pitch );
}
@ -1523,7 +1523,7 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in
float fattn = ATTN_NORM;
if( !g_pGameRules->PlayTextureSounds() )
return 0.0;
return 0.0f;
CBaseEntity *pEntity = CBaseEntity::Instance( ptr->pHit );
@ -1572,44 +1572,44 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in
{
default:
case CHAR_TEX_CONCRETE:
fvol = 0.9;
fvolbar = 0.6;
fvol = 0.9f;
fvolbar = 0.6f;
rgsz[0] = "player/pl_step1.wav";
rgsz[1] = "player/pl_step2.wav";
cnt = 2;
break;
case CHAR_TEX_METAL:
fvol = 0.9;
fvolbar = 0.3;
fvol = 0.9f;
fvolbar = 0.3f;
rgsz[0] = "player/pl_metal1.wav";
rgsz[1] = "player/pl_metal2.wav";
cnt = 2;
break;
case CHAR_TEX_DIRT:
fvol = 0.9;
fvolbar = 0.1;
fvol = 0.9f;
fvolbar = 0.1f;
rgsz[0] = "player/pl_dirt1.wav";
rgsz[1] = "player/pl_dirt2.wav";
rgsz[2] = "player/pl_dirt3.wav";
cnt = 3;
break;
case CHAR_TEX_VENT:
fvol = 0.5;
fvolbar = 0.3;
fvol = 0.5f;
fvolbar = 0.3f;
rgsz[0] = "player/pl_duct1.wav";
rgsz[1] = "player/pl_duct1.wav";
cnt = 2;
break;
case CHAR_TEX_GRATE:
fvol = 0.9;
fvolbar = 0.5;
fvol = 0.9f;
fvolbar = 0.5f;
rgsz[0] = "player/pl_grate1.wav";
rgsz[1] = "player/pl_grate4.wav";
cnt = 2;
break;
case CHAR_TEX_TILE:
fvol = 0.8;
fvolbar = 0.2;
fvol = 0.8f;
fvolbar = 0.2f;
rgsz[0] = "player/pl_tile1.wav";
rgsz[1] = "player/pl_tile3.wav";
rgsz[2] = "player/pl_tile2.wav";
@ -1617,8 +1617,8 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in
cnt = 4;
break;
case CHAR_TEX_SLOSH:
fvol = 0.9;
fvolbar = 0.0;
fvol = 0.9f;
fvolbar = 0.0f;
rgsz[0] = "player/pl_slosh1.wav";
rgsz[1] = "player/pl_slosh3.wav";
rgsz[2] = "player/pl_slosh2.wav";
@ -1626,8 +1626,8 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in
cnt = 4;
break;
case CHAR_TEX_WOOD:
fvol = 0.9;
fvolbar = 0.2;
fvol = 0.9f;
fvolbar = 0.2f;
rgsz[0] = "debris/wood1.wav";
rgsz[1] = "debris/wood2.wav";
rgsz[2] = "debris/wood3.wav";
@ -1635,8 +1635,8 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in
break;
case CHAR_TEX_GLASS:
case CHAR_TEX_COMPUTER:
fvol = 0.8;
fvolbar = 0.2;
fvol = 0.8f;
fvolbar = 0.2f;
rgsz[0] = "debris/glass1.wav";
rgsz[1] = "debris/glass2.wav";
rgsz[2] = "debris/glass3.wav";
@ -1644,12 +1644,12 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in
break;
case CHAR_TEX_FLESH:
if( iBulletType == BULLET_PLAYER_CROWBAR )
return 0.0; // crowbar already makes this sound
fvol = 1.0;
fvolbar = 0.2;
return 0.0f; // crowbar already makes this sound
fvol = 1.0f;
fvolbar = 0.2f;
rgsz[0] = "weapons/bullet_hit1.wav";
rgsz[1] = "weapons/bullet_hit2.wav";
fattn = 1.0;
fattn = 1.0f;
cnt = 2;
break;
}
@ -1658,17 +1658,17 @@ float TEXTURETYPE_PlaySound( TraceResult *ptr, Vector vecSrc, Vector vecEnd, in
if( pEntity && FClassnameIs( pEntity->pev, "func_breakable" ) )
{
// drop volumes, the object will already play a damaged sound
fvol /= 1.5;
fvolbar /= 2.0;
fvol /= 1.5f;
fvolbar /= 2.0f;
}
else if( chTextureType == CHAR_TEX_COMPUTER )
{
// play random spark if computer
if( ptr->flFraction != 1.0 && RANDOM_LONG( 0, 1 ) )
if( ptr->flFraction != 1.0f && RANDOM_LONG( 0, 1 ) )
{
UTIL_Sparks( ptr->vecEndPos );
float flVolume = RANDOM_FLOAT( 0.7, 1.0 );//random volume range
float flVolume = RANDOM_FLOAT( 0.7f, 1.0f );//random volume range
switch( RANDOM_LONG( 0, 1 ) )
{
case 0:
@ -1734,8 +1734,8 @@ void CSpeaker::Spawn( void )
if( !m_preset && ( FStringNull( pev->message ) || szSoundFile[0] == '\0' ) )
{
ALERT( at_error, "SPEAKER with no Level/Sentence! at: %f, %f, %f\n", pev->origin.x, pev->origin.y, pev->origin.z );
pev->nextthink = gpGlobals->time + 0.1;
ALERT( at_error, "SPEAKER with no Level/Sentence! at: %f, %f, %f\n", (double)pev->origin.x, (double)pev->origin.y, (double)pev->origin.z );
pev->nextthink = gpGlobals->time + 0.1f;
SetThink( &CBaseEntity::SUB_Remove );
return;
}
@ -1743,7 +1743,7 @@ void CSpeaker::Spawn( void )
pev->movetype = MOVETYPE_NONE;
SetThink( &CSpeaker::SpeakerThink );
pev->nextthink = 0.0;
pev->nextthink = 0.0f;
// allow on/off switching via 'use' function.
SetUse( &CSpeaker::ToggleUse );
@ -1751,27 +1751,27 @@ void CSpeaker::Spawn( void )
Precache();
}
#define ANNOUNCE_MINUTES_MIN 0.25
#define ANNOUNCE_MINUTES_MAX 2.25
#define ANNOUNCE_MINUTES_MIN 0.25f
#define ANNOUNCE_MINUTES_MAX 2.25f
void CSpeaker::Precache( void )
{
if( !FBitSet( pev->spawnflags, SPEAKER_START_SILENT ) )
// set first announcement time for random n second
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 5.0, 15.0 );
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 5.0f, 15.0f );
}
void CSpeaker::SpeakerThink( void )
{
const char* szSoundFile = NULL;
float flvolume = pev->health * 0.1;
float flattenuation = 0.3;
float flvolume = pev->health * 0.1f;
float flattenuation = 0.3f;
int flags = 0;
int pitch = 100;
// Wait for the talkmonster to finish first.
if( gpGlobals->time <= CTalkMonster::g_talkWaitTime )
{
pev->nextthink = CTalkMonster::g_talkWaitTime + RANDOM_FLOAT( 5, 10 );
pev->nextthink = CTalkMonster::g_talkWaitTime + RANDOM_FLOAT( 5.0f, 10.0f );
return;
}
@ -1828,7 +1828,7 @@ void CSpeaker::SpeakerThink( void )
flvolume, flattenuation, flags, pitch );
// shut off and reset
pev->nextthink = 0.0;
pev->nextthink = 0.0f;
}
else
{
@ -1837,9 +1837,9 @@ void CSpeaker::SpeakerThink( void )
ALERT( at_console, "Level Design Error!\nSPEAKER has bad sentence group name: %s\n",szSoundFile );
// set next announcement time for random 5 to 10 minute delay
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( ANNOUNCE_MINUTES_MIN * 60.0, ANNOUNCE_MINUTES_MAX * 60.0 );
pev->nextthink = gpGlobals->time + RANDOM_FLOAT( ANNOUNCE_MINUTES_MIN * 60.0f, ANNOUNCE_MINUTES_MAX * 60.0f );
CTalkMonster::g_talkWaitTime = gpGlobals->time + 5; // time delay until it's ok to speak: used so that two NPCs don't talk at once
CTalkMonster::g_talkWaitTime = gpGlobals->time + 5.0f; // time delay until it's ok to speak: used so that two NPCs don't talk at once
}
return;
@ -1850,7 +1850,7 @@ void CSpeaker::SpeakerThink( void )
//
void CSpeaker::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
int fActive = ( pev->nextthink > 0.0 );
int fActive = ( pev->nextthink > 0.0f );
// fActive is TRUE only if an announcement is pending
@ -1865,14 +1865,14 @@ void CSpeaker::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
if( useType == USE_ON )
{
// turn on announcements
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
return;
}
if( useType == USE_OFF )
{
// turn off announcements
pev->nextthink = 0.0;
pev->nextthink = 0.0f;
return;
}
@ -1880,12 +1880,12 @@ void CSpeaker::ToggleUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
if( fActive )
{
// turn off announcements
pev->nextthink = 0.0;
pev->nextthink = 0.0f;
}
else
{
// turn on announcements
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
}
}

View File

@ -82,7 +82,7 @@ void CSoundEnt::Spawn( void )
pev->solid = SOLID_NOT;
Initialize();
pev->nextthink = gpGlobals->time + 1;
pev->nextthink = gpGlobals->time + 1.0f;
}
//=========================================================
@ -95,7 +95,7 @@ void CSoundEnt::Think( void )
int iSound;
int iPreviousSound;
pev->nextthink = gpGlobals->time + 0.3;// how often to check the sound list.
pev->nextthink = gpGlobals->time + 0.3f;// how often to check the sound list.
iPreviousSound = SOUNDLIST_EMPTY;
iSound = m_iActiveSound;

View File

@ -355,7 +355,7 @@ int CSquadMonster::SquadRecruit( int searchRadius, int maxMembers )
{
TraceResult tr;
UTIL_TraceLine( pev->origin + pev->view_ofs, pRecruit->pev->origin + pev->view_ofs, ignore_monsters, pRecruit->edict(), &tr );// try to hit recruit with a traceline.
if( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0f )
{
if( !SquadAdd( pRecruit ) )
break;
@ -457,6 +457,7 @@ BOOL CSquadMonster::NoFriendlyFire( void )
Vector vecLeftSide;
Vector vecRightSide;
Vector v_left;
Vector v_dir;
//!!!BUGBUG - to fix this, the planes must be aligned to where the monster will be firing its gun, not the direction it is facing!!!
if( m_hEnemy != 0 )
@ -471,9 +472,13 @@ BOOL CSquadMonster::NoFriendlyFire( void )
//UTIL_MakeVectors( pev->angles );
vecLeftSide = pev->origin - ( gpGlobals->v_right * ( pev->size.x * 1.5 ) );
vecRightSide = pev->origin + ( gpGlobals->v_right * ( pev->size.x * 1.5 ) );
v_left = gpGlobals->v_right * -1;
// vecLeftSide = pev->origin - ( gpGlobals->v_right * ( pev->size.x * 1.5f ) );
// vecRightSide = pev->origin + ( gpGlobals->v_right * ( pev->size.x * 1.5f ) );
v_dir = gpGlobals->v_right * ( pev->size.x * 1.5f );
vecLeftSide = pev->origin - v_dir;
vecRightSide = pev->origin + v_dir;
v_left = gpGlobals->v_right * -1.0f;
leftPlane.InitializePlane( gpGlobals->v_right, vecLeftSide );
rightPlane.InitializePlane( v_left, vecRightSide );

View File

@ -87,7 +87,7 @@ TYPEDESCRIPTION CSqueakGrenade::m_SaveData[] =
IMPLEMENT_SAVERESTORE( CSqueakGrenade, CGrenade )
#define SQUEEK_DETONATE_DELAY 15.0
#define SQUEEK_DETONATE_DELAY 15.0f
int CSqueakGrenade::Classify( void )
{
@ -120,25 +120,25 @@ void CSqueakGrenade::Spawn( void )
pev->solid = SOLID_BBOX;
SET_MODEL( ENT( pev ), "models/w_squeak.mdl" );
UTIL_SetSize( pev, Vector( -4, -4, 0 ), Vector( 4, 4, 8 ) );
UTIL_SetSize( pev, Vector( -4.0f, -4.0f, 0.0f ), Vector( 4.0f, 4.0f, 8.0f ) );
UTIL_SetOrigin( pev, pev->origin );
SetTouch( &CSqueakGrenade::SuperBounceTouch );
SetThink( &CSqueakGrenade::HuntThink );
pev->nextthink = gpGlobals->time + 0.1;
m_flNextHunt = gpGlobals->time + 1E6;
pev->nextthink = gpGlobals->time + 0.1f;
m_flNextHunt = gpGlobals->time + (float)1E6;
pev->flags |= FL_MONSTER;
pev->takedamage = DAMAGE_AIM;
pev->health = gSkillData.snarkHealth;
pev->gravity = 0.5;
pev->friction = 0.5;
pev->gravity = 0.5f;
pev->friction = 0.5f;
pev->dmg = gSkillData.snarkDmgPop;
m_flDie = gpGlobals->time + SQUEEK_DETONATE_DELAY;
m_flFieldOfView = 0; // 180 degrees
m_flFieldOfView = 0.0f; // 180 degrees
if( pev->owner )
m_hOwner = Instance( pev->owner );
@ -166,7 +166,7 @@ void CSqueakGrenade::Killed( entvars_t *pevAttacker, int iGib )
pev->model = iStringNull;// make invisible
SetThink( &CBaseEntity::SUB_Remove );
SetTouch( NULL );
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
// since squeak grenades never leave a body behind, clear out their takedamage now.
// Squeaks do a bit of radius damage when they pop, and that radius damage will
@ -174,9 +174,9 @@ void CSqueakGrenade::Killed( entvars_t *pevAttacker, int iGib )
pev->takedamage = DAMAGE_NO;
// play squeek blast
EMIT_SOUND_DYN( ENT( pev ), CHAN_ITEM, "squeek/sqk_blast1.wav", 1, 0.5, 0, PITCH_NORM );
EMIT_SOUND_DYN( ENT( pev ), CHAN_ITEM, "squeek/sqk_blast1.wav", 1, 0.5f, 0, PITCH_NORM );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, SMALL_EXPLOSION_VOLUME, 3.0 );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, SMALL_EXPLOSION_VOLUME, 3.0f );
UTIL_BloodDrips( pev->origin, g_vecZero, BloodColor(), 80 );
@ -194,7 +194,7 @@ void CSqueakGrenade::Killed( entvars_t *pevAttacker, int iGib )
void CSqueakGrenade::GibMonster( void )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "common/bodysplat.wav", 0.75, ATTN_NORM, 0, 200 );
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "common/bodysplat.wav", 0.75f, ATTN_NORM, 0, 200 );
}
void CSqueakGrenade::HuntThink( void )
@ -209,7 +209,7 @@ void CSqueakGrenade::HuntThink( void )
}
StudioFrameAdvance();
pev->nextthink = gpGlobals->time + 0.1;
pev->nextthink = gpGlobals->time + 0.1f;
// explode when ready
if( gpGlobals->time >= m_flDie )
@ -227,8 +227,8 @@ void CSqueakGrenade::HuntThink( void )
{
pev->movetype = MOVETYPE_FLY;
}
pev->velocity = pev->velocity * 0.9;
pev->velocity.z += 8.0;
pev->velocity = pev->velocity * 0.9f;
pev->velocity.z += 8.0f;
}
else if( pev->movetype == MOVETYPE_FLY )
{
@ -239,7 +239,7 @@ void CSqueakGrenade::HuntThink( void )
if( m_flNextHunt > gpGlobals->time )
return;
m_flNextHunt = gpGlobals->time + 2.0;
m_flNextHunt = gpGlobals->time + 2.0f;
//CBaseEntity *pOther = NULL;
Vector vecDir;
@ -259,16 +259,16 @@ void CSqueakGrenade::HuntThink( void )
}
// squeek if it's about time blow up
if( ( m_flDie - gpGlobals->time <= 0.5 ) && ( m_flDie - gpGlobals->time >= 0.3 ) )
if( ( m_flDie - gpGlobals->time <= 0.5f ) && ( m_flDie - gpGlobals->time >= 0.3f ) )
{
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "squeek/sqk_die1.wav", 1, ATTN_NORM, 0, 100 + RANDOM_LONG( 0, 0x3F ) );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, 256, 0.25 );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, 256, 0.25f );
}
// higher pitch as squeeker gets closer to detonation time
float flpitch = 155.0 - 60.0 * ( ( m_flDie - gpGlobals->time ) / SQUEEK_DETONATE_DELAY );
if( flpitch < 80 )
flpitch = 80;
float flpitch = 155.0f - 60.0f * ( ( m_flDie - gpGlobals->time ) / SQUEEK_DETONATE_DELAY );
if( flpitch < 80.0f )
flpitch = 80.0f;
if( m_hEnemy != 0 )
{
@ -279,16 +279,16 @@ void CSqueakGrenade::HuntThink( void )
}
float flVel = pev->velocity.Length();
float flAdj = 50.0 / ( flVel + 10.0 );
float flAdj = 50.0f / ( flVel + 10.0f );
if( flAdj > 1.2 )
flAdj = 1.2;
if( flAdj > 1.2f )
flAdj = 1.2f;
// ALERT( at_console, "think : enemy\n");
// ALERT( at_console, "%.0f %.2f %.2f %.2f\n", flVel, m_vecTarget.x, m_vecTarget.y, m_vecTarget.z );
pev->velocity = pev->velocity * flAdj + m_vecTarget * 300;
pev->velocity = pev->velocity * flAdj + m_vecTarget * 300.0f;
}
if( pev->flags & FL_ONGROUND )
@ -304,7 +304,7 @@ void CSqueakGrenade::HuntThink( void )
}
}
if( ( pev->origin - m_posPrev ).Length() < 1.0 )
if( ( pev->origin - m_posPrev ).Length() < 1.0f )
{
pev->velocity.x = RANDOM_FLOAT( -100, 100 );
pev->velocity.y = RANDOM_FLOAT( -100, 100 );
@ -329,15 +329,15 @@ void CSqueakGrenade::SuperBounceTouch( CBaseEntity *pOther )
// at least until we've bounced once
pev->owner = NULL;
pev->angles.x = 0;
pev->angles.z = 0;
pev->angles.x = 0.0f;
pev->angles.z = 0.0f;
// avoid bouncing too much
if( m_flNextHit > gpGlobals->time )
return;
// higher pitch as squeeker gets closer to detonation time
flpitch = 155.0 - 60.0 * ( ( m_flDie - gpGlobals->time ) / SQUEEK_DETONATE_DELAY );
flpitch = 155.0f - 60.0f * ( ( m_flDie - gpGlobals->time ) / SQUEEK_DETONATE_DELAY );
if( pOther->pev->takedamage && m_flNextAttack < gpGlobals->time )
{
@ -358,11 +358,11 @@ void CSqueakGrenade::SuperBounceTouch( CBaseEntity *pOther )
ApplyMultiDamage( pev, pev );
pev->dmg += gSkillData.snarkDmgPop; // add more explosion damage
// m_flDie += 2.0; // add more life
// m_flDie += 2.0f; // add more life
// make bite sound
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "squeek/sqk_deploy1.wav", 1.0, ATTN_NORM, 0, (int)flpitch );
m_flNextAttack = gpGlobals->time + 0.5;
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "squeek/sqk_deploy1.wav", 1.0f, ATTN_NORM, 0, (int)flpitch );
m_flNextAttack = gpGlobals->time + 0.5f;
}
}
else
@ -371,7 +371,7 @@ void CSqueakGrenade::SuperBounceTouch( CBaseEntity *pOther )
}
}
m_flNextHit = gpGlobals->time + 0.1;
m_flNextHit = gpGlobals->time + 0.1f;
m_flNextHunt = gpGlobals->time;
if( g_pGameRules->IsMultiplayer() )
@ -387,23 +387,23 @@ void CSqueakGrenade::SuperBounceTouch( CBaseEntity *pOther )
if( !( pev->flags & FL_ONGROUND ) )
{
// play bounce sound
float flRndSound = RANDOM_FLOAT( 0, 1 );
float flRndSound = RANDOM_FLOAT( 0.0f, 1.0f );
if( flRndSound <= 0.33 )
if( flRndSound <= 0.33f )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "squeek/sqk_hunt1.wav", 1, ATTN_NORM, 0, (int)flpitch );
else if( flRndSound <= 0.66 )
else if( flRndSound <= 0.66f )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "squeek/sqk_hunt2.wav", 1, ATTN_NORM, 0, (int)flpitch );
else
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "squeek/sqk_hunt3.wav", 1, ATTN_NORM, 0, (int)flpitch );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, 256, 0.25 );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, 256, 0.25f );
}
else
{
// skittering sound
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, 100, 0.1 );
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, 100, 0.1f );
}
m_flNextBounceSoundTime = gpGlobals->time + 0.5;// half second.
m_flNextBounceSoundTime = gpGlobals->time + 0.5f;// half second.
}
#endif
@ -421,7 +421,7 @@ void CSqueak::Spawn()
pev->sequence = 1;
pev->animtime = gpGlobals->time;
pev->framerate = 1.0;
pev->framerate = 1.0f;
}
void CSqueak::Precache( void )
@ -456,9 +456,9 @@ int CSqueak::GetItemInfo( ItemInfo *p )
BOOL CSqueak::Deploy()
{
// play hunt sound
float flRndSound = RANDOM_FLOAT( 0, 1 );
float flRndSound = RANDOM_FLOAT( 0.0f, 1.0f );
if( flRndSound <= 0.5 )
if( flRndSound <= 0.5f )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "squeek/sqk_hunt2.wav", 1, ATTN_NORM, 0, 100 );
else
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "squeek/sqk_hunt3.wav", 1, ATTN_NORM, 0, 100 );
@ -470,7 +470,7 @@ BOOL CSqueak::Deploy()
void CSqueak::Holster( int skiplocal /* = 0 */ )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
if( !m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
{
@ -480,7 +480,7 @@ void CSqueak::Holster( int skiplocal /* = 0 */ )
}
SendWeaponAnim( SQUEAK_DOWN );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0, ATTN_NORM );
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "common/null.wav", 1.0f, ATTN_NORM );
}
void CSqueak::PrimaryAttack()
@ -500,7 +500,7 @@ void CSqueak::PrimaryAttack()
}
// find place to toss monster
UTIL_TraceLine( trace_origin + gpGlobals->v_forward * 20, trace_origin + gpGlobals->v_forward * 64, dont_ignore_monsters, NULL, &tr );
UTIL_TraceLine( trace_origin + gpGlobals->v_forward * 20.0f, trace_origin + gpGlobals->v_forward * 64.0f, dont_ignore_monsters, NULL, &tr );
int flags;
#ifdef CLIENT_WEAPONS
@ -508,20 +508,20 @@ void CSqueak::PrimaryAttack()
#else
flags = 0;
#endif
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSnarkFire, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, 0, 0, 0, 0 );
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSnarkFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, 0, 0, 0 );
if( tr.fAllSolid == 0 && tr.fStartSolid == 0 && tr.flFraction > 0.25 )
if( tr.fAllSolid == 0 && tr.fStartSolid == 0 && tr.flFraction > 0.25f )
{
// player "shoot" animation
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
#ifndef CLIENT_DLL
CBaseEntity *pSqueak = CBaseEntity::Create( "monster_snark", tr.vecEndPos, m_pPlayer->pev->v_angle, m_pPlayer->edict() );
pSqueak->pev->velocity = gpGlobals->v_forward * 200 + m_pPlayer->pev->velocity;
pSqueak->pev->velocity = gpGlobals->v_forward * 200.0f + m_pPlayer->pev->velocity;
#endif
// play hunt sound
float flRndSound = RANDOM_FLOAT( 0, 1 );
float flRndSound = RANDOM_FLOAT( 0.0f, 1.0f );
if( flRndSound <= 0.5 )
if( flRndSound <= 0.5f )
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "squeek/sqk_hunt2.wav", 1, ATTN_NORM, 0, 105 );
else
EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "squeek/sqk_hunt3.wav", 1, ATTN_NORM, 0, 105 );
@ -532,8 +532,8 @@ void CSqueak::PrimaryAttack()
m_fJustThrown = 1;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.3 );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
m_flNextPrimaryAttack = GetNextAttackDelay( 0.3f );
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
}
}
}
@ -565,20 +565,20 @@ void CSqueak::WeaponIdle( void )
int iAnim;
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
if( flRand <= 0.75 )
if( flRand <= 0.75f )
{
iAnim = SQUEAK_IDLE1;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 30.0 / 16 * (2);
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 30.0f / 16.0f * 2.0f;
}
else if( flRand <= 0.875 )
else if( flRand <= 0.875f )
{
iAnim = SQUEAK_FIDGETFIT;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0 / 16.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 70.0f / 16.0f;
}
else
{
iAnim = SQUEAK_FIDGETNIP;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0 / 16.0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 80.0f / 16.0f;
}
SendWeaponAnim( iAnim );
}

View File

@ -230,7 +230,7 @@ void CBaseDelay::SUB_UseTargets( CBaseEntity *pActivator, USE_TYPE useType, floa
// Save the useType
pTemp->pev->button = (int)useType;
pTemp->m_iszKillTarget = m_iszKillTarget;
pTemp->m_flDelay = 0; // prevent "recursion"
pTemp->m_flDelay = 0.0f; // prevent "recursion"
pTemp->pev->target = pev->target;
// HACKHACK
@ -400,7 +400,7 @@ void CBaseToggle::LinearMove( Vector vecDest, float flSpeed )
// divide vector length by speed to get time to reach dest
float flTravelTime = vecDestDelta.Length() / flSpeed;
if( flTravelTime < 0.05 )
if( flTravelTime < 0.05f )
{
UTIL_SetOrigin( pev, m_vecFinalDest );
LinearMoveDone();
@ -424,7 +424,7 @@ void CBaseToggle::LinearMoveDone( void )
{
Vector delta = m_vecFinalDest - pev->origin;
float error = delta.Length();
if( error > 0.03125 )
if( error > 0.03125f )
{
LinearMove( m_vecFinalDest, 100 );
return;

View File

@ -64,13 +64,13 @@ const char *CTalkMonster::m_szFriends[TLK_CFRIENDS] =
Task_t tlIdleResponse[] =
{
{ TASK_SET_ACTIVITY, (float)ACT_IDLE }, // Stop and listen
{ TASK_WAIT, (float)0.5 }, // Wait until sure it's me they are talking to
{ TASK_TLK_EYECONTACT, (float)0 }, // Wait until speaker is done
{ TASK_TLK_RESPOND, (float)0 }, // Wait and then say my response
{ TASK_TLK_IDEALYAW, (float)0 }, // look at who I'm talking to
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_WAIT, 0.5f }, // Wait until sure it's me they are talking to
{ TASK_TLK_EYECONTACT, 0.0f }, // Wait until speaker is done
{ TASK_TLK_RESPOND, 0.0f }, // Wait and then say my response
{ TASK_TLK_IDEALYAW, 0.0f }, // look at who I'm talking to
{ TASK_FACE_IDEAL, 0.0f },
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },
{ TASK_TLK_EYECONTACT, (float)0 }, // Wait until speaker is done
{ TASK_TLK_EYECONTACT, 0.0f }, // Wait until speaker is done
};
Schedule_t slIdleResponse[] =
@ -88,12 +88,12 @@ Schedule_t slIdleResponse[] =
Task_t tlIdleSpeak[] =
{
{ TASK_TLK_SPEAK, (float)0 },// question or remark
{ TASK_TLK_IDEALYAW, (float)0 },// look at who I'm talking to
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_TLK_SPEAK, 0.0f },// question or remark
{ TASK_TLK_IDEALYAW, 0.0f },// look at who I'm talking to
{ TASK_FACE_IDEAL, 0.0f },
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },
{ TASK_TLK_EYECONTACT, (float)0 },
{ TASK_WAIT_RANDOM, (float)0.5 },
{ TASK_TLK_EYECONTACT, 0.0f },
{ TASK_WAIT_RANDOM, 0.5f },
};
Schedule_t slIdleSpeak[] =
@ -113,9 +113,9 @@ Schedule_t slIdleSpeak[] =
Task_t tlIdleSpeakWait[] =
{
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },// Stop and talk
{ TASK_TLK_SPEAK, (float)0 },// question or remark
{ TASK_TLK_EYECONTACT, (float)0 },//
{ TASK_WAIT, (float)2 },// wait - used when sci is in 'use' mode to keep head turned
{ TASK_TLK_SPEAK, 0.0f },// question or remark
{ TASK_TLK_EYECONTACT, 0.0f },//
{ TASK_WAIT, 2.0f },// wait - used when sci is in 'use' mode to keep head turned
};
Schedule_t slIdleSpeakWait[] =
@ -135,18 +135,18 @@ Schedule_t slIdleSpeakWait[] =
Task_t tlIdleHello[] =
{
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },// Stop and talk
{ TASK_TLK_HELLO, (float)0 },// Try to say hello to player
{ TASK_TLK_EYECONTACT, (float)0 },
{ TASK_WAIT, (float)0.5 },// wait a bit
{ TASK_TLK_HELLO, (float)0 },// Try to say hello to player
{ TASK_TLK_EYECONTACT, (float)0 },
{ TASK_WAIT, (float)0.5 },// wait a bit
{ TASK_TLK_HELLO, (float)0 },// Try to say hello to player
{ TASK_TLK_EYECONTACT, (float)0 },
{ TASK_WAIT, (float)0.5 },// wait a bit
{ TASK_TLK_HELLO, (float)0 },// Try to say hello to player
{ TASK_TLK_EYECONTACT, (float)0 },
{ TASK_WAIT, (float)0.5 },// wait a bit
{ TASK_TLK_HELLO, 0.0f },// Try to say hello to player
{ TASK_TLK_EYECONTACT, 0.0f },
{ TASK_WAIT, 0.5f },// wait a bit
{ TASK_TLK_HELLO, 0.0f },// Try to say hello to player
{ TASK_TLK_EYECONTACT, 0.0f },
{ TASK_WAIT, 0.5f },// wait a bit
{ TASK_TLK_HELLO, 0.0f },// Try to say hello to player
{ TASK_TLK_EYECONTACT, 0.0f },
{ TASK_WAIT, 0.5f },// wait a bit
{ TASK_TLK_HELLO, 0.0f },// Try to say hello to player
{ TASK_TLK_EYECONTACT, 0.0f },
{ TASK_WAIT, 0.5f },// wait a bit
};
Schedule_t slIdleHello[] =
@ -167,8 +167,8 @@ Schedule_t slIdleHello[] =
Task_t tlIdleStopShooting[] =
{
{ TASK_TLK_STOPSHOOTING, (float)0 },// tell player to stop shooting friend
// { TASK_TLK_EYECONTACT, (float)0 },// look at the player
{ TASK_TLK_STOPSHOOTING, 0.0f },// tell player to stop shooting friend
// { TASK_TLK_EYECONTACT, 0.0f },// look at the player
};
Schedule_t slIdleStopShooting[] =
@ -188,11 +188,11 @@ Schedule_t slIdleStopShooting[] =
Task_t tlMoveAway[] =
{
{ TASK_SET_FAIL_SCHEDULE, (float)SCHED_MOVE_AWAY_FAIL },
{ TASK_STORE_LASTPOSITION, (float)0 },
{ TASK_MOVE_AWAY_PATH, (float)100 },
{ TASK_WALK_PATH_FOR_UNITS, (float)100 },
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FACE_PLAYER, (float)0.5 },
{ TASK_STORE_LASTPOSITION, 0.0f },
{ TASK_MOVE_AWAY_PATH, 100.0f },
{ TASK_WALK_PATH_FOR_UNITS, 100.0f },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_FACE_PLAYER, 0.5f },
};
Schedule_t slMoveAway[] =
@ -208,8 +208,8 @@ Schedule_t slMoveAway[] =
Task_t tlMoveAwayFail[] =
{
{ TASK_STOP_MOVING, (float)0 },
{ TASK_FACE_PLAYER, (float)0.5 },
{ TASK_STOP_MOVING, 0.0f },
{ TASK_FACE_PLAYER, 0.5f },
};
Schedule_t slMoveAwayFail[] =
@ -248,19 +248,19 @@ Task_t tlTlkIdleWatchClient[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_TLK_LOOK_AT_CLIENT, (float)6 },
{ TASK_TLK_LOOK_AT_CLIENT, 6.0f },
};
Task_t tlTlkIdleWatchClientStare[] =
{
{ TASK_STOP_MOVING, 0 },
{ TASK_SET_ACTIVITY, (float)ACT_IDLE },
{ TASK_TLK_CLIENT_STARE, (float)6 },
{ TASK_TLK_STARE, (float)0 },
{ TASK_TLK_IDEALYAW, (float)0 },// look at who I'm talking to
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_TLK_CLIENT_STARE, 6.0f },
{ TASK_TLK_STARE, 0.0f },
{ TASK_TLK_IDEALYAW, 0.0f },// look at who I'm talking to
{ TASK_FACE_IDEAL, 0.0f },
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },
{ TASK_TLK_EYECONTACT, (float)0 },
{ TASK_TLK_EYECONTACT, 0.0f },
};
Schedule_t slTlkIdleWatchClient[] =
@ -310,10 +310,10 @@ Schedule_t slTlkIdleWatchClient[] =
Task_t tlTlkIdleEyecontact[] =
{
{ TASK_TLK_IDEALYAW, (float)0 },// look at who I'm talking to
{ TASK_FACE_IDEAL, (float)0 },
{ TASK_TLK_IDEALYAW, 0.0f },// look at who I'm talking to
{ TASK_FACE_IDEAL, 0.0f },
{ TASK_SET_ACTIVITY, (float)ACT_SIGNAL3 },
{ TASK_TLK_EYECONTACT, (float)0 },// Wait until speaker is done
{ TASK_TLK_EYECONTACT, 0.0f },// Wait until speaker is done
};
Schedule_t slTlkIdleEyecontact[] =
@ -445,7 +445,7 @@ void CTalkMonster::StartTask( Task_t *pTask )
else if( FindCover( pev->origin, pev->view_ofs, 0, CoverRadius() ) )
{
// then try for plain ole cover
m_flMoveWaitFinished = gpGlobals->time + 2;
m_flMoveWaitFinished = gpGlobals->time + 2.0f;
TaskComplete();
}
else
@ -631,9 +631,9 @@ CBaseEntity *CTalkMonster::EnumFriends( CBaseEntity *pPrevious, int listNumber,
UTIL_TraceLine( pev->origin, vecCheck, ignore_monsters, ENT( pev ), &tr );
}
else
tr.flFraction = 1.0;
tr.flFraction = 1.0f;
if( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0f )
{
return pFriend;
}
@ -732,7 +732,7 @@ void CTalkMonster::HandleAnimEvent( MonsterEvent_t *pEvent )
// fall through...
case SCRIPT_EVENT_SENTENCE: // Play a named sentence group
ShutUpFriends();
PlaySentence( pEvent->options, RANDOM_FLOAT( 2.8, 3.4 ), VOL_NORM, ATTN_IDLE );
PlaySentence( pEvent->options, RANDOM_FLOAT( 2.8f, 3.4f ), VOL_NORM, ATTN_IDLE );
//ALERT( at_console, "script event speak\n" );
break;
default:
@ -806,7 +806,7 @@ CBaseEntity *CTalkMonster::FindNearestFriend( BOOL fPlayer )
{
UTIL_TraceLine( vecStart, vecCheck, ignore_monsters, ENT( pev ), &tr );
if( tr.flFraction == 1.0 )
if( tr.flFraction == 1.0f )
{
// visible and in range, this is the new nearest scientist
if( ( vecStart - vecCheck ).Length() < TALKRANGE_MIN )
@ -841,7 +841,7 @@ void CTalkMonster::Touch( CBaseEntity *pOther )
// Heuristic for determining if the player is pushing me away
float speed = fabs( pOther->pev->velocity.x ) + fabs( pOther->pev->velocity.y );
if( speed > 50 )
if( speed > 50.0f )
{
SetConditions( bits_COND_CLIENT_PUSH );
MakeIdealYaw( pOther->pev->origin );
@ -858,7 +858,7 @@ void CTalkMonster::IdleRespond( void )
//int pitch = GetVoicePitch();
// play response
PlaySentence( m_szGrp[TLK_ANSWER], RANDOM_FLOAT( 2.8, 3.2 ), VOL_NORM, ATTN_IDLE );
PlaySentence( m_szGrp[TLK_ANSWER], RANDOM_FLOAT( 2.8f, 3.2f ), VOL_NORM, ATTN_IDLE );
}
int CTalkMonster::FOkToSpeak( void )
@ -939,9 +939,9 @@ int CTalkMonster::FIdleHello( void )
m_hTalkTarget = pPlayer;
if( FBitSet(pev->spawnflags, SF_MONSTER_PREDISASTER ) )
PlaySentence( m_szGrp[TLK_PHELLO], RANDOM_FLOAT( 3, 3.5 ), VOL_NORM, ATTN_IDLE );
PlaySentence( m_szGrp[TLK_PHELLO], RANDOM_FLOAT( 3.0f, 3.5f ), VOL_NORM, ATTN_IDLE );
else
PlaySentence( m_szGrp[TLK_HELLO], RANDOM_FLOAT( 3, 3.5 ), VOL_NORM, ATTN_IDLE );
PlaySentence( m_szGrp[TLK_HELLO], RANDOM_FLOAT( 3.0f, 3.5f ), VOL_NORM, ATTN_IDLE );
SetBits( m_bitsSaid, bit_saidHelloPlayer );
@ -991,14 +991,14 @@ int CTalkMonster::FIdleSpeak( void )
szIdleGroup = m_szGrp[TLK_PIDLE];
szQuestionGroup = m_szGrp[TLK_PQUESTION];
// set global min delay for next conversation
duration = RANDOM_FLOAT( 4.8, 5.2 );
duration = RANDOM_FLOAT( 4.8f, 5.2f );
}
else
{
szIdleGroup = m_szGrp[TLK_IDLE];
szQuestionGroup = m_szGrp[TLK_QUESTION];
// set global min delay for next conversation
duration = RANDOM_FLOAT( 2.8, 3.2 );
duration = RANDOM_FLOAT( 2.8f, 3.2f );
}
//pitch = GetVoicePitch();
@ -1105,7 +1105,7 @@ void CTalkMonster::PlaySentence( const char *pszSentence, float duration, float
Talk( duration );
CTalkMonster::g_talkWaitTime = gpGlobals->time + duration + 2.0;
CTalkMonster::g_talkWaitTime = gpGlobals->time + duration + 2.0f;
if( pszSentence[0] == '!' )
EMIT_SOUND_DYN( edict(), CHAN_VOICE, pszSentence, volume, attenuation, 0, GetVoicePitch() );
else
@ -1124,7 +1124,7 @@ void CTalkMonster::Talk( float flDuration )
if( flDuration <= 0 )
{
// no duration :(
m_flStopTalkTime = gpGlobals->time + 3;
m_flStopTalkTime = gpGlobals->time + 3.0f;
}
else
{
@ -1186,20 +1186,20 @@ Schedule_t *CTalkMonster::GetScheduleOfType( int Type )
}
// sustained light wounds?
if( !FBitSet( m_bitsSaid, bit_saidWoundLight ) && ( pev->health <= ( pev->max_health * 0.75 ) ) )
if( !FBitSet( m_bitsSaid, bit_saidWoundLight ) && ( pev->health <= ( pev->max_health * 0.75f ) ) )
{
//SENTENCEG_PlayRndSz( ENT( pev ), m_szGrp[TLK_WOUND], 1.0, ATTN_IDLE, 0, GetVoicePitch() );
//CTalkMonster::g_talkWaitTime = gpGlobals->time + RANDOM_FLOAT( 2.8, 3.2 );
PlaySentence( m_szGrp[TLK_WOUND], RANDOM_FLOAT( 2.8, 3.2 ), VOL_NORM, ATTN_IDLE );
//CTalkMonster::g_talkWaitTime = gpGlobals->time + RANDOM_FLOAT( 2.8f, 3.2f );
PlaySentence( m_szGrp[TLK_WOUND], RANDOM_FLOAT( 2.8f, 3.2f ), VOL_NORM, ATTN_IDLE );
SetBits( m_bitsSaid, bit_saidWoundLight );
return slIdleStand;
}
// sustained heavy wounds?
else if( !FBitSet( m_bitsSaid, bit_saidWoundHeavy ) && ( pev->health <= ( pev->max_health * 0.5 ) ) )
else if( !FBitSet( m_bitsSaid, bit_saidWoundHeavy ) && ( pev->health <= ( pev->max_health * 0.5f ) ) )
{
//SENTENCEG_PlayRndSz( ENT( pev ), m_szGrp[TLK_MORTAL], 1.0, ATTN_IDLE, 0, GetVoicePitch() );
//CTalkMonster::g_talkWaitTime = gpGlobals->time + RANDOM_FLOAT( 2.8, 3.2 );
PlaySentence( m_szGrp[TLK_MORTAL], RANDOM_FLOAT( 2.8, 3.2 ), VOL_NORM, ATTN_IDLE );
//CTalkMonster::g_talkWaitTime = gpGlobals->time + RANDOM_FLOAT( 2.8f, 3.2f );
PlaySentence( m_szGrp[TLK_MORTAL], RANDOM_FLOAT( 2.8f, 3.2f ), VOL_NORM, ATTN_IDLE );
SetBits( m_bitsSaid, bit_saidWoundHeavy );
return slIdleStand;
}
@ -1289,8 +1289,8 @@ void CTalkMonster::TrySmellTalk( void )
// smelled something?
if( !FBitSet( m_bitsSaid, bit_saidSmelled ) && HasConditions( bits_COND_SMELL ) )
{
PlaySentence( m_szGrp[TLK_SMELL], RANDOM_FLOAT( 2.8, 3.2 ), VOL_NORM, ATTN_IDLE );
m_flLastSaidSmelled = gpGlobals->time + 60;// don't talk about the stinky for a while.
PlaySentence( m_szGrp[TLK_SMELL], RANDOM_FLOAT( 2.8f, 3.2f ), VOL_NORM, ATTN_IDLE );
m_flLastSaidSmelled = gpGlobals->time + 60.0f;// don't talk about the stinky for a while.
SetBits( m_bitsSaid, bit_saidSmelled );
}
}
@ -1309,7 +1309,7 @@ void CTalkMonster::StopFollowing( BOOL clearSchedule )
{
if( !( m_afMemory & bits_MEMORY_PROVOKED ) )
{
PlaySentence( m_szGrp[TLK_UNUSE], RANDOM_FLOAT( 2.8, 3.2 ), VOL_NORM, ATTN_IDLE );
PlaySentence( m_szGrp[TLK_UNUSE], RANDOM_FLOAT( 2.8f, 3.2f ), VOL_NORM, ATTN_IDLE );
m_hTalkTarget = m_hTargetEnt;
}
@ -1332,7 +1332,7 @@ void CTalkMonster::StartFollowing( CBaseEntity *pLeader )
m_IdealMonsterState = MONSTERSTATE_ALERT;
m_hTargetEnt = pLeader;
PlaySentence( m_szGrp[TLK_USE], RANDOM_FLOAT( 2.8, 3.2 ), VOL_NORM, ATTN_IDLE );
PlaySentence( m_szGrp[TLK_USE], RANDOM_FLOAT( 2.8f, 3.2f ), VOL_NORM, ATTN_IDLE );
m_hTalkTarget = m_hTargetEnt;
ClearConditions( bits_COND_CLIENT_PUSH );
ClearSchedule();

View File

@ -25,7 +25,7 @@
// Used for scientists and barneys
//=========================================================
#define TALKRANGE_MIN 500.0 // don't talk to anyone farther away than this
#define TALKRANGE_MIN 500.0f // don't talk to anyone farther away than this
#define TLK_STARE_DIST 128 // anyone closer than this and looking at me is probably staring at me.

Some files were not shown because too many files have changed in this diff Show More