diff --git a/.gitignore b/.gitignore index a0bc5604..3d6ad540 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,10 @@ cmake_install.cmake *.vsxproj *.vsproj *.sln +.waf-* +waf-* +.waf3-* +waf3-* +.lock* +*.pyc +.vscode/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 64c48928..ffae124c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,6 @@ project (HLSDK-XASH3D) #-------------- # USER DEFINES \ ################\ -option(64BIT "Allow 64 Bit builds" OFF) option(USE_VGUI "Enable VGUI1. UNDONE" OFF) option(USE_VGUI2 "Enable VGUI2. UNDONE" OFF) option(USE_VOICEMGR "Enable VOICE MANAGER." OFF) @@ -55,8 +54,8 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT 64BIT) if(MSVC) error("UNDONE: set 32 build flags") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32") endif() set(CMAKE_SIZEOF_VOID_P 4) @@ -87,6 +86,11 @@ if(${CMAKE_VERSION} VERSION_LESS "3.0.2") endmacro() endif() +if(NOT MSVC) + add_compile_options(-Wempty-body) # GCC/Clang flag + add_compile_options(-Wreturn-type) # GCC/Clang flag +endif() + if(BUILD_CLIENT) add_subdirectory(cl_dll) endif() diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..60f4aad3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,39 @@ +Half Life 1 SDK LICENSE +====================== + +Half Life 1 SDK Copyright(c) Valve Corp. + +THIS DOCUMENT DESCRIBES A CONTRACT BETWEEN YOU AND VALVE CORPORATION ("Valve"). +PLEASE READ IT BEFORE DOWNLOADING OR USING THE HALF LIFE 1 SDK ("SDK"). BY +DOWNLOADING AND/OR USING THE HALF LIFE 1 SDK YOU ACCEPT THIS LICENSE. IF YOU DO +NOT AGREE TO THE TERMS OF THIS LICENSE PLEASE DON'T DOWNLOAD OR USE THE SDK. + +You may, free of charge, download and use the SDK to develop a modified Valve +game running on the Half-Life 1 engine. You may distribute your modified Valve +game in source and object code form, but only for free. Terms of use for Valve +games are found in the Steam Subscriber Agreement located here: +http://store.steampowered.com/subscriber_agreement/ + +You may copy, modify, and distribute the SDK and any modifications you make to +the SDK in source and object code form, but only for free. Any distribution of +this SDK must include this LICENSE file. + +Any distribution of the SDK or a substantial portion of the SDK must include +the above copyright notice and the following: + + DISCLAIMER OF WARRANTIES. THE HALF LIFE 1 SDK AND ANY OTHER MATERIAL + DOWNLOADED BY LICENSEE IS PROVIDED "AS IS". VALVE AND ITS SUPPLIERS + DISCLAIM ALL WARRANTIES WITH RESPECT TO THE SDK, EITHER EXPRESS OR IMPLIED, + INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY, + NON-INFRINGEMENT, TITLE AND FITNESS FOR A PARTICULAR PURPOSE. + + LIMITATION OF LIABILITY. IN NO EVENT SHALL VALVE OR ITS SUPPLIERS BE LIABLE + FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER + (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, + BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY + LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE ENGINE AND/OR THE + SDK, EVEN IF VALVE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + +If you would like to use the SDK for a commercial purpose, please contact Valve +at sourceengine@valvesoftware.com. diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index 1143eefe..57d52654 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -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) @@ -125,6 +130,10 @@ if (GOLDSOURCE_SUPPORT) target_link_libraries( ${CLDLL_LIBRARY} ${CMAKE_DL_LIBS} ) endif() +if(WIN32) + target_link_libraries( ${CLDLL_LIBRARY} user32.lib ) +endif() + set_target_properties (${CLDLL_LIBRARY} PROPERTIES POSITION_INDEPENDENT_CODE 1) diff --git a/cl_dll/GameStudioModelRenderer.cpp b/cl_dll/GameStudioModelRenderer.cpp index 570b3375..f32def43 100644 --- a/cl_dll/GameStudioModelRenderer.cpp +++ b/cl_dll/GameStudioModelRenderer.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include "studio_util.h" #include "r_studioint.h" diff --git a/cl_dll/GameStudioModelRenderer_Sample.cpp b/cl_dll/GameStudioModelRenderer_Sample.cpp index ee8e8f9c..8910d809 100644 --- a/cl_dll/GameStudioModelRenderer_Sample.cpp +++ b/cl_dll/GameStudioModelRenderer_Sample.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include "studio_util.h" #include "r_studioint.h" diff --git a/cl_dll/MOTD.cpp b/cl_dll/MOTD.cpp index 179ae4a8..7059948a 100644 --- a/cl_dll/MOTD.cpp +++ b/cl_dll/MOTD.cpp @@ -56,7 +56,7 @@ void CHudMOTD::Reset( void ) m_bShow = 0; } -#define LINE_HEIGHT 13 +#define LINE_HEIGHT (gHUD.m_scrinfo.iCharHeight) #define ROW_GAP 13 #define ROW_RANGE_MIN 30 #define ROW_RANGE_MAX ( ScreenHeight - 100 ) @@ -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; } diff --git a/cl_dll/StudioModelRenderer.cpp b/cl_dll/StudioModelRenderer.cpp index a9859244..5350ad10 100644 --- a/cl_dll/StudioModelRenderer.cpp +++ b/cl_dll/StudioModelRenderer.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #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 ) diff --git a/cl_dll/ammo.cpp b/cl_dll/ammo.cpp index 4104acff..7be34e23 100644 --- a/cl_dll/ammo.cpp +++ b/cl_dll/ammo.cpp @@ -77,7 +77,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) else iRes = 640; - char sz[128]; + char sz[256]; if( !pWeapon ) return; @@ -152,7 +152,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->hInactive = SPR_Load( sz ); pWeapon->rcInactive = p->rc; - gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); } else pWeapon->hInactive = 0; @@ -174,7 +174,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->hAmmo = SPR_Load( sz ); pWeapon->rcAmmo = p->rc; - gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); } else pWeapon->hAmmo = 0; @@ -186,7 +186,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon ) pWeapon->hAmmo2 = SPR_Load( sz ); pWeapon->rcAmmo2 = p->rc; - gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top ); } else pWeapon->hAmmo2 = 0; @@ -320,7 +320,7 @@ int CHudAmmo::VidInit( void ) giBucketWidth = gHUD.GetSpriteRect( m_HUD_bucket0 ).right - gHUD.GetSpriteRect( m_HUD_bucket0 ).left; giBucketHeight = gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top; - gHR.iHistoryGap = max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top ); + gHR.iHistoryGap = Q_max( gHR.iHistoryGap, gHUD.GetSpriteRect( m_HUD_bucket0 ).bottom - gHUD.GetSpriteRect( m_HUD_bucket0 ).top ); // If we've already loaded weapons, let's get new sprites gWR.LoadAllWeaponSprites(); @@ -861,10 +861,10 @@ int CHudAmmo::Draw( float flTime ) AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left; - a = (int)max( MIN_ALPHA, m_fFade ); + 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 ); diff --git a/cl_dll/ammo_secondary.cpp b/cl_dll/ammo_secondary.cpp index 148d29b7..4034c86f 100644 --- a/cl_dll/ammo_secondary.cpp +++ b/cl_dll/ammo_secondary.cpp @@ -61,9 +61,9 @@ int CHudAmmoSecondary::Draw( float flTime ) // draw secondary ammo icons above normal ammo readout int a, x, y, r, g, b, AmmoWidth; UnpackRGB( r, g, b, RGB_YELLOWISH ); - a = (int)max( MIN_ALPHA, m_fFade ); + 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; @@ -142,7 +142,7 @@ int CHudAmmoSecondary::MsgFunc_SecAmmoVal( const char *pszName, int iSize, void int count = 0; for( int i = 0; i < MAX_SEC_AMMO_VALUES; i++ ) { - count += max( 0, m_iAmmoAmounts[i] ); + count += Q_max( 0, m_iAmmoAmounts[i] ); } if( count == 0 ) diff --git a/cl_dll/ammohistory.cpp b/cl_dll/ammohistory.cpp index 4b1e6745..a3961da7 100644 --- a/cl_dll/ammohistory.cpp +++ b/cl_dll/ammohistory.cpp @@ -111,7 +111,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) { if( rgAmmoHistory[i].type ) { - rgAmmoHistory[i].DisplayTime = min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME ); + rgAmmoHistory[i].DisplayTime = Q_min( rgAmmoHistory[i].DisplayTime, gHUD.m_flTime + HISTORY_DRAW_TIME ); if( rgAmmoHistory[i].DisplayTime <= flTime ) { @@ -127,7 +127,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) int r, g, b; UnpackRGB( r, g, b, RGB_YELLOWISH ); float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80; - ScaleColors( r, g, b, min( scale, 255 ) ); + ScaleColors( r, g, b, Q_min( scale, 255 ) ); // Draw the pic int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)); @@ -158,7 +158,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) UnpackRGB( r, g, b, RGB_REDISH ); // if the weapon doesn't have ammo, display it as red float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80; - ScaleColors( r, g, b, min( scale, 255 ) ); + ScaleColors( r, g, b, Q_min( scale, 255 ) ); int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) ); int xpos = ScreenWidth - ( weap->rcInactive.right - weap->rcInactive.left ); @@ -176,7 +176,7 @@ int HistoryResource::DrawAmmoHistory( float flTime ) UnpackRGB( r, g, b, RGB_YELLOWISH ); float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80; - ScaleColors( r, g, b, min( scale, 255 ) ); + ScaleColors( r, g, b, Q_min( scale, 255 ) ); int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) ); int xpos = ScreenWidth - ( rect.right - rect.left ) - 10; diff --git a/cl_dll/battery.cpp b/cl_dll/battery.cpp index 2f26057f..b6cd9e0b 100644 --- a/cl_dll/battery.cpp +++ b/cl_dll/battery.cpp @@ -78,7 +78,7 @@ int CHudBattery::Draw( float flTime ) wrect_t rc; rc = *m_prc2; - rc.top += m_iHeight * ( (float)( 100 - ( 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; diff --git a/cl_dll/cdll_int.cpp b/cl_dll/cdll_int.cpp index dc9199ba..45bbcd67 100644 --- a/cl_dll/cdll_int.cpp +++ b/cl_dll/cdll_int.cpp @@ -212,7 +212,9 @@ void TeamFortressViewport::paintBackground() // int wide, tall; // getParent()->getSize( wide, tall ); // setSize( wide, tall ); - gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect()); + int extents[4]; + getParent()->getAbsExtents(extents[0],extents[1],extents[2],extents[3]); + gEngfuncs.VGui_ViewportPaintBackground(extents); } void *TeamFortressViewport::operator new( size_t stAllocateBlock ) diff --git a/cl_dll/cl_dll.h b/cl_dll/cl_dll.h index 6e1c4e69..6ba3db67 100644 --- a/cl_dll/cl_dll.h +++ b/cl_dll/cl_dll.h @@ -38,7 +38,7 @@ typedef int ( *pfnUserMsgHook )( const char *pszName, int iSize, void *pbuf ); #include "../engine/cdll_int.h" #include "../dlls/cdll_dll.h" -#ifndef __MSC_VER +#if !defined(_WIN32) #define _cdecl #endif #include "exportdef.h" diff --git a/cl_dll/cl_util.h b/cl_dll/cl_util.h index 0cb65f32..7ba3bc7e 100644 --- a/cl_dll/cl_util.h +++ b/cl_dll/cl_util.h @@ -148,8 +148,8 @@ inline void CenterPrint( const char *string ) inline void PlaySound( const char *szSound, float vol ) { gEngfuncs.pfnPlaySoundByName( szSound, vol ); } inline void PlaySound( int iSound, float vol ) { gEngfuncs.pfnPlaySoundByIndex( iSound, vol ); } -#define max(a, b) (((a) > (b)) ? (a) : (b)) -#define min(a, b) (((a) < (b)) ? (a) : (b)) +#define Q_max(a, b) (((a) > (b)) ? (a) : (b)) +#define Q_min(a, b) (((a) < (b)) ? (a) : (b)) #define fabs(x) ((x) > 0 ? (x) : 0 - (x)) void ScaleColors( int &r, int &g, int &b, int a ); diff --git a/cl_dll/com_weapons.cpp b/cl_dll/com_weapons.cpp index 5621149b..4b9ae338 100644 --- a/cl_dll/com_weapons.cpp +++ b/cl_dll/com_weapons.cpp @@ -116,7 +116,7 @@ void HUD_PlaySound( const char *sound, float volume ) if( !g_runfuncs || !g_finalstate ) return; - gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, (float *)&g_finalstate->playerstate.origin ); + gEngfuncs.pfnPlaySoundByNameAtLocation( sound, volume, g_finalstate->playerstate.origin ); } /* @@ -127,7 +127,7 @@ Directly queue up an event on the client ===================== */ void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, - float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ) + const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ) { vec3_t org; vec3_t ang; @@ -138,7 +138,7 @@ void HUD_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short event // Weapon prediction events are assumed to occur at the player's origin org = g_finalstate->playerstate.origin; ang = v_angles; - gEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, (float *)&org, (float *)&ang, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 ); + gEngfuncs.pfnPlaybackEvent( flags, pInvoker, eventindex, delay, org, ang, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 ); } /* @@ -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 ); } diff --git a/cl_dll/com_weapons.h b/cl_dll/com_weapons.h index efe06ad6..89fb3cfe 100644 --- a/cl_dll/com_weapons.h +++ b/cl_dll/com_weapons.h @@ -27,7 +27,7 @@ int UTIL_SharedRandomLong( unsigned int seed, int low, int high ); int HUD_GetWeaponAnim( void ); void HUD_SendWeaponAnim( int iAnim, int body, int force ); void HUD_PlaySound( const char *sound, float volume ); -void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); +void HUD_PlaybackEvent( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); void HUD_SetMaxSpeed( const struct edict_s *ed, float speed ); int stub_PrecacheModel( const char* s ); int stub_PrecacheSound( const char* s ); diff --git a/cl_dll/compile.bat b/cl_dll/compile.bat index 9270d4bc..18b45459 100644 --- a/cl_dll/compile.bat +++ b/cl_dll/compile.bat @@ -8,68 +8,68 @@ echo -- Compiler is MSVC6 set XASH3DSRC=..\..\Xash3D_original set INCLUDES=-I../common -I../engine -I../pm_shared -I../game_shared -I../public -I../external -I../dlls -I../utils/false_vgui/include -set SOURCES=../dlls/crossbow.cpp^ - ../dlls/crowbar.cpp^ - ../dlls/egon.cpp^ - ../dlls/gauss.cpp^ - ../dlls/handgrenade.cpp^ - ../dlls/hornetgun.cpp^ - ../dlls/mp5.cpp^ - ../dlls/python.cpp^ - ../dlls/rpg.cpp^ - ../dlls/satchel.cpp^ - ../dlls/shotgun.cpp^ - ../dlls/squeakgrenade.cpp^ - ../dlls/tripmine.cpp^ - ../dlls/glock.cpp^ - ev_hldm.cpp^ - hl/hl_baseentity.cpp^ - hl/hl_events.cpp^ - hl/hl_objects.cpp^ - hl/hl_weapons.cpp^ - ammo.cpp^ - ammo_secondary.cpp^ - ammohistory.cpp^ - battery.cpp^ - cdll_int.cpp^ - com_weapons.cpp^ - death.cpp^ - demo.cpp^ - entity.cpp^ - ev_common.cpp^ - events.cpp^ - flashlight.cpp^ - GameStudioModelRenderer.cpp^ - geiger.cpp^ - health.cpp^ - hud.cpp^ - hud_msg.cpp^ - hud_redraw.cpp^ - hud_spectator.cpp^ - hud_update.cpp^ - in_camera.cpp^ - input.cpp^ - input_goldsource.cpp^ - input_mouse.cpp^ - input_xash3d.cpp^ - menu.cpp^ - message.cpp^ - overview.cpp^ - parsemsg.cpp^ - ../pm_shared/pm_debug.c^ - ../pm_shared/pm_math.c^ - ../pm_shared/pm_shared.c^ - saytext.cpp^ - status_icons.cpp^ - statusbar.cpp^ - studio_util.cpp^ - StudioModelRenderer.cpp^ - text_message.cpp^ - train.cpp^ - tri.cpp^ - util.cpp^ - view.cpp^ - scoreboard.cpp^ +set SOURCES=../dlls/crossbow.cpp ^ + ../dlls/crowbar.cpp ^ + ../dlls/egon.cpp ^ + ../dlls/gauss.cpp ^ + ../dlls/handgrenade.cpp ^ + ../dlls/hornetgun.cpp ^ + ../dlls/mp5.cpp ^ + ../dlls/python.cpp ^ + ../dlls/rpg.cpp ^ + ../dlls/satchel.cpp ^ + ../dlls/shotgun.cpp ^ + ../dlls/squeakgrenade.cpp ^ + ../dlls/tripmine.cpp ^ + ../dlls/glock.cpp ^ + ev_hldm.cpp ^ + hl/hl_baseentity.cpp ^ + hl/hl_events.cpp ^ + hl/hl_objects.cpp ^ + hl/hl_weapons.cpp ^ + ammo.cpp ^ + ammo_secondary.cpp ^ + ammohistory.cpp ^ + battery.cpp ^ + cdll_int.cpp ^ + com_weapons.cpp ^ + death.cpp ^ + demo.cpp ^ + entity.cpp ^ + ev_common.cpp ^ + events.cpp ^ + flashlight.cpp ^ + GameStudioModelRenderer.cpp ^ + geiger.cpp ^ + health.cpp ^ + hud.cpp ^ + hud_msg.cpp ^ + hud_redraw.cpp ^ + hud_spectator.cpp ^ + hud_update.cpp ^ + in_camera.cpp ^ + input.cpp ^ + input_goldsource.cpp ^ + input_mouse.cpp ^ + input_xash3d.cpp ^ + menu.cpp ^ + message.cpp ^ + overview.cpp ^ + parsemsg.cpp ^ + ../pm_shared/pm_debug.c ^ + ../pm_shared/pm_math.c ^ + ../pm_shared/pm_shared.c ^ + saytext.cpp ^ + status_icons.cpp ^ + statusbar.cpp ^ + studio_util.cpp ^ + StudioModelRenderer.cpp ^ + text_message.cpp ^ + train.cpp ^ + tri.cpp ^ + util.cpp ^ + view.cpp ^ + scoreboard.cpp ^ MOTD.cpp set DEFINES=/DCLIENT_DLL /DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR /DGOLDSOURCE_SUPPORT set LIBS=user32.lib Winmm.lib diff --git a/cl_dll/death.cpp b/cl_dll/death.cpp index 579fc255..d2c41e38 100644 --- a/cl_dll/death.cpp +++ b/cl_dll/death.cpp @@ -71,7 +71,7 @@ int CHudDeathNotice::Init( void ) HOOK_MESSAGE( DeathMsg ); - CVAR_CREATE( "hud_deathnotice_time", "6", 0 ); + CVAR_CREATE( "hud_deathnotice_time", "6", FCVAR_ARCHIVE ); return 1; } @@ -106,7 +106,7 @@ int CHudDeathNotice::Draw( float flTime ) continue; } - rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); + rgDeathNoticeList[i].flDisplayTime = Q_min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); // Only draw if the viewport will let me // vgui dropped out @@ -204,7 +204,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu // Get the Victim's name const char *victim_name = ""; // If victim is -1, the killer killed a specific, non-player object (like a sentrygun) - if( ( (char)victim ) != -1 ) + if( ( (signed char)victim ) != -1 ) victim_name = g_PlayerInfoList[victim].name; if( !victim_name ) { @@ -219,7 +219,7 @@ int CHudDeathNotice::MsgFunc_DeathMsg( const char *pszName, int iSize, void *pbu } // Is it a non-player object kill? - if( ( (char)victim ) == -1 ) + if( ( (signed char)victim ) == -1 ) { rgDeathNoticeList[i].iNonPlayerKill = TRUE; diff --git a/cl_dll/entity.cpp b/cl_dll/entity.cpp index 40649fa7..6a7fdc79 100644 --- a/cl_dll/entity.cpp +++ b/cl_dll/entity.cpp @@ -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 ) { diff --git a/cl_dll/ev_hldm.cpp b/cl_dll/ev_hldm.cpp index 08127aa1..9b100439 100644 --- a/cl_dll/ev_hldm.cpp +++ b/cl_dll/ev_hldm.cpp @@ -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 ); } } //====================== @@ -1410,7 +1410,9 @@ enum EGON_FIREMODE #define EGON_SOUND_RUN "weapons/egon_run3.wav" #define EGON_SOUND_STARTUP "weapons/egon_windup2.wav" +#if !defined(ARRAYSIZE) #define ARRAYSIZE(p) ( sizeof(p) /sizeof(p[0]) ) +#endif BEAM *pBeam; BEAM *pBeam2; @@ -1539,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; } @@ -1665,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(); @@ -1720,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(); @@ -1749,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 ) { diff --git a/cl_dll/flashlight.cpp b/cl_dll/flashlight.cpp index ee3d6d22..3ec69973 100644 --- a/cl_dll/flashlight.cpp +++ b/cl_dll/flashlight.cpp @@ -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; diff --git a/cl_dll/geiger.cpp b/cl_dll/geiger.cpp index 097889b9..339c8ee1 100644 --- a/cl_dll/geiger.cpp +++ b/cl_dll/geiger.cpp @@ -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; diff --git a/cl_dll/health.cpp b/cl_dll/health.cpp index eebf0eb0..6540671e 100644 --- a/cl_dll/health.cpp +++ b/cl_dll/health.cpp @@ -18,9 +18,9 @@ // implementation of CHudHealth class // -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include +#include +#include #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,28 +270,28 @@ void CHudHealth::CalcDamageDirection( vec3_t vecFrom ) } else { - if( side > 0 ) + if( side > 0.0f ) { - if( side > 0.3 ) - m_fAttackFront = max( m_fAttackFront, side ); + if( side > 0.3f ) + m_fAttackFront = Q_max( m_fAttackFront, side ); } else { float f = fabs( side ); - if( f > 0.3 ) - m_fAttackRear = max( m_fAttackRear, f ); + if( f > 0.3f ) + m_fAttackRear = Q_max( m_fAttackRear, f ); } - if( front > 0 ) + if( front > 0.0f ) { - if( front > 0.3 ) - m_fAttackRight = max( m_fAttackRight, front ); + if( front > 0.3f ) + m_fAttackRight = Q_max( m_fAttackRight, front ); } else { float f = fabs( front ); - if( f > 0.3 ) - m_fAttackLeft = max( m_fAttackLeft, f ); + if( f > 0.3f ) + m_fAttackLeft = Q_max( m_fAttackLeft, f ); } } } @@ -310,54 +310,54 @@ 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 * 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 ); x = ScreenWidth / 2 - SPR_Width( m_hSprite, 0 ) / 2; y = ScreenHeight / 2 - SPR_Height( m_hSprite, 0 ) * 3; SPR_DrawAdditive( 0, x, y, NULL ); - m_fAttackFront = max( 0, m_fAttackFront - fFade ); + m_fAttackFront = Q_max( 0, m_fAttackFront - fFade ); } else m_fAttackFront = 0; - if( m_fAttackRight > 0.4 ) + if( m_fAttackRight > 0.4f ) { GetPainColor( r, g, b ); - shade = a * 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 ); x = ScreenWidth / 2 + SPR_Width( m_hSprite, 1 ) * 2; y = ScreenHeight / 2 - SPR_Height( m_hSprite,1 ) / 2; SPR_DrawAdditive( 1, x, y, NULL ); - m_fAttackRight = max( 0, m_fAttackRight - fFade ); + m_fAttackRight = Q_max( 0, m_fAttackRight - fFade ); } else m_fAttackRight = 0; - if( m_fAttackRear > 0.4 ) + if( m_fAttackRear > 0.4f ) { GetPainColor( r, g, b ); - shade = a * 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 ); x = ScreenWidth / 2 - SPR_Width( m_hSprite, 2 ) / 2; y = ScreenHeight / 2 + SPR_Height( m_hSprite, 2 ) * 2; SPR_DrawAdditive( 2, x, y, NULL ); - m_fAttackRear = max( 0, m_fAttackRear - fFade ); + m_fAttackRear = Q_max( 0, m_fAttackRear - fFade ); } else m_fAttackRear = 0; - if( m_fAttackLeft > 0.4 ) + if( m_fAttackLeft > 0.4f ) { GetPainColor( r, g, b ); - shade = a * 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 ); @@ -365,7 +365,7 @@ int CHudHealth::DrawPain( float flTime ) y = ScreenHeight / 2 - SPR_Height( m_hSprite,3 ) / 2; SPR_DrawAdditive( 3, x, y, NULL ); - m_fAttackLeft = max( 0, m_fAttackLeft - fFade ); + m_fAttackLeft = Q_max( 0, m_fAttackLeft - fFade ); } else m_fAttackLeft = 0; @@ -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 ); @@ -397,7 +397,7 @@ int CHudHealth::DrawDamage( float flTime ) SPR_Set( gHUD.GetSprite( m_HUD_dmg_bio + i ), r, g, b ); SPR_DrawAdditive( 0, pdmg->x, pdmg->y, &gHUD.GetSpriteRect( m_HUD_dmg_bio + i ) ); - pdmg->fExpire = min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire ); + pdmg->fExpire = Q_min( flTime + DMG_IMAGE_LIFE, pdmg->fExpire ); if( pdmg->fExpire <= flTime // when the time has expired && a < 40 ) // and the flash is at the low point of the cycle diff --git a/cl_dll/hl/hl_objects.cpp b/cl_dll/hl/hl_objects.cpp index 55822dcb..788b09e3 100644 --- a/cl_dll/hl/hl_objects.cpp +++ b/cl_dll/hl/hl_objects.cpp @@ -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 ); diff --git a/cl_dll/hl/hl_weapons.cpp b/cl_dll/hl/hl_weapons.cpp index 75161a9e..63e6f6d8 100644 --- a/cl_dll/hl/hl_weapons.cpp +++ b/cl_dll/hl/hl_weapons.cpp @@ -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. diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index 62c32b41..9652770d 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -190,8 +190,9 @@ void CHud::Init( void ) m_iLogo = 0; m_iFOV = 0; - CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", 0 ); - default_fov = CVAR_CREATE( "default_fov", "90", 0 ); + CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", FCVAR_ARCHIVE ); + CVAR_CREATE( "cl_autowepswitch", "1", FCVAR_ARCHIVE | FCVAR_USERINFO ); + default_fov = CVAR_CREATE( "default_fov", "90", FCVAR_ARCHIVE ); m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE ); m_pCvarDraw = CVAR_CREATE( "hud_draw", "1", FCVAR_ARCHIVE ); cl_lw = gEngfuncs.pfnGetCvarPointer( "cl_lw" ); diff --git a/cl_dll/hud_redraw.cpp b/cl_dll/hud_redraw.cpp index 4a46a519..579c0897 100644 --- a/cl_dll/hud_redraw.cpp +++ b/cl_dll/hud_redraw.cpp @@ -15,7 +15,8 @@ // // hud_redraw.cpp // -#include +#include + #include "hud.h" #include "cl_util.h" //#include "triangleapi.h" @@ -75,7 +76,7 @@ void CHud::Think( void ) if( m_iFOV == 0 ) { // only let players adjust up in fov, and only if they are not overriden by something else - m_iFOV = max( default_fov->value, 90 ); + m_iFOV = Q_max( default_fov->value, 90 ); } } @@ -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 ) diff --git a/cl_dll/hud_spectator.cpp b/cl_dll/hud_spectator.cpp index edb743ba..f666b5e6 100644 --- a/cl_dll/hud_spectator.cpp +++ b/cl_dll/hud_spectator.cpp @@ -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 ) @@ -820,8 +820,8 @@ bool CHudSpectator::IsActivePlayer( cl_entity_t *ent ) bool CHudSpectator::ParseOverviewFile() { - char filename[255] = { 0 }; - char levelname[255] = { 0 }; + char filename[512] = { 0 }; + char levelname[256] = { 0 }; char token[1024] = { 0 }; float height; @@ -842,7 +842,7 @@ bool CHudSpectator::ParseOverviewFile() m_OverviewData.layersHeights[0] = 0.0f; strcpy( m_OverviewData.map, gEngfuncs.pfnGetLevelName() ); - if( strlen( m_OverviewData.map ) == 0 ) + if( m_OverviewData.map[0] == '\0' ) return false; // not active yet strcpy( levelname, m_OverviewData.map + 5 ); @@ -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; diff --git a/cl_dll/hud_update.cpp b/cl_dll/hud_update.cpp index cecbb625..f431bbaf 100644 --- a/cl_dll/hud_update.cpp +++ b/cl_dll/hud_update.cpp @@ -16,7 +16,7 @@ // hud_update.cpp // -#include +#include #include "hud.h" #include "cl_util.h" #include diff --git a/cl_dll/in_camera.cpp b/cl_dll/in_camera.cpp index 12ad41f4..3b089577 100644 --- a/cl_dll/in_camera.cpp +++ b/cl_dll/in_camera.cpp @@ -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 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 diff --git a/cl_dll/input.cpp b/cl_dll/input.cpp index 0abd542b..eab15acf 100644 --- a/cl_dll/input.cpp +++ b/cl_dll/input.cpp @@ -169,7 +169,7 @@ int KB_ConvertString( char *in, char **ppout ) *pEnd = '\0'; pBinding = NULL; - if( strlen( binding + 1 ) > 0 ) + if( binding[1] != '\0' ) { // See if there is a binding for binding? pBinding = gEngfuncs.Key_LookupBinding( binding + 1 ); @@ -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 ) ); diff --git a/cl_dll/input_goldsource.cpp b/cl_dll/input_goldsource.cpp index c45841cb..be85ee3a 100644 --- a/cl_dll/input_goldsource.cpp +++ b/cl_dll/input_goldsource.cpp @@ -44,62 +44,62 @@ const char* (*pfnSDL_GameControllerName)(SDL_GameController*); int safe_pfnSDL_SetRelativeMouseMode(SDL_bool mode) { - if (pfnSDL_SetRelativeMouseMode) - return pfnSDL_SetRelativeMouseMode(mode); - return -1; + if (pfnSDL_SetRelativeMouseMode) + return pfnSDL_SetRelativeMouseMode(mode); + return -1; } Uint32 safe_pfnSDL_GetRelativeMouseState(int* x, int* y) { - if (pfnSDL_GetRelativeMouseState) - return pfnSDL_GetRelativeMouseState(x, y); - return 0; + if (pfnSDL_GetRelativeMouseState) + return pfnSDL_GetRelativeMouseState(x, y); + return 0; } int safe_pfnSDL_NumJoysticks() { - if (pfnSDL_NumJoysticks) - return pfnSDL_NumJoysticks(); - return -1; + if (pfnSDL_NumJoysticks) + return pfnSDL_NumJoysticks(); + return -1; } SDL_bool safe_pfnSDL_IsGameController(int joystick_index) { - if (pfnSDL_IsGameController) - return pfnSDL_IsGameController(joystick_index); - return SDL_FALSE; + if (pfnSDL_IsGameController) + return pfnSDL_IsGameController(joystick_index); + return SDL_FALSE; } SDL_GameController* safe_pfnSDL_GameControllerOpen(int joystick_index) { - if (pfnSDL_GameControllerOpen) - return pfnSDL_GameControllerOpen(joystick_index); - return NULL; + if (pfnSDL_GameControllerOpen) + return pfnSDL_GameControllerOpen(joystick_index); + return NULL; } Sint16 safe_pfnSDL_GameControllerGetAxis(SDL_GameController* gamecontroller, SDL_GameControllerAxis axis) { - if (pfnSDL_GameControllerGetAxis) - return pfnSDL_GameControllerGetAxis(gamecontroller, axis); - return 0; + if (pfnSDL_GameControllerGetAxis) + return pfnSDL_GameControllerGetAxis(gamecontroller, axis); + return 0; } Uint8 safe_pfnSDL_GameControllerGetButton(SDL_GameController* gamecontroller, SDL_GameControllerButton button) { - if (pfnSDL_GameControllerGetButton) - return pfnSDL_GameControllerGetButton(gamecontroller, button); - return 0; + if (pfnSDL_GameControllerGetButton) + return pfnSDL_GameControllerGetButton(gamecontroller, button); + return 0; } void safe_pfnSDL_JoystickUpdate() { - if (pfnSDL_JoystickUpdate) - pfnSDL_JoystickUpdate(); + if (pfnSDL_JoystickUpdate) + pfnSDL_JoystickUpdate(); } const char* safe_pfnSDL_GameControllerName(SDL_GameController* gamecontroller) { - if (pfnSDL_GameControllerName) - return pfnSDL_GameControllerName(gamecontroller); - return NULL; + if (pfnSDL_GameControllerName) + return pfnSDL_GameControllerName(gamecontroller); + return NULL; } struct SDLFunction { - void** ppfnFunc; - const char* name; + void** ppfnFunc; + const char* name; }; static SDLFunction sdlFunctions[] = { {(void**)&pfnSDL_SetRelativeMouseMode, "SDL_SetRelativeMouseMode"}, @@ -129,15 +129,15 @@ extern cl_enginefunc_t gEngfuncs; extern int iMouseInUse; -extern kbutton_t in_strafe; -extern kbutton_t in_mlook; -extern kbutton_t in_speed; -extern kbutton_t in_jlook; +extern kbutton_t in_strafe; +extern kbutton_t in_mlook; +extern kbutton_t in_speed; +extern kbutton_t in_jlook; -extern cvar_t *m_pitch; -extern cvar_t *m_yaw; -extern cvar_t *m_forward; -extern cvar_t *m_side; +extern cvar_t *m_pitch; +extern cvar_t *m_yaw; +extern cvar_t *m_forward; +extern cvar_t *m_side; extern cvar_t *lookstrafe; extern cvar_t *lookspring; @@ -161,6 +161,7 @@ bool isMouseRelative = false; extern globalvars_t *gpGlobals; #endif +int CL_IsDead( void ); extern Vector dead_viewangles; void V_StopPitchDrift( void ) @@ -169,8 +170,8 @@ void V_StopPitchDrift( void ) } // mouse variables -cvar_t *m_filter; -extern cvar_t *sensitivity; +cvar_t *m_filter; +extern cvar_t *sensitivity; // Custom mouse acceleration (0 disable, 1 to enable, 2 enable with separate yaw/pitch rescale) static cvar_t *m_customaccel; @@ -188,44 +189,44 @@ static cvar_t *m_customaccel_exponent; static cvar_t *m_mousethread_sleep; #endif -float mouse_x, mouse_y; +float mouse_x, mouse_y; -static int restore_spi; -static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1}; -static int mouseactive = 0; -static int mouseparmsvalid; -static int mouseshowtoggle = 1; +static int restore_spi; +static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1}; +static int mouseactive = 0; +static int mouseparmsvalid; +static int mouseshowtoggle = 1; // joystick defines and variables // where should defines be moved? -#define JOY_ABSOLUTE_AXIS 0x00000000 // control like a joystick -#define JOY_RELATIVE_AXIS 0x00000010 // control like a mouse, spinner, trackball -#define JOY_MAX_AXES 6 // X, Y, Z, R, U, V -#define JOY_AXIS_X 0 -#define JOY_AXIS_Y 1 -#define JOY_AXIS_Z 2 -#define JOY_AXIS_R 3 -#define JOY_AXIS_U 4 -#define JOY_AXIS_V 5 +#define JOY_ABSOLUTE_AXIS 0x00000000 // control like a joystick +#define JOY_RELATIVE_AXIS 0x00000010 // control like a mouse, spinner, trackball +#define JOY_MAX_AXES 6 // X, Y, Z, R, U, V +#define JOY_AXIS_X 0 +#define JOY_AXIS_Y 1 +#define JOY_AXIS_Z 2 +#define JOY_AXIS_R 3 +#define JOY_AXIS_U 4 +#define JOY_AXIS_V 5 enum _ControlList { - AxisNada = 0, - AxisForward, - AxisLook, - AxisSide, - AxisTurn + AxisNada = 0, + AxisForward, + AxisLook, + AxisSide, + AxisTurn }; #if !defined(USE_SDL2) && defined(_WIN32) DWORD dwAxisFlags[JOY_MAX_AXES] = { - JOY_RETURNX, - JOY_RETURNY, - JOY_RETURNZ, - JOY_RETURNR, - JOY_RETURNU, - JOY_RETURNV + JOY_RETURNX, + JOY_RETURNY, + JOY_RETURNZ, + JOY_RETURNR, + JOY_RETURNU, + JOY_RETURNV }; #endif @@ -236,10 +237,10 @@ int pdwRawValue[ JOY_MAX_AXES ]; #elif defined(_WIN32) PDWORD pdwRawValue[ JOY_MAX_AXES ]; #endif -DWORD joy_oldbuttonstate, joy_oldpovstate; +DWORD joy_oldbuttonstate, joy_oldpovstate; -int joy_id; -DWORD joy_numbuttons; +int joy_id; +DWORD joy_numbuttons; #ifdef USE_SDL2 SDL_GameController *s_pJoystick = NULL; @@ -273,13 +274,13 @@ cvar_t *joy_yawsensitivity; cvar_t *joy_wwhack1; cvar_t *joy_wwhack2; -int joy_avail, joy_advancedinit, joy_haspov; +int joy_avail, joy_advancedinit, joy_haspov; #ifdef _WIN32 unsigned int s_hMouseThreadId = 0; -HANDLE s_hMouseThread = 0; -HANDLE s_hMouseQuitEvent = 0; -HANDLE s_hMouseThreadActiveLock = 0; +HANDLE s_hMouseThread = 0; +HANDLE s_hMouseQuitEvent = 0; +HANDLE s_hMouseThreadActiveLock = 0; #endif /* @@ -289,14 +290,14 @@ Force_CenterView_f */ void Force_CenterView_f (void) { - vec3_t viewangles; + vec3_t viewangles; - if (!iMouseInUse) - { - gEngfuncs.GetViewAngles( (float *)viewangles ); - viewangles[PITCH] = 0; - gEngfuncs.SetViewAngles( (float *)viewangles ); - } + if (!iMouseInUse) + { + gEngfuncs.GetViewAngles( (float *)viewangles ); + viewangles[PITCH] = 0; + gEngfuncs.SetViewAngles( (float *)viewangles ); + } } #ifdef _WIN32 @@ -310,129 +311,129 @@ LONG mouseThreadSleep = 0; bool MouseThread_ActiveLock_Enter( void ) { - if(!m_bMouseThread) - return true; + if(!m_bMouseThread) + return true; - return WAIT_OBJECT_0 == WaitForSingleObject( s_hMouseThreadActiveLock, INFINITE); + return WAIT_OBJECT_0 == WaitForSingleObject( s_hMouseThreadActiveLock, INFINITE); } void MouseThread_ActiveLock_Exit( void ) { - if(!m_bMouseThread) - return; + if(!m_bMouseThread) + return; - SetEvent( s_hMouseThreadActiveLock ); + SetEvent( s_hMouseThreadActiveLock ); } unsigned __stdcall MouseThread_Function( void * pArg ) { - while ( true ) - { - DWORD sleepVal = (DWORD)InterlockedExchangeAdd(&mouseThreadSleep, 0); - if(0 > sleepVal) sleepVal = 0; - else if(1000 < sleepVal) sleepVal = 1000; - if(WAIT_OBJECT_0 == WaitForSingleObject( s_hMouseQuitEvent, sleepVal)) - { - break; - } + while ( true ) + { + DWORD sleepVal = (DWORD)InterlockedExchangeAdd(&mouseThreadSleep, 0); + if(0 > sleepVal) sleepVal = 0; + else if(1000 < sleepVal) sleepVal = 1000; + if(WAIT_OBJECT_0 == WaitForSingleObject( s_hMouseQuitEvent, sleepVal)) + { + break; + } - if( MouseThread_ActiveLock_Enter() ) - { - if ( InterlockedExchangeAdd(&mouseThreadActive, 0) ) - { - POINT mouse_pos; - POINT center_pos; + if( MouseThread_ActiveLock_Enter() ) + { + if ( InterlockedExchangeAdd(&mouseThreadActive, 0) ) + { + POINT mouse_pos; + POINT center_pos; - center_pos.x = InterlockedExchangeAdd(&mouseThreadCenterX, 0); - center_pos.y = InterlockedExchangeAdd(&mouseThreadCenterY, 0); - GetCursorPos(&mouse_pos); + center_pos.x = InterlockedExchangeAdd(&mouseThreadCenterX, 0); + center_pos.y = InterlockedExchangeAdd(&mouseThreadCenterY, 0); + GetCursorPos(&mouse_pos); - mouse_pos.x -= center_pos.x; - mouse_pos.y -= center_pos.y; + mouse_pos.x -= center_pos.x; + mouse_pos.y -= center_pos.y; - if(mouse_pos.x || mouse_pos.y) SetCursorPos( center_pos.x, center_pos.y ); + if(mouse_pos.x || mouse_pos.y) SetCursorPos( center_pos.x, center_pos.y ); - InterlockedExchangeAdd(&mouseThreadDeltaX, mouse_pos.x); - InterlockedExchangeAdd(&mouseThreadDeltaY, mouse_pos.y); - } + InterlockedExchangeAdd(&mouseThreadDeltaX, mouse_pos.x); + InterlockedExchangeAdd(&mouseThreadDeltaY, mouse_pos.y); + } - MouseThread_ActiveLock_Exit(); - } - } + MouseThread_ActiveLock_Exit(); + } + } - return 0; + return 0; } /// Updates mouseThreadActive using the global variables mouseactive, iVisibleMouse and m_bRawInput. Should be called after any of these is changed. /// Has to be interlocked manually by programmer! Use MouseThread_ActiveLock_Enter and MouseThread_ActiveLock_Exit. void UpdateMouseThreadActive(void) { - InterlockedExchange(&mouseThreadActive, mouseactive && !iVisibleMouse && !m_bRawInput); + InterlockedExchange(&mouseThreadActive, mouseactive && !iVisibleMouse && !m_bRawInput); } #endif void IN_SetMouseMode(bool enable) { - static bool currentMouseMode = false; + static bool currentMouseMode = false; - if(enable == currentMouseMode) - return; + if(enable == currentMouseMode) + return; - if(enable) - { + if(enable) + { #ifdef _WIN32 - if (mouseparmsvalid) - restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0); + if (mouseparmsvalid) + restore_spi = SystemParametersInfo (SPI_SETMOUSE, 0, newmouseparms, 0); - m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; - if(m_bRawInput) - { + m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + if(m_bRawInput) + { #ifdef USE_SDL2 - safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); + safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); #endif - isMouseRelative = true; - } + isMouseRelative = true; + } #else - safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); + safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); #endif - currentMouseMode = true; - } - else - { + currentMouseMode = true; + } + else + { #ifdef _WIN32 - if(isMouseRelative) - { + if(isMouseRelative) + { #ifdef USE_SDL2 - safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); + safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); #endif - isMouseRelative = false; - } + isMouseRelative = false; + } - if (restore_spi) - SystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0); + if (restore_spi) + SystemParametersInfo (SPI_SETMOUSE, 0, originalmouseparms, 0); #else - safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); + safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); #endif - currentMouseMode = false; - } + currentMouseMode = false; + } } void IN_SetVisibleMouse(bool visible) { #ifdef _WIN32 - bool lockEntered = MouseThread_ActiveLock_Enter(); + bool lockEntered = MouseThread_ActiveLock_Enter(); #endif - iVisibleMouse = visible; + iVisibleMouse = visible; - IN_SetMouseMode(!visible); + IN_SetMouseMode(!visible); #ifdef _WIN32 - UpdateMouseThreadActive(); - if(lockEntered) MouseThread_ActiveLock_Exit(); + UpdateMouseThreadActive(); + if(lockEntered) MouseThread_ActiveLock_Exit(); #endif } @@ -445,24 +446,24 @@ IN_ActivateMouse */ void GoldSourceInput::IN_ActivateMouse (void) { - if (mouseinitialized) - { + if (mouseinitialized) + { #ifdef _WIN32 - bool lockEntered = MouseThread_ActiveLock_Enter(); + bool lockEntered = MouseThread_ActiveLock_Enter(); #endif - IN_SetMouseMode(true); + IN_SetMouseMode(true); - mouseactive = 1; + mouseactive = 1; #ifdef _WIN32 - UpdateMouseThreadActive(); - if(lockEntered) MouseThread_ActiveLock_Exit(); + UpdateMouseThreadActive(); + if(lockEntered) MouseThread_ActiveLock_Exit(); #endif - // now is a good time to reset mouse positon: - IN_ResetMouse(); - } + // now is a good time to reset mouse positon: + IN_ResetMouse(); + } } @@ -473,21 +474,21 @@ IN_DeactivateMouse */ void GoldSourceInput::IN_DeactivateMouse (void) { - if (mouseinitialized) - { + if (mouseinitialized) + { #ifdef _WIN32 - bool lockEntered = MouseThread_ActiveLock_Enter(); + bool lockEntered = MouseThread_ActiveLock_Enter(); #endif - IN_SetMouseMode(false); + IN_SetMouseMode(false); - mouseactive = 0; + mouseactive = 0; #ifdef _WIN32 - UpdateMouseThreadActive(); - if(lockEntered) MouseThread_ActiveLock_Exit(); + UpdateMouseThreadActive(); + if(lockEntered) MouseThread_ActiveLock_Exit(); #endif - } + } } /* @@ -497,34 +498,34 @@ IN_StartupMouse */ void GoldSourceInput::IN_StartupMouse (void) { - if ( gEngfuncs.CheckParm ("-nomouse", NULL ) ) - return; + if ( gEngfuncs.CheckParm ("-nomouse", NULL ) ) + return; - mouseinitialized = 1; + mouseinitialized = 1; #ifdef _WIN32 - mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0); + mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0); - if (mouseparmsvalid) - { - if ( gEngfuncs.CheckParm ("-noforcemspd", NULL ) ) - newmouseparms[2] = originalmouseparms[2]; + if (mouseparmsvalid) + { + if ( gEngfuncs.CheckParm ("-noforcemspd", NULL ) ) + newmouseparms[2] = originalmouseparms[2]; - if ( gEngfuncs.CheckParm ("-noforcemaccel", NULL ) ) - { - newmouseparms[0] = originalmouseparms[0]; - newmouseparms[1] = originalmouseparms[1]; - } + if ( gEngfuncs.CheckParm ("-noforcemaccel", NULL ) ) + { + newmouseparms[0] = originalmouseparms[0]; + newmouseparms[1] = originalmouseparms[1]; + } - if ( gEngfuncs.CheckParm ("-noforcemparms", NULL ) ) - { - newmouseparms[0] = originalmouseparms[0]; - newmouseparms[1] = originalmouseparms[1]; - newmouseparms[2] = originalmouseparms[2]; - } - } + if ( gEngfuncs.CheckParm ("-noforcemparms", NULL ) ) + { + newmouseparms[0] = originalmouseparms[0]; + newmouseparms[1] = originalmouseparms[1]; + newmouseparms[2] = originalmouseparms[2]; + } + } #endif - mouse_buttons = MOUSE_BUTTON_COUNT; + mouse_buttons = MOUSE_BUTTON_COUNT; } /* @@ -534,43 +535,43 @@ IN_Shutdown */ void GoldSourceInput::IN_Shutdown (void) { - IN_DeactivateMouse (); + IN_DeactivateMouse (); #ifdef _WIN32 - if ( s_hMouseQuitEvent ) - { - SetEvent( s_hMouseQuitEvent ); - } + if ( s_hMouseQuitEvent ) + { + SetEvent( s_hMouseQuitEvent ); + } - if ( s_hMouseThread ) - { - if(WAIT_OBJECT_0 != WaitForSingleObject( s_hMouseThread, 5000 )) - { - TerminateThread( s_hMouseThread, 0 ); - } - CloseHandle( s_hMouseThread ); - s_hMouseThread = (HANDLE)0; - } + if ( s_hMouseThread ) + { + if(WAIT_OBJECT_0 != WaitForSingleObject( s_hMouseThread, 5000 )) + { + TerminateThread( s_hMouseThread, 0 ); + } + CloseHandle( s_hMouseThread ); + s_hMouseThread = (HANDLE)0; + } - if ( s_hMouseQuitEvent ) - { - CloseHandle( s_hMouseQuitEvent ); - s_hMouseQuitEvent = (HANDLE)0; - } + if ( s_hMouseQuitEvent ) + { + CloseHandle( s_hMouseQuitEvent ); + s_hMouseQuitEvent = (HANDLE)0; + } - if( s_hMouseThreadActiveLock ) - { - CloseHandle( s_hMouseThreadActiveLock ); - s_hMouseThreadActiveLock = (HANDLE)0; - } + if( s_hMouseThreadActiveLock ) + { + CloseHandle( s_hMouseThreadActiveLock ); + s_hMouseThreadActiveLock = (HANDLE)0; + } #endif #ifdef USE_SDL2 - for (int j=0; jvalue; + // This is the default sensitivity + float mouse_senstivity = ( gHUD.GetSensitivity() != 0 ) ? gHUD.GetSensitivity() : sensitivity->value; - // Using special accleration values - if ( m_customaccel->value != 0 ) - { - float raw_mouse_movement_distance = sqrt( mx * mx + my * my ); - float acceleration_scale = m_customaccel_scale->value; - float accelerated_sensitivity_max = m_customaccel_max->value; - float accelerated_sensitivity_exponent = m_customaccel_exponent->value; - float accelerated_sensitivity = ( (float)pow( raw_mouse_movement_distance, accelerated_sensitivity_exponent ) * acceleration_scale + mouse_senstivity ); + // Using special accleration values + if ( m_customaccel->value != 0 ) + { + float raw_mouse_movement_distance = sqrt( mx * mx + my * my ); + float acceleration_scale = m_customaccel_scale->value; + float accelerated_sensitivity_max = m_customaccel_max->value; + float accelerated_sensitivity_exponent = m_customaccel_exponent->value; + float accelerated_sensitivity = ( (float)pow( raw_mouse_movement_distance, accelerated_sensitivity_exponent ) * acceleration_scale + mouse_senstivity ); - if ( accelerated_sensitivity_max > 0.0001f && - accelerated_sensitivity > accelerated_sensitivity_max ) - { - accelerated_sensitivity = accelerated_sensitivity_max; - } + if ( accelerated_sensitivity_max > 0.0001f && + accelerated_sensitivity > accelerated_sensitivity_max ) + { + accelerated_sensitivity = accelerated_sensitivity_max; + } - *x *= accelerated_sensitivity; - *y *= accelerated_sensitivity; + *x *= accelerated_sensitivity; + *y *= accelerated_sensitivity; - // Further re-scale by yaw and pitch magnitude if user requests alternate mode 2 - // This means that they will need to up their value for m_customaccel_scale greatly (>40x) since m_pitch/yaw default - // to 0.022 - if ( m_customaccel->value == 2 ) - { - *x *= m_yaw->value; - *y *= m_pitch->value; - } - } - else - { - // Just apply the default - *x *= mouse_senstivity; - *y *= mouse_senstivity; - } + // Further re-scale by yaw and pitch magnitude if user requests alternate mode 2 + // This means that they will need to up their value for m_customaccel_scale greatly (>40x) since m_pitch/yaw default + // to 0.022 + if ( m_customaccel->value == 2 ) + { + *x *= m_yaw->value; + *y *= m_pitch->value; + } + } + else + { + // Just apply the default + *x *= mouse_senstivity; + *y *= mouse_senstivity; + } } void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY) { - bool active = mouseactive && !iVisibleMouse; - int mx, my; + bool active = mouseactive && !iVisibleMouse; + int mx, my; - if(active) - { - int deltaX, deltaY; + if(active) + { + int deltaX, deltaY; #ifdef _WIN32 - if ( !m_bRawInput ) - { - if ( m_bMouseThread ) - { - // update mouseThreadSleep: - InterlockedExchange(&mouseThreadSleep, (LONG)m_mousethread_sleep->value); + if ( !m_bRawInput ) + { + if ( m_bMouseThread ) + { + // update mouseThreadSleep: + InterlockedExchange(&mouseThreadSleep, (LONG)m_mousethread_sleep->value); - bool lockEntered = MouseThread_ActiveLock_Enter(); + bool lockEntered = MouseThread_ActiveLock_Enter(); - current_pos.x = InterlockedExchange( &mouseThreadDeltaX, 0 ); - current_pos.y = InterlockedExchange( &mouseThreadDeltaY, 0 ); + current_pos.x = InterlockedExchange( &mouseThreadDeltaX, 0 ); + current_pos.y = InterlockedExchange( &mouseThreadDeltaY, 0 ); - if(lockEntered) MouseThread_ActiveLock_Exit(); - } - else - { - GetCursorPos (¤t_pos); - } - } - else + if(lockEntered) MouseThread_ActiveLock_Exit(); + } + else + { + GetCursorPos (¤t_pos); + } + } + else #endif - { + { #ifdef USE_SDL2 - safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY ); - current_pos.x = deltaX; - current_pos.y = deltaY; + safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY ); + current_pos.x = deltaX; + current_pos.y = deltaY; #else - GetCursorPos (¤t_pos); - deltaX = current_pos.x - gEngfuncs.GetWindowCenterX(); - deltaY = current_pos.y - gEngfuncs.GetWindowCenterY(); + GetCursorPos (¤t_pos); + deltaX = current_pos.x - gEngfuncs.GetWindowCenterX(); + deltaY = current_pos.y - gEngfuncs.GetWindowCenterY(); #endif - } + } #ifdef _WIN32 - if ( !m_bRawInput ) - { - if ( m_bMouseThread ) - { - mx = current_pos.x; - my = current_pos.y; - } - else - { - mx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum; - my = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum; - } - } - else + if ( !m_bRawInput ) + { + if ( m_bMouseThread ) + { + mx = current_pos.x; + my = current_pos.y; + } + else + { + mx = current_pos.x - gEngfuncs.GetWindowCenterX() + mx_accum; + my = current_pos.y - gEngfuncs.GetWindowCenterY() + my_accum; + } + } + else #endif - { - mx = deltaX + mx_accum; - my = deltaY + my_accum; - } + { + mx = deltaX + mx_accum; + my = deltaY + my_accum; + } - mx_accum = 0; - my_accum = 0; + mx_accum = 0; + my_accum = 0; - // reset mouse position if required, so there is room to move: + // reset mouse position if required, so there is room to move: #ifdef _WIN32 - // do not reset if mousethread would do it: - if ( m_bRawInput || !m_bMouseThread ) + // do not reset if mousethread would do it: + if ( m_bRawInput || !m_bMouseThread ) #else - if(true) + if(true) #endif - IN_ResetMouse(); + IN_ResetMouse(); #ifdef _WIN32 - // update m_bRawInput occasionally: - if ( gpGlobals && gpGlobals->time - s_flRawInputUpdateTime > 1.0f ) - { - s_flRawInputUpdateTime = gpGlobals->time; + // update m_bRawInput occasionally: + if ( gpGlobals && gpGlobals->time - s_flRawInputUpdateTime > 1.0f ) + { + s_flRawInputUpdateTime = gpGlobals->time; - bool lockEntered = MouseThread_ActiveLock_Enter(); + bool lockEntered = MouseThread_ActiveLock_Enter(); - m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; - if(m_bRawInput && !isMouseRelative) - { + if(m_bRawInput && !isMouseRelative) + { #ifdef USE_SDL2 - safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); + safe_pfnSDL_SetRelativeMouseMode(SDL_TRUE); #endif - isMouseRelative = true; - } - else if(!m_bRawInput && isMouseRelative) - { + isMouseRelative = true; + } + else if(!m_bRawInput && isMouseRelative) + { #ifdef USE_SDL2 - safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); + safe_pfnSDL_SetRelativeMouseMode(SDL_FALSE); #endif - isMouseRelative = false; - } + isMouseRelative = false; + } - UpdateMouseThreadActive(); - if(lockEntered) MouseThread_ActiveLock_Exit(); - } + UpdateMouseThreadActive(); + if(lockEntered) MouseThread_ActiveLock_Exit(); + } #endif - } - else - { - mx = my = 0; - } + } + else + { + mx = my = 0; + } - if(pOutX) *pOutX = mx; - if(pOutY) *pOutY = my; + if(pOutX) *pOutX = mx; + if(pOutY) *pOutY = my; } /* @@ -820,77 +825,93 @@ IN_MouseMove */ void GoldSourceInput::IN_MouseMove ( float frametime, usercmd_t *cmd) { - int mx, my; - vec3_t viewangles; + int mx, my; + vec3_t viewangles; - gEngfuncs.GetViewAngles( (float *)viewangles ); + if( gHUD.m_iIntermission ) + return; // we can't move during intermission - if ( in_mlook.state & 1) - { - V_StopPitchDrift (); - } + if( CL_IsDead() ) + { + viewangles = dead_viewangles; // HACKHACK: see below + } + else + { + gEngfuncs.GetViewAngles( viewangles ); + } - //jjb - this disbles normal mouse control if the user is trying to - // move the camera, or if the mouse cursor is visible or if we're in intermission - if ( !iMouseInUse && !gHUD.m_iIntermission && !iVisibleMouse ) - { - IN_GetMouseDelta( &mx, &my ); + if ( in_mlook.state & 1) + { + V_StopPitchDrift (); + } - if (m_filter && m_filter->value) - { - mouse_x = (mx + old_mouse_x) * 0.5; - mouse_y = (my + old_mouse_y) * 0.5; - } - else - { - mouse_x = mx; - mouse_y = my; - } + //jjb - this disbles normal mouse control if the user is trying to + // move the camera, or if the mouse cursor is visible or if we're in intermission + if ( !iMouseInUse && !gHUD.m_iIntermission && !iVisibleMouse ) + { + IN_GetMouseDelta( &mx, &my ); - old_mouse_x = mx; - old_mouse_y = my; + if (m_filter && m_filter->value) + { + mouse_x = (mx + old_mouse_x) * 0.5; + mouse_y = (my + old_mouse_y) * 0.5; + } + else + { + mouse_x = mx; + mouse_y = my; + } - // Apply custom mouse scaling/acceleration - IN_ScaleMouse( &mouse_x, &mouse_y ); + old_mouse_x = mx; + old_mouse_y = my; - // add mouse X/Y movement to cmd - if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) )) - cmd->sidemove += m_side->value * mouse_x; - else - viewangles[YAW] -= m_yaw->value * mouse_x; + // Apply custom mouse scaling/acceleration + IN_ScaleMouse( &mouse_x, &mouse_y ); - if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) - { - viewangles[PITCH] += m_pitch->value * mouse_y; - if (viewangles[PITCH] > cl_pitchdown->value) - viewangles[PITCH] = cl_pitchdown->value; - if (viewangles[PITCH] < -cl_pitchup->value) - viewangles[PITCH] = -cl_pitchup->value; - } - else - { - if ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() ) - { - cmd->upmove -= m_forward->value * mouse_y; - } - else - { - cmd->forwardmove -= m_forward->value * mouse_y; - } - } - } + // add mouse X/Y movement to cmd + if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) )) + cmd->sidemove += m_side->value * mouse_x; + else + viewangles[YAW] -= m_yaw->value * mouse_x; - gEngfuncs.SetViewAngles( (float *)viewangles ); + if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) + { + viewangles[PITCH] += m_pitch->value * mouse_y; + if (viewangles[PITCH] > cl_pitchdown->value) + viewangles[PITCH] = cl_pitchdown->value; + if (viewangles[PITCH] < -cl_pitchup->value) + viewangles[PITCH] = -cl_pitchup->value; + } + else + { + if ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() ) + { + cmd->upmove -= m_forward->value * mouse_y; + } + else + { + cmd->forwardmove -= m_forward->value * mouse_y; + } + } + } + // HACKHACK: change viewangles directly in viewcode, + // so viewangles when player is dead will not be changed on server + if( !CL_IsDead() ) + { + gEngfuncs.SetViewAngles( viewangles ); + } + + dead_viewangles = viewangles; // keep them actual /* //#define TRACE_TEST #if defined( TRACE_TEST ) - { - int mx, my; - void V_Move( int mx, int my ); - IN_GetMousePos( &mx, &my ); - V_Move( mx, my ); - } + { + int mx, my; + void V_Move( int mx, int my ); + IN_GetMousePos( &mx, &my ); + V_Move( mx, my ); + } #endif */ } @@ -902,49 +923,49 @@ IN_Accumulate */ void GoldSourceInput::IN_Accumulate (void) { - //only accumulate mouse if we are not moving the camera with the mouse - if ( !iMouseInUse && !iVisibleMouse) - { - if (mouseactive) - { + //only accumulate mouse if we are not moving the camera with the mouse + if ( !iMouseInUse && !iVisibleMouse) + { + if (mouseactive) + { #ifdef _WIN32 - if ( !m_bRawInput ) - { - if ( !m_bMouseThread ) - { - GetCursorPos (¤t_pos); + if ( !m_bRawInput ) + { + if ( !m_bMouseThread ) + { + GetCursorPos (¤t_pos); - mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); - my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); - } - } - else + mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); + my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); + } + } + else #endif - { + { #ifdef USE_SDL2 - int deltaX, deltaY; - safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY ); - mx_accum += deltaX; - my_accum += deltaY; + int deltaX, deltaY; + safe_pfnSDL_GetRelativeMouseState( &deltaX, &deltaY ); + mx_accum += deltaX; + my_accum += deltaY; #else - GetCursorPos (¤t_pos); + GetCursorPos (¤t_pos); - mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); - my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); + mx_accum += current_pos.x - gEngfuncs.GetWindowCenterX(); + my_accum += current_pos.y - gEngfuncs.GetWindowCenterY(); #endif - } + } - // force the mouse to the center, so there's room to move + // force the mouse to the center, so there's room to move #ifdef _WIN32 - // do not reset if mousethread would do it: - if ( m_bRawInput || !m_bMouseThread ) + // do not reset if mousethread would do it: + if ( m_bRawInput || !m_bMouseThread ) #else - if(true) + if(true) #endif - IN_ResetMouse(); + IN_ResetMouse(); - } - } + } + } } @@ -955,12 +976,12 @@ IN_ClearStates */ void GoldSourceInput::IN_ClearStates (void) { - if ( !mouseactive ) - return; + if ( !mouseactive ) + return; - mx_accum = 0; - my_accum = 0; - mouse_oldbuttonstate = 0; + mx_accum = 0; + my_accum = 0; + mouse_oldbuttonstate = 0; } /* @@ -970,136 +991,136 @@ IN_StartupJoystick */ void IN_StartupJoystick (void) { - // abort startup if user requests no joystick - if ( gEngfuncs.CheckParm ("-nojoy", NULL ) ) - return; + // abort startup if user requests no joystick + if ( gEngfuncs.CheckParm ("-nojoy", NULL ) ) + return; - // assume no joystick - joy_avail = 0; + // assume no joystick + joy_avail = 0; #ifdef USE_SDL2 - int nJoysticks = safe_pfnSDL_NumJoysticks(); - if ( nJoysticks > 0 ) - { - for ( int i = 0; i < nJoysticks; i++ ) - { - if ( safe_pfnSDL_IsGameController( i ) ) - { - s_pJoystick = safe_pfnSDL_GameControllerOpen( i ); - if ( s_pJoystick ) - { - //save the joystick's number of buttons and POV status - joy_numbuttons = SDL_CONTROLLER_BUTTON_MAX; - joy_haspov = 0; + int nJoysticks = safe_pfnSDL_NumJoysticks(); + if ( nJoysticks > 0 ) + { + for ( int i = 0; i < nJoysticks; i++ ) + { + if ( safe_pfnSDL_IsGameController( i ) ) + { + s_pJoystick = safe_pfnSDL_GameControllerOpen( i ); + if ( s_pJoystick ) + { + //save the joystick's number of buttons and POV status + joy_numbuttons = SDL_CONTROLLER_BUTTON_MAX; + joy_haspov = 0; - // old button and POV states default to no buttons pressed - joy_oldbuttonstate = joy_oldpovstate = 0; + // old button and POV states default to no buttons pressed + joy_oldbuttonstate = joy_oldpovstate = 0; - // mark the joystick as available and advanced initialization not completed - // this is needed as cvars are not available during initialization - gEngfuncs.Con_Printf ("joystick found\n\n", safe_pfnSDL_GameControllerName(s_pJoystick)); - joy_avail = 1; - joy_advancedinit = 0; - break; - } - } - } - } - else - { - gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); - } + // mark the joystick as available and advanced initialization not completed + // this is needed as cvars are not available during initialization + gEngfuncs.Con_Printf ("joystick found\n\n", safe_pfnSDL_GameControllerName(s_pJoystick)); + joy_avail = 1; + joy_advancedinit = 0; + break; + } + } + } + } + else + { + gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); + } #elif defined(_WIN32) - int numdevs; - JOYCAPS jc; - MMRESULT mmr; - // verify joystick driver is present - if ((numdevs = joyGetNumDevs ()) == 0) - { - gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); - return; - } + int numdevs; + JOYCAPS jc; + MMRESULT mmr; + // verify joystick driver is present + if ((numdevs = joyGetNumDevs ()) == 0) + { + gEngfuncs.Con_DPrintf ("joystick not found -- driver not present\n\n"); + return; + } - // cycle through the joystick ids for the first valid one - for (joy_id=0 ; joy_idvalue == 0.0) - { - // default joystick initialization - // 2 axes only with joystick control - dwAxisMap[JOY_AXIS_X] = AxisTurn; - // dwControlMap[JOY_AXIS_X] = JOY_ABSOLUTE_AXIS; - dwAxisMap[JOY_AXIS_Y] = AxisForward; - // dwControlMap[JOY_AXIS_Y] = JOY_ABSOLUTE_AXIS; - } - else - { - if ( strcmp ( joy_name->string, "joystick") != 0 ) - { - // notify user of advanced controller - gEngfuncs.Con_Printf ("\n%s configured\n\n", joy_name->string); - } + if( joy_advanced->value == 0.0) + { + // default joystick initialization + // 2 axes only with joystick control + dwAxisMap[JOY_AXIS_X] = AxisTurn; + // dwControlMap[JOY_AXIS_X] = JOY_ABSOLUTE_AXIS; + dwAxisMap[JOY_AXIS_Y] = AxisForward; + // dwControlMap[JOY_AXIS_Y] = JOY_ABSOLUTE_AXIS; + } + else + { + if ( strcmp ( joy_name->string, "joystick") != 0 ) + { + // notify user of advanced controller + gEngfuncs.Con_Printf ("\n%s configured\n\n", joy_name->string); + } - // advanced initialization here - // data supplied by user via joy_axisn cvars - dwTemp = (DWORD) joy_advaxisx->value; - dwAxisMap[JOY_AXIS_X] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_X] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisy->value; - dwAxisMap[JOY_AXIS_Y] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_Y] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisz->value; - dwAxisMap[JOY_AXIS_Z] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_Z] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisr->value; - dwAxisMap[JOY_AXIS_R] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_R] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisu->value; - dwAxisMap[JOY_AXIS_U] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_U] = dwTemp & JOY_RELATIVE_AXIS; - dwTemp = (DWORD) joy_advaxisv->value; - dwAxisMap[JOY_AXIS_V] = dwTemp & 0x0000000f; - dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS; - } + // advanced initialization here + // data supplied by user via joy_axisn cvars + dwTemp = (DWORD) joy_advaxisx->value; + dwAxisMap[JOY_AXIS_X] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_X] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisy->value; + dwAxisMap[JOY_AXIS_Y] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_Y] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisz->value; + dwAxisMap[JOY_AXIS_Z] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_Z] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisr->value; + dwAxisMap[JOY_AXIS_R] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_R] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisu->value; + dwAxisMap[JOY_AXIS_U] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_U] = dwTemp & JOY_RELATIVE_AXIS; + dwTemp = (DWORD) joy_advaxisv->value; + dwAxisMap[JOY_AXIS_V] = dwTemp & 0x0000000f; + dwControlMap[JOY_AXIS_V] = dwTemp & JOY_RELATIVE_AXIS; + } #if !defined(USE_SDL2) && defined(_WIN32) - // compute the axes to collect from DirectInput - joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV; - for (i = 0; i < JOY_MAX_AXES; i++) - { - if (dwAxisMap[i] != AxisNada) - { - joy_flags |= dwAxisFlags[i]; - } - } + // compute the axes to collect from DirectInput + joy_flags = JOY_RETURNCENTERED | JOY_RETURNBUTTONS | JOY_RETURNPOV; + for (i = 0; i < JOY_MAX_AXES; i++) + { + if (dwAxisMap[i] != AxisNada) + { + joy_flags |= dwAxisFlags[i]; + } + } #endif } @@ -1184,85 +1205,85 @@ IN_Commands */ void GoldSourceInput::IN_Commands (void) { - int i, key_index; + int i, key_index; - if (!joy_avail) - { - return; - } + if (!joy_avail) + { + return; + } - DWORD buttonstate, povstate; + DWORD buttonstate, povstate; - // loop through the joystick buttons - // key a joystick event or auxillary event for higher number buttons for each state change + // loop through the joystick buttons + // key a joystick event or auxillary event for higher number buttons for each state change #ifdef USE_SDL2 - buttonstate = 0; - for ( i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++ ) - { - if ( safe_pfnSDL_GameControllerGetButton( s_pJoystick, (SDL_GameControllerButton)i ) ) - { - buttonstate |= 1<value != 0.0) - { - ji.dwUpos += 100; - } - return 1; - } - else - { - // read error occurred - // turning off the joystick seems too harsh for 1 read error,\ - // but what should be done? - // Con_Printf ("IN_ReadJoystick: no response\n"); - // joy_avail = 0; - return 0; - } + if (joyGetPosEx (joy_id, &ji) == JOYERR_NOERROR) + { + // this is a hack -- there is a bug in the Logitech WingMan Warrior DirectInput Driver + // rather than having 32768 be the zero point, they have the zero point at 32668 + // go figure -- anyway, now we get the full resolution out of the device + if (joy_wwhack1->value != 0.0) + { + ji.dwUpos += 100; + } + return 1; + } + else + { + // read error occurred + // turning off the joystick seems too harsh for 1 read error,\ + // but what should be done? + // Con_Printf ("IN_ReadJoystick: no response\n"); + // joy_avail = 0; + return 0; + } #else - return 0; + return 0; #endif } @@ -1314,189 +1335,189 @@ IN_JoyMove */ void IN_JoyMove ( float frametime, usercmd_t *cmd ) { - float speed, aspeed; - float fAxisValue, fTemp; - int i; - vec3_t viewangles; + float speed, aspeed; + float fAxisValue, fTemp; + int i; + vec3_t viewangles; - gEngfuncs.GetViewAngles( (float *)viewangles ); + gEngfuncs.GetViewAngles( (float *)viewangles ); - // complete initialization if first time in - // this is needed as cvars are not available at initialization time - if( joy_advancedinit != 1 ) - { - Joy_AdvancedUpdate_f(); - joy_advancedinit = 1; - } + // complete initialization if first time in + // this is needed as cvars are not available at initialization time + if( joy_advancedinit != 1 ) + { + Joy_AdvancedUpdate_f(); + joy_advancedinit = 1; + } - // verify joystick is available and that the user wants to use it - if (!joy_avail || !in_joystick->value) - { - return; - } + // verify joystick is available and that the user wants to use it + if (!joy_avail || !in_joystick->value) + { + return; + } - // collect the joystick data, if possible - if (IN_ReadJoystick () != 1) - { - return; - } + // collect the joystick data, if possible + if (IN_ReadJoystick () != 1) + { + return; + } - if (in_speed.state & 1) - speed = cl_movespeedkey->value; - else - speed = 1; + if (in_speed.state & 1) + speed = cl_movespeedkey->value; + else + speed = 1; - aspeed = speed * frametime; + aspeed = speed * frametime; - // loop through the axes - for (i = 0; i < JOY_MAX_AXES; i++) - { - // get the floating point zero-centered, potentially-inverted data for the current axis + // loop through the axes + for (i = 0; i < JOY_MAX_AXES; i++) + { + // get the floating point zero-centered, potentially-inverted data for the current axis #ifdef USE_SDL2 - fAxisValue = (float)pdwRawValue[i]; + fAxisValue = (float)pdwRawValue[i]; #elif defined(_WIN32) - fAxisValue = (float) *pdwRawValue[i]; - fAxisValue -= 32768.0; + fAxisValue = (float) *pdwRawValue[i]; + fAxisValue -= 32768.0; #endif - if (joy_wwhack2->value != 0.0) - { - if (dwAxisMap[i] == AxisTurn) - { - // this is a special formula for the Logitech WingMan Warrior - // y=ax^b; where a = 300 and b = 1.3 - // also x values are in increments of 800 (so this is factored out) - // then bounds check result to level out excessively high spin rates - fTemp = 300.0 * pow(fabs(fAxisValue) / 800.0, 1.3); - if (fTemp > 14000.0) - fTemp = 14000.0; - // restore direction information - fAxisValue = (fAxisValue > 0.0) ? fTemp : -fTemp; - } - } + if (joy_wwhack2->value != 0.0) + { + if (dwAxisMap[i] == AxisTurn) + { + // this is a special formula for the Logitech WingMan Warrior + // y=ax^b; where a = 300 and b = 1.3 + // also x values are in increments of 800 (so this is factored out) + // then bounds check result to level out excessively high spin rates + fTemp = 300.0 * pow(fabs(fAxisValue) / 800.0, 1.3); + if (fTemp > 14000.0) + fTemp = 14000.0; + // restore direction information + fAxisValue = (fAxisValue > 0.0) ? fTemp : -fTemp; + } + } - // convert range from -32768..32767 to -1..1 - fAxisValue /= 32768.0; + // convert range from -32768..32767 to -1..1 + fAxisValue /= 32768.0; - switch (dwAxisMap[i]) - { - case AxisForward: - if ((joy_advanced->value == 0.0) && (in_jlook.state & 1)) - { - // user wants forward control to become look control - if (fabs(fAxisValue) > joy_pitchthreshold->value) - { - // if mouse invert is on, invert the joystick pitch value - // only absolute control support here (joy_advanced is 0) - if (m_pitch->value < 0.0) - { - viewangles[PITCH] -= (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; - } - else - { - viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; - } - V_StopPitchDrift(); - } - else - { - // no pitch movement - // disable pitch return-to-center unless requested by user - // *** this code can be removed when the lookspring bug is fixed - // *** the bug always has the lookspring feature on - if(lookspring->value == 0.0) - { - V_StopPitchDrift(); - } - } - } - else - { - // user wants forward control to be forward control - if (fabs(fAxisValue) > joy_forwardthreshold->value) - { - cmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value; - } - } - break; + switch (dwAxisMap[i]) + { + case AxisForward: + if ((joy_advanced->value == 0.0) && (in_jlook.state & 1)) + { + // user wants forward control to become look control + if (fabs(fAxisValue) > joy_pitchthreshold->value) + { + // if mouse invert is on, invert the joystick pitch value + // only absolute control support here (joy_advanced is 0) + if (m_pitch->value < 0.0) + { + viewangles[PITCH] -= (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; + } + else + { + viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; + } + V_StopPitchDrift(); + } + else + { + // no pitch movement + // disable pitch return-to-center unless requested by user + // *** this code can be removed when the lookspring bug is fixed + // *** the bug always has the lookspring feature on + if(lookspring->value == 0.0) + { + V_StopPitchDrift(); + } + } + } + else + { + // user wants forward control to be forward control + if (fabs(fAxisValue) > joy_forwardthreshold->value) + { + cmd->forwardmove += (fAxisValue * joy_forwardsensitivity->value) * speed * cl_forwardspeed->value; + } + } + break; - case AxisSide: - if (fabs(fAxisValue) > joy_sidethreshold->value) - { - cmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; - } - break; + case AxisSide: + if (fabs(fAxisValue) > joy_sidethreshold->value) + { + cmd->sidemove += (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; + } + break; - case AxisTurn: - if ((in_strafe.state & 1) || (lookstrafe->value && (in_jlook.state & 1))) - { - // user wants turn control to become side control - if (fabs(fAxisValue) > joy_sidethreshold->value) - { - cmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; - } - } - else - { - // user wants turn control to be turn control - if (fabs(fAxisValue) > joy_yawthreshold->value) - { - if(dwControlMap[i] == JOY_ABSOLUTE_AXIS) - { - viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * aspeed * cl_yawspeed->value; - } - else - { - viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * speed * 180.0; - } + case AxisTurn: + if ((in_strafe.state & 1) || (lookstrafe->value && (in_jlook.state & 1))) + { + // user wants turn control to become side control + if (fabs(fAxisValue) > joy_sidethreshold->value) + { + cmd->sidemove -= (fAxisValue * joy_sidesensitivity->value) * speed * cl_sidespeed->value; + } + } + else + { + // user wants turn control to be turn control + if (fabs(fAxisValue) > joy_yawthreshold->value) + { + if(dwControlMap[i] == JOY_ABSOLUTE_AXIS) + { + viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * aspeed * cl_yawspeed->value; + } + else + { + viewangles[YAW] += (fAxisValue * joy_yawsensitivity->value) * speed * 180.0; + } - } - } - break; + } + } + break; - case AxisLook: - if (in_jlook.state & 1) - { - if (fabs(fAxisValue) > joy_pitchthreshold->value) - { - // pitch movement detected and pitch movement desired by user - if(dwControlMap[i] == JOY_ABSOLUTE_AXIS) - { - viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; - } - else - { - viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * speed * 180.0; - } - V_StopPitchDrift(); - } - else - { - // no pitch movement - // disable pitch return-to-center unless requested by user - // *** this code can be removed when the lookspring bug is fixed - // *** the bug always has the lookspring feature on - if( lookspring->value == 0.0 ) - { - V_StopPitchDrift(); - } - } - } - break; + case AxisLook: + if (in_jlook.state & 1) + { + if (fabs(fAxisValue) > joy_pitchthreshold->value) + { + // pitch movement detected and pitch movement desired by user + if(dwControlMap[i] == JOY_ABSOLUTE_AXIS) + { + viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * aspeed * cl_pitchspeed->value; + } + else + { + viewangles[PITCH] += (fAxisValue * joy_pitchsensitivity->value) * speed * 180.0; + } + V_StopPitchDrift(); + } + else + { + // no pitch movement + // disable pitch return-to-center unless requested by user + // *** this code can be removed when the lookspring bug is fixed + // *** the bug always has the lookspring feature on + if( lookspring->value == 0.0 ) + { + V_StopPitchDrift(); + } + } + } + break; - default: - break; - } - } + default: + break; + } + } - // bounds check pitch - if (viewangles[PITCH] > cl_pitchdown->value) - viewangles[PITCH] = cl_pitchdown->value; - if (viewangles[PITCH] < -cl_pitchup->value) - viewangles[PITCH] = -cl_pitchup->value; + // bounds check pitch + if (viewangles[PITCH] > cl_pitchdown->value) + viewangles[PITCH] = cl_pitchdown->value; + if (viewangles[PITCH] < -cl_pitchup->value) + viewangles[PITCH] = -cl_pitchup->value; - gEngfuncs.SetViewAngles( (float *)viewangles ); + gEngfuncs.SetViewAngles( (float *)viewangles ); } /* @@ -1506,12 +1527,12 @@ IN_Move */ void GoldSourceInput::IN_Move ( float frametime, usercmd_t *cmd) { - if ( !iMouseInUse && mouseactive ) - { - IN_MouseMove ( frametime, cmd); - } + if ( !iMouseInUse && mouseactive ) + { + IN_MouseMove ( frametime, cmd); + } - IN_JoyMove ( frametime, cmd); + IN_JoyMove ( frametime, cmd); } /* @@ -1521,62 +1542,62 @@ IN_Init */ void GoldSourceInput::IN_Init (void) { - m_filter = gEngfuncs.pfnRegisterVariable ( "m_filter","0", FCVAR_ARCHIVE ); - sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE ); // user mouse sensitivity setting. + m_filter = gEngfuncs.pfnRegisterVariable ( "m_filter","0", FCVAR_ARCHIVE ); + sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE ); // user mouse sensitivity setting. - in_joystick = gEngfuncs.pfnRegisterVariable ( "joystick","0", FCVAR_ARCHIVE ); - joy_name = gEngfuncs.pfnRegisterVariable ( "joyname", "joystick", 0 ); - joy_advanced = gEngfuncs.pfnRegisterVariable ( "joyadvanced", "0", 0 ); - joy_advaxisx = gEngfuncs.pfnRegisterVariable ( "joyadvaxisx", "0", 0 ); - joy_advaxisy = gEngfuncs.pfnRegisterVariable ( "joyadvaxisy", "0", 0 ); - joy_advaxisz = gEngfuncs.pfnRegisterVariable ( "joyadvaxisz", "0", 0 ); - joy_advaxisr = gEngfuncs.pfnRegisterVariable ( "joyadvaxisr", "0", 0 ); - joy_advaxisu = gEngfuncs.pfnRegisterVariable ( "joyadvaxisu", "0", 0 ); - joy_advaxisv = gEngfuncs.pfnRegisterVariable ( "joyadvaxisv", "0", 0 ); - joy_forwardthreshold = gEngfuncs.pfnRegisterVariable ( "joyforwardthreshold", "0.15", 0 ); - joy_sidethreshold = gEngfuncs.pfnRegisterVariable ( "joysidethreshold", "0.15", 0 ); - joy_pitchthreshold = gEngfuncs.pfnRegisterVariable ( "joypitchthreshold", "0.15", 0 ); - joy_yawthreshold = gEngfuncs.pfnRegisterVariable ( "joyyawthreshold", "0.15", 0 ); - joy_forwardsensitivity = gEngfuncs.pfnRegisterVariable ( "joyforwardsensitivity", "-1.0", 0 ); - joy_sidesensitivity = gEngfuncs.pfnRegisterVariable ( "joysidesensitivity", "-1.0", 0 ); - joy_pitchsensitivity = gEngfuncs.pfnRegisterVariable ( "joypitchsensitivity", "1.0", 0 ); - joy_yawsensitivity = gEngfuncs.pfnRegisterVariable ( "joyyawsensitivity", "-1.0", 0 ); - joy_wwhack1 = gEngfuncs.pfnRegisterVariable ( "joywwhack1", "0.0", 0 ); - joy_wwhack2 = gEngfuncs.pfnRegisterVariable ( "joywwhack2", "0.0", 0 ); + in_joystick = gEngfuncs.pfnRegisterVariable ( "joystick","0", FCVAR_ARCHIVE ); + joy_name = gEngfuncs.pfnRegisterVariable ( "joyname", "joystick", 0 ); + joy_advanced = gEngfuncs.pfnRegisterVariable ( "joyadvanced", "0", 0 ); + joy_advaxisx = gEngfuncs.pfnRegisterVariable ( "joyadvaxisx", "0", 0 ); + joy_advaxisy = gEngfuncs.pfnRegisterVariable ( "joyadvaxisy", "0", 0 ); + joy_advaxisz = gEngfuncs.pfnRegisterVariable ( "joyadvaxisz", "0", 0 ); + joy_advaxisr = gEngfuncs.pfnRegisterVariable ( "joyadvaxisr", "0", 0 ); + joy_advaxisu = gEngfuncs.pfnRegisterVariable ( "joyadvaxisu", "0", 0 ); + joy_advaxisv = gEngfuncs.pfnRegisterVariable ( "joyadvaxisv", "0", 0 ); + joy_forwardthreshold = gEngfuncs.pfnRegisterVariable ( "joyforwardthreshold", "0.15", 0 ); + joy_sidethreshold = gEngfuncs.pfnRegisterVariable ( "joysidethreshold", "0.15", 0 ); + joy_pitchthreshold = gEngfuncs.pfnRegisterVariable ( "joypitchthreshold", "0.15", 0 ); + joy_yawthreshold = gEngfuncs.pfnRegisterVariable ( "joyyawthreshold", "0.15", 0 ); + joy_forwardsensitivity = gEngfuncs.pfnRegisterVariable ( "joyforwardsensitivity", "-1.0", 0 ); + joy_sidesensitivity = gEngfuncs.pfnRegisterVariable ( "joysidesensitivity", "-1.0", 0 ); + joy_pitchsensitivity = gEngfuncs.pfnRegisterVariable ( "joypitchsensitivity", "1.0", 0 ); + joy_yawsensitivity = gEngfuncs.pfnRegisterVariable ( "joyyawsensitivity", "-1.0", 0 ); + joy_wwhack1 = gEngfuncs.pfnRegisterVariable ( "joywwhack1", "0.0", 0 ); + joy_wwhack2 = gEngfuncs.pfnRegisterVariable ( "joywwhack2", "0.0", 0 ); - m_customaccel = gEngfuncs.pfnRegisterVariable ( "m_customaccel", "0", FCVAR_ARCHIVE ); - m_customaccel_scale = gEngfuncs.pfnRegisterVariable ( "m_customaccel_scale", "0.04", FCVAR_ARCHIVE ); - m_customaccel_max = gEngfuncs.pfnRegisterVariable ( "m_customaccel_max", "0", FCVAR_ARCHIVE ); - m_customaccel_exponent = gEngfuncs.pfnRegisterVariable ( "m_customaccel_exponent", "1", FCVAR_ARCHIVE ); + m_customaccel = gEngfuncs.pfnRegisterVariable ( "m_customaccel", "0", FCVAR_ARCHIVE ); + m_customaccel_scale = gEngfuncs.pfnRegisterVariable ( "m_customaccel_scale", "0.04", FCVAR_ARCHIVE ); + m_customaccel_max = gEngfuncs.pfnRegisterVariable ( "m_customaccel_max", "0", FCVAR_ARCHIVE ); + m_customaccel_exponent = gEngfuncs.pfnRegisterVariable ( "m_customaccel_exponent", "1", FCVAR_ARCHIVE ); #ifdef _WIN32 - m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; - m_bMouseThread = gEngfuncs.CheckParm ("-mousethread", NULL ) != NULL; - m_mousethread_sleep = gEngfuncs.pfnRegisterVariable ( "m_mousethread_sleep", "1", FCVAR_ARCHIVE ); // default to less than 1000 Hz + m_bRawInput = CVAR_GET_FLOAT( "m_rawinput" ) != 0; + m_bMouseThread = gEngfuncs.CheckParm ("-mousethread", NULL ) != NULL; + m_mousethread_sleep = gEngfuncs.pfnRegisterVariable ( "m_mousethread_sleep", "1", FCVAR_ARCHIVE ); // default to less than 1000 Hz - m_bMouseThread = m_bMouseThread && NULL != m_mousethread_sleep; + m_bMouseThread = m_bMouseThread && NULL != m_mousethread_sleep; - if (m_bMouseThread) - { - // init mouseThreadSleep: + if (m_bMouseThread) + { + // init mouseThreadSleep: #if 0 // _beginthreadex is not defined on VS 6? - InterlockedExchange(&mouseThreadSleep, (LONG)m_mousethread_sleep->value); + InterlockedExchange(&mouseThreadSleep, (LONG)m_mousethread_sleep->value); - s_hMouseQuitEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); - s_hMouseThreadActiveLock = CreateEvent( NULL, FALSE, TRUE, NULL ); - if ( s_hMouseQuitEvent && s_hMouseThreadActiveLock) - { - s_hMouseThread = (HANDLE)_beginthreadex( NULL, 0, MouseThread_Function, NULL, 0, &s_hMouseThreadId ); - } + s_hMouseQuitEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); + s_hMouseThreadActiveLock = CreateEvent( NULL, FALSE, TRUE, NULL ); + if ( s_hMouseQuitEvent && s_hMouseThreadActiveLock) + { + s_hMouseThread = (HANDLE)_beginthreadex( NULL, 0, MouseThread_Function, NULL, 0, &s_hMouseThreadId ); + } - m_bMouseThread = NULL != s_hMouseThread; + m_bMouseThread = NULL != s_hMouseThread; #else - m_bMouseThread = 0; + m_bMouseThread = 0; #endif - // at this early stage this won't print anything: - // gEngfuncs.Con_DPrintf ("Mouse thread %s.\n", m_bMouseThread ? "initalized" : "failed to initalize"); - } + // at this early stage this won't print anything: + // gEngfuncs.Con_DPrintf ("Mouse thread %s.\n", m_bMouseThread ? "initalized" : "failed to initalize"); + } #endif #ifdef USE_SDL2 @@ -1597,11 +1618,11 @@ void GoldSourceInput::IN_Init (void) gEngfuncs.Con_Printf("Could not load SDL2: %s\n", dlerror()); } #endif - gEngfuncs.pfnAddCommand ("force_centerview", Force_CenterView_f); - gEngfuncs.pfnAddCommand ("joyadvancedupdate", Joy_AdvancedUpdate_f); + gEngfuncs.pfnAddCommand ("force_centerview", Force_CenterView_f); + gEngfuncs.pfnAddCommand ("joyadvancedupdate", Joy_AdvancedUpdate_f); - IN_StartupMouse (); - IN_StartupJoystick (); + IN_StartupMouse (); + IN_StartupJoystick (); } #endif diff --git a/cl_dll/input_xash3d.cpp b/cl_dll/input_xash3d.cpp index 2ff572ee..2be1ffb3 100644 --- a/cl_dll/input_xash3d.cpp +++ b/cl_dll/input_xash3d.cpp @@ -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; diff --git a/cl_dll/message.cpp b/cl_dll/message.cpp index ff8d97bf..15e62188 100644 --- a/cl_dll/message.cpp +++ b/cl_dll/message.cpp @@ -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 ) { @@ -240,7 +242,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time ) { int i, j, length, width; const char *pText; - unsigned char line[80]; + const char *pLineStart; pText = pMessage->pMessage; // Count lines @@ -278,22 +280,21 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time ) { m_parms.lineLength = 0; m_parms.width = 0; + pLineStart = pText; while( *pText && *pText != '\n' ) { unsigned char c = *pText; - line[m_parms.lineLength] = c; m_parms.width += gHUD.m_scrinfo.charWidths[c]; m_parms.lineLength++; pText++; } pText++; // Skip LF - line[m_parms.lineLength] = 0; m_parms.x = XPosition( pMessage->x, m_parms.width, m_parms.totalWidth ); for( j = 0; j < m_parms.lineLength; j++ ) { - m_parms.text = line[j]; + m_parms.text = pLineStart[j]; int next = m_parms.x + gHUD.m_scrinfo.charWidths[m_parms.text]; MessageScanNextChar(); @@ -353,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 } } @@ -429,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 ); @@ -453,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; } diff --git a/cl_dll/saytext.cpp b/cl_dll/saytext.cpp index 8f2e2520..b084f44b 100644 --- a/cl_dll/saytext.cpp +++ b/cl_dll/saytext.cpp @@ -96,10 +96,7 @@ int CHudSayText::Draw( float flTime ) int y = Y_START; // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset - flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value ); - - // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset - flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value ); + flScrollTime = Q_min( flScrollTime, flTime + m_HUD_saytext_time->value ); if( flScrollTime <= flTime ) { @@ -126,8 +123,8 @@ int CHudSayText::Draw( float flTime ) static char buf[MAX_PLAYER_NAME_LENGTH + 32]; // draw the first x characters in the player color - strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) ); - buf[min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0; + strncpy( buf, g_szLineBuffer[i], Q_min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 32 ) ); + buf[Q_min( g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH + 31 )] = 0; DrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] ); int x = DrawConsoleString( LINE_START, y, buf ); @@ -196,7 +193,7 @@ void CHudSayText::SayTextPrint( const char *pszBuf, int iBufSize, int clientInde } } - strncpy( g_szLineBuffer[i], pszBuf, max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) ); + strncpy( g_szLineBuffer[i], pszBuf, Q_max( iBufSize - 1, MAX_CHARS_PER_LINE - 1 ) ); // make sure the text fits in one line EnsureTextFitsInOneLineAndWrapIfHaveTo( i ); diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index 5d52787c..721980f3 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -108,7 +108,7 @@ We have a minimum width of 1-320 - we could have the field widths scale with it? int SCOREBOARD_WIDTH = 320; // Y positions -#define ROW_GAP 13 +#define ROW_GAP (gHUD.m_scrinfo.iCharHeight) #define ROW_RANGE_MIN 15 #define ROW_RANGE_MAX ( ScreenHeight - 50 ) @@ -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; @@ -561,7 +561,7 @@ int CHudScoreboard::MsgFunc_TeamInfo( const char *pszName, int iSize, void *pbuf if( g_TeamInfo[j].name[0] == '\0' ) break; } - m_iNumTeams = max( j, m_iNumTeams ); + m_iNumTeams = Q_max( j, m_iNumTeams ); strncpy( g_TeamInfo[j].name, g_PlayerExtraInfo[i].teamname, MAX_TEAM_NAME ); g_TeamInfo[j].players = 0; diff --git a/cl_dll/statusbar.cpp b/cl_dll/statusbar.cpp index 98b317c5..79f30b7e 100644 --- a/cl_dll/statusbar.cpp +++ b/cl_dll/statusbar.cpp @@ -197,7 +197,7 @@ int CHudStatusBar::Draw( float fTime ) // let user set status ID bar centering if( ( i == STATUSBAR_ID_LINE ) && CVAR_GET_FLOAT( "hud_centerid" ) ) { - x = max( 0, max( 2, ( ScreenWidth - TextWidth ) ) / 2 ); + x = Q_max( 0, Q_max( 2, ( ScreenWidth - TextWidth ) ) / 2 ); y = ( ScreenHeight / 2 ) + ( TextHeight * CVAR_GET_FLOAT( "hud_centerid" ) ); } diff --git a/cl_dll/studio_util.cpp b/cl_dll/studio_util.cpp index 6e488dcb..7ac385fe 100644 --- a/cl_dll/studio_util.cpp +++ b/cl_dll/studio_util.cpp @@ -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]; } /* diff --git a/cl_dll/studio_util.h b/cl_dll/studio_util.h index 83de704c..12d165c5 100644 --- a/cl_dll/studio_util.h +++ b/cl_dll/studio_util.h @@ -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 diff --git a/cl_dll/util.cpp b/cl_dll/util.cpp index 655bde64..cda9fdf4 100644 --- a/cl_dll/util.cpp +++ b/cl_dll/util.cpp @@ -18,9 +18,9 @@ // implementation of class-less helper functions // -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include +#include +#include #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; diff --git a/cl_dll/util_vector.h b/cl_dll/util_vector.h index 477d97be..93166a6b 100644 --- a/cl_dll/util_vector.h +++ b/cl_dll/util_vector.h @@ -20,9 +20,9 @@ #define UTIL_VECTOR_H // Misc C-runtime library headers -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include +#include +#include // Header file containing definition of globalvars_t and entvars_t typedef unsigned int func_t; // diff --git a/cl_dll/view.cpp b/cl_dll/view.cpp index daecc3af..f67a994d 100644 --- a/cl_dll/view.cpp +++ b/cl_dll/view.cpp @@ -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 = min( bob, 4 ); - bob = 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; @@ -708,12 +712,12 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams ) if( dt > 0.0 ) { frac = ( t - ViewInterp.OriginTime[foundidx & ORIGIN_MASK] ) / dt; - frac = min( 1.0, frac ); + frac = Q_min( 1.0, frac ); VectorSubtract( ViewInterp.Origins[( foundidx + 1 ) & ORIGIN_MASK], ViewInterp.Origins[foundidx & ORIGIN_MASK], delta ); 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 = 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 { diff --git a/cl_dll/wscript b/cl_dll/wscript new file mode 100644 index 00000000..02a9d530 --- /dev/null +++ b/cl_dll/wscript @@ -0,0 +1,71 @@ +#! /usr/bin/env python +# encoding: utf-8 +# a1batross, mittorn, 2018 + +from waflib import Utils +import os + +def options(opt): + # stub + return + +def configure(conf): + if conf.env.GOLDSRC and conf.env.DEST_OS != 'win32': + conf.check_cc(lib='dl') + + if conf.env.DEST_OS == 'win32': + conf.check_cxx( lib='user32' ) + +def build(bld): + source = bld.path.parent.ant_glob([ + 'pm_shared/*.c', + 'dlls/crossbow.cpp', 'dlls/crowbar.cpp', 'dlls/egon.cpp', 'dlls/gauss.cpp', 'dlls/handgrenade.cpp', + 'dlls/hornetgun.cpp', 'dlls/mp5.cpp', 'dlls/python.cpp', 'dlls/rpg.cpp', 'dlls/satchel.cpp', + 'dlls/shotgun.cpp', 'dlls/squeakgrenade.cpp', 'dlls/tripmine.cpp', 'dlls/glock.cpp' + ]) + + source += bld.path.ant_glob(['hl/*.cpp']) + source += [ + 'ev_hldm.cpp', 'ammo.cpp', 'ammo_secondary.cpp', 'ammohistory.cpp', + 'battery.cpp', 'cdll_int.cpp', 'com_weapons.cpp', 'death.cpp', + 'demo.cpp', 'entity.cpp', 'ev_common.cpp', 'events.cpp', + 'flashlight.cpp', 'GameStudioModelRenderer.cpp', 'geiger.cpp', + 'health.cpp', 'hud.cpp', 'hud_msg.cpp', 'hud_redraw.cpp', + 'hud_spectator.cpp', 'hud_update.cpp', 'in_camera.cpp', + 'input.cpp', 'input_goldsource.cpp', 'input_mouse.cpp', + 'input_xash3d.cpp', 'menu.cpp', 'message.cpp', + 'overview.cpp', 'parsemsg.cpp', 'saytext.cpp', + 'status_icons.cpp', 'statusbar.cpp', 'studio_util.cpp', + 'StudioModelRenderer.cpp', 'text_message.cpp', 'train.cpp', + 'tri.cpp', 'util.cpp', 'view.cpp', 'scoreboard.cpp', 'MOTD.cpp' + ] + + includes = Utils.to_list('. hl/ ../dlls ../dlls/wpn_shared ../common ../engine ../pm_shared ../game_shared ../public ../utils/false_vgui/include') + + defines = ['CLIENT_DLL'] + if bld.env.GOLDSRC: + defines += ['GOLDSOURCE_SUPPORT'] + + libs = [] + if bld.env.GOLDSRC and bld.env.DEST_OS != 'win32': + libs += ['DL'] + + if bld.env.DEST_OS == 'win32': + libs += ["USER32"] + + if bld.env.DEST_OS not in ['android']: + install_path = os.path.join(bld.env.GAMEDIR, bld.env.CLIENT_DIR) + else: + install_path = bld.env.PREFIX + + bld.shlib( + source = source, + target = 'client', + features = 'c cxx', + includes = includes, + defines = defines, + use = libs, + install_path = install_path, + subsystem = bld.env.MSVC_SUBSYSTEM, + idx = bld.get_taskgen_count() + ) diff --git a/common/com_model.h b/common/com_model.h index abc8e8e6..631373fc 100644 --- a/common/com_model.h +++ b/common/com_model.h @@ -173,7 +173,7 @@ typedef struct mleaf_s } mleaf_t; -typedef struct msurface_s +struct msurface_s { int visframe; // should be drawn when node is crossed @@ -205,7 +205,7 @@ typedef struct msurface_s color24 *samples; // note: this is the actual lightmap data for this surface decal_t *pdecals; -} msurface_t; +}; typedef struct msurfmesh_s { diff --git a/common/mathlib.h b/common/mathlib.h index 6bcf76eb..afe44352 100644 --- a/common/mathlib.h +++ b/common/mathlib.h @@ -16,22 +16,31 @@ #pragma once #ifndef MATHLIB_H #define MATHLIB_H +#ifndef __cplusplus #include +#ifdef HAVE_TGMATH_H +#include +#endif // HAVE_TGMATH_H +#else // __cplusplus +#include +#endif // __cplusplus typedef float vec_t; -typedef vec_t vec2_t[2]; -#ifndef DID_VEC3_T_DEFINE +#if !defined DID_VEC3_T_DEFINE #define DID_VEC3_T_DEFINE typedef vec_t vec3_t[3]; #endif -typedef vec_t vec4_t[4]; // x,y,z,w #ifndef M_PI #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; diff --git a/dlls/CMakeLists.txt b/dlls/CMakeLists.txt index 3b1f4883..0aac88ff 100644 --- a/dlls/CMakeLists.txt +++ b/dlls/CMakeLists.txt @@ -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) diff --git a/dlls/aflock.cpp b/dlls/aflock.cpp index d50a8165..f69a99a9 100644 --- a/dlls/aflock.cpp +++ b/dlls/aflock.cpp @@ -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; diff --git a/dlls/agrunt.cpp b/dlls/agrunt.cpp index cb47ac65..28374a6b 100644 --- a/dlls/agrunt.cpp +++ b/dlls/agrunt.cpp @@ -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(); } diff --git a/dlls/animating.cpp b/dlls/animating.cpp index 95e8b86b..cab2c198 100644 --- a/dlls/animating.cpp +++ b/dlls/animating.cpp @@ -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 ); } } diff --git a/dlls/animation.cpp b/dlls/animation.cpp index f84ec380..6ebddc01 100644 --- a/dlls/animation.cpp +++ b/dlls/animation.cpp @@ -203,7 +203,7 @@ void SequencePrecache( void *pmodel, const char *pSequenceName ) // of it's name if it is. if( IsSoundEvent( pevent[i].event ) ) { - if( !strlen( pevent[i].options ) ) + if( pevent[i].options[0] == '\0' ) { ALERT( at_error, "Bad sound event %d in sequence %s :: %s (sound is \"%s\")\n", pevent[i].event, pstudiohdr->name, pSequenceName, pevent[i].options ); } @@ -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 ) diff --git a/dlls/apache.cpp b/dlls/apache.cpp index b3cfcf87..a863e3c2 100644 --- a/dlls/apache.cpp +++ b/dlls/apache.cpp @@ -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 diff --git a/dlls/barnacle.cpp b/dlls/barnacle.cpp index ecc1f5d4..8db34740 100644 --- a/dlls/barnacle.cpp +++ b/dlls/barnacle.cpp @@ -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; diff --git a/dlls/barney.cpp b/dlls/barney.cpp index 1f7740d0..6688e061 100644 --- a/dlls/barney.cpp +++ b/dlls/barney.cpp @@ -207,7 +207,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 ); } } } @@ -246,22 +246,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; } @@ -293,9 +293,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! @@ -343,7 +343,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; @@ -417,15 +417,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; } @@ -480,18 +480,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; } } @@ -504,10 +504,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() ); @@ -523,17 +523,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; } } diff --git a/dlls/bigmomma.cpp b/dlls/bigmomma.cpp index 434d6134..d67d10f7 100644 --- a/dlls/bigmomma.cpp +++ b/dlls/bigmomma.cpp @@ -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 diff --git a/dlls/bmodels.cpp b/dlls/bmodels.cpp index fe56b6ac..a8b8f00f 100644 --- a/dlls/bmodels.cpp +++ b/dlls/bmodels.cpp @@ -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 ) ) @@ -434,7 +434,7 @@ void CFuncRotating::Precache( void ) BOOL NullSound = FALSE; // set up fan sounds - if( !FStringNull( pev->message ) && strlen( szSoundFile ) > 0 ) + if( !FStringNull( pev->message ) && szSoundFile[0] != '\0' ) { // if a path is set for a wave, use it } @@ -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; diff --git a/dlls/bullsquid.cpp b/dlls/bullsquid.cpp index af3ab88a..01c9e590 100644 --- a/dlls/bullsquid.cpp +++ b/dlls/bullsquid.cpp @@ -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; } @@ -398,7 +398,7 @@ BOOL CBullsquid::FValidateHintType( short sHint ) } } - ALERT( at_aiconsole, "Couldn't validate hint type" ); + ALERT( at_aiconsole, "Couldn't validate hint type\n" ); return FALSE; } @@ -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[] = diff --git a/dlls/buttons.cpp b/dlls/buttons.cpp index 3df2a184..add00d4f 100644 --- a/dlls/buttons.cpp +++ b/dlls/buttons.cpp @@ -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(); @@ -694,7 +694,7 @@ CBaseButton::BUTTON_CODE CBaseButton::ButtonResponseToTouch( void ) void CBaseButton::ButtonTouch( CBaseEntity *pOther ) { // Ignore touches by anything but players - if( !FClassnameIs( pOther->pev, "player" ) ) + if( !pOther->IsPlayer() ) return; m_hActivator = pOther; @@ -795,7 +795,7 @@ void CBaseButton::ButtonReturn( void ) { ASSERT( m_toggle_state == TS_AT_TOP ); m_toggle_state = TS_GOING_DOWN; - + SetMoveDone( &CBaseButton::ButtonBackHome ); if( !m_fRotating ) LinearMove( m_vecPosition1, pev->speed ); @@ -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; @@ -1089,14 +1089,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; @@ -1108,9 +1108,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 ); @@ -1142,7 +1142,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 @@ -1154,23 +1154,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; } } @@ -1223,10 +1223,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(); } @@ -1261,7 +1261,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 ); } @@ -1269,7 +1269,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 ) @@ -1307,7 +1307,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 diff --git a/dlls/cbase.cpp b/dlls/cbase.cpp index 8750bddf..4e6292ba 100644 --- a/dlls/cbase.cpp +++ b/dlls/cbase.cpp @@ -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; diff --git a/dlls/cbase.h b/dlls/cbase.h index e200d7b0..a15638ab 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -363,6 +363,7 @@ public: #define SetTouch( a ) TouchSet( static_cast (a), #a ) #define SetUse( a ) UseSet( static_cast (a), #a ) #define SetBlocked( a ) BlockedSet( static_cast (a), #a ) +#define ResetThink() SetThink(NULL) #else diff --git a/dlls/client.cpp b/dlls/client.cpp index 1e7dab72..cade437a 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -51,6 +51,7 @@ extern int gmsgSayText; extern int gmsgBhopcap; extern cvar_t allow_spectators; +extern cvar_t multibyte_only; extern int g_teamplay; @@ -72,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; } @@ -169,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; @@ -195,6 +196,7 @@ void ClientPutInServer( edict_t *pEntity ) pPlayer = GetClassPtr( (CBasePlayer *)pev ); pPlayer->SetCustomDecalFrames( -1 ); // Assume none; + pPlayer->SetPrefsFromUserinfo( g_engfuncs.pfnGetInfoKeyBuffer( pEntity ) ); // Allocate a CBasePlayer for pev, and call spawn pPlayer->Spawn(); @@ -287,6 +289,10 @@ decodeFinishedMaybeCESU8: bool Q_UnicodeValidate( const char *pUTF8 ) { bool bError = false; + + if( !multibyte_only.value ) + return true; + while( *pUTF8 ) { unsigned int uVal; @@ -489,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 ) ); @@ -497,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 ) @@ -1097,8 +1103,8 @@ void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pv } } - *pvs = ENGINE_SET_PVS( (float *)&org ); - *pas = ENGINE_SET_PAS( (float *)&org ); + *pvs = ENGINE_SET_PVS( org ); + *pas = ENGINE_SET_PAS( org ); } #include "entity_state.h" @@ -1198,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) ); @@ -1656,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; @@ -1926,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 diff --git a/dlls/combat.cpp b/dlls/combat.cpp index 9f221cc9..c6ab3efe 100644 --- a/dlls/combat.cpp +++ b/dlls/combat.cpp @@ -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,8 +973,8 @@ 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() ); } diff --git a/dlls/compile.bat b/dlls/compile.bat index 53c4511b..f97806a5 100644 --- a/dlls/compile.bat +++ b/dlls/compile.bat @@ -8,105 +8,105 @@ echo -- Compiler is MSVC6 set XASH3DSRC=..\..\Xash3D_original set INCLUDES=-I../common -I../engine -I../pm_shared -I../game_shared -I../public -set SOURCES=agrunt.cpp^ - airtank.cpp^ - aflock.cpp^ - animating.cpp^ - animation.cpp^ - apache.cpp^ - barnacle.cpp^ - barney.cpp^ - bigmomma.cpp^ - bloater.cpp^ - bmodels.cpp^ - bullsquid.cpp^ - buttons.cpp^ - cbase.cpp^ - client.cpp^ - combat.cpp^ - controller.cpp^ - crossbow.cpp^ - crowbar.cpp^ - defaultai.cpp^ - doors.cpp^ - effects.cpp^ - egon.cpp^ - explode.cpp^ - flyingmonster.cpp^ - func_break.cpp^ - func_tank.cpp^ - game.cpp^ - gamerules.cpp^ - gargantua.cpp^ - gauss.cpp^ - genericmonster.cpp^ - ggrenade.cpp^ - globals.cpp^ - glock.cpp^ - gman.cpp^ - h_ai.cpp^ - h_battery.cpp^ - h_cine.cpp^ - h_cycler.cpp^ - h_export.cpp^ - handgrenade.cpp^ - hassassin.cpp^ - headcrab.cpp^ - healthkit.cpp^ - hgrunt.cpp^ - hornet.cpp^ - hornetgun.cpp^ - houndeye.cpp^ - ichthyosaur.cpp^ - islave.cpp^ - items.cpp^ - leech.cpp^ - lights.cpp^ - maprules.cpp^ - monstermaker.cpp^ - monsters.cpp^ - monsterstate.cpp^ - mortar.cpp^ - mp5.cpp^ - multiplay_gamerules.cpp^ - nihilanth.cpp^ - nodes.cpp^ - observer.cpp^ - osprey.cpp^ - pathcorner.cpp^ - plane.cpp^ - plats.cpp^ - player.cpp^ - playermonster.cpp^ - python.cpp^ - rat.cpp^ - roach.cpp^ - rpg.cpp^ - satchel.cpp^ - schedule.cpp^ - scientist.cpp^ - scripted.cpp^ - shotgun.cpp^ - singleplay_gamerules.cpp^ - skill.cpp^ - sound.cpp^ - soundent.cpp^ - spectator.cpp^ - squadmonster.cpp^ - squeakgrenade.cpp^ - subs.cpp^ - talkmonster.cpp^ - teamplay_gamerules.cpp^ - tempmonster.cpp^ - tentacle.cpp^ - triggers.cpp^ - tripmine.cpp^ - turret.cpp^ - util.cpp^ - weapons.cpp^ - world.cpp^ - xen.cpp^ - zombie.cpp^ +set SOURCES=agrunt.cpp ^ + airtank.cpp ^ + aflock.cpp ^ + animating.cpp ^ + animation.cpp ^ + apache.cpp ^ + barnacle.cpp ^ + barney.cpp ^ + bigmomma.cpp ^ + bloater.cpp ^ + bmodels.cpp ^ + bullsquid.cpp ^ + buttons.cpp ^ + cbase.cpp ^ + client.cpp ^ + combat.cpp ^ + controller.cpp ^ + crossbow.cpp ^ + crowbar.cpp ^ + defaultai.cpp ^ + doors.cpp ^ + effects.cpp ^ + egon.cpp ^ + explode.cpp ^ + flyingmonster.cpp ^ + func_break.cpp ^ + func_tank.cpp ^ + game.cpp ^ + gamerules.cpp ^ + gargantua.cpp ^ + gauss.cpp ^ + genericmonster.cpp ^ + ggrenade.cpp ^ + globals.cpp ^ + glock.cpp ^ + gman.cpp ^ + h_ai.cpp ^ + h_battery.cpp ^ + h_cine.cpp ^ + h_cycler.cpp ^ + h_export.cpp ^ + handgrenade.cpp ^ + hassassin.cpp ^ + headcrab.cpp ^ + healthkit.cpp ^ + hgrunt.cpp ^ + hornet.cpp ^ + hornetgun.cpp ^ + houndeye.cpp ^ + ichthyosaur.cpp ^ + islave.cpp ^ + items.cpp ^ + leech.cpp ^ + lights.cpp ^ + maprules.cpp ^ + monstermaker.cpp ^ + monsters.cpp ^ + monsterstate.cpp ^ + mortar.cpp ^ + mp5.cpp ^ + multiplay_gamerules.cpp ^ + nihilanth.cpp ^ + nodes.cpp ^ + observer.cpp ^ + osprey.cpp ^ + pathcorner.cpp ^ + plane.cpp ^ + plats.cpp ^ + player.cpp ^ + playermonster.cpp ^ + python.cpp ^ + rat.cpp ^ + roach.cpp ^ + rpg.cpp ^ + satchel.cpp ^ + schedule.cpp ^ + scientist.cpp ^ + scripted.cpp ^ + shotgun.cpp ^ + singleplay_gamerules.cpp ^ + skill.cpp ^ + sound.cpp ^ + soundent.cpp ^ + spectator.cpp ^ + squadmonster.cpp ^ + squeakgrenade.cpp ^ + subs.cpp ^ + talkmonster.cpp ^ + teamplay_gamerules.cpp ^ + tempmonster.cpp ^ + tentacle.cpp ^ + triggers.cpp ^ + tripmine.cpp ^ + turret.cpp ^ + util.cpp ^ + weapons.cpp ^ + world.cpp ^ + xen.cpp ^ + zombie.cpp ^ ../pm_shared/pm_debug.c ../pm_shared/pm_math.c ../pm_shared/pm_shared.c set DEFINES=/DCLIENT_WEAPONS /Dsnprintf=_snprintf /DNO_VOICEGAMEMGR set LIBS=user32.lib diff --git a/dlls/controller.cpp b/dlls/controller.cpp index e1d57517..1f851766 100644 --- a/dlls/controller.cpp +++ b/dlls/controller.cpp @@ -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 ); diff --git a/dlls/crossbow.cpp b/dlls/crossbow.cpp index 12d0ff8c..f0526188 100644 --- a/dlls/crossbow.cpp +++ b/dlls/crossbow.cpp @@ -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, (float *)&g_vecZero, (float *)&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, (float *)&g_vecZero, (float *)&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 ); } diff --git a/dlls/crowbar.cpp b/dlls/crowbar.cpp index 4cc48d97..ddcb15d8 100644 --- a/dlls/crowbar.cpp +++ b/dlls/crowbar.cpp @@ -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, (float *)&g_vecZero, (float *)&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,20 +276,27 @@ 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 + m_flNextPrimaryAttack = GetNextAttackDelay(0.25); +#endif return TRUE; + } else - flVol = 0.1; + flVol = 0.1f; fHitWorld = FALSE; } @@ -300,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 @@ -328,9 +335,13 @@ 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.25f; +#else + m_flNextPrimaryAttack = GetNextAttackDelay( 0.25f ); #endif - m_flNextPrimaryAttack = GetNextAttackDelay( 0.25 ); } #ifdef CROWBAR_IDLE_ANIM m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); @@ -345,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 ); diff --git a/dlls/doors.cpp b/dlls/doors.cpp index c12cc3a0..235669af 100644 --- a/dlls/doors.cpp +++ b/dlls/doors.cpp @@ -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 ) ) { @@ -520,10 +520,8 @@ void CBaseDoor::Precache( void ) // void CBaseDoor::DoorTouch( CBaseEntity *pOther ) { - entvars_t *pevToucher = pOther->pev; - // Ignore touches by anything but players - if( !FClassnameIs( pevToucher, "player" ) ) + if( !pOther->IsPlayer() ) return; // If door has master, and it's not ready to trigger, @@ -542,7 +540,7 @@ void CBaseDoor::DoorTouch( CBaseEntity *pOther ) m_hActivator = pOther;// remember who activated the door - if( DoorActivate()) + if( DoorActivate() ) SetTouch( NULL ); // Temporarily disable the touch function, until movement is finished. } @@ -613,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 ) { @@ -623,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 ); @@ -647,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 ); @@ -666,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; } } @@ -686,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 @@ -707,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 ); @@ -747,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 ) ) @@ -780,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 ) { @@ -868,8 +866,8 @@ 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; m_vecAngle2 = pev->angles + pev->movedir * m_flMoveDistance; @@ -885,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 @@ -897,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; @@ -926,6 +924,7 @@ public: void Spawn( void ); void Precache( void ); void EXPORT MomentaryMoveDone( void ); + void EXPORT StopMoveSound( void ); void KeyValue( KeyValueData *pkvd ); void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); @@ -959,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 ) ) @@ -1090,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,6 +1117,14 @@ void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP void CMomentaryDoor::MomentaryMoveDone( void ) { - STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) ); - EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM ); + SetThink(&CMomentaryDoor::StopMoveSound); + 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.0f, ATTN_NORM ); + pev->nextthink = -1.0f; + ResetThink(); } diff --git a/dlls/effects.cpp b/dlls/effects.cpp index bd12f8aa..e6ad257f 100644 --- a/dlls/effects.cpp +++ b/dlls/effects.cpp @@ -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 ) diff --git a/dlls/egon.cpp b/dlls/egon.cpp index b83c9086..a52e58ab 100644 --- a/dlls/egon.cpp +++ b/dlls/egon.cpp @@ -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, (float *)&g_vecZero, (float *)&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, (float *)&g_vecZero, (float *)&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, (float *)&m_pPlayer->pev->origin, (float *)&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; diff --git a/dlls/explode.cpp b/dlls/explode.cpp index f605dc02..a5815ddb 100644 --- a/dlls/explode.cpp +++ b/dlls/explode.cpp @@ -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 ) ) diff --git a/dlls/extdll.h b/dlls/extdll.h index d6ea4888..eb8c37ec 100644 --- a/dlls/extdll.h +++ b/dlls/extdll.h @@ -51,18 +51,26 @@ #ifndef TRUE #define TRUE (!FALSE) #endif +#include +#include typedef unsigned int ULONG; typedef unsigned char BYTE; typedef int BOOL; #define MAX_PATH PATH_MAX -#include -#include +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif #endif //_WIN32 // Misc C-runtime library headers -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include +#include +#include +#include + +#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 diff --git a/dlls/flyingmonster.cpp b/dlls/flyingmonster.cpp index c9822898..424f1dec 100644 --- a/dlls/flyingmonster.cpp +++ b/dlls/flyingmonster.cpp @@ -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; diff --git a/dlls/func_break.cpp b/dlls/func_break.cpp index 0cc3675f..27324260 100644 --- a/dlls/func_break.cpp +++ b/dlls/func_break.cpp @@ -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] ); diff --git a/dlls/func_tank.cpp b/dlls/func_tank.cpp index a3dba841..fd6ff1e7 100644 --- a/dlls/func_tank.cpp +++ b/dlls/func_tank.cpp @@ -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(); } diff --git a/dlls/game.cpp b/dlls/game.cpp index 62bc63a8..d09c11a9 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -31,6 +31,7 @@ cvar_t friendlyfire = { "mp_friendlyfire","0", FCVAR_SERVER }; cvar_t falldamage = { "mp_falldamage","0", FCVAR_SERVER }; cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER }; cvar_t selfgauss = { "mp_selfgauss", "1", FCVAR_SERVER }; +cvar_t chargerfix = { "mp_chargerfix", "0", FCVAR_SERVER }; cvar_t satchelfix = { "mp_satchelfix", "0", FCVAR_SERVER }; cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER }; cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER }; @@ -43,6 +44,7 @@ cvar_t allowmonsters = { "mp_allowmonsters","0", FCVAR_SERVER }; cvar_t bhopcap = { "mp_bhopcap", "1", FCVAR_SERVER }; cvar_t allow_spectators = { "allow_spectators", "0", FCVAR_SERVER }; // 0 prevents players from being spectators +cvar_t multibyte_only = { "mp_multibyte_only", "0", FCVAR_SERVER }; cvar_t mp_chattime = { "mp_chattime","10", FCVAR_SERVER }; @@ -475,6 +477,7 @@ void GameDLLInit( void ) CVAR_REGISTER( &falldamage ); CVAR_REGISTER( &weaponstay ); CVAR_REGISTER( &selfgauss ); + CVAR_REGISTER( &chargerfix ); CVAR_REGISTER( &satchelfix ); CVAR_REGISTER( &forcerespawn ); CVAR_REGISTER( &flashlight ); @@ -485,6 +488,7 @@ void GameDLLInit( void ) CVAR_REGISTER( &defaultteam ); CVAR_REGISTER( &allowmonsters ); CVAR_REGISTER( &bhopcap ); + CVAR_REGISTER( &multibyte_only ); CVAR_REGISTER( &mp_chattime ); diff --git a/dlls/game.h b/dlls/game.h index 0dc5ba87..7eb665c6 100644 --- a/dlls/game.h +++ b/dlls/game.h @@ -28,6 +28,7 @@ extern cvar_t friendlyfire; extern cvar_t falldamage; extern cvar_t weaponstay; extern cvar_t selfgauss; +extern cvar_t chargerfix; extern cvar_t satchelfix; extern cvar_t forcerespawn; extern cvar_t flashlight; diff --git a/dlls/gamerules.cpp b/dlls/gamerules.cpp index 24bffa46..7d2abc74 100644 --- a/dlls/gamerules.cpp +++ b/dlls/gamerules.cpp @@ -306,6 +306,11 @@ void CGameRules::RefreshSkillData ( void ) gSkillData.plrArm = GetSkillCvar( "sk_player_arm" ); } +void CGameRules::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer ) +{ + pPlayer->SetPrefsFromUserinfo( infobuffer ); +} + //========================================================= // instantiate the proper game rules object //========================================================= diff --git a/dlls/gamerules.h b/dlls/gamerules.h index 04c6eea5..22c73a47 100644 --- a/dlls/gamerules.h +++ b/dlls/gamerules.h @@ -98,7 +98,7 @@ public: virtual BOOL AllowAutoTargetCrosshair( void ) { return TRUE; }; virtual BOOL ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) { return FALSE; }; // handles the user commands; returns TRUE if command handled properly - virtual void ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer ) {} // the player has changed userinfo; can change it now + virtual void ClientUserInfoChanged( CBasePlayer *pPlayer, char *infobuffer ); // the player has changed userinfo; can change it now // Client kills/scoring virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled ) = 0;// how many points do I award whoever kills this player? diff --git a/dlls/gargantua.cpp b/dlls/gargantua.cpp index f3155d7f..b82bb02f 100644 --- a/dlls/gargantua.cpp +++ b/dlls/gargantua.cpp @@ -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; diff --git a/dlls/gauss.cpp b/dlls/gauss.cpp index 62af08e1..8bff79a1 100644 --- a/dlls/gauss.cpp +++ b/dlls/gauss.cpp @@ -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, (float *)&m_pPlayer->pev->origin, (float *)&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, (float *)&g_vecZero, (float *)&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, (float *)&g_vecZero, (float *)&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, (float *)&m_pPlayer->pev->origin, (float *)&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, (float *)&m_pPlayer->pev->origin, (float *)&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 ); diff --git a/dlls/ggrenade.cpp b/dlls/ggrenade.cpp index 0ca516c4..60b658b9 100644 --- a/dlls/ggrenade.cpp +++ b/dlls/ggrenade.cpp @@ -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; } diff --git a/dlls/glock.cpp b/dlls/glock.cpp index 1150d8b9..db0cf082 100644 --- a/dlls/glock.cpp +++ b/dlls/glock.cpp @@ -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; @@ -168,7 +168,7 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim ) Vector vecDir; vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_9MM, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGlock1 : m_usFireGlock2, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), fUseAutoAim ? m_usFireGlock1 : m_usFireGlock2, 0.0, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, ( m_iClip == 0 ) ? 1 : 0, 0 ); m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay( flCycleTime ); @@ -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 ); } diff --git a/dlls/h_ai.cpp b/dlls/h_ai.cpp index d8a35547..0cc5d306 100644 --- a/dlls/h_ai.cpp +++ b/dlls/h_ai.cpp @@ -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; diff --git a/dlls/h_battery.cpp b/dlls/h_battery.cpp index 976a5733..f0cf612b 100644 --- a/dlls/h_battery.cpp +++ b/dlls/h_battery.cpp @@ -26,6 +26,8 @@ #include "saverestore.h" #include "skill.h" #include "gamerules.h" +#include "weapons.h" +#include "game.h" class CRecharge : public CBaseToggle { @@ -104,8 +106,12 @@ void CRecharge::Precache() void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { + // Make sure that we have a caller + if( !pActivator ) + return; + // if it's not a player, ignore - if( !FClassnameIs( pActivator->pev, "player" ) ) + if( !pActivator->IsPlayer() ) return; // if there is no juice left, turn it off @@ -116,40 +122,33 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use } // if the player doesn't have the suit, or there is no juice left, make the deny noise - if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) ) + if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( ( chargerfix.value ) && ( pActivator->pev->armorvalue == MAX_NORMAL_BATTERY ) ) ) { 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? if( m_flNextCharge >= gpGlobals->time ) return; - // Make sure that we have a caller - if( !pActivator ) - return; - m_hActivator = pActivator; - //only recharge the player - if( !m_hActivator->IsPlayer() ) - return; - // Play the on sound or the looping charging sound if( !m_iOn ) { 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 ) ) { m_iOn++; @@ -167,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 ) diff --git a/dlls/h_cine.cpp b/dlls/h_cine.cpp index bb07e02c..55e7a631 100644 --- a/dlls/h_cine.cpp +++ b/dlls/h_cine.cpp @@ -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 ); diff --git a/dlls/h_cycler.cpp b/dlls/h_cycler.cpp index 5daad4a2..1c5a9150 100644 --- a/dlls/h_cycler.cpp +++ b/dlls/h_cycler.cpp @@ -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 ) { diff --git a/dlls/handgrenade.cpp b/dlls/handgrenade.cpp index c2bbd7f9..4d866708 100644 --- a/dlls/handgrenade.cpp +++ b/dlls/handgrenade.cpp @@ -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 ); diff --git a/dlls/hassassin.cpp b/dlls/hassassin.cpp index f51ed4cb..c98c940f 100644 --- a/dlls/hassassin.cpp +++ b/dlls/hassassin.cpp @@ -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; diff --git a/dlls/headcrab.cpp b/dlls/headcrab.cpp index 60e03c10..dea97ebe 100644 --- a/dlls/headcrab.cpp +++ b/dlls/headcrab.cpp @@ -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; } diff --git a/dlls/healthkit.cpp b/dlls/healthkit.cpp index 99d53d35..9e111300 100644 --- a/dlls/healthkit.cpp +++ b/dlls/healthkit.cpp @@ -22,6 +22,7 @@ #include "player.h" #include "items.h" #include "gamerules.h" +#include "game.h" extern int gmsgItemPickup; @@ -187,17 +188,17 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u } // if the player doesn't have the suit, or there is no juice left, make the deny noise - if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) ) + if( ( m_iJuice <= 0 ) || ( !( pActivator->pev->weapons & ( 1 << WEAPON_SUIT ) ) ) || ( ( chargerfix.value ) && ( pActivator->pev->health >= pActivator->pev->max_health ) ) ) { 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? @@ -209,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 ) ) { @@ -224,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 ) diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 62c947f1..bcb71005 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -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 ); } diff --git a/dlls/hornet.cpp b/dlls/hornet.cpp index 758ba7e9..6fc79aa7 100644 --- a/dlls/hornet.cpp +++ b/dlls/hornet.cpp @@ -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! } diff --git a/dlls/hornetgun.cpp b/dlls/hornetgun.cpp index cc63d6db..5e903b0d 100644 --- a/dlls/hornetgun.cpp +++ b/dlls/hornetgun.cpp @@ -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, (float *)&g_vecZero, (float *)&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, (float *)&g_vecZero, (float *)&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 ); } diff --git a/dlls/houndeye.cpp b/dlls/houndeye.cpp index cedee258..2b8cadb0 100644 --- a/dlls/houndeye.cpp +++ b/dlls/houndeye.cpp @@ -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 @@ -155,7 +155,7 @@ BOOL CHoundeye::FValidateHintType( short sHint ) } } - ALERT( at_aiconsole, "Couldn't validate hint type" ); + ALERT( at_aiconsole, "Couldn't validate hint type\n" ); return FALSE; } @@ -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 ); diff --git a/dlls/ichthyosaur.cpp b/dlls/ichthyosaur.cpp index 53f57a27..56ff96af 100644 --- a/dlls/ichthyosaur.cpp +++ b/dlls/ichthyosaur.cpp @@ -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; } diff --git a/dlls/islave.cpp b/dlls/islave.cpp index b516c09b..f66a57aa 100644 --- a/dlls/islave.cpp +++ b/dlls/islave.cpp @@ -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 ); diff --git a/dlls/items.cpp b/dlls/items.cpp index 45edeb5e..08a13711 100644 --- a/dlls/items.cpp +++ b/dlls/items.cpp @@ -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--; diff --git a/dlls/leech.cpp b/dlls/leech.cpp index 1d64eae1..092f338e 100644 --- a/dlls/leech.cpp +++ b/dlls/leech.cpp @@ -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; diff --git a/dlls/lights.cpp b/dlls/lights.cpp index 13e6d3a9..9ff839c3 100644 --- a/dlls/lights.cpp +++ b/dlls/lights.cpp @@ -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(); diff --git a/dlls/monsters.cpp b/dlls/monsters.cpp index 953d1a69..72eb331d 100644 --- a/dlls/monsters.cpp +++ b/dlls/monsters.cpp @@ -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(); @@ -1208,13 +1208,19 @@ void CBaseMonster::SetActivity( Activity NewActivity ) iSequence = LookupActivity( NewActivity ); + Activity OldActivity = m_Activity; + m_Activity = NewActivity; // Go ahead and set this so it doesn't keep trying when the anim is not present + + // In case someone calls this with something other than the ideal activity + m_IdealActivity = m_Activity; + // Set to the desired anim, or default anim if the desired is not present if( iSequence > ACTIVITY_NOT_AVAILABLE ) { if( pev->sequence != iSequence || !m_fSequenceLoops ) { // don't reset frame between walk and run - if( !( m_Activity == ACT_WALK || m_Activity == ACT_RUN ) || !( NewActivity == ACT_WALK || NewActivity == ACT_RUN ) ) + if( !( OldActivity == ACT_WALK || OldActivity == ACT_RUN ) || !( NewActivity == ACT_WALK || NewActivity == ACT_RUN ) ) pev->frame = 0; } @@ -1228,11 +1234,6 @@ void CBaseMonster::SetActivity( Activity NewActivity ) ALERT( at_aiconsole, "%s has no sequence for act:%d\n", STRING( pev->classname ), NewActivity ); pev->sequence = 0; // Set to the reset anim (if it's there) } - - m_Activity = NewActivity; // Go ahead and set this so it doesn't keep trying when the anim is not present - - // In case someone calls this with something other than the ideal activity - m_IdealActivity = m_Activity; } //========================================================= @@ -1356,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; } @@ -1477,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(); } @@ -1611,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(); @@ -1855,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 ) @@ -1890,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 @@ -1956,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; } @@ -2007,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 ); } @@ -2116,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 @@ -2213,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 ) @@ -2263,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 ) ) @@ -2317,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 ) @@ -2361,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 ) ) @@ -2813,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! @@ -2871,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. " ); } @@ -2896,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 ) @@ -3094,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 ) { @@ -3108,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 ) { @@ -3144,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; } @@ -3197,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 @@ -3222,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; } //========================================================= diff --git a/dlls/mp5.cpp b/dlls/mp5.cpp index 403efa04..fcfbd179 100644 --- a/dlls/mp5.cpp +++ b/dlls/mp5.cpp @@ -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; } @@ -151,9 +151,9 @@ void CMP5::PrimaryAttack() Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); Vector vecDir; #ifdef CLIENT_DLL - if( !bIsMultiplayer() ) + if( bIsMultiplayer() ) #else - if( !g_pGameRules->IsMultiplayer() ) + if( g_pGameRules->IsMultiplayer() ) #endif { // optimized multiplayer. Widened to make it easier to hit a moving player @@ -171,16 +171,16 @@ void CMP5::PrimaryAttack() #else flags = 0; #endif - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMP5, 0.0, (float *)&g_vecZero, (float *)&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 ) diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index de91ac6e..90dc4f3b 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -319,6 +319,11 @@ BOOL CHalfLifeMultiplay::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerI return TRUE; } + if( !pPlayer->m_iAutoWepSwitch ) + { + return FALSE; + } + if( !pPlayer->m_pActiveItem->CanHolster() ) { // can't put away the active item. @@ -1331,7 +1336,8 @@ int ReloadMapCycleFile( const char *filename, mapcycle_t *cycle ) hasbuffer = 0; pFileList = COM_Parse( pFileList ); - if( strlen( com_token ) <= 0 ) + + if( com_token[0] == '\0' ) break; strcpy( szMap, com_token ); @@ -1340,7 +1346,8 @@ int ReloadMapCycleFile( const char *filename, mapcycle_t *cycle ) if( COM_TokenWaiting( pFileList ) ) { pFileList = COM_Parse( pFileList ); - if( strlen( com_token ) > 0 ) + + if( com_token[0] != '\0' ) { hasbuffer = 1; strcpy( szBuffer, com_token ); @@ -1496,7 +1503,8 @@ void ExtractCommandString( char *s, char *szCommand ) *o = 0; strcat( szCommand, pkey ); - if( strlen( value ) > 0 ) + + if( value[0] != '\0' ) { strcat( szCommand, " " ); strcat( szCommand, value ); @@ -1631,13 +1639,15 @@ void CHalfLifeMultiplay::ChangeLevel( void ) { ALERT( at_console, "PLAYER COUNT: min %i max %i current %i\n", minplayers, maxplayers, curplayers ); } - if( strlen( szRules ) > 0 ) + + if( szRules[0] != '\0' ) { ALERT( at_console, "RULES: %s\n", szRules ); } CHANGE_LEVEL( szNextMap, NULL ); - if( strlen( szCommands ) > 0 ) + + if( szCommands[0] != '\0' ) { SERVER_COMMAND( szCommands ); } diff --git a/dlls/nihilanth.cpp b/dlls/nihilanth.cpp index 1d072db4..5a789f2b 100644 --- a/dlls/nihilanth.cpp +++ b/dlls/nihilanth.cpp @@ -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(); } } @@ -724,7 +724,7 @@ void CNihilanth::NextActivity() if( ( pev->health < gSkillData.nihilanthHealth / 2 || m_iActiveSpheres < N_SPHERES / 2 ) && m_hRecharger == 0 && m_iLevel <= 9 ) { - char szName[64]; + char szName[128]; CBaseEntity *pEnt = NULL; CBaseEntity *pRecharger = NULL; @@ -766,13 +766,13 @@ 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" ); if( iseq != pev->sequence ) { - char szText[64]; + char szText[128]; sprintf( szText, "%s%d", m_szDrawUse, m_iLevel ); FireTargets( szText, this, this, USE_ON, 1.0 ); @@ -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" ); } @@ -820,7 +820,7 @@ void CNihilanth::NextActivity() } else { - char szText[64]; + char szText[128]; sprintf( szText, "%s%d", m_szTeleportTouch, m_iTeleport ); CBaseEntity *pTouch = UTIL_FindEntityByTargetname( NULL, szText ); @@ -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,14 +1093,14 @@ 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: // prayer if( m_hEnemy != 0 ) { - char szText[32]; + char szText[128]; sprintf( szText, "%s%d", m_szTeleportTouch, m_iTeleport ); CBaseEntity *pTouch = UTIL_FindEntityByTargetname( NULL, szText ); @@ -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(); } diff --git a/dlls/nodes.cpp b/dlls/nodes.cpp index 04705638..c8d6296c 100644 --- a/dlls/nodes.cpp +++ b/dlls/nodes.cpp @@ -21,6 +21,7 @@ #include "cbase.h" #include "monsters.h" #include "nodes.h" +#include "nodes_compat.h" #include "animation.h" #include "doors.h" @@ -44,9 +45,7 @@ LINK_ENTITY_TO_CLASS( info_node_air, CNodeEnt ) #if !defined _WIN32 #include #include -#define CreateDirectory(p, n) mkdir(p, 0777) -#else -#define CreateDirectory(p, n) CreateDirectoryA(p, n) +#define CreateDirectoryA(p, n) mkdir(p, 0777) #endif //========================================================= @@ -668,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; @@ -710,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; @@ -720,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; @@ -838,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; @@ -908,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. @@ -1277,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 @@ -1443,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 )]; @@ -1517,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 @@ -1538,7 +1537,7 @@ void CTestHull::DropDelay( void ) SetThink( &CTestHull::CallBuildNodeGraph ); - pev->nextthink = gpGlobals->time + 1; + pev->nextthink = gpGlobals->time + 1.0f; } //========================================================= @@ -1624,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; @@ -1701,9 +1700,9 @@ void CTestHull::BuildNodeGraph( void ) // make sure directories have been made GET_GAME_DIR( szNrpFilename ); strcat( szNrpFilename, "/maps" ); - CreateDirectory( szNrpFilename, NULL ); + CreateDirectoryA( szNrpFilename, NULL ); strcat( szNrpFilename, "/graphs" ); - CreateDirectory( szNrpFilename, NULL ); + CreateDirectoryA( szNrpFilename, NULL ); strcat( szNrpFilename, "/" ); strcat( szNrpFilename, STRING( gpGlobals->mapname ) ); @@ -1738,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" ); @@ -1960,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; } @@ -2375,9 +2374,9 @@ int CGraph::FLoadGraph( const char *szMapName ) char szDirName[MAX_PATH]; GET_GAME_DIR( szDirName ); strcat( szDirName, "/maps" ); - CreateDirectory( szDirName, NULL ); + CreateDirectoryA( szDirName, NULL ); strcat( szDirName, "/graphs" ); - CreateDirectory( szDirName, NULL ); + CreateDirectoryA( szDirName, NULL ); strcpy( szFilename, "maps/graphs/" ); strcat( szFilename, szMapName ); @@ -2386,42 +2385,47 @@ int CGraph::FLoadGraph( const char *szMapName ) pMemFile = aMemFile = LOAD_FILE_FOR_ME( szFilename, &length ); if( !aMemFile ) - { return FALSE; - } - else + + // Read the graph version number + // + length -= sizeof(int); + if( length < 0 ) + goto ShortFile; + iVersion = *(int *) pMemFile; + pMemFile += sizeof(int); + + if( iVersion == GRAPH_VERSION || iVersion == GRAPH_VERSION_RETAIL ) { - // Read the graph version number - // - length -= sizeof(int); - if( length < 0 ) - goto ShortFile; - memcpy( &iVersion, pMemFile, sizeof(int) ); - pMemFile += sizeof(int); - - if( iVersion != GRAPH_VERSION ) - { - // This file was written by a different build of the dll! - // - ALERT( at_aiconsole, "**ERROR** Graph version is %d, expected %d\n", iVersion, GRAPH_VERSION ); - goto ShortFile; - } - // Read the graph class // - length -= sizeof(CGraph); - if( length < 0 ) - goto ShortFile; - memcpy( this, pMemFile, sizeof(CGraph) ); - pMemFile += sizeof(CGraph); + if ( iVersion == GRAPH_VERSION ) + { + length -= sizeof(CGraph); + if( length < 0 ) + goto ShortFile; + memcpy( this, pMemFile, sizeof(CGraph) ); + pMemFile += sizeof(CGraph); - // Set the pointers to zero, just in case we run out of memory. - // - m_pNodes = NULL; - m_pLinkPool = NULL; - m_di = NULL; - m_pRouteInfo = NULL; - m_pHashLinks = NULL; + // Set the pointers to zero, just in case we run out of memory. + // + m_pNodes = NULL; + m_pLinkPool = NULL; + m_di = NULL; + m_pRouteInfo = NULL; + m_pHashLinks = NULL; + } +#if _GRAPH_VERSION != _GRAPH_VERSION_RETAIL + else + { + ALERT( at_aiconsole, "Loading CGraph in GRAPH_VERSION 16 compatibility mode\n" ); + length -= sizeof(CGraph_Retail); + if( length < 0 ) + goto ShortFile; + reinterpret_cast(pMemFile) -> copyOverTo(this); + pMemFile += sizeof(CGraph_Retail); + } +#endif // Malloc for the nodes // @@ -2453,11 +2457,25 @@ int CGraph::FLoadGraph( const char *szMapName ) // Read in all the links // - length -= sizeof(CLink) * m_cLinks; - if( length < 0 ) - goto ShortFile; - memcpy( m_pLinkPool, pMemFile, sizeof(CLink) * m_cLinks ); - pMemFile += sizeof(CLink) * m_cLinks; + if( iVersion == GRAPH_VERSION ) + { + length -= sizeof(CLink) * m_cLinks; + if( length < 0 ) + goto ShortFile; + memcpy( m_pLinkPool, pMemFile, sizeof(CLink) * m_cLinks ); + pMemFile += sizeof(CLink) * m_cLinks; + } +#if _GRAPH_VERSION != _GRAPH_VERSION_RETAIL + else + { + ALERT( at_aiconsole, "Loading CLink array in GRAPH_VERSION 16 compatibility mode\n" ); + length -= sizeof(CLink_Retail) * m_cLinks; + if( length < 0 ) + goto ShortFile; + reinterpret_cast(pMemFile) -> copyOverTo(m_pLinkPool); + pMemFile += sizeof(CLink_Retail) * m_cLinks; + } +#endif // Malloc for the sorting info. // @@ -2482,7 +2500,7 @@ int CGraph::FLoadGraph( const char *szMapName ) m_pRouteInfo = (signed char *)calloc( sizeof(signed char), m_nRouteInfo ); if( !m_pRouteInfo ) { - ALERT( at_aiconsole, "***ERROR**\nCounldn't malloc %d route bytes!\n", m_nRouteInfo ); + ALERT( at_aiconsole, "***ERROR**\nCouldn't malloc %d route bytes!\n", m_nRouteInfo ); goto NoMemory; } m_CheckedCounter = 0; @@ -2505,7 +2523,7 @@ int CGraph::FLoadGraph( const char *szMapName ) m_pHashLinks = (short *)calloc( sizeof(short), m_nHashLinks ); if( !m_pHashLinks ) { - ALERT( at_aiconsole, "***ERROR**\nCounldn't malloc %d hash link bytes!\n", m_nHashLinks ); + ALERT( at_aiconsole, "***ERROR**\nCouldn't malloc %d hash link bytes!\n", m_nHashLinks ); goto NoMemory; } @@ -2531,6 +2549,13 @@ int CGraph::FLoadGraph( const char *szMapName ) return TRUE; } + else + { + // This file was written by a different build of the dll! + // + ALERT( at_aiconsole, "**ERROR** Graph version is %d, expected %d\n", iVersion, GRAPH_VERSION ); + goto ShortFile; + } ShortFile: NoMemory: @@ -2558,9 +2583,9 @@ int CGraph::FSaveGraph( const char *szMapName ) // make sure directories have been made GET_GAME_DIR( szFilename ); strcat( szFilename, "/maps" ); - CreateDirectory( szFilename, NULL ); + CreateDirectoryA( szFilename, NULL ); strcat( szFilename, "/graphs" ); - CreateDirectory( szFilename, NULL ); + CreateDirectoryA( szFilename, NULL ); strcat( szFilename, "/" ); strcat( szFilename, szMapName ); @@ -3492,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 ) diff --git a/dlls/nodes.h b/dlls/nodes.h index 52b715e5..4bc1ec1b 100644 --- a/dlls/nodes.h +++ b/dlls/nodes.h @@ -105,11 +105,14 @@ typedef struct //========================================================= // CGraph //========================================================= +#define _GRAPH_VERSION_RETAIL 16 // Retail Half-Life graph version. Don't increment this #ifdef XASH_64BIT -#define GRAPH_VERSION (int)16 * 10 +#define _GRAPH_VERSION (16 * 10) #else -#define GRAPH_VERSION (int)16// !!!increment this whever graph/node/link classes change, to obsolesce older disk files. +#define _GRAPH_VERSION (16) // !!!increment this whenever graph/node/link classes change, to obsolesce older disk files. #endif +#define GRAPH_VERSION (int)_GRAPH_VERSION +#define GRAPH_VERSION_RETAIL (int)_GRAPH_VERSION_RETAIL class CGraph { diff --git a/dlls/nodes_compat.h b/dlls/nodes_compat.h new file mode 100644 index 00000000..d73567e9 --- /dev/null +++ b/dlls/nodes_compat.h @@ -0,0 +1,143 @@ + +#pragma once +#ifndef NODES_32BIT_COMPAT +#define NODES_32BIT_COMPAT + +//#include "nodes.h" + +#if _GRAPH_VERSION != _GRAPH_VERSION_RETAIL + +#include "stdint.h" + +typedef int32_t PTR32; + +class CGraph_Retail +{ +public: + + BOOL m_fGraphPresent; + BOOL m_fGraphPointersSet; + BOOL m_fRoutingComplete; + + PTR32 m_pNodes; // CNode* + PTR32 m_pLinkPool; // CLink* + PTR32 m_pRouteInfo; // signed char* + + int m_cNodes; + int m_cLinks; + int m_nRouteInfo; + + PTR32 m_di; // DIST_INFO* + int m_RangeStart[3][NUM_RANGES]; + int m_RangeEnd[3][NUM_RANGES]; + float m_flShortest; + int m_iNearest; + int m_minX, m_minY, m_minZ, m_maxX, m_maxY, m_maxZ; + int m_minBoxX, m_minBoxY, m_minBoxZ, m_maxBoxX, m_maxBoxY, m_maxBoxZ; + int m_CheckedCounter; + float m_RegionMin[3], m_RegionMax[3]; + CACHE_ENTRY m_Cache[CACHE_SIZE]; + + + int m_HashPrimes[16]; + PTR32 m_pHashLinks; // short* + int m_nHashLinks; + + int m_iLastActiveIdleSearch; + + int m_iLastCoverSearch; + + + void copyOverTo(CGraph *other) { + other->m_fGraphPresent = m_fGraphPresent; + other->m_fGraphPointersSet = m_fGraphPointersSet; + other->m_fRoutingComplete = m_fRoutingComplete; + + other->m_pNodes = NULL; + other->m_pLinkPool = NULL; + other->m_pRouteInfo = NULL; + + other->m_cNodes = m_cNodes; + other->m_cLinks = m_cLinks; + other->m_nRouteInfo = m_nRouteInfo; + + other->m_di = NULL; + + memcpy( (void *) &other->m_RangeStart, (void *) m_RangeStart, + offsetof(class CGraph, m_pHashLinks) - offsetof(class CGraph, m_RangeStart) ); + +#if 0 // replacement routine in case a change in CGraph breaks the above memcpy + for (int i = 0; i < 3; ++i) + for (int j = 0; j < NUM_RANGES; ++j) + other->m_RangeStart[i][j] = m_RangeStart[i][j]; +// m_RangeStart[3][NUM_RANGES] + for (int i = 0; i < 3; ++i) + for (int j = 0; j < NUM_RANGES; ++j) + other->m_RangeEnd[i][j] = m_RangeEnd[i][j]; +// m_RangeEnd[3][NUM_RANGES] + other->m_flShortest = m_flShortest; + other->m_iNearest = m_iNearest; + other->m_minX = m_minX; + other->m_minY = m_minY; + other->m_minZ = m_minZ; + other->m_maxX = m_maxX; + other->m_maxY = m_maxY; + other->m_maxZ = m_maxZ; + other->m_minBoxX = m_minBoxX; + other->m_minBoxY = m_minBoxY; + other->m_minBoxZ = m_minBoxZ; + other->m_maxBoxX = m_maxBoxX; + other->m_maxBoxY = m_maxBoxY; + other->m_maxBoxZ = m_maxBoxZ; + other->m_CheckedCounter = m_CheckedCounter; + for (int i = 0; i < 3; ++i) + other->m_RegionMin[i] = m_RegionMin[i]; +// m_RegionMin[3] + for (int i = 0; i < 3; ++i) + other->m_RegionMax[i] = m_RegionMax[i]; +// m_RegionMax[3] + for (int i = 0; i < CACHE_SIZE; ++i) + other->m_Cache[i] = m_Cache[i]; +// m_Cache[CACHE_SIZE] + for (int i = 0; i < 16; ++i) + other->m_HashPrimes[i] = m_HashPrimes[i]; +// m_HashPrimes[16] +#endif + + other->m_pHashLinks = NULL; + other->m_nHashLinks = m_nHashLinks; + + other->m_iLastActiveIdleSearch = m_iLastActiveIdleSearch; + + other->m_iLastCoverSearch = m_iLastCoverSearch; + + } + +}; + + +class CLink_Retail +{ + +public: + int m_iSrcNode; + int m_iDestNode; + PTR32 m_pLinkEnt; // entvars_t* + char m_szLinkEntModelname[ 4 ]; + int m_afLinkInfo; + float m_flWeight; + + void copyOverTo(CLink* other) { + other->m_iSrcNode = m_iSrcNode; + other->m_iDestNode = m_iDestNode ; + other->m_pLinkEnt = NULL; + for (int i = 0; i < 4; ++i) + other->m_szLinkEntModelname[i] = m_szLinkEntModelname[i]; +// m_szLinkEntModelname[ 4 ] + other->m_afLinkInfo = m_afLinkInfo; + other->m_flWeight = m_flWeight; + } +}; + +#endif +#endif diff --git a/dlls/observer.cpp b/dlls/observer.cpp index 22fa3818..79e1c9c1 100644 --- a/dlls/observer.cpp +++ b/dlls/observer.cpp @@ -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; } } diff --git a/dlls/osprey.cpp b/dlls/osprey.cpp index 6a421645..8cd8ed1e 100644 --- a/dlls/osprey.cpp +++ b/dlls/osprey.cpp @@ -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 diff --git a/dlls/plats.cpp b/dlls/plats.cpp index b3e1c683..d74129e7 100644 --- a/dlls/plats.cpp +++ b/dlls/plats.cpp @@ -358,8 +358,7 @@ void CPlatTrigger::SpawnInsideTrigger( CFuncPlat *pPlatform ) void CPlatTrigger::Touch( CBaseEntity *pOther ) { // Ignore touches by non-players - entvars_t *pevToucher = pOther->pev; - if( !FClassnameIs( pevToucher, "player" ) ) + if( !pOther->IsPlayer() ) return; CFuncPlat *pPlatform = (CFuncPlat*)(CBaseEntity*)m_hPlatform; @@ -586,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 { @@ -648,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 ); } @@ -745,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. @@ -755,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 @@ -773,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 ); } } @@ -792,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 @@ -836,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 ) @@ -884,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; } } } @@ -939,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" ) ) @@ -978,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 @@ -1011,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 ) @@ -1023,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 ); } } @@ -1059,7 +1058,7 @@ void CFuncTrackTrain::StopSound( void ) us_encode = us_sound; PLAYBACK_EVENT_FULL( FEV_RELIABLE | FEV_UPDATE, edict(), m_usAdjustPitch, 0.0, - (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, us_encode, 0, 1, 0 ); + g_vecZero, g_vecZero, 0.0, 0.0, us_encode, 0, 1, 0 ); /* STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noise ) ); */ @@ -1101,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, - (float *)&g_vecZero, (float *)&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 ); } } @@ -1136,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; @@ -1210,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 ); } } @@ -1349,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; @@ -1398,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 ); } @@ -1464,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(); } @@ -1473,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 ) { @@ -1668,7 +1667,7 @@ void CFuncTrackChange::Spawn( void ) } EnableUse(); - pev->nextthink = pev->ltime + 2.0; + pev->nextthink = pev->ltime + 2.0f; SetThink( &CFuncTrackChange::Find ); Precache(); } @@ -1715,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 ); } @@ -1741,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 ); @@ -1808,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 ) @@ -2109,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; } } @@ -2122,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 ); } } @@ -2144,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 ) diff --git a/dlls/player.cpp b/dlls/player.cpp index 926bf1e1..6b741778 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -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; @@ -2762,7 +2762,7 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) } // If startspot is set, (re)spawn there. - if( FStringNull( gpGlobals->startspot ) || !strlen(STRING( gpGlobals->startspot ) ) ) + if( FStringNull( gpGlobals->startspot ) || (STRING( gpGlobals->startspot ) )[0] == '\0') { pSpot = UTIL_FindEntityByClassname( NULL, "info_player_start" ); if( !FNullEnt( pSpot ) ) @@ -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(); @@ -2876,6 +2876,8 @@ void CBasePlayer::Spawn( void ) m_flNextChatTime = gpGlobals->time; + m_iAutoWepSwitch = 1; + g_pGameRules->PlayerSpawn( this ); } @@ -3173,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 ); } @@ -3212,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 @@ -3229,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 ) @@ -3244,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; } //============================================== @@ -3273,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; @@ -3409,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; @@ -3431,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; } @@ -3580,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 ); @@ -4102,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. @@ -4158,6 +4160,18 @@ int CBasePlayer::Illumination( void ) return iIllum; } +void CBasePlayer::SetPrefsFromUserinfo( char *infobuffer ) +{ + const char *pszKeyVal; + + pszKeyVal = g_engfuncs.pfnInfoKeyValue( infobuffer, "cl_autowepswitch" ); + + if( pszKeyVal[0] != '\0' ) + m_iAutoWepSwitch = atoi( pszKeyVal ); + else + m_iAutoWepSwitch = 1; +} + void CBasePlayer::EnableControl( BOOL fControl ) { if( !fControl ) @@ -4193,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! @@ -4236,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; @@ -4338,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; @@ -4432,7 +4446,7 @@ void CBasePlayer::DropPlayerItem( char *pszItemName ) return; } - if( !strlen( pszItemName ) ) + if( pszItemName[0] == '\0' ) { // if this string has no length, the client didn't type a name! // assume player wants to drop the active item. @@ -4784,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 ) diff --git a/dlls/player.h b/dlls/player.h index 6fc06dbb..571a025d 100644 --- a/dlls/player.h +++ b/dlls/player.h @@ -307,14 +307,12 @@ public: void TabulateAmmo( void ); - Vector m_vecLastViewAngles; - float m_flStartCharge; float m_flAmmoStartCharge; float m_flPlayAftershock; float m_flNextAmmoBurn;// while charging, when to absorb another unit of player's ammo? - //Player ID + // Player ID void InitStatusBar( void ); void UpdateStatusBar( void ); int m_izSBarState[SBAR_END]; @@ -323,8 +321,14 @@ public: char m_SbarString0[SBAR_STRING_SIZE]; char m_SbarString1[SBAR_STRING_SIZE]; + void SetPrefsFromUserinfo( char *infobuffer ); + float m_flNextChatTime; + int m_iAutoWepSwitch; + + Vector m_vecLastViewAngles; + bool m_bSentBhopcap; // If false, the player just joined and needs a bhopcap message. }; diff --git a/dlls/python.cpp b/dlls/python.cpp index 90606c50..d8bfd35f 100644 --- a/dlls/python.cpp +++ b/dlls/python.cpp @@ -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; @@ -200,14 +200,14 @@ void CPython::PrimaryAttack() #else flags = 0; #endif - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usFirePython, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usFirePython, 0.0, 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 = 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; diff --git a/dlls/roach.cpp b/dlls/roach.cpp index 692b4beb..66e9702d 100644 --- a/dlls/roach.cpp +++ b/dlls/roach.cpp @@ -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 ); diff --git a/dlls/rpg.cpp b/dlls/rpg.cpp index fe1fd8a9..0b5b5f7b 100644 --- a/dlls/rpg.cpp +++ b/dlls/rpg.cpp @@ -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; } } @@ -535,6 +535,9 @@ void CRpg::UpdateSpot( void ) #ifndef CLIENT_DLL if( m_fSpotActive ) { + if (m_pPlayer->pev->viewmodel == 0) + return; + if( !m_pSpot ) { m_pSpot = CLaserSpot::CreateSpot(); @@ -545,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 ); } diff --git a/dlls/satchel.cpp b/dlls/satchel.cpp index dc8724bd..09e431c5 100644 --- a/dlls/satchel.cpp +++ b/dlls/satchel.cpp @@ -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; } diff --git a/dlls/schedule.cpp b/dlls/schedule.cpp index 4a5cefca..2a4cc311 100644 --- a/dlls/schedule.cpp +++ b/dlls/schedule.cpp @@ -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 ); } diff --git a/dlls/scientist.cpp b/dlls/scientist.cpp index 7e94b286..e679770a 100644 --- a/dlls/scientist.cpp +++ b/dlls/scientist.cpp @@ -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(); @@ -695,12 +697,6 @@ void CScientist::TalkInit() { CTalkMonster::TalkInit(); - // scientist will try to talk to friends in this order: - - m_szFriends[0] = "monster_scientist"; - m_szFriends[1] = "monster_sitting_scientist"; - m_szFriends[2] = "monster_barney"; - // scientists speach group names (group names are in sentences.txt) m_szGrp[TLK_ANSWER] = "SC_ANSWER"; @@ -777,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 ) ) { @@ -1053,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; @@ -1065,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 ); @@ -1244,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 ) ); } @@ -1372,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; } diff --git a/dlls/scripted.cpp b/dlls/scripted.cpp index 41638b39..4c04a9f7 100644 --- a/dlls/scripted.cpp +++ b/dlls/scripted.cpp @@ -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 ); } @@ -1068,14 +1068,17 @@ BOOL CScriptedSentence::AcceptableSpeaker( CBaseMonster *pMonster ) { if( pev->spawnflags & SF_SENTENCE_FOLLOWERS ) { - if( pMonster->m_hTargetEnt == 0 || !FClassnameIs( pMonster->m_hTargetEnt->pev, "player" ) ) + if( pMonster->m_hTargetEnt == 0 || !pMonster->m_hTargetEnt->IsPlayer() ) return FALSE; } + BOOL override; + if( pev->spawnflags & SF_SENTENCE_INTERRUPT ) override = TRUE; else override = FALSE; + if( pMonster->CanPlaySentence( override ) ) return TRUE; } @@ -1143,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; } @@ -1189,7 +1192,7 @@ void CFurniture::Spawn() pev->sequence = 0; pev->frame = 0; - //pev->nextthink += 1.0; + //pev->nextthink += 1.0f; //SetThink( &WalkMonsterDelay ); ResetSequenceInfo(); diff --git a/dlls/shotgun.cpp b/dlls/shotgun.cpp index a08770b3..90ec7e8c 100644 --- a/dlls/shotgun.cpp +++ b/dlls/shotgun.cpp @@ -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; } @@ -166,21 +166,21 @@ void CShotgun::PrimaryAttack() vecDir = m_pPlayer->FireBulletsPlayer( 6, 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_usSingleFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usSingleFire, 0.0, 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.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, (float *)&g_vecZero, (float *)&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 ); } diff --git a/dlls/singleplay_gamerules.cpp b/dlls/singleplay_gamerules.cpp index 9a46e722..7f722e30 100644 --- a/dlls/singleplay_gamerules.cpp +++ b/dlls/singleplay_gamerules.cpp @@ -75,6 +75,11 @@ BOOL CHalfLifeRules::FShouldSwitchWeapon( CBasePlayer *pPlayer, CBasePlayerItem return TRUE; } + if( !pPlayer->m_iAutoWepSwitch ) + { + return FALSE; + } + if( !pPlayer->m_pActiveItem->CanHolster() ) { return FALSE; diff --git a/dlls/sound.cpp b/dlls/sound.cpp index 30c44326..51f37fbb 100644 --- a/dlls/sound.cpp +++ b/dlls/sound.cpp @@ -184,10 +184,10 @@ void CAmbientGeneric::Spawn( void ) const char *szSoundFile = STRING( pev->message ); - if( FStringNull( pev->message ) || strlen( szSoundFile ) < 1 ) + 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. @@ -218,7 +218,7 @@ void CAmbientGeneric::Precache( void ) { const char *szSoundFile = STRING( pev->message ); - if( !FStringNull( pev->message ) && strlen( szSoundFile ) > 1 ) + if( !FStringNull( pev->message ) && szSoundFile[0] != '\0' ) { if( *szSoundFile != '!' ) PRECACHE_SOUND( szSoundFile ); @@ -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 ====================================== @@ -1037,9 +1037,8 @@ void USENTENCEG_InitLRU( unsigned char *plru, int count ) int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int freset ) { - char *szgroupname; + const char *szgroupname; unsigned char count; - char sznum[8]; if( !fSentencesInit ) return -1; @@ -1056,10 +1055,7 @@ int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int fre if( ipick >= count ) ipick = count - 1; - strcpy( szfound, "!" ); - strcat( szfound, szgroupname ); - sprintf( sznum, "%d", ipick ); - strcat( szfound, sznum ); + sprintf( szfound, "!%s%d", szgroupname, ipick ); if( ipick >= count ) { @@ -1083,11 +1079,10 @@ int USENTENCEG_PickSequential( int isentenceg, char *szfound, int ipick, int fre int USENTENCEG_Pick( int isentenceg, char *szfound ) { - char *szgroupname; + const char *szgroupname; unsigned char *plru; unsigned char i; unsigned char count; - char sznum[8]; unsigned char ipick; int ffound = FALSE; @@ -1116,10 +1111,8 @@ int USENTENCEG_Pick( int isentenceg, char *szfound ) USENTENCEG_InitLRU( plru, count ); else { - strcpy( szfound, "!" ); - strcat( szfound, szgroupname ); - sprintf( sznum, "%d", ipick ); - strcat( szfound, sznum ); + sprintf( szfound, "!%s%d", szgroupname, ipick ); + return ipick; } } @@ -1227,7 +1220,6 @@ int SENTENCEG_PlaySequentialSz( edict_t *entity, const char *szgroupname, float void SENTENCEG_Stop( edict_t *entity, int isentenceg, int ipick ) { char buffer[64]; - char sznum[8]; if( !fSentencesInit ) return; @@ -1235,10 +1227,7 @@ void SENTENCEG_Stop( edict_t *entity, int isentenceg, int ipick ) if( isentenceg < 0 || ipick < 0 ) return; - strcpy( buffer, "!" ); - strcat( buffer, rgsentenceg[isentenceg].szgroupname ); - sprintf( sznum, "%d", ipick ); - strcat( buffer, sznum ); + sprintf( buffer, "!%s%d", rgsentenceg[isentenceg].szgroupname, ipick ); STOP_SOUND( entity, CHAN_VOICE, buffer ); } @@ -1292,9 +1281,9 @@ void SENTENCEG_Init() if( !buffer[j] ) continue; - if( gcallsentences > CVOXFILESENTENCEMAX ) + if( gcallsentences >= CVOXFILESENTENCEMAX ) { - ALERT( at_error, "Too many sentences in sentences.txt!\n" ); + ALERT( at_error, "Too many sentences in sentences.txt! >%d\n", gcallsentences ); break; } @@ -1369,9 +1358,8 @@ void SENTENCEG_Init() int SENTENCEG_Lookup( const char *sample, char *sentencenum ) { - char sznum[8]; - int i; + // this is a sentence name; lookup sentence number // and give to engine as string. for( i = 0; i < gcallsentences; i++ ) @@ -1379,9 +1367,7 @@ int SENTENCEG_Lookup( const char *sample, char *sentencenum ) { if( sentencenum ) { - strcpy( sentencenum, "!" ); - sprintf( sznum, "%d", i ); - strcat( sentencenum, sznum ); + sprintf(sentencenum, "!%d", i); } return i; } @@ -1414,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 ); } @@ -1429,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 ); } @@ -1444,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 ); } @@ -1537,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 ); @@ -1586,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"; @@ -1631,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"; @@ -1640,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"; @@ -1649,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"; @@ -1658,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; } @@ -1672,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: @@ -1746,10 +1732,10 @@ void CSpeaker::Spawn( void ) { const char *szSoundFile = STRING( pev->message ); - if( !m_preset && ( FStringNull( pev->message ) || strlen( szSoundFile ) < 1 ) ) + 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; } @@ -1757,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 ); @@ -1765,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; } @@ -1842,7 +1828,7 @@ void CSpeaker::SpeakerThink( void ) flvolume, flattenuation, flags, pitch ); // shut off and reset - pev->nextthink = 0.0; + pev->nextthink = 0.0f; } else { @@ -1851,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; @@ -1864,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 @@ -1879,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; } @@ -1894,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; } } diff --git a/dlls/soundent.cpp b/dlls/soundent.cpp index 08000f28..7d9583f0 100644 --- a/dlls/soundent.cpp +++ b/dlls/soundent.cpp @@ -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; diff --git a/dlls/squadmonster.cpp b/dlls/squadmonster.cpp index 3d476b50..cbf3f19f 100644 --- a/dlls/squadmonster.cpp +++ b/dlls/squadmonster.cpp @@ -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 ); diff --git a/dlls/squeakgrenade.cpp b/dlls/squeakgrenade.cpp index bfe17ed1..f6e2d636 100644 --- a/dlls/squeakgrenade.cpp +++ b/dlls/squeakgrenade.cpp @@ -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, (float *)&g_vecZero, (float *)&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 ); } diff --git a/dlls/subs.cpp b/dlls/subs.cpp index 2a299ce4..400e05c8 100644 --- a/dlls/subs.cpp +++ b/dlls/subs.cpp @@ -107,13 +107,6 @@ void CBaseEntity::UpdateOnRemove( void ) if( pev->globalname ) gGlobalState.EntitySetState( pev->globalname, GLOBAL_DEAD ); - - // tell owner ( if any ) that we're dead.This is mostly for MonsterMaker functionality. - //Killtarget didn't do this before, so the counter broke. - Solokiller - if( CBaseEntity* pOwner = pev->owner ? Instance( pev->owner ) : 0 ) - { - pOwner->DeathNotice( pev ); - } } // Convenient way to delay removing oneself @@ -237,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 @@ -407,6 +400,13 @@ 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.05f ) + { + UTIL_SetOrigin( pev, m_vecFinalDest ); + LinearMoveDone(); + return; + } + // set nextthink to trigger a call to LinearMoveDone when dest is reached pev->nextthink = pev->ltime + flTravelTime; SetThink( &CBaseToggle::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; diff --git a/dlls/talkmonster.cpp b/dlls/talkmonster.cpp index 9180f037..295a3260 100644 --- a/dlls/talkmonster.cpp +++ b/dlls/talkmonster.cpp @@ -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(); diff --git a/dlls/talkmonster.h b/dlls/talkmonster.h index 36ac21a6..befa4e4a 100644 --- a/dlls/talkmonster.h +++ b/dlls/talkmonster.h @@ -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. diff --git a/dlls/teamplay_gamerules.cpp b/dlls/teamplay_gamerules.cpp index 87b695e7..ea733fa4 100644 --- a/dlls/teamplay_gamerules.cpp +++ b/dlls/teamplay_gamerules.cpp @@ -52,14 +52,14 @@ CHalfLifeTeamplay::CHalfLifeTeamplay() if( teamoverride.value ) { const char *pTeamList = STRING( pWorld->v.team ); - if( pTeamList && strlen( pTeamList ) ) + if( pTeamList && pTeamList[0] != '\0' ) { strncpy( m_szTeamList, pTeamList, TEAMPLAY_TEAMLISTLENGTH ); } } } // Has the server set teams - if( strlen( m_szTeamList ) ) + if( m_szTeamList[0] != '\0' ) m_teamLimit = TRUE; else m_teamLimit = FALSE; @@ -357,6 +357,8 @@ void CHalfLifeTeamplay::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infob // recound stuff RecountTeams( TRUE ); + + pPlayer->SetPrefsFromUserinfo( infobuffer ); } extern int gmsgDeathMsg; diff --git a/dlls/tentacle.cpp b/dlls/tentacle.cpp index 44b8b45b..c860fcb3 100644 --- a/dlls/tentacle.cpp +++ b/dlls/tentacle.cpp @@ -261,7 +261,7 @@ void CTentacle::Spawn() SetTouch( &CTentacle::HitTouch ); SetUse( &CTentacle::CommandUse ); - pev->nextthink = gpGlobals->time + 0.2; + pev->nextthink = gpGlobals->time + 0.2f; ResetSequenceInfo(); m_iDir = 1; @@ -323,7 +323,7 @@ void CTentacle::KeyValue( KeyValueData *pkvd ) { if( FStrEq( pkvd->szKeyName, "sweeparc" ) ) { - m_flMaxYaw = atof( pkvd->szValue ) / 2.0; + m_flMaxYaw = atof( pkvd->szValue ) * 0.5f; pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "sound" ) ) @@ -426,7 +426,7 @@ void CTentacle::Test( void ) pev->sequence = TENTACLE_ANIM_Floor_Strike; pev->framerate = 0; StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } // @@ -435,7 +435,7 @@ void CTentacle::Test( void ) void CTentacle::Cycle( void ) { // ALERT( at_console, "%s %.2f %d %d\n", STRING( pev->targetname ), pev->origin.z, m_MonsterState, m_IdealMonsterState ); - pev->nextthink = gpGlobals-> time + 0.1; + pev->nextthink = gpGlobals-> time + 0.1f; // ALERT( at_console, "%s %d %d %d %f %f\n", STRING( pev->targetname ), pev->sequence, m_iGoalAnim, m_iDir, pev->framerate, pev->health ); @@ -467,7 +467,7 @@ void CTentacle::Cycle( void ) if( pSound ) { Vector vecDir; - if( gpGlobals->time - m_flPrevSoundTime < 0.5 ) + if( gpGlobals->time - m_flPrevSoundTime < 0.5f ) { float dt = gpGlobals->time - m_flPrevSoundTime; vecDir = pSound->m_vecOrigin + ( pSound->m_vecOrigin - m_vecPrevSound ) / dt - pev->origin; @@ -506,7 +506,7 @@ void CTentacle::Cycle( void ) // UTIL_EmitAmbientSound( ENT( pev ), pev->origin + Vector( 0, 0, MyHeight() ), sound, 1.0, ATTN_NORM, 0, 100 ); } #endif - m_flSoundTime = gpGlobals->time + RANDOM_FLOAT( 5.0, 10.0 ); + m_flSoundTime = gpGlobals->time + RANDOM_FLOAT( 5.0f, 10.0f ); } // clip ideal_yaw @@ -644,8 +644,8 @@ void CTentacle::Cycle( void ) } ResetSequenceInfo(); - m_flFramerateAdj = RANDOM_FLOAT( -0.2, 0.2 ); - pev->framerate = m_iDir * 1.0 + m_flFramerateAdj; + m_flFramerateAdj = RANDOM_FLOAT( -0.2f, 0.2f ); + pev->framerate = m_iDir * 1.0f + m_flFramerateAdj; switch( pev->sequence ) { @@ -678,12 +678,12 @@ void CTentacle::Cycle( void ) // ALERT( at_console, "seq %d\n", pev->sequence ); } - if( m_flPrevSoundTime + 2.0 > gpGlobals->time ) + if( m_flPrevSoundTime + 2.0f > gpGlobals->time ) { // 1.5 normal speed if hears sounds - pev->framerate = m_iDir * 1.5 + m_flFramerateAdj; + pev->framerate = m_iDir * 1.5f + m_flFramerateAdj; } - else if( m_flPrevSoundTime + 5.0 > gpGlobals->time ) + else if( m_flPrevSoundTime + 5.0f > gpGlobals->time ) { // slowdown to normal pev->framerate = m_iDir + m_iDir * ( 5 - ( gpGlobals->time - m_flPrevSoundTime ) ) / 2 + m_flFramerateAdj; @@ -719,7 +719,7 @@ void CTentacle::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T void CTentacle::DieThink( void ) { - pev->nextthink = gpGlobals-> time + 0.1; + pev->nextthink = gpGlobals-> time + 0.1f; DispatchAnimEvents(); StudioFrameAdvance(); @@ -778,7 +778,7 @@ void CTentacle::DieThink( void ) case TENTACLE_ANIM_Engine_Death1: case TENTACLE_ANIM_Engine_Death2: case TENTACLE_ANIM_Engine_Death3: - pev->framerate = RANDOM_FLOAT( m_iDir - 0.2, m_iDir + 0.2 ); + pev->framerate = RANDOM_FLOAT( m_iDir - 0.2f, m_iDir + 0.2f ); dy = 180; break; default: @@ -841,11 +841,11 @@ void CTentacle::HandleAnimEvent( MonsterEvent_t *pEvent ) case 6: // light tap { - Vector vecSrc = pev->origin + m_flTapRadius * Vector( cos( pev->angles.y * ( M_PI / 180.0 ) ), sin( pev->angles.y * ( M_PI / 180.0 ) ), 0.0 ); + Vector vecSrc = pev->origin + m_flTapRadius * Vector( cos( pev->angles.y * ( M_PI_F / 180.0f ) ), sin( pev->angles.y * ( M_PI_F / 180.0f ) ), 0.0f ); vecSrc.z += MyHeight(); - float flVol = RANDOM_FLOAT( 0.3, 0.5 ); + float flVol = RANDOM_FLOAT( 0.3f, 0.5f ); switch( m_iTapSound ) { @@ -929,7 +929,7 @@ void CTentacle::Start( void ) g_fSquirmSound = TRUE; } - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } void CTentacle::HitTouch( CBaseEntity *pOther ) @@ -961,7 +961,7 @@ void CTentacle::HitTouch( CBaseEntity *pOther ) return; // Huh? } - m_flHitTime = gpGlobals->time + 0.5; + m_flHitTime = gpGlobals->time + 0.5f; // ALERT( at_console, "%s : ", STRING( tr.pHit->v.classname ) ); diff --git a/dlls/triggers.cpp b/dlls/triggers.cpp index 6d8fef04..2c0888c9 100644 --- a/dlls/triggers.cpp +++ b/dlls/triggers.cpp @@ -163,7 +163,7 @@ void CAutoTrigger::Spawn( void ) void CAutoTrigger::Precache( void ) { - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } void CAutoTrigger::Think( void ) @@ -614,7 +614,7 @@ void CTriggerMonsterJump::Touch( CBaseEntity *pOther ) return; } - pevOther->origin.z += 1; + pevOther->origin.z += 1.0f; if( FBitSet( pevOther->flags, FL_ONGROUND ) ) { @@ -739,7 +739,7 @@ void CTargetCDAudio::Spawn( void ) pev->movetype = MOVETYPE_NONE; if( pev->scale > 0 ) - pev->nextthink = gpGlobals->time + 1.0; + pev->nextthink = gpGlobals->time + 1.0f; } void CTargetCDAudio::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) @@ -759,7 +759,7 @@ void CTargetCDAudio::Think( void ) if( !pClient ) return; - pev->nextthink = gpGlobals->time + 0.5; + pev->nextthink = gpGlobals->time + 0.5f; if( ( pClient->v.origin - pev->origin ).Length() <= pev->scale ) Play(); @@ -825,8 +825,8 @@ void CTriggerHurt::RadiationThink( void ) origin = pev->origin; view_ofs = pev->view_ofs; - pev->origin = ( pev->absmin + pev->absmax ) * 0.5; - pev->view_ofs = pev->view_ofs * 0.0; + pev->origin = ( pev->absmin + pev->absmax ) * 0.5f; + pev->view_ofs = pev->view_ofs * 0.0f; pentPlayer = FIND_CLIENT_IN_PVS( edict() ); @@ -841,8 +841,8 @@ void CTriggerHurt::RadiationThink( void ) pevTarget = VARS( pentPlayer ); // get range to player; - vecSpot1 = ( pev->absmin + pev->absmax ) * 0.5; - vecSpot2 = ( pevTarget->absmin + pevTarget->absmax ) * 0.5; + vecSpot1 = ( pev->absmin + pev->absmax ) * 0.5f; + vecSpot2 = ( pevTarget->absmin + pevTarget->absmax ) * 0.5f; vecRange = vecSpot1 - vecSpot2; flRange = vecRange.Length(); @@ -855,7 +855,7 @@ void CTriggerHurt::RadiationThink( void ) pPlayer->m_flgeigerRange = flRange; } - pev->nextthink = gpGlobals->time + 0.25; + pev->nextthink = gpGlobals->time + 0.25f; } // @@ -952,7 +952,7 @@ void CBaseTrigger::HurtTouch( CBaseEntity *pOther ) // while touching the trigger. Player continues taking damage for a while after // leaving the trigger - fldmg = pev->dmg * 0.5; // 0.5 seconds worth of damage, pev->dmg is damage/second + fldmg = pev->dmg * 0.5f; // 0.5 seconds worth of damage, pev->dmg is damage/second // JAY: Cut this because it wasn't fully realized. Damage is simpler now. #if 0 @@ -992,7 +992,7 @@ void CBaseTrigger::HurtTouch( CBaseEntity *pOther ) pev->pain_finished = gpGlobals->time; // Apply damage every half second - pev->dmgtime = gpGlobals->time + 0.5;// half second delay until this trigger can hurt toucher again + pev->dmgtime = gpGlobals->time + 0.5f;// half second delay until this trigger can hurt toucher again if( pev->target ) { @@ -1038,7 +1038,7 @@ LINK_ENTITY_TO_CLASS( trigger_multiple, CTriggerMultiple ) void CTriggerMultiple::Spawn( void ) { if( m_flWait == 0 ) - m_flWait = 0.2; + m_flWait = 0.2f; InitTrigger(); @@ -1124,7 +1124,7 @@ void CBaseTrigger::ActivateMultiTrigger( CBaseEntity *pActivator ) if( pev->nextthink > gpGlobals->time ) return; // still waiting for reset time - if( !UTIL_IsMasterTriggered( m_sMaster,pActivator ) ) + if( !UTIL_IsMasterTriggered( m_sMaster, pActivator ) ) return; if( FClassnameIs( pev, "trigger_secret" ) ) @@ -1159,7 +1159,7 @@ void CBaseTrigger::ActivateMultiTrigger( CBaseEntity *pActivator ) // we can't just remove (self) here, because this is a touch function // called while C code is looping through area links... SetTouch( NULL ); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; SetThink( &CBaseEntity::SUB_Remove ); } } @@ -1191,7 +1191,7 @@ void CBaseTrigger::CounterUse( CBaseEntity *pActivator, CBaseEntity *pCaller, US BOOL fTellActivator = ( m_hActivator != 0 ) && - FClassnameIs( m_hActivator->pev, "player" ) && + m_hActivator->IsPlayer() && !FBitSet( pev->spawnflags, SPAWNFLAG_NOMESSAGE ); if( m_cTriggersLeft != 0 ) { @@ -1499,7 +1499,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) // void CChangeLevel::TouchChangeLevel( CBaseEntity *pOther ) { - if( !FClassnameIs( pOther->pev, "player" ) ) + if( !pOther->IsPlayer() ) return; ChangeLevelNow( pOther ); @@ -1702,7 +1702,7 @@ void NextLevel( void ) if( pChange->pev->nextthink < gpGlobals->time ) { pChange->SetThink( &CChangeLevel::ExecuteChangeLevel ); - pChange->pev->nextthink = gpGlobals->time + 0.1; + pChange->pev->nextthink = gpGlobals->time + 0.1f; } } @@ -2323,8 +2323,8 @@ void CTriggerCamera::FollowTarget() if( !( FBitSet( pev->spawnflags, SF_CAMERA_PLAYER_TAKECONTROL ) ) ) { - pev->velocity = pev->velocity * 0.8; - if( pev->velocity.Length() < 10.0 ) + pev->velocity = pev->velocity * 0.8f; + if( pev->velocity.Length() < 10.0f ) pev->velocity = g_vecZero; } diff --git a/dlls/tripmine.cpp b/dlls/tripmine.cpp index 94907bcd..50ea8c37 100644 --- a/dlls/tripmine.cpp +++ b/dlls/tripmine.cpp @@ -105,22 +105,22 @@ void CTripmineGrenade::Spawn( void ) ResetSequenceInfo(); pev->framerate = 0; - 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 ) ); UTIL_SetOrigin( pev, pev->origin ); if( pev->spawnflags & 1 ) { // power up quickly - m_flPowerUp = gpGlobals->time + 1.0; + m_flPowerUp = gpGlobals->time + 1.0f; } else { // power up in 2.5 seconds - m_flPowerUp = gpGlobals->time + 2.5; + m_flPowerUp = gpGlobals->time + 2.5f; } SetThink( &CTripmineGrenade::PowerupThink ); - pev->nextthink = gpGlobals->time + 0.2; + pev->nextthink = gpGlobals->time + 0.2f; pev->takedamage = DAMAGE_YES; pev->dmg = gSkillData.plrDmgTripmine; @@ -138,7 +138,7 @@ void CTripmineGrenade::Spawn( void ) UTIL_MakeAimVectors( pev->angles ); m_vecDir = gpGlobals->v_forward; - m_vecEnd = pev->origin + m_vecDir * 2048; + m_vecEnd = pev->origin + m_vecDir * 2048.0f; } void CTripmineGrenade::Precache( void ) @@ -163,7 +163,7 @@ void CTripmineGrenade::WarningThink( void ) // set to power up SetThink( &CTripmineGrenade::PowerupThink ); - pev->nextthink = gpGlobals->time + 1.0; + pev->nextthink = gpGlobals->time + 1.0f; } void CTripmineGrenade::PowerupThink( void ) @@ -175,15 +175,15 @@ void CTripmineGrenade::PowerupThink( void ) // find an owner edict_t *oldowner = pev->owner; pev->owner = NULL; - UTIL_TraceLine( pev->origin + m_vecDir * 8, pev->origin - m_vecDir * 32, dont_ignore_monsters, ENT( pev ), &tr ); + UTIL_TraceLine( pev->origin + m_vecDir * 8.0f, pev->origin - m_vecDir * 32.0f, dont_ignore_monsters, ENT( pev ), &tr ); if( tr.fStartSolid || ( oldowner && tr.pHit == oldowner ) ) { pev->owner = oldowner; - m_flPowerUp += 0.1; - pev->nextthink = gpGlobals->time + 0.1; + m_flPowerUp += 0.1f; + pev->nextthink = gpGlobals->time + 0.1f; return; } - if( tr.flFraction < 1.0 ) + if( tr.flFraction < 1.0f ) { pev->owner = tr.pHit; m_hOwner = CBaseEntity::Instance( pev->owner ); @@ -195,8 +195,8 @@ void CTripmineGrenade::PowerupThink( void ) STOP_SOUND( ENT( pev ), CHAN_VOICE, "weapons/mine_deploy.wav" ); STOP_SOUND( ENT( pev ), CHAN_BODY, "weapons/mine_charge.wav" ); SetThink( &CBaseEntity::SUB_Remove ); - pev->nextthink = gpGlobals->time + 0.1; - ALERT( at_console, "WARNING:Tripmine at %.0f, %.0f, %.0f removed\n", pev->origin.x, pev->origin.y, pev->origin.z ); + pev->nextthink = gpGlobals->time + 0.1f; + ALERT( at_console, "WARNING:Tripmine at %.0f, %.0f, %.0f removed\n", (double)pev->origin.x, (double)pev->origin.y, (double)pev->origin.z ); KillBeam(); return; } @@ -206,12 +206,12 @@ void CTripmineGrenade::PowerupThink( void ) // disable STOP_SOUND( ENT( pev ), CHAN_VOICE, "weapons/mine_deploy.wav" ); STOP_SOUND( ENT( pev ), CHAN_BODY, "weapons/mine_charge.wav" ); - CBaseEntity *pMine = Create( "weapon_tripmine", pev->origin + m_vecDir * 24, pev->angles ); + CBaseEntity *pMine = Create( "weapon_tripmine", pev->origin + m_vecDir * 24.0f, pev->angles ); pMine->pev->spawnflags |= SF_NORESPAWN; SetThink( &CBaseEntity::SUB_Remove ); KillBeam(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; return; } // ALERT( at_console, "%d %.0f %.0f %0.f\n", pev->owner, m_pOwner->pev->origin.x, m_pOwner->pev->origin.y, m_pOwner->pev->origin.z ); @@ -227,7 +227,7 @@ void CTripmineGrenade::PowerupThink( void ) // play enabled sound EMIT_SOUND_DYN( ENT( pev ), CHAN_VOICE, "weapons/mine_activate.wav", 0.5, ATTN_NORM, 1, 75 ); } - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } void CTripmineGrenade::KillBeam( void ) @@ -251,9 +251,9 @@ void CTripmineGrenade::MakeBeam( void ) // set to follow laser spot SetThink( &CTripmineGrenade::BeamBreakThink ); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; - Vector vecTmpEnd = pev->origin + m_vecDir * 2048 * m_flBeamLength; + Vector vecTmpEnd = pev->origin + m_vecDir * 2048.0f * m_flBeamLength; m_pBeam = CBeam::BeamCreate( g_pModelNameLaser, 10 ); m_pBeam->PointEntInit( vecTmpEnd, entindex() ); @@ -282,7 +282,7 @@ void CTripmineGrenade::BeamBreakThink( void ) m_hOwner = CBaseEntity::Instance( tr.pHit ); // reset owner too } - if( fabs( m_flBeamLength - tr.flFraction ) > 0.001 ) + if( fabs( m_flBeamLength - tr.flFraction ) > 0.001f ) { bBlowup = 1; } @@ -308,7 +308,7 @@ void CTripmineGrenade::BeamBreakThink( void ) return; } - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } int CTripmineGrenade::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType ) @@ -316,9 +316,9 @@ int CTripmineGrenade::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacke if( gpGlobals->time < m_flPowerUp && flDamage < pev->health ) { // disable - // Create( "weapon_tripmine", pev->origin + m_vecDir * 24, pev->angles ); + // Create( "weapon_tripmine", pev->origin + m_vecDir * 24.0f, pev->angles ); SetThink( &CBaseEntity::SUB_Remove ); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; KillBeam(); return FALSE; } @@ -336,16 +336,16 @@ void CTripmineGrenade::Killed( entvars_t *pevAttacker, int iGib ) } SetThink( &CTripmineGrenade::DelayDeathThink ); - pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1, 0.3 ); + pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1f, 0.3f ); - EMIT_SOUND( ENT( pev ), CHAN_BODY, "common/null.wav", 0.5, ATTN_NORM ); // shut off chargeup + EMIT_SOUND( ENT( pev ), CHAN_BODY, "common/null.wav", 0.5f, ATTN_NORM ); // shut off chargeup } void CTripmineGrenade::DelayDeathThink( void ) { KillBeam(); TraceResult tr; - UTIL_TraceLine( pev->origin + m_vecDir * 8, pev->origin - m_vecDir * 64, dont_ignore_monsters, ENT( pev ), &tr ); + UTIL_TraceLine( pev->origin + m_vecDir * 8, pev->origin - m_vecDir * 64.0f, dont_ignore_monsters, ENT( pev ), &tr ); Explode( &tr, DMG_BLAST ); } @@ -374,7 +374,7 @@ void CTripmine::Spawn() if( !g_pGameRules->IsDeathmatch() ) #endif { - UTIL_SetSize( pev, Vector( -16, -16, 0 ), Vector( 16, 16, 28 ) ); + UTIL_SetSize( pev, Vector( -16.0f, -16.0f, 0.0f ), Vector( 16.0f, 16.0f, 28.0f ) ); } } @@ -412,7 +412,7 @@ BOOL CTripmine::Deploy() void CTripmine::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] ) { @@ -422,7 +422,7 @@ void CTripmine::Holster( int skiplocal /* = 0 */ ) } SendWeaponAnim( TRIPMINE_HOLSTER ); - 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 CTripmine::PrimaryAttack( void ) @@ -436,7 +436,7 @@ void CTripmine::PrimaryAttack( void ) TraceResult tr; - UTIL_TraceLine( vecSrc, vecSrc + vecAiming * 128, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr ); + UTIL_TraceLine( vecSrc, vecSrc + vecAiming * 128.0f, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr ); int flags; #ifdef CLIENT_WEAPONS @@ -444,16 +444,16 @@ void CTripmine::PrimaryAttack( void ) #else flags = 0; #endif - PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usTripFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usTripFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 0, 0, 0, 0 ); - if( tr.flFraction < 1.0 ) + if( tr.flFraction < 1.0f ) { CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit ); if( pEntity && !( pEntity->pev->flags & FL_CONVEYOR ) ) { Vector angles = UTIL_VecToAngles( tr.vecPlaneNormal ); - CBaseEntity::Create( "monster_tripmine", tr.vecEndPos + tr.vecPlaneNormal * 8, angles, m_pPlayer->edict() ); + CBaseEntity::Create( "monster_tripmine", tr.vecEndPos + tr.vecPlaneNormal * 8.0f, angles, m_pPlayer->edict() ); m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--; @@ -498,20 +498,20 @@ void CTripmine::WeaponIdle( void ) int iAnim; float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 ); - if( flRand <= 0.25 ) + if( flRand <= 0.25f ) { iAnim = TRIPMINE_IDLE1; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0 / 30.0; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 90.0f / 30.0f; } - else if( flRand <= 0.75 ) + else if( flRand <= 0.75f ) { iAnim = TRIPMINE_IDLE2; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0 / 30.0; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f / 30.0f; } else { iAnim = TRIPMINE_FIDGET; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 100.0 / 30.0; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 100.0f / 30.0f; } SendWeaponAnim( iAnim ); diff --git a/dlls/turret.cpp b/dlls/turret.cpp index 093b2032..a5aa6d23 100644 --- a/dlls/turret.cpp +++ b/dlls/turret.cpp @@ -316,7 +316,7 @@ void CTurret::Spawn() m_pEyeGlow->SetAttachment( edict(), 2 ); m_eyeBrightness = 0; - pev->nextthink = gpGlobals->time + 0.3; + pev->nextthink = gpGlobals->time + 0.3f; } void CTurret::Precache() @@ -331,9 +331,9 @@ void CMiniTurret::Spawn() Precache(); SET_MODEL( ENT( pev ), "models/miniturret.mdl" ); pev->health = gSkillData.miniturretHealth; - m_HackedGunPos = Vector( 0, 0, 12.75 ); + m_HackedGunPos = Vector( 0.0f, 0.0f, 12.75f ); m_flMaxSpin = 0; - pev->view_ofs.z = 12.75; + pev->view_ofs.z = 12.75f; CBaseTurret::Spawn(); m_iRetractHeight = 16; @@ -342,7 +342,7 @@ void CMiniTurret::Spawn() UTIL_SetSize( pev, Vector( -16, -16, -m_iRetractHeight ), Vector( 16, 16, m_iRetractHeight ) ); SetThink( &CBaseTurret::Initialize ); - pev->nextthink = gpGlobals->time + 0.3; + pev->nextthink = gpGlobals->time + 0.3f; } void CMiniTurret::Precache() @@ -385,7 +385,7 @@ void CBaseTurret::Initialize( void ) { m_flLastSight = gpGlobals->time + m_flMaxWait; SetThink( &CBaseTurret::AutoSearchThink ); - pev->nextthink = gpGlobals->time + .1; + pev->nextthink = gpGlobals->time + 0.1f; } else SetThink( &CBaseEntity::SUB_DoNothing ); @@ -399,7 +399,7 @@ void CBaseTurret::TurretUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_ if( m_iOn ) { m_hEnemy = NULL; - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; m_iAutoStart = FALSE;// switching off a turret disables autostart //!!!! this should spin down first!!BUGBUG @@ -407,7 +407,7 @@ void CBaseTurret::TurretUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_ } else { - pev->nextthink = gpGlobals->time + 0.1; // turn on delay + pev->nextthink = gpGlobals->time + 0.1f; // turn on delay // if the turret is flagged as an autoactivate turret, re-enable it's ability open self. if( pev->spawnflags & SF_MONSTER_TURRET_AUTOACTIVATE ) @@ -465,7 +465,7 @@ void CBaseTurret::ActiveThink( void ) int fAttack = 0; Vector vecDirToEnemy; - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; StudioFrameAdvance(); if( ( !m_iOn ) || ( m_hEnemy == 0 ) ) @@ -481,7 +481,7 @@ void CBaseTurret::ActiveThink( void ) { if( !m_flLastSight ) { - m_flLastSight = gpGlobals->time + 0.5; // continue-shooting timeout + m_flLastSight = gpGlobals->time + 0.5f; // continue-shooting timeout } else { @@ -510,7 +510,7 @@ void CBaseTurret::ActiveThink( void ) if( !fEnemyVisible || ( flDistToEnemy > TURRET_RANGE ) ) { if( !m_flLastSight ) - m_flLastSight = gpGlobals->time + 0.5; + m_flLastSight = gpGlobals->time + 0.5f; else { // Should we look for a new target? @@ -529,7 +529,7 @@ void CBaseTurret::ActiveThink( void ) m_vecLastSight = vecMidEnemy; } - UTIL_MakeAimVectors(m_vecCurAngles); + UTIL_MakeAimVectors( m_vecCurAngles ); /* ALERT( at_console, "%.0f %.0f : %.2f %.2f %.2f\n", @@ -541,7 +541,7 @@ void CBaseTurret::ActiveThink( void ) vecLOS = vecLOS.Normalize(); // Is the Gun looking at the target - if( DotProduct( vecLOS, gpGlobals->v_forward ) <= 0.866 ) // 30 degree slop + if( DotProduct( vecLOS, gpGlobals->v_forward ) <= 0.866f ) // 30 degree slop fAttack = FALSE; else fAttack = TRUE; @@ -642,7 +642,7 @@ void CMiniTurret::Shoot( Vector &vecSrc, Vector &vecDirToEnemy ) void CBaseTurret::Deploy( void ) { - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; StudioFrameAdvance(); if( pev->sequence != TURRET_ANIM_DEPLOY ) @@ -684,7 +684,7 @@ void CBaseTurret::Retire( void ) m_vecGoalAngles.x = 0; m_vecGoalAngles.y = m_flStartYaw; - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; StudioFrameAdvance(); @@ -713,7 +713,7 @@ void CBaseTurret::Retire( void ) if( m_iAutoStart ) { SetThink( &CBaseTurret::AutoSearchThink ); - pev->nextthink = gpGlobals->time + .1; + pev->nextthink = gpGlobals->time + 0.1f; } else SetThink( &CBaseEntity::SUB_DoNothing ); @@ -728,7 +728,7 @@ void CBaseTurret::Retire( void ) void CTurret::SpinUpCall( void ) { StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; // Are we already spun up? If not start the two stage process. if( !m_iSpin ) @@ -738,15 +738,15 @@ void CTurret::SpinUpCall( void ) // for the first pass, spin up the the barrel if( !m_iStartSpin ) { - pev->nextthink = gpGlobals->time + 1.0; // spinup delay + pev->nextthink = gpGlobals->time + 1.0f; // spinup delay EMIT_SOUND( ENT( pev ), CHAN_BODY, "turret/tu_spinup.wav", TURRET_MACHINE_VOLUME, ATTN_NORM ); m_iStartSpin = 1; - pev->framerate = 0.1; + pev->framerate = 0.1f; } // after the barrel is spun up, turn on the hum - else if( pev->framerate >= 1.0 ) + else if( pev->framerate >= 1.0f ) { - pev->nextthink = gpGlobals->time + 0.1; // retarget delay + pev->nextthink = gpGlobals->time + 0.1f; // retarget delay EMIT_SOUND( ENT( pev ), CHAN_STATIC, "turret/tu_active2.wav", TURRET_MACHINE_VOLUME, ATTN_NORM ); SetThink( &CBaseTurret::ActiveThink ); m_iStartSpin = 0; @@ -754,7 +754,7 @@ void CTurret::SpinUpCall( void ) } else { - pev->framerate += 0.075; + pev->framerate += 0.075f; } } @@ -769,12 +769,12 @@ void CTurret::SpinDownCall( void ) if( m_iSpin ) { SetTurretAnim( TURRET_ANIM_SPIN ); - if( pev->framerate == 1.0 ) + if( pev->framerate == 1.0f ) { EMIT_SOUND_DYN( ENT( pev ), CHAN_STATIC, "turret/tu_active2.wav", 0, 0, SND_STOP, 100 ); EMIT_SOUND( ENT( pev ), CHAN_ITEM, "turret/tu_spindown.wav", TURRET_MACHINE_VOLUME, ATTN_NORM ); } - pev->framerate -= 0.02; + pev->framerate -= 0.02f; if( pev->framerate <= 0 ) { pev->framerate = 0; @@ -830,7 +830,7 @@ void CBaseTurret::SearchThink( void ) // ensure rethink SetTurretAnim( TURRET_ANIM_SPIN ); StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; if( m_flSpinUpTime == 0 && m_flMaxSpin ) m_flSpinUpTime = gpGlobals->time + m_flMaxSpin; @@ -875,7 +875,7 @@ void CBaseTurret::SearchThink( void ) } // generic hunt for new victims - m_vecGoalAngles.y = ( m_vecGoalAngles.y + 0.1 * m_fTurnRate ); + m_vecGoalAngles.y = ( m_vecGoalAngles.y + 0.1f * m_fTurnRate ); if( m_vecGoalAngles.y >= 360 ) m_vecGoalAngles.y -= 360; MoveTurret(); @@ -890,7 +890,7 @@ void CBaseTurret::AutoSearchThink( void ) { // ensure rethink StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.3; + pev->nextthink = gpGlobals->time + 0.3f; // If we have a target and we're still healthy if( m_hEnemy != 0 ) @@ -918,7 +918,7 @@ void CBaseTurret::TurretDeath( void ) //BOOL iActive = FALSE; StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; if( pev->deadflag != DEAD_DEAD ) { @@ -926,9 +926,9 @@ void CBaseTurret::TurretDeath( void ) float flRndSound = RANDOM_FLOAT( 0, 1 ); - if( flRndSound <= 0.33 ) + if( flRndSound <= 0.33f ) EMIT_SOUND( ENT( pev ), CHAN_BODY, "turret/tu_die.wav", 1.0, ATTN_NORM ); - else if( flRndSound <= 0.66 ) + else if( flRndSound <= 0.66f ) EMIT_SOUND( ENT( pev ), CHAN_BODY, "turret/tu_die2.wav", 1.0, ATTN_NORM ); else EMIT_SOUND( ENT( pev ), CHAN_BODY, "turret/tu_die3.wav", 1.0, ATTN_NORM ); @@ -1006,7 +1006,7 @@ int CBaseTurret::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl return 0; if( !m_iOn ) - flDamage /= 10.0; + flDamage *= 0.1f; pev->health -= flDamage; if( pev->health <= 0 ) @@ -1020,7 +1020,7 @@ int CBaseTurret::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl SetUse( NULL ); SetThink( &CBaseTurret::TurretDeath ); SUB_UseTargets( this, USE_ON, 0 ); // wake up others - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; return 0; } @@ -1046,7 +1046,7 @@ int CBaseTurret::MoveTurret( void ) { float flDir = m_vecGoalAngles.x > m_vecCurAngles.x ? 1 : -1 ; - m_vecCurAngles.x += 0.1 * m_fTurnRate * flDir; + m_vecCurAngles.x += 0.1f * m_fTurnRate * flDir; // if we started below the goal, and now we're past, peg to goal if( flDir == 1 ) @@ -1093,14 +1093,14 @@ int CBaseTurret::MoveTurret( void ) m_fTurnRate += m_iBaseTurnRate; } - m_vecCurAngles.y += 0.1 * m_fTurnRate * flDir; + m_vecCurAngles.y += 0.1f * m_fTurnRate * flDir; if( m_vecCurAngles.y < 0 ) m_vecCurAngles.y += 360; else if( m_vecCurAngles.y >= 360 ) m_vecCurAngles.y -= 360; - if( flDist < ( 0.05 * m_iBaseTurnRate ) ) + if( flDist < ( 0.05f * m_iBaseTurnRate ) ) m_vecCurAngles.y = m_vecGoalAngles.y; //ALERT( at_console, "%.2f -> %.2f\n", m_vecCurAngles.y, y ); @@ -1170,7 +1170,7 @@ void CSentry::Spawn() SetTouch( &CSentry::SentryTouch ); SetThink( &CBaseTurret::Initialize ); - pev->nextthink = gpGlobals->time + 0.3; + pev->nextthink = gpGlobals->time + 0.3f; } void CSentry::Shoot( Vector &vecSrc, Vector &vecDirToEnemy ) @@ -1201,7 +1201,7 @@ int CSentry::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float { SetThink( &CBaseTurret::Deploy ); SetUse( NULL ); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } pev->health -= flDamage; @@ -1216,7 +1216,7 @@ int CSentry::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float SetUse( NULL ); SetThink( &CSentry::SentryDeath ); SUB_UseTargets( this, USE_ON, 0 ); // wake up others - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; return 0; } @@ -1237,7 +1237,7 @@ void CSentry::SentryDeath( void ) //BOOL iActive = FALSE; StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; if( pev->deadflag != DEAD_DEAD ) { @@ -1245,9 +1245,9 @@ void CSentry::SentryDeath( void ) float flRndSound = RANDOM_FLOAT( 0, 1 ); - if( flRndSound <= 0.33 ) + if( flRndSound <= 0.33f ) EMIT_SOUND( ENT( pev ), CHAN_BODY, "turret/tu_die.wav", 1.0, ATTN_NORM ); - else if( flRndSound <= 0.66 ) + else if( flRndSound <= 0.66f ) EMIT_SOUND( ENT( pev ), CHAN_BODY, "turret/tu_die2.wav", 1.0, ATTN_NORM ); else EMIT_SOUND( ENT( pev ), CHAN_BODY, "turret/tu_die3.wav", 1.0, ATTN_NORM ); diff --git a/dlls/util.cpp b/dlls/util.cpp index c7feab31..018a2f8e 100644 --- a/dlls/util.cpp +++ b/dlls/util.cpp @@ -34,7 +34,7 @@ float UTIL_WeaponTimeBase( void ) { #if defined( CLIENT_WEAPONS ) - return 0.0; + return 0.0f; #else return gpGlobals->time; #endif @@ -130,7 +130,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 ); } @@ -147,8 +147,8 @@ void UTIL_ParametricRocket( entvars_t *pev, Vector vecOrigin, Vector vecAngles, // Now compute how long it will take based on current velocity Vector vecTravel = pev->endpos - pev->startpos; - float travelTime = 0.0; - if( pev->velocity.Length() > 0 ) + float travelTime = 0.0f; + if( pev->velocity.Length() > 0.0f ) { travelTime = vecTravel.Length() / pev->velocity.Length(); } @@ -458,7 +458,7 @@ int UTIL_MonstersInSphere( CBaseEntity **pList, int listMax, const Vector ¢e // Use origin for X & Y since they are centered for all monsters // Now X - delta = center.x - pEdict->v.origin.x;//( pEdict->v.absmin.x + pEdict->v.absmax.x ) * 0.5; + delta = center.x - pEdict->v.origin.x;//( pEdict->v.absmin.x + pEdict->v.absmax.x ) * 0.5f; delta *= delta; if( delta > radiusSquared ) @@ -466,7 +466,7 @@ int UTIL_MonstersInSphere( CBaseEntity **pList, int listMax, const Vector ¢e distance = delta; // Now Y - delta = center.y - pEdict->v.origin.y;//( pEdict->v.absmin.y + pEdict->v.absmax.y )*0.5; + delta = center.y - pEdict->v.origin.y;//( pEdict->v.absmin.y + pEdict->v.absmax.y ) * 0.5f; delta *= delta; distance += delta; @@ -474,7 +474,7 @@ int UTIL_MonstersInSphere( CBaseEntity **pList, int listMax, const Vector ¢e continue; // Now Z - delta = center.z - ( pEdict->v.absmin.z + pEdict->v.absmax.z ) * 0.5; + delta = center.z - ( pEdict->v.absmin.z + pEdict->v.absmax.z ) * 0.5f; delta *= delta; distance += delta; @@ -1184,7 +1184,7 @@ void UTIL_DecalTrace( TraceResult *pTrace, int decalNumber ) if( index < 0 ) return; - if( pTrace->flFraction == 1.0 ) + if( pTrace->flFraction == 1.0f ) return; // Only decal BSP models @@ -1253,7 +1253,7 @@ void UTIL_PlayerDecalTrace( TraceResult *pTrace, int playernum, int decalNumber, else index = decalNumber; - if( pTrace->flFraction == 1.0 ) + if( pTrace->flFraction == 1.0f ) return; MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY ); @@ -1276,7 +1276,7 @@ void UTIL_GunshotDecalTrace( TraceResult *pTrace, int decalNumber ) if( index < 0 ) return; - if( pTrace->flFraction == 1.0 ) + if( pTrace->flFraction == 1.0f ) return; MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pTrace->vecEndPos ); @@ -1306,7 +1306,7 @@ void UTIL_Ricochet( const Vector &position, float scale ) WRITE_COORD( position.x ); WRITE_COORD( position.y ); WRITE_COORD( position.z ); - WRITE_BYTE( (int)( scale * 10 ) ); + WRITE_BYTE( (int)( scale * 10.0f ) ); MESSAGE_END(); } @@ -1423,9 +1423,9 @@ float UTIL_WaterLevel( const Vector &position, float minz, float maxz ) return maxz; float diff = maxz - minz; - while( diff > 1.0 ) + while( diff > 1.0f ) { - midUp.z = minz + diff / 2.0; + midUp.z = minz + diff / 2.0f; if( UTIL_PointContents( midUp ) == CONTENTS_WATER ) { minz = midUp.z; @@ -1444,7 +1444,7 @@ extern DLL_GLOBAL short g_sModelIndexBubbles;// holds the index for the bubbles void UTIL_Bubbles( Vector mins, Vector maxs, int count ) { - Vector mid = ( mins + maxs ) * 0.5; + Vector mid = ( mins + maxs ) * 0.5f; float flHeight = UTIL_WaterLevel( mid, mid.z, mid.z + 1024 ); flHeight = flHeight - mins.z; @@ -1733,8 +1733,8 @@ void CSaveRestoreBuffer::BufferRewind( int size ) extern "C" { unsigned _rotr( unsigned val, int shift ) { - register unsigned lobit; /* non-zero means lo bit set */ - register unsigned num = val; /* number to rotate */ + unsigned lobit; /* non-zero means lo bit set */ + unsigned num = val; /* number to rotate */ shift &= 0x1f; /* modulo 32 -- this will also make negative shifts work */ @@ -2196,7 +2196,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou pString++; } pInputData = pString; - if( strlen( (char *)pInputData ) == 0 ) + if( ( (char *)pInputData )[0] == '\0' ) *( (string_t *)pOutputData ) = 0; else { @@ -2291,7 +2291,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou *( (void**)pOutputData ) = *(void **)pInputData; break; case FIELD_FUNCTION: - if( strlen( (char *)pInputData ) == 0 ) + if( ( (char *)pInputData )[0] == '\0' ) *( (void**)pOutputData ) = 0; else *( (void**)pOutputData ) = (void*)FUNCTION_FROM_NAME( (char *)pInputData ); diff --git a/dlls/util.h b/dlls/util.h index 41e86a84..2bb8a5d4 100644 --- a/dlls/util.h +++ b/dlls/util.h @@ -108,7 +108,11 @@ typedef int BOOL; // The _declspec forces them to be exported by name so we can do a lookup with GetProcAddress() // The function is used to intialize / allocate the object for the entity +#if defined(CLIENT_DLL) +#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) +#else // CLIENT_DLL #define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) extern "C" EXPORT void mapClassName( entvars_t *pev ); void mapClassName( entvars_t *pev ) { GetClassPtr( (DLLClassName *)pev ); } +#endif // CLIENT_DLL // // Conversion among the three types of "entity", including identity-conversions. @@ -552,8 +556,8 @@ void EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname); #define RANDOM_SOUND_ARRAY( array ) (array) [ RANDOM_LONG(0,ARRAYSIZE( (array) )-1) ] -#define PLAYBACK_EVENT( flags, who, index ) PLAYBACK_EVENT_FULL( flags, who, index, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0 ); -#define PLAYBACK_EVENT_DELAY( flags, who, index, delay ) PLAYBACK_EVENT_FULL( flags, who, index, delay, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0 ); +#define PLAYBACK_EVENT( flags, who, index ) PLAYBACK_EVENT_FULL( flags, who, index, 0, g_vecZero, g_vecZero, 0.0, 0.0, 0, 0, 0, 0 ); +#define PLAYBACK_EVENT_DELAY( flags, who, index, delay ) PLAYBACK_EVENT_FULL( flags, who, index, delay, g_vecZero, g_vecZero, 0.0, 0.0, 0, 0, 0, 0 ); #define GROUP_OP_AND 0 #define GROUP_OP_NAND 1 diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 5e4f8f78..ec98e0ca 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -441,7 +441,7 @@ void CBasePlayerItem::FallInit( void ) SetTouch( &CBasePlayerItem::DefaultTouch ); SetThink( &CBasePlayerItem::FallThink ); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } //========================================================= @@ -453,7 +453,7 @@ void CBasePlayerItem::FallInit( void ) //========================================================= void CBasePlayerItem::FallThink( void ) { - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; if( pev->flags & FL_ONGROUND ) { @@ -596,7 +596,7 @@ BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted ) } else { - return ( attack_time <= 0.0 ) ? TRUE : FALSE; + return ( attack_time <= 0.0f ) ? TRUE : FALSE; } } @@ -654,19 +654,19 @@ void CBasePlayerWeapon::ItemPostFrame( void ) // no fire buttons down m_fFireOnEmpty = FALSE; - if( !IsUseable() && m_flNextPrimaryAttack < ( UseDecrement() ? 0.0 : gpGlobals->time ) ) + if( !IsUseable() && m_flNextPrimaryAttack < ( UseDecrement() ? 0.0f : gpGlobals->time ) ) { // weapon isn't useable, switch. if( !( iFlags() & ITEM_FLAG_NOAUTOSWITCHEMPTY ) && g_pGameRules->GetNextBestWeapon( m_pPlayer, this ) ) { - m_flNextPrimaryAttack = ( UseDecrement() ? 0.0 : gpGlobals->time ) + 0.3; + m_flNextPrimaryAttack = ( UseDecrement() ? 0.0f : gpGlobals->time ) + 0.3f; return; } } else { // 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 < ( UseDecrement() ? 0.0 : gpGlobals->time ) ) + if( m_iClip == 0 && !(iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack < ( UseDecrement() ? 0.0f : gpGlobals->time ) ) { Reload(); return; @@ -706,14 +706,14 @@ void CBasePlayerItem::Drop( void ) { SetTouch( NULL ); SetThink( &CBaseEntity::SUB_Remove ); - pev->nextthink = gpGlobals->time + .1; + pev->nextthink = gpGlobals->time + 0.1f; } void CBasePlayerItem::Kill( void ) { SetTouch( NULL ); SetThink( &CBaseEntity::SUB_Remove ); - pev->nextthink = gpGlobals->time + .1; + pev->nextthink = gpGlobals->time + 0.1f; } void CBasePlayerItem::Holster( int skiplocal /* = 0 */ ) @@ -952,8 +952,8 @@ BOOL CBasePlayerWeapon::DefaultDeploy( const char *szViewModel, const char *szWe strcpy( m_pPlayer->m_szAnimExtention, szAnimExt ); SendWeaponAnim( iAnim, skiplocal, body ); - m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5; - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0; + m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f; + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f; m_flLastFireTime = 0.0f; return TRUE; @@ -976,7 +976,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; } @@ -1071,7 +1071,7 @@ void CBasePlayerAmmo::DefaultTouch( CBaseEntity *pOther ) { SetTouch( NULL ); SetThink( &CBaseEntity::SUB_Remove ); - pev->nextthink = gpGlobals->time + .1; + pev->nextthink = gpGlobals->time + 0.1f; } } else if( gEvilImpulse101 ) @@ -1079,7 +1079,7 @@ void CBasePlayerAmmo::DefaultTouch( CBaseEntity *pOther ) // evil impulse 101 hack, kill always SetTouch( NULL ); SetThink( &CBaseEntity::SUB_Remove ); - pev->nextthink = gpGlobals->time + .1; + pev->nextthink = gpGlobals->time + 0.1f; } } @@ -1158,7 +1158,7 @@ void CBasePlayerWeapon::RetireWeapon( void ) //========================================================================= float CBasePlayerWeapon::GetNextAttackDelay( float delay ) { - if( m_flLastFireTime == 0 || m_flNextPrimaryAttack == -1 ) + if( m_flLastFireTime == 0 || m_flNextPrimaryAttack == -1.0f ) { // At this point, we are assuming that the client has stopped firing // and we are going to reset our book keeping variables. @@ -1256,7 +1256,7 @@ void CWeaponBox::Kill( void ) while( pWeapon ) { pWeapon->SetThink( &CBaseEntity::SUB_Remove ); - pWeapon->pev->nextthink = gpGlobals->time + 0.1; + pWeapon->pev->nextthink = gpGlobals->time + 0.1f; pWeapon = pWeapon->m_pNext; } } @@ -1550,8 +1550,8 @@ void CWeaponBox::SetObjectCollisionBox( void ) void CBasePlayerWeapon::PrintState( void ) { - ALERT( at_console, "primary: %f\n", m_flNextPrimaryAttack ); - ALERT( at_console, "idle : %f\n", m_flTimeWeaponIdle ); + ALERT( at_console, "primary: %f\n", (double)m_flNextPrimaryAttack ); + ALERT( at_console, "idle : %f\n", (double)m_flTimeWeaponIdle ); //ALERT( at_console, "nextrl : %f\n", m_flNextReload ); //ALERT( at_console, "nextpum: %f\n", m_flPumpTime ); @@ -1617,7 +1617,7 @@ IMPLEMENT_SAVERESTORE( CEgon, CBasePlayerWeapon ) TYPEDESCRIPTION CHgun::m_SaveData[] = { - DEFINE_FIELD( CHgun, m_flRechargeTime, FIELD_FLOAT ), + DEFINE_FIELD( CHgun, m_flRechargeTime, FIELD_TIME ), }; IMPLEMENT_SAVERESTORE( CHgun, CBasePlayerWeapon ) diff --git a/dlls/world.cpp b/dlls/world.cpp index ae5a41bc..0e0a0288 100644 --- a/dlls/world.cpp +++ b/dlls/world.cpp @@ -159,7 +159,7 @@ void CDecal::TriggerDecal( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY MESSAGE_END(); SetThink( &CBaseEntity::SUB_Remove ); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; } void CDecal::StaticDecal( void ) @@ -626,15 +626,15 @@ void CWorld::Precache( void ) pEntity->SetThink( &CBaseEntity::SUB_CallUseToggle ); pEntity->pev->message = pev->netname; pev->netname = 0; - pEntity->pev->nextthink = gpGlobals->time + 0.3; + pEntity->pev->nextthink = gpGlobals->time + 0.3f; pEntity->pev->spawnflags = SF_MESSAGE_ONCE; } } if( pev->spawnflags & SF_WORLD_DARK ) - CVAR_SET_FLOAT( "v_dark", 1.0 ); + CVAR_SET_FLOAT( "v_dark", 1.0f ); else - CVAR_SET_FLOAT( "v_dark", 0.0 ); + CVAR_SET_FLOAT( "v_dark", 0.0f ); pev->spawnflags &= ~SF_WORLD_DARK; // g-cont. don't apply fade after save\restore @@ -647,11 +647,11 @@ void CWorld::Precache( void ) if( pev->spawnflags & SF_WORLD_FORCETEAM ) { - CVAR_SET_FLOAT( "mp_defaultteam", 1 ); + CVAR_SET_FLOAT( "mp_defaultteam", 1.0f ); } else { - CVAR_SET_FLOAT( "mp_defaultteam", 0 ); + CVAR_SET_FLOAT( "mp_defaultteam", 0.0f ); } // g-cont. moved here so cheats will working on restore level @@ -677,7 +677,7 @@ void CWorld::KeyValue( KeyValueData *pkvd ) else if( FStrEq(pkvd->szKeyName, "WaveHeight" ) ) { // Sent over net now. - pev->scale = atof( pkvd->szValue ) * ( 1.0 / 8.0 ); + pev->scale = atof( pkvd->szValue ) * ( 1.0f / 8.0f ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "MaxRange" ) ) diff --git a/dlls/wscript b/dlls/wscript new file mode 100644 index 00000000..e5268e05 --- /dev/null +++ b/dlls/wscript @@ -0,0 +1,79 @@ +#! /usr/bin/env python +# encoding: utf-8 +# a1batross, mittorn, 2018 + +from waflib import Utils +import os + +def options(opt): + # stub + return + +def configure(conf): + if conf.env.COMPILER_CC == 'msvc': + # hl.def removes MSVC function name decoration from GiveFnptrsToDll on Windows. + # Without this, the lookup for this function fails. + hlDefNode = conf.path.find_resource("./hl.def") + + if hlDefNode is not None: + conf.env.append_unique('LINKFLAGS', '/def:%s' % hlDefNode.abspath()) + else: + conf.fatal("Could not find hl.def") + +def build(bld): + defines = [] + source = bld.path.parent.ant_glob([ + 'pm_shared/*.c', + ]) + + source += [ + 'agrunt.cpp', 'airtank.cpp', 'aflock.cpp', 'animating.cpp', 'animation.cpp', 'apache.cpp', + 'barnacle.cpp', 'barney.cpp', 'bigmomma.cpp', 'bloater.cpp', 'bmodels.cpp', 'bullsquid.cpp', 'buttons.cpp', + 'cbase.cpp', 'client.cpp', 'combat.cpp', 'controller.cpp', 'crossbow.cpp', 'crowbar.cpp', + 'defaultai.cpp', 'doors.cpp', + 'effects.cpp', 'egon.cpp', 'explode.cpp', + 'flyingmonster.cpp', 'func_break.cpp', 'func_tank.cpp', + 'game.cpp', 'gamerules.cpp', 'gargantua.cpp', 'gauss.cpp', 'genericmonster.cpp', 'ggrenade.cpp', 'globals.cpp', 'glock.cpp', 'gman.cpp', + 'h_ai.cpp', 'h_battery.cpp', 'h_cine.cpp', 'h_cycler.cpp', 'h_export.cpp', 'handgrenade.cpp', 'hassassin.cpp', 'headcrab.cpp', + 'healthkit.cpp', 'hgrunt.cpp', 'hornet.cpp', 'hornetgun.cpp', 'houndeye.cpp', + 'ichthyosaur.cpp', 'islave.cpp', 'items.cpp', + 'leech.cpp', 'lights.cpp', + 'maprules.cpp', 'monstermaker.cpp', 'monsters.cpp', 'monsterstate.cpp', 'mortar.cpp', 'mp5.cpp', 'multiplay_gamerules.cpp', + 'nihilanth.cpp', 'nodes.cpp', + 'observer.cpp', 'osprey.cpp', + 'pathcorner.cpp', 'plane.cpp', 'plats.cpp', 'player.cpp', 'playermonster.cpp', 'python.cpp', + 'rat.cpp', 'roach.cpp', 'rpg.cpp', + 'satchel.cpp', 'schedule.cpp', 'scientist.cpp', 'scripted.cpp', 'shotgun.cpp', 'singleplay_gamerules.cpp', 'skill.cpp', + 'sound.cpp', 'soundent.cpp', 'spectator.cpp', 'squadmonster.cpp', 'squeakgrenade.cpp', 'subs.cpp', + 'talkmonster.cpp', 'teamplay_gamerules.cpp', 'tempmonster.cpp', 'tentacle.cpp', + 'triggers.cpp', 'tripmine.cpp', 'turret.cpp', + 'util.cpp', + 'weapons.cpp', 'world.cpp', 'xen.cpp', 'zombie.cpp'] + + if bld.env.VOICEMGR: + source += bld.path.parent.ant_glob([ + 'game_shared/voice_gamemgr.cpp', + ]) + else: + defines += ['NO_VOICEGAMEMGR'] + + includes = Utils.to_list('. wpn_shared ../common ../engine ../pm_shared ../game_shared ../public') + + libs = [] + + if bld.env.DEST_OS not in ['android']: + install_path = os.path.join(bld.env.GAMEDIR, bld.env.SERVER_DIR) + else: + install_path = bld.env.PREFIX + + bld.shlib( + source = source, + target = bld.env.SERVER_NAME, + features = 'c cxx', + includes = includes, + defines = defines, + use = libs, + install_path = install_path, + subsystem = bld.env.MSVC_SUBSYSTEM, + idx = bld.get_taskgen_count() + ) diff --git a/dlls/xen.cpp b/dlls/xen.cpp index 1d86beb3..847f26f7 100644 --- a/dlls/xen.cpp +++ b/dlls/xen.cpp @@ -94,10 +94,10 @@ void CXenPLight::Spawn( void ) UTIL_SetSize( pev, Vector( -80, -80, 0 ), Vector( 80, 80, 32 ) ); SetActivity( ACT_IDLE ); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; pev->frame = RANDOM_FLOAT( 0, 255 ); - m_pGlow = CSprite::SpriteCreate( XEN_PLANT_GLOW_SPRITE, pev->origin + Vector(0,0,(pev->mins.z+pev->maxs.z)*0.5), FALSE ); + m_pGlow = CSprite::SpriteCreate( XEN_PLANT_GLOW_SPRITE, pev->origin + Vector( 0, 0, ( pev->mins.z + pev->maxs.z ) * 0.5f ), FALSE ); m_pGlow->SetTransparency( kRenderGlow, (int)pev->rendercolor.x, (int)pev->rendercolor.y, (int)pev->rendercolor.z, (int)pev->renderamt, (int)pev->renderfx ); m_pGlow->SetAttachment( edict(), 1 ); } @@ -111,7 +111,7 @@ void CXenPLight::Precache( void ) void CXenPLight::Think( void ) { StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; switch( GetActivity() ) { @@ -187,19 +187,19 @@ void CXenHair::Spawn( void ) if( !( pev->spawnflags & SF_HAIR_SYNC ) ) { pev->frame = RANDOM_FLOAT( 0, 255 ); - pev->framerate = RANDOM_FLOAT( 0.7, 1.4 ); + pev->framerate = RANDOM_FLOAT( 0.7f, 1.4f ); } ResetSequenceInfo(); pev->solid = SOLID_NOT; pev->movetype = MOVETYPE_NONE; - pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1, 0.4 ); // Load balance these a bit + pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1f, 0.4f ); // Load balance these a bit } void CXenHair::Think( void ) { StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.5; + pev->nextthink = gpGlobals->time + 0.5f; } void CXenHair::Precache( void ) @@ -283,9 +283,9 @@ void CXenTree::Spawn( void ) UTIL_SetSize( pev, Vector( -30, -30, 0 ), Vector( 30, 30, 188 ) ); SetActivity( ACT_IDLE ); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; pev->frame = RANDOM_FLOAT( 0, 255 ); - pev->framerate = RANDOM_FLOAT( 0.7, 1.4 ); + pev->framerate = RANDOM_FLOAT( 0.7f, 1.4f ); Vector triggerPosition; UTIL_MakeVectorsPrivate( pev->angles, triggerPosition, NULL, NULL ); @@ -329,7 +329,7 @@ void CXenTree::Attack( void ) if( GetActivity() == ACT_IDLE ) { SetActivity( ACT_MELEE_ATTACK1 ); - pev->framerate = RANDOM_FLOAT( 1.0, 1.4 ); + pev->framerate = RANDOM_FLOAT( 1.0f, 1.4f ); EMIT_SOUND_ARRAY_DYN( CHAN_WEAPON, pAttackMissSounds ); } } @@ -375,7 +375,7 @@ void CXenTree::HandleAnimEvent( MonsterEvent_t *pEvent ) void CXenTree::Think( void ) { float flInterval = StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; DispatchAnimEvents( flInterval ); switch( GetActivity() ) @@ -384,7 +384,7 @@ void CXenTree::Think( void ) if( m_fSequenceFinished ) { SetActivity( ACT_IDLE ); - pev->framerate = RANDOM_FLOAT( 0.6, 1.4 ); + pev->framerate = RANDOM_FLOAT( 0.6f, 1.4f ); } break; default: @@ -513,9 +513,9 @@ void CXenSpore :: Spawn( void ) //SetActivity( ACT_IDLE ); pev->sequence = 0; pev->frame = RANDOM_FLOAT( 0, 255 ); - pev->framerate = RANDOM_FLOAT( 0.7, 1.4 ); + pev->framerate = RANDOM_FLOAT( 0.7f, 1.4f ); ResetSequenceInfo(); - pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1, 0.4 ); // Load balance these a bit + pev->nextthink = gpGlobals->time + RANDOM_FLOAT( 0.1f, 0.4f ); // Load balance these a bit } const char *CXenSpore::pModelNames[] = @@ -537,7 +537,7 @@ void CXenSpore::Touch( CBaseEntity *pOther ) void CXenSpore::Think( void ) { StudioFrameAdvance(); - pev->nextthink = gpGlobals->time + 0.1; + pev->nextthink = gpGlobals->time + 0.1f; #if 0 DispatchAnimEvents( flInterval ); diff --git a/dlls/zombie.cpp b/dlls/zombie.cpp index 96f032e6..7f891a36 100644 --- a/dlls/zombie.cpp +++ b/dlls/zombie.cpp @@ -136,11 +136,11 @@ int CZombie::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float // Take 30% damage from bullets if( bitsDamageType == DMG_BULLET ) { - Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5; + Vector vecDir = pev->origin - ( pevInflictor->absmin + pevInflictor->absmax ) * 0.5f; vecDir = vecDir.Normalize(); float flForce = DamageForce( flDamage ); pev->velocity = pev->velocity + vecDir * flForce; - flDamage *= 0.3; + flDamage *= 0.3f; } // HACK HACK -- until we fix this. diff --git a/engine/cdll_int.h b/engine/cdll_int.h index abfc43bd..8ab903b0 100644 --- a/engine/cdll_int.h +++ b/engine/cdll_int.h @@ -169,7 +169,7 @@ typedef struct cl_enginefuncs_s int (*GetWindowCenterX)( void ); int (*GetWindowCenterY)( void ); void (*GetViewAngles)( float * ); - void (*SetViewAngles)( float * ); + void (*SetViewAngles)( const float * ); int (*GetMaxClients)( void ); void (*Cvar_SetValue)( const char *cvar, float value ); @@ -195,20 +195,20 @@ typedef struct cl_enginefuncs_s float (*GetClientTime)( void ); void (*V_CalcShake)( void ); - void (*V_ApplyShake)( float *origin, float *angles, float factor ); + void (*V_ApplyShake)( const float *origin, const float *angles, float factor ); - int (*PM_PointContents)( float *point, int *truecontents ); - int (*PM_WaterEntity)( float *p ); - struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe ); + int (*PM_PointContents)( const float *point, int *truecontents ); + int (*PM_WaterEntity)( const float *p ); + struct pmtrace_s *(*PM_TraceLine)( const float *start, const float *end, int flags, int usehull, int ignore_pe ); struct model_s *(*CL_LoadModel)( const char *modelname, int *index ); int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent ); const struct model_s* (*GetSpritePointer)( HSPRITE hSprite ); - void (*pfnPlaySoundByNameAtLocation)( const char *szSound, float volume, float *origin ); + void (*pfnPlaySoundByNameAtLocation)( const char *szSound, float volume, const float *origin ); unsigned short (*pfnPrecacheEvent)( int type, const char* psz ); - void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); + void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); void (*pfnWeaponAnim)( int iAnim, int body ); float (*pfnRandomFloat)( float flLow, float flHigh ); int (*pfnRandomLong)( int lLow, int lHigh ); diff --git a/engine/eiface.h b/engine/eiface.h index f6cf2f51..6a5f86fc 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -124,7 +124,7 @@ typedef struct enginefuncs_s int (*pfnWalkMove)( edict_t *ent, float yaw, float dist, int iMode ); void (*pfnSetOrigin)( edict_t *e, const float *rgflOrigin ); void (*pfnEmitSound)( edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch ); - void (*pfnEmitAmbientSound)( edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch ); + void (*pfnEmitAmbientSound)( edict_t *entity, const float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch ); void (*pfnTraceLine)( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr ); void (*pfnTraceToss)( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr ); int (*pfnTraceMonsterHull)( edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr ); @@ -219,10 +219,10 @@ typedef struct enginefuncs_s void (*pfnSetPhysicsKeyValue)( const edict_t *pClient, const char *key, const char *value ); const char *(*pfnGetPhysicsInfoString)( const edict_t *pClient ); unsigned short (*pfnPrecacheEvent)( int type, const char*psz ); - void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); - - unsigned char *(*pfnSetFatPVS)( float *org ); - unsigned char *(*pfnSetFatPAS)( float *org ); + void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, const float *origin, const float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); + + unsigned char *(*pfnSetFatPVS)( const float *org ); + unsigned char *(*pfnSetFatPAS)( const float *org ); int (*pfnCheckVisibility )( const edict_t *entity, unsigned char *pset ); @@ -241,7 +241,7 @@ typedef struct enginefuncs_s // Forces the client and server to be running with the same version of the specified file // ( e.g., a player model ). // Calling this has no effect in single player - void (*pfnForceUnmodified)( FORCE_TYPE type, float *mins, float *maxs, const char *filename ); + void (*pfnForceUnmodified)( FORCE_TYPE type, const float *mins, const float *maxs, const char *filename ); void (*pfnGetPlayerStats)( const edict_t *pClient, int *ping, int *packet_loss ); @@ -355,7 +355,7 @@ typedef enum _fieldtypes FIELD_TYPECOUNT // MUST BE LAST } FIELDTYPE; -#if !defined(offsetof) && !defined(GNUC) +#if !defined(offsetof) && !defined(__GNUC__) #define offsetof(s,m) (size_t)&(((s *)0)->m) #endif diff --git a/gnu.txt b/gnu.txt deleted file mode 100644 index e587591e..00000000 --- a/gnu.txt +++ /dev/null @@ -1,621 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/pm_shared/pm_debug.c b/pm_shared/pm_debug.c index 3b0879c7..fbe1e288 100644 --- a/pm_shared/pm_debug.c +++ b/pm_shared/pm_debug.c @@ -12,8 +12,12 @@ * without written permission from Valve LLC. * ****/ - +#include #include "mathlib.h" +#ifdef HAVE_TGMATH_H +#include +#endif + #include "const.h" #include "usercmd.h" #include "pm_defs.h" @@ -76,7 +80,7 @@ void PM_ShowClipBox( void ) // Show our BBOX in particles. PM_DrawBBox( pmove->player_mins[pmove->usehull], pmove->player_maxs[pmove->usehull], org, pmove->server ? 132 : 0, 0.1 ); - PM_ParticleLine( org, org, pmove->server ? 132 : 0, 0.1, 5.0 ); + PM_ParticleLine( org, org, pmove->server ? 132 : 0, 0.1f, 5.0f ); /* { int i; @@ -179,13 +183,13 @@ void PM_DrawPhysEntBBox(int num, int pcolor, float life) { vec3_t forward, right, up; - AngleVectorsTranspose(pe->angles, forward, right, up); - for (j = 0; j < 8; j++) + AngleVectorsTranspose( pe->angles, forward, right, up); + for( j = 0; j < 8; j++ ) { VectorCopy(p[j], tmp); - p[j][0] = DotProduct ( tmp, forward ); - p[j][1] = DotProduct ( tmp, right ); - p[j][2] = DotProduct ( tmp, up ); + p[j][0] = DotProduct( tmp, forward ); + p[j][1] = DotProduct( tmp, right ); + p[j][2] = DotProduct( tmp, up ); } } @@ -296,7 +300,7 @@ void PM_ViewEntity( void ) VectorCopy( pmove->origin, origin); - fup = 0.5*( pmove->player_mins[pmove->usehull][2] + pmove->player_maxs[pmove->usehull][2] ); + fup = 0.5f * ( pmove->player_mins[pmove->usehull][2] + pmove->player_maxs[pmove->usehull][2] ); fup += pmove->view_ofs[2]; fup -= 4; diff --git a/pm_shared/pm_math.c b/pm_shared/pm_math.c index 4bb4b93f..87c65d9f 100644 --- a/pm_shared/pm_math.c +++ b/pm_shared/pm_math.c @@ -13,10 +13,12 @@ * ****/ // pm_math.c -- math primitives - -#include "mathlib.h" -#include "const.h" #include +#include "mathlib.h" +#ifdef HAVE_TGMATH_H +#include +#endif +#include "const.h" // up / down #define PITCH 0 @@ -29,12 +31,12 @@ #pragma warning(disable : 4244) #endif -vec3_t vec3_origin = { 0,0,0 }; +vec3_t vec3_origin = { 0, 0, 0 }; int nanmask = 255 << 23; float anglemod( float a ) { - a = ( 360.0 / 65536 ) * ( (int)( a * ( 65536 / 360.0 ) ) & 65535 ); + a = ( 360.0f / 65536.0f ) * ( (int)( a * ( 65536.0f / 360.0f ) ) & 65535 ); return a; } @@ -43,13 +45,13 @@ void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up 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 ); @@ -78,13 +80,13 @@ void AngleVectorsTranspose( const vec3_t angles, vec3_t forward, vec3_t right, v 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 ); @@ -113,13 +115,13 @@ void AngleMatrix( const vec3_t 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 ); @@ -133,9 +135,9 @@ void AngleMatrix( const vec3_t 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; } void AngleIMatrix( const vec3_t angles, float matrix[3][4] ) @@ -143,13 +145,13 @@ void AngleIMatrix( const vec3_t angles, float matrix[3][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 ); @@ -174,13 +176,13 @@ void 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; } } } @@ -209,13 +211,13 @@ void 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; @@ -240,7 +242,7 @@ float AngleBetweenVectors( const vec3_t v1, const vec3_t v2 ) return 0.0f; angle = acos( DotProduct( v1, v2 ) / ( l1 * l2 ) ); - angle = ( angle * 180.0f ) / M_PI; + angle = ( angle * 180.0f ) / M_PI_F; return angle; } @@ -303,8 +305,6 @@ void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) cross[2] = v1[0] * v2[1] - v1[1] * v2[0]; } -double sqrt( double x ); - float Length( const vec3_t v ) { int i; @@ -333,7 +333,7 @@ float VectorNormalize( vec3_t v ) if( length ) { - ilength = 1 / length; + ilength = 1.0f / length; v[0] *= ilength; v[1] *= ilength; v[2] *= ilength; @@ -368,18 +368,18 @@ void VectorMatrix( vec3_t forward, vec3_t right, vec3_t up ) { vec3_t tmp; - if( forward[0] == 0 && forward[1] == 0 ) + if( forward[0] == 0.0f && forward[1] == 0.0f ) { - right[0] = 1; - right[1] = 0; - right[2] = 0; + right[0] = 1.0f; + right[1] = 0.0f; + right[2] = 0.0f; up[0] = -forward[2]; - up[1] = 0; - up[2] = 0; + up[1] = 0.0f; + up[2] = 0.0f; return; } - tmp[0] = 0; tmp[1] = 0; tmp[2] = 1.0; + tmp[0] = 0.0f; tmp[1] = 0.0f; tmp[2] = 1.0f; CrossProduct( forward, tmp, right ); VectorNormalize( right ); CrossProduct( right, forward, up ); @@ -390,27 +390,27 @@ void VectorAngles( const vec3_t forward, vec3_t 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; } diff --git a/pm_shared/pm_shared.c b/pm_shared/pm_shared.c index ace56595..01825777 100644 --- a/pm_shared/pm_shared.c +++ b/pm_shared/pm_shared.c @@ -14,18 +14,22 @@ ****/ #include +//#include // NULL +#include // sqrt +#include // strcpy +#include // atoi +#include // isspace #include "mathlib.h" +#ifdef HAVE_TGMATH_H +#include +#endif + #include "const.h" #include "usercmd.h" #include "pm_defs.h" #include "pm_shared.h" #include "pm_movevars.h" #include "pm_debug.h" -//#include // NULL -#include // sqrt -#include // strcpy -#include // atoi -#include // isspace int g_bhopcap = 1; @@ -45,7 +49,7 @@ static int pm_shared_initialized = 0; playermove_t *pmove = NULL; // Ducking time -#define TIME_TO_DUCK 0.4 +#define TIME_TO_DUCK 0.4f #define VEC_DUCK_HULL_MIN -18 #define VEC_DUCK_HULL_MAX 18 #define VEC_DUCK_VIEW 12 @@ -56,7 +60,7 @@ playermove_t *pmove = NULL; #define VEC_HULL_MIN -36 #define VEC_HULL_MAX 36 #define VEC_VIEW 28 -#define STOP_EPSILON 0.1 +#define STOP_EPSILON 0.1f #define CTEXTURESMAX 512 // max number of textures loaded #define CBTEXTURENAMEMAX 13 // only load first n chars of name @@ -91,7 +95,7 @@ playermove_t *pmove = NULL; #define PLAYER_LONGJUMP_SPEED 350 // how fast we longjump -#define PLAYER_DUCKING_MULTIPLIER 0.333 +#define PLAYER_DUCKING_MULTIPLIER 0.333f // double to float warning #ifdef _MSC_VER @@ -284,7 +288,7 @@ void PM_PlayStepSound( int step, float fvol ) return; VectorCopy( pmove->velocity, hvel ); - hvel[2] = 0.0; + hvel[2] = 0.0f; if( pmove->multiplayer && ( !g_onladder && Length( hvel ) <= 220 ) ) return; @@ -594,7 +598,7 @@ void PM_UpdateStepSound( void ) // If we're on a ladder or on the ground, and we're moving fast enough, // play step sound. Also, if pmove->flTimeStepSound is zero, get the new // sound right away - we just started moving in new level. - if( ( fLadder || ( pmove->onground != -1 ) ) && ( Length( pmove->velocity ) > 0.0 ) && ( speed >= velwalk || !pmove->flTimeStepSound ) ) + if( ( fLadder || ( pmove->onground != -1 ) ) && ( Length( pmove->velocity ) > 0.0f ) && ( speed >= velwalk || !pmove->flTimeStepSound ) ) { fWalking = speed < velrun; @@ -604,26 +608,26 @@ void PM_UpdateStepSound( void ) height = pmove->player_maxs[pmove->usehull][2] - pmove->player_mins[pmove->usehull][2]; - knee[2] = pmove->origin[2] - 0.3 * height; - feet[2] = pmove->origin[2] - 0.5 * height; + knee[2] = pmove->origin[2] - 0.3f * height; + feet[2] = pmove->origin[2] - 0.5f * height; // find out what we're stepping in or on... if( fLadder ) { step = STEP_LADDER; - fvol = 0.35; + fvol = 0.35f; pmove->flTimeStepSound = 350; } else if( pmove->PM_PointContents( knee, NULL ) == CONTENTS_WATER ) { step = STEP_WADE; - fvol = 0.65; + fvol = 0.65f; pmove->flTimeStepSound = 600; } else if( pmove->PM_PointContents( feet, NULL ) == CONTENTS_WATER ) { step = STEP_SLOSH; - fvol = fWalking ? 0.2 : 0.5; + fvol = fWalking ? 0.2f : 0.5f; pmove->flTimeStepSound = fWalking ? 400 : 300; } else @@ -636,31 +640,31 @@ void PM_UpdateStepSound( void ) { default: case CHAR_TEX_CONCRETE: - fvol = fWalking ? 0.2 : 0.5; + fvol = fWalking ? 0.2f : 0.5f; pmove->flTimeStepSound = fWalking ? 400 : 300; break; case CHAR_TEX_METAL: - fvol = fWalking ? 0.2 : 0.5; + fvol = fWalking ? 0.2f : 0.5f; pmove->flTimeStepSound = fWalking ? 400 : 300; break; case CHAR_TEX_DIRT: - fvol = fWalking ? 0.25 : 0.55; + fvol = fWalking ? 0.25f : 0.55f; pmove->flTimeStepSound = fWalking ? 400 : 300; break; case CHAR_TEX_VENT: - fvol = fWalking ? 0.4 : 0.7; + fvol = fWalking ? 0.4f : 0.7f; pmove->flTimeStepSound = fWalking ? 400 : 300; break; case CHAR_TEX_GRATE: - fvol = fWalking ? 0.2 : 0.5; + fvol = fWalking ? 0.2f : 0.5f; pmove->flTimeStepSound = fWalking ? 400 : 300; break; case CHAR_TEX_TILE: - fvol = fWalking ? 0.2 : 0.5; + fvol = fWalking ? 0.2f : 0.5f; pmove->flTimeStepSound = fWalking ? 400 : 300; break; case CHAR_TEX_SLOSH: - fvol = fWalking ? 0.2 : 0.5; + fvol = fWalking ? 0.2f : 0.5f; pmove->flTimeStepSound = fWalking ? 400 : 300; break; } @@ -672,7 +676,7 @@ void PM_UpdateStepSound( void ) // 35% volume if ducking if( pmove->flags & FL_DUCKING ) { - fvol *= 0.35; + fvol *= 0.35f; } PM_PlayStepSound( step, fvol ); @@ -801,11 +805,11 @@ void PM_AddCorrectGravity() if( pmove->gravity ) ent_gravity = pmove->gravity; else - ent_gravity = 1.0; + ent_gravity = 1.0f; // Add gravity so they'll be in the correct position during movement // yes, this 0.5 looks wrong, but it's not. - pmove->velocity[2] -= ( ent_gravity * pmove->movevars->gravity * 0.5 * pmove->frametime ); + pmove->velocity[2] -= ( ent_gravity * pmove->movevars->gravity * 0.5f * pmove->frametime ); pmove->velocity[2] += pmove->basevelocity[2] * pmove->frametime; pmove->basevelocity[2] = 0; @@ -822,10 +826,10 @@ void PM_FixupGravityVelocity() if( pmove->gravity ) ent_gravity = pmove->gravity; else - ent_gravity = 1.0; + ent_gravity = 1.0f; // Get the correct velocity for the end of the dt - pmove->velocity[2] -= ( ent_gravity * pmove->movevars->gravity * pmove->frametime * 0.5 ); + pmove->velocity[2] -= ( ent_gravity * pmove->movevars->gravity * pmove->frametime * 0.5f ); PM_CheckVelocity(); } @@ -911,7 +915,7 @@ int PM_FlyMove( void ) // If the plane we hit has a high z component in the normal, then // it's probably a floor - if( trace.plane.normal[2] > 0.7 ) + if( trace.plane.normal[2] > 0.7f ) { blocked |= 1; // floor } @@ -946,14 +950,14 @@ int PM_FlyMove( void ) { for( i = 0; i < numplanes; i++ ) { - if( planes[i][2] > 0.7 ) + if( planes[i][2] > 0.7f ) { // floor or slope PM_ClipVelocity( original_velocity, planes[i], new_velocity, 1 ); VectorCopy( new_velocity, original_velocity ); } else - PM_ClipVelocity( original_velocity, planes[i], new_velocity, 1.0 + pmove->movevars->bounce * ( 1 - pmove->friction ) ); + PM_ClipVelocity( original_velocity, planes[i], new_velocity, 1.0f + pmove->movevars->bounce * ( 1 - pmove->friction ) ); } VectorCopy( new_velocity, pmove->velocity ); @@ -1202,8 +1206,9 @@ void PM_WalkMove() // If we are not on the ground any more then // use the original movement attempt - if( trace.plane.normal[2] < 0.7 ) + if( trace.plane.normal[2] < 0.7f ) goto usedown; + // If the trace ended up in empty space, copy the end // over to the origin. if( !trace.startsolid && !trace.allsolid ) @@ -1274,7 +1279,7 @@ void PM_Friction( void ) trace = pmove->PM_PlayerTrace( start, stop, PM_NORMAL, -1 ); - if( trace.fraction == 1.0 ) + if( trace.fraction == 1.0f ) friction = pmove->movevars->friction*pmove->movevars->edgefriction; else friction = pmove->movevars->friction; @@ -1388,7 +1393,7 @@ void PM_WaterMove( void ) wishspeed = pmove->maxspeed; } // Slow us down a bit. - wishspeed *= 0.8; + wishspeed *= 0.8f; VectorAdd( pmove->velocity, pmove->basevelocity, pmove->velocity ); @@ -1515,8 +1520,8 @@ qboolean PM_CheckWater() float heightover2; // Pick a spot just above the players feet. - point[0] = pmove->origin[0] + ( pmove->player_mins[pmove->usehull][0] + pmove->player_maxs[pmove->usehull][0] ) * 0.5; - point[1] = pmove->origin[1] + ( pmove->player_mins[pmove->usehull][1] + pmove->player_maxs[pmove->usehull][1] ) * 0.5; + point[0] = pmove->origin[0] + ( pmove->player_mins[pmove->usehull][0] + pmove->player_maxs[pmove->usehull][0] ) * 0.5f; + point[1] = pmove->origin[1] + ( pmove->player_mins[pmove->usehull][1] + pmove->player_maxs[pmove->usehull][1] ) * 0.5f; point[2] = pmove->origin[2] + pmove->player_mins[pmove->usehull][2] + 1; // Assume that we are not in water at all. @@ -1535,7 +1540,7 @@ qboolean PM_CheckWater() pmove->waterlevel = 1; height = ( pmove->player_mins[pmove->usehull][2] + pmove->player_maxs[pmove->usehull][2] ); - heightover2 = height * 0.5; + heightover2 = height * 0.5f; // Now check a point that is at the player hull midpoint. point[2] = pmove->origin[2] + heightover2; @@ -1610,7 +1615,7 @@ void PM_CatagorizePosition( void ) // Try and move down. tr = pmove->PM_PlayerTrace( pmove->origin, point, PM_NORMAL, -1 ); // If we hit a steep plane, we are not on ground - if( tr.plane.normal[2] < 0.7 ) + if( tr.plane.normal[2] < 0.7f ) pmove->onground = -1; // too steep else pmove->onground = tr.ent; // Otherwise, point to index of ent under us. @@ -1666,7 +1671,7 @@ try nudging slightly on all axis to allow for the cut precision of the net coordinates ================= */ -#define PM_CHECKSTUCK_MINTIME 0.05 // Don't check again too quickly. +#define PM_CHECKSTUCK_MINTIME 0.05f // Don't check again too quickly. int PM_CheckStuck( void ) { @@ -1752,8 +1757,8 @@ int PM_CheckStuck( void ) if( pmove->cmd.buttons & ( IN_JUMP | IN_DUCK | IN_ATTACK ) && ( pmove->physents[hitent].player != 0 ) ) { float x, y, z; - float xystep = 8.0; - float zstep = 18.0; + float xystep = 8.0f; + float zstep = 18.0f; float xyminmax = xystep; float zminmax = 4 * zstep; @@ -1826,7 +1831,7 @@ void PM_SpectatorMove( void ) { drop = 0; - friction = pmove->movevars->friction * 1.5; // extra friction + friction = pmove->movevars->friction * 1.5f; // extra friction control = speed < pmove->movevars->stopspeed ? pmove->movevars->stopspeed : speed; drop += control * friction*pmove->frametime; @@ -2043,12 +2048,12 @@ void PM_Duck( void ) pmove->bInDuck = true; } - time = max( 0.0, ( 1.0 - (float)pmove->flDuckTime / 1000.0 ) ); + time = max( 0.0f, ( 1.0f - (float)pmove->flDuckTime / 1000.0f ) ); if( pmove->bInDuck ) { // Finish ducking immediately if duck time is over or not on ground - if( ( (float)pmove->flDuckTime / 1000.0 <= ( 1.0 - TIME_TO_DUCK ) ) || ( pmove->onground == -1 ) ) + if( ( (float)pmove->flDuckTime / 1000.0f <= ( 1.0f - TIME_TO_DUCK ) ) || ( pmove->onground == -1 ) ) { pmove->usehull = 1; pmove->view_ofs[2] = VEC_DUCK_VIEW; @@ -2074,7 +2079,7 @@ void PM_Duck( void ) float fMore = VEC_DUCK_HULL_MIN - VEC_HULL_MIN; // Calc parametric time - duckFraction = PM_SplineFraction( time, (1.0/TIME_TO_DUCK) ); + duckFraction = PM_SplineFraction( time, ( 1.0f / TIME_TO_DUCK ) ); pmove->view_ofs[2] = ( ( VEC_DUCK_VIEW - fMore ) * duckFraction ) + ( VEC_VIEW * ( 1 - duckFraction ) ); } } @@ -2116,7 +2121,7 @@ void PM_LadderMove( physent_t *pLadder ) pmove->gravity = 0; pmove->PM_TraceModel( pLadder, pmove->origin, ladderCenter, &trace ); - if( trace.fraction != 1.0 ) + if( trace.fraction != 1.0f ) { float forward = 0, right = 0; vec3_t vpn, v_right; @@ -2261,7 +2266,7 @@ void PM_AddGravity() if( pmove->gravity ) ent_gravity = pmove->gravity; else - ent_gravity = 1.0; + ent_gravity = 1.0f; // Add gravity incorrectly pmove->velocity[2] -= ( ent_gravity * pmove->movevars->gravity * pmove->frametime ); @@ -2289,7 +2294,7 @@ pmtrace_t PM_PushEntity( vec3_t push ) VectorCopy( trace.endpos, pmove->origin ); // So we can run impact function afterwards. - if( trace.fraction < 1.0 && !trace.allsolid ) + if( trace.fraction < 1.0f && !trace.allsolid ) { PM_AddToTouched( trace, pmove->velocity ); } @@ -2356,16 +2361,16 @@ void PM_Physics_Toss() } if( pmove->movetype == MOVETYPE_BOUNCE ) - backoff = 2.0 - pmove->friction; + backoff = 2.0f - pmove->friction; else if( pmove->movetype == MOVETYPE_BOUNCEMISSILE ) - backoff = 2.0; + backoff = 2.0f; else - backoff = 1; + backoff = 1.0f; PM_ClipVelocity( pmove->velocity, trace.plane.normal, pmove->velocity, backoff ); // stop if on ground - if( trace.plane.normal[2] > 0.7 ) + if( trace.plane.normal[2] > 0.7f ) { float vel; vec3_t base; @@ -2389,7 +2394,7 @@ void PM_Physics_Toss() } else { - VectorScale( pmove->velocity, ( 1.0 - trace.fraction) * pmove->frametime * 0.9, move ); + VectorScale( pmove->velocity, ( 1.0f - trace.fraction) * pmove->frametime * 0.9f, move ); trace = PM_PushEntity( move ); } VectorSubtract( pmove->velocity, base, pmove->velocity ) @@ -2461,7 +2466,7 @@ void PM_PreventMegaBunnyJumping( void ) if( spd <= maxscaledspeed ) return; - fraction = ( maxscaledspeed / spd ) * 0.65; //Returns the modifier for the velocity + fraction = ( maxscaledspeed / spd ) * 0.65f; //Returns the modifier for the velocity VectorScale( pmove->velocity, fraction, pmove->velocity ); //Crop it down!. } @@ -2566,7 +2571,7 @@ void PM_Jump( void ) } else { - PM_PlayStepSound( PM_MapTextureTypeStepType( pmove->chtexturetype ), 1.0 ); + PM_PlayStepSound( PM_MapTextureTypeStepType( pmove->chtexturetype ), 1.0f ); } // See if user can super long jump? @@ -2585,19 +2590,19 @@ void PM_Jump( void ) for( i = 0; i < 2; i++ ) { - pmove->velocity[i] = pmove->forward[i] * PLAYER_LONGJUMP_SPEED * 1.6; + pmove->velocity[i] = pmove->forward[i] * PLAYER_LONGJUMP_SPEED * 1.6f; } - pmove->velocity[2] = sqrt( 2 * 800 * 56.0 ); + pmove->velocity[2] = sqrt( 2.0f * 800.0f * 56.0f ); } else { - pmove->velocity[2] = sqrt( 2 * 800 * 45.0 ); + pmove->velocity[2] = sqrt( 2.0f * 800.0f * 45.0f ); } } else { - pmove->velocity[2] = sqrt( 2 * 800 * 45.0 ); + pmove->velocity[2] = sqrt( 2.0f * 800.0f * 45.0f ); } // Decay it for simulation @@ -2645,7 +2650,7 @@ void PM_CheckWaterJump( void ) VectorNormalize( flatforward ); // Are we backing into water from steps or something? If so, don't pop forward - if( curspeed != 0.0 && ( DotProduct( flatvelocity, flatforward ) < 0.0 ) ) + if( curspeed != 0.0f && ( DotProduct( flatvelocity, flatforward ) < 0.0f ) ) return; VectorCopy( pmove->origin, vecStart ); @@ -2657,14 +2662,14 @@ void PM_CheckWaterJump( void ) savehull = pmove->usehull; pmove->usehull = 2; tr = pmove->PM_PlayerTrace( vecStart, vecEnd, PM_NORMAL, -1 ); - if( tr.fraction < 1.0 && fabs( tr.plane.normal[2] ) < 0.1f ) // Facing a near vertical wall? + if( tr.fraction < 1.0f && fabs( tr.plane.normal[2] ) < 0.1f ) // Facing a near vertical wall? { vecStart[2] += pmove->player_maxs[savehull][2] - WJ_HEIGHT; VectorMA( vecStart, 24, flatforward, vecEnd ); VectorMA( vec3_origin, -50, tr.plane.normal, pmove->movedir ); tr = pmove->PM_PlayerTrace( vecStart, vecEnd, PM_NORMAL, -1 ); - if( tr.fraction == 1.0 ) + if( tr.fraction == 1.0f ) { pmove->waterjumptime = 2000; pmove->velocity[2] = 225; @@ -2681,7 +2686,7 @@ void PM_CheckFalling( void ) { if( pmove->onground != -1 && !pmove->dead && pmove->flFallVelocity >= PLAYER_FALL_PUNCH_THRESHHOLD ) { - float fvol = 0.5; + float fvol = 0.5f; if( pmove->waterlevel > 0 ) { @@ -2699,7 +2704,7 @@ void PM_CheckFalling( void ) pmove->PM_PlaySound( CHAN_VOICE, "player/pl_fallpain3.wav", 1, ATTN_NORM, 0, PITCH_NORM ); // break; //} - fvol = 1.0; + fvol = 1.0f; } else if( pmove->flFallVelocity > PLAYER_MAX_SAFE_FALL_SPEED / 2 ) { @@ -2718,7 +2723,7 @@ void PM_CheckFalling( void ) fvol = 0; } - if( fvol > 0.0 ) + if( fvol > 0.0f ) { // Play landing step right away pmove->flTimeStepSound = 0; @@ -2729,7 +2734,7 @@ void PM_CheckFalling( void ) PM_PlayStepSound( PM_MapTextureTypeStepType( pmove->chtexturetype ), fvol ); // Knock the screen around a little bit, temporary effect - pmove->punchangle[2] = pmove->flFallVelocity * 0.013; // punch z axis + pmove->punchangle[2] = pmove->flFallVelocity * 0.013f; // punch z axis if( pmove->punchangle[0] > 8 ) { @@ -2819,8 +2824,8 @@ void PM_DropPunchAngle( vec3_t punchangle ) float len; len = VectorNormalize( punchangle ); - len -= ( 10.0 + len * 0.5 ) * pmove->frametime; - len = max( len, 0.0 ); + len -= ( 10.0f + len * 0.5f ) * pmove->frametime; + len = max( len, 0.0f ); VectorScale( punchangle, len, punchangle ); } @@ -2841,12 +2846,12 @@ void PM_CheckParamters( void ) spd = sqrt( spd ); maxspeed = pmove->clientmaxspeed; //atof( pmove->PM_Info_ValueForKey( pmove->physinfo, "maxspd" ) ); - if( maxspeed != 0.0 ) + if( maxspeed != 0.0f ) { pmove->maxspeed = min( maxspeed, pmove->maxspeed ); } - if( ( spd != 0.0 ) && ( spd > pmove->maxspeed ) ) + if( ( spd != 0.0f ) && ( spd > pmove->maxspeed ) ) { float fRatio = pmove->maxspeed / spd; pmove->cmd.forwardmove *= fRatio; @@ -2944,7 +2949,7 @@ void PM_PlayerMove( qboolean server ) pmove->numtouch = 0; // # of msec to apply movement - pmove->frametime = pmove->cmd.msec * 0.001; + pmove->frametime = pmove->cmd.msec * 0.001f; PM_ReduceTimers(); @@ -3126,7 +3131,7 @@ void PM_PlayerMove( qboolean server ) // we don't slow when standing still, relative to the conveyor. if( pmove->onground != -1 ) { - pmove->velocity[2] = 0.0; + pmove->velocity[2] = 0.0f; PM_Friction(); } @@ -3190,7 +3195,7 @@ void PM_CreateStuckTable( void ) // Little Moves. x = y = 0; // Z moves - for( z = -0.125; z <= 0.125; z += 0.125 ) + for( z = -0.125f; z <= 0.125f; z += 0.125f ) { rgv3tStuckTable[idx][0] = x; rgv3tStuckTable[idx][1] = y; @@ -3199,7 +3204,7 @@ void PM_CreateStuckTable( void ) } x = z = 0; // Y moves - for( y = -0.125; y <= 0.125; y += 0.125 ) + for( y = -0.125f; y <= 0.125f; y += 0.125f ) { rgv3tStuckTable[idx][0] = x; rgv3tStuckTable[idx][1] = y; @@ -3208,7 +3213,7 @@ void PM_CreateStuckTable( void ) } y = z = 0; // X moves - for( x = -0.125; x <= 0.125; x += 0.125 ) + for( x = -0.125f; x <= 0.125f; x += 0.125f ) { rgv3tStuckTable[idx][0] = x; rgv3tStuckTable[idx][1] = y; @@ -3217,11 +3222,11 @@ void PM_CreateStuckTable( void ) } // Remaining multi axis nudges. - for( x = - 0.125; x <= 0.125; x += 0.250 ) + for( x = - 0.125f; x <= 0.125f; x += 0.250f ) { - for( y = - 0.125; y <= 0.125; y += 0.250 ) + for( y = - 0.125f; y <= 0.125f; y += 0.250f ) { - for( z = - 0.125; z <= 0.125; z += 0.250 ) + for( z = - 0.125f; z <= 0.125f; z += 0.250f ) { rgv3tStuckTable[idx][0] = x; rgv3tStuckTable[idx][1] = y; @@ -3250,7 +3255,7 @@ void PM_CreateStuckTable( void ) x = z = 0; // Y moves - for( y = -2.0f ; y <= 2.0f ; y += 2.0 ) + for( y = -2.0f; y <= 2.0f; y += 2.0f ) { rgv3tStuckTable[idx][0] = x; rgv3tStuckTable[idx][1] = y; @@ -3259,7 +3264,7 @@ void PM_CreateStuckTable( void ) } y = z = 0; // X moves - for( x = -2.0f ; x <= 2.0f ; x += 2.0f ) + for( x = -2.0f; x <= 2.0f; x += 2.0f ) { rgv3tStuckTable[idx][0] = x; rgv3tStuckTable[idx][1] = y; @@ -3274,7 +3279,7 @@ void PM_CreateStuckTable( void ) for( x = -2.0f; x <= 2.0f; x += 2.0f ) { - for( y = -2.0f; y <= 2.0f; y += 2.0 ) + for( y = -2.0f; y <= 2.0f; y += 2.0f ) { rgv3tStuckTable[idx][0] = x; rgv3tStuckTable[idx][1] = y; diff --git a/scripts/waifulib/strip_on_install.py b/scripts/waifulib/strip_on_install.py new file mode 100644 index 00000000..6522065d --- /dev/null +++ b/scripts/waifulib/strip_on_install.py @@ -0,0 +1,49 @@ +#! /usr/bin/env python +# Modified: Alibek Omarov +# Originally taken from Thomas Nagy's blogpost + +""" +Strip executables upon installation +""" + +import shutil, os +from waflib import Build, Utils, Context, Errors, Logs + +def options(opt): + grp = opt.option_groups['install/uninstall options'] + grp.add_option('--no-strip', dest='no_strip', action='store_true', default=False, + help='don\'t strip binaries. You must pass this flag to install command(default: False)') + +def configure(conf): + if conf.env.DEST_BINFMT in ['elf', 'mac-o']: + conf.find_program('strip', var='STRIP') + if not conf.env.STRIPFLAGS: + conf.env.STRIPFLAGS = os.environ['STRIPFLAGS'] if 'STRIPFLAGS' in os.environ else [] + +def copy_fun(self, src, tgt): + inst_copy_fun(self, src, tgt) + + if self.generator.bld.options.no_strip: + return + + if self.env.DEST_BINFMT not in ['elf', 'mac-o']: # don't strip unknown formats or PE + return + + if getattr(self.generator, 'link_task', None) and self.generator.link_task.outputs[0] in self.inputs: + cmd = self.env.STRIP + self.env.STRIPFLAGS + [tgt] + try: + self.generator.bld.cmd_and_log(cmd, output=Context.BOTH, quiet=Context.BOTH) + if not self.generator.bld.progress_bar: + c1 = Logs.colors.NORMAL + c2 = Logs.colors.CYAN + + f1 = os.path.getsize(src) + f2 = os.path.getsize(tgt) + + Logs.info('%s+ strip %s%s%s (%d bytes change)', c1, c2, tgt, c1, f2 - f1) + except Errors.WafError as e: + print(e.stdout, e.stderr) + +inst_copy_fun = Build.inst.copy_fun +Build.inst.copy_fun = copy_fun + diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py new file mode 100644 index 00000000..a7818911 --- /dev/null +++ b/scripts/waifulib/xcompile.py @@ -0,0 +1,409 @@ +# encoding: utf-8 +# xcompile.py -- crosscompiling utils +# Copyright (C) 2018 a1batross +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +try: from fwgslib import get_flags_by_compiler +except: from waflib.extras.fwgslib import get_flags_by_compiler +from waflib import Logs, TaskGen +from waflib.Tools import c_config +from collections import OrderedDict +import os +import sys + +ANDROID_NDK_ENVVARS = ['ANDROID_NDK_HOME', 'ANDROID_NDK'] +ANDROID_NDK_SUPPORTED = [10, 19, 20] +ANDROID_NDK_HARDFP_MAX = 11 # latest version that supports hardfp +ANDROID_NDK_GCC_MAX = 17 # latest NDK that ships with GCC +ANDROID_NDK_UNIFIED_SYSROOT_MIN = 15 +ANDROID_NDK_SYSROOT_FLAG_MAX = 19 # latest NDK that need --sysroot flag +ANDROID_NDK_API_MIN = { 10: 3, 19: 16, 20: 16 } # minimal API level ndk revision supports +ANDROID_64BIT_API_MIN = 21 # minimal API level that supports 64-bit targets + +# This class does support ONLY r10e and r19c/r20 NDK +class Android: + ctx = None # waf context + arch = None + toolchain = None + api = None + ndk_home = None + ndk_rev = 0 + is_hardfloat = False + clang = False + + def __init__(self, ctx, arch, toolchain, api): + self.ctx = ctx + self.api = api + self.toolchain = toolchain + self.arch = arch + + for i in ANDROID_NDK_ENVVARS: + self.ndk_home = os.getenv(i) + if self.ndk_home != None: + break + else: + ctx.fatal('Set %s environment variable pointing to the root of Android NDK!' % + ' or '.join(ANDROID_NDK_ENVVARS)) + + # TODO: this were added at some point of NDK development + # but I don't know at which version + # r10e don't have it + source_prop = os.path.join(self.ndk_home, 'source.properties') + if os.path.exists(source_prop): + with open(source_prop) as ndk_props_file: + for line in ndk_props_file.readlines(): + tokens = line.split('=') + trimed_tokens = [token.strip() for token in tokens] + + if 'Pkg.Revision' in trimed_tokens: + self.ndk_rev = int(trimed_tokens[1].split('.')[0]) + + if self.ndk_rev not in ANDROID_NDK_SUPPORTED: + ctx.fatal('Unknown NDK revision: %d' % (self.ndk_rev)) + else: + self.ndk_rev = ANDROID_NDK_SUPPORTED[0] + + if 'clang' in self.toolchain or self.ndk_rev > ANDROID_NDK_GCC_MAX: + self.clang = True + + if self.arch == 'armeabi-v7a-hard': + if self.ndk_rev <= ANDROID_NDK_HARDFP_MAX: + self.arch = 'armeabi-v7a' # Only armeabi-v7a have hard float ABI + self.is_hardfloat = True + else: + ctx.fatal('NDK does not support hardfloat ABI') + + if self.api < ANDROID_NDK_API_MIN[self.ndk_rev]: + self.api = ANDROID_NDK_API_MIN[self.ndk_rev] + Logs.warn('API level automatically was set to %d due to NDK support' % self.api) + + if self.is_arm64() or self.is_amd64() and self.api < ANDROID_64BIT_API_MIN: + self.api = ANDROID_64BIT_API_MIN + Logs.warn('API level for 64-bit target automatically was set to %d' % self.api) + + def is_host(self): + ''' + Checks if we using host compiler(implies clang) + ''' + return self.toolchain == 'host' + + def is_arm(self): + ''' + Checks if selected architecture is **32-bit** ARM + ''' + return self.arch.startswith('armeabi') + + def is_x86(self): + ''' + Checks if selected architecture is **32-bit** or **64-bit** x86 + ''' + return self.arch == 'x86' + + def is_amd64(self): + ''' + Checks if selected architecture is **64-bit** x86 + ''' + return self.arch == 'x86_64' + + def is_arm64(self): + ''' + Checks if selected architecture is AArch64 + ''' + return self.arch == 'aarch64' + + def is_clang(self): + ''' + Checks if selected toolchain is Clang (TODO) + ''' + return self.clang + + def is_hardfp(self): + return self.is_hardfloat + + def ndk_triplet(self, llvm_toolchain = False, toolchain_folder = False): + if self.is_x86(): + if toolchain_folder: + return 'x86' + else: + return 'i686-linux-android' + elif self.is_arm(): + if llvm_toolchain: + return 'armv7a-linux-androideabi' + else: + return 'arm-linux-androideabi' + elif self.is_amd64() and toolchain_folder: + return 'x86_64' + else: + return self.arch + '-linux-android' + + def apk_arch(self): + if self.is_arm64(): + return 'arm64-v8a' + return self.arch + + def gen_host_toolchain(self): + # With host toolchain we don't care about OS + # so just download NDK for Linux x86_64 + if self.is_host(): + return 'linux-x86_64' + + if sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): + osname = 'windows' + elif sys.platform.startswith('darwin'): + osname = 'darwin' + elif sys.platform.startswith('linux'): + osname = 'linux' + else: + self.ctx.fatal('Unsupported by NDK host platform') + + if sys.maxsize > 2**32: + arch = 'x86_64' + else: arch = 'x86' + + return '%s-%s' % (osname, arch) + + def gen_gcc_toolchain_path(self): + path = 'toolchains' + toolchain_host = self.gen_host_toolchain() + + if self.is_clang(): + toolchain_folder = 'llvm' + else: + if self.is_host(): + toolchain = '4.9' + else: + toolchain = self.toolchain + + toolchain_folder = '%s-%s' % (self.ndk_triplet(toolchain_folder = True), toolchain) + + return os.path.abspath(os.path.join(self.ndk_home, path, toolchain_folder, 'prebuilt', toolchain_host)) + + def gen_toolchain_path(self): + if self.is_clang(): + triplet = '%s%d-' % (self.ndk_triplet(llvm_toolchain = True), self.api) + else: + triplet = self.ndk_triplet() + '-' + return os.path.join(self.gen_gcc_toolchain_path(), 'bin', triplet) + + def gen_binutils_path(self): + return os.path.join(self.gen_gcc_toolchain_path(), self.ndk_triplet(), 'bin') + + def cc(self): + if self.is_host(): + return 'clang --target=%s%d' % (self.ndk_triplet(), self.api) + return self.gen_toolchain_path() + ('clang' if self.is_clang() else 'gcc') + + def cxx(self): + if self.is_host(): + return 'clang++ --target=%s%d' % (self.ndk_triplet(), self.api) + return self.gen_toolchain_path() + ('clang++' if self.is_clang() else 'g++') + + def strip(self): + if self.is_host(): + return 'llvm-strip' + return os.path.join(self.gen_binutils_path(), 'strip') + + def system_stl(self): + # TODO: proper STL support + return os.path.abspath(os.path.join(self.ndk_home, 'sources', 'cxx-stl', 'system', 'include')) + + def libsysroot(self): + arch = self.arch + if self.is_arm(): + arch = 'arm' + elif self.is_arm64(): + arch = 'arm64' + path = 'platforms/android-%s/arch-%s' % (self.api, arch) + + return os.path.abspath(os.path.join(self.ndk_home, path)) + + def sysroot(self): + if self.ndk_rev >= ANDROID_NDK_UNIFIED_SYSROOT_MIN: + return os.path.abspath(os.path.join(self.ndk_home, 'sysroot')) + else: + return self.libsysroot() + + def cflags(self, cxx = False): + cflags = [] + + if self.ndk_rev <= ANDROID_NDK_SYSROOT_FLAG_MAX: + cflags += ['--sysroot=%s' % (self.sysroot())] + else: + if self.is_host(): + cflags += [ + '--sysroot=%s/sysroot' % (self.gen_gcc_toolchain_path()), + '-isystem', '%s/usr/include/' % (self.sysroot()) + ] + + cflags += ['-I%s' % (self.system_stl()), '-DANDROID', '-D__ANDROID__'] + + if cxx and not self.is_clang() and self.toolchain not in ['4.8','4.9']: + cflags += ['-fno-sized-deallocation'] + + if self.is_arm(): + if self.arch == 'armeabi-v7a': + # ARMv7 support + cflags += ['-mthumb', '-mfpu=neon', '-mcpu=cortex-a9', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS', '-DVECTORIZE_SINCOS'] + + if not self.is_clang() and not self.is_host(): + cflags += [ '-mvectorize-with-neon-quad' ] + + if self.is_hardfp(): + cflags += ['-D_NDK_MATH_NO_SOFTFP=1', '-mfloat-abi=hard', '-DLOAD_HARDFP', '-DSOFTFP_LINK'] + + if self.is_host(): + # Clang builtin redefine w/ different calling convention bug + # NOTE: I did not added complex.h functions here, despite + # that NDK devs forgot to put __NDK_FPABI_MATH__ for complex + # math functions + # I personally don't need complex numbers support, but if you want it + # just run sed to patch header + for f in ['strtod', 'strtof', 'strtold']: + cflags += ['-fno-builtin-%s' % f] + else: + cflags += ['-mfloat-abi=softfp'] + else: + # ARMv5 support + cflags += ['-march=armv5te', '-mtune=xscale', '-msoft-float'] + elif self.is_x86(): + cflags += ['-mtune=atom', '-march=atom', '-mssse3', '-mfpmath=sse', '-DVECTORIZE_SINCOS', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS'] + return cflags + + # they go before object list + def linkflags(self): + linkflags = [] + if self.is_host(): + linkflags += ['--gcc-toolchain=%s' % self.gen_gcc_toolchain_path()] + + if self.ndk_rev <= ANDROID_NDK_SYSROOT_FLAG_MAX: + linkflags += ['--sysroot=%s' % (self.sysroot())] + elif self.is_host(): + linkflags += ['--sysroot=%s/sysroot' % (self.gen_gcc_toolchain_path())] + + if self.is_clang() or self.is_host(): + linkflags += ['-fuse-ld=lld'] + + linkflags += ['-Wl,--hash-style=both','-Wl,--no-undefined'] + return linkflags + + def ldflags(self): + ldflags = ['-lgcc', '-no-canonical-prefixes'] + if self.is_clang() or self.is_host(): + ldflags += ['-stdlib=libstdc++'] + if self.is_arm(): + if self.arch == 'armeabi-v7a': + ldflags += ['-march=armv7-a', '-mthumb'] + + if not self.is_clang() and not self.is_host(): # lld only + ldflags += ['-Wl,--fix-cortex-a8'] + + if self.is_hardfp(): + ldflags += ['-Wl,--no-warn-mismatch', '-lm_hard'] + else: + ldflags += ['-march=armv5te'] + return ldflags + +def options(opt): + android = opt.add_option_group('Android options') + android.add_option('--android', action='store', dest='ANDROID_OPTS', default=None, + help='enable building for android, format: --android=,,, example: --android=armeabi-v7a-hard,4.9,9') + +def configure(conf): + if conf.options.ANDROID_OPTS: + values = conf.options.ANDROID_OPTS.split(',') + if len(values) != 3: + conf.fatal('Invalid --android paramater value!') + + valid_archs = ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'aarch64'] + + if values[0] not in valid_archs: + conf.fatal('Unknown arch: %s. Supported: %r' % (values[0], ', '.join(valid_archs))) + + conf.android = android = Android(conf, values[0], values[1], int(values[2])) + conf.environ['CC'] = android.cc() + conf.environ['CXX'] = android.cxx() + conf.environ['STRIP'] = android.strip() + conf.env.CFLAGS += android.cflags() + conf.env.CXXFLAGS += android.cflags(True) + conf.env.LINKFLAGS += android.linkflags() + conf.env.LDFLAGS += android.ldflags() + + conf.env.HAVE_M = True + if android.is_hardfp(): + conf.env.LIB_M = ['m_hard'] + else: conf.env.LIB_M = ['m'] + + conf.env.PREFIX = '/lib/%s' % android.apk_arch() + + conf.msg('Selected Android NDK', '%s, version: %d' % (android.ndk_home, android.ndk_rev)) + # no need to print C/C++ compiler, as it would be printed by compiler_c/cxx + conf.msg('... C/C++ flags', ' '.join(android.cflags()).replace(android.ndk_home, '$NDK/')) + conf.msg('... link flags', ' '.join(android.linkflags()).replace(android.ndk_home, '$NDK/')) + conf.msg('... ld flags', ' '.join(android.ldflags()).replace(android.ndk_home, '$NDK/')) + + # conf.env.ANDROID_OPTS = android + conf.env.DEST_OS2 = 'android' + + MACRO_TO_DESTOS = OrderedDict({ '__ANDROID__' : 'android' }) + for k in c_config.MACRO_TO_DESTOS: + MACRO_TO_DESTOS[k] = c_config.MACRO_TO_DESTOS[k] # ordering is important + c_config.MACRO_TO_DESTOS = MACRO_TO_DESTOS + +def post_compiler_cxx_configure(conf): + conf.msg('Target OS', conf.env.DEST_OS) + conf.msg('Target CPU', conf.env.DEST_CPU) + conf.msg('Target binfmt', conf.env.DEST_BINFMT) + + if conf.options.ANDROID_OPTS: + if conf.android.ndk_rev == 19: + conf.env.CXXFLAGS_cxxshlib += ['-static-libstdc++'] + conf.env.LDFLAGS_cxxshlib += ['-static-libstdc++'] + return + +def post_compiler_c_configure(conf): + conf.msg('Target OS', conf.env.DEST_OS) + conf.msg('Target CPU', conf.env.DEST_CPU) + conf.msg('Target binfmt', conf.env.DEST_BINFMT) + + return + +from waflib.Tools import compiler_cxx, compiler_c + +compiler_cxx_configure = getattr(compiler_cxx, 'configure') +compiler_c_configure = getattr(compiler_c, 'configure') + +def patch_compiler_cxx_configure(conf): + compiler_cxx_configure(conf) + post_compiler_cxx_configure(conf) + +def patch_compiler_c_configure(conf): + compiler_c_configure(conf) + post_compiler_c_configure(conf) + +setattr(compiler_cxx, 'configure', patch_compiler_cxx_configure) +setattr(compiler_c, 'configure', patch_compiler_c_configure) + +@TaskGen.feature('cshlib', 'cxxshlib', 'dshlib', 'fcshlib', 'vnum') +@TaskGen.after_method('apply_link', 'propagate_uselib_vars') +@TaskGen.before_method('apply_vnum') +def apply_android_soname(self): + """ + Enforce SONAME on Android + """ + if self.env.DEST_OS != 'android': + return + + setattr(self, 'vnum', None) # remove vnum, so SONAME would not be overwritten + link = self.link_task + node = link.outputs[0] + libname = node.name + v = self.env.SONAME_ST % libname + self.env.append_value('LINKFLAGS', v.split()) diff --git a/waf b/waf new file mode 100755 index 00000000..53213cb6 --- /dev/null +++ b/waf @@ -0,0 +1,172 @@ +#!/usr/bin/env python +# encoding: latin-1 +# Thomas Nagy, 2005-2018 +# +""" +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +""" + +import os, sys, inspect + +VERSION="2.0.18" +REVISION="ff338576c6abcf8ea755ffa7e678f790" +GIT="6539bd1ad3e285b124c02859ee5862dbd80704b7" +INSTALL='' +C1='#[' +C2='#E' +C3='#2' +cwd = os.getcwd() +join = os.path.join + + +WAF='waf' +def b(x): + return x +if sys.hexversion>0x300000f: + WAF='waf3' + def b(x): + return x.encode() + +def err(m): + print(('\033[91mError: %s\033[0m' % m)) + sys.exit(1) + +def unpack_wafdir(dir, src): + f = open(src,'rb') + c = 'corrupt archive (%d)' + while 1: + line = f.readline() + if not line: err('run waf-light from a folder containing waflib') + if line == b('#==>\n'): + txt = f.readline() + if not txt: err(c % 1) + if f.readline() != b('#<==\n'): err(c % 2) + break + if not txt: err(c % 3) + txt = txt[1:-1].replace(b(C1), b('\n')).replace(b(C2), b('\r')).replace(b(C3), b('\x00')) + + import shutil, tarfile + try: shutil.rmtree(dir) + except OSError: pass + try: + for x in ('Tools', 'extras'): + os.makedirs(join(dir, 'waflib', x)) + except OSError: + err("Cannot unpack waf lib into %s\nMove waf in a writable directory" % dir) + + os.chdir(dir) + tmp = 't.bz2' + t = open(tmp,'wb') + try: t.write(txt) + finally: t.close() + + try: + t = tarfile.open(tmp) + except: + try: + os.system('bunzip2 t.bz2') + t = tarfile.open('t') + tmp = 't' + except: + os.chdir(cwd) + try: shutil.rmtree(dir) + except OSError: pass + err("Waf cannot be unpacked, check that bzip2 support is present") + + try: + for x in t: t.extract(x) + finally: + t.close() + + for x in ('Tools', 'extras'): + os.chmod(join('waflib',x), 493) + + if sys.hexversion<0x300000f: + sys.path = [join(dir, 'waflib')] + sys.path + import fixpy2 + fixpy2.fixdir(dir) + + os.remove(tmp) + os.chdir(cwd) + + try: dir = unicode(dir, 'mbcs') + except: pass + try: + from ctypes import windll + windll.kernel32.SetFileAttributesW(dir, 2) + except: + pass + +def test(dir): + try: + os.stat(join(dir, 'waflib')) + return os.path.abspath(dir) + except OSError: + pass + +def find_lib(): + src = os.path.abspath(inspect.getfile(inspect.getmodule(err))) + base, name = os.path.split(src) + + #devs use $WAFDIR + w=test(os.environ.get('WAFDIR', '')) + if w: return w + + #waf-light + if name.endswith('waf-light'): + w = test(base) + if w: return w + for dir in sys.path: + if test(dir): + return dir + err('waf-light requires waflib -> export WAFDIR=/folder') + + dirname = '%s-%s-%s' % (WAF, VERSION, REVISION) + for i in (INSTALL,'/usr','/usr/local','/opt'): + w = test(i + '/lib/' + dirname) + if w: return w + + #waf-local + dir = join(base, (sys.platform != 'win32' and '.' or '') + dirname) + w = test(dir) + if w: return w + + #unpack + unpack_wafdir(dir, src) + return dir + +wafdir = find_lib() +sys.path.insert(0, wafdir) + +if __name__ == '__main__': + sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', 'waifulib')) + from waflib import Scripting + Scripting.waf_entry_point(cwd, VERSION, wafdir) + +#==> +#BZh91AY&SY܋HP},Ƭ#200ebV{#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2׍Q{=hMOrw4fgTO/h]ZVO [X4>|lM<{T:of{]@b 7ozꮀg|9}9绽ës[Y#2}ww^n|G{ET}a{ok]ө{d3n&&ڷ4>Cvns.۷|#f6uѧ_ns;׫nNrvGu^7ιOlO{p4ne,=^^w6.wc)#2@&HQ#[!]`3n_E/sz)]75dvZ:uu]ΪlVix#2#2wQ#2*{sX{َ)آG9Ǜqb}g]Aڙnt5zz}y#2$zanfucjsvpz0:}=d6^}gO[ٞnv͆Cg|]9=s^y_dمl#E(V.Oz6[@8gK˦4*}ڸﻟ}#2;tݺZ#E*p6{]#[=m^3N7빰租UZrPzt==4't݈RvθwԞ 9]{|#2ac @DZ|4#2@ #2 #2#24D#2FOM@zCM4PjzS@ ! A2 CS&G&&1hh#2#2#2#2#2#2H 44ЙG钣4iiOQ#[im=h#2#2#2#2#2#2$JHjijOM50 SLSOP4iF=@#2#2#2#2#2$ #2#2#A0@h#E5=<@d A24MDA#2 2dȧ2hTbSeOS4#2#2#2#2#2rmwJGusmQWwkh̓>:HSTjʳ=[j6#X/|,gjʋ /|>s9Mc)j%ZGi#[ eے]ukoxۻkƹm׋+~<NjL$8Ի˼đ.V8J*pzsJ(­WDq$gO&-fJ+UvvL1Եoj7+\b" 4PI(C,"EtaaȀ#-HR=R`ALU1-*Z5E^ݵw#E#[ H$`YLZ 4֌Ril F %lLʄK#2J)maeKd5A0#Efɦ"b6HIQCiEE-Q$K+) IAe6H`1e3H6h&I- "f#%aiec)MM-Z*3X2 &6KI55R3d-&dHЕRe&34XFȖ6CP44I((X2#45)(؄!A"$,@#$!X!fhd"$aLMj231"JEej1ƉYHdbM RdSL%&M#E1"5%Fh3#[Q$D̒m$$`I ؉1M)mIBLeahII"KIE$DIB)ɂ("aIIc3I)5eI&($BZSd LleE"̒("b&ZQ$#JPlŋdLM &ɋER#Sd$fFhBIRKJ2m!)*e&1%K1F,L&H#[(јLPƠ#)Li# LPF2fQMc#["a#Kf,)*6iEF$$cc54Lcb4͓3%Da+#$l54"`QCSF#E51F#R2SDHlɑJeI#[X,LI&4"E#E#`LF0LiD#EIJ1fCfD%)(&jiebKI$# 6j JD2YeRXijSJM3ZPД̤ l`LhҘ0̙kh2LH)&djSl#[YRiBYRmL-1 b&)J"f&lXk7vf)Qda*iZm6Dm464ڕQeS(͢Y,mRAid#E0QjKTaFf2YM*HF3[%hiE&D-l&L6eZEEM"TdU6i*aMMfUQbȍledJe6UE M2ƪF,)QcDU!j06TRmQXbKdѵ[(,Q4M$m-حF-Q4f4J)FB$Ҵڈ4m15REQd&S5-d&ĄJZF,ԫ*RSe53eL6U,6[I$Yaaͤ-a 0Ih$hbRDTBTb2Ii+3@j+$E4QR16XSe hYd2E1)K#[EM2BE#6I#&)DąhĐdŢ,F#E E$Df4Ym2,i1f)Bj-"3j1F̤35"VKI,(%#[2Z(#[) Ě4e6e%*f &H,dD1٭*5)i5Dj@%16$*L$&k LTRji,m0DJ2Zdk"4г1)a1( *M#b5M Fl%EFUa’$i$Q&6#EeBD*2$JmƴmDMQAXm&0 MiDj5EF4QF"ْZ"1b1b2VRUř"ɤfP(3%`Ģ&m5V#E25JS4+E&KYRJR1jI! ldQY$1d5!3!j4m1R[$Z!M%54mI66LQFKPd+,Z+DV6i-R hLdfFcMHFl+F,mdeЕ mDTQ$mQLiQmE1f&3Mhm4lJԢT#4#[ZP4hD6KPk2ԕdڔISLV2cbmU*)*Q`!(ئ5L(cl[b5mֲT[)dSSl&4eDhIEPjJ3eb4 TF$)&DmIZ"|ܟWYiq,0閭J2,?Їye:b.!4%X(l0fD6O,:(|15žl{L*P <#[lZ/u \(4ZQB^?~YFrܝ5gjhM_JpfRfV:cFםwЇΜs_ٻ['?I,xڹQ#[X'mQgFѡ>IXBS#[f' e;6j4^.5E,DqKS\.YUPN0UIYC"Ҫ`K謼кTfõ&EcDETP1PXqNthxEڹ`E,8+u\,bźoM&Ω`h V>;|0zQ#EPJ^XNacXE`(#l*ڐ% ;b"h/i^\-m"RklZ5#[4j 袖(DAgHFcxûccQRmIh%.{/>O=Kd]+8uX "1Y$A?[vPاv|{RJ罗"SZ`8i(bi$2݁ʎU ﺖ"Vwլ*Х5œzY`ńQ )#E-6iU%;N%]MZMj˷|!#[#[@2(YU"N#[(~X\:!(zÈ:*}I+U"t##E.*pBUOSe(+;zÉH7͇T ]'QҡS n ?>xTC9k,5ӳ5rã,2ɞ6\@PRffF~Ox4P^bڼ4T_W:K<<13 6$ X]:Qj3tsM̼1FJ2P3T͒lYۭlτ&1mHmY~9n!BiP]~kfz/\TDN 5auljx6XsY(}SC./̍~:HTႰԦ;'xo^֫WF&؜p#ekrab=!9n;Ez[{6y9Ժ5$7CwJH1֛@83F?,bw W)DJ* Y!(.7'B4ߗ#[{AqkFoH |Cka !Cƶѯ(`q6>uXƬcȶ_f~pg0֧mz# !Mź_}Wg' VB] lP:`_cB#[:WrݟCqHf\)n_BRI&|o[OxkhE_c[y'FH(56/зm8{V=f{1A}[2H?ãw .G sHaުL/ƺ(?5L`.A-kc [avT S.A8Uf5ώY:6? Jj+{Uy6dY?s`ꚎO*ms%ltӿ;EEqQQx[1H4龜-}[1GO7~\f4ES`i=غ4x2/fH?#2rO&r2Om}P&dFiv>&Z:wæp#b)Lv_4$m;E)UN| x򹇓;./z- ӍiDQQe5a-FC#E((ꝚV!ԙ/g$&lwkV*s"1A>kAVG梳m/;<{E%#[Gq-2"#@Qh ̊5}5W65[5fC-88;J!jۥklX8woȲ31ҡ%MN0kP0Ő:!tx1KR] :YQ/"Qn5 Eu6쒈msNM";YFh5sr dkr)WZ|PvX@HהŸ՘momգ|K>rC{x2.+6o~U0$ݻKlۿ,(~^]$W9(Xhʇ{ԇV7VE8mȥս kWYK\Z7IIw,P֜9tC,b`qǟ*Kewv*e Unǿ鮬NpsfJ+Z=ҸSW rFs1^n< փ"kh6OMdGU .Kd0>!;+ P)˯]#[12Fw.3k1sUQD́ÿAr>~eho3ߪ0p$Cc ̨~8Pj'5":X@ @`[RsxE.::/>ƬF֘4s>wWxzؒ|%I$&GCdՐ2O{c>؂)&Bψ֓x#2 ѹR#2H@m}>#E.V}pمtڂY:zq&~w~UFF`H_g^&f(ҧտ"̲cEMvv(M$Q֙{h9=m/XGVέVgWT$3Yc0k;c#NMZSmwj8ީ7OZ!w|R貎]^(5$@5*(E+dX(#[b)!,gn#[W݀ߜES0lz)~ht=WQtLs|v>V1jѡkL#Wq*3>۵M.xf lr Kfm"go,br?\J1k~KV_%S}LLa˵$8}J>8 $.9. /q])qe\G_7C8t㰭q~:>xc@KMFMƥPxV\sK*ҸX#E#ESφj:wWj4.w|Sm,8q hU ;;ﴒoh-6Z\.UrMp#[TJm=2ӺpS&q@vl3iP%!˿fHt _]jUCQ\O5ϩ4z ~(w,3)=o~3&\_kĥR "#2,mr4U|){0>y~6[FMbv\>\ZE#E#H rٳ;g+[FW}]AO4. /LFncDt6 yg;bf(jlzwܾ;q+2Us:Qb:JسVUUJb)aBY|ZJ ?j;APz.#2!gGkRQX(SE D`|ѝs6@j@DQwyLmã>,Wω$f76.ʣ#2ƁIuc1@M㮢pX#[} o䣦p͚Dx4#'Jr'duvZ9_1X9^ONޞ0: wGۆ'b4)v-^uktպ/ zO}}K/8~O7]eZ0/p~`_}ɬoW Lvj,sn=fO8L]V rPןD%Sm@drYz-V)@)DȌߚ# Jg\-#2CbC `,9ȯuR@y*Vԯt:luUL8.@V۲𑑲ttKBF%a-?䯒#HNr+M<<80p !GgBF0졐rbu0(m 52Jk?OsySo҂ƸI]D$I {#>=+r˪`#EuGQlyGU)PK6cXt4 -H%ꐳɷ Mѯt?w&W0'UQP0wڃZ׏yN߻so# FCW(LoBuRB-M4D #E}+Y ւ"#2#[;?~#2i^kdBYxouwy%3喅G*v30Oz}ŵ۳of;#[7kߧ,_][ClmBL0PD*yRJ(Ȣ$03a#2c.ӠusD#ma#Ed|pY v`P[l#E5GsJ>u "vK 0΍#E~~ik"^/Ƶ 61 A!0t\lK1:m+WP\_?\#)1?<S$#EQWd#;:~>N\e;v:Pc#ECKT^FHL v?9\ѵ/P#2Ku Fq_޼=ϯcHl:\3pO~l/#~>|#Eh3sGԻ3;%_#:Cg1?el.Mm8*Th͊x'/H mv&FfzFߎf_.CEXȑuq ^%^Njjl@TƾG-6/I׏N3ŖO?` X#v΋f1-!Z\X.W?E9>F;9vm E[#[*+#E!#EuA'^nd#E4VQmY֓axy4FfbUPV4k%"2#L|`"b9} #[8aL^3g &g1:0חe=q (\*#ET,43U]'*L<#ӡ=a bCIJz#La:.X;3;T˝,PU[ה|uڙZ{,..H9ea@t̳yj\Q~@~̈́#2$Z|5aa vx mESaLc-c#޸Bg;:ܤ$XѩN^eCCGқ3ѽ2 I[Wb)a}q'MOO^mkx9DIN@<~ql&-d˃ߎ,02+M҂nhJHg{Sm]z潆h#0oɓ#EfL';~k mhJz3,PA#0N[5UdK-RzNaɝQ_Hb4"zVwc~&#ED&`%aYGGC7vWQj5E5nJh#Eԫ,abHUy>oK3Ȱ:tԄ_<~#[=F"%4LFZtU])6^Muc/gFP ۉaj=7)8oq%/>LcF#E0TztJ,]PA#%VDh\༄&/ө1$}kp/U`_PO#2,*b#EsRdnA{oPў8+vVl5 eb(_spKcl h/uuXF2D*H MFŕf1)[ XS R1SQ1CJ .W3#[XcAvA\tyAtȷ_LlxˋBLF1#[,"vNӸv5Q]YyݧH)1Iר@wis#nrsWx<^8wTvgkM]e$=OYŵ"`,j%|HU{[m.hQgjTa{ˆ@?:X0Ʊm (,[UJ[hŠQx-@Be/KoMx#EץI]k5#2f"͘=F<1K|abe7$,F2zuay_2*Pz1&S%EYbњЭ֨Cdn"gOM槽^j1}1;|v9Dnjo+Ӊ,8.ln#5H6hLu .XȆ77ptb#[ēY(C.p949BöB(y1/qP3y 4|Y^w=)HH╎\ĵdW4s7Hew|#Eӯm5.+ۑѺɷՅ>%`#tfHC acb@RxΤ-T,hAyӡeCD#21\!iyHsml#2Oqs#Eyb#2+6y6(Kv.wu1#FwnۖJʿut|ÿM4usTy!P XʅUPe"*TDkۡ4&#EeH+QU_WW|^]GxkDO.#EKJfT1D6x#,ofLcˇ 5/YccB.8P)"S"o*$#[x!1Bu:#E[q̋6fJ;b7em|w!?gܕ'y#Ӵ1JևNw+h9)i5Y=] ^u?כHLBW9ӟ3zfb/V18`$DfeZ`an:&eC!R;[#E֘Ι 4ͺB#[2J`@D(mzcjߪj4,Mh&׻o6+٢.c+cuR 'RS- *B `<^=iw$ pjdy Op,@b ILռ/oׇXc>:3!NA.sy/s?}qf|S#2{=>qd!9ż\4#[?/s([%"6}sgyzwQϽ9ؓKQ$,S#EO<1O#2K#[En˹=ッm(#eE̩NxS6Ν>w~p./%jA"ҽknW)hWm}l1󃑄 hE sB/r[GS+1Piʡ:.Sp;S)s aWpmZI$ #/^#E|][U, _<{p샣,@w-tqg?&6]^#[R';!~Xy>[4^ ;!p#j ]ulp B<&#2Oǚg[)t]$T'f(=ЙoU SQejRD4Y1@EiuH4|d_՟w(2a#[W+*}`E^YM_PԵd/lzₒ;?/ڲI?̂kgi,<=_W {z~J>^<}a~8:{$jl?,}B"¡EvLڒɢL@fʖ%8MlUEɪSDHnT}aH"c7:i|($6I=?wo7W]kD&)0(Cˈ喃%4 L1(p}wsFh"uM\ C>R7˽~AY wP>;ÁOX(ۂ05k9knmO?PDx2**He[jr#[$}LV%R뎌i5Ͱ+N ;zۑZ?vڒʩ[ m4ƝKsRƏ]ZK`Jԛ]Kۿ⏛&h(U=e\N$MSqzCums}ullH`e7I!U#EchKQXXJ}Mrx2=(T(` riaEE ׳#[2Zfd9xem$1c>~&*{Q>#["CalEa P#[A #[DRhm#[^Ϛ_`luy~oo֬GwQK4q%?OS\mzXb vo;Yii}X)Uǥ ;HO没P?PlN 8G^UJ` 4!NҚ4}̃DM]rqI}i`P~Nׄ4M܏O?|a =SG'ѿƊ4 fFCY26QEt_]wvx93>"9MMG* S1 JXTAUbzs(6oĒP<Ԡ:"w(dyX]fMSSּxwX>op$I7\k=_CHeܡXflzA!L#[dP>acQF4bA@mjEPM_qV 6 \&8K㻠}θ=ޮ}?]~}' qX2?Yz<gؖ|~m<ʣzFN _FbѺzOܳ#rw^%w|~Kħpn>Yݘ=5~[ڥ|wI';4y۷7;vlZ>o)8;юs;7\£vN~>:/>C Z6Q1Bb\b#EysUsO9QuIܞ<Î=nn;"^Vl廑ۯ;C¡1ds_1vl7>Rdxz#2zwXOg"anۻz#B| vbsGR g/}ǭf#MwcZHh12+gCһTv}}gha?gtفv#Ef>#EF?H˲O[߁wp"TF9NMSRVtN_{Q;J V8.o}=UA<8O~r:_3s#2m#2is$;;y?+ɒGv4QJ%Ъf壈rv$\=3$!Kܩ:-@DCM#E{dm:^Wry|W65ܗnF;Iױ͇E'c!IOdb.}]99+ϖRw~oM@7 7Iz^ÄyؒU?٥GY*bGuTA쒞Q|qz#2去cY|u~|/#`ydOZ,̹,0!1#EAȑFdAJbqx&(vh1 UiAQQ:Si68kMjD +HR#[kd0!XjlYYc'Ý;V &bTMFf&#ohW}*2N?wK-~;Yhfq[w]ZO!uN#[&$/[^0D[%v?Mw|ǁ#c F6,# f¾僻>3#2#2P,[2FfFDa`֗} IAb¥*26B40TUPT!( #2SݽuS;%v?+ֆчh.8`VU 8xja2s5;/sG͕뮭_N/ *>h~:~A)v~Lnk>| ? lw[~oA\We,0OdsP96GC^;a $av6?oٳNWyF Z[p9Vӧ)慛se|,$uwr8g]'5_WE=X*kR.~~~=|&r&s;- q2I|AEnӁ"M6Vz" U´[J-B:ゔ,JhQ< 1#EV4M QF&#T %TH#֡SӑDA6(VNiB@xU-p Li@e^0b:h-2TQ e e+4"dì7VbaV'vkj=J༓:tcoSwsEE]'5c""'No"U87-V-YipuKzs``K[X aĐ\S|1#>\R8@x۬P5о)s.TK2[֣F[@&$byw !NCCהj#8;q/vKzwI$"PG(cTRvRTHW43PiTR ̦H\S]y$$%ׯOy9#3#2DF>a(1*2#ER/\mFHG#[5 .ʹKі)YQK||{_0C*ww|ɠ ,``g\Xz2"cE뢴#[MɆ##D1TD|$T\P\+c0#ES릘7}UqƠՑAF4#NfhUw-F&QZ#2!{lDbk*FcTZ2}- r9p()Ne0#Ej5bLjf$dg9[bZSo֙\3+e-c2l?l(Ո#[&i.6B41@rƢln#N\ &e[C`2`.Bl˶1G2Q/-0wccWPmhǕF ;.D>t:wf<F`liZm~Gۮ/$cMPv~<_mw,QI[bT<(!c,ƛ y_ge703oPT+s 4۾|]Hi}':;nm~l) #[vcљ#2f F,XZUT4~c5DnGHҌiO| Y%ө Hȑ#u4CߪƫzV745LrHwq#Ela#[2T(qPGcE{/F04RhDŀL03 +kB!S/]M$<(-,׭H`~;?Ayqz|iF0EC78r-1 t[풄[v7ec˙`!I`8#EБWZa A oTe'hWEՐfRr7x;G#ccGR4yUE#Pm]B#EԈmଁk;o3~`isZÂQ„",S*Ip#E#Zc_H! #2PuD}N[UYo" M\шThGbG|5w.IFXKL4' dDօ#h&>h4Bb8ijF5Gs}M`rBy[`n0tE&Y#j+20f% ﹨[=U&240O04OK"vs5M cL >y9?_VdL-ۻzA!l?"{ְhz=F) ]mᶫƀO|`/#[!-ҳf&_C5-ƫ:}llc.";nfЅUL"g87#E =W#אM@of{񬰱7:XĐ;"Q@uBƮvR () 9f=cqڭtV=,9)69j#E)g#[5xoPNZ"-Dƴd"3SDP87Iq*#2LylOTf՝4#EݘF<ƨÆbnd|f3q2!Cpc(437ܦ^nюѭn:My5.ߗ8|2;I'5$%MfACx幻S8\A%g̙̈!9ʍ(|7#Et>rN\5#[#GV]Wk"wT%QvtwDydw#[6#[9c\&2]qqh5#EٌHmE|HX뫣NLyX-jv=.Xda9ɍhTr3}\sJ) n%h`XVC69vdr Z@" 6f19X؞}Ι֐8g5j:U cZN~K1IO:ۢ+JaX2E#[KЖSl#Q)SU#E%2$sw(2~T|?OUNjq a197=𝯲|(S!>vZp"6S(k I6QnB@aNuc9'^3$ޥtb^l#[Dyǫ `M06:U+3xPqEц=]z 5{_\#E)L#[?WZUyhz{zi74HFM{#"/ҭh܇s#g43bJKӭAE9McVrp5ĝF1̪]p{ uz+^]y1 k6j{\~ ?Oe>Z8Z`ޯ-u'4DEr@EK}j'zKFrq+mlO62 2‹iƴ$p#2 mHfνnvP| @xs#2%Wa>yO/ڷe{1#[3b['(d1#[{Z׾ Np牢.Wk #2aly9sd?A^68k:.v`=CwCɪW9*=d*?u0jKD£';O-d޸'4jN<ws/5|#[|x:THxP^ఖ0䌧aW9v0twۗ/$i 9~(*ꔛ/#EL\M1GD>5U5~(#Eofڥ^'躮znZ+ѺB mWfεSն|#[V!~E]7:_}tGIRN4e2E'8sl 鈐xnMU*(J 'CewQ ጢrd#'126ۦ6\#2ޣ;eGu}Ӽ%$/ 6'Ah^#[Eb薆}h]yݩQmFPid/ Qȡ]jR6j ^I됔Щ"u WppSD#E5,<&i}lGU$i4-yb o-8O "F,tvPt!'ACV>Z| BӕϤH^16KpQC=ϚVqLWo٬5'JuuK[ÍR]T(Fk4˔Jl,U'uy9ʓVElj#EB#ֶLWvZ+W.0۩GMhdMqQ綂Q-p[c1TeLߟ[B&TFYC^}[ɞ`ĐtkMBYdӚۚ-Y{S>L kEx9ٽZwɆ}ҝE{e8s!t7EMmH[N-j.4>pI0ʋѩ]CԓIWf!Pzʧ(XyXUw9ûQ[[[t9~m[~p(4ID>_!#2tO6 #[#KcEFB#izs$h^0K6b誌WSgu#"O<},mPfX|fNԭwj*a";"mu,wL 3tG(pp{פ3 l-@6-=.r*e2zxID?OSbvK'~<9k#E6Y?Uƻ2wCNDЧ+*#%[noo4$:m?Q7歹`Ȣ#Ew"j#2%HZ`e;8L}(} iĮYyx 3c+At j{#E Ʒ1x/g0*gb`eo `،CbqYL\G~$BM:<>Z `,FhZ?W5*:eqϿQTy?3صnZp*4[h!ZlUJԹYU}U}y)`nY+rt*5D. K֌i% eEA#[`VfC+DrNOUsI햼E#E!V6`A7.Y4Ubra1h(?]RAcIg`8ev#E8qϴ:s~%Ӗ6n3ՅXbU,T_[7(ZK&f]prZAHR3@gK'ܜ9X˿Mo#EQ/?NwOQ]8`oW;dz,iX,5LP#E]c\fO2BKAĆa#2^_7:OmZ0L8C8nv]%Y]@ťɺa+Gn)|lWXEQLkBV-pdJRS*;R)%{}}lkm9Ɲ`_z5Sa2y.dVFVKWE~BI1:csg{V.B-ɚ9!8=cMڱ /UؒaV\˷'ĝ|2yfcގ(6G]Ɏ6Ֆi <,6gk;Amh{\N/ͥg\WES|w[-jsT#E84ipŰ~y+9~[8R:/WcȺd<2:&eV>HmZ4´'tiJ#`>Ym|,|[&DX)XGjB<V AU`4i$)<ey¶W:'=,p.jZZ0p(Bz\`̝>zH_P9m]`˹o0cBU2:Ux7 C-nlXU=u^,[:b&ʍg=Xv|?3umS;6KnnQV|4'hhibKU#[GB0IIҶ: ׵,%F#[: ZbOqז8EE+cmH E_7n7+3o9fnI=wl:GPg5pc{ ^$&o#}ELw3u >K.PM;4Z,a}5V#6loL.\0"!s~0.`t{M'oK:#=ϋHZPu%Bu 0#E ^-~01Xӥykg!uMg(TE#[[t4ÍU V׉D-+63Hm4/}.}>ӍtT3l Mi)tAHs盳YhKuš#2Bq6Osq趿ϦzJmJ8c#2ppf4c`6LNeXSncy>g'`S:Ol&Nf$՜;^qc~'}v)`PϒӪUOKue]uЗ2;wp~`_=eXaӡt9PPI#[J(6ϡ1eA?^j*_v[P2k,<򸵬u AUp4we%ar#ZH#}/ikniT 鉖p|o$_L^tCn=N1y㏏n"C̿.>߄C4F8SR8xxq3CR?{ %EgYL?f0/VM]x}ia*M _9YIHN0wKsUMsɕJMEFc?V,R:bm!4}/k>g֋#EXUxKKM)U;,=KxSine!,8 Ĭ vCc=9)i*jt1\mB+J0S:Ѵbv0vje2@p!#2 C׷O 2)@Ġ}y¸w[UϷ6EBhP?pnC#2\70T_0,bVcv՘}9F倁PG&lx~#[;*9UkKicj%/0h>n Q!Nft3کR^"[k\d8Zn8/'SRȎ3 m5+~k#[7ӂZg*&|]D*_ ۚfa[,8T޺Gt>%W|sb}^%u<#O8{sSժp z^!R<#E9'7<GI:־3k v(Aج-MOw6^hJy`Wc,Ήyp06y\$aXթ6DrgxL7 q Xw`XmeI a}Q \ʤ^FY@a 19łyLƄ2z(0Wtg9 ѣcn'8%x.kkvDGT tF*h5MT_=*N#$ZBAO@dJ?-<ѵ%  4h`EV{#2xtruǶ IX:YEMn\kuզ_grXmb)T%mϩD絥`1MI?rd,c;#AD#ihZQ/ ;#2ŏFMR6۸ޏy#[!W י%=%%tX !5fYIuPM왆9۾R';ci!"`zXB?3SIGxgb|hO~IHYM_U+7M۵ъWMhۿlohL=0#˪M3yOtvs)#u:NJc+Nm=}\vLEYs&Sc@"9H#Et:v>/}L3X폟CNgcgӒ#>1ipNW{{ -vN}R%}5X|f8:G>qrc#䇷;(M2:P[T'ŭSdKБw~?k/\zt>\(шq49-^3#A9󤌳#Ean23ϽV2ro)R5q&á,QeӤJ7r*JL>7|gBctnc :jI))i'8012#2AOwoXn#) GwiMūrߣT QP:3c>ˇVIUOTΛ#2:#2@/EޚpVAl=(ﳗVWރfX]飥PQ snQKr5k>E8vx C[G]-',**uT4Z-tFG}s SnARySUTU9;œf8G]t{t:*a1:եO;WDҭ$2S7٢.K6wZu2h.&mJsھuLL#EުJnp{N;4f27_v͍ߧx 9zTe+WBr'Ҋ̎.V$C|C |?d/}B?MC#[Ke=Gf~Ņ܆~L˻br|1Q+L$Uz1btҩ[߶w-- K~e~jKdŶAA]Ƽ3>߻Ȯ#E}Q TxL >4X׵Ewd$c88sa5瞹&y?emKnUH ( &Sal\){b7_5`kaQ5|&j-h)挏6NϪI g_ o2mc ,XhHUUջ>(qHTi.Jz'"cHFfةk`yݽEpgH:By3Xv/aY,z1#[#[vÕ]V@[tAF]y>#E T ltTؒΔֻC."DJ0#plD'Aٺ( Μ{+"~QH.RhE8_M){Ԛ=ƵB|Am W3q*Ѓ|zj!rZ!P[6cK_#E3K$sǯRFciVy@FպЋ7Kkj8`r'IwITssE '6)͹B_aNLFT5U"Q({d0, x`KF/I{=ZPƕZD;I^A}ߐanQ sLo2kmdUq#[XzeYUM7;1nQy_l)A+w̩H ~DvϦ;4Zd8c~=PgpE1tӦ/RwtM-Sl|HZF0v4/d#EH`62 юgWs $|v/t9:"θZuQz:wjUSc$"@Ȅ$:sCHev4>#2Vª#Eܝ/(d2f8x7Ƀ9؇$6gGRe|h2C"5#^f#%3-I?wB2tC8&WC`(-3M74O>w5MR2AT&UPBJ^3; wF)]#]ufw5XmnKB\@p`؋G$(!=E,F>F,cײlvV~š+ ՆஹAD0NSu7s8 ^9Ȳ䥺#A(Ԛ"ɘm pALÝdťJo4BNt@oUc E*[Amp}QprP#j/0\%K]q(*ޯ}v"_4dRRZ"B_Њp-/W2 ~9o!ts!Nm4L_f4嫴LN, XZRzc}K~UӼD/mr!xBq;8]c5 ѽ= L=n@6Ƙs/4I;ZR'!ep[r EC͝aE4S@Q;U]{|fy_Gu !N*R#[=p bͅ*D=34V~Δd"Up5^ 7`OomFS6<" ׬4ãVB=PՇg(h'ǎ8{}EXHL#ַ.he,\ Qv-Fᓇ9wMD5V\I@d(]o)b9Ȼ`fttz"S>{yg@3T{䛷J|L* |poƚ0VVneh#E#2Sv  f˵FWgm3Bn@YIF=-l4(ۦ51t#E*0|xOOrہ** =tBFf?΄&P>Ow#2#[zO1R/x0#2I= ;"#2{/).-w5W9x#[㞩N.lJGץ kEē\j$ymtڷK>>S-Na~-UM$|s8hw ]#E?q!u4CܨوVT2#m#D%|U4ު0df=={Ha2^pK2pi-#[$eAJ?ә'Ƥ=v̯\rʘ)|nyN'lt;8=ӻM2Mi_w6xl7fY&`.}ٞlϟ깡Ab'Ļ#[.Yr#[{]@؇ۓ̬mUs By#[Cݷ/ICRxi@te-AQuCZ"a`#2;;OѶ[Z3K#2V"һa`bnK*Y D[&";#[KRA.7qbH(RP&3l!pFPĺkKnxXf[,(İl#[cfJJZ#E#[K5Pk D3#[:=WT#E۱Õ#E%a(*Ń#269|#[o}#[#[M5V.)qƣ#ER: ^9x#E,dΈQ .w$QN}(}Vui ]#[}@sbŗgModžr#2I#E4/JБɽ4;(Ka7M46&R]-1A8oE3FzvA9#Ir59gsY(vr{*~=,W$2UFP?㾭7iz*8#E6lT3M#E4:SINd8"a.5dGV#E@Wr͒S8:h/0+\ӺꩈL闘B=w=(-i 5~|fнlJQ!#[ŸıXhɢbU0i)TZfiLXo#.J**,ERwr7 mϋrwFYπl#EиN`Cm2$ T )(l՝J),=qثzwO߳]Sx^7c '7ʆ{t)l`:0o '"RTNh43n2QǸ;k @CiBPz-Pwk :(gMqQCuMל}*M5p9\ܩ+{Ɛ"v Ϟ4];&2s:fP?Ѯn#F ׷`M \DO4|Zё8(wD` jV؂KNKC ەkZk^5IZUt Y~F9f#E F#[+(.Zb(ͲĹ5x$R'e5/zl2 zM_>g sä!5 wa}nVU, twVMzf%d(Zaĵ>RS )Ҥmٕb[_-xU&}EG9xu٘djzeE;*>d2'Aɦ#E=P\jRdF[I)-{#[`'_]Pvfۊ۞\tŰè$Ė%)lmP;o[>7j׿0AZҍ.톖 lgdICX#29@%:ɐ`TEXRMFLDqђ̔l!^9(5K V֧V}2(y(Vnle'RoþyO"IS>oɋ1J:򤴡eB#E#2,|>nUUOw=WHtAN-<@ӠmA҄ҹ:*gV$-y}o\z0P*nxQ(PUz VU5)Wuz&WwJIb *ERTYeΪ8#Ehl%!%]|a6[rNA}ۻo(!gFО^L$H2P. rKq7yGjGP';KPGG~ͽp&l;@ԅP1Ie$d1M }#2za.z J KٙCkJk+f7wc'Ja33$s#E#E#[Npg!)mqC*gsN.1#E#E.x#[a}'suψe:d9&A`((zZLI߱er+ăIPm4yxY*r#uM5ITwߞ|J;ف0zqI^70=2-b ńhi> Iӑ6dDItF˥C(tLUc!T+(L$_"=IzPQн5G)ܳF#EQ1vj-,vNlAK0iأ%v 0@̬wU0'(wI CF9gޜc#1ʊ8AA,#"8IJ;Yg#E$86uxqNuW NOur!#E$F$(dф06Q18:Mio\ h|QSc5'{ #[6_o(ΔU8.$ (jځuYRfj|4Sh;4ֶxh[ѻ u~>p}LҀ#[I7ӳ;u5#EzB|QLq:?qa$};u;nU2*J ߚ& V h%n>y*Q9~#E ߳ Y ׶8q큐:,e{S9fGdLO:eV u#[O'J=y#E18v:>f)*so[#O}oQc#DdRco|&#[ n crBd7L!JY ]'_'#27y g-dD[:~RT0VRU*+LwwV7VdD߾OHO?ν̄D ]#2=_|?_0o0}):ٻkk9[&۟R=;5[G-f=c_0!tuX Egݦ} /]~v[֊\K5k0̧?O}ʽnmR0 M)^b^tݩMk7D>(}U"4'?~_Smj*8Kq9$5YHL$:Zr~3طknJŨ+ם !A6p}A,("m;=o_X%n*Zb8~RD#CܢLs!/:"tG]#2JfvmD+#E4AsQ.m;,noϸ'".햍]-9k{5>@ #[%$DNhnal:+z&&mPSh* %+u}$|_#[03!Bs>Mx uQe޻JRtOoONA$$b2%^ u[bx.{˺w#[3WiĔD&JiOyfEznxC~ϰ(g4ԟԜ1KO*#[,Y5gRUZUr fɁORNv;8gΘa4fHǏ#[m*( sK:tt5<CV Q6"N|~Bjb&;+`4LmS(]OUڹmYb3=3+Źͽ)O2#2xvt:sP'#EBs^x|E ^?)>BX"_0?˨ !Mnh#2#E:M]SzD#E\5 ;eӴ&ilԚt @76gcG`h(:w!sE{8rS[ctӎ-gp<`o0 ~OGӻ A[oLٶG#g$?zc ?#9MdWHMpx g]q*ͧϥv?R{#2$c<_u,"#EݱBh#2nSoC3ڞ}n]$#E֦?S{@]5Бb#EYۣl#EUV\(I=m֯AR#2Z|~~gd#EoIZ|`T +4C9^TB> aT>,$WvaB:0>P1D:'uF!6F[hdbFcĚY펌;r˞:E5YVyN_1e*CmP#["vJ:MCzQN%,UAD^>0{/3q"_Hv٭5E[ǯ:h%O=cr{i4.~c\C8ѰY\a#2a8q~:i0sm3p%zF"F6#E 7CyT&i;>vD>=Zݝ"V=<#J#ݵWϹ_殪^n$dE['mRRZ\-{ɶ:R(#'~E=Sˍ~x]%൚+vhYHV#0%o"`ś<;wN._D~ XX Fes+nwE?/}ߑ?t:uU(wg}lɤFgM>fQ.๿#.D&υ =V ,㚕\Hsܪ*st}yrkvBml%/f6?+Mwz:1g >k]sr(ɉ_f8G|KHMqⳮ:KњVASy#[}|8ۻ_,hiv0%Bz$W%׹J/3\lGUb_L)P亳l<#[V{#EJ*X)?G>'49u/cqI Qyk߭Qvre?m#E9w=0O'k-r)5fMأZ@ q46wfaT0rģ#2XSAfsh]a@O$ gƠ0wk/+g}ciYG%~ zw c#2C..e40p&4wt E3niP~Py#1_@YKtw[q{#[shŵMG#2o&>0q#E!*Lƽ3Ȁ),#n]c IH2?; LS`8Ep"M2h((nNC"sȶ|gZAZggϖ_c*\?|G_~(lyf#ElaL_z~%E&4DQ~%bP<bwv= BegNR)D/Kyi6\rߋ˳2O}\728zv)# .>OcJ\E/zC#2>wbPa$k'k=ÃD@UΉ ;;4I|}U7_:<W]Pp鬋)h U[/ʳZ |0|т v!=O2,,<ӿf݄rz ٤%^@yrs xdm6 +ԊQo#[ALC{ jWEw+j!OgP6ok+3) ("MRw^~kNN$3.2"jm=10rz9OV-[o&VҺ}u6?H'b;w`f6ُ,rexkBH(J;n|!{Kr"/?^#EߓĎ&F;"j CTunnNzE̲1#2 ˟oO}_i&~cqӳ%J4mz|߶!(3uu`9ͰjI;l~b?i@RFxΗfWd$>ڡO_nHtp+E TP#EJ#[Hz@zDrր??Κxr{m'_s?Y?GSǝ#[aA,*#[xHR ' tp6m#[In1;Ckumrlی[9v.3*\#E?NP1mD/FDA/-w׋lߵ,r*ǜ<Zګ].H[zԟNSK߸?rL>sD`#[]qX(#2t̴=mʶckFП@qjϾ&~a's\K% )av?/՟/pA!KFu.KA"2j0Bċh({^W.5m9z#2MY`L ,Fbݞj]:^W4;N5@A8Z+M4>RČtꜶZ;`r.rH:w(9 :ŵ$9 eZp}z\#22)$<}Ӄ)oMqFe#2z)AY`N|3{"*d{۫o`Ȝ r I#1;5M9ˤ谗4.\Q#ERI4#29l'qe;MZ1& #Eb[`+(*N9f.%T8ZI#2T-O#E?D6;B#Bi架x-hvd#EYgH]2Kc"r;6$юx=EOB20H!D$*E*<дҨLw9K5D0!CmT8#X]nX(u.+S)F8XR[[#c7>K1g`z<^4y?:W{+Ae#%q`:嶅嚾-`ݫy/BLP^કQAl/RA|)_R"##[jGHQx+У+\0IϹsS03 ]vTEx9OtGkHc[adR'G>IμLbSNDT:1AhaкPDcYqZFy#[}/ oFS]ރt:NQё:0@+hfk*dx5ч>Kt\;y#E%f3N>8x4\Zܝy37kv|C$oP]l0g(D\^S\Z@аQ=g-b 1h/aj{O>WՄQ}ʻyl۝i}_W HYThgM\er;H ๪8ze-"6#[Zu*HQxy&P`ӬXߔsE-Lj7$f.hs4|slٜ<Np:82*۪~g݇(GhI#)3HrE2 }K!b?WCl֥0z(Ɋ0W m+PS1jmIO\#2s#2`fBm_Eo8<- $=>#2AȮL Y9ӓ`Ld<1w{#El iJp4'\V~⼐M`6)`[g`?' @8ξΏaadY?I!JI<\#2@rR$x5yIP7D1;31'o |9;z#@r@y{ڪ/ 2 SP1l 1@ \#2g[$ga5X#2r^2}m-\vp LM  fi#EW ntӛr:Y:K A$$fɫgn%$3j$M1nc][ g ]E N)+^(#6#Eox:V9p1bmA]#U 4qw_eA/̌[Gp X# :#[m2Z#C1R66^DgYݪՎiam6%6&f8Y|vj(#E-s#EgNDmGs#exnВ]1D?y}ja?B+uq"E=~l\㉖ǪL΄ڴKp3{Y21qAzx79x5Mu*(]k01w|CjΌ \M%x(*6|efK@D)жot( fP.="YlzFպAcYpo:'Y\}.H":W΂{ j*`.*X#EV̡5Z ns]?^#fk18G"d a#fa~רtӅp-PE8Jd&.$zCFتs7 'a0!Z.@ ].ry1;bn[z@2b}Kd"4=SG; σV|b/^opy\13g\þW>m`"acg/ ̅C/7o0OOp<^Z(Rd'> pУ,#2zX"9ٔ(8'#E"5/XGB楪#EürUԬgk9XԜ7#2>g{rl @4^Ցe:Zc<rK:wx,l#2pMkk `uWOG#[5#E 7?_W?ʪxp~_ۏ#2YT)Q#2~9#2(@yDr|~@K:zDuyb=gWby:} eAʄ?zAb |j|:Y3Un6b}52zGΫ%Ls'y#EAë mG#EmTYRtc[I6R8Hu @K%!XQ8S]ɮV(BCGCIj TAH\W- RC\>x[ڝ0;KOs~M@eI;6jJo)#ENA㙝瓀0j,ZLHQ$Pak6ໞ+JQ $olHtNKי#r\8&#[$aiaV}JZ'uY}_J(?n40_h)=:,Ahhk2RI?CƵRfCcv-oP  M@'R.'}Q3JY-~1N6dEC 1)Q(>"pzzqVVYfH#Eژ<))Xy=PUW↴VʨI&’B*`"w#6\#2MBClH(#O۷8A@<$!DC9=5ME}#EU,F#p:̤>#2)$#E'q8D4U!n~/!,yS$a:Qc@zi"ee'm!Ka^r\tboX%I$xw.Hl7i)>g >:g6=!FA#EV~FPs:LH;53ijlBJ.a/bC{=_hfgG@#E~Kٸ.d@c1MpI?A#eR:?vl|'zi'L ڢͰŦ#[A 6O5W {;J6dbgVOO{J<ѡ#=V>A ixuOJ_UA#[oV_A=Fxյ`0h8mQ25wǨ8l6#E!#E˼n&F7yG C:CEF`BO#Es{H$(i^=JlvONZz7%7["!d95#2"o!Cp52dSt *)S<1a*/d a$s2"Цa$ Mʔk!=#2Lˆ[7#EDI?5ޮޮ!o#2+ܳDHd뒓`P{6W5׮ԛђ/\Lc`ޚcԳw5ݝnan72WYYYjѦee7O5IZ,7r6\JlɲG^I3ukZyYk #8nu:W3:֐Q$#[ qwJ"7e\D=(%'~0W'*x%hKd07kf9#R>WJ]`_SC3k#1ҝȝ#[ܻk " -Rmt2NvXMxzZU#ALPA+3/|DU&8KѬ)<#fT^2zdkwS-$|+#[*I  E0Z qOP72HH#>])$ RP5@RȆ~#[ٳ#2x}Թ#2#2 wWNWĨ_h*s78H0}6E'ʾTn/#2`Kz#[}O=F^Eϙz }?gԚ{m0,h0ȡ"B:kAcˡ7䃞uB,cN@xv: ʧ8ޟ!Н"Hð&S$Xz7y]Ǜih%nK*Z~]a&pk덍k%%/ؾ_v+gH]C=fIJ-W;ӓhnpo#t$U!*B#h??y~-~2o>u) KƇ <>_Cݰ/aMh{Ժf!!dI@76#[Y6,*tIqFoP% 45TiʌdBf^sJ6iR'y WoG`W*Pt}azw!;X_tOxM}0:N8X#2zP;w-G<ӌӺ|SA BV#Jq2lDYX&T҉džưbF_D㳱%T$)t$#!#[R#Eۦ&%f-ur6E7>ϓ8PxnłC#[ [l=Iy%%HBOð1plV#Ep9NrC#2s͠U @^"(nEX2@c,Hd!sL!d05CnQ#2BQK YJ9;7ً$8^vgO1x/l/!܅ `שÑ6DIƵEf: #ED/iFȅnM'G@;'v[lsr6ͅ@alfnz= V~-#[%IxT#[(9/XUO>mGHxosg3A_QAuϪN;Rf}uA*~*gp?ĶZ@n#EYq v4ul)h~)TW~vgiXhb0Xd&|DgՎ~b~fXTjT>UX&5ZMrOsoS~g5[ј=?β'D#2,Z[;ڰB8Tr]ؐݲ#25Ij#2uB𽐈* cn9k *?hq #,w$i#2Z!=Ԫ _qWnl}XY3BD#_XA^)y'7h^eV` Ph$@l#[ݴ!P= ʱy(b+rY6*Im +iZ܋lbTے&3qiKRv0Z@եfA~EX[?ձ|]*~@7 ^%"Mv+Ɓcѳ#~u䬁H!sh6*Jb~a$)#E?]K]C1B,zH׿Z{ HiZaYԅ`Ɍ @W?uUuj('b{;"p}!C+k?>!,q'p~g#2m0!"+wahV#2h[F$>@t\"Axm+0`]s x=(_#2jut/}%~Du6(_밮_ÚX0~,#[ݵS7eyJwxvʋ%WJahɠ$&iUˆ|(2b(@#EcxQd^y5E2+ҠZ2E6}5+~_~2^hqc~>Cy="f7?U_B,&&7wUHX>uwGO7xآr=Q &~xGك#Ez&bA"Ǻ=H4Eej&9I_;ЊKhڀ(M9T*7\{h=A>Qd҃7!jdSb #2Vʊ76@H e rxpBxx@ϱãJ?ɷK#f.Lk** r70Ԗk:o Ͻd=\tGA෨w\wBEˣ\+@^ljnt~ekүQQ!;;)%{9Ўع+[18;ztQtC%KTs4zֈ]”[^S <@k1QX:6#E:) e b#[7Vl-*m0pί0p5G_-xNp3+@K~ɒĊGIQ&PTχ[`vpзC˰[J>;>#E5Q1#EَvyDp=Wtݯ61֜]˂Gz7Uێy8;rWsm'd:~/10f2ioSٳ|PpM)*QhZPZMztS #<A6("#[s0ߟ[3V NM#2#2 9w嗟{X-s^yJ{b:pW6WufED82"t哻$򃬥X'*14gtO9p|?Ui. -$KtbfWLe炓{ vVs#3ufqHI#v-]6Q-9[1{RRv@0(S?C'v>;[My<#EVDbT[ţF(Eozt~'{ٿMqMpsq ~>0GѶ!t0bgW=9V,>Teр94:zԉNG=!&*X?{GO,F:Ǖ[5!a0/=e8GnXCq+H5OqdT@ 8_7y4.2#EUd6fƘ=vIKzCuL\Ӫbe%#q˅%%L4)Ll>NwgsGN-hwYOzj+^JaI#E1$dElnVU<11Wݪs;Dq.6-Ꚃ?dV WOd61A̱E=瘀H 1^#j O7_k!D'8_p^\i榕~_OIM>N}O#[BѓA1K SjV%U#[Q8 W3n!'5ZH92-몪`]LOav#E݆Қ#[ĭɘkPjk#[v(#"1'jevꛝ9x$T}Na0l,8k=VT>vI-efbl: !;pnmQUM@ӏsդ<ψnGa#2w=}<'HВCS"S@g,̆VScc`/HAv-RոLަlpf{I.4Uz+_̅XYS $,#vΜ}V!S!ηa-S-bbxg=r7 ГgɇC&8zjU*2SMsk"0f0j`,Mb D”j `8p}gH1<{#23vr };gHAfXWy.*vK] ؅wArOJɦd$[ 7(̅#[@ nyF;3BYd\OǪKj~Fb4\3ufgftdݨTh8iElj6\)ZcljJ$Ly &b0,*0ݿvUڷr -WvܙglRƙHbu^iu~Ae}htB>B0kKX߁#[#A,PknAfS;d`;'7Hǎ˝/xr"$Ȥ"jY{7'OMN_)#oX#3Qws y6=a!#[pW caPf1sCxƠڈBuvB;vuAق8EK;5b`?-8DSGPߨ-kɮ!6[ \yZTcl霄!D#[Z=WXj^&qmt&&M^Ce`u +#EFP{$,a=i-OLMmه#uw0;K9vhuGsG! "=<&G bu(+79-HFihvpTMn0? 7"[#Eo47vMo 62#2 !.э7qy"(;SV)k83Ȳ-77,xxrʊoR,pr2pxκѳO&sTU#2Y)j4Υ|#[5tM]<#[ i5z/MzoU#EbnLZQUDȘB 6Y ;r;vܜ#E-'NJ6C >ZJ ;:0Pyf޻wyuDђ܃W|N"V2 t՟j`!267fd侜1 y7mN;#E쪃b*D׃ɧ$qSE((ŌӢBI(Wa#E:.vGϰUԫѡi(;݃ns-U F@*(L8TK jAP*r]XlUV TeE&QP#E#[x%aGVbG{uU'#E#[G(t[K:&v;:ضB'(c{7pMNy|siQTqNmlMcIl۵m,r,a({jz=48(Ҋ"8532s]"z|h$d(#[pJ"K e}L#"|1C#[u}0kqF-FPY8r#[ha}t:*(Gf{%j}̜{G-DZa#EY2F/Tx& Dp†v1wp6vAp!$86H*`ј(4]"+΅ Em`ejEQ(Jc++'R#(/n<"'E*67]Wu&I`"Qa u)FB2Q.:3q 5hv`ENۓp ,E:]Y9:F+6@fxCyJs"%uaͺz:;<ȹRCb27x9"a[G<#p*0BWU0l~Pޕl sE0w ,(I~?z9j;yC"ʫii;+OA'V &~%mǩ.(h Beww|#ECq0Hè@LɎCHHFo譺f\$Dz[RSˏn[*+i:(00}4fBSm'ʶ*υ?N^!vJ]Vg<{AS ]I )kخ3%{#2_?$ D0j-(/Tz/#8xoe%gy$uk7T:*od-Iz~$2 #Em\*dHDI^D.@>Y #2(WSM ŌT j HNA`=Ԇ#E0" $ AM{Ĩ\ -\\lVJm!$JZSrT!|Y۷zQ#B k8.C j`]2HlCNk?׃VTTWLr_V(<qs}ӱc-=žG~n]2Kq9:{@BʮfZn=tZnBl(ַ5-XzĦf5 o:#E(ogbWķj#[zFגN1ph\5qh\X#[=҄FhJgҝ\SEWbz05u<{a=^@@(B#YUA_X#E넩_IIdp#E{X} YId?CD?w/{wJE?>T-7S6"* //_-W EbU1LR+ K넇#[ ?Fk6&ڍ@lՍ$D5ͥZljEiFTRZm5k#[z{ i-SwUc"zdUH#2#2~>q2*d^PH`<;?F˘!Yq*_&.hH9݁s@늣D,跤##2@]ǚ&j!C}Z߄C8ǿtW4u4m=. "C6\mnhyPK`4B0f 1-굦`J$ E^۽n'EB$AT1VHAEVJ @h#2r=yt2NjpU2- L 202#YPhf"'t}ޑ(R0PJ7˜2@!KoUhƳMI#[lQ%QZ6j3PBQlb#EvIE~߶.\ȁWm5#E2#[$ "jry_^Ã?z=#[h-!#22< 8O1'p=wb#2XFoMIa>c)HN<(ڀwwXPPn*xoBb/D*H~#|XD0I0A}r(ѳ<)T2V:7~5E^4A礆ǖ-dW : b+ NȒh{Bq Yd@ErȔ)JP(M~s~[.uiMf_i9xi؝Zq5 zJ8U8s{aNno~_EXdGi6cʺ :u؁#[}  (B <*XG<_MҚ#2_k$ xBzRJJJ5_C`FEwnrTd~O7;+Sעևs͑C$46/7WHy!"$tc l>ne`>%]4k&@%(iI9T&9 n(>A'R r$D`ƟmF]̥R;(&h|(uxfP8ٺ!@Z06#[zݕ< .~}(=c729ߜ`,73ViyjO&7KQt@޵㥷;WecpqF;jt,FCnP(}HSn{CF#Eu}E׷<{c*C#E8Hr8/[:m4ڸr/G`WpH7~ljm-NbdPV;Vb>x^=:yt$#v9s~|ښ9Y3YnïM׎#2ɍ68'^$Ƕn~ Ǜ!d;G#P=A#[O"#2q#E[6鍄Qu:m+GW> E獾%vr!c=R5,l _ [fϚNHE#E:.ED&ἔZ˜ʡKŅuQ!~P8yB2`P #2RBS .`ؖ$T,k͒g-l_u`C<}6 㪁GCq$$uERa{D E#Yr ; ]cc" AaoڏtW3xi΍ޚr-bC2*:YH,Ƿ@Gzl.Qyvˡ! =[?V1Q_t/fwAHR::55,?gVDyH;IS#Ot@gdE3U6NL};6DdFޞkm@T :y5׵@wwP#2r(PjbV%ڮbFlK(ȺKj0 DCd Ģ"¢%\#E KFX@FA(60Mt4pJS`0 b1  =#[ЁX]S%WFu==y^(d!BEV1@<(dBؔj$0q ,lx-ɖ^{1bOh/i$B@SBo N=ecR#+9c M#E3шP>]<cl6hD6,"PM=MꈐZ䄐^mopLE)AjYy̪b'[}lhXA"ꢄH:1WI\bzoL#[oMfN0%l7SnsY%WlDDEܝ<}8^Bj'e,u;xU4`-PXj6YBLlFFFND;O}[IٮePYGOI$`CIͥ$"Z4`u#E/#EBB kR֛gp1p}zB&L5#EjxlTf% 3Cxh\Ѐo5JNR1F@$K dN/s{ g1!&Xr(5#2u:m#Ef7c$`26k#]C#E#Ev4X10B3KZ26<ÇI M!KI}h! F,@Zb!i5lk. (%Kl%1CG-=L> BׄU*s1ZTiB%tbW5c70Po0a>_aݤChą 5٨Ɏ ɶ\O#2dIՓ߲am= 퐳Vi@,qĵeW #EܲKE9VGr%np%xEϪZrMr((P;8Í-&#[iwCA6EĊ:k=/ LYkRdst>U3ਙ!ly" -u뗵a'~fd(#[Z"q]X&1&1 c $_]M6o;Y^qX@$oU2QlM#H7I];VQu]%Wu$$;]%w@h'izhD BHPX0#2tUJiL$I¶"ًrQ]BRiR24ؿUP-PlV|Rږ*3!cE1ц4 pqOK2䬥P gc+m'hѢ[qJ CdN$نz 2c6#E#EF4`K`LBlddٰr EroV#EM6[Hpzj晹F`ʨ![&D)i4JZ+41dAR +zv,f$tB6]sʚqg<_>6mJQpm[^F+]0B1(=A#2YMh2iJN afZ@"Fj }˔r"i`#zO%A!NFw)ܝêO+̂rDw=Xڃ8ZI400[IRHЈ&Jei?aMMQi3%\LIH`Dҥ#[iM0mfd5b4Jelcf$M3i#&)"(%,M/(PiRJK20ɵ05Q"(%1Mb&Q)2S))J1#E3i4ƒ"DWoD7{h9)#[_7b2YZ*_[7o3y;ng:10Np5:,uplY&6B[6L@Lurv'f.hYL:=:s!\z-Cdd4 f]N͂G!;^Xmڍ0G[=84*.mؽ*F".kLǻI8`\GA6cGF e\C $FB1FRH٬)d*11fAEu<9nދx,ͅ,0ϹNUMaY+H]ZZCɃc#E+Ӿ'.#EK5@cr}#E\M#2'~m.WD7]OhƢo=$(so4Jٹu#EN#2kn#[l #:lGGge!U[ 7AhRJ$Q@"@#[&̠U: J?b8m`C<^E#_s着r$3w)M@̖vįX4b-izj*[i#[Ӈчf53*-hrEXN.Uyka7`3Oaie$ڱU5LD 鶣nWc.["^7LPKsM;4k]mw3XA\9b)_s9o &}ձd]+4/oo't.g!IO!W1T~r%I2rLw("Ngc7$wz;la=[y7gItn'[V:׳]v>gpA8y{HT8+xC\C>33g9i,Fġ;Q[|#EMs1mgZD"O'Ţ:25u܌qVeo$$XRW#[2yuӃ)$/|Ls iI҃O9S&24dfԺHf>*%%CZf׵/T̑;ýUeТ.#Ev`DXQ۠TI$ O :w[zɲ+92%~1 :ѻplp;&.)Ě0NP;`bL#`rL#[.8kT90:a(i̴9dNjRCTF-};e=6 g$NL+\q:8/̳|tQv`B\lӳV4!ŭoy**_vN4&sS0wM#EC`׃rQ뇁YDn>\(=}#Eڃ\ݒHbN4y>59͙;Y"H^Mk8O:(zqFUnޢ%#|OmGJT.6巇.-B~t%&,wFj5U(#;1Bh2s[|S SuҒ|3#Ez!{=T;q%j6McC`d#>g}e:,aLigV4BG[:»-m&3fסDia5&w !S S04\4ƈI4u*  5*oRE*BHҩ~NoYqPo8 WVMﺣt^ȄI1[K+{%a<%N78+yeЌQԹsiN1Զ h1/QLhfS\qP3 .m<-*>&%!öD#tîr\6%䦽e9͜ \ebq`JcTCVLֺ֢{sH0qKh3mQ)Y#J#OMPglC鵅 ,5rח+NP+ƔYh19D:Fb,1kC14qL&01sjR}iunXVȝ;qrbBZF#2$$zdb cmF8w Q bLvK0)N<]fms%pWrÝ7$ps[M5si -7׃uU6uu?S]iña(TI2))ͥ[B!`C8fmqKfs%O6(R*xq,HR*%'E)!*yD<;:-K&;T^|ydF"syL3qy1FQh8.%#+rzDc,Tf^m;FQFՑcY:Y% 4n#E2a48dGN7xš#i$#Ezev٧ 3X:̦1LdMw]D|iLH^:6We$>u8YU&tVv3P6EqX2a#[!:H=<Խ#E68pF4jfE :aQy96kfjWڢA:hHS *rK#Et1(Dwhm_b.skm#[#[ҪG[!$N`Tl)L;ڎ؛&FhRhmh)Ȏɯ#E{l7]bvžU˳;iidթHԐ!Im k $3A&D)~L*[# h`ۚV6&NoCaTa4`n'`y2cLS-WeBd<g5)&Y&,L$.RjC^XmjG4[e5tLP7aVMlff ё4bmA-R+])ʛpmDeIz֘JHaE]+dia jN,)CV[,,#E0ʎl݌*s@p$ntp,y+C:49]}O%imt@vjU`eBq1`&c<.S6pCd0m;`BPïBY.p0:!]du'f\`E hn66f4q_/= 7[6'gMX|k;3kߊ~@(yCp#[FLІӵ @9Jk ÙHL23훺$*c)|`Ҳv!0#[0bX%rjl"Ǯ 1|9!M#2a٦`a"ѦX]=QؠeԞB#8hI##ZA9Dcu48ř*F=.CE#2: ѽ#ټX2֦Q 1Ρb)S ?ޫFBB(V&in+yW "x6CB#2d ٲ r#2 l1ub?W~o=ه<#[G:6K,̽6jGTpYŵS5xɻ:(мk*ËCg/13\B{Y|T1eZ#E[U88k46CQXd:  !\r98בus"j I6kAM8Yj:eTS\,1`oCXw\UQA 1h da dD01)T27#Ez<,",Xc3Qj4zY!'XZҨk^ hASh{}Hh 6fV~#2OD*T(;kuݙsuuA\ ~Y cjH#>ayCzHaJ`o^B"H(童'Jc"4 j(=pE=XS7C3jP7X~ȸ|@#2 m=8>|3l5HFW1Vfɤ\#[ 1BĤKhńb&T@ 2&?^FQ&,FSL*%4#[!rˆh+f>'Gd2#[̤-شm!kcQbf*#[ih-mѫmx[j'n{\)#E#(B)n9n\2^%a$w $=E"e}qkm&0dAST#2ZI)'A3(f|,c ⬠BZ(8qơbX^ޕEO $)׫z-`7b$yԢ##[V$b{&11(0#E0&TP#KH^a&,ꠡ0"ɫ1IG?q+D*9'p@P,U`kTKi0`_0ޤ4y'n(pЁ0L."  NعGh8njHbG/z.aY5V@}H3CLΣjPed Cr-)RmhCt($4F+x Q#6^,[?/x#2rO3#[ )$Q#[UKiSFFKDB/`6QF #EcAM`-}D&}4E`҃0\AR~dXC5lI}6(GWY&4x/UA2]\JZ3!l=,Xj*M5jQA IrNJ֐5ے|{Ԍ|۝&rkT#E}h{܏Ӯj#[[{[֗F%+CJ/rRudKhⵇbc9 e!¹tRJ-Sm(m B җQQB3S0oF#[HmYMjN2 K,zfd2Lz5ՏUZ3ED^3JζR&x#EI"ndL8-)C`{ph]-wɩ SiSk&'"#ESn(ΖVVϕ-U!\N#2vf751UrCls#EL&K5.oMgB`roSmeM8WK-} j:f|ÊD<#[4If0!˴}^tX3`#$8p q)JI5G① R>5{jN"iHv0[#[A`C V H4I$Y@X.B4%)#!e텃t"PV2* 5CDQlT,k%Dj)-9+h\ۨ-fln8ҵ#,5#qB:;n)zfuUpQ11iqJlLimԭb5F81ÿ&I QۊڼlTlRHjRm6eS6mU55ZY2^TR[P`ڙFXJT5Izo|6E:\l.@`G]&TNH)DJDA;bϴZx$q+rT}b1Gua)h{`fy<>LWiE*(sܯoSy@-,l#ELXDFO` Ne-2!sƥzB&~u1H5TBA@) %*#2Z Y#2̙@#@ACcbf3 Dm̈́,S`p#2*LX; [xN+G8bhH߬ LU5Waè 7~r% k X\5Ř(l\N~놖O%T2r "@,էݼc|qT8Z&"\ $/HUKk9噧CZ #pYlӗ͖| % ( Ƞ{& s1jt'軅(#EAxtHEʨ#2DUa!>5nM^J>ޢpFO.7bn2У?_2.}uI Y~%lR;%h!FH]J&^ݮ12In" i-ҮƩyJɦҨ-FƤQK4ԖS%+LRh)H[]aKI7{6$(k5jh8-]MKVv٫߮Ɗ j)IUL3Uur%^$״(+6D iU\FIfjRUz•iBfF6[6zucmYIMZ;&̳]YJ]eS魮$m& A&r c9ŮivKXuz7@BqG#|{hp:ov ng\ԓD RzFS"7hSCNqSD YnXE$iǾTeV隖K*0IJi##2r^.K_JŤ"+fK[٪Mc[EWYvZkjr6k}*%H Mumi2R#2 #2qUecf)i~%tPZRke-m٦mdՊSF)̷e 0&Zb%M5$(m-%M#E3̦(,F2QM$FIZ4XbJM)L5J2Y#jQj6iY#[RbIM2M2TU#j)bfԙ$Y[ZYV(hҔ"0 *"#2JTMK|%Ŋ@D,m\zkkJ-敫"kZTVm?v";{@tGqF+"zq OwGh0ekUs@ =vߊb|ωjp"#[`b^Q=7y;# YvEgGv5ѳlf=][M &H nPRb]W҃^r9#ER{tqzB#[ /BCxC@.S1\a1TAQ;$"Q-B\A5GL؛b=H #_N*xH&"!'M5Q3?vILDs1 B."[^F= S-.y 4(nf}(|yصVv7#[8T>*#T蔴3{WoשodCIC~PR{H8d\_GJڤv7$sج$z3ep")~z0aΤ2}Tb/m^ݧH<#26QmJې8{;[#ij-=,  AdM/3qODONKdzP1Y#E^BmoqĻPLP3#2^"c2sj3(m𙙵15̇T9j˞;AN]5p;ɱ^u)jBH0{Shl @]bo9ހC@E*堳 f#[((c笳 ְ@syh)  k7 TP2S!Wk_F7Ĭ(YI#25 yTM-4A4CP"dai``N\44( t&),֊bˁ ΡcmH&ѪlƠ%R(lL2!1 ig5b9b- a#[(]@ɂC" L}U#[C\R]3Olm~,7\̈?Tשng(S &բ w 9!m@iAss^Ė‛9EM}QR19uy7"@yffC89r;zs,pbgpшTyb)p-DZ Nvݝگ?m[]RH|.Y#2'Xco#E}FL韐y6g!ctW-I=SG^VP<$f*W&`#EBKk\dLBBO[4sC3c(0H&7z[XD>5CAm*}#EH4̌FԝnQ=g[zp>;OR:4#E&A[bX#2]Z-J؆_;, 8Tl6΢dBoڧ htJq" ǍPhiF:I !%'續#En$TX#[1#[h3ѡ֟!pI0"U#Ee#<ɪW3Tm~g(WMNtfRBd`ځc8sh:ZZotQlUAx@TDR7 ϾԩyHz PdP [[%b%CLfT#[3+?_,?]y eEQhXNt1!AW8s&a9Ť;􁘠N1cD&扃nD!j:5u )6Qx~<őU\;1c9Imw/.]u,92&e"uޚ[^vɲduf_ LZm<rW7en) iLX&QF Yb( _Ml2\ #2_q8xlַCvL~*E#Efyc$,ʕZX}]fSW[8C6X+5嵆jҍY6?p0#[ª-KH$IJ#[leSfME]f$5Qj*mmȱTI[m_"" hAU*k[uϞ`b`p{kLsu .\ l@-Q#[Ð44 l(  VFRl[FAiT+ J[M!B|}u^品I!‚XzfGe{䢣EB9k@(N0D%2UGT2YAPTa)&,zz2]Q(E*)-U "31McmSV9yO#EBgȡ5b˘nG¸`k+r8#2$Q!9 ;?Ǣ9}NAgV, b5% K#[A~ܕ5iID<~aP+Qm !.D3n?%`T@Rb㚴;lyKH˼k#0Q@C`It("@Cp7lriR}z{ >#[Q!d=p'rCg*A$" mkQ[dj#[FŘ$"$FE #2)wdiS,ECq+BAiuB$(Jk44}>׬Gm1}C ڞ%!h8+, @RE#E!(HUvA2ZPH}Y}VmD̥O>SW@D^a2 &Z1#26|!z#En+imn>qkvW_Ӗ]myzy5MVy0b!#[PI@#2_i+ץ%""#Ei5! H,TU#[E3wn)g U$,%4 a?ťi#E?ꤰD@?e#E⃃:\CGD PnqRLRr,`7,8h-d"1`Fٕ$@3GƑmVo*4d4ed%1Íc]XEuP[\24޻ڮZ6b)m|$\b2.fj;&Fn׳x66k^#26ӣL j`9QF`L2тK-J+[ޞ@mV*ь9aZ56&Vt9(#E#En$l#ݹZʹm+,j+Erܾ#Eyܓ=u^7x&#ErKyXg+SgY1N,k#"4ԋk0,$iKbcG|xt4%ፁ$ &Dֶin-LQCT$GIkM;Rv ;(P3wPmOEI '"mO?'c wl۵LjUVC41\'0t4WUގ#2yrT@ xP?a}~[EEeVV#[Nn^W-y.m53I5&弚McJ2\I,V(]Mm5SAXA"Da8J"Fն-zg.ˤyD(R@^l-ȲaXzve~kDW#[,Ɇ;,$v&26BH}'r#[U#EvoE!R%v`JZ A @?-&#[Y75k")!4ZfIEgn_y~{ ѪvP(W5>xACiUq_+)aÊa6m;#E<>#IhoLH/L!!'.7셱B&!!@Z2Utkk]M\vRx6£zLŒ cwup6ζr56ō%Խ2QEDP$[k`w2L(,Hƚb0`SPafZ--"!%#2_'Y9@,E(P*x {R"*zʼCox#2EnFC&3יGN^K1:HR=趝50mHm,!#2iHvcВɒω5( "-r!z=8;@gɒ  zƈQ7V!t5'a!v(h #`y&TyQLt2 I i`q>A#ES\҂h#EDVCMGę?xFurQf\xjy!bByJ0UR8>xc!DS]ٍ\lh!ֵWds>>]Jh^p a4 v ӅpMaj>7>)6ŨV4&"-m,-FV$ ׇ~ּ'Y ,Lr`O08b&8:( hj5dX0dY0i3׽l:p%#[٨2o=\R|~ /ﵚd7&Ѭ=M1 񢁱B0ܮL*v#[HۉbLU)x`H#[S-9anTFmxıC^$S#2B(0Mjqo: 5&3U2fbDDȤT7`BRx%U)n̲C<ͦ(X)_TUDǒ#[[L`) MeP<8a6Hѫ&W$Gt.dh@/6vN/D=#[qqzf&T4Zz&Cٽ$Uȥ2c" B@ETX#E<[(x.3.| v"wUQ# 5"RK޳L\>8sibB#96;6YuJ#2N|Gd"15-$BȌ 0]PF!mH807FC!L#[AyIeb\B,@Q&2Ry6 d&-3T>6QdPĈ1T)]eK#2)vs2jQfRDGCtdN4i9&]#X9=]g[-=r+m'Iz/58Ѣ7һR9E\9k~ygޡTiI a TD#Eq[Salʼ-BK&˭(2ӣ PǑiX?t:AB#En}Y*# l4ɝd Cwh*TNi%-`v~Ɉm3 Ɠ86Nk &ԦZ-|{Q&SҭNF||v,Jɪ7UI|!6g18Ab0FKc0-*.aC/L&Gr]HP+]BնUJE{eiRZ-#2Y"*@c#2Vumt) t7qNp7owj2مj V^Y3#EtoC3Ngg2Qd!d!CprѠS)#EI%l WV6L]A(@' #E.HA{{}[ջdռӴ;HH}~^ɞI#2F>kFu]WIzF&DՓ7]玕םEuhʹcIm5k%Yɦh$q lR@LJD >?>QAl6K|-`N@\Ɗi_uU/|-FA2Ks1r`j|#[ 6FĈͽ1<7%ZB9i X0#0Z4\ \3AI#UAswCƧwhǙ͎39tAW8b`˯JZ,#[֠FEed9qKwL:--.r]KL P#[ƫ(:ƣ#[^>j!RA@jﵼ)i-2شUkجZɕZ^5xstJ!!Ӿ$R 87~c儢ޖ0p>Awn#2@t)sϟ#9(>\E}ΡRA{` >0JUoUbq61$(6 <00 D=4&m0b09_0/(](WK@K^֐(q2YlNMUY4%(I*6y!7z^%NHo 'ؖ+:Ғ(iQb1b!A udeqR$`xVy۹:WUtkv#E+DDOEX pB QCq!oY=ɋgĞɃ}'nANcQP jzS1khrCԫ#2}p?.gEW&qR@iPTĩfP&q"Bh퍥s+_payp-cMAp[(u F d#ENf@v#$0|%PAPJ+J #EŤ`Q_8`۲ʕh #2F)h ,I$:u[+w[f #[TDk:*D1JVng4eȩ0$pƢM)6Ngd}>H5!W܅x7.3 7iK|%P' hN<>%Aؖ!Z\ Mm#(SL^j#2՝Hu҃5,=+'?kˢ 2#7ξ/DɃT {4M62(EI.kGBJ9{5¾g:.z!`e~R[ՋUۮ0VaEҁ"}!Eh焹рcmp@$~8;Hrv}Y~;w_[X)jqTkÛIV3ۜcqm6A3}-IbU`6& k+Bô*m]Z0mdlAA[v,a%)`Ik$ХCiְ}`7P(8Iv8hC,@~_jGC;dLAPS4<>LlNvK3:skY~[d(cB0&(c&ȓfW(DeR:z90qlZLm#EDagjl(i] `Y)0(ϐmeVԪiݨ)={2uТHukg%x#* #[ntxރ51$) ~ 2G-?mlգ+c!}/ώrYն.o=b"y< f6%p*XT8G?#LIM*C<c!<,yb Ha@(%z(B<9&g%3@uATƮyBFBBPBM5_ǚckFգ\kU6ɍ,mZҭ\1 9˔Ӵhhir#[CN4&#E2*OBk1,.Bǯam" ܳ)v׸RkFz:PP1w8-z{}n}Tɀ_[Gh8ތH0I#E4 I_jCj{M&ú5CAH"H 5J٘x".e*)CФ:5t}>pQ.s\pE߾' AN㘼{lZ#[FCC٩僾a`}Fjr$0(}'HJ?1\$l`>EK[CHTJs|汘6e5F #EMڙxljE#9aUMb#QbY#Vnmm8m/\#4.@k1c{z,Pı9wp?a5 $/ikAQOjr-Rlg*m/&Ux:6te:d. (J|XWL}2 ,+{YL 1#2ͥ0)4ֳ:Ud&%77ГʬZ6mhk1U,T|k#E ,^{O7k/9vb ]#[l"`RS)ChҌMIP[̡[vGQ,44,ebl\ %T PFK*X0#2Aa@)#["Й.1$`!P#[8@9\l}v=-r,l'ؘE_4^ftsa#O!t&dײX8|_&[S#A# #MH'<+F9>=S Ž<k"v-!V\6=F@T<ǡ4O.Z~F!$07o)!u<p3G#E#[#EE}5xmED2kN9-|0PBS. ·WK|5td~R#Ew#28P d3SGv#EQ3=o\R&9n֬kþ0ToJeT1OE53͕#8q&/&qcg1Z[bG\co3 "'f1[-"r_b.V/F,j0FE#[0#P)V*#2yFuiF6T*填'5X %<ݮR&lhUY]kٴV+Ԧd_O\EXh65QlVZ 4m2ѲTe4fLjh6Z@65`]@(YP)`:̐>#E!PEF"u$ FH I!"ȃe:u_.Z%O}P(}gs,4dΎ/HAADi)}#E̾BmdڶR~^igTQm;:])knQQmR[s\[5WebU^y4}7dF$CSIP4LelJ#2`o":Bu.ۊ6*5#[HiT,2J6}VJ1AsGc#2B"f\z8MHk[O0zBmڞqk6wH(p\9uQ@ީ% f Y#a誏nfmdaLf7?,qew2M5 F3R-AeBa-su.ӓ2Ln#X|^^^hC&(l>A+u*;,yI]x4`xM#[b^IVsq8DFZM3-ҍJ=uɣKpꖊ,/ ^)dHwСEF0d^{B̀^.N;l>qYlz1~x`LU}&eꕵTY01)4Ҥ%52 ;0b#[wHDUc@l|n۸ם\Sws44ܷy:,&Սe)YekS7V6c5X!#2mlkRAUzu"XH`X,J٤h4V+DA2#2k+jѓHBH91x,=ac\4BRHcAA' irzx%>Jrlg31=FkIkdl۷ay]I(3j6ݿ= k̇3v= d AE-!(0@!#22L :#2ϑ:}#cUd! 0wCڍ527Γ]$x4#E)Pc+hz#2f9Yg?hABH,T [mPmzh6H0ځ!sc&Hjsמyu;fDoSky%>7yKL#[yRX*֪KdՑqLJ5/bbғ$o(FrD(71DHQKҭo25"[ dB iH@"9kC~똙i^؟\@q HP>>.ƲЀ.@Y(F$BY*[lMڦڠECzNh"k01G17mK[64ɚ!#2E9_AjAIZv9i+&*&n5hlm$7.܂ 2A#e8د#[HѤTuo%zࡩ$YGM&ר^{v?n?VH?D"Aޯӥ~kKnY[$#E`b^"#[%A0v KY4-R.#O::1)""pZ95inu~6Czy#2ZEO\88I#E"Hd#EADHVI-„M7AM큦2LBm.JPKT@`ٌԅPlX,b]`#[#[#[l6A*5 eRUnEdm3 qu|`pW%PTsNi4PR$5Hl8: Aydd&Y`#[JHYnE8b0 E`$BhTVޭ[KN2Sۢj ֫5N7ltR !SQQ$:ș{y#E#E#[UMvE1]SZk-;Wjm[,RU QY IUI(-4Q#PZVζ$b+JBT0t{" ̜aEO0&׏(|j 6,L[D Mtg_Lkꫠo<-\rښ)ɒcBH#[1xm$"uEXmYQߟ&ݛQKK\`Zek-4Bz=aw< hSIc[m4;CAA?n?\#ETD?MQQߴદZj]KV}nUS~ZokԮPE;%vDԳsU6#E8Άt^!-7o?ӏYȥ$уHX*f?kI&\Ps@PDDuG<Q_KttA_d:/? eetϼ2Ԅ gц8ZCD"2Ög4ū3:B:6."cm-LJ8';7n*e6jo\3gDșC#E28Aq)37#ED#2adƍ-!c?k 熣#EOqTr  Z1*+@R bV'f*i'#u<qr#[>U[g>$#EAahlt #3H` (._%v鏹1C},jۄ {r=RoF"*L&a}2+!#Vm1PŹ#f45M.EsH:}=n_~ʯKY{^#EcCm6`3ZS{O-;YҞi{K֞m#2>Dŕm}I#="cg9l/ؐWb鯆G4v8+,;(U^jq 邛dfj{Q۞ԇr#E|`0T\fҧm~jNHf#[GkfM敚زeY evӢq #2 I#[FPUs>*;/3&p>>~|g@܁P B=zEf#"yU{xDvD:m #[1-kkȄ4̄h|ǂX1ΥF~tHT#[&iQu63I hUf-9HV, p{Bv{عl3tk8[!ḑXPRRI5rh1JB$`$Ab#[d4WkkuV\Iswmo\llg>ns10o45?Y׎8k$lDe[<dX]kk,Fx՝<*kʾq|6p&Pphc!i @ ,@6D2241s#E۞S6ت銬5.v/doA:6vt*r׿#[͝V7󰓹$׼rUPr|D2H7&E.dthΩ*-6kP#=hWyG^M㷱p.FnBp6#[S(ooY&%kJ=A|>@+ iUEV+\#2#ٿEHqלC35P੷:4CYNq#2ss#EAn=\$JcQn I\sGk b"Um`֭vs>'98]л#[EO2dÜ$F#[QwBMpJ8a3⊇y96|ˮW>rWA9VXkb!|mՋmԚmMPX$QTPu%;ω#B>#EYUbXa 8-kǟ?̬WS/H$#>ۺ}b}J4#2QRD-t@<'O} Tbt~twuBHz=)Y:)Bo[9|u>n?h=kQE1tB ږ .Y♋i`eh`P 2GۯeFgwJo)XF"z#?O|/\cc4_*EXIT#2P瀍,dNeMZw,wܫL0̥kS~jFX$~YO'oiz*Q)ȿdU1ȹ#2:K5w.j{.p.4Є:o#2STn^[5!Qdyw,(RkQ%d7Qoc,: -dBʨr#! PT~6G2d@Sӑﯷ&j0b . H(딨D$xu,mw5rlLgCBsoIURP )t[Q 7BaD#[a<-daEFuH{nߗ}NT3]ֻU!ŭML $!!"!=XcZH#2;2zWE 7E#E[$P }o)#@&љFTfDE&!&4eJIeI#0]'6 9 ؒGyL_v)LWnl#Ec#EDɆ$D#iDg DfH#2#2 [/<Sop"ͳa2Q#[ԊFVj(%CѓQLBV̆L_mtjrr}XH|6{Xjv^vOBS3f#2JS;u'bʤTBO@I)E9rIP2M,HV*(E,C@;I@Q@k-TJRiƔjg|l-,U5I4FdDd.C5ͪwIwn],r#245YL TA-SȬ0 01 ^#[V蔀 #[J+M*(#2m4QY66mKH( Gm΋K2AZ.B:%#E[wFVxȪx0ǘ2aBhMW/SO<Yb&`7a.#[*99T|\mpX(hB0:'fi#E6EX/k[6hqiF4BЀ7sijҋcT&#EV%cy$D#ҕFؖRJa9)Q R6cD%SIm46LjhV.nyhuxPaTNYj:R\لm$!3l"š4A(F9*²1&6*e(lo3C01 2h1s-^hٔ#[4p֋B+R#Em,jh32Є1Ga%.S b#xMa]={LXaha~7iq( ]i3Pu=7kX6WK1dR0qx8B ټ1EMjJ#EBmKH'pA^KF#[Gp@.3N Xդ#[@62*4E.A& F♬FMHmFoҊ7$;豘TnuZS+j$R #I#EL!L#[:2 dIdPdaH*RF0&8e!ZLCcF(6O3OAlU8T6Ģ% وPlPȍ;,)FH|΢#E4ޡҨ?&,#EL5zN#[fMgFSE Aj+#E<14PP|EbY!滳lFڱg6y&w3\g߲f\ #c\qIźߦg^znU,`6vRcpdY~`!H~1aؾj/zۦ/b8 s8^%ze@RA!<3ޝ 8?3f'3X+4mM2y(62SrBYp|gQ"IDCeXh:>S|H,S iG#Y8 I$7!U8}(?"~';ip/VWy#@v矘 *tT2"B+N׶iFoC)D-Z1+\S<ғ:[٩9Bj묶R<9}ĪumptGiK%t#[܂hIEE/5~_#Eqw|!gOTeD@Q/e W5T%Qa?H&l6 H#[9 #[f#[썵!A+ L H24,"2Iv&ܻ6űcnZ[!mͤlVӻٮEFFьQQ\Yݬm_(/6^#EcW@riX}d>lo  "GtE#2Y(zgC*L0wU|C#2{@^hܪ#2N Z$R]$悑@*]ǏM)#!*0Hw]dH`hWz.0@V0TA#2`*2#[*"aUMTom׭ꨨR%ۈ]*/^*AQHѪ-aXe,MZ >b "܂U!s(ū8b>9_0b۹t6֫g@QTTu}z$A <=F7nJuYTC WiJkWURS3d)B-,&#E(ڊ)%b›UVƶmiZejekE޿O\ֳ&1aPF#EZ6W"D> m6aU#ש=7^:WF(!" c#[16 cH D*F E# cDQ4DB("E#[B䢒*-@VwDQSŗNiӻ1uW[^[xu*A[6J#[;#2dP&](B `+:vIʟ_EisE)^ R#2&Ȏ懭~a8gnu\Z# n! QT& <#oÌJRzqsbC4E8RXT0N اp#Et4E\;^7&˩RFVEkZ.EVo%o' Gr'S;ۺB@J/N1Td>{d^/zh.ؒ7rps~_~7!ZfҔc?ۥF@M}k_tC<%\"Mc/ӿm-ȚS窼 l㴼C#E,{퍈8 .#Eg%akBv4~#'gGࡢYU;ɗrpӀcHq }=@Te|eh|sKԻ:=Q>~1&\.*w[= &75zE M(#2`|36X:}=c8kTnmp#2AἻ5FkٕZ.x5] ppbIP489vҞ=5B#E⺻x:}N٢dJ;\z#E&1# ObSOǵ^rc=iA&; "ryw ZIqǧ<{o mA#['~î=E *'#EВnl! /ys74ׇ%.!¤Bu)-@^dAo]&V~9>TͥAACj:,=bM]dbqn// b4G09%Q"!m(#W$dxYH̓Ct+Bsr8i&r=:n!;bzz->'#f7<K[E@65&L yG&SAr<ݎ,ٶ$1SM`V'噢u^P.p.!Ύd3[FE=K6}xw[A3gε)#EgJ\۬;v(̎'%5.Oue~e$89λѬmym0k9l>D񫽞R C8̭DTg>툧Ƴ֗!"Jf u,GeNyl-+<YTG#2GXR(Y%nTl4gFg*yLls~ 1WNXi԰DF1aT9iaJ76+`cXXhf UI]\,PK՞p* =<ֻAv:m0FD=!Sف@PT0#q$ #E^[Ƥ+˳wfybO2."4q2NhkSACR5D0rp~2$٤S";KW~.r CJj#[VDg,gT3^^rx*(KbQQf +]bv:-e7ZX*gnl>K޸uv߮;KO޳z[ɷ{"S1Rғ˳!=QX*7sDӑY[8{bd8Y 7̜u36QjyLAӵQ)rTʓrz!*i3F%͝khΠu|b8g#E>\o|Ovb",|#{gk:8wc,nj]ē#1%'Lҫ"-gdPX#-ۣZwWf:a۷&٫t%U'<"B``e.v7Enpq -DZ̝d멿=ΈɐiTN港oC^Tl.ywh3q yH]}ᠥ%g3#ozVWdE6|>SB) Z`jE`LP'Z#[#[[22·y!tY#ۋp#E8`3#[u7,;ÞR>np~l ^+߳ &jBQc}km?LM8m <;P9j'#4f˧ʤ(aK/dyդ#E CזN ec8QFcӵlNe]Pے3:{iVm%4^YM[#ElBÇp%ִH+NUUa8և 0!sYX;Ϯ)-[etY,#[Pp5Y<%o+3#"! 0݉ArG+k#2#ޠE:(b^oC^9j$֘ HJ^ilϤ2aZqvkX ,r.Ĉޙ 0%pg2vx8:q)[b,204EDb$,߼fku[!?4fӨm-D3aP#E"4б(b#[QE؄Y#[4ƒHj/fTcmoMh`#2#EXB"(ڎ^-65*&PTҊX`Y,BŖƠr<3׎3}m H$&$HvΣ=5.H*"tŊj^Wbڶ-mhֹUj7*#-Sr31o]NV5]c-PRbc4BQHͳ @$$ۅQ!ѳQ+^3J{2tq1O#Ecׅ!(I ]R2AWˍ=HJo"DQNPk1j44#EaDi6K)a.+M1Ɔa 9,h墣S3U(3LGSPZs}zpcXߥaB#Du5S+$*6q+"`M,cfL"TX.tuˉ0:X#[2+M1֌d46NFFO=3jL;5:wF#E5ainmdBc"Q[ڟފ=#^f>2P(Xģ܋F:ݔpf {bib7'Sm6tp`mI#E@bof!br; Lf8wVfoRgULsa*"(R#(,n`ny&9ݾ#[OrA#DHT_Nvi+9s]mːO#[ vp?/P~D؅SgmXn’*$9gIaOYޠ^ŗNqcPAz}2C?t#2!o'4} U8I١0zQǑ7vwc_T&rkm. ]MF1F̪f|8yRm#wIܘD_w@y9;1cUS-Igºcȴkz@<@#EQ E8ߍ%Dbe~ӯû#8_MJAAfNך 25i-v6\Ս֮ɵiutH gi">_mwWzU!ckHje[aF6Lc%T-S*#[md#[J6ĕ#[4Qh͡M6I&J6RTF4"JD2BihL6#ED &Km$$E?aݫ~#/\5^G{ ԩQ&]Ś]dj~Q:"{%487`vDa"ŏ@$z8 ȫ베D%KT#2@چ`nj#[3\&x[ N!ƊPnejLn|O#E ~7p"H(EV\@d*>'fᘛL4b(aXUSy||WYSRBbsY8/V$6#[KTE%4}Vm*5(Rj4b#>ڹYj^]VvbY0ӓ $L#T 1f@ʪx v.B}H֟uvjKƢQGJ5$r[lTPAawNP+56I C(B[#2YGP%ĉؽ7 .kί3E75+I.h[_FG6\[(bEi(Q#""1/E򣖚iӻP΂*'\{N1Kyl@;{j|{#[ sjtp:[X.1$S*Li[ZVlP>-fEb#E/2b*7߭$m.8/Twh0xN:dj'9A%WK6$>?\QܲCQIZ"SA;k*)4Q$2J v(n]K2=W!B//Q`=ؤPߓGIX#2 .j`vc"x۟|`)GL71Ğ•Q*L#E||":߉tQXr<@?qe-_Xdjg4==j<УYXzb4YH&- O`:0aoQ{"ܠn,-tE`U2gQ,Wn-c0p#Jaou'98>I5csY%h dvTvx3͞.kbf e{~߮FA%5b?@ȏM IVQWiq鍔xfB?3ԏǸFr2g/z!$\:n&-bgбG$&%➠sxSpBH%m#E8 4s9,hL ƶn"6ﻍF_uC&ϮNA"4ЩL iwc' HkY F4³EJvct&ܨq*D`J#E0 HԅE1ZQkj#`*+b28\A@UCmcij"HCHRESx0T:: ^#E&1B97wΣYũGFF<,101:%bQ_zyԚ:?N6,F~v2eܦBd[ѼuEDTew\?v\gιwnL.#2a%魷=|$rn WD7f%+*0e/0B#EBRAxu#fB@3 Y03 Dh mlZUO-+c=-I5Rp+#[*hE|fPwZn<Lnkm&P1o.t@k삷#8`ʂXVFʲe.*eō!sslc ar4p$6ĶP=Em7Xv5ii2K1r=I tSc5-),id4fOȜ䘎v7״J{Ɔl޺l\Vg%mWM. S9gSN);&vt.s`\9W.d!&w|ؚ4t$!90ю+ظY+VKC-xsuZuvD#[eT;<=Dg2ɤ[ia#[׬J%XUǗC&M؜5wO.Xb.d$'5. ;HX!/U6Zexg)#ENiyK\ r"Yr-Y\[Sk#E7d.yR$1䎓H|V"ىd̓46yt֯.T.g[I#2aȱր{Ctc#S@8o{LDlCWÕņBI,k$`mHlR fy/ti#[]Hi6H"P(B&mI\aЀk|T3Fe#EX `C }U*5H$$EѬ5-fKZnRDv)Uӛ<1ymd(viU,6ddܺd\h!-_.6˝Et:"OF^.edR5LM4N:æ$ 14y({SyH'|]<1l>mCO|3"&q~<&aLS&3m͖&GCdYqUb|2A_!f栌դd0v5#Y#Es~f&K%! 6ҰUشS&z-6F݃lS3ΧGIf$LFJŚHPK(fc~y,M#[XrfP Ԇ+ˋɄhY#E-@@V*L 06S UV^v\Da4Jjrs&z"yyBn\C8Ls= 22ږvA=38L$wqWnɽ}K#E8`kcZ#E!*Cw_355[%L&IaJ.ttwR#E[BV E0eELMkI4"ݺ^w:EuHz 0͏0H$!uфaႍH`ȫn֩hI7C30l–QYl j׸̚$#E$ L}(xnqec&/͈mbRpq#EQ+@,&([v&aeHC!$#[l&.xL v 6"&dGfA3bTlB4odADt J#$#VUmȻ!1`SFΦ;Kl#[u]`v#[40# %$`g6bPyw|(@)2m#LQJ!BFCcAQE@Y' à| XU(%JמԛtM#-/sylxhdw]#[]v~-G*Z!D5,=̖xկp!yt#H`!{ɌXCYŹFDN#EI:f"+#E]&!W#E(#E5Ha ¢c#[$J#Ew&9w#[ncNL}3d*s=TYϮ4u*&YI>m$_?C8 zBb%%,0yIjE6mՔUkYT/1a8]6uLDB 8Ny9ۃvzN3D'#EGf.{/xQ {h0Y` iّf R}fk kG ;t穬YDI(w{L`(x`Iu&"IFZՔ1%KmI#"aeƅ*^jMm\o5W-WlB #[ ,]\P* R{&zMR/rSM? L ui{龆جdص$վke/'ޥ0n#21,# kewLTG#EYba]/8=CwIp2zy7IZM. $#E3\&QJ* FGlƔar`02`#2ȈTGLJ~Np857:DB{NO?9PoM=NE%"#[#2뵇"19$$ڲ~)^uUnʹk#nU6.#2(w3eWfX)hTE~d'#EkuVRQ,JZnM6wrPyR[~!%-a(|s$4(ͺuEz=0MgYCe"1B5*D3=`e>9:T*  ӆ^)&`LV8Sf)OKKmTT9;;$Jy7#E`0"tۉ7Hݔ\ّ>vDA\49|61PhTAFfa40HlU&5#h"(1yODTJBi"uCu&-#[A( (H<q#1hl~}nw#2{DȄlZ4M}$U9Ŋl8 ,ŪK3(3p]2EKBϬ8DR#2 "a[ Jw|RdH8-SB$<ۄ; J$p80#Ewg_mV#:\=IsuLyۻ)MX#[8#2<(\{i,ٮk5C#2_h#E(#P4@]X={KYFLfGj#4I#f}ͱsכ7ᐩE4E/&k^Ehs\,׋yvIZ̛*m]I#!S`7r۳wPQU+`EA$-M>U)#[~;@ê!(dfʬH^ u<@@XbJFѤYITٯ5u_F4lCflh)USIK5soMI\%-lH02.0諺Zn1Mak-b#jR`=y-I(tZ"wQ5{IܯxA5 FOjz#岜ڔ.I>8I$x{HC5`8IQx@:V1*.+~6Xdl IIT;g`ЂsNl[JB.#[!BY>Ssӯpx#EBhށ`0?6J =A#2$#[F#[J6[i45JkW@U0jlkL#2 ۔#E#[u =*ȰZ̲j2˪Dkz3.b1+#En&` #[&rVLն0ez4oNmĎ]Ͷ}0s*><+h)cvB0M$@JdTRF#Eb66Rѿ~F$$H$?2:w^=v2Q f6B$a=*ܫ|F:J(Ab0E4M#EJ5RkS{nbI"#2A(F,XZ* VmBE#2BF$n.a_={*I#a!#Eb &N6דL#EĀ[R]$!(]~,i}GXR du2!RLDRȉcOdpQ71& p]XM#E4M-{p9kwezk6%W6T[fnʮݵsȳVƦ[RTJFy[5$ISa!H6bM{v{7jרP4LPĀQ4Yl;nvV˦J_%= 0 0hFa4A?`וUkB- / v/kbg ToT1zLfgړ,b#[rrgxYT(pJƭl50:t#2j.rT.0\DNpۦ #[T!Ǔy%ąOM#EUJ]/αo&i13VBN1H+R3x\Lo5aMN1USp"^|3ww: @俔j>V]J[E(?^n#w/w6w?o?^p-s&Is zO#[d+6;"m\?ӌ#E@7W#\K_31Q azvTEdzO/s@3>ַT~`l#E)&wm$c>&aMf #l/ep#['`~鴠ssxqE@rzY'AJ(E(H-#[k.31#2AH(#'@WKHRYkC\#8y.PF\ʶPrРt!Bee}%?5rܧC#EsƗFc HڬV#2ԩU%3KL!TLf *avwjU2J 6^\I98L3 `KNSzc'48u>|1ikc%Pf\5ѽifw$%NRUxԛ͢Da$n&4KF5W#[_4^Q&kن\B!RFS#EHͮ^ `f6m#Pĝ?\cîTv7M^AȊY[N予nѳӳt5`%B(zy󲱦|uEfJ'w#EFbO#0۱L]IL|i'0 a Sӑh[•gxa#[c[һ0hѿu̡# c15xu7VE;DlbH* 1!},'Pr"B@K3/ݳ>$՘Jz9Y+Gb0H'v 5Z%owA#$Shґ1/kB*ҙmEf&,( M}(P R#['@t`€cΩ*Ә,Rؤ;C@e0ԤU W??*FPPIHlLG~W+ϙUIDjKKǻ&QU&ٽflzC=$2F c6ʆ#E} ]>֓|h |#2pǤq,J\D-y@3+]'تhx5E8٫#E D|c [+Yj?/Fg: &'THdocchV+ŶWZަԛUm0D`\D,n&볡H`nd#bNO.d=:$` 62F t)CB$ÌvfmkAA=z/uƒ\dFn+<<~QۢsGr:琾0+O,P$DX @G-n#[ )+Ve35۱-_B6hQVӻ{g>6E!xrˌ!z5X1zTGEQߦ,?f>?#[^olGQPAlC ((G#[z_~]KB'qxAP&~go?Ѭ.d.g&+0^8}vB^h|(5sN;g]wϪL<z\0O{'_r#7Xn#KBaw |J=-bh+SAMy0W#E#(f!X=T"q'%D=kG%Mob#[;?*Yh5K }#2(NY]N*pM\e|!m:v: G9bo1yl%جDârBF76TtaPt4,.b٭Yuu5[@(qh+h WP7U 1Cw?a~jb/AzsAxXmrTHS֗N&@?!S [fmR[{oR??R #2#)„_@ +#<== diff --git a/waf.bat b/waf.bat new file mode 100644 index 00000000..dac6143c --- /dev/null +++ b/waf.bat @@ -0,0 +1,101 @@ +@echo off + +rem try fix py2 build +chcp 1252 +set PYTHONIOENCODING=UTF-8 +rem from issue #964 + +Setlocal EnableDelayedExpansion + +rem Check Windows Version +set TOKEN=tokens=3* +ver | findstr /i "5\.0\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=3* +ver | findstr /i "5\.1\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=3* +ver | findstr /i "5\.2\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=3* +ver | findstr /i "6\.0\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=2* +ver | findstr /i "6\.1\." > nul +if %ERRORLEVEL% EQU 0 SET TOKEN=tokens=2* + +rem Start calculating PYTHON and PYTHON_DIR +set PYTHON= +set PYTHON_DIR= + +Setlocal EnableDelayedExpansion + +set PYTHON_DIR_OK=FALSE +set REGPATH= + +for %%i in (3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5) do ( +for %%j in (HKCU HKLM) do ( +for %%k in (SOFTWARE\Wow6432Node SOFTWARE) do ( +for %%l in (Python\PythonCore IronPython) do ( +set REG_PYTHON_EXE=python.exe +if "%%l"=="IronPython" ( +set REG_PYTHON_EXE=ipy.exe +) + +@echo on + +set REGPATH=%%j\%%k\%%l\%%i\InstallPath +rem @echo Regpath !REGPATH! +REG QUERY "!REGPATH!" /ve 1>nul 2>nul +if !ERRORLEVEL! equ 0 ( + for /F "%TOKEN% delims= " %%A IN ('REG QUERY "!REGPATH!" /ve') do @set REG_PYTHON_DIR=%%B + if exist !REG_PYTHON_DIR! ( + IF NOT "!REG_PYTHON_DIR:~-1!"=="\" SET REG_PYTHON_DIR=!REG_PYTHON_DIR!\ + set REG_PYTHON=!REG_PYTHON_DIR!!REG_PYTHON_EXE! + rem set PYTHON_DIR_OK=TRUE + if "!PYTHON_DIR_OK!"=="FALSE" ( + set PYTHON_DIR=!REG_PYTHON_DIR! + set PYTHON=!REG_PYTHON! + set PYTHON_DIR_OK=TRUE + ) + + rem set PYTHON_DIR_OK=FALSE + rem @echo Find !REG_PYTHON! + rem goto finished + ) +) + +echo off + +) +rem for l +) +rem for k +) +rem for j +) +rem for i + + + +:finished + +Endlocal & SET PYTHON_DIR=%PYTHON_DIR% & SET PYTHON=%PYTHON% + +if "%PYTHON_DIR%" == "" ( +rem @echo No Python dir +set PYTHON=python +goto running +) + +rem @echo %PYTHON_DIR% + +if "%PYTHON%" == "" ( +rem @echo No Python +set PYTHON=python +goto running +) + +:running + +@echo Using %PYTHON% + +"%PYTHON%" -x "%~dp0waf" %* +Endlocal +exit /b %ERRORLEVEL% diff --git a/wscript b/wscript new file mode 100644 index 00000000..c93885e8 --- /dev/null +++ b/wscript @@ -0,0 +1,237 @@ +#! /usr/bin/env python +# encoding: utf-8 +# a1batross, mittorn, 2018 + +from __future__ import print_function +from waflib import Logs, Context, Configure +import sys +import os + +VERSION = '2.4' +APPNAME = 'hlsdk-xash3d' +top = '.' + +Context.Context.line_just = 55 # should fit for everything on 80x26 + +@Configure.conf +def get_taskgen_count(self): + try: idx = self.tg_idx_count + except: idx = 0 # don't set tg_idx_count to not increase counter + return idx + +def options(opt): + grp = opt.add_option_group('Common options') + + grp.add_option('-T', '--build-type', action='store', dest='BUILD_TYPE', default = None, + help = 'build type: debug, release or none(custom flags)') + + grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False, + help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]') + + grp.add_option('--enable-voicemgr', action = 'store_true', dest = 'VOICEMGR', default = False, + help = 'enable voice manager [default: %default]') + + grp.add_option('--enable-goldsrc-support', action = 'store_true', dest = 'GOLDSRC', default = False, + help = 'enable GoldSource engine support [default: %default]') + + grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False, + help = 'enable Link Time Optimization [default: %default]') + + grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False, + help = 'enable polyhedral optimization if possible [default: %default]') + + opt.load('xcompile compiler_cxx compiler_c clang_compilation_database strip_on_install') + + if sys.platform == 'win32': + opt.load('msvc msdev msvs') + + opt.load('reconfigure subproject') + opt.add_subproject(["cl_dll", "dlls"]) + +def configure(conf): + # Configuration + conf.env.GAMEDIR = 'valve' + conf.env.CLIENT_DIR = 'cl_dlls' + conf.env.SERVER_DIR = 'dlls' + conf.env.SERVER_NAME = 'hl' + conf.env.PREFIX = '' + + conf.load('fwgslib reconfigure') + + conf.start_msg('Build type') + if conf.options.BUILD_TYPE == None: + conf.end_msg('not set', color='RED') + conf.fatal('Please set a build type, for example "-T release"') + elif not conf.options.BUILD_TYPE in ['fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none']: + conf.end_msg(conf.options.BUILD_TYPE, color='RED') + conf.fatal('Invalid build type. Valid are "debug", "release" or "none"') + conf.end_msg(conf.options.BUILD_TYPE) + + # -march=native should not be used + if conf.options.BUILD_TYPE == 'fast': + Logs.warn('WARNING: \'fast\' build type should not be used in release builds') + + conf.env.VOICEMGR = conf.options.VOICEMGR + conf.env.GOLDSRC = conf.options.GOLDSRC + + # Force XP compability, all build targets should add + # subsystem=bld.env.MSVC_SUBSYSTEM + # TODO: wrapper around bld.stlib, bld.shlib and so on? + conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01' + conf.env.MSVC_TARGETS = ['x86'] # explicitly request x86 target for MSVC + if sys.platform == 'win32': + conf.load('msvc msdev') + conf.load('xcompile compiler_c compiler_cxx strip_on_install') + + if conf.env.DEST_OS == 'android': + conf.options.GOLDSRC = False + conf.env.SERVER_NAME = 'server' # can't be any other name, until specified + + # We restrict 64-bit builds ONLY for Win/Linux/OSX running on Intel architecture + # Because compatibility with original GoldSrc + if conf.env.DEST_OS in ['win32', 'linux', 'darwin'] and conf.env.DEST_CPU in ['x86_64']: + conf.env.BIT32_ALLOW64 = conf.options.ALLOW64 + if not conf.env.BIT32_ALLOW64: + Logs.info('WARNING: will build engine for 32-bit target') + else: + conf.env.BIT32_ALLOW64 = True + conf.env.BIT32_MANDATORY = not conf.env.BIT32_ALLOW64 + conf.load('force_32bit') + + linker_flags = { + 'common': { + 'msvc': ['/DEBUG'], # always create PDB, doesn't affect result binaries + 'gcc': ['-Wl,--no-undefined'] + }, + 'sanitize': { + 'clang': ['-fsanitize=undefined', '-fsanitize=address'], + 'gcc': ['-fsanitize=undefined', '-fsanitize=address'], + } + } + + compiler_c_cxx_flags = { + 'common': { + # disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP + 'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-', '/MT'], + 'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden'], + 'gcc': ['-g', '-fvisibility=hidden'] + }, + 'fast': { + 'msvc': ['/O2', '/Oy'], #todo: check /GL /LTCG + 'gcc': ['-Ofast', '-march=native', '-funsafe-math-optimizations', '-funsafe-loop-optimizations', '-fomit-frame-pointer'], + 'clang': ['-Ofast', '-march=native'], + 'default': ['-O3'] + }, + 'release': { + 'msvc': ['/O2'], + 'default': ['-O3'] + }, + 'debug': { + 'msvc': ['/O1'], + 'gcc': ['-Og'], + 'default': ['-O1'] + }, + 'sanitize': { + 'msvc': ['/Od', '/RTC1'], + 'gcc': ['-Og', '-fsanitize=undefined', '-fsanitize=address'], + 'clang': ['-O0', '-fsanitize=undefined', '-fsanitize=address'], + 'default': ['-O0'] + }, + 'nooptimize': { + 'msvc': ['/Od'], + 'default': ['-O0'] + } + } + + compiler_optional_flags = [ + '-fdiagnostics-color=always', + '-Werror=implicit-function-declaration', + '-Werror=int-conversion', + '-Werror=return-type', + '-Werror=parentheses', + '-Werror=vla', + '-Werror=tautological-compare', + '-Werror=duplicated-cond', + '-Werror=bool-compare', + '-Werror=bool-operation', + '-Wstrict-aliasing', + ] + + c_compiler_optional_flags = [ + '-Werror=implicit-int', + '-Werror=declaration-after-statement' + ] + + linkflags = conf.get_flags_by_type(linker_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC) + cflags = conf.get_flags_by_type(compiler_c_cxx_flags, conf.options.BUILD_TYPE, conf.env.COMPILER_CC) + + # Here we don't differentiate C or C++ flags + if conf.options.LTO: + lto_cflags = { + 'msvc': ['/GL'], + 'gcc': ['-flto'], + 'clang': ['-flto'] + } + + lto_linkflags = { + 'msvc': ['/LTCG'], + 'gcc': ['-flto'], + 'clang': ['-flto'] + } + cflags += conf.get_flags_by_compiler(lto_cflags, conf.env.COMPILER_CC) + linkflags += conf.get_flags_by_compiler(lto_linkflags, conf.env.COMPILER_CC) + + if conf.options.POLLY: + polly_cflags = { + 'gcc': ['-fgraphite-identity'], + 'clang': ['-mllvm', '-polly'] + # msvc sosat :( + } + + cflags += conf.get_flags_by_compiler(polly_cflags, conf.env.COMPILER_CC) + + # And here C++ flags starts to be treated separately + cxxflags = list(cflags) + if conf.env.COMPILER_CC != 'msvc': + conf.check_cc(cflags=cflags, msg= 'Checking for required C flags') + conf.check_cxx(cxxflags=cflags, msg= 'Checking for required C++ flags') + + cflags += conf.filter_cflags(compiler_optional_flags + c_compiler_optional_flags, cflags) + cxxflags += conf.filter_cxxflags(compiler_optional_flags, cflags) + + conf.env.append_unique('CFLAGS', cflags) + conf.env.append_unique('CXXFLAGS', cxxflags) + conf.env.append_unique('LINKFLAGS', linkflags) + + # check if we can use C99 tgmath + if conf.check_cc(header_name='tgmath.h', mandatory=False): + tgmath_usable = conf.check_cc(fragment='''#include + int main(void){ return (int)sin(2.0f); }''', + msg='Checking if tgmath.h is usable', mandatory=False): + conf.define_cond('HAVE_TGMATH_H', tgmath_usable) + else: + conf.undefine('HAVE_TGMATH_H') + + if conf.env.COMPILER_CC == 'msvc': + conf.define('_CRT_SECURE_NO_WARNINGS', 1) + conf.define('_CRT_NONSTDC_NO_DEPRECATE', 1) + else: + conf.env.append_unique('DEFINES', ['stricmp=strcasecmp', 'strnicmp=strncasecmp', '_snprintf=snprintf', '_vsnprintf=vsnprintf', '_LINUX', 'LINUX']) + conf.env.append_unique('CXXFLAGS', ['-Wno-invalid-offsetof', '-fno-rtti', '-fno-exceptions']) + + # strip lib from pattern + if conf.env.DEST_OS in ['linux', 'darwin']: + if conf.env.cshlib_PATTERN.startswith('lib'): + conf.env.cshlib_PATTERN = conf.env.cshlib_PATTERN[3:] + if conf.env.cxxshlib_PATTERN.startswith('lib'): + conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:] + + conf.define('CLIENT_WEAPONS', '1') + + conf.add_subproject(["cl_dll", "dlls"]) + +def build(bld): + bld.add_subproject(["cl_dll", "dlls"]) + + +