mirror of https://github.com/FWGS/hlsdk-xash3d
Merge branch 'sohl1.2' into aomdc
This commit is contained in:
commit
c1ba788c58
|
@ -18,5 +18,9 @@ cmake_install.cmake
|
|||
*.vsproj
|
||||
*.sln
|
||||
.waf-*
|
||||
waf-*
|
||||
.waf3-*
|
||||
waf3-*
|
||||
.lock*
|
||||
*.pyc
|
||||
.vscode/
|
|
@ -86,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()
|
||||
|
|
19
README.md
19
README.md
|
@ -43,19 +43,12 @@ There're dsp projects for Visual Studio 6 in `cl_dll` and `dlls` directories, bu
|
|||
|
||||
TODO
|
||||
|
||||
### Linux
|
||||
### Unix-like
|
||||
|
||||
(cd dlls && make)
|
||||
(cd cl_dll && make)
|
||||
To use waf, you need to install python (2.7 minimum)
|
||||
|
||||
### OS X
|
||||
|
||||
Nothing here.
|
||||
|
||||
### FreeBSD
|
||||
|
||||
(cd dlls && gmake CXX=clang++ CC=clang)
|
||||
(cd cl_dll && gmake CXX=clang++ CC=clang)
|
||||
(./waf configure -T release)
|
||||
(./waf)
|
||||
|
||||
### Android
|
||||
|
||||
|
@ -68,9 +61,9 @@ To enable building the goldsource compatible client library add GOLDSOURCE_SUPPO
|
|||
|
||||
cmake .. -DGOLDSOURCE_SUPPORT=ON
|
||||
|
||||
or when using make without cmake:
|
||||
or when using waf:
|
||||
|
||||
make GOLDSOURCE_SUPPORT=1
|
||||
./waf configure -T release --enable-goldsrc-support
|
||||
|
||||
Unlike original client by Valve the resulting client library will not depend on vgui or SDL2 just like the one that's used in FWGS Xash3d.
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
@ -129,6 +134,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)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "studio_util.h"
|
||||
#include "r_studioint.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "studio_util.h"
|
||||
#include "r_studioint.h"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
CC?=gcc
|
||||
CXX?=g++
|
||||
SRCS+=../dlls/crossbow.cpp
|
||||
SRCS+=../dlls/crowbar.cpp
|
||||
SRCS+=../dlls/egon.cpp
|
||||
SRCS+=./ev_hldm.cpp
|
||||
SRCS+=../dlls/gauss.cpp
|
||||
SRCS+=../dlls/handgrenade.cpp
|
||||
SRCS+=./hl/hl_baseentity.cpp
|
||||
SRCS+=./hl/hl_events.cpp
|
||||
SRCS+=./hl/hl_objects.cpp
|
||||
SRCS+=./hl/hl_weapons.cpp
|
||||
SRCS+=../dlls/glock.cpp
|
||||
SRCS+=../dlls/hornetgun.cpp
|
||||
#SRCS+=../common/interface.cpp
|
||||
SRCS+=../dlls/mp5.cpp
|
||||
SRCS+=../dlls/python.cpp
|
||||
SRCS+=../dlls/rpg.cpp
|
||||
SRCS+=../dlls/satchel.cpp
|
||||
SRCS+=../dlls/shotgun.cpp
|
||||
SRCS+=../dlls/squeakgrenade.cpp
|
||||
SRCS+=../dlls/tripmine.cpp
|
||||
#SRCS+=../game_shared/voice_banmgr.cpp
|
||||
#SRCS+=../game_shared/voice_status.cpp
|
||||
SRCS+=./ammo.cpp
|
||||
SRCS+=./ammo_secondary.cpp
|
||||
SRCS+=./ammohistory.cpp
|
||||
SRCS+=./battery.cpp
|
||||
SRCS+=./cdll_int.cpp
|
||||
SRCS+=./com_weapons.cpp
|
||||
SRCS+=./death.cpp
|
||||
SRCS+=./demo.cpp
|
||||
SRCS+=./entity.cpp
|
||||
SRCS+=./ev_common.cpp
|
||||
SRCS+=./events.cpp
|
||||
SRCS+=./flashlight.cpp
|
||||
SRCS+=./GameStudioModelRenderer.cpp
|
||||
SRCS+=./geiger.cpp
|
||||
SRCS+=./health.cpp
|
||||
SRCS+=./hud.cpp
|
||||
SRCS+=./hud_msg.cpp
|
||||
SRCS+=./hud_redraw.cpp
|
||||
#SRCS+=./hud_servers.cpp
|
||||
SRCS+=./hud_spectator.cpp
|
||||
SRCS+=./hud_update.cpp
|
||||
SRCS+=./in_camera.cpp
|
||||
SRCS+=./input.cpp
|
||||
SRCS+=./input_mouse.cpp
|
||||
SRCS+=./input_goldsource.cpp
|
||||
SRCS+=./menu.cpp
|
||||
SRCS+=./message.cpp
|
||||
SRCS+=./overview.cpp
|
||||
SRCS+=./parsemsg.cpp
|
||||
SRCS_C+=../pm_shared/pm_debug.c
|
||||
SRCS_C+=../pm_shared/pm_math.c
|
||||
SRCS_C+=../pm_shared/pm_shared.c
|
||||
SRCS+=./saytext.cpp
|
||||
SRCS+=./status_icons.cpp
|
||||
SRCS+=./statusbar.cpp
|
||||
SRCS+=./studio_util.cpp
|
||||
SRCS+=./StudioModelRenderer.cpp
|
||||
SRCS+=./text_message.cpp
|
||||
SRCS+=./train.cpp
|
||||
SRCS+=./tri.cpp
|
||||
SRCS+=./util.cpp
|
||||
SRCS+=./view.cpp
|
||||
SRCS+=./input_xash3d.cpp
|
||||
SRCS+=./scoreboard.cpp
|
||||
SRCS+=./MOTD.cpp
|
||||
INCLUDES = -I../common -I. -I../game_shared -I../pm_shared -I../engine -I../dlls -I../utils/false_vgui/include
|
||||
DEFINES = -Wno-write-strings -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -DCLIENT_WEAPONS -DCLIENT_DLL
|
||||
CFLAGS = -m32
|
||||
OBJS = $(SRCS:.cpp=.o) $(SRCS_C:.c=.o)
|
||||
|
||||
LIBS=-lm
|
||||
ifeq ($(GOLDSOURCE_SUPPORT),1)
|
||||
DEFINES += -DGOLDSOURCE_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname -s),Linux)
|
||||
LIBS += -ldl
|
||||
endif
|
||||
|
||||
%.o : %.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@
|
||||
|
||||
%.o : %.cpp
|
||||
$(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -fPIC -c $< -o $@
|
||||
client.so : $(OBJS)
|
||||
$(CXX) $(CFLAGS) $(OBJS) -o client.so -shared -Wl,--no-undefined -fPIC $(LIBS)
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS)
|
|
@ -21,7 +21,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "studio_util.h"
|
||||
#include "r_studioint.h"
|
||||
|
@ -138,27 +138,27 @@ void CStudioModelRenderer::StudioCalcBoneAdj( float dadt, float *adj, const byte
|
|||
int a, b;
|
||||
a = ( pcontroller1[j] + 128 ) % 256;
|
||||
b = ( pcontroller2[j] + 128 ) % 256;
|
||||
value = ( ( a * dadt ) + ( b * ( 1 - dadt ) ) - 128 ) * ( 360.0 / 256.0 ) + pbonecontroller[j].start;
|
||||
value = ( ( a * dadt ) + ( b * ( 1.0f - dadt ) ) - 128.0f ) * ( 360.0f / 256.0f ) + pbonecontroller[j].start;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = ( ( pcontroller1[i] * dadt + ( pcontroller2[i] ) * ( 1.0 - dadt ) ) ) * ( 360.0 / 256.0 ) + pbonecontroller[j].start;
|
||||
value = ( ( pcontroller1[i] * dadt + ( pcontroller2[i] ) * ( 1.0f - dadt ) ) ) * ( 360.0f / 256.0f ) + pbonecontroller[j].start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value = ( pcontroller1[i] * dadt + pcontroller2[i] * ( 1.0 - dadt ) ) / 255.0;
|
||||
if( value < 0 ) value = 0;
|
||||
if( value > 1.0 ) value = 1.0;
|
||||
value = ( 1.0 - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
|
||||
value = ( pcontroller1[i] * dadt + pcontroller2[i] * ( 1.0f - dadt ) ) / 255.0f;
|
||||
if( value < 0.0f ) value = 0.0f;
|
||||
if( value > 1.0f ) value = 1.0f;
|
||||
value = ( 1.0f - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
|
||||
}
|
||||
// Con_DPrintf( "%d %d %f : %f\n", m_pCurrentEntity->curstate.controller[j], m_pCurrentEntity->latched.prevcontroller[j], value, dadt );
|
||||
}
|
||||
else
|
||||
{
|
||||
value = mouthopen / 64.0;
|
||||
if( value > 1.0 ) value = 1.0;
|
||||
value = ( 1.0 - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
|
||||
value = mouthopen / 64.0f;
|
||||
if( value > 1.0f ) value = 1.0f;
|
||||
value = ( 1.0f - value ) * pbonecontroller[j].start + value * pbonecontroller[j].end;
|
||||
// Con_DPrintf( "%d %f\n", mouthopen, value );
|
||||
}
|
||||
switch( pbonecontroller[j].type & STUDIO_TYPES )
|
||||
|
@ -166,7 +166,7 @@ void CStudioModelRenderer::StudioCalcBoneAdj( float dadt, float *adj, const byte
|
|||
case STUDIO_XR:
|
||||
case STUDIO_YR:
|
||||
case STUDIO_ZR:
|
||||
adj[j] = value * ( M_PI / 180.0 );
|
||||
adj[j] = value * ( M_PI_F / 180.0f );
|
||||
break;
|
||||
case STUDIO_X:
|
||||
case STUDIO_Y:
|
||||
|
@ -305,7 +305,7 @@ void CStudioModelRenderer::StudioCalcBonePosition( int frame, float s, mstudiobo
|
|||
// and there's more data in the span
|
||||
if( panimvalue->num.valid > k + 1 )
|
||||
{
|
||||
pos[j] += ( panimvalue[k + 1].value * ( 1.0 - s ) + s * panimvalue[k + 2].value ) * pbone->scale[j];
|
||||
pos[j] += ( panimvalue[k + 1].value * ( 1.0f - s ) + s * panimvalue[k + 2].value ) * pbone->scale[j];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -317,7 +317,7 @@ void CStudioModelRenderer::StudioCalcBonePosition( int frame, float s, mstudiobo
|
|||
// are we at the end of the repeating values section and there's another section with data?
|
||||
if( panimvalue->num.total <= k + 1 )
|
||||
{
|
||||
pos[j] += ( panimvalue[panimvalue->num.valid].value * ( 1.0 - s ) + s * panimvalue[panimvalue->num.valid + 2].value ) * pbone->scale[j];
|
||||
pos[j] += ( panimvalue[panimvalue->num.valid].value * ( 1.0f - s ) + s * panimvalue[panimvalue->num.valid + 2].value ) * pbone->scale[j];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -344,12 +344,12 @@ void CStudioModelRenderer::StudioSlerpBones( vec4_t q1[], float pos1[][3], vec4_
|
|||
vec4_t q3;
|
||||
float s1;
|
||||
|
||||
if( s < 0 )
|
||||
s = 0;
|
||||
else if( s > 1.0 )
|
||||
s = 1.0;
|
||||
if( s < 0.0f )
|
||||
s = 0.0f;
|
||||
else if( s > 1.0f )
|
||||
s = 1.0f;
|
||||
|
||||
s1 = 1.0 - s;
|
||||
s1 = 1.0f - s;
|
||||
|
||||
for( i = 0; i < m_pStudioHeader->numbones; i++ )
|
||||
{
|
||||
|
@ -410,17 +410,17 @@ void CStudioModelRenderer::StudioPlayerBlend( mstudioseqdesc_t *pseqdesc, int *p
|
|||
*pBlend = ( *pPitch * 3 );
|
||||
if( *pBlend < pseqdesc->blendstart[0] )
|
||||
{
|
||||
*pPitch -= pseqdesc->blendstart[0] / 3.0;
|
||||
*pPitch -= pseqdesc->blendstart[0] / 3.0f;
|
||||
*pBlend = 0;
|
||||
}
|
||||
else if( *pBlend > pseqdesc->blendend[0] )
|
||||
{
|
||||
*pPitch -= pseqdesc->blendend[0] / 3.0;
|
||||
*pPitch -= pseqdesc->blendend[0] / 3.0f;
|
||||
*pBlend = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pseqdesc->blendend[0] - pseqdesc->blendstart[0] < 0.1 ) // catch qc error
|
||||
if( pseqdesc->blendend[0] - pseqdesc->blendstart[0] < 0.1f ) // catch qc error
|
||||
*pBlend = 127;
|
||||
else
|
||||
*pBlend = 255 * ( *pBlend - pseqdesc->blendstart[0] ) / ( pseqdesc->blendend[0] - pseqdesc->blendstart[0] );
|
||||
|
@ -475,11 +475,11 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
|
|||
if( m_fDoInterp )
|
||||
{
|
||||
// ugly hack to interpolate angle, position. current is reached 0.1 seconds after being set
|
||||
f = f - 1.0;
|
||||
f = f - 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = 0;
|
||||
f = 0.0f;
|
||||
}
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
|
@ -489,7 +489,7 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
|
|||
|
||||
// NOTE: Because multiplayer lag can be relatively large, we don't want to cap
|
||||
// f at 1.5 anymore.
|
||||
//if( f > -1.0 && f < 1.5 ) {}
|
||||
//if( f > -1.0f && f < 1.5f ) {}
|
||||
//Con_DPrintf( "%.0f %.0f\n",m_pCurrentEntity->msg_angles[0][YAW], m_pCurrentEntity->msg_angles[1][YAW] );
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
|
@ -499,13 +499,13 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
|
|||
ang2 = m_pCurrentEntity->latched.prevangles[i];
|
||||
|
||||
d = ang1 - ang2;
|
||||
if( d > 180 )
|
||||
if( d > 180.0f )
|
||||
{
|
||||
d -= 360;
|
||||
d -= 360.0f;
|
||||
}
|
||||
else if( d < -180 )
|
||||
else if( d < -180.0f )
|
||||
{
|
||||
d += 360;
|
||||
d += 360.0f;
|
||||
}
|
||||
|
||||
angles[i] += d * f;
|
||||
|
@ -547,9 +547,9 @@ void CStudioModelRenderer::StudioSetUpTransform( int trivial_accept )
|
|||
{
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
(*m_paliastransform)[0][i] *= m_fSoftwareXScale * ( 1.0 / ( ZISCALE * 0x10000 ) );
|
||||
(*m_paliastransform)[1][i] *= m_fSoftwareYScale * ( 1.0 / ( ZISCALE * 0x10000 ) );
|
||||
(*m_paliastransform)[2][i] *= 1.0 / ( ZISCALE * 0x10000 );
|
||||
(*m_paliastransform)[0][i] *= m_fSoftwareXScale * ( 1.0f / ( ZISCALE * 0x10000 ) );
|
||||
(*m_paliastransform)[1][i] *= m_fSoftwareYScale * ( 1.0f / ( ZISCALE * 0x10000 ) );
|
||||
(*m_paliastransform)[2][i] *= 1.0f / ( ZISCALE * 0x10000 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -579,14 +579,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;
|
||||
|
@ -610,14 +610,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;
|
||||
|
@ -647,18 +647,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 )
|
||||
{
|
||||
|
@ -691,7 +691,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 )
|
||||
{
|
||||
|
@ -699,7 +699,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;
|
||||
|
@ -707,7 +707,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;
|
||||
|
@ -746,7 +746,7 @@ float CStudioModelRenderer::StudioEstimateFrame( mstudioseqdesc_t *pseqdesc )
|
|||
|
||||
if( pseqdesc->numframes <= 1 )
|
||||
{
|
||||
f = 0;
|
||||
f = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1271,10 +1271,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 )
|
||||
{
|
||||
|
@ -1304,29 +1304,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1360,10 +1360,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 );
|
||||
|
||||
|
@ -1371,38 +1371,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 )
|
||||
|
|
|
@ -77,7 +77,7 @@ void WeaponsResource::LoadWeaponSprites( WEAPON *pWeapon )
|
|||
else
|
||||
iRes = 640;
|
||||
|
||||
char sz[128];
|
||||
char sz[256];
|
||||
|
||||
if( !pWeapon )
|
||||
return;
|
||||
|
@ -878,7 +878,7 @@ int CHudAmmo::Draw( float flTime )
|
|||
a = (int)Q_max( MIN_ALPHA, m_fFade );
|
||||
|
||||
if( m_fFade > 0 )
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f );
|
||||
|
||||
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ int CHudAmmoSecondary::Draw( float flTime )
|
|||
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;
|
||||
|
|
|
@ -78,7 +78,7 @@ int CHudBattery::Draw( float flTime )
|
|||
wrect_t rc;
|
||||
|
||||
rc = *m_prc2;
|
||||
rc.top += m_iHeight * ( (float)( 100 - ( Q_min( 100, m_iBat ) ) ) * 0.01 ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
|
||||
rc.top += m_iHeight * ( (float)( 100 - ( Q_min( 100, m_iBat ) ) ) * 0.01f ); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
|
||||
|
||||
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -68,18 +68,18 @@ void EV_FireGMGeneral( 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.
|
||||
|
@ -421,7 +421,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 )
|
||||
{
|
||||
|
@ -1233,3 +1233,4 @@ void EV_FireGMGeneral( event_args_t *args )
|
|||
//======================
|
||||
// GMGENERAL END
|
||||
//======================
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
@ -76,7 +76,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;
|
||||
}
|
||||
|
@ -87,7 +87,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;
|
||||
}
|
||||
|
@ -120,7 +120,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, gHUD.m_iHUDColor );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
// implementation of CHudHealth class
|
||||
//
|
||||
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
|
@ -191,7 +191,7 @@ int CHudHealth::Draw( float flTime )
|
|||
// Has health changed? Flash the health #
|
||||
if( m_fFade )
|
||||
{
|
||||
m_fFade -= ( gHUD.m_flTimeDelta * 20 );
|
||||
m_fFade -= ( (float)gHUD.m_flTimeDelta * 20.0f );
|
||||
if( m_fFade <= 0 )
|
||||
{
|
||||
a = MIN_ALPHA;
|
||||
|
@ -263,27 +263,27 @@ void CHudHealth::CalcDamageDirection( vec3_t vecFrom )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( side > 0 )
|
||||
if( side > 0.0f )
|
||||
{
|
||||
if( side > 0.3 )
|
||||
if( side > 0.3f )
|
||||
m_fAttackFront = Q_max( m_fAttackFront, side );
|
||||
}
|
||||
else
|
||||
{
|
||||
float f = fabs( side );
|
||||
if( f > 0.3 )
|
||||
if( f > 0.3f )
|
||||
m_fAttackRear = Q_max( m_fAttackRear, f );
|
||||
}
|
||||
|
||||
if( front > 0 )
|
||||
if( front > 0.0f )
|
||||
{
|
||||
if( front > 0.3 )
|
||||
if( front > 0.3f )
|
||||
m_fAttackRight = Q_max( m_fAttackRight, front );
|
||||
}
|
||||
else
|
||||
{
|
||||
float f = fabs( front );
|
||||
if( f > 0.3 )
|
||||
if( f > 0.3f )
|
||||
m_fAttackLeft = Q_max( m_fAttackLeft, f );
|
||||
}
|
||||
}
|
||||
|
@ -303,10 +303,10 @@ int CHudHealth::DrawPain( float flTime )
|
|||
float fFade = gHUD.m_flTimeDelta * 2;
|
||||
|
||||
// SPR_Draw top
|
||||
if( m_fAttackFront > 0.4 )
|
||||
if( m_fAttackFront > 0.4f )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * Q_max( m_fAttackFront, 0.5 );
|
||||
shade = a * Q_max( m_fAttackFront, 0.5f );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
|
@ -317,10 +317,10 @@ int CHudHealth::DrawPain( float flTime )
|
|||
} else
|
||||
m_fAttackFront = 0;
|
||||
|
||||
if( m_fAttackRight > 0.4 )
|
||||
if( m_fAttackRight > 0.4f )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * Q_max( m_fAttackRight, 0.5 );
|
||||
shade = a * Q_max( m_fAttackRight, 0.5f );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
|
@ -332,10 +332,10 @@ int CHudHealth::DrawPain( float flTime )
|
|||
else
|
||||
m_fAttackRight = 0;
|
||||
|
||||
if( m_fAttackRear > 0.4 )
|
||||
if( m_fAttackRear > 0.4f )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * Q_max( m_fAttackRear, 0.5 );
|
||||
shade = a * Q_max( m_fAttackRear, 0.5f );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
|
@ -347,10 +347,10 @@ int CHudHealth::DrawPain( float flTime )
|
|||
else
|
||||
m_fAttackRear = 0;
|
||||
|
||||
if( m_fAttackLeft > 0.4 )
|
||||
if( m_fAttackLeft > 0.4f )
|
||||
{
|
||||
GetPainColor( r, g, b );
|
||||
shade = a * Q_max( m_fAttackLeft, 0.5 );
|
||||
shade = a * Q_max( m_fAttackLeft, 0.5f );
|
||||
ScaleColors( r, g, b, shade );
|
||||
SPR_Set( m_hSprite, r, g, b );
|
||||
|
||||
|
@ -375,7 +375,7 @@ int CHudHealth::DrawDamage( float flTime )
|
|||
|
||||
UnpackRGB(r,g,b, gHUD.m_iHUDColor);
|
||||
|
||||
a = (int)( fabs( sin( flTime * 2 ) ) * 256.0 );
|
||||
a = (int)( fabs( sin( flTime * 2.0f ) ) * 256.0f );
|
||||
|
||||
ScaleColors( r, g, b, a );
|
||||
|
||||
|
|
|
@ -162,7 +162,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;
|
||||
}
|
||||
|
||||
|
@ -224,8 +224,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;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,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;
|
||||
}
|
||||
|
@ -302,8 +302,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 );
|
||||
}
|
||||
|
@ -311,13 +311,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 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -329,7 +329,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.
|
||||
|
@ -344,7 +344,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()] )
|
||||
{
|
||||
|
@ -354,7 +354,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()] ) )
|
||||
{
|
||||
|
@ -374,7 +374,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;
|
||||
|
@ -489,7 +489,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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -936,73 +936,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.
|
||||
|
|
|
@ -266,8 +266,9 @@ void CHud::Init( void )
|
|||
m_iFOV = 0;
|
||||
m_iHUDColor = 0x00FFFFFF; //255,255,255 -- LRC
|
||||
|
||||
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" );
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
//
|
||||
// hud_redraw.cpp
|
||||
//
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include "triangleapi.h"
|
||||
|
@ -93,8 +94,8 @@ 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;
|
||||
static int m_flShotTime = 0;
|
||||
m_flTimeDelta = (double)(m_flTime - m_fOldTime);
|
||||
static float m_flShotTime = 0;
|
||||
|
||||
//LRC - handle fog fading effects. (is this the right place for it?)
|
||||
if (g_fFadeDuration)
|
||||
|
@ -138,7 +139,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
|
||||
}
|
||||
}*/
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// hud_update.cpp
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -28,16 +28,16 @@ extern cl_enginefunc_t gEngfuncs;
|
|||
|
||||
//-------------------------------------------------- Constants
|
||||
|
||||
#define CAM_DIST_DELTA 1.0
|
||||
#define CAM_ANGLE_DELTA 2.5
|
||||
#define CAM_ANGLE_SPEED 2.5
|
||||
#define CAM_MIN_DIST 30.0
|
||||
#define CAM_ANGLE_MOVE .5
|
||||
#define MAX_ANGLE_DIFF 10.0
|
||||
#define PITCH_MAX 90.0
|
||||
#define PITCH_MIN 0
|
||||
#define YAW_MAX 135.0
|
||||
#define YAW_MIN -135.0
|
||||
#define CAM_DIST_DELTA 1.0f
|
||||
#define CAM_ANGLE_DELTA 2.5f
|
||||
#define CAM_ANGLE_SPEED 2.5f
|
||||
#define CAM_MIN_DIST 30.0f
|
||||
#define CAM_ANGLE_MOVE 0.5f
|
||||
#define MAX_ANGLE_DIFF 10.0f
|
||||
#define PITCH_MAX 90.0f
|
||||
#define PITCH_MIN 0.0f
|
||||
#define YAW_MAX 135.0f
|
||||
#define YAW_MIN -135.0f
|
||||
|
||||
enum ECAM_Command
|
||||
{
|
||||
|
@ -91,35 +91,35 @@ float MoveToward( float cur, float goal, float maxspeed )
|
|||
{
|
||||
if( cur != goal )
|
||||
{
|
||||
if( fabs( cur - goal ) > 180.0 )
|
||||
if( fabs( cur - goal ) > 180.0f )
|
||||
{
|
||||
if( cur < goal )
|
||||
cur += 360.0;
|
||||
cur += 360.0f;
|
||||
else
|
||||
cur -= 360.0;
|
||||
cur -= 360.0f;
|
||||
}
|
||||
|
||||
if( cur < goal )
|
||||
{
|
||||
if( cur < goal - 1.0 )
|
||||
cur += ( goal - cur ) / 4.0;
|
||||
if( cur < goal - 1.0f )
|
||||
cur += ( goal - cur ) * 0.25f;
|
||||
else
|
||||
cur = goal;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( cur > goal + 1.0 )
|
||||
cur -= ( cur - goal ) / 4.0;
|
||||
if( cur > goal + 1.0f )
|
||||
cur -= ( cur - goal ) * 0.25f;
|
||||
else
|
||||
cur = goal;
|
||||
}
|
||||
}
|
||||
|
||||
// bring cur back into range
|
||||
if( cur < 0 )
|
||||
cur += 360.0;
|
||||
else if( cur >= 360 )
|
||||
cur -= 360;
|
||||
if( cur < 0.0f )
|
||||
cur += 360.0f;
|
||||
else if( cur >= 360.0f )
|
||||
cur -= 360.0f;
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ void DLLEXPORT CAM_Think( void )
|
|||
if( cam_contain->value )
|
||||
{
|
||||
gEngfuncs.GetClientOrigin( origin );
|
||||
ext[0] = ext[1] = ext[2] = 0.0;
|
||||
ext[0] = ext[1] = ext[2] = 0.0f;
|
||||
}
|
||||
#endif
|
||||
camAngles[PITCH] = cam_idealpitch->value;
|
||||
|
@ -195,7 +195,7 @@ void DLLEXPORT CAM_Think( void )
|
|||
//keep the camera within certain limits around the player (ie avoid certain bad viewing angles)
|
||||
if( cam_mouse.x>gEngfuncs.GetWindowCenterX() )
|
||||
{
|
||||
//if( ( camAngles[YAW] >= 225.0 ) || ( camAngles[YAW] < 135.0 ) )
|
||||
//if( ( camAngles[YAW] >= 225.0f ) || ( camAngles[YAW] < 135.0f ) )
|
||||
if( camAngles[YAW] < c_maxyaw->value )
|
||||
{
|
||||
camAngles[YAW] += CAM_ANGLE_MOVE * ( ( cam_mouse.x - gEngfuncs.GetWindowCenterX() ) / 2 );
|
||||
|
@ -207,7 +207,7 @@ void DLLEXPORT CAM_Think( void )
|
|||
}
|
||||
else if( cam_mouse.x<gEngfuncs.GetWindowCenterX() )
|
||||
{
|
||||
//if( ( camAngles[YAW] <= 135.0 ) || ( camAngles[YAW] > 225.0 ) )
|
||||
//if( ( camAngles[YAW] <= 135.0f ) || ( camAngles[YAW] > 225.0f ) )
|
||||
if( camAngles[YAW] > c_minyaw->value )
|
||||
{
|
||||
camAngles[YAW] -= CAM_ANGLE_MOVE * ( ( gEngfuncs.GetWindowCenterX() - cam_mouse.x ) / 2 );
|
||||
|
@ -363,10 +363,10 @@ void DLLEXPORT CAM_Think( void )
|
|||
if( camAngles[PITCH] - viewangles[PITCH] != cam_idealpitch->value )
|
||||
camAngles[PITCH] = MoveToward( camAngles[PITCH], cam_idealpitch->value + viewangles[PITCH], CAM_ANGLE_SPEED );
|
||||
|
||||
if( fabs( camAngles[2] - cam_idealdist->value ) < 2.0 )
|
||||
if( fabs( camAngles[2] - cam_idealdist->value ) < 2.0f )
|
||||
camAngles[2] = cam_idealdist->value;
|
||||
else
|
||||
camAngles[2] += ( cam_idealdist->value - camAngles[2] ) / 4.0;
|
||||
camAngles[2] += ( cam_idealdist->value - camAngles[2] ) * 0.25f;
|
||||
}
|
||||
#ifdef LATER
|
||||
if( cam_contain->value )
|
||||
|
@ -382,9 +382,9 @@ void DLLEXPORT CAM_Think( void )
|
|||
|
||||
// check line from r_refdef.vieworg to pnt
|
||||
memset( &clip, 0, sizeof(moveclip_t) );
|
||||
ext[0] = ext[1] = ext[2] = 0.0;
|
||||
ext[0] = ext[1] = ext[2] = 0.0f;
|
||||
clip.trace = SV_ClipMoveToEntity( sv.edicts, r_refdef.vieworg, ext, ext, pnt );
|
||||
if( clip.trace.fraction != 1.0 )
|
||||
if( clip.trace.fraction != 1.0f )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -170,7 +170,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 );
|
||||
|
@ -820,7 +820,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 ) );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -66,22 +66,22 @@ float CHudMessage::FadeBlend( float fadein, float fadeout, float hold, float loc
|
|||
float fadeTime = fadein + hold;
|
||||
float fadeBlend;
|
||||
|
||||
if( localTime < 0 )
|
||||
if( localTime < 0.0f )
|
||||
return 0;
|
||||
|
||||
if( localTime < fadein )
|
||||
{
|
||||
fadeBlend = 1 - ( ( fadein - localTime ) / fadein );
|
||||
fadeBlend = 1.0f - ( ( fadein - localTime ) / fadein );
|
||||
}
|
||||
else if( localTime > fadeTime )
|
||||
{
|
||||
if( fadeout > 0 )
|
||||
fadeBlend = 1 - ( ( localTime - fadeTime ) / fadeout );
|
||||
if( fadeout > 0.0f )
|
||||
fadeBlend = 1.0f - ( ( localTime - fadeTime ) / fadeout );
|
||||
else
|
||||
fadeBlend = 0;
|
||||
fadeBlend = 0.0f;
|
||||
}
|
||||
else
|
||||
fadeBlend = 1;
|
||||
fadeBlend = 1.0f;
|
||||
|
||||
return fadeBlend;
|
||||
}
|
||||
|
@ -91,14 +91,14 @@ int CHudMessage::XPosition( float x, int width, int totalWidth )
|
|||
{
|
||||
int xPos;
|
||||
|
||||
if( x == -1 )
|
||||
if( x == -1.0f )
|
||||
{
|
||||
xPos = ( ScreenWidth - width ) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( x < 0 )
|
||||
xPos = ( 1.0 + x ) * ScreenWidth - totalWidth; // Alight right
|
||||
if( x < 0.0f )
|
||||
xPos = ( 1.0f + x ) * ScreenWidth - totalWidth; // Alight right
|
||||
else
|
||||
xPos = x * ScreenWidth;
|
||||
}
|
||||
|
@ -116,12 +116,12 @@ int CHudMessage::YPosition( float y, int height )
|
|||
int yPos;
|
||||
|
||||
if( y == -1 ) // Centered?
|
||||
yPos = ( ScreenHeight - height ) * 0.5;
|
||||
yPos = ( ScreenHeight - height ) * 0.5f;
|
||||
else
|
||||
{
|
||||
// Alight bottom?
|
||||
if ( y < 0 )
|
||||
yPos = ( 1.0 + y ) * ScreenHeight - height; // Alight bottom
|
||||
yPos = ( 1.0f + y ) * ScreenHeight - height; // Alight bottom
|
||||
else // align top
|
||||
yPos = y * ScreenHeight;
|
||||
}
|
||||
|
@ -164,18 +164,20 @@ void CHudMessage::MessageScanNextChar( void )
|
|||
float deltaTime = m_parms.time - m_parms.charTime;
|
||||
|
||||
destRed = destGreen = destBlue = 0;
|
||||
if ( m_parms.time > m_parms.fadeTime )
|
||||
if( m_parms.time > m_parms.fadeTime )
|
||||
{
|
||||
blend = m_parms.fadeBlend;
|
||||
}
|
||||
else if ( deltaTime > m_parms.pMessage->fxtime )
|
||||
else if( deltaTime > m_parms.pMessage->fxtime )
|
||||
{
|
||||
blend = 0; // pure dest
|
||||
}
|
||||
else
|
||||
{
|
||||
destRed = m_parms.pMessage->r2;
|
||||
destGreen = m_parms.pMessage->g2;
|
||||
destBlue = m_parms.pMessage->b2;
|
||||
blend = 255 - (deltaTime * (1.0/m_parms.pMessage->fxtime) * 255.0 + 0.5);
|
||||
blend = 255 - ( deltaTime * ( 1.0f / m_parms.pMessage->fxtime) * 255.0f + 0.5f );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -208,7 +210,7 @@ void CHudMessage::MessageScanStart( void )
|
|||
|
||||
if( m_parms.time < m_parms.pMessage->fadein )
|
||||
{
|
||||
m_parms.fadeBlend = ( ( m_parms.pMessage->fadein - m_parms.time ) * ( 1.0 / m_parms.pMessage->fadein ) * 255 );
|
||||
m_parms.fadeBlend = ( ( m_parms.pMessage->fadein - m_parms.time ) * ( 1.0f / m_parms.pMessage->fadein ) * 255 );
|
||||
}
|
||||
else if( m_parms.time > m_parms.fadeTime )
|
||||
{
|
||||
|
@ -352,7 +354,7 @@ int CHudMessage::Draw( float fTime )
|
|||
{
|
||||
pMessage = m_pMessages[i];
|
||||
if( m_startTime[i] > gHUD.m_flTime )
|
||||
m_startTime[i] = gHUD.m_flTime + m_parms.time - m_startTime[i] + 0.2; // Server takes 0.2 seconds to spawn, adjust for this
|
||||
m_startTime[i] = gHUD.m_flTime + m_parms.time - m_startTime[i] + 0.2f; // Server takes 0.2 seconds to spawn, adjust for this
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,11 +430,11 @@ void CHudMessage::MessageAdd( const char *pName, float time )
|
|||
g_pCustomMessage.g2 = 110;
|
||||
g_pCustomMessage.b2 = 0;
|
||||
g_pCustomMessage.a2 = 0;
|
||||
g_pCustomMessage.x = -1; // Centered
|
||||
g_pCustomMessage.y = 0.7;
|
||||
g_pCustomMessage.fadein = 0.01;
|
||||
g_pCustomMessage.fadeout = 1.5;
|
||||
g_pCustomMessage.fxtime = 0.25;
|
||||
g_pCustomMessage.x = -1.0f; // Centered
|
||||
g_pCustomMessage.y = 0.7f;
|
||||
g_pCustomMessage.fadein = 0.01f;
|
||||
g_pCustomMessage.fadeout = 1.5f;
|
||||
g_pCustomMessage.fxtime = 0.25f;
|
||||
g_pCustomMessage.holdtime = 5;
|
||||
g_pCustomMessage.pName = g_pCustomName;
|
||||
strcpy( g_pCustomText, pName );
|
||||
|
@ -452,9 +454,9 @@ void CHudMessage::MessageAdd( const char *pName, float time )
|
|||
}
|
||||
|
||||
// get rid of any other messages in same location (only one displays at a time)
|
||||
if( fabs( tempMessage->y - m_pMessages[j]->y ) < 0.0001 )
|
||||
if( fabs( tempMessage->y - m_pMessages[j]->y ) < 0.0001f )
|
||||
{
|
||||
if ( fabs( tempMessage->x - m_pMessages[j]->x ) < 0.0001 )
|
||||
if( fabs( tempMessage->x - m_pMessages[j]->x ) < 0.0001f )
|
||||
{
|
||||
m_pMessages[j] = NULL;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
// implementation of class-less helper functions
|
||||
//
|
||||
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "hud.h"
|
||||
#include "cl_util.h"
|
||||
|
@ -30,20 +30,22 @@
|
|||
#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
|
||||
#endif
|
||||
|
||||
#ifndef M_PI_F
|
||||
#define M_PI_F (float)M_PI
|
||||
#endif
|
||||
|
||||
extern vec3_t vec3_origin;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
vec3_t vec3_origin;
|
||||
#endif
|
||||
|
||||
double sqrt( double x );
|
||||
|
||||
float Length( const float *v )
|
||||
{
|
||||
int i;
|
||||
float length;
|
||||
|
||||
length = 0;
|
||||
length = 0.0f;
|
||||
for( i = 0; i < 3; i++ )
|
||||
length += v[i] * v[i];
|
||||
length = sqrt( length ); // FIXME
|
||||
|
@ -55,29 +57,29 @@ void VectorAngles( const float *forward, float *angles )
|
|||
{
|
||||
float tmp, yaw, pitch;
|
||||
|
||||
if( forward[1] == 0 && forward[0] == 0 )
|
||||
if( forward[1] == 0.0f && forward[0] == 0.0f )
|
||||
{
|
||||
yaw = 0;
|
||||
if( forward[2] > 0 )
|
||||
pitch = 90;
|
||||
yaw = 0.0f;
|
||||
if( forward[2] > 0.0f )
|
||||
pitch = 90.0f;
|
||||
else
|
||||
pitch = 270;
|
||||
pitch = 270.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
yaw = ( atan2( forward[1], forward[0]) * 180 / M_PI );
|
||||
if( yaw < 0 )
|
||||
yaw += 360;
|
||||
yaw = ( atan2( forward[1], forward[0]) * 180.0f / M_PI_F );
|
||||
if( yaw < 0.0f )
|
||||
yaw += 360.0f;
|
||||
|
||||
tmp = sqrt( forward[0] * forward[0] + forward[1] * forward[1] );
|
||||
pitch = ( atan2( forward[2], tmp ) * 180 / M_PI );
|
||||
if( pitch < 0 )
|
||||
pitch += 360;
|
||||
pitch = ( atan2( forward[2], tmp ) * 180.0f / M_PI_F );
|
||||
if( pitch < 0.0f )
|
||||
pitch += 360.0f;
|
||||
}
|
||||
|
||||
angles[0] = pitch;
|
||||
angles[1] = yaw;
|
||||
angles[2] = 0;
|
||||
angles[2] = 0.0f;
|
||||
}
|
||||
|
||||
float VectorNormalize( float *v )
|
||||
|
@ -89,7 +91,7 @@ float VectorNormalize( float *v )
|
|||
|
||||
if( length )
|
||||
{
|
||||
ilength = 1 / length;
|
||||
ilength = 1.0f / length;
|
||||
v[0] *= ilength;
|
||||
v[1] *= ilength;
|
||||
v[2] *= ilength;
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
#define UTIL_VECTOR_H
|
||||
|
||||
// Misc C-runtime library headers
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
|
||||
// Header file containing definition of globalvars_t and entvars_t
|
||||
typedef unsigned int func_t; //
|
||||
|
|
172
cl_dll/view.cpp
172
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 = Q_min( bob, 4 );
|
||||
bob = Q_max( bob, -7 );
|
||||
bob = bob * 0.3f + bob * 0.7f * sin(cycle);
|
||||
bob = Q_min( bob, 4.0f );
|
||||
bob = Q_max( bob, -7.0f );
|
||||
return bob;
|
||||
}
|
||||
|
||||
|
@ -234,7 +238,7 @@ float V_CalcRoll( vec3_t angles, vec3_t velocity, float rollangle, float rollspe
|
|||
AngleVectors( angles, forward, right, up );
|
||||
|
||||
side = DotProduct( velocity, right );
|
||||
sign = side < 0 ? -1 : 1;
|
||||
sign = side < 0.0f ? -1.0f : 1.0f;
|
||||
side = fabs( side );
|
||||
|
||||
value = rollangle;
|
||||
|
@ -290,11 +294,11 @@ void V_CalcGunAngle( struct ref_params_s *pparams )
|
|||
return;
|
||||
|
||||
viewent->angles[YAW] = pparams->viewangles[YAW] + pparams->crosshairangle[YAW];
|
||||
viewent->angles[PITCH] = -pparams->viewangles[PITCH] + pparams->crosshairangle[PITCH] * 0.25;
|
||||
viewent->angles[PITCH] = -pparams->viewangles[PITCH] + pparams->crosshairangle[PITCH] * 0.25f;
|
||||
viewent->angles[ROLL] -= v_idlescale * sin( pparams->time * v_iroll_cycle.value ) * v_iroll_level.value;
|
||||
|
||||
// don't apply all of the v_ipitch to prevent normally unseen parts of viewmodel from coming into view.
|
||||
viewent->angles[PITCH] -= v_idlescale * sin( pparams->time * v_ipitch_cycle.value ) * ( v_ipitch_level.value * 0.5 );
|
||||
viewent->angles[PITCH] -= v_idlescale * sin( pparams->time * v_ipitch_cycle.value ) * ( v_ipitch_level.value * 0.5f );
|
||||
viewent->angles[YAW] -= v_idlescale * sin( pparams->time * v_iyaw_cycle.value ) * v_iyaw_level.value;
|
||||
|
||||
VectorCopy( viewent->angles, viewent->curstate.angles );
|
||||
|
@ -481,15 +485,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
|
||||
|
@ -509,7 +513,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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -581,7 +585,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 );
|
||||
|
||||
|
@ -614,18 +618,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 );
|
||||
|
@ -633,25 +637,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
|
||||
|
@ -664,7 +668,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;
|
||||
|
||||
|
@ -674,11 +678,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];
|
||||
}
|
||||
|
@ -693,7 +697,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;
|
||||
|
@ -710,9 +714,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;
|
||||
|
@ -724,7 +728,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;
|
||||
|
@ -741,7 +745,7 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
|
|||
VectorMA( ViewInterp.Origins[foundidx & ORIGIN_MASK], frac, delta, neworg );
|
||||
|
||||
// Dont interpolate large changes
|
||||
if( Length( delta ) < 64 )
|
||||
if( Length( delta ) < 64.0f )
|
||||
{
|
||||
VectorSubtract( neworg, pparams->simorg, delta );
|
||||
|
||||
|
@ -763,13 +767,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;
|
||||
|
@ -836,7 +840,7 @@ void V_SmoothInterpolateAngles( float * startAngle, float * endAngle, float * fi
|
|||
{
|
||||
frac = degreesPerSec * v_frametime;
|
||||
|
||||
threshhold= degreesPerSec / 4;
|
||||
threshhold= degreesPerSec / 4.0f;
|
||||
|
||||
if( absd < threshhold )
|
||||
{
|
||||
|
@ -851,7 +855,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;
|
||||
|
@ -947,7 +951,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 )
|
||||
|
@ -961,7 +965,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
|
||||
|
@ -1002,12 +1006,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
|
||||
|
@ -1045,13 +1049,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 );
|
||||
|
@ -1086,9 +1090,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 );
|
||||
|
@ -1191,9 +1195,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 );
|
||||
}
|
||||
|
@ -1232,14 +1236,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 );
|
||||
}
|
||||
|
@ -1274,15 +1278,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 )
|
||||
|
@ -1346,7 +1350,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 )
|
||||
|
@ -1593,8 +1597,8 @@ void V_DropPunchAngle( float frametime, float *ev_punchangle )
|
|||
float len;
|
||||
|
||||
len = VectorNormalize( ev_punchangle );
|
||||
len -= ( 10.0 + len * 0.5 ) * frametime;
|
||||
len = Q_max( len, 0.0 );
|
||||
len -= ( 10.0f + len * 0.5f ) * (float)frametime;
|
||||
len = Q_max( len, 0.0f );
|
||||
VectorScale( ev_punchangle, len, ev_punchangle );
|
||||
}
|
||||
|
||||
|
@ -1645,14 +1649,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;
|
||||
}
|
||||
|
@ -1674,8 +1678,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;
|
||||
|
@ -1684,8 +1688,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;
|
||||
|
||||
|
@ -1700,10 +1704,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
|
||||
{
|
||||
|
|
|
@ -10,10 +10,12 @@ def options(opt):
|
|||
return
|
||||
|
||||
def configure(conf):
|
||||
if conf.env.GOLDSRC:
|
||||
if conf.env.DEST_OS != 'win32':
|
||||
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',
|
||||
|
@ -45,10 +47,13 @@ def build(bld):
|
|||
defines += ['GOLDSOURCE_SUPPORT']
|
||||
|
||||
libs = []
|
||||
if bld.env.GOLDSRC:
|
||||
if bld.env.GOLDSRC and bld.env.DEST_OS != 'win32':
|
||||
libs += ['DL']
|
||||
|
||||
if bld.env.DEST_OS2 not in ['android']:
|
||||
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
|
||||
|
@ -62,5 +67,5 @@ def build(bld):
|
|||
use = libs,
|
||||
install_path = install_path,
|
||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||
idx = 1
|
||||
idx = bld.get_taskgen_count()
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -204,7 +204,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
|
||||
{
|
||||
|
|
|
@ -16,7 +16,14 @@
|
|||
#pragma once
|
||||
#ifndef MATHLIB_H
|
||||
#define MATHLIB_H
|
||||
#ifndef __cplusplus
|
||||
#include <math.h>
|
||||
#ifdef HAVE_TGMATH_H
|
||||
#include <tgmath.h>
|
||||
#endif // HAVE_TGMATH_H
|
||||
#else // __cplusplus
|
||||
#include <cmath>
|
||||
#endif // __cplusplus
|
||||
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec5_t[5];
|
||||
|
@ -31,17 +38,20 @@ typedef int fixed8_t;
|
|||
typedef int fixed16_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;
|
||||
|
|
|
@ -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)
|
||||
|
|
190
dlls/Makefile
190
dlls/Makefile
|
@ -1,190 +0,0 @@
|
|||
#
|
||||
# Half-Life Full SDK 2.3 hl_i386.so Makefile for x86 Linux
|
||||
#
|
||||
# October 2002 by Leon Hartwig (hartwig@valvesoftware.com)
|
||||
#
|
||||
|
||||
DLLNAME=hl
|
||||
|
||||
ARCH=i386
|
||||
|
||||
#make sure this is the correct compiler for your system
|
||||
CC?=gcc
|
||||
CXX?=g++
|
||||
|
||||
DLL_SRCDIR=.
|
||||
ENGINE_SRCDIR=../engine
|
||||
COMMON_SRCDIR=../common
|
||||
WPN_SHARED_SRCDIR=./wpn_shared
|
||||
PM_SHARED_SRCDIR=../pm_shared
|
||||
GAME_SHARED_SRCDIR=../game_shared
|
||||
|
||||
DLL_OBJDIR=$(DLL_SRCDIR)/obj
|
||||
WPN_SHARED_OBJDIR=$(WPN_SHARED_SRCDIR)/obj
|
||||
PM_SHARED_OBJDIR=$(PM_SHARED_SRCDIR)/obj
|
||||
GAME_SHARED_OBJDIR=$(GAME_SHARED_SRCDIR)/obj
|
||||
|
||||
BASE_CFLAGS= -Dstricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
|
||||
-DCLIENT_WEAPONS -DNO_VOICEGAMEMGR
|
||||
|
||||
#safe optimization
|
||||
CFLAGS=$(BASE_CFLAGS) -m32 -w -O1
|
||||
|
||||
#full optimization
|
||||
#CFLAGS=$(BASE_CFLAGS) -w -O1 -m486 -ffast-math -funroll-loops \
|
||||
-fomit-frame-pointer -fexpensive-optimizations \
|
||||
-malign-loops=2 -malign-jumps=2 -malign-functions=2
|
||||
|
||||
#use these when debugging
|
||||
#CFLAGS=$(BASE_CFLAGS) -g
|
||||
|
||||
INCLUDEDIRS=-I. -I$(ENGINE_SRCDIR) -I$(COMMON_SRCDIR) -I$(PM_SHARED_SRCDIR) -I$(GAME_SHARED_SRCDIR)
|
||||
|
||||
LDFLAGS=
|
||||
|
||||
SHLIBEXT=so
|
||||
SHLIBCFLAGS=-fPIC
|
||||
SHLIBLDFLAGS=-shared
|
||||
|
||||
DO_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) $(INCLUDEDIRS) -o $@ -c $<
|
||||
DO_CXX=$(CXX) $(CFLAGS) $(SHLIBCFLAGS) $(INCLUDEDIRS) -o $@ -c $<
|
||||
|
||||
#############################################################################
|
||||
# SETUP AND BUILD
|
||||
# GAME
|
||||
#############################################################################
|
||||
|
||||
$(DLL_OBJDIR)/%.o: $(DLL_SRCDIR)/%.cpp
|
||||
$(DO_CXX)
|
||||
|
||||
$(WPN_SHARED_OBJDIR)/%.o: $(WPN_SHARED_SRCDIR)/%.cpp
|
||||
$(DO_CXX)
|
||||
|
||||
$(GAME_SHARED_OBJDIR)/%.o: $(GAME_SHARED_SRCDIR)/%.cpp
|
||||
$(DO_CXX)
|
||||
|
||||
$(PM_SHARED_OBJDIR)/%.o: $(PM_SHARED_SRCDIR)/%.c
|
||||
$(DO_CC)
|
||||
|
||||
OBJ = \
|
||||
$(DLL_OBJDIR)/aflock.o \
|
||||
$(DLL_OBJDIR)/agrunt.o \
|
||||
$(DLL_OBJDIR)/airtank.o \
|
||||
$(DLL_OBJDIR)/animating.o \
|
||||
$(DLL_OBJDIR)/animation.o \
|
||||
$(DLL_OBJDIR)/apache.o \
|
||||
$(DLL_OBJDIR)/barnacle.o \
|
||||
$(DLL_OBJDIR)/barney.o \
|
||||
$(DLL_OBJDIR)/bigmomma.o \
|
||||
$(DLL_OBJDIR)/bloater.o \
|
||||
$(DLL_OBJDIR)/bmodels.o \
|
||||
$(DLL_OBJDIR)/bullsquid.o \
|
||||
$(DLL_OBJDIR)/buttons.o \
|
||||
$(DLL_OBJDIR)/cbase.o \
|
||||
$(DLL_OBJDIR)/client.o \
|
||||
$(DLL_OBJDIR)/combat.o \
|
||||
$(DLL_OBJDIR)/controller.o \
|
||||
$(DLL_OBJDIR)/crossbow.o \
|
||||
$(DLL_OBJDIR)/crowbar.o \
|
||||
$(DLL_OBJDIR)/defaultai.o \
|
||||
$(DLL_OBJDIR)/doors.o \
|
||||
$(DLL_OBJDIR)/effects.o \
|
||||
$(DLL_OBJDIR)/egon.o \
|
||||
$(DLL_OBJDIR)/explode.o \
|
||||
$(DLL_OBJDIR)/flyingmonster.o \
|
||||
$(DLL_OBJDIR)/func_break.o \
|
||||
$(DLL_OBJDIR)/func_tank.o \
|
||||
$(DLL_OBJDIR)/game.o \
|
||||
$(DLL_OBJDIR)/gamerules.o \
|
||||
$(DLL_OBJDIR)/gargantua.o \
|
||||
$(DLL_OBJDIR)/gauss.o \
|
||||
$(DLL_OBJDIR)/genericmonster.o \
|
||||
$(DLL_OBJDIR)/ggrenade.o \
|
||||
$(DLL_OBJDIR)/globals.o \
|
||||
$(DLL_OBJDIR)/gman.o \
|
||||
$(DLL_OBJDIR)/h_ai.o \
|
||||
$(DLL_OBJDIR)/h_battery.o \
|
||||
$(DLL_OBJDIR)/h_cine.o \
|
||||
$(DLL_OBJDIR)/h_cycler.o \
|
||||
$(DLL_OBJDIR)/h_export.o \
|
||||
$(DLL_OBJDIR)/handgrenade.o \
|
||||
$(DLL_OBJDIR)/hassassin.o \
|
||||
$(DLL_OBJDIR)/headcrab.o \
|
||||
$(DLL_OBJDIR)/healthkit.o \
|
||||
$(DLL_OBJDIR)/hgrunt.o \
|
||||
$(DLL_OBJDIR)/hornet.o \
|
||||
$(DLL_OBJDIR)/hornetgun.o \
|
||||
$(DLL_OBJDIR)/houndeye.o \
|
||||
$(DLL_OBJDIR)/ichthyosaur.o \
|
||||
$(DLL_OBJDIR)/islave.o \
|
||||
$(DLL_OBJDIR)/items.o \
|
||||
$(DLL_OBJDIR)/leech.o \
|
||||
$(DLL_OBJDIR)/lights.o \
|
||||
$(DLL_OBJDIR)/maprules.o \
|
||||
$(DLL_OBJDIR)/monstermaker.o \
|
||||
$(DLL_OBJDIR)/monsters.o \
|
||||
$(DLL_OBJDIR)/monsterstate.o \
|
||||
$(DLL_OBJDIR)/mortar.o \
|
||||
$(DLL_OBJDIR)/mp5.o \
|
||||
$(DLL_OBJDIR)/multiplay_gamerules.o \
|
||||
$(DLL_OBJDIR)/nihilanth.o \
|
||||
$(DLL_OBJDIR)/nodes.o \
|
||||
$(DLL_OBJDIR)/observer.o \
|
||||
$(DLL_OBJDIR)/osprey.o \
|
||||
$(DLL_OBJDIR)/pathcorner.o \
|
||||
$(DLL_OBJDIR)/plane.o \
|
||||
$(DLL_OBJDIR)/plats.o \
|
||||
$(DLL_OBJDIR)/player.o \
|
||||
$(DLL_OBJDIR)/playermonster.o \
|
||||
$(DLL_OBJDIR)/python.o \
|
||||
$(DLL_OBJDIR)/rat.o \
|
||||
$(DLL_OBJDIR)/roach.o \
|
||||
$(DLL_OBJDIR)/rpg.o \
|
||||
$(DLL_OBJDIR)/satchel.o \
|
||||
$(DLL_OBJDIR)/schedule.o \
|
||||
$(DLL_OBJDIR)/scientist.o \
|
||||
$(DLL_OBJDIR)/scripted.o \
|
||||
$(DLL_OBJDIR)/shotgun.o \
|
||||
$(DLL_OBJDIR)/singleplay_gamerules.o \
|
||||
$(DLL_OBJDIR)/skill.o \
|
||||
$(DLL_OBJDIR)/sound.o \
|
||||
$(DLL_OBJDIR)/soundent.o \
|
||||
$(DLL_OBJDIR)/spectator.o \
|
||||
$(DLL_OBJDIR)/squadmonster.o \
|
||||
$(DLL_OBJDIR)/squeakgrenade.o \
|
||||
$(DLL_OBJDIR)/subs.o \
|
||||
$(DLL_OBJDIR)/talkmonster.o \
|
||||
$(DLL_OBJDIR)/teamplay_gamerules.o \
|
||||
$(DLL_OBJDIR)/tempmonster.o \
|
||||
$(DLL_OBJDIR)/tentacle.o \
|
||||
$(DLL_OBJDIR)/triggers.o \
|
||||
$(DLL_OBJDIR)/tripmine.o \
|
||||
$(DLL_OBJDIR)/turret.o \
|
||||
$(DLL_OBJDIR)/util.o \
|
||||
$(DLL_OBJDIR)/weapons.o \
|
||||
$(DLL_OBJDIR)/world.o \
|
||||
$(DLL_OBJDIR)/xen.o \
|
||||
$(DLL_OBJDIR)/zombie.o \
|
||||
$(DLL_OBJDIR)/glock.o \
|
||||
$(PM_SHARED_OBJDIR)/pm_debug.o \
|
||||
$(PM_SHARED_OBJDIR)/pm_math.o \
|
||||
$(PM_SHARED_OBJDIR)/pm_shared.o
|
||||
# $(GAME_SHARED_OBJDIR)/voice_gamemgr.o
|
||||
|
||||
$(DLLNAME)_$(ARCH).$(SHLIBEXT) : neat $(OBJ)
|
||||
$(CXX) $(CFLAGS) $(SHLIBLDFLAGS) $(LDFLAGS) -o $@ $(OBJ)
|
||||
|
||||
neat:
|
||||
-mkdir $(DLL_OBJDIR)
|
||||
-mkdir $(WPN_SHARED_OBJDIR)
|
||||
-mkdir $(GAME_SHARED_OBJDIR)
|
||||
-mkdir $(PM_SHARED_OBJDIR)
|
||||
clean:
|
||||
-rm -f $(OBJ)
|
||||
-rm -f $(DLLNAME)_$(ARCH).$(SHLIBEXT)
|
||||
spotless: clean
|
||||
-rm -r $(DLL_OBJDIR)
|
||||
-rm -r $(WPN_SHARED_OBJDIR)
|
||||
-rm -r $(GAME_SHARED_OBJDIR)
|
||||
-rm -r $(PM_SHARED_OBJDIR)
|
||||
|
|
@ -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, vecSpot);
|
||||
|
@ -211,7 +211,7 @@ void CFlockingFlyerFlock::SpawnFlock( void )
|
|||
pBoid->pev->angles = pev->angles;
|
||||
|
||||
pBoid->pev->frame = 0;
|
||||
pBoid->SetNextThink( 0.2 );
|
||||
pBoid->SetNextThink( 0.2f );
|
||||
pBoid->SetThink( &CFlockingFlyer::IdleThink );
|
||||
|
||||
if( pBoid != pLeader )
|
||||
|
@ -229,7 +229,7 @@ void CFlockingFlyer::Spawn()
|
|||
SpawnCommonCode();
|
||||
|
||||
pev->frame = 0;
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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 );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
void CFlockingFlyer::FallHack( void )
|
||||
|
@ -312,7 +312,7 @@ void CFlockingFlyer::FallHack( void )
|
|||
if( !FClassnameIs ( pev->groundentity, "worldspawn" ) )
|
||||
{
|
||||
pev->flags &= ~FL_ONGROUND;
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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 )
|
||||
{
|
||||
SetNextThink( 0.2 );
|
||||
SetNextThink( 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 );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ void CFlockingFlyer::IdleThink( void )
|
|||
//=========================================================
|
||||
void CFlockingFlyer::Start( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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 );
|
||||
|
@ -571,8 +571,7 @@ void CFlockingFlyer::FlockLeaderThink( void )
|
|||
float flLeftSide;
|
||||
float flRightSide;
|
||||
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
UTIL_MakeVectors( pev->angles );
|
||||
|
||||
|
@ -589,7 +588,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;
|
||||
|
||||
|
@ -645,8 +644,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 ) )
|
||||
|
@ -677,7 +676,7 @@ void CFlockingFlyer::FlockFollowerThink( void )
|
|||
Vector vecDirToLeader;
|
||||
float flDistToLeader;
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
if( IsLeader() || !InSquad() )
|
||||
{
|
||||
|
@ -700,19 +699,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();
|
||||
|
@ -724,13 +723,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 )
|
||||
|
@ -785,7 +784,7 @@ void CFlockingFlyer::FlockFollowerThink( void )
|
|||
// else slide left
|
||||
else
|
||||
{
|
||||
m_vecAdjustedVelocity = gpGlobals->v_right * -1;
|
||||
m_vecAdjustedVelocity = gpGlobals->v_right * -1.0f;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
167
dlls/agrunt.cpp
167
dlls/agrunt.cpp
|
@ -65,7 +65,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
|
||||
|
||||
//LRC - body definitions for the Agrunt model
|
||||
#define AGRUNT_BODY_HASGUN 0
|
||||
|
@ -82,8 +82,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 );
|
||||
|
@ -225,7 +225,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;
|
||||
}
|
||||
|
||||
|
@ -233,11 +233,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 );
|
||||
|
@ -251,9 +251,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
|
||||
{
|
||||
|
@ -269,7 +269,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 );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -291,7 +291,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;
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +318,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 )
|
||||
|
@ -328,7 +328,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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +341,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 );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -351,7 +351,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 );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -361,7 +361,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 );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -374,11 +374,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 );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -449,15 +449,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
|
||||
|
@ -469,8 +469,8 @@ 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;
|
||||
|
||||
CBaseMonster *pHornetMonster = pHornet->MyMonsterPointer();
|
||||
|
||||
|
@ -509,7 +509,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;
|
||||
|
@ -520,17 +520,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 );
|
||||
|
@ -539,7 +539,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;
|
||||
|
@ -549,17 +549,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 );
|
||||
|
@ -568,7 +568,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;
|
||||
|
@ -589,22 +589,23 @@ void CAGrunt::Spawn()
|
|||
SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
|
||||
else
|
||||
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 = DONT_BLEED;
|
||||
pev->effects = 0;
|
||||
|
||||
if (pev->health == 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();
|
||||
}
|
||||
|
@ -660,8 +661,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[] =
|
||||
|
@ -683,8 +684,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[] =
|
||||
|
@ -706,9 +707,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[] =
|
||||
|
@ -731,8 +732,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[] =
|
||||
|
@ -751,9 +752,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[] =
|
||||
|
@ -797,13 +798,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[] =
|
||||
|
@ -822,13 +823,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 },
|
||||
|
@ -860,8 +861,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 },
|
||||
};
|
||||
|
||||
|
@ -939,7 +940,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;
|
||||
|
@ -948,18 +949,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;
|
||||
}
|
||||
|
@ -974,7 +975,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();
|
||||
}
|
||||
|
@ -1004,20 +1005,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();
|
||||
}
|
||||
|
@ -1025,10 +1026,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();
|
||||
}
|
||||
|
@ -1036,10 +1037,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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -268,7 +268,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 );
|
||||
|
@ -280,8 +280,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++ )
|
||||
|
@ -314,8 +314,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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
|
|
290
dlls/apache.cpp
290
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 );
|
||||
|
@ -126,7 +126,7 @@ void CApache::Spawn( void )
|
|||
SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
|
||||
else
|
||||
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( this, pev->origin );
|
||||
|
||||
pev->flags |= FL_MONSTER;
|
||||
|
@ -134,7 +134,7 @@ void CApache::Spawn( void )
|
|||
if (pev->health == 0)
|
||||
pev->health = gSkillData.apacheHealth;
|
||||
|
||||
m_flFieldOfView = -0.707; // 270 degrees
|
||||
m_flFieldOfView = -0.707f; // 270 degrees
|
||||
|
||||
pev->sequence = 0;
|
||||
ResetSequenceInfo();
|
||||
|
@ -150,7 +150,7 @@ void CApache::Spawn( void )
|
|||
{
|
||||
SetThink( &CApache::HuntThink );
|
||||
SetTouch( &CApache::FlyTouch );
|
||||
SetNextThink( 1.0 );
|
||||
SetNextThink( 1.0f );
|
||||
}
|
||||
|
||||
m_iRockets = 10;
|
||||
|
@ -185,47 +185,47 @@ void CApache::Precache( void )
|
|||
void CApache::NullThink( void )
|
||||
{
|
||||
StudioFrameAdvance();
|
||||
SetNextThink( 0.5 );
|
||||
SetNextThink( 0.5f );
|
||||
}
|
||||
|
||||
void CApache::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
SetThink( &CApache::HuntThink );
|
||||
SetTouch( &CApache::FlyTouch );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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 );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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();
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
pev->avelocity = pev->avelocity * 1.02;
|
||||
pev->avelocity = pev->avelocity * 1.02f;
|
||||
|
||||
// still falling?
|
||||
if( m_flNextRocket > gpGlobals->time )
|
||||
|
@ -233,9 +233,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
|
||||
|
@ -245,15 +245,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 );
|
||||
|
||||
|
@ -290,19 +290,19 @@ void CApache::DyingThink( void )
|
|||
|
||||
// don't stop it we touch a entity
|
||||
pev->flags &= ~FL_ONGROUND;
|
||||
SetNextThink( 0.2 );
|
||||
SetNextThink( 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
|
||||
|
@ -314,7 +314,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
|
||||
|
@ -325,7 +325,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
|
||||
|
@ -353,7 +353,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 );
|
||||
|
||||
|
@ -361,22 +361,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 );
|
||||
|
@ -404,8 +404,8 @@ void CApache::DyingThink( void )
|
|||
WRITE_BYTE( BREAK_METAL );
|
||||
MESSAGE_END();
|
||||
|
||||
SetThink(&CApache :: SUB_Remove );
|
||||
SetNextThink( 0.1 );
|
||||
SetThink( &CApache::SUB_Remove );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,13 +434,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();
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
ShowDamage();
|
||||
|
||||
|
@ -462,15 +462,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();
|
||||
|
@ -489,7 +489,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 )
|
||||
|
@ -506,11 +506,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();
|
||||
}
|
||||
|
@ -527,47 +527,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();
|
||||
}
|
||||
}
|
||||
|
@ -575,9 +575,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();
|
||||
}
|
||||
}
|
||||
|
@ -587,34 +587,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 );
|
||||
|
@ -622,11 +622,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;
|
||||
|
||||
|
@ -636,62 +636,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 );
|
||||
|
@ -700,8 +700,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
|
||||
}
|
||||
|
@ -715,22 +715,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 );
|
||||
}
|
||||
|
@ -738,27 +738,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;
|
||||
|
@ -776,7 +776,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--;
|
||||
|
||||
|
@ -801,23 +801,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 );
|
||||
|
@ -826,11 +826,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;
|
||||
|
@ -847,7 +847,7 @@ BOOL CApache::FireGun()
|
|||
|
||||
if( flNext < gpGlobals->time )
|
||||
{
|
||||
flNext = gpGlobals->time + 0.5;
|
||||
flNext = gpGlobals->time + 0.5f;
|
||||
m_pBeam->SetStartPos( tr.vecEndPos );
|
||||
}
|
||||
#endif
|
||||
|
@ -889,14 +889,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;
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -917,13 +917,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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -968,9 +968,9 @@ void CApacheHVR::Spawn( void )
|
|||
|
||||
UTIL_MakeAimVectors( pev->angles );
|
||||
m_vecForward = gpGlobals->v_forward;
|
||||
pev->gravity = 0.5;
|
||||
pev->gravity = 0.5f;
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
pev->dmg = 150;
|
||||
}
|
||||
|
@ -979,7 +979,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 )
|
||||
|
@ -990,7 +990,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 );
|
||||
|
@ -1007,13 +1007,13 @@ void CApacheHVR::IgniteThink( void )
|
|||
|
||||
// set to accelerate
|
||||
SetThink( &CApacheHVR::AccelerateThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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;
|
||||
|
@ -1021,14 +1021,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 );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
@ -116,11 +116,11 @@ void CBarnacle::Spawn()
|
|||
{
|
||||
Precache();
|
||||
|
||||
if (pev->model)
|
||||
SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
|
||||
if( pev->model )
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) ); //LRC
|
||||
else
|
||||
SET_MODEL( ENT( pev ), "models/mouth_monster.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;
|
||||
|
@ -128,20 +128,20 @@ void CBarnacle::Spawn()
|
|||
m_bloodColor = DONT_BLEED;
|
||||
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 );
|
||||
SetNextThink( 0.5 );
|
||||
SetNextThink( 0.5f );
|
||||
|
||||
UTIL_SetOrigin ( this, pev->origin );
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void CBarnacle::BarnacleThink( void )
|
|||
UTIL_SetOrigin( pev, pev->origin );
|
||||
}
|
||||
#endif
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
if( m_hEnemy != 0 )
|
||||
{
|
||||
|
@ -200,8 +200,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;
|
||||
|
@ -215,7 +215,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 )
|
||||
{
|
||||
|
@ -231,7 +231,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 )
|
||||
|
@ -268,7 +268,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() ) ) )
|
||||
SetNextThink( RANDOM_FLOAT(1,1.5) ); // Stagger a bit to keep barnacles from thinking on the same frame
|
||||
SetNextThink( RANDOM_FLOAT( 1.0f, 1.5f ) ); // Stagger a bit to keep barnacles from thinking on the same frame
|
||||
|
||||
if( m_fSequenceFinished )
|
||||
{
|
||||
|
@ -307,7 +307,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;
|
||||
|
||||
|
@ -342,7 +342,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 );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -380,9 +380,9 @@ void CBarnacle::Killed( entvars_t *pevAttacker, int iGib )
|
|||
SetActivity( ACT_DIESIMPLE );
|
||||
SetBoneController( 0, 0 );
|
||||
|
||||
StudioFrameAdvance( 0.1 );
|
||||
StudioFrameAdvance( 0.1f );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
SetThink( &CBarnacle::WaitTillDead );
|
||||
}
|
||||
|
||||
|
@ -390,9 +390,9 @@ void CBarnacle::Killed( entvars_t *pevAttacker, int iGib )
|
|||
//=========================================================
|
||||
void CBarnacle::WaitTillDead( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
float flInterval = StudioFrameAdvance( 0.1 );
|
||||
float flInterval = StudioFrameAdvance( 0.1f );
|
||||
DispatchAnimEvents( flInterval );
|
||||
|
||||
if( m_fSequenceFinished )
|
||||
|
@ -427,21 +427,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;
|
||||
|
|
|
@ -268,16 +268,16 @@ void CBarney::AlertSound( void )
|
|||
{
|
||||
if( FOkToSpeak() )
|
||||
{
|
||||
if (m_iszSpeakAs)
|
||||
if( m_iszSpeakAs )
|
||||
{
|
||||
char szBuf[32];
|
||||
strcpy(szBuf,STRING(m_iszSpeakAs));
|
||||
strcat(szBuf,"_ATTACK");
|
||||
PlaySentence( szBuf, RANDOM_FLOAT(2.8, 3.2), VOL_NORM, ATTN_IDLE );
|
||||
strcpy( szBuf, STRING( m_iszSpeakAs ) );
|
||||
strcat( szBuf, "_ATTACK" );
|
||||
PlaySentence( szBuf, RANDOM_FLOAT( 2.8f, 3.2f ), VOL_NORM, ATTN_IDLE );
|
||||
}
|
||||
else
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,22 +316,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;
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ void CBarney::BarneyFirePistol( void )
|
|||
EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, "barney/ba_attack2.wav", 1, 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!
|
||||
|
@ -426,9 +426,9 @@ void CBarney::Spawn()
|
|||
pev->solid = SOLID_SLIDEBOX;
|
||||
pev->movetype = MOVETYPE_STEP;
|
||||
m_bloodColor = BLOOD_COLOR_RED;
|
||||
if (pev->health == 0) //LRC
|
||||
if( pev->health == 0 ) //LRC
|
||||
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;
|
||||
|
||||
|
@ -520,15 +520,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;
|
||||
}
|
||||
|
@ -616,18 +616,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;
|
||||
}
|
||||
}
|
||||
|
@ -640,10 +640,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() );
|
||||
|
@ -659,17 +659,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,8 +153,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 )
|
||||
|
@ -259,8 +259,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 );
|
||||
|
@ -279,8 +279,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
|
||||
|
@ -422,6 +422,7 @@ void CBigMomma::SetYawSpeed( void )
|
|||
break;
|
||||
default:
|
||||
ys = 90;
|
||||
break;
|
||||
}
|
||||
pev->yaw_speed = ys;
|
||||
}
|
||||
|
@ -444,9 +445,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 );
|
||||
|
@ -464,22 +465,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;
|
||||
|
@ -519,10 +520,10 @@ void CBigMomma::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
case BIG_AE_JUMP_FORWARD:
|
||||
ClearBits( pev->flags, FL_ONGROUND );
|
||||
|
||||
UTIL_SetOrigin (this, pev->origin + Vector ( 0 , 0 , 1) );// take her off ground so engine doesn't instantly reset onground
|
||||
UTIL_SetOrigin( this, pev->origin + Vector( 0.0f, 0.0f, 1.0f ) );// take her 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:
|
||||
{
|
||||
|
@ -545,11 +546,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 )
|
||||
{
|
||||
|
@ -564,7 +565,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 ) )
|
||||
{
|
||||
|
@ -588,20 +589,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++;
|
||||
}
|
||||
|
||||
|
@ -618,7 +619,7 @@ 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;
|
||||
|
@ -642,8 +643,8 @@ void CBigMomma::LaunchMortar( void )
|
|||
|
||||
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, RANDOM_SOUND_ARRAY( pSackSounds ), 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG( -5, 5 ) );
|
||||
CBMortar *pBomb = CBMortar::Shoot( edict(), startPos, vecLaunch );
|
||||
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 );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -653,19 +654,19 @@ void CBigMomma::Spawn()
|
|||
{
|
||||
Precache();
|
||||
|
||||
if (pev->model)
|
||||
SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
|
||||
if( pev->model )
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) ); //LRC
|
||||
else
|
||||
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;
|
||||
if (pev->health == 0)
|
||||
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();
|
||||
|
@ -762,7 +763,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;
|
||||
|
@ -786,8 +787,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;
|
||||
}
|
||||
|
@ -964,7 +965,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 ) );
|
||||
|
@ -1005,7 +1006,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;
|
||||
|
||||
|
||||
|
@ -1105,12 +1106,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;
|
||||
|
@ -1119,17 +1120,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;
|
||||
|
||||
|
@ -1170,26 +1171,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 )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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;
|
||||
}
|
||||
|
@ -1204,9 +1205,9 @@ CBMortar *CBMortar::Shoot( edict_t *pOwner, Vector vecStart, Vector vecVelocity
|
|||
UTIL_SetOrigin( pSpit, vecStart );
|
||||
pSpit->pev->velocity = vecVelocity;
|
||||
pSpit->pev->owner = pOwner;
|
||||
pSpit->pev->scale = 2.5;
|
||||
pSpit->pev->scale = 2.5f;
|
||||
pSpit->SetThink( &CBMortar::Animate );
|
||||
pSpit->SetNextThink( 0.1 );
|
||||
pSpit->SetNextThink( 0.1f );
|
||||
|
||||
return pSpit;
|
||||
}
|
||||
|
@ -1235,13 +1236,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
|
||||
|
|
104
dlls/bmodels.cpp
104
dlls/bmodels.cpp
|
@ -43,8 +43,8 @@ extern DLL_GLOBAL Vector g_vecAttackDir;
|
|||
//
|
||||
Vector VecBModelOrigin( entvars_t* pevBModel )
|
||||
{
|
||||
return (pevBModel->absmin + pevBModel->absmax) * 0.5; //LRC - bug fix for rotating ents
|
||||
// return pevBModel->absmin + ( pevBModel->size * 0.5 );
|
||||
return ( pevBModel->absmin + pevBModel->absmax ) * 0.5f; //LRC - bug fix for rotating ents
|
||||
// return pevBModel->absmin + ( pevBModel->size * 0.5f );
|
||||
}
|
||||
|
||||
// =================== FUNC_WALL ==============================================
|
||||
|
@ -230,8 +230,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 );
|
||||
}
|
||||
|
@ -240,7 +240,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;
|
||||
|
@ -442,17 +442,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" ) )
|
||||
|
@ -500,8 +500,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;
|
||||
|
@ -520,24 +520,24 @@ void CFuncRotating::Spawn()
|
|||
}
|
||||
|
||||
// prevent divide by zero if level designer forgets friction!
|
||||
if ( m_flFanFriction <= 0 ) //LRC - ensure it's not negative
|
||||
if( m_flFanFriction <= 0.0f ) //LRC - ensure it's not negative
|
||||
{
|
||||
m_flFanFriction = 1;
|
||||
m_flFanFriction = 1.0f;
|
||||
}
|
||||
|
||||
if (pev->movedir == g_vecZero)
|
||||
{
|
||||
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 ) )
|
||||
|
@ -557,8 +557,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 )
|
||||
|
@ -566,10 +566,10 @@ void CFuncRotating::Spawn()
|
|||
|
||||
// instant-use brush?
|
||||
//LRC - start immediately if unnamed, too.
|
||||
if ( FBitSet( pev->spawnflags, SF_BRUSH_ROTATE_INSTANT) || FStringNull(pev->targetname) )
|
||||
if( FBitSet( pev->spawnflags, SF_BRUSH_ROTATE_INSTANT ) || FStringNull( pev->targetname ) )
|
||||
{
|
||||
SetThink(&CFuncRotating :: WaitForStart );
|
||||
SetNextThink( 1.5 ); // leave a magic delay for client to start up
|
||||
SetThink( &CFuncRotating::WaitForStart );
|
||||
SetNextThink( 1.5f ); // leave a magic delay for client to start up
|
||||
}
|
||||
// can this brush inflict pain?
|
||||
if( FBitSet( pev->spawnflags, SF_BRUSH_HURT ) )
|
||||
|
@ -586,7 +586,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
|
||||
}
|
||||
|
@ -628,20 +628,20 @@ void CFuncRotating::Precache( void )
|
|||
// make sure we restart the sound. 1.5 sec delay is magic number. KDB
|
||||
|
||||
SetThink( &CFuncRotating::SpinUp );
|
||||
SetNextThink( 1.5 );
|
||||
SetNextThink( 1.5f );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CFuncRotating :: WaitForStart()
|
||||
void CFuncRotating::WaitForStart()
|
||||
{
|
||||
if (gpGlobals->time > 1) // has the client started yet?
|
||||
if( gpGlobals->time > 1 ) // has the client started yet?
|
||||
{
|
||||
SUB_CallUseToggle();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ void CFuncRotating::SpinUp( void )
|
|||
{
|
||||
//Vector vecAVel;//rotational velocity
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
m_fCurSpeed = m_fCurSpeed + ( pev->speed * m_flFanFriction );
|
||||
UTIL_SetAvelocity(this, pev->movedir * m_fCurSpeed);
|
||||
//pev->avelocity = pev->avelocity + ( pev->movedir * ( pev->speed * m_flFanFriction ) );
|
||||
|
@ -731,7 +731,7 @@ void CFuncRotating::SpinUp( void )
|
|||
//
|
||||
void CFuncRotating::SpinDown( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
m_fCurSpeed = m_fCurSpeed - ( pev->speed * m_flFanFriction );
|
||||
UTIL_SetAvelocity(this, pev->movedir * m_fCurSpeed);
|
||||
|
@ -760,7 +760,7 @@ void CFuncRotating::SpinDown( void )
|
|||
|
||||
void CFuncRotating::Rotate( void )
|
||||
{
|
||||
SetNextThink( 10 );
|
||||
SetNextThink( 10.0f );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -782,16 +782,16 @@ void CFuncRotating::RotatingUse( CBaseEntity *pActivator, CBaseEntity *pCaller,
|
|||
//EMIT_SOUND_DYN( ENT( pev ), CHAN_WEAPON, STRING( pev->noiseStop ),
|
||||
// m_flVolume, m_flAttenuation, 0, m_pitch );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
else// fan is not moving, so start it
|
||||
{
|
||||
m_iState = STATE_TURN_ON;
|
||||
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 );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
}
|
||||
else // if ( !FBitSet ( pev->spawnflags, SF_BRUSH_ACCDCC ) )//this is a normal start/stop brush.
|
||||
|
@ -806,7 +806,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 );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
// pev->avelocity = g_vecZero;
|
||||
}
|
||||
else
|
||||
|
@ -892,7 +892,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
|
||||
|
@ -915,18 +915,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(&CPendulum :: SUB_CallUseToggle );
|
||||
SetNextThink( 0.1 );
|
||||
SetThink( &CPendulum::SUB_CallUseToggle );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
pev->speed = 0;
|
||||
SetUse( &CPendulum::PendulumUse );
|
||||
|
@ -956,7 +956,7 @@ void CPendulum::PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
|
|||
}
|
||||
else
|
||||
{
|
||||
pev->speed = 0; // Dead stop
|
||||
pev->speed = 0.0f; // Dead stop
|
||||
DontThink();
|
||||
UTIL_SetAvelocity(this, g_vecZero); //LRC
|
||||
//pev->avelocity = g_vecZero;
|
||||
|
@ -964,8 +964,8 @@ void CPendulum::PendulumUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
|
|||
}
|
||||
else
|
||||
{
|
||||
SetNextThink(0.1); // start the pendulum moving
|
||||
SetThink(&CPendulum ::SwingThink);
|
||||
SetNextThink( 0.1f ); // start the pendulum moving
|
||||
SetThink( &CPendulum ::SwingThink );
|
||||
m_time = gpGlobals->time; // Save time to calculate dt
|
||||
m_dampSpeed = m_maxSpeed;
|
||||
}
|
||||
|
@ -975,7 +975,7 @@ void CPendulum :: StopThink( void )
|
|||
{
|
||||
UTIL_SetAngles(this, m_start); //LRC
|
||||
//pev->angles = m_start;
|
||||
pev->speed = 0;
|
||||
pev->speed = 0.0f;
|
||||
DontThink();
|
||||
UTIL_SetAvelocity(this, g_vecZero); //LRC
|
||||
//pev->avelocity = g_vecZero;
|
||||
|
@ -994,7 +994,7 @@ void CPendulum :: SwingThink( 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;
|
||||
|
@ -1011,8 +1011,8 @@ void CPendulum :: SwingThink( void )
|
|||
// ALERT(at_console, "SwingThink: delta %f, dt %f, speed %f, avel %f %f %f\n", delta, dt, pev->speed, pev->avelocity.x, pev->avelocity.y, pev->avelocity.z);
|
||||
|
||||
// Call this again
|
||||
SetNextThink(0.1);
|
||||
SetThink(&CPendulum ::SwingThink);
|
||||
SetNextThink( 0.1f );
|
||||
SetThink( &CPendulum::SwingThink );
|
||||
|
||||
// if (m_pMoveWith) // correct MoveWith problems associated with fast-thinking entities
|
||||
// UTIL_AssignOrigin(this, m_vecMoveWithOffset + m_pMoveWith->pev->origin);
|
||||
|
@ -1020,7 +1020,7 @@ void CPendulum :: SwingThink( void )
|
|||
if( m_damp )
|
||||
{
|
||||
m_dampSpeed -= m_damp * m_dampSpeed * dt;
|
||||
if( m_dampSpeed < 30.0 )
|
||||
if( m_dampSpeed < 30.0f )
|
||||
{
|
||||
UTIL_SetAngles(this, m_center); //LRC
|
||||
//pev->angles = m_center;
|
||||
|
@ -1049,7 +1049,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;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "scripted.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;
|
||||
|
||||
|
@ -92,7 +92,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 ) );
|
||||
|
||||
|
@ -101,7 +101,7 @@ void CSquidSpit::Spawn( void )
|
|||
|
||||
void CSquidSpit::Animate( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
if( pev->frame++ )
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ void CSquidSpit::Shoot( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity
|
|||
pSpit->pev->owner = ENT( pevOwner );
|
||||
|
||||
pSpit->SetThink( &CSquidSpit::Animate );
|
||||
pSpit->SetNextThink( 0.1 );
|
||||
pSpit->SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
void CSquidSpit::Touch( CBaseEntity *pOther )
|
||||
|
@ -131,7 +131,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 );
|
||||
|
||||
|
@ -243,7 +243,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.
|
||||
// Er, more like, we HAVE been hurt in the last 20 seconds, so DON'T let it care about food. --LRC
|
||||
|
@ -269,7 +269,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.
|
||||
|
@ -290,7 +290,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();
|
||||
|
||||
|
@ -298,7 +298,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 );
|
||||
}
|
||||
|
@ -319,17 +319,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;
|
||||
|
@ -339,12 +339,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;
|
||||
|
@ -359,7 +359,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;
|
||||
}
|
||||
|
@ -374,7 +374,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;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ void CBullsquid::SetYawSpeed( void )
|
|||
|
||||
ys = 0;
|
||||
|
||||
switch ( m_Activity )
|
||||
switch( m_Activity )
|
||||
{
|
||||
case ACT_WALK:
|
||||
ys = 90;
|
||||
|
@ -546,7 +546,7 @@ 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 );
|
||||
if (m_pCine) // LRC- are we being told to do this by a scripted_action?
|
||||
{
|
||||
|
@ -558,9 +558,9 @@ void CBullsquid::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
else
|
||||
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();
|
||||
|
@ -580,7 +580,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:
|
||||
|
@ -590,10 +590,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;
|
||||
|
@ -603,10 +603,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;
|
||||
|
@ -627,8 +627,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:
|
||||
|
@ -641,14 +641,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;
|
||||
}
|
||||
|
||||
|
@ -657,12 +657,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -679,11 +679,11 @@ void CBullsquid::Spawn()
|
|||
{
|
||||
Precache();
|
||||
|
||||
if (pev->model)
|
||||
SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
|
||||
if( pev->model )
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) ); //LRC
|
||||
else
|
||||
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;
|
||||
|
@ -691,7 +691,7 @@ void CBullsquid::Spawn()
|
|||
pev->effects = 0;
|
||||
if (pev->health == 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;
|
||||
|
@ -807,7 +807,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -820,8 +820,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 },
|
||||
};
|
||||
|
||||
|
@ -844,9 +844,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[] =
|
||||
|
@ -870,10 +870,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[] =
|
||||
|
@ -889,10 +889,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[] =
|
||||
|
@ -910,20 +910,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[] =
|
||||
|
@ -946,21 +946,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[] =
|
||||
|
@ -982,18 +982,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[] =
|
||||
|
|
|
@ -370,7 +370,7 @@ void CMultiSource::Spawn()
|
|||
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
pev->spawnflags |= SF_MULTI_INIT; // Until it's initialized
|
||||
SetThink( &CMultiSource::Register );
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ void CBaseButton::Spawn()
|
|||
if( FBitSet( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF ) )// this button should spark in OFF state
|
||||
{
|
||||
SetThink( &CBaseButton::ButtonSpark );
|
||||
SetNextThink( 0.5 );// no hurry, make sure everything else spawns
|
||||
SetNextThink( 0.5f );// no hurry, make sure everything else spawns
|
||||
}
|
||||
|
||||
SetMovedir( pev );
|
||||
|
@ -773,33 +773,34 @@ void CBaseButton::Spawn()
|
|||
}
|
||||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
|
||||
|
||||
//LRC
|
||||
if (m_iStyle >= 32) LIGHT_STYLE(m_iStyle, "z");
|
||||
else if (m_iStyle <= -32) LIGHT_STYLE(-m_iStyle, "a");
|
||||
|
||||
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
|
||||
|
@ -921,11 +922,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 );
|
||||
|
@ -951,7 +952,7 @@ void DoSpark( entvars_t *pev, const Vector &location )
|
|||
void CBaseButton::ButtonSpark( void )
|
||||
{
|
||||
SetThink( &CBaseButton::ButtonSpark );
|
||||
SetNextThink( 0.1 + RANDOM_FLOAT ( 0, 1.5 ) );// spark again at random interval
|
||||
SetNextThink( 0.1f + RANDOM_FLOAT( 0.0f, 1.5f ) );// spark again at random interval
|
||||
|
||||
DoSpark( pev, pev->mins );
|
||||
}
|
||||
|
@ -971,7 +972,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();
|
||||
|
@ -1015,7 +1016,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;
|
||||
|
@ -1205,7 +1206,7 @@ void CBaseButton::ButtonBackHome( void )
|
|||
if( FBitSet( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF ) )
|
||||
{
|
||||
SetThink( &CBaseButton::ButtonSpark );
|
||||
SetNextThink( 0.5 );// no hurry.
|
||||
SetNextThink( 0.5f );// no hurry.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1253,7 +1254,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;
|
||||
|
||||
|
@ -1264,8 +1265,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;
|
||||
|
@ -1280,7 +1281,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
|
||||
|
@ -1363,10 +1364,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;
|
||||
|
@ -1478,16 +1479,16 @@ void CMomentaryRotButton::UpdateSelf( float value )
|
|||
}
|
||||
m_lastUsed = 1;
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
//LRC check if we're outside the boundaries
|
||||
if( m_direction > 0 && value >= 1.0 )
|
||||
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;
|
||||
|
@ -1501,11 +1502,11 @@ void CMomentaryRotButton::UpdateSelf( float value )
|
|||
// bump nexthink on each one to avoid stalling
|
||||
//LRC- that is to say: our avelocity will get us to the target point in 0.1 secs.
|
||||
// If we're being told to move further than that, wait that much longer.
|
||||
if ( m_fNextThink < pev->ltime )
|
||||
SetNextThink( 0.1 );
|
||||
if( m_fNextThink < pev->ltime )
|
||||
SetNextThink( 0.1f );
|
||||
else
|
||||
{
|
||||
AbsoluteNextThink( m_fNextThink + 0.1 );
|
||||
AbsoluteNextThink( m_fNextThink + 0.1f );
|
||||
}
|
||||
|
||||
pev->avelocity = m_direction * pev->speed * pev->movedir;
|
||||
|
@ -1534,7 +1535,7 @@ void CMomentaryRotButton::Off( void )
|
|||
if( FBitSet( pev->spawnflags, SF_PENDULUM_AUTO_RETURN ) && m_returnSpeed > 0 )
|
||||
{
|
||||
SetThink( &CMomentaryRotButton::Return );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
m_direction = -1;
|
||||
}
|
||||
else
|
||||
|
@ -1546,13 +1547,13 @@ 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;
|
||||
|
@ -1562,7 +1563,7 @@ void CMomentaryRotButton::UpdateSelfReturn( float value )
|
|||
else
|
||||
{
|
||||
pev->avelocity = -m_returnSpeed * pev->movedir;
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1624,12 +1625,12 @@ void CEnvSpark::Spawn( void )
|
|||
else
|
||||
SetThink( &CEnvSpark::SparkThink );
|
||||
|
||||
if (this->m_pfnThink)
|
||||
if( this->m_pfnThink )
|
||||
{
|
||||
SetNextThink( 0.1 + RANDOM_FLOAT ( 0, 1.5 ) );
|
||||
SetNextThink( 0.1f + RANDOM_FLOAT( 0.0f, 1.5f ) );
|
||||
|
||||
if( m_flDelay <= 0 )
|
||||
m_flDelay = 1.5;
|
||||
m_flDelay = 1.5f;
|
||||
}
|
||||
|
||||
Precache();
|
||||
|
@ -1691,7 +1692,7 @@ void EXPORT CEnvSpark::SparkThink( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
SetNextThink( 0.1 + RANDOM_FLOAT (0, m_flDelay) );
|
||||
SetNextThink( 0.1f + RANDOM_FLOAT (0, m_flDelay) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1700,7 +1701,7 @@ void EXPORT CEnvSpark::SparkStart( CBaseEntity *pActivator, CBaseEntity *pCaller
|
|||
SetUse( &CEnvSpark::SparkStop );
|
||||
SetThink( &CEnvSpark::SparkThink );
|
||||
m_iState = STATE_ON; //LRC
|
||||
SetNextThink( 0.1 + RANDOM_FLOAT ( 0, m_flDelay) );
|
||||
SetNextThink( 0.1f + RANDOM_FLOAT ( 0, m_flDelay) );
|
||||
}
|
||||
|
||||
void EXPORT CEnvSpark::SparkStop( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
|
@ -1739,7 +1740,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
|
||||
|
|
|
@ -138,8 +138,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->InitMoveWith(); //LRC
|
||||
pEntity->Spawn();
|
||||
|
@ -726,13 +726,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;
|
||||
}
|
||||
|
||||
|
@ -906,30 +906,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;
|
||||
|
|
|
@ -477,6 +477,7 @@ inline BOOL FNullEnt( CBaseEntity *ent ) { return ent == NULL || FNullEnt( ent->
|
|||
#define SetTouch( a ) TouchSet( static_cast <void (CBaseEntity::*)(CBaseEntity *)> (a), #a )
|
||||
#define SetUse( a ) UseSet( static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (a), #a )
|
||||
#define SetBlocked( a ) BlockedSet( static_cast <void (CBaseEntity::*)(CBaseEntity *)> (a), #a )
|
||||
#define ResetThink() SetThink(NULL)
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
@ -76,7 +76,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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,7 +173,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;
|
||||
|
@ -199,6 +199,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();
|
||||
|
@ -500,7 +501,7 @@ void ClientCommand( edict_t *pEntity )
|
|||
}
|
||||
else
|
||||
{
|
||||
ALERT(at_console, "Syntax: hud_color RRR GGG BBB\n");
|
||||
ALERT( at_console, "Syntax: hud_color RRR GGG BBB\n" );
|
||||
}
|
||||
}
|
||||
else if ( FStrEq(pcmd, "fire") ) //LRC - trigger entities manually
|
||||
|
@ -1241,7 +1242,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) );
|
||||
|
@ -1700,12 +1701,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;
|
||||
|
@ -1961,7 +1962,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
|
||||
|
|
226
dlls/combat.cpp
226
dlls/combat.cpp
|
@ -49,8 +49,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
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,9 +73,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 ) );
|
||||
|
@ -84,32 +84,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;
|
||||
|
@ -131,7 +131,7 @@ void CGib::SpawnHeadGib( entvars_t *pevVictim )
|
|||
}
|
||||
|
||||
void CGib :: SpawnHeadGib( entvars_t *pevVictim, const char* szGibModel )
|
||||
{
|
||||
{
|
||||
CGib *pGib = GetClassPtr( (CGib *)NULL );
|
||||
|
||||
pGib->Spawn( szGibModel );// throw one head
|
||||
|
@ -149,31 +149,31 @@ void CGib :: SpawnHeadGib( entvars_t *pevVictim, const char* szGibModel )
|
|||
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();
|
||||
|
@ -221,37 +221,37 @@ void CGib :: SpawnRandomGibs( entvars_t *pevVictim, int cGibs, int notfirst, con
|
|||
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;
|
||||
|
@ -411,7 +411,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 )
|
||||
{
|
||||
|
@ -425,11 +425,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;
|
||||
}
|
||||
|
@ -438,11 +438,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;
|
||||
}
|
||||
|
@ -461,11 +461,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;
|
||||
}
|
||||
|
@ -481,9 +481,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;
|
||||
}
|
||||
|
@ -492,9 +492,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;
|
||||
}
|
||||
|
@ -515,7 +515,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 )
|
||||
{
|
||||
|
@ -566,9 +566,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 )
|
||||
|
@ -585,12 +585,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;
|
||||
}
|
||||
|
||||
|
@ -690,7 +690,7 @@ void CBaseEntity::SUB_StartFadeOut( void )
|
|||
pev->solid = SOLID_NOT;
|
||||
pev->avelocity = g_vecZero;
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
SetThink( &CBaseEntity::SUB_FadeOut );
|
||||
}
|
||||
|
||||
|
@ -699,12 +699,12 @@ void CBaseEntity::SUB_FadeOut( void )
|
|||
if( pev->renderamt > 7 )
|
||||
{
|
||||
pev->renderamt -= 7;
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
else
|
||||
{
|
||||
pev->renderamt = 0;
|
||||
SetNextThink( 0.2 );
|
||||
SetNextThink( 0.2f );
|
||||
SetThink( &CBaseEntity::SUB_Remove );
|
||||
}
|
||||
}
|
||||
|
@ -738,7 +738,7 @@ void CGib::WaitTillLand( void )
|
|||
else
|
||||
{
|
||||
// wait and check again in another half second.
|
||||
SetNextThink( 0.5 );
|
||||
SetNextThink( 0.5f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -755,18 +755,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 );
|
||||
|
||||
|
@ -778,7 +778,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 );
|
||||
}
|
||||
|
@ -793,7 +793,7 @@ void CGib::StickyGibTouch( CBaseEntity *pOther )
|
|||
Vector vecSpot;
|
||||
TraceResult tr;
|
||||
|
||||
SetThink(&CGib :: SUB_Remove );
|
||||
SetThink( &CGib::SUB_Remove );
|
||||
SetNextThink( 10 );
|
||||
|
||||
if( !FClassnameIs( pOther->pev, "worldspawn" ) )
|
||||
|
@ -802,11 +802,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;
|
||||
|
@ -819,7 +819,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!
|
||||
|
@ -833,7 +833,7 @@ void CGib::Spawn( const char *szGibModel )
|
|||
SET_MODEL( ENT( pev ), szGibModel );
|
||||
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
|
||||
|
||||
SetNextThink( 4 );
|
||||
SetNextThink( 4.0f );
|
||||
m_lifeTime = 25;
|
||||
SetThink( &CGib::WaitTillLand );
|
||||
SetTouch( &CGib::BounceGibTouch );
|
||||
|
@ -1000,7 +1000,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 );
|
||||
|
@ -1008,12 +1008,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 );
|
||||
}
|
||||
|
@ -1038,7 +1038,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();
|
||||
}
|
||||
}
|
||||
|
@ -1046,7 +1046,7 @@ int CBaseMonster::DeadTakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacke
|
|||
#if 0// turn this back on when the bounding box issues are resolved.
|
||||
|
||||
pev->flags &= ~FL_ONGROUND;
|
||||
pev->origin.z += 1;
|
||||
pev->origin.z += 1.0f;
|
||||
|
||||
// let the damage scoot the corpse around a bit.
|
||||
if( !FNullEnt( pevInflictor ) && ( pevAttacker->solid != SOLID_TRIGGER ) )
|
||||
|
@ -1064,7 +1064,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;
|
||||
|
@ -1072,11 +1072,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;
|
||||
|
@ -1096,11 +1096,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;
|
||||
|
@ -1127,27 +1127,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 );
|
||||
|
@ -1164,12 +1164,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 );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -1190,7 +1190,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 );
|
||||
|
@ -1292,7 +1292,7 @@ BOOL CBaseEntity::FVisible( CBaseEntity *pEntity )
|
|||
|
||||
UTIL_TraceLine( vecLookerOrigin, vecTargetOrigin, ignore_monsters, ignore_glass, ENT( pev )/*pentIgnore*/, &tr );
|
||||
|
||||
if (tr.flFraction != 1.0 && tr.pHit != ENT(pEntity->pev)) //LRC - added so that monsters can "see" some bsp objects
|
||||
if( tr.flFraction != 1.0f && tr.pHit != ENT( pEntity->pev ) ) //LRC - added so that monsters can "see" some bsp objects
|
||||
{
|
||||
return FALSE;// Line of sight is not established
|
||||
}
|
||||
|
@ -1315,7 +1315,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
|
||||
}
|
||||
|
@ -1332,7 +1332,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 )
|
||||
{
|
||||
|
@ -1354,7 +1354,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 );
|
||||
|
||||
|
@ -1442,8 +1442,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);
|
||||
|
||||
|
@ -1463,7 +1463,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
|
||||
{
|
||||
|
@ -1491,7 +1491,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 );
|
||||
|
||||
|
@ -1548,7 +1548,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 );
|
||||
}
|
||||
|
@ -1583,8 +1583,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 +
|
||||
|
@ -1596,7 +1596,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 );
|
||||
|
||||
|
@ -1636,7 +1636,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 );
|
||||
|
||||
|
@ -1676,33 +1676,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() );
|
||||
}
|
||||
|
@ -1740,7 +1740,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 );
|
||||
|
@ -1755,7 +1755,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() );
|
||||
}
|
||||
|
|
|
@ -191,9 +191,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
|
||||
|
@ -282,9 +282,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:
|
||||
|
@ -309,7 +309,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 );
|
||||
if (m_pCine)
|
||||
{
|
||||
pBall->m_hEnemy = m_hTargetEnt;
|
||||
|
@ -327,23 +327,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:
|
||||
|
@ -371,7 +371,7 @@ void CController::Spawn()
|
|||
m_bloodColor = DONT_BLEED;
|
||||
if (pev->health == 0)
|
||||
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;
|
||||
|
||||
|
@ -424,8 +424,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[] =
|
||||
|
@ -442,10 +442,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[] =
|
||||
|
@ -461,10 +461,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[] =
|
||||
|
@ -519,7 +519,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();
|
||||
}
|
||||
|
@ -541,7 +541,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();
|
||||
}
|
||||
|
@ -574,8 +574,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;
|
||||
|
||||
|
@ -587,10 +587,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;
|
||||
|
@ -598,7 +598,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" );
|
||||
}
|
||||
|
@ -665,23 +665,23 @@ 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 )
|
||||
|
@ -756,7 +756,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 ) )
|
||||
|
@ -808,7 +808,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;
|
||||
}
|
||||
|
@ -817,7 +817,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;
|
||||
}
|
||||
|
@ -836,10 +836,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;
|
||||
}
|
||||
}
|
||||
|
@ -862,14 +862,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;
|
||||
|
||||
|
@ -943,9 +943,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;
|
||||
}
|
||||
|
@ -997,7 +997,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 )
|
||||
|
@ -1023,7 +1024,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
|
||||
{
|
||||
|
@ -1061,10 +1062,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 );
|
||||
|
@ -1072,19 +1073,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;
|
||||
}
|
||||
|
@ -1107,7 +1108,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;
|
||||
|
@ -1127,7 +1128,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 );
|
||||
}
|
||||
|
@ -1165,7 +1166,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( this, pev->origin );
|
||||
|
@ -1175,7 +1176,7 @@ void CControllerHeadBall::Spawn( void )
|
|||
|
||||
m_vecIdeal = Vector( 0, 0, 0 );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
m_hOwner = Instance( pev->owner );
|
||||
pev->dmgtime = gpGlobals->time;
|
||||
|
@ -1190,7 +1191,7 @@ void CControllerHeadBall::Precache( void )
|
|||
|
||||
void CControllerHeadBall::HuntThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
pev->renderamt -= 5;
|
||||
|
||||
|
@ -1251,12 +1252,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 );
|
||||
SetNextThink( 0.3 );
|
||||
SetNextThink( 0.3f );
|
||||
}
|
||||
|
||||
//Crawl();
|
||||
|
@ -1271,31 +1272,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
|
||||
|
@ -1318,7 +1319,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();
|
||||
}
|
||||
|
@ -1348,7 +1349,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( this, pev->origin );
|
||||
|
@ -1358,7 +1359,7 @@ void CControllerZapBall::Spawn( void )
|
|||
|
||||
m_hOwner = Instance( pev->owner );
|
||||
pev->dmgtime = gpGlobals->time; // keep track of when ball spawned
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
void CControllerZapBall::Precache( void )
|
||||
|
@ -1370,11 +1371,11 @@ void CControllerZapBall::Precache( void )
|
|||
|
||||
void CControllerZapBall::AnimateThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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 );
|
||||
|
@ -1399,10 +1400,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 );
|
||||
|
|
|
@ -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 );
|
||||
SetNextThink( 0.2 );
|
||||
SetNextThink( 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(&CCrossbowBolt:: SUB_Remove );
|
||||
SetNextThink( 0 );// 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( this, pev->origin - vecDir * 12 );
|
||||
UTIL_SetOrigin( this, 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 );
|
||||
SetNextThink( 10.0 );
|
||||
SetNextThink( 10.0f );
|
||||
}
|
||||
else if( pOther->pev->movetype == MOVETYPE_PUSH || pOther->pev->movetype == MOVETYPE_PUSHSTEP )
|
||||
{
|
||||
Vector vecDir = pev->velocity.Normalize();
|
||||
UTIL_SetOrigin( this, pev->origin - vecDir * 12 );
|
||||
UTIL_SetOrigin( this, 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 );
|
||||
SetNextThink( 10.0 );
|
||||
SetNextThink( 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 );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
}
|
||||
|
||||
void CCrossbowBolt::BubbleThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
if (pev->waterlevel == 0 || pev->watertype <= CONTENT_FLYFIELD)
|
||||
return;
|
||||
|
||||
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1, pev->origin, 1 );
|
||||
UTIL_BubbleTrail( pev->origin - pev->velocity * 0.1f, pev->origin, 1 );
|
||||
}
|
||||
|
||||
void CCrossbowBolt::ExplodeThink( void )
|
||||
|
@ -328,7 +328,7 @@ void CCrossbow::Holster( int skiplocal /* = 0 */ )
|
|||
SecondaryAttack();
|
||||
}
|
||||
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
|
||||
if( m_iClip )
|
||||
SendWeaponAnim( CROSSBOW_HOLSTER1 );
|
||||
else
|
||||
|
@ -353,7 +353,7 @@ void CCrossbow::PrimaryAttack( void )
|
|||
// this function only gets called in multiplayer
|
||||
void CCrossbow::FireSniperBolt()
|
||||
{
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 );
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75f );
|
||||
|
||||
if( m_iClip == 0 )
|
||||
{
|
||||
|
@ -373,14 +373,14 @@ void CCrossbow::FireSniperBolt()
|
|||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow2, 0.0, g_vecZero, g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow2, 0.0f, g_vecZero, g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
Vector anglesAim = m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle;
|
||||
UTIL_MakeVectors( anglesAim );
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2;
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2.0f;
|
||||
Vector vecDir = gpGlobals->v_forward;
|
||||
|
||||
UTIL_TraceLine( vecSrc, vecSrc + vecDir * 8192, dont_ignore_monsters, m_pPlayer->edict(), &tr );
|
||||
|
@ -416,7 +416,7 @@ void CCrossbow::FireBolt()
|
|||
flags = 0;
|
||||
#endif
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow, 0.0, g_vecZero, g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usCrossbow, 0.0f, g_vecZero, g_vecZero, 0, 0, m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType], 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
@ -427,7 +427,7 @@ void CCrossbow::FireBolt()
|
|||
anglesAim.x = -anglesAim.x;
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2;
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition() - gpGlobals->v_up * 2.0f;
|
||||
Vector vecDir = gpGlobals->v_forward;
|
||||
|
||||
CCrossbowBolt *pBolt = CCrossbowBolt::BoltCreate();
|
||||
|
@ -445,21 +445,21 @@ void CCrossbow::FireBolt()
|
|||
pBolt->pev->velocity = vecDir * BOLT_AIR_VELOCITY;
|
||||
pBolt->pev->speed = BOLT_AIR_VELOCITY;
|
||||
}
|
||||
pBolt->pev->avelocity.z = 10;
|
||||
pBolt->pev->avelocity.z = 10.0f;
|
||||
#endif
|
||||
|
||||
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
||||
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75 );
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.75f );
|
||||
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75;
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.75f;
|
||||
|
||||
if( m_iClip != 0 )
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 5.0f;
|
||||
else
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.75f;
|
||||
}
|
||||
|
||||
void CCrossbow::SecondaryAttack()
|
||||
|
@ -475,8 +475,8 @@ void CCrossbow::SecondaryAttack()
|
|||
m_fInZoom = 1;
|
||||
}
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
|
||||
SetNextThink( 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 );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -182,15 +182,15 @@ int CCrowbar::Swing( int fFirst )
|
|||
|
||||
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
|
||||
Vector vecSrc = m_pPlayer->GetGunPosition();
|
||||
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32;
|
||||
Vector vecEnd = vecSrc + gpGlobals->v_forward * 32.0f;
|
||||
|
||||
UTIL_TraceLine( vecSrc, vecEnd, dont_ignore_monsters, ENT( m_pPlayer->pev ), &tr );
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
if( tr.flFraction >= 1.0 )
|
||||
if( tr.flFraction >= 1.0f )
|
||||
{
|
||||
UTIL_TraceHull( vecSrc, vecEnd, dont_ignore_monsters, head_hull, ENT( m_pPlayer->pev ), &tr );
|
||||
if( tr.flFraction < 1.0 )
|
||||
if( tr.flFraction < 1.0f )
|
||||
{
|
||||
// Calculate the point of intersection of the line (or hull) and the object we hit
|
||||
// This is and approximation of the "best" intersection
|
||||
|
@ -204,11 +204,11 @@ int CCrowbar::Swing( int fFirst )
|
|||
if( fFirst )
|
||||
{
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usCrowbar,
|
||||
0.0, g_vecZero, g_vecZero, 0, 0, 0,
|
||||
0.0f, g_vecZero, g_vecZero, 0, 0, 0,
|
||||
0, 0, 0 );
|
||||
}
|
||||
|
||||
if( tr.flFraction >= 1.0 )
|
||||
if( tr.flFraction >= 1.0f )
|
||||
{
|
||||
if( fFirst )
|
||||
{
|
||||
|
@ -245,7 +245,7 @@ int CCrowbar::Swing( int fFirst )
|
|||
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
|
||||
|
||||
// play thwack, smack, or dong sound
|
||||
float flVol = 1.0;
|
||||
float flVol = 1.0f;
|
||||
int fHitWorld = TRUE;
|
||||
|
||||
if( pEntity )
|
||||
|
@ -255,9 +255,9 @@ int CCrowbar::Swing( int fFirst )
|
|||
// UTIL_WeaponTimeBase() is always 0 and m_flNextPrimaryAttack is >= -1.0f, thus making
|
||||
// m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() always evaluate to false.
|
||||
#ifdef CLIENT_WEAPONS
|
||||
if( ( m_flNextPrimaryAttack + 1 == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
if( ( m_flNextPrimaryAttack + 1.0f == UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
#else
|
||||
if( ( m_flNextPrimaryAttack + 1 < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
if( ( m_flNextPrimaryAttack + 1.0f < UTIL_WeaponTimeBase() ) || g_pGameRules->IsMultiplayer() )
|
||||
#endif
|
||||
{
|
||||
// first swing does full damage
|
||||
|
@ -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 );
|
||||
SetNextThink( 0.2 );
|
||||
SetNextThink( 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 );
|
||||
|
|
|
@ -103,9 +103,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.
|
||||
|
@ -133,9 +133,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 )
|
||||
|
@ -152,7 +152,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
|
||||
|
@ -171,9 +171,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 )
|
||||
|
@ -188,7 +188,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
|
||||
|
@ -260,7 +260,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
|
||||
|
@ -325,13 +325,13 @@ void CBaseDoor::Spawn()
|
|||
SET_MODEL( ENT( pev ), STRING( pev->model ) );
|
||||
UTIL_SetOrigin(this, pev->origin);
|
||||
|
||||
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 ) )
|
||||
{
|
||||
|
@ -644,10 +644,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,
|
||||
|
@ -667,7 +665,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.
|
||||
}
|
||||
|
||||
|
@ -781,7 +779,7 @@ void CBaseDoor::DoorGoUp( void )
|
|||
|
||||
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 )
|
||||
{
|
||||
|
@ -791,14 +789,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 );
|
||||
|
@ -815,7 +813,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 );
|
||||
|
@ -835,7 +833,7 @@ void CBaseDoor::DoorHitTop( void )
|
|||
SetNextThink( m_flWait );
|
||||
SetThink( &CBaseDoor::DoorGoDown );
|
||||
|
||||
if( m_flWait == -1 )
|
||||
if( m_flWait == -1.0f )
|
||||
{
|
||||
DontThink();
|
||||
}
|
||||
|
@ -870,7 +868,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
|
||||
|
@ -908,7 +906,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 );
|
||||
|
@ -967,7 +965,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 )
|
||||
{
|
||||
//LRC - thanks to [insert name here] for this
|
||||
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
|
||||
|
@ -997,8 +995,8 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
|
|||
if ( ( VARS( pTarget->pev ) != pev && FClassnameIs( pTarget->pev, "func_door" ) ) ||
|
||||
FClassnameIs( pTarget->pev, "func_door_rotating" ) )
|
||||
{
|
||||
pDoor = GetClassPtr( (CBaseDoor *) VARS(pTarget->pev) );
|
||||
if( pDoor->m_flWait >= 0 )
|
||||
pDoor = GetClassPtr( (CBaseDoor *)VARS( pTarget->pev ) );
|
||||
if( pDoor->m_flWait >= 0.0f )
|
||||
{
|
||||
// avelocity == velocity!? LRC
|
||||
if( pDoor->pev->velocity == pev->velocity && pDoor->pev->avelocity == pev->velocity )
|
||||
|
@ -1088,7 +1086,7 @@ void CRotDoor::Spawn( void )
|
|||
|
||||
// check for clockwise rotation
|
||||
if( FBitSet( pev->spawnflags, SF_DOOR_ROTATE_BACKWARDS ) )
|
||||
pev->movedir = pev->movedir * -1;
|
||||
pev->movedir = pev->movedir * -1.0f;
|
||||
|
||||
//m_flWait = 2; who the hell did this? (sjb)
|
||||
m_vecAngle1 = pev->angles;
|
||||
|
@ -1105,8 +1103,8 @@ void CRotDoor::Spawn( void )
|
|||
UTIL_SetOrigin(this, 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
|
||||
|
@ -1117,7 +1115,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;
|
||||
|
@ -1201,16 +1199,16 @@ void CMomentaryDoor::Spawn( void )
|
|||
UTIL_SetOrigin(this, 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_iState = STATE_OFF;
|
||||
|
||||
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" );
|
||||
|
||||
//LRC: FIXME, move to PostSpawn
|
||||
|
@ -1342,16 +1340,16 @@ 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;
|
||||
if (IsLockedByMaster()) return;
|
||||
|
||||
Vector move = m_vecPosition1 + ( value * ( m_vecPosition2 - m_vecPosition1 ) );
|
||||
|
||||
float speed = 0;
|
||||
if (pev->speed)
|
||||
if( pev->speed )
|
||||
{
|
||||
//LRC- move at the given speed, if any.
|
||||
speed = pev->speed;
|
||||
|
@ -1362,10 +1360,9 @@ void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
|
|||
Vector delta;
|
||||
delta = move - pev->origin;
|
||||
|
||||
speed = delta.Length() * 10;
|
||||
speed = delta.Length() * 10.0f;
|
||||
}
|
||||
|
||||
|
||||
//FIXME: allow for it being told to move at the same speed in the _opposite_ direction!
|
||||
if( speed != 0 )
|
||||
{
|
||||
|
@ -1388,13 +1385,13 @@ void CMomentaryDoor::MomentaryMoveDone( void )
|
|||
{
|
||||
m_iState = STATE_OFF;
|
||||
SetThink(&CMomentaryDoor::StopMoveSound);
|
||||
pev->nextthink = pev->ltime + 0.1;
|
||||
pev->nextthink = pev->ltime + 0.1f;
|
||||
}
|
||||
|
||||
void CMomentaryDoor::StopMoveSound()
|
||||
{
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1, ATTN_NORM );
|
||||
pev->nextthink = -1;
|
||||
EMIT_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseArrived ), 1.0f, ATTN_NORM );
|
||||
pev->nextthink = -1.0f;
|
||||
ResetThink();
|
||||
}
|
||||
|
|
106
dlls/effects.cpp
106
dlls/effects.cpp
|
@ -122,7 +122,7 @@ void CBubbling::Spawn( void )
|
|||
if( !( pev->spawnflags & SF_BUBBLES_STARTOFF ) )
|
||||
{
|
||||
SetThink( &CBubbling::FizzThink );
|
||||
SetNextThink( 2.0 );
|
||||
SetNextThink( 2.0f );
|
||||
m_state = 1;
|
||||
}
|
||||
else
|
||||
|
@ -142,7 +142,7 @@ void CBubbling::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
|
|||
if( m_state )
|
||||
{
|
||||
SetThink( &CBubbling::FizzThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -181,10 +181,10 @@ void CBubbling::FizzThink( void )
|
|||
WRITE_BYTE( m_density );
|
||||
MESSAGE_END();
|
||||
|
||||
if ( m_frequency > 19 ) // frequencies above 20 are treated as 20.
|
||||
SetNextThink( 0.5 );
|
||||
if( m_frequency > 19 ) // frequencies above 20 are treated as 20.
|
||||
SetNextThink( 0.5f );
|
||||
else
|
||||
SetNextThink( 2.5 - (0.1 * m_frequency) );
|
||||
SetNextThink( 2.5f - ( 0.1f * m_frequency ) );
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
|
@ -502,7 +502,7 @@ void CLightning::Spawn( void )
|
|||
if ( pev->dmg != 0 || !FStringNull(pev->target) )
|
||||
{
|
||||
SetThink(&CLightning:: TripThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
if( pev->targetname )
|
||||
{
|
||||
|
@ -528,7 +528,7 @@ void CLightning::Spawn( void )
|
|||
if( FStringNull( pev->targetname ) || FBitSet( pev->spawnflags, SF_BEAM_STARTON ) )
|
||||
{
|
||||
SetThink( &CLightning::StrikeThink );
|
||||
SetNextThink( 1.0 );
|
||||
SetNextThink( 1.0f );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ void CLightning::StrikeUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
|
|||
else
|
||||
{
|
||||
SetThink( &CLightning::StrikeThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
if( !FBitSet( pev->spawnflags, SF_BEAM_TOGGLE ) )
|
||||
|
@ -670,7 +670,7 @@ void CLightning::StrikeThink( void )
|
|||
if ( m_life != 0 && m_restrike != -1) //LRC non-restriking beams! what an idea!
|
||||
{
|
||||
if( pev->spawnflags & SF_BEAM_RANDOM )
|
||||
SetNextThink( m_life + RANDOM_FLOAT( 0, m_restrike ) );
|
||||
SetNextThink( m_life + RANDOM_FLOAT( 0.0f, m_restrike ) );
|
||||
else
|
||||
SetNextThink( m_life + m_restrike );
|
||||
}
|
||||
|
@ -751,7 +751,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
|
||||
|
@ -806,7 +806,7 @@ CBaseEntity* CBeam::GetTripEntity( TraceResult *ptr )
|
|||
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 )
|
||||
|
@ -835,7 +835,7 @@ void CBeam::BeamDamage( TraceResult *ptr )
|
|||
//LRC - used to be DamageThink, but now it's more general.
|
||||
void CLightning::TripThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
TraceResult tr;
|
||||
|
||||
//ALERT(at_console,"TripThink\n");
|
||||
|
@ -885,7 +885,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
|
||||
|
@ -920,32 +920,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 );
|
||||
|
@ -960,15 +960,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 );
|
||||
|
@ -1361,22 +1361,22 @@ void CLaser::StrikeThink( void )
|
|||
//LRC
|
||||
// UTIL_TraceLine( pev->origin, m_firePosition, dont_ignore_monsters, NULL, &tr );
|
||||
IGNORE_GLASS iIgnoreGlass;
|
||||
if (m_iStoppedBy % 2) // if it's an odd number
|
||||
if( m_iStoppedBy % 2 ) // if it's an odd number
|
||||
iIgnoreGlass = ignore_glass;
|
||||
else
|
||||
iIgnoreGlass = dont_ignore_glass;
|
||||
|
||||
IGNORE_MONSTERS iIgnoreMonsters;
|
||||
if (m_iStoppedBy <= 1)
|
||||
if( m_iStoppedBy <= 1 )
|
||||
iIgnoreMonsters = dont_ignore_monsters;
|
||||
else if (m_iStoppedBy <= 3)
|
||||
else if( m_iStoppedBy <= 3 )
|
||||
iIgnoreMonsters = missile;
|
||||
else
|
||||
iIgnoreMonsters = ignore_monsters;
|
||||
|
||||
if ( m_iProjection )
|
||||
if( m_iProjection )
|
||||
{
|
||||
Vector vecProject = startpos + 4096*((m_firePosition - startpos).Normalize());
|
||||
Vector vecProject = startpos + 4096 * ( ( m_firePosition - startpos ).Normalize() );
|
||||
UTIL_TraceLine( startpos, vecProject, iIgnoreMonsters, iIgnoreGlass, NULL, &tr );
|
||||
}
|
||||
else
|
||||
|
@ -1387,18 +1387,18 @@ void CLaser::StrikeThink( void )
|
|||
FireAtPoint( startpos, tr );
|
||||
|
||||
//LRC - tripbeams
|
||||
if (pev->target)
|
||||
if( pev->target )
|
||||
{
|
||||
// nicked from monster_tripmine:
|
||||
//HACKHACK Set simple box using this really nice global!
|
||||
gpGlobals->trace_flags = FTRACE_SIMPLEBOX;
|
||||
UTIL_TraceLine( startpos, m_firePosition, dont_ignore_monsters, NULL, &tr );
|
||||
CBaseEntity *pTrip = GetTripEntity( &tr );
|
||||
if (pTrip)
|
||||
if( pTrip )
|
||||
{
|
||||
if (!FBitSet(pev->spawnflags, SF_BEAM_TRIPPED))
|
||||
if( !FBitSet( pev->spawnflags, SF_BEAM_TRIPPED ) )
|
||||
{
|
||||
FireTargets(STRING(pev->target), pTrip, this, USE_TOGGLE, 0);
|
||||
FireTargets( STRING( pev->target ), pTrip, this, USE_TOGGLE, 0 );
|
||||
pev->spawnflags |= SF_BEAM_TRIPPED;
|
||||
}
|
||||
}
|
||||
|
@ -1407,7 +1407,7 @@ void CLaser::StrikeThink( void )
|
|||
pev->spawnflags &= ~SF_BEAM_TRIPPED;
|
||||
}
|
||||
}
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
class CGlow : public CPointEntity
|
||||
|
@ -1445,8 +1445,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 )
|
||||
SetNextThink( 0.1 );
|
||||
if( m_maxFrame > 1.0f && pev->framerate != 0 )
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
m_lastTime = gpGlobals->time;
|
||||
}
|
||||
|
@ -1455,7 +1455,7 @@ void CGlow::Think( void )
|
|||
{
|
||||
Animate( pev->framerate * ( gpGlobals->time - m_lastTime ) );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
m_lastTime = gpGlobals->time;
|
||||
}
|
||||
|
||||
|
@ -1538,7 +1538,7 @@ void CSprite::AnimateThink( void )
|
|||
{
|
||||
Animate( pev->framerate * ( gpGlobals->time - m_lastTime ) );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
m_lastTime = gpGlobals->time;
|
||||
}
|
||||
|
||||
|
@ -1575,7 +1575,7 @@ void CSprite::ExpandThink( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
m_lastTime = gpGlobals->time;
|
||||
}
|
||||
}
|
||||
|
@ -1614,7 +1614,7 @@ void CSprite::TurnOn( void )
|
|||
return;
|
||||
}
|
||||
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 );
|
||||
SetNextThink( 0 );
|
||||
|
@ -2105,9 +2105,9 @@ void CGibShooter::ShootThink( void )
|
|||
else
|
||||
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();
|
||||
|
||||
|
@ -2432,7 +2432,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 );
|
||||
|
||||
|
@ -2446,7 +2446,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
|
||||
|
@ -2462,15 +2462,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 );
|
||||
}
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2488,7 +2488,7 @@ void CTestEffect::TestThink( void )
|
|||
void CTestEffect::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
SetThink( &CTestEffect::TestThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
m_flStartTime = gpGlobals->time;
|
||||
}
|
||||
|
||||
|
@ -2604,7 +2604,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() );
|
||||
}
|
||||
}
|
||||
|
@ -2855,8 +2855,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 )
|
||||
|
@ -4213,7 +4213,7 @@ void CItemSoda::Spawn( void )
|
|||
UTIL_SetSize( pev, Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
|
||||
|
||||
SetThink( &CItemSoda::CanThink );
|
||||
SetNextThink( 0.5 );
|
||||
SetNextThink( 0.5f );
|
||||
}
|
||||
|
||||
void CItemSoda::CanThink( void )
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#define EGON_SOUND_RUN "weapons/egon_run3.wav"
|
||||
#define EGON_SOUND_STARTUP "weapons/egon_windup2.wav"
|
||||
|
||||
#define EGON_SWITCH_NARROW_TIME 0.75 // Time it takes to switch fire modes
|
||||
#define EGON_SWITCH_WIDE_TIME 1.5
|
||||
#define EGON_SWITCH_NARROW_TIME 0.75f // Time it takes to switch fire modes
|
||||
#define EGON_SWITCH_WIDE_TIME 1.5f
|
||||
|
||||
enum egon_e {
|
||||
EGON_IDLE1 = 0,
|
||||
|
@ -105,7 +105,7 @@ int CEgon::AddToPlayer( CBasePlayer *pPlayer )
|
|||
|
||||
void CEgon::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
|
||||
SendWeaponAnim( EGON_HOLSTER );
|
||||
|
||||
EndAttack();
|
||||
|
@ -190,20 +190,20 @@ void CEgon::Attack( void )
|
|||
{
|
||||
if( !HasAmmo() )
|
||||
{
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.25;
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.25f;
|
||||
PlayEmptySound( );
|
||||
return;
|
||||
}
|
||||
|
||||
m_flAmmoUseTime = gpGlobals->time;// start using ammo ASAP.
|
||||
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, m_fireState, m_fireMode, 1, 0 );
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, m_fireState, m_fireMode, 1, 0 );
|
||||
|
||||
m_shakeTime = 0;
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = EGON_PRIMARY_VOLUME;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1;
|
||||
pev->fuser1 = UTIL_WeaponTimeBase() + 2;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1f;
|
||||
pev->fuser1 = UTIL_WeaponTimeBase() + 2.0f;
|
||||
|
||||
pev->dmgtime = gpGlobals->time + GetPulseInterval();
|
||||
m_fireState = FIRE_CHARGE;
|
||||
|
@ -216,14 +216,14 @@ void CEgon::Attack( void )
|
|||
|
||||
if( pev->fuser1 <= UTIL_WeaponTimeBase() )
|
||||
{
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0, g_vecZero, g_vecZero, 0.0, 0.0, m_fireState, m_fireMode, 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usEgonFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, m_fireState, m_fireMode, 0, 0 );
|
||||
pev->fuser1 = 1000;
|
||||
}
|
||||
|
||||
if( !HasAmmo() )
|
||||
{
|
||||
EndAttack();
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0;
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 1.0f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -238,12 +238,12 @@ void CEgon::PrimaryAttack( void )
|
|||
|
||||
void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
|
||||
{
|
||||
Vector vecDest = vecOrigSrc + vecDir * 2048;
|
||||
Vector vecDest = vecOrigSrc + vecDir * 2048.0f;
|
||||
edict_t *pentIgnore;
|
||||
TraceResult tr;
|
||||
|
||||
pentIgnore = m_pPlayer->edict();
|
||||
Vector tmpSrc = vecOrigSrc + gpGlobals->v_up * -8 + gpGlobals->v_right * 3;
|
||||
Vector tmpSrc = vecOrigSrc + gpGlobals->v_up * -8.0f + gpGlobals->v_right * 3.0f;
|
||||
|
||||
// ALERT( at_console, "." );
|
||||
|
||||
|
@ -292,7 +292,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
|
|||
if( gpGlobals->time >= m_flAmmoUseTime )
|
||||
{
|
||||
UseAmmo( 1 );
|
||||
m_flAmmoUseTime = gpGlobals->time + 0.1;
|
||||
m_flAmmoUseTime = gpGlobals->time + 0.1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -301,7 +301,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
|
|||
if( gpGlobals->time >= m_flAmmoUseTime )
|
||||
{
|
||||
UseAmmo( 1 );
|
||||
m_flAmmoUseTime = gpGlobals->time + 0.166;
|
||||
m_flAmmoUseTime = gpGlobals->time + 0.166f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
|
|||
if( g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
// radius damage a little more potent in multiplayer.
|
||||
::RadiusDamage( tr.vecEndPos, pev, m_pPlayer->pev, gSkillData.plrDmgEgonWide/4, 128, CLASS_NONE, DMG_ENERGYBEAM | DMG_BLAST | DMG_ALWAYSGIB );
|
||||
::RadiusDamage( tr.vecEndPos, pev, m_pPlayer->pev, gSkillData.plrDmgEgonWide * 0.25f, 128, CLASS_NONE, DMG_ENERGYBEAM | DMG_BLAST | DMG_ALWAYSGIB );
|
||||
}
|
||||
|
||||
if( !m_pPlayer->IsAlive() )
|
||||
|
@ -337,7 +337,7 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
|
|||
if( gpGlobals->time >= m_flAmmoUseTime )
|
||||
{
|
||||
UseAmmo( 1 );
|
||||
m_flAmmoUseTime = gpGlobals->time + 0.2;
|
||||
m_flAmmoUseTime = gpGlobals->time + 0.2f;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -346,15 +346,15 @@ void CEgon::Fire( const Vector &vecOrigSrc, const Vector &vecDir )
|
|||
if( gpGlobals->time >= m_flAmmoUseTime )
|
||||
{
|
||||
UseAmmo( 1 );
|
||||
m_flAmmoUseTime = gpGlobals->time + 0.1;
|
||||
m_flAmmoUseTime = gpGlobals->time + 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
pev->dmgtime = gpGlobals->time + GetDischargeInterval();
|
||||
if( m_shakeTime < gpGlobals->time )
|
||||
{
|
||||
UTIL_ScreenShake( tr.vecEndPos, 5.0, 150.0, 0.75, 250.0 );
|
||||
m_shakeTime = gpGlobals->time + 1.5;
|
||||
UTIL_ScreenShake( tr.vecEndPos, 5.0f, 150.0f, 0.75f, 250.0f );
|
||||
m_shakeTime = gpGlobals->time + 1.5f;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -384,13 +384,14 @@ 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 );
|
||||
UTIL_SetOrigin( m_pSprite, 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;
|
||||
|
||||
|
@ -481,17 +482,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 );
|
||||
|
@ -505,10 +506,10 @@ void CEgon::EndAttack( void )
|
|||
if( m_fireState != FIRE_OFF ) //Checking the button just in case!.
|
||||
bMakeNoise = true;
|
||||
|
||||
PLAYBACK_EVENT_FULL( FEV_GLOBAL | FEV_RELIABLE, m_pPlayer->edict(), m_usEgonStop, 0, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, bMakeNoise, 0, 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( FEV_GLOBAL | FEV_RELIABLE, m_pPlayer->edict(), m_usEgonStop, 0.0f, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0f, 0.0f, bMakeNoise, 0, 0, 0 );
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.5f;
|
||||
|
||||
m_fireState = FIRE_OFF;
|
||||
|
||||
|
|
|
@ -39,21 +39,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;
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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;
|
||||
}
|
||||
|
@ -62,9 +62,9 @@ void CShower::Think( void )
|
|||
{
|
||||
UTIL_Sparks( pev->origin );
|
||||
|
||||
pev->speed -= 0.1;
|
||||
if( pev->speed > 0 )
|
||||
SetNextThink( 0.1 );
|
||||
pev->speed -= 0.1f;
|
||||
if( pev->speed > 0.0f )
|
||||
SetNextThink( 0.1f );
|
||||
else
|
||||
UTIL_Remove( this );
|
||||
pev->flags &= ~FL_ONGROUND;
|
||||
|
@ -73,12 +73,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
|
||||
|
@ -131,17 +131,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;
|
||||
|
@ -169,9 +169,9 @@ void CEnvExplosion::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
|||
UTIL_TraceLine ( vecSpot + Vector( 0, 0, 8 ), vecSpot + Vector ( 0, 0, -32 ), 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
|
||||
{
|
||||
|
@ -181,7 +181,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 );
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ void CEnvExplosion::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
|||
}
|
||||
|
||||
SetThink( &CEnvExplosion::Smoke );
|
||||
SetNextThink( 0.3 );
|
||||
SetNextThink( 0.3f );
|
||||
|
||||
// draw sparks
|
||||
if( !( pev->spawnflags & SF_ENVEXPLOSION_NOSPARKS ) )
|
||||
|
|
|
@ -51,19 +51,26 @@
|
|||
#ifndef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
typedef unsigned int ULONG;
|
||||
typedef unsigned char BYTE;
|
||||
typedef int BOOL;
|
||||
#define MAX_PATH PATH_MAX
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
#endif //_WIN32
|
||||
|
||||
// Misc C-runtime library headers
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "stddef.h"
|
||||
#include "math.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <cmath>
|
||||
|
||||
#ifndef M_PI_F
|
||||
#define M_PI_F (float)M_PI
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
||||
#define XASH_64BIT
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -328,7 +328,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 )
|
||||
|
@ -489,7 +489,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 )
|
||||
{
|
||||
|
@ -510,10 +510,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;
|
||||
}
|
||||
|
||||
SetNextThink( m_flDelay );
|
||||
|
@ -626,7 +626,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:
|
||||
|
@ -639,7 +639,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;
|
||||
|
@ -670,7 +670,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 ) &&
|
||||
|
@ -680,7 +680,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() )
|
||||
|
@ -688,11 +688,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();
|
||||
|
@ -734,10 +734,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 )
|
||||
{
|
||||
|
@ -815,7 +815,7 @@ void CBreakable::Die( void )
|
|||
}
|
||||
|
||||
if( m_Explosion == expDirected )
|
||||
vecVelocity = g_vecAttackDir * 200;
|
||||
vecVelocity = g_vecAttackDir * 200.0f;
|
||||
else
|
||||
{
|
||||
vecVelocity.x = 0;
|
||||
|
@ -823,7 +823,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 );
|
||||
|
||||
|
@ -918,12 +918,12 @@ void CBreakable::Die( void )
|
|||
if (m_pHitProxy)
|
||||
{
|
||||
m_pHitProxy->SetThink(&CBreakable::SUB_Remove );
|
||||
m_pHitProxy->SetNextThink( 0.1 );
|
||||
m_pHitProxy->SetNextThink( 0.1f );
|
||||
m_pHitProxy = NULL;
|
||||
}
|
||||
|
||||
SetThink(&CBreakable::SUB_Remove );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
// ALERT(at_console, "Set SUB_Remove\n");
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ void CPushable::Spawn( void )
|
|||
UTIL_SetOrigin( this, 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;
|
||||
}
|
||||
|
||||
|
@ -1044,11 +1044,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
|
||||
|
@ -1103,8 +1103,8 @@ void CPushable::Move( CBaseEntity *pOther, int push )
|
|||
if( FBitSet( pevToucher->flags,FL_ONGROUND ) && pevToucher->groundentity && VARS( pevToucher->groundentity ) == pev )
|
||||
{
|
||||
// Only push if floating
|
||||
if ( pev->waterlevel > 0 && pev->watertype > CONTENT_FLYFIELD)
|
||||
pev->velocity.z += pevToucher->velocity.z * 0.1;
|
||||
if( pev->waterlevel > 0 && pev->watertype > CONTENT_FLYFIELD )
|
||||
pev->velocity.z += pevToucher->velocity.z * 0.1f;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1127,13 +1127,13 @@ void CPushable::Move( CBaseEntity *pOther, int push )
|
|||
if ( pev->waterlevel < 1 || pev->watertype <= CONTENT_FLYFIELD)
|
||||
return;
|
||||
else
|
||||
factor = 0.1;
|
||||
factor = 0.1f;
|
||||
}
|
||||
else
|
||||
factor = 1;
|
||||
factor = 1.0f;
|
||||
}
|
||||
else
|
||||
factor = 0.25;
|
||||
factor = 0.25f;
|
||||
|
||||
if (!push)
|
||||
factor = factor*0.5;
|
||||
|
@ -1151,15 +1151,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 );
|
||||
// SetNextThink( 0.1 );
|
||||
// SetNextThink( 0.1f );
|
||||
}
|
||||
else
|
||||
STOP_SOUND( ENT( pev ), CHAN_WEAPON, m_soundNames[m_lastSound] );
|
||||
|
|
|
@ -158,7 +158,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; SetNextThink(0.1); m_fireLast = 0; }
|
||||
inline void TankActivate( void ) { pev->spawnflags |= SF_TANK_ACTIVE; SetNextThink( 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 );
|
||||
|
@ -304,7 +304,7 @@ void CFuncTank::Spawn( void )
|
|||
|
||||
if( IsActive() )
|
||||
{
|
||||
SetNextThink(1.0);
|
||||
SetNextThink( 1.0f );
|
||||
}
|
||||
|
||||
m_sightOrigin = BarrelPosition(); // Point at the end of the barrel
|
||||
|
@ -551,10 +551,10 @@ void CFuncTank :: StopControl( CFuncTankControls* pControls)
|
|||
|
||||
void CFuncTank::UpdateSpot( void )
|
||||
{
|
||||
if ( pev->spawnflags & SF_TANK_LASERSPOT )
|
||||
if( pev->spawnflags & SF_TANK_LASERSPOT )
|
||||
{
|
||||
if (!m_pSpot)
|
||||
{
|
||||
{
|
||||
m_pSpot = CLaserSpot::CreateSpot();
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ void CFuncTank::UpdateSpot( 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 );
|
||||
|
||||
|
@ -601,7 +601,7 @@ void CFuncTank::UpdateSpot( 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 //////////////
|
||||
|
@ -928,7 +928,7 @@ void CFuncTank::TrackTarget( void )
|
|||
// ALERT( at_console, "TANK has no controller\n");
|
||||
if( IsActive() )
|
||||
{
|
||||
SetNextThink(0.1);
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -945,7 +945,7 @@ void CFuncTank::TrackTarget( void )
|
|||
if ( FNullEnt( pTarget ) )
|
||||
{
|
||||
if( IsActive() )
|
||||
SetNextThink(2); // No enemies visible, wait 2 secs
|
||||
SetNextThink( 2.0f ); // No enemies visible, wait 2 secs
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -959,7 +959,7 @@ void CFuncTank::TrackTarget( void )
|
|||
|
||||
UTIL_TraceLine( barrelEnd, targetPosition, dont_ignore_monsters, edict(), &tr );
|
||||
|
||||
if ( tr.flFraction == 1.0 || tr.pHit == ENT(pTarget->pev) )
|
||||
if( tr.flFraction == 1.0f || tr.pHit == ENT( pTarget->pev ) )
|
||||
{
|
||||
lineOfSight = TRUE;
|
||||
|
||||
|
@ -1144,12 +1144,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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1176,9 +1176,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 )
|
||||
|
@ -1189,7 +1189,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->AbsoluteNextThink( pSprite->m_fNextThink + 0.1 );
|
||||
pSprite->AbsoluteNextThink( pSprite->m_fNextThink + 0.1f );
|
||||
}
|
||||
|
||||
//LRC
|
||||
|
@ -1208,8 +1208,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 +
|
||||
|
@ -1386,7 +1386,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( barrelEnd, tr );
|
||||
|
||||
//LRC - tripbeams
|
||||
|
@ -1704,7 +1704,7 @@ void CFuncTankControls::Spawn( void )
|
|||
UTIL_SetSize( pev, pev->mins, pev->maxs );
|
||||
UTIL_SetOrigin( this, pev->origin );
|
||||
|
||||
//LRC SetNextThink( 0.3 ); // After all the func_tanks have spawned
|
||||
//LRC SetNextThink( 0.3f ); // After all the func_tanks have spawned
|
||||
|
||||
CBaseEntity::Spawn();
|
||||
}
|
||||
|
|
|
@ -307,6 +307,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
|
||||
//=========================================================
|
||||
|
|
|
@ -100,7 +100,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?
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
//=========================================================
|
||||
// Gargantua Monster
|
||||
//=========================================================
|
||||
const float GARG_ATTACKDIST = 80.0;
|
||||
const float GARG_ATTACKDIST = 80.0f;
|
||||
|
||||
// Garg animation events
|
||||
#define GARG_AE_SLASH_LEFT 1
|
||||
|
@ -44,7 +44,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)
|
||||
|
@ -115,16 +115,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;
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
// Do damage for this frame
|
||||
Vector vecStart = pev->origin;
|
||||
|
@ -146,7 +146,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 )
|
||||
|
@ -159,9 +159,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->SetNextThink( 0.3 );
|
||||
pSprite->pev->velocity = Vector( RANDOM_FLOAT( -200.0f, 200.0f ), RANDOM_FLOAT( -200.0f, 200.0f ), 175.0f );
|
||||
// pSprite->AnimateAndDie( RANDOM_FLOAT( 8.0f, 12.0f ) );
|
||||
pSprite->SetNextThink( 0.3f );
|
||||
pSprite->SetThink(&CSprite:: SUB_Remove );
|
||||
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxFadeFast );
|
||||
}
|
||||
|
@ -475,7 +475,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 );
|
||||
}
|
||||
|
||||
|
@ -560,9 +560,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;
|
||||
|
@ -578,7 +578,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
|
||||
|
@ -598,7 +598,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();
|
||||
|
||||
|
@ -628,15 +628,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;
|
||||
}
|
||||
|
@ -646,7 +646,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 );
|
||||
|
@ -680,7 +680,7 @@ void CGargantua::PrescheduleThink( void )
|
|||
{
|
||||
if( !HasConditions( bits_COND_SEE_ENEMY ) )
|
||||
{
|
||||
m_seeTime = gpGlobals->time + 5;
|
||||
m_seeTime = gpGlobals->time + 5.0f;
|
||||
EyeOff();
|
||||
}
|
||||
else
|
||||
|
@ -868,7 +868,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 );
|
||||
}
|
||||
|
@ -883,13 +883,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;
|
||||
}
|
||||
|
||||
|
@ -897,7 +897,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->SetNextThink( 2.5 ); // Start in 2.5 seconds
|
||||
pSmoker->SetNextThink( 2.5f ); // Start in 2.5 seconds
|
||||
}
|
||||
|
||||
void CGargantua::Killed( entvars_t *pevAttacker, int iGib )
|
||||
|
@ -917,7 +917,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;
|
||||
|
@ -932,7 +932,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;
|
||||
|
@ -954,7 +954,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;
|
||||
}
|
||||
|
@ -973,7 +973,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 ) )
|
||||
|
@ -1000,7 +1000,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:
|
||||
if ( !(pev->spawnflags & SF_MONSTER_GAG) || m_MonsterState != MONSTERSTATE_IDLE)
|
||||
|
@ -1030,7 +1030,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 );
|
||||
|
||||
|
@ -1074,7 +1074,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;
|
||||
|
@ -1099,7 +1099,7 @@ void CGargantua::StartTask( Task_t *pTask )
|
|||
break;
|
||||
|
||||
case TASK_DIE:
|
||||
m_flWaitFinished = gpGlobals->time + 1.6;
|
||||
m_flWaitFinished = gpGlobals->time + 1.6f;
|
||||
DeathEffect();
|
||||
// FALL THROUGH
|
||||
default:
|
||||
|
@ -1123,8 +1123,9 @@ void CGargantua::RunTask( Task_t *pTask )
|
|||
pev->rendercolor.y = 0;
|
||||
pev->rendercolor.z = 0;
|
||||
StopAnimation();
|
||||
SetNextThink( 0.15 );
|
||||
SetThink(&CGargantua:: SUB_Remove );
|
||||
SetNextThink( 0.15f );
|
||||
SetThink( &CGargantua::SUB_Remove );
|
||||
|
||||
int i;
|
||||
int parts = MODEL_FRAMES( gGargGibModel );
|
||||
for( i = 0; i < 10; i++ )
|
||||
|
@ -1142,7 +1143,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->SetNextThink( 1.25 );
|
||||
pGib->SetNextThink( 1.25f );
|
||||
pGib->SetThink(&CGib:: SUB_FadeOut );
|
||||
}
|
||||
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
|
||||
|
@ -1247,10 +1248,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;
|
||||
|
@ -1288,13 +1289,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 )
|
||||
SetNextThink( RANDOM_FLOAT(0.1, 0.2) );
|
||||
SetNextThink( RANDOM_FLOAT( 0.1f, 0.2f ) );
|
||||
else
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
@ -1327,7 +1328,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 )
|
||||
{
|
||||
|
@ -1338,7 +1339,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;
|
||||
|
||||
|
|
108
dlls/gauss.cpp
108
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, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 );
|
||||
PLAYBACK_EVENT_FULL( FEV_RELIABLE | FEV_GLOBAL, m_pPlayer->edict(), m_usGaussFire, 0.01f, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 );
|
||||
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
|
||||
|
||||
SendWeaponAnim( GAUSS_HOLSTER );
|
||||
m_fInAttack = 0;
|
||||
|
@ -152,14 +152,14 @@ void CGauss::PrimaryAttack()
|
|||
if ( m_pPlayer->pev->waterlevel == 3 && m_pPlayer->pev->watertype > CONTENT_FLYFIELD )
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.15 );
|
||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.15f );
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < 2 )
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -170,8 +170,8 @@ void CGauss::PrimaryAttack()
|
|||
|
||||
StartFire();
|
||||
m_fInAttack = 0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.2;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.2f;
|
||||
}
|
||||
|
||||
void CGauss::SecondaryAttack()
|
||||
|
@ -190,7 +190,7 @@ void CGauss::SecondaryAttack()
|
|||
PlayEmptySound();
|
||||
}
|
||||
|
||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5 );
|
||||
m_flNextSecondaryAttack = m_flNextPrimaryAttack = GetNextAttackDelay( 0.5f );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ void CGauss::SecondaryAttack()
|
|||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
{
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/357_cock1.wav", 0.8, ATTN_NORM );
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -213,11 +213,11 @@ void CGauss::SecondaryAttack()
|
|||
|
||||
SendWeaponAnim( GAUSS_SPINUP );
|
||||
m_fInAttack = 1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5f;
|
||||
m_pPlayer->m_flStartCharge = gpGlobals->time;
|
||||
m_pPlayer->m_flAmmoStartCharge = UTIL_WeaponTimeBase() + GetFullChargeTime();
|
||||
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, 110, 0, 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, 110, 0, 0, 0 );
|
||||
|
||||
m_iSoundState = SND_CHANGE_PITCH;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ void CGauss::SecondaryAttack()
|
|||
// out of ammo! force the gun to fire
|
||||
StartFire();
|
||||
m_fInAttack = 0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
|
||||
return;
|
||||
}
|
||||
|
@ -257,12 +257,12 @@ void CGauss::SecondaryAttack()
|
|||
#endif
|
||||
{
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
||||
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.1;
|
||||
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
||||
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.3;
|
||||
m_pPlayer->m_flNextAmmoBurn = UTIL_WeaponTimeBase() + 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,25 +281,25 @@ void CGauss::SecondaryAttack()
|
|||
if( m_iSoundState == 0 )
|
||||
ALERT( at_console, "sound state %d\n", m_iSoundState );
|
||||
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussSpin, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, pitch, 0, ( m_iSoundState == SND_CHANGE_PITCH ) ? 1 : 0, 0 );
|
||||
|
||||
m_iSoundState = SND_CHANGE_PITCH; // hack for going through level transitions
|
||||
|
||||
m_pPlayer->m_iWeaponVolume = GAUSS_PRIMARY_CHARGE_VOLUME;
|
||||
|
||||
// m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1;
|
||||
if( m_pPlayer->m_flStartCharge < gpGlobals->time - 10 )
|
||||
// m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.1f;
|
||||
if( m_pPlayer->m_flStartCharge < gpGlobals->time - 10.0f )
|
||||
{
|
||||
// Player charged up too long. Zap him.
|
||||
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", 1.0, ATTN_NORM, 0, 80 + RANDOM_LONG( 0, 0x3f ) );
|
||||
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/electro6.wav", 1.0, ATTN_NORM, 0, 75 + RANDOM_LONG( 0, 0x3f ) );
|
||||
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", 1.0f, ATTN_NORM, 0, 80 + RANDOM_LONG( 0, 0x3f ) );
|
||||
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/electro6.wav", 1.0f, ATTN_NORM, 0, 75 + RANDOM_LONG( 0, 0x3f ) );
|
||||
|
||||
m_fInAttack = 0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0f;
|
||||
#ifndef CLIENT_DLL
|
||||
m_pPlayer->TakeDamage( VARS( eoNullEntity ), VARS( eoNullEntity ), 50, DMG_SHOCK );
|
||||
UTIL_ScreenFade( m_pPlayer, Vector( 255, 128, 0 ), 2, 0.5, 128, FFADE_IN );
|
||||
UTIL_ScreenFade( m_pPlayer, Vector( 255, 128, 0 ), 2, 0.5f, 128, FFADE_IN );
|
||||
#endif
|
||||
SendWeaponAnim( GAUSS_IDLE );
|
||||
|
||||
|
@ -325,18 +325,18 @@ void CGauss::StartFire( void )
|
|||
|
||||
if( gpGlobals->time - m_pPlayer->m_flStartCharge > GetFullChargeTime() )
|
||||
{
|
||||
flDamage = 200;
|
||||
flDamage = 200.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
flDamage = 200 * ( ( gpGlobals->time - m_pPlayer->m_flStartCharge ) / GetFullChargeTime() );
|
||||
flDamage = 200.0f * ( ( gpGlobals->time - m_pPlayer->m_flStartCharge ) / GetFullChargeTime() );
|
||||
}
|
||||
|
||||
if( m_fPrimaryFire )
|
||||
{
|
||||
// fixed damage on primary attack
|
||||
#ifdef CLIENT_DLL
|
||||
flDamage = 20;
|
||||
flDamage = 20.0f;
|
||||
#else
|
||||
flDamage = gSkillData.plrDmgGauss;
|
||||
#endif
|
||||
|
@ -350,7 +350,7 @@ void CGauss::StartFire( void )
|
|||
|
||||
if( !m_fPrimaryFire )
|
||||
{
|
||||
m_pPlayer->pev->velocity = m_pPlayer->pev->velocity - gpGlobals->v_forward * flDamage * 5;
|
||||
m_pPlayer->pev->velocity = m_pPlayer->pev->velocity - gpGlobals->v_forward * flDamage * 5.0f;
|
||||
}
|
||||
|
||||
if( !g_pGameRules->IsMultiplayer() )
|
||||
|
@ -364,7 +364,7 @@ void CGauss::StartFire( void )
|
|||
}
|
||||
|
||||
// time until aftershock 'static discharge' sound
|
||||
m_pPlayer->m_flPlayAftershock = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.3, 0.8 );
|
||||
m_pPlayer->m_flPlayAftershock = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.3f, 0.8f );
|
||||
|
||||
Fire( vecSrc, vecAiming, flDamage );
|
||||
}
|
||||
|
@ -375,9 +375,9 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
|||
TraceResult tr, beam_tr;
|
||||
#ifndef CLIENT_DLL
|
||||
Vector vecSrc = vecOrigSrc;
|
||||
Vector vecDest = vecSrc + vecDir * 8192;
|
||||
Vector vecDest = vecSrc + vecDir * 8192.0f;
|
||||
edict_t *pentIgnore;
|
||||
float flMaxFrac = 1.0;
|
||||
float flMaxFrac = 1.0f;
|
||||
int nTotal = 0;
|
||||
int fHasPunched = 0;
|
||||
int fFirstBeam = 1;
|
||||
|
@ -389,13 +389,13 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
|||
g_irunninggausspred = true;
|
||||
#endif
|
||||
// The main firing event is sent unreliably so it won't be delayed.
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussFire, 0.0, m_pPlayer->pev->origin, m_pPlayer->pev->angles, flDamage, 0.0, 0, 0, m_fPrimaryFire ? 1 : 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST, m_pPlayer->edict(), m_usGaussFire, 0.0f, m_pPlayer->pev->origin, m_pPlayer->pev->angles, flDamage, 0.0, 0, 0, m_fPrimaryFire ? 1 : 0, 0 );
|
||||
|
||||
// This reliable event is used to stop the spinning sound
|
||||
// It's delayed by a fraction of second to make sure it is delayed by 1 frame on the client
|
||||
// It's sent reliably anyway, which could lead to other delays
|
||||
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST | FEV_RELIABLE, m_pPlayer->edict(), m_usGaussFire, 0.01, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 );
|
||||
PLAYBACK_EVENT_FULL( FEV_NOTHOST | FEV_RELIABLE, m_pPlayer->edict(), m_usGaussFire, 0.01f, m_pPlayer->pev->origin, m_pPlayer->pev->angles, 0.0, 0.0, 0, 0, 0, 1 );
|
||||
|
||||
/*ALERT( at_console, "%f %f %f\n%f %f %f\n",
|
||||
vecSrc.x, vecSrc.y, vecSrc.z,
|
||||
|
@ -442,7 +442,7 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
|||
|
||||
n = -DotProduct( tr.vecPlaneNormal, vecDir );
|
||||
|
||||
if( n < 0.5 ) // 60 degrees
|
||||
if( n < 0.5f ) // 60 degrees
|
||||
{
|
||||
// ALERT( at_console, "reflect %f\n", n );
|
||||
// reflect
|
||||
|
@ -451,8 +451,8 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
|||
r = 2.0 * tr.vecPlaneNormal * n + vecDir;
|
||||
flMaxFrac = flMaxFrac - tr.flFraction;
|
||||
vecDir = r;
|
||||
vecSrc = tr.vecEndPos + vecDir * 8;
|
||||
vecDest = vecSrc + vecDir * 8192;
|
||||
vecSrc = tr.vecEndPos + vecDir * 8.0f;
|
||||
vecDest = vecSrc + vecDir * 8192.0f;
|
||||
|
||||
// explode a bit
|
||||
m_pPlayer->RadiusDamage( tr.vecEndPos, pev, m_pPlayer->pev, flDamage * n, CLASS_NONE, DMG_BLAST );
|
||||
|
@ -460,8 +460,8 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
|||
nTotal += 34;
|
||||
|
||||
// lose energy
|
||||
if( n == 0 ) n = 0.1;
|
||||
flDamage = flDamage * ( 1 - n );
|
||||
if( n == 0.0f ) n = 0.1f;
|
||||
flDamage = flDamage * ( 1.0f - n );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -485,8 +485,8 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
|||
|
||||
if( n < flDamage )
|
||||
{
|
||||
if( n == 0 )
|
||||
n = 1;
|
||||
if( n == 0.0f )
|
||||
n = 1.0f;
|
||||
flDamage -= n;
|
||||
|
||||
// ALERT( at_console, "punch %f\n", n );
|
||||
|
@ -498,16 +498,16 @@ void CGauss::Fire( Vector vecOrigSrc, Vector vecDir, float flDamage )
|
|||
|
||||
if( g_pGameRules->IsMultiplayer() )
|
||||
{
|
||||
damage_radius = flDamage * 1.75; // Old code == 2.5
|
||||
damage_radius = flDamage * 1.75f; // Old code == 2.5
|
||||
}
|
||||
else
|
||||
{
|
||||
damage_radius = flDamage * 2.5;
|
||||
damage_radius = flDamage * 2.5f;
|
||||
}
|
||||
|
||||
::RadiusDamage( beam_tr.vecEndPos + vecDir * 8, pev, m_pPlayer->pev, flDamage, damage_radius, CLASS_NONE, DMG_BLAST );
|
||||
|
||||
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0 );
|
||||
CSoundEnt::InsertSound( bits_SOUND_COMBAT, pev->origin, NORMAL_EXPLOSION_VOLUME, 3.0f );
|
||||
|
||||
nTotal += 53;
|
||||
|
||||
|
@ -553,18 +553,18 @@ void CGauss::WeaponIdle( void )
|
|||
switch( RANDOM_LONG( 0, 3 ) )
|
||||
{
|
||||
case 0:
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", RANDOM_FLOAT( 0.7, 0.8 ), ATTN_NORM );
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro4.wav", RANDOM_FLOAT( 0.7f, 0.8f ), ATTN_NORM );
|
||||
break;
|
||||
case 1:
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro5.wav", RANDOM_FLOAT( 0.7, 0.8 ), ATTN_NORM );
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro5.wav", RANDOM_FLOAT( 0.7f, 0.8f ), ATTN_NORM );
|
||||
break;
|
||||
case 2:
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro6.wav", RANDOM_FLOAT( 0.7, 0.8 ), ATTN_NORM );
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/electro6.wav", RANDOM_FLOAT( 0.7f, 0.8f ), ATTN_NORM );
|
||||
break;
|
||||
case 3:
|
||||
break; // no sound
|
||||
}
|
||||
m_pPlayer->m_flPlayAftershock = 0.0;
|
||||
m_pPlayer->m_flPlayAftershock = 0.0f;
|
||||
}
|
||||
|
||||
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
|
@ -574,30 +574,30 @@ void CGauss::WeaponIdle( void )
|
|||
{
|
||||
StartFire();
|
||||
m_fInAttack = 0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;
|
||||
|
||||
// Need to set m_flNextPrimaryAttack so the weapon gets a chance to complete its secondary fire animation. - Solokiller
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
int iAnim;
|
||||
float flRand = RANDOM_FLOAT( 0, 1 );
|
||||
if( flRand <= 0.5 )
|
||||
float flRand = RANDOM_FLOAT( 0.0f, 1.0f );
|
||||
if( flRand <= 0.5f )
|
||||
{
|
||||
iAnim = GAUSS_IDLE;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
|
||||
}
|
||||
else if( flRand <= 0.75 )
|
||||
else if( flRand <= 0.75f )
|
||||
{
|
||||
iAnim = GAUSS_IDLE2;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
iAnim = GAUSS_FIDGET;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0f;
|
||||
}
|
||||
#ifndef CLIENT_DLL
|
||||
SendWeaponAnim( iAnim );
|
||||
|
|
|
@ -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;
|
||||
SetNextThink( 0.3 );
|
||||
SetNextThink( 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, pev->velocity.Length( ), 0.2 );
|
||||
SetNextThink( 0.2 );
|
||||
CSoundEnt::InsertSound( bits_SOUND_DANGER, pev->origin + pev->velocity * 0.5f, pev->velocity.Length(), 0.2f );
|
||||
SetNextThink( 0.2f );
|
||||
|
||||
if (pev->waterlevel != 0 && pev->watertype > CONTENT_FLYFIELD)
|
||||
{
|
||||
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();
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
if( pev->dmgtime - 1 < gpGlobals->time )
|
||||
{
|
||||
|
@ -337,8 +337,8 @@ void CGrenade::TumbleThink( void )
|
|||
}
|
||||
if (pev->waterlevel != 0 && pev->watertype > CONTENT_FLYFIELD)
|
||||
{
|
||||
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->SetNextThink( 0.1 );
|
||||
if( time < 0.1 )
|
||||
pGrenade->SetNextThink( 0.1f );
|
||||
if( time < 0.1f )
|
||||
{
|
||||
pGrenade->SetNextThink( 0 );
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -106,12 +106,12 @@ BOOL CGlock::Deploy()
|
|||
|
||||
void CGlock::SecondaryAttack( void )
|
||||
{
|
||||
GlockFire( 0.1, 0.2, FALSE );
|
||||
GlockFire( 0.1f, 0.2f, FALSE );
|
||||
}
|
||||
|
||||
void CGlock::PrimaryAttack( void )
|
||||
{
|
||||
GlockFire( 0.01, 0.3, TRUE );
|
||||
GlockFire( 0.01f, 0.3f, TRUE );
|
||||
}
|
||||
|
||||
void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
|
||||
|
@ -121,7 +121,7 @@ void CGlock::GlockFire( float flSpread, float flCycleTime, BOOL fUseAutoAim )
|
|||
if( m_fFireOnEmpty )
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.2 );
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.2f );
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -187,9 +187,9 @@ void CGlock::Reload( void )
|
|||
int iResult;
|
||||
|
||||
if( m_iClip == 0 )
|
||||
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 1.5 );
|
||||
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD, 1.5f );
|
||||
else
|
||||
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 1.5 );
|
||||
iResult = DefaultReload( GLOCK_MAX_CLIP, GLOCK_RELOAD_NOT_EMPTY, 1.5f );
|
||||
|
||||
if( iResult )
|
||||
{
|
||||
|
@ -212,20 +212,20 @@ void CGlock::WeaponIdle( void )
|
|||
int iAnim;
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0, 1.0 );
|
||||
|
||||
if( flRand <= 0.3 + 0 * 0.75 )
|
||||
if( flRand <= 0.3f + 0 * 0.75f )
|
||||
{
|
||||
iAnim = GLOCK_IDLE3;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 49.0 / 16;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 49.0f / 16.0f;
|
||||
}
|
||||
else if( flRand <= 0.6 + 0 * 0.875 )
|
||||
else if( flRand <= 0.6f + 0 * 0.875f )
|
||||
{
|
||||
iAnim = GLOCK_IDLE1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0 / 16.0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 60.0f / 16.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
iAnim = GLOCK_IDLE2;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0 / 16.0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0f / 16.0f;
|
||||
}
|
||||
SendWeaponAnim( iAnim, 1 );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -110,8 +110,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
|
||||
|
@ -129,36 +133,29 @@ void CRecharge::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE use
|
|||
{
|
||||
if( m_flSoundTime <= gpGlobals->time )
|
||||
{
|
||||
m_flSoundTime = gpGlobals->time + 0.62;
|
||||
m_flSoundTime = gpGlobals->time + 0.62f;
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/suitchargeno1.wav", 0.85, ATTN_NORM );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
SetNextThink( 0.25 );
|
||||
SetNextThink( 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++;
|
||||
|
@ -176,7 +173,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 )
|
||||
|
|
|
@ -126,7 +126,7 @@ void CLegacyCineMonster :: CineSpawn( const char *szModel )
|
|||
if ( FStringNull(pev->targetname) )
|
||||
{
|
||||
SetThink( &CLegacyCineMonster::CineThink );
|
||||
AbsoluteNextThink( m_fNextThink + 0.1 );
|
||||
AbsoluteNextThink( m_fNextThink + 0.1f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ void CLegacyCineMonster :: CineThink( void )
|
|||
if (!pev->animtime)
|
||||
ResetSequenceInfo( );
|
||||
|
||||
SetNextThink( 1.0 );
|
||||
SetNextThink( 1.0f );
|
||||
|
||||
if (pev->spawnflags != 0 && m_fSequenceFinished)
|
||||
{
|
||||
|
@ -196,14 +196,15 @@ void CCineBlood :: BloodGush ( void )
|
|||
{
|
||||
Vector vecSplatDir;
|
||||
TraceResult tr;
|
||||
SetNextThink( 0.1 );
|
||||
|
||||
UTIL_MakeVectors(pev->angles);
|
||||
if ( pev->health-- < 0 )
|
||||
REMOVE_ENTITY(ENT(pev));
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
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 +213,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 );
|
||||
|
|
|
@ -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;
|
||||
|
||||
AbsoluteNextThink( m_fNextThink + 1.0 );
|
||||
AbsoluteNextThink( m_fNextThink + 1.0f );
|
||||
|
||||
ResetSequenceInfo();
|
||||
|
||||
|
@ -145,7 +145,7 @@ void CCycler::Spawn()
|
|||
//
|
||||
void CCycler::Think( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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;
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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 ) );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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;
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
if( pev->model )
|
||||
{
|
||||
|
@ -418,7 +418,7 @@ void CWreckage::Precache()
|
|||
void CWreckage::Think( void )
|
||||
{
|
||||
StudioFrameAdvance();
|
||||
SetNextThink( 0.2 );
|
||||
SetNextThink( 0.2f );
|
||||
|
||||
if( pev->dmgtime )
|
||||
{
|
||||
|
|
|
@ -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] )
|
||||
{
|
||||
|
@ -100,10 +100,10 @@ void CHandGrenade::Holster( int skiplocal /* = 0 */ )
|
|||
// no more grenades!
|
||||
m_pPlayer->pev->weapons &= ~( 1 << WEAPON_HANDGRENADE );
|
||||
SetThink(&CHandGrenade:: DestroyItem );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
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()
|
||||
|
@ -111,16 +111,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() )
|
||||
|
@ -130,33 +130,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 );
|
||||
}
|
||||
|
@ -168,10 +168,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]--;
|
||||
|
||||
|
@ -180,14 +180,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] )
|
||||
{
|
||||
|
@ -199,24 +199,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 );
|
||||
|
|
|
@ -194,15 +194,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;
|
||||
|
||||
|
@ -215,10 +215,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;
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ void CHAssassin::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
else
|
||||
CGrenade::ShootTimed( pev, vecGunPosition, 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.
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ void CHAssassin::HandleAnimEvent( MonsterEvent_t *pEvent )
|
|||
}
|
||||
else
|
||||
pev->velocity = m_vecJumpVelocity;
|
||||
m_flNextJump = gpGlobals->time + 3.0;
|
||||
m_flNextJump = gpGlobals->time + 3.0f;
|
||||
}
|
||||
return;
|
||||
default:
|
||||
|
@ -651,7 +651,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;
|
||||
|
||||
|
@ -659,15 +659,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;
|
||||
|
|
|
@ -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:
|
||||
|
@ -377,7 +377,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();
|
||||
}
|
||||
|
@ -408,7 +408,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;
|
||||
}
|
||||
|
@ -423,7 +423,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;
|
||||
}
|
||||
|
@ -494,11 +494,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 )
|
||||
|
@ -514,7 +514,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 )
|
||||
|
@ -539,7 +539,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -202,13 +202,13 @@ void CWallHealth::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
|
|||
{
|
||||
if( m_flSoundTime <= gpGlobals->time )
|
||||
{
|
||||
m_flSoundTime = gpGlobals->time + 0.62;
|
||||
m_flSoundTime = gpGlobals->time + 0.62f;
|
||||
EMIT_SOUND( ENT( pev ), CHAN_ITEM, "items/medshotno1.wav", 1.0, ATTN_NORM );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
SetNextThink( 0.25 );
|
||||
SetNextThink( 0.25f );
|
||||
SetThink( &CWallHealth::Off );
|
||||
|
||||
// Time to recharge yet?
|
||||
|
@ -220,7 +220,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 ) )
|
||||
{
|
||||
|
@ -235,7 +235,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 )
|
||||
|
|
|
@ -358,7 +358,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;
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,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;
|
||||
|
@ -427,7 +427,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 )
|
||||
{
|
||||
|
@ -446,7 +446,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;
|
||||
|
||||
|
@ -461,7 +461,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;
|
||||
}
|
||||
|
@ -543,7 +543,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.
|
||||
|
@ -569,7 +569,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
|
||||
|
@ -583,14 +583,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.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,7 +613,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
|
||||
|
@ -754,7 +754,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 );
|
||||
|
@ -932,9 +932,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:
|
||||
|
@ -2449,8 +2449,8 @@ void CHGruntRepel::RepelUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_
|
|||
pBeam->PointEntInit( pev->origin + Vector( 0, 0, 112 ), pGrunt->entindex() );
|
||||
pBeam->SetFlags( BEAM_FSOLID );
|
||||
pBeam->SetColor( 255, 255, 255 );
|
||||
pBeam->SetThink(&CBeam:: SUB_Remove );
|
||||
pBeam->SetNextThink( -4096.0 * tr.flFraction / pGrunt->pev->velocity.z + 0.5 );
|
||||
pBeam->SetThink( &CBeam::SUB_Remove );
|
||||
pBeam->SetNextThink( -4096.0f * tr.flFraction / pGrunt->pev->velocity.z + 0.5f );
|
||||
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ void CHornet::Spawn( void )
|
|||
// no real owner, or owner isn't a client.
|
||||
pev->dmg = gSkillData.monDmgHornet;
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
ResetSequenceInfo();
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ void CHornet::StartTrack( void )
|
|||
SetTouch( &CHornet::TrackTouch );
|
||||
SetThink( &CHornet::TrackTarget );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -176,7 +176,7 @@ void CHornet::StartDart( void )
|
|||
SetTouch( &CHornet::DartTouch );
|
||||
|
||||
SetThink(&CHornet :: SUB_Remove );
|
||||
SetNextThink( 4 );
|
||||
SetNextThink( 4.0f );
|
||||
}
|
||||
|
||||
void CHornet::IgniteTrail( void )
|
||||
|
@ -246,8 +246,8 @@ void CHornet::TrackTarget( void )
|
|||
if( gpGlobals->time > m_flStopAttack )
|
||||
{
|
||||
SetTouch( NULL );
|
||||
SetThink(&CHornet :: SUB_Remove );
|
||||
SetNextThink( 0.1 );
|
||||
SetThink(&CHornet::SUB_Remove );
|
||||
SetNextThink( 0.1f );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -265,12 +265,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();
|
||||
|
@ -278,7 +278,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 ) )
|
||||
|
@ -298,7 +298,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();
|
||||
|
@ -306,20 +306,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 )
|
||||
SetNextThink( RANDOM_FLOAT( 0.1, 0.3 ) );
|
||||
SetNextThink( 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.
|
||||
SetNextThink( 0.1 );// fixed think time
|
||||
SetNextThink( 0.1f );// fixed think time
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,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 );
|
||||
|
@ -356,8 +356,9 @@ 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;
|
||||
SetNextThink( 1.0 );
|
||||
pev->velocity = pev->velocity * 2.0f;
|
||||
SetNextThink( 1.0f );
|
||||
|
||||
// don't attack again
|
||||
m_flStopAttack = gpGlobals->time;
|
||||
}
|
||||
|
@ -382,10 +383,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;
|
||||
|
@ -424,6 +425,6 @@ void CHornet::DieTouch( CBaseEntity *pOther )
|
|||
pev->modelindex = 0;// so will disappear for the 0.1 secs we wait until NEXTTHINK gets rid
|
||||
pev->solid = SOLID_NOT;
|
||||
|
||||
SetThink(&CHornet:: SUB_Remove );
|
||||
SetNextThink( 1 );// stick around long enough for the sound to finish!
|
||||
SetThink( &CHornet::SUB_Remove );
|
||||
SetNextThink( 1.0f );// stick around long enough for the sound to finish!
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ BOOL CHgun::Deploy()
|
|||
|
||||
void CHgun::Holster( int skiplocal /* = 0 */ )
|
||||
{
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5f;
|
||||
SendWeaponAnim( HGUN_DOWN );
|
||||
|
||||
//!!!HACKHACK - can't select hornetgun if it's empty! no way to get ammo for it, either.
|
||||
|
@ -127,17 +127,17 @@ void CHgun::PrimaryAttack()
|
|||
{
|
||||
Reload();
|
||||
|
||||
if(m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
|
||||
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
#ifndef CLIENT_DLL
|
||||
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
|
||||
|
||||
CBaseEntity *pHornet = CBaseEntity::Create( "hornet", m_pPlayer->GetGunPosition( ) + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12, m_pPlayer->pev->v_angle, m_pPlayer->edict() );
|
||||
pHornet->pev->velocity = gpGlobals->v_forward * 300;
|
||||
CBaseEntity *pHornet = CBaseEntity::Create( "hornet", m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16.0f + gpGlobals->v_right * 8.0f + gpGlobals->v_up * -12.0f, m_pPlayer->pev->v_angle, m_pPlayer->edict() );
|
||||
pHornet->pev->velocity = gpGlobals->v_forward * 300.0f;
|
||||
|
||||
m_flRechargeTime = gpGlobals->time + 0.5;
|
||||
m_flRechargeTime = gpGlobals->time + 0.5f;
|
||||
#endif
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
||||
|
||||
|
@ -150,16 +150,16 @@ void CHgun::PrimaryAttack()
|
|||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, FIREMODE_TRACK, 0, 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, FIREMODE_TRACK, 0, 0, 0 );
|
||||
|
||||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.25;
|
||||
m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.25f;
|
||||
|
||||
if( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
||||
{
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25;
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f;
|
||||
}
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
|
@ -181,49 +181,49 @@ void CHgun::SecondaryAttack( void )
|
|||
|
||||
UTIL_MakeVectors( m_pPlayer->pev->v_angle );
|
||||
|
||||
vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16 + gpGlobals->v_right * 8 + gpGlobals->v_up * -12;
|
||||
vecSrc = m_pPlayer->GetGunPosition() + gpGlobals->v_forward * 16.0f + gpGlobals->v_right * 8.0f + gpGlobals->v_up * -12.0f;
|
||||
|
||||
m_iFirePhase++;
|
||||
switch( m_iFirePhase )
|
||||
{
|
||||
case 1:
|
||||
vecSrc = vecSrc + gpGlobals->v_up * 8;
|
||||
vecSrc = vecSrc + gpGlobals->v_up * 8.0f;
|
||||
break;
|
||||
case 2:
|
||||
vecSrc = vecSrc + gpGlobals->v_up * 8;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * 8;
|
||||
vecSrc = vecSrc + gpGlobals->v_up * 8.0f;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * 8.0f;
|
||||
break;
|
||||
case 3:
|
||||
vecSrc = vecSrc + gpGlobals->v_right * 8;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * 8.0f;
|
||||
break;
|
||||
case 4:
|
||||
vecSrc = vecSrc + gpGlobals->v_up * -8;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * 8;
|
||||
vecSrc = vecSrc + gpGlobals->v_up * -8.0f;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * 8.0f;
|
||||
break;
|
||||
case 5:
|
||||
vecSrc = vecSrc + gpGlobals->v_up * -8;
|
||||
vecSrc = vecSrc + gpGlobals->v_up * -8.0f;
|
||||
break;
|
||||
case 6:
|
||||
vecSrc = vecSrc + gpGlobals->v_up * -8;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * -8;
|
||||
vecSrc = vecSrc + gpGlobals->v_up * -8.0f;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * -8.0f;
|
||||
break;
|
||||
case 7:
|
||||
vecSrc = vecSrc + gpGlobals->v_right * -8;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * -8.0f;
|
||||
break;
|
||||
case 8:
|
||||
vecSrc = vecSrc + gpGlobals->v_up * 8;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * -8;
|
||||
vecSrc = vecSrc + gpGlobals->v_up * 8.0f;
|
||||
vecSrc = vecSrc + gpGlobals->v_right * -8.0f;
|
||||
m_iFirePhase = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
pHornet = CBaseEntity::Create( "hornet", vecSrc, m_pPlayer->pev->v_angle, m_pPlayer->edict() );
|
||||
pHornet->pev->velocity = gpGlobals->v_forward * 1200;
|
||||
pHornet->pev->velocity = gpGlobals->v_forward * 1200.0f;
|
||||
pHornet->pev->angles = UTIL_VecToAngles( pHornet->pev->velocity );
|
||||
|
||||
pHornet->SetThink( &CHornet::StartDart );
|
||||
|
||||
m_flRechargeTime = gpGlobals->time + 0.5;
|
||||
m_flRechargeTime = gpGlobals->time + 0.5f;
|
||||
#endif
|
||||
int flags;
|
||||
#if defined( CLIENT_WEAPONS )
|
||||
|
@ -231,7 +231,7 @@ void CHgun::SecondaryAttack( void )
|
|||
#else
|
||||
flags = 0;
|
||||
#endif
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, FIREMODE_FAST, 0, 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usHornetFire, 0.0f, g_vecZero, g_vecZero, 0.0f, 0.0f, FIREMODE_FAST, 0, 0, 0 );
|
||||
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]--;
|
||||
m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME;
|
||||
|
@ -240,8 +240,8 @@ void CHgun::SecondaryAttack( void )
|
|||
// player "shoot" animation
|
||||
m_pPlayer->SetAnimation( PLAYER_ATTACK1 );
|
||||
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.1f;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
|
||||
}
|
||||
|
||||
void CHgun::Reload( void )
|
||||
|
@ -252,7 +252,7 @@ void CHgun::Reload( void )
|
|||
while( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time )
|
||||
{
|
||||
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++;
|
||||
m_flRechargeTime += 0.5;
|
||||
m_flRechargeTime += 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,21 +264,21 @@ void CHgun::WeaponIdle( void )
|
|||
return;
|
||||
|
||||
int iAnim;
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0, 1 );
|
||||
if( flRand <= 0.75 )
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0f, 1.0f );
|
||||
if( flRand <= 0.75f )
|
||||
{
|
||||
iAnim = HGUN_IDLE1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 30.0 / 16 * ( 2 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 30.0f / 16.0f * 2.0f;
|
||||
}
|
||||
else if( flRand <= 0.875 )
|
||||
else if( flRand <= 0.875f )
|
||||
{
|
||||
iAnim = HGUN_FIDGETSWAY;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0 / 16.0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 40.0f / 16.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
iAnim = HGUN_FIDGETSHAKE;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 35.0 / 16.0;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 35.0f / 16.0f;
|
||||
}
|
||||
SendWeaponAnim( iAnim );
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ extern CGraph WorldGraph;
|
|||
// houndeye does 20 points of damage spread over a sphere 384 units in diameter, and each additional
|
||||
// squad member increases the BASE damage by 110%, per the spec.
|
||||
#define HOUNDEYE_MAX_SQUAD_SIZE 4
|
||||
#define HOUNDEYE_MAX_ATTACK_RADIUS 384
|
||||
#define HOUNDEYE_SQUAD_BONUS (float)1.1
|
||||
#define HOUNDEYE_MAX_ATTACK_RADIUS 384.0f
|
||||
#define HOUNDEYE_SQUAD_BONUS 1.1f
|
||||
|
||||
#define HOUNDEYE_EYE_FRAMES 4 // how many different switchable maps for the eye
|
||||
|
||||
|
@ -192,7 +192,7 @@ BOOL CHoundeye::FCanActiveIdle( void )
|
|||
//=========================================================
|
||||
BOOL CHoundeye::CheckRangeAttack1( float flDot, float flDist )
|
||||
{
|
||||
if( flDist <= ( HOUNDEYE_MAX_ATTACK_RADIUS * 0.5 ) && flDot >= 0.3 )
|
||||
if( flDist <= ( HOUNDEYE_MAX_ATTACK_RADIUS * 0.5f ) && flDot >= 0.3f )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -286,8 +286,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:
|
||||
|
@ -573,10 +573,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
|
||||
|
@ -594,10 +594,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
|
||||
|
@ -646,7 +646,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" ) )
|
||||
{
|
||||
|
@ -810,17 +810,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 )
|
||||
|
@ -844,7 +844,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();
|
||||
}
|
||||
|
@ -890,8 +890,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[] =
|
||||
|
@ -1087,14 +1087,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,
|
||||
|
@ -1268,13 +1268,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 );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
@ -482,7 +482,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;
|
||||
|
||||
|
@ -641,9 +641,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 );
|
||||
|
||||
|
@ -651,16 +651,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 )
|
||||
{
|
||||
|
@ -677,12 +677,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 )
|
||||
{
|
||||
|
@ -697,7 +697,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 )
|
||||
|
@ -723,8 +723,8 @@ 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;
|
||||
if (pev->waterlevel > 1 && pev->watertype != CONTENT_FOG && pev->velocity.z < 64)
|
||||
pev->velocity = pev->velocity * 0.8f;
|
||||
if( pev->waterlevel > 1 && pev->watertype != CONTENT_FOG && pev->velocity.z < 64 )
|
||||
{
|
||||
pev->velocity.z += 8;
|
||||
}
|
||||
|
@ -747,7 +747,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;
|
||||
}
|
||||
|
@ -800,7 +800,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;
|
||||
}
|
||||
|
@ -819,7 +819,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 );
|
||||
}
|
||||
|
@ -850,9 +850,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
|
||||
|
@ -880,7 +880,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 );
|
||||
|
||||
|
@ -901,15 +901,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 );
|
||||
}
|
||||
/*
|
||||
|
@ -942,10 +942,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;
|
||||
|
||||
|
@ -964,7 +964,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 )
|
||||
|
@ -988,12 +988,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;
|
||||
}
|
||||
|
@ -1004,15 +1004,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
|
||||
//
|
||||
|
@ -1029,7 +1029,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 )
|
||||
{
|
||||
|
@ -1037,7 +1037,7 @@ void CIchthyosaur::Swim()
|
|||
}
|
||||
else
|
||||
{
|
||||
if( turn < 0.0 )
|
||||
if( turn < 0.0f )
|
||||
{
|
||||
pev->angles.z -= speed;
|
||||
}
|
||||
|
@ -1065,12 +1065,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;
|
||||
|
@ -1087,7 +1087,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;
|
||||
}
|
||||
|
|
|
@ -483,8 +483,8 @@ 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())
|
||||
UTIL_TraceLine( EyePosition(), pEntity->EyePosition(), ignore_monsters, ENT( pev ), &tr );
|
||||
if( tr.flFraction == 1.0 || tr.pHit == pEntity->edict() )
|
||||
{
|
||||
if (pEntity->pev->deadflag == DEAD_DEAD)
|
||||
{
|
||||
|
@ -763,7 +763,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 );
|
||||
|
|
|
@ -99,7 +99,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;
|
||||
}
|
||||
|
@ -264,7 +264,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--;
|
||||
|
|
104
dlls/leech.cpp
104
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
|
||||
|
||||
|
@ -214,16 +214,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 );
|
||||
|
@ -264,14 +264,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 )
|
||||
|
@ -297,7 +297,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 );
|
||||
|
@ -323,7 +323,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;
|
||||
|
@ -362,12 +362,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() ) )
|
||||
{
|
||||
|
@ -385,16 +385,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;
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ void CLeech::DeadThink( void )
|
|||
}
|
||||
}
|
||||
StudioFrameAdvance();
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
// Apply damage velocity, but keep out of the walls
|
||||
if( pev->velocity.x != 0 || pev->velocity.y != 0 )
|
||||
|
@ -424,11 +424,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,15 +436,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;
|
||||
|
||||
|
@ -453,9 +453,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;
|
||||
|
@ -471,10 +471,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;
|
||||
|
@ -487,11 +487,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 )
|
||||
{
|
||||
|
@ -513,11 +513,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;
|
||||
|
@ -540,12 +540,12 @@ void CLeech::SwimThink( void )
|
|||
|
||||
if( FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) )
|
||||
{
|
||||
SetNextThink( RANDOM_FLOAT(1,1.5) );
|
||||
SetNextThink( RANDOM_FLOAT( 1.0f, 1.5f ) );
|
||||
pev->velocity = g_vecZero;
|
||||
return;
|
||||
}
|
||||
else
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
targetSpeed = LEECH_SWIM_SPEED;
|
||||
|
||||
|
@ -580,10 +580,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;
|
||||
}
|
||||
|
@ -592,7 +592,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 )
|
||||
|
@ -610,11 +610,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 )
|
||||
|
@ -629,7 +629,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;
|
||||
|
||||
|
@ -647,12 +647,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;
|
||||
|
|
|
@ -371,9 +371,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 );
|
||||
|
@ -394,11 +394,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();
|
||||
|
|
|
@ -521,7 +521,7 @@ CSound *CBaseMonster::PBestScent( void )
|
|||
//=========================================================
|
||||
void CBaseMonster::MonsterThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );// keep monster thinking.
|
||||
SetNextThink( 0.1f );// keep monster thinking.
|
||||
|
||||
RunAI();
|
||||
|
||||
|
@ -858,10 +858,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 )
|
||||
|
@ -935,7 +935,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;
|
||||
}
|
||||
|
@ -947,7 +947,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;
|
||||
}
|
||||
|
@ -960,7 +960,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;
|
||||
}
|
||||
|
@ -972,7 +972,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;
|
||||
}
|
||||
|
@ -1070,7 +1070,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();
|
||||
|
@ -1107,7 +1107,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
|
||||
{
|
||||
|
@ -1143,7 +1143,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();
|
||||
|
@ -1365,7 +1365,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;
|
||||
}
|
||||
|
@ -1483,7 +1483,7 @@ void CBaseMonster::AdvanceRoute( float distance )
|
|||
}
|
||||
else // At goal!!!
|
||||
{
|
||||
if( distance < m_flGroundSpeed * 0.2 /* FIX */ )
|
||||
if( distance < m_flGroundSpeed * 0.2f /* FIX */ )
|
||||
{
|
||||
MovementComplete();
|
||||
}
|
||||
|
@ -1617,13 +1617,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();
|
||||
|
||||
|
@ -1861,7 +1861,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 )
|
||||
|
@ -1896,10 +1896,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
|
||||
|
@ -1962,10 +1962,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;
|
||||
}
|
||||
|
@ -2013,14 +2013,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 );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
SetUse( &CBaseMonster::MonsterUse );
|
||||
}
|
||||
|
||||
|
@ -2120,7 +2120,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 );
|
||||
AbsoluteNextThink( m_fNextThink + RANDOM_FLOAT(0.1, 0.4) ); // spread think times.
|
||||
AbsoluteNextThink( m_fNextThink + 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
|
||||
|
@ -2234,12 +2234,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 )
|
||||
|
@ -2284,7 +2284,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 ) )
|
||||
|
@ -2338,12 +2338,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 )
|
||||
|
@ -2382,7 +2382,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 ) )
|
||||
|
@ -2836,7 +2836,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!
|
||||
|
@ -2894,7 +2894,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. " );
|
||||
}
|
||||
|
@ -2919,7 +2919,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 )
|
||||
|
@ -3151,7 +3151,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 )
|
||||
{
|
||||
|
@ -3165,7 +3165,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 )
|
||||
{
|
||||
|
@ -3204,7 +3204,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;
|
||||
}
|
||||
|
@ -3257,7 +3257,7 @@ void CBaseMonster::CorpseFallThink( void )
|
|||
UTIL_SetOrigin( this, pev->origin );// link into world.
|
||||
}
|
||||
else
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
// Call after animation/pose is set up
|
||||
|
@ -3282,7 +3282,7 @@ void CBaseMonster::MonsterInitDead( void )
|
|||
// Setup health counters, etc.
|
||||
BecomeDead();
|
||||
SetThink( &CBaseMonster::CorpseFallThink );
|
||||
SetNextThink( 0.5 );
|
||||
SetNextThink( 0.5f );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
|
30
dlls/mp5.cpp
30
dlls/mp5.cpp
|
@ -126,14 +126,14 @@ void CMP5::PrimaryAttack()
|
|||
if (m_pPlayer->pev->waterlevel == 3 && m_pPlayer->pev->watertype > CONTENT_FLYFIELD)
|
||||
{
|
||||
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, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
|
||||
PLAYBACK_EVENT_FULL( flags, m_pPlayer->edict(), m_usMP5, 0.0f, g_vecZero, g_vecZero, vecDir.x, vecDir.y, 0, 0, 0, 0 );
|
||||
|
||||
if( !m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
|
||||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
||||
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.1 );
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay( 0.1f );
|
||||
|
||||
if( m_flNextPrimaryAttack < UTIL_WeaponTimeBase() )
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1;
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.1f;
|
||||
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ void CMP5::SecondaryAttack( void )
|
|||
if (m_pPlayer->pev->waterlevel == 3 && m_pPlayer->pev->watertype > CONTENT_FLYFIELD)
|
||||
{
|
||||
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 )
|
||||
|
|
|
@ -280,6 +280,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.
|
||||
|
@ -1292,7 +1297,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 );
|
||||
|
@ -1301,7 +1307,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 );
|
||||
|
@ -1457,7 +1464,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 );
|
||||
|
@ -1592,13 +1600,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 );
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ void CNihilanth::Spawn( void )
|
|||
InitBoneControllers();
|
||||
|
||||
SetThink( &CNihilanth::StartupThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
m_vecDesired = Vector( 1, 0, 0 );
|
||||
m_posDesired = Vector( pev->origin.x, pev->origin.y, 512 );
|
||||
|
@ -398,13 +398,13 @@ void CNihilanth::DeathSound( void )
|
|||
void CNihilanth::NullThink( void )
|
||||
{
|
||||
StudioFrameAdvance();
|
||||
SetNextThink( 0.5 );
|
||||
SetNextThink( 0.5f );
|
||||
}
|
||||
|
||||
void CNihilanth::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
SetThink( &CNihilanth::HuntThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
SetUse( &CNihilanth::CommandUse );
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,7 @@ void CNihilanth::StartupThink( void )
|
|||
|
||||
SetThink( &CNihilanth::HuntThink );
|
||||
SetUse( &CNihilanth::CommandUse );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
void CNihilanth::Killed( entvars_t *pevAttacker, int iGib )
|
||||
|
@ -446,7 +446,7 @@ void CNihilanth::Killed( entvars_t *pevAttacker, int iGib )
|
|||
|
||||
void CNihilanth::DyingThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
DispatchAnimEvents();
|
||||
StudioFrameAdvance();
|
||||
|
||||
|
@ -501,13 +501,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:
|
||||
|
@ -558,7 +558,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;
|
||||
|
@ -626,7 +626,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 );
|
||||
|
@ -635,10 +635,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -705,8 +705,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();
|
||||
}
|
||||
}
|
||||
|
@ -731,7 +731,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;
|
||||
|
@ -773,13 +773,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 );
|
||||
|
@ -815,7 +815,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" );
|
||||
}
|
||||
|
@ -827,7 +827,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 );
|
||||
|
@ -855,7 +855,7 @@ void CNihilanth::NextActivity()
|
|||
|
||||
void CNihilanth::HuntThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
DispatchAnimEvents();
|
||||
StudioFrameAdvance();
|
||||
|
||||
|
@ -884,7 +884,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
|
||||
|
@ -892,7 +892,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;
|
||||
|
@ -940,7 +940,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;
|
||||
|
@ -959,12 +959,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 )
|
||||
|
@ -977,8 +977,8 @@ void CNihilanth::Flight( void )
|
|||
m_flForce -= 10;
|
||||
}
|
||||
|
||||
UTIL_SetOrigin( this, pev->origin + m_velocity * 0.1 );
|
||||
pev->angles = pev->angles + m_avelocity * 0.1;
|
||||
UTIL_SetOrigin( this, 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 );
|
||||
}
|
||||
|
@ -1102,14 +1102,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 );
|
||||
|
@ -1164,7 +1164,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;
|
||||
|
@ -1201,7 +1201,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;
|
||||
|
@ -1312,7 +1312,7 @@ void CNihilanthHVR::Spawn( void )
|
|||
|
||||
pev->rendermode = kRenderTransAdd;
|
||||
pev->renderamt = 255;
|
||||
pev->scale = 3.0;
|
||||
pev->scale = 3.0f;
|
||||
}
|
||||
|
||||
void CNihilanthHVR::Precache( void )
|
||||
|
@ -1341,7 +1341,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;
|
||||
|
||||
|
@ -1350,7 +1350,7 @@ void CNihilanthHVR::CircleInit( CBaseEntity *pTarget )
|
|||
|
||||
SetThink( &CNihilanthHVR::HoverThink );
|
||||
SetTouch( &CNihilanthHVR::BounceTouch );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
m_hTargetEnt = pTarget;
|
||||
}
|
||||
|
@ -1372,7 +1372,7 @@ CBaseEntity *CNihilanthHVR::RandomClassname( const char *szName )
|
|||
|
||||
void CNihilanthHVR::HoverThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
if( m_hTargetEnt != 0 )
|
||||
{
|
||||
|
@ -1441,21 +1441,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 );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "debris/zap4.wav", 1, ATTN_NORM, 0, 100 );
|
||||
}
|
||||
|
||||
void CNihilanthHVR::ZapThink( void )
|
||||
{
|
||||
SetNextThink( 0.05 );
|
||||
SetNextThink( 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 )
|
||||
|
@ -1467,7 +1467,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() );
|
||||
|
@ -1509,7 +1509,7 @@ void CNihilanthHVR::ZapThink( void )
|
|||
|
||||
SetTouch( NULL );
|
||||
UTIL_Remove( this );
|
||||
SetNextThink( 0.2 );
|
||||
SetNextThink( 0.2f );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1548,7 +1548,7 @@ void CNihilanthHVR::ZapTouch( CBaseEntity *pOther )
|
|||
|
||||
SetTouch( NULL );
|
||||
UTIL_Remove( this );
|
||||
SetNextThink( 0.2 );
|
||||
SetNextThink( 0.2f );
|
||||
}
|
||||
|
||||
void CNihilanthHVR::TeleportInit( CNihilanth *pOwner, CBaseEntity *pEnemy, CBaseEntity *pTarget, CBaseEntity *pTouch )
|
||||
|
@ -1559,7 +1559,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" );
|
||||
|
||||
|
@ -1570,7 +1570,7 @@ void CNihilanthHVR::TeleportInit( CNihilanth *pOwner, CBaseEntity *pEnemy, CBase
|
|||
|
||||
SetThink( &CNihilanthHVR::TeleportThink );
|
||||
SetTouch( &CNihilanthHVR::TeleportTouch );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
EMIT_SOUND_DYN( edict(), CHAN_WEAPON, "x/x_teleattack1.wav", 1, 0.2, 0, 100 );
|
||||
}
|
||||
|
@ -1583,7 +1583,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" );
|
||||
|
||||
|
@ -1592,7 +1592,7 @@ void CNihilanthHVR::GreenBallInit()
|
|||
|
||||
void CNihilanthHVR::TeleportThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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 )
|
||||
|
@ -1682,13 +1682,13 @@ void CNihilanthHVR::TeleportTouch( CBaseEntity *pOther )
|
|||
|
||||
void CNihilanthHVR::DissipateThink( void )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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 )
|
||||
{
|
||||
|
@ -1824,7 +1824,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();
|
||||
}
|
||||
|
|
|
@ -670,7 +670,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;
|
||||
|
@ -712,8 +712,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;
|
||||
|
@ -722,7 +722,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;
|
||||
|
@ -840,7 +840,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;
|
||||
|
@ -910,7 +910,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.
|
||||
|
@ -1279,7 +1279,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
|
||||
|
@ -1445,14 +1445,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 )];
|
||||
|
@ -1518,7 +1518,7 @@ void CTestHull::Spawn( entvars_t *pevMasterNode )
|
|||
else
|
||||
{
|
||||
SetThink( &CTestHull::DropDelay );
|
||||
SetNextThink( 1 );
|
||||
SetNextThink( 1.0f );
|
||||
}
|
||||
|
||||
// Make this invisible
|
||||
|
@ -1539,7 +1539,7 @@ void CTestHull::DropDelay( void )
|
|||
|
||||
SetThink( &CTestHull::CallBuildNodeGraph );
|
||||
|
||||
SetNextThink( 1 );
|
||||
SetNextThink( 1.0f );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -1625,7 +1625,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 );
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
extern BOOL gTouchDisabled;
|
||||
|
@ -1739,7 +1739,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" );
|
||||
|
@ -1961,7 +1961,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;
|
||||
}
|
||||
|
@ -3519,7 +3519,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 )
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ void COsprey::Spawn( void )
|
|||
|
||||
if( !( pev->spawnflags & SF_WAITFORTRIGGER ) )
|
||||
{
|
||||
SetNextThink( 1.0 );
|
||||
SetNextThink( 1.0f );
|
||||
}
|
||||
|
||||
m_pos2 = pev->origin;
|
||||
|
@ -208,7 +208,7 @@ void COsprey::Precache( void )
|
|||
|
||||
void COsprey::CommandUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
void COsprey::FindAllThink( void )
|
||||
|
@ -235,7 +235,7 @@ void COsprey::FindAllThink( void )
|
|||
// return;
|
||||
}
|
||||
SetThink( &COsprey::FlyThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
m_startTime = gpGlobals->time;
|
||||
}
|
||||
|
||||
|
@ -250,8 +250,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 );
|
||||
|
@ -266,7 +266,7 @@ void COsprey::DeployThink( void )
|
|||
m_hRepel[3] = MakeGrunt( vecSrc );
|
||||
|
||||
SetThink( &COsprey::HoverThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
BOOL COsprey::HasDead()
|
||||
|
@ -291,7 +291,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;
|
||||
|
||||
|
@ -314,7 +314,7 @@ CBaseMonster *COsprey::MakeGrunt( Vector vecSrc )
|
|||
pBeam->SetFlags( BEAM_FSOLID );
|
||||
pBeam->SetColor( 255, 255, 255 );
|
||||
pBeam->SetThink(&CBeam:: SUB_Remove );
|
||||
pBeam->SetNextThink( -4096.0 * tr.flFraction / pGrunt->pev->velocity.z + 0.5 );
|
||||
pBeam->SetNextThink( -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];
|
||||
|
@ -343,7 +343,7 @@ void COsprey::HoverThink( void )
|
|||
SetThink( &COsprey::FlyThink );
|
||||
}
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
UTIL_MakeAimVectors( pev->angles );
|
||||
ShowDamage();
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ void COsprey::UpdateGoal()
|
|||
m_vel2 = gpGlobals->v_forward * pev->speed; //LRC
|
||||
|
||||
m_startTime = m_startTime + m_dTime;
|
||||
m_dTime = 2.0 * (m_pos1 - m_pos2).Length() / (m_vel1.Length() + pev->speed);
|
||||
m_dTime = 2.0f * ( m_pos1 - m_pos2 ).Length() / ( m_vel1.Length() + pev->speed );
|
||||
|
||||
//ALERT(at_console, "osprey m_dTime = %f / %f + %f\n", (m_pos1 - m_pos2).Length(), m_vel1.Length(), m_pGoalEnt->pev->speed);
|
||||
|
||||
|
@ -393,7 +393,7 @@ void COsprey::UpdateGoal()
|
|||
void COsprey::FlyThink( void )
|
||||
{
|
||||
StudioFrameAdvance();
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
if( m_pGoalEnt == NULL && !FStringNull( pev->target) )// this monster has a target
|
||||
{
|
||||
|
@ -422,13 +422,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( this, pos );
|
||||
pev->angles = ang;
|
||||
|
@ -437,18 +437,18 @@ void COsprey::Flight()
|
|||
|
||||
// float flSpeed = DotProduct( gpGlobals->v_forward, pev->velocity );
|
||||
|
||||
m_flIdealtilt = (160 - flSpeed) / 10.0;
|
||||
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;
|
||||
}
|
||||
|
@ -471,7 +471,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;
|
||||
|
@ -495,7 +495,7 @@ void COsprey::Flight()
|
|||
|
||||
void COsprey::HitTouch( CBaseEntity *pOther )
|
||||
{
|
||||
SetNextThink( 2.0 );
|
||||
SetNextThink( 2.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -517,7 +517,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" );
|
||||
|
@ -525,11 +525,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 );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 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 )
|
||||
|
@ -547,9 +547,9 @@ void COsprey::CrashTouch( CBaseEntity *pOther )
|
|||
void COsprey::DyingThink( void )
|
||||
{
|
||||
StudioFrameAdvance();
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
|
||||
pev->avelocity = pev->avelocity * 1.02;
|
||||
pev->avelocity = pev->avelocity * 1.02f;
|
||||
|
||||
// still falling?
|
||||
if( m_startTime > gpGlobals->time )
|
||||
|
@ -557,14 +557,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
|
||||
|
@ -574,15 +574,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);
|
||||
|
||||
|
@ -619,12 +619,12 @@ void COsprey::DyingThink( void )
|
|||
|
||||
// don't stop it we touch a entity
|
||||
pev->flags &= ~FL_ONGROUND;
|
||||
SetNextThink( 0.2 );
|
||||
SetNextThink( 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 );
|
||||
|
@ -683,12 +683,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);
|
||||
|
||||
|
@ -705,7 +705,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 );
|
||||
|
@ -772,7 +772,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 )
|
||||
|
@ -781,7 +781,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
|
||||
|
|
|
@ -454,8 +454,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;
|
||||
|
@ -713,9 +712,9 @@ void CFuncPlatRot::RotMove( Vector &destAngle, float time )
|
|||
Vector vecDestDelta = destAngle - pev->angles;
|
||||
|
||||
// Travel time is so short, we're practically there already; make it so.
|
||||
if( time >= 0.1 )
|
||||
if( time >= 0.1f )
|
||||
{
|
||||
UTIL_SetAvelocity(this, vecDestDelta / time);
|
||||
UTIL_SetAvelocity( this, vecDestDelta / time );
|
||||
//pev->avelocity = vecDestDelta / time;
|
||||
}
|
||||
else
|
||||
|
@ -809,7 +808,7 @@ void CFuncTrain::Blocked( CBaseEntity *pOther )
|
|||
if( gpGlobals->time < m_flActivateFinished )
|
||||
return;
|
||||
|
||||
m_flActivateFinished = gpGlobals->time + 0.5;
|
||||
m_flActivateFinished = gpGlobals->time + 0.5f;
|
||||
|
||||
if (pev->dmg)
|
||||
pOther->TakeDamage( pev, pev, pev->dmg, DMG_CRUSH );
|
||||
|
@ -983,7 +982,7 @@ void CFuncTrain::Next( void )
|
|||
if (pev->spawnflags & SF_TRAIN_SETORIGIN)
|
||||
distance = (pev->origin - pTarg->pev->origin).Length();
|
||||
else
|
||||
distance = (pev->origin - (pTarg->pev->origin - (pev->mins + pev->maxs) * 0.5)).Length();
|
||||
distance = (pev->origin - (pTarg->pev->origin - (pev->mins + pev->maxs) * 0.5f)).Length();
|
||||
|
||||
pev->speed = distance / m_pevCurrentTarget->speed;
|
||||
ALERT( at_aiconsole, "Train %s speed to %4.2f (timed)\n", STRING(pev->targetname), pev->speed );
|
||||
|
@ -1017,14 +1016,14 @@ void CFuncTrain::Next( void )
|
|||
if (pev->spawnflags & SF_TRAIN_SETORIGIN)
|
||||
UTIL_AssignOrigin(this, pTarg->pev->origin - m_pMoveWith->pev->origin );
|
||||
else
|
||||
UTIL_AssignOrigin(this, pTarg->pev->origin - (pev->mins + pev->maxs) * 0.5 - m_pMoveWith->pev->origin );
|
||||
UTIL_AssignOrigin(this, pTarg->pev->origin - (pev->mins + pev->maxs) * 0.5f - m_pMoveWith->pev->origin );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pev->spawnflags & SF_TRAIN_SETORIGIN)
|
||||
UTIL_AssignOrigin(this, pTarg->pev->origin );
|
||||
else
|
||||
UTIL_AssignOrigin(this, pTarg->pev->origin - (pev->mins + pev->maxs) * 0.5 );
|
||||
UTIL_AssignOrigin(this, pTarg->pev->origin - (pev->mins + pev->maxs) * 0.5f );
|
||||
}
|
||||
|
||||
if (pTarg->pev->armorvalue) //LRC - "teleport and turn to face" means you set an angle as you teleport.
|
||||
|
@ -1068,19 +1067,19 @@ void CFuncTrain::Next( void )
|
|||
|
||||
m_iState = STATE_ON;
|
||||
|
||||
if (m_pMoveWith)
|
||||
if( m_pMoveWith )
|
||||
{
|
||||
if (pev->spawnflags & SF_TRAIN_SETORIGIN)
|
||||
if( pev->spawnflags & SF_TRAIN_SETORIGIN )
|
||||
LinearMove( pTarg->pev->origin - m_pMoveWith->pev->origin, pev->speed );
|
||||
else
|
||||
LinearMove (pTarg->pev->origin - (pev->mins + pev->maxs)* 0.5 - m_pMoveWith->pev->origin, pev->speed);
|
||||
LinearMove( pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5 - m_pMoveWith->pev->origin, pev->speed );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pev->spawnflags & SF_TRAIN_SETORIGIN)
|
||||
if( pev->spawnflags & SF_TRAIN_SETORIGIN )
|
||||
LinearMove( pTarg->pev->origin, pev->speed );
|
||||
else
|
||||
LinearMove( pTarg->pev->origin - ( pev->mins + pev->maxs )* 0.5, pev->speed );
|
||||
LinearMove( pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5f, pev->speed );
|
||||
}
|
||||
|
||||
// ALERT(at_console, "Next: LMove done\n");
|
||||
|
@ -1133,11 +1132,11 @@ void CFuncTrain :: PostSpawn( void )
|
|||
UTIL_AssignOrigin (this, pevTarg->origin - (pev->mins + pev->maxs) * 0.5 );
|
||||
}
|
||||
|
||||
if ( FStringNull(pev->targetname) || pev->spawnflags & SF_TRAIN_START_ON)
|
||||
if( FStringNull( pev->targetname ) || pev->spawnflags & SF_TRAIN_START_ON )
|
||||
{ // not triggered, so start immediately
|
||||
SetNextThink( 1.5 );
|
||||
SetNextThink( 1.5f );
|
||||
// SetThink( Next );
|
||||
SetThink(&CFuncTrain :: ThinkDoNext );
|
||||
SetThink( &CFuncTrain::ThinkDoNext );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1220,7 +1219,7 @@ void CFuncTrain::Spawn( void )
|
|||
m_iState = STATE_OFF;
|
||||
|
||||
if( m_volume == 0 )
|
||||
m_volume = 0.85;
|
||||
m_volume = 0.85f;
|
||||
}
|
||||
|
||||
//LRC - making movement sounds which continue after a game is loaded.
|
||||
|
@ -1305,7 +1304,7 @@ void CFuncTrain::OverrideReset( void )
|
|||
else // Keep moving for 0.1 secs, then find path_corner again and restart
|
||||
{
|
||||
SetThink( &CFuncTrain::Next );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1457,7 +1456,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" ) )
|
||||
|
@ -1498,7 +1497,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
|
||||
|
@ -1536,7 +1535,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 )
|
||||
|
@ -1549,14 +1548,14 @@ void CFuncTrackTrain::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
|||
pev->speed = m_speed * delta;
|
||||
|
||||
if ( pev->spawnflags & SF_TRACKTRAIN_AVEL_GEARS )
|
||||
{
|
||||
{
|
||||
UTIL_SetAvelocity(this, m_vecMasterAvel * delta);
|
||||
//pev->avelocity = m_vecMasterAvel * delta; //LRC
|
||||
}
|
||||
|
||||
PostponeNext();
|
||||
ALERT( at_aiconsole, "TRAIN(%s), speed to %.2f\n", STRING(pev->targetname), pev->speed );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define TRAIN_STARTPITCH 60
|
||||
|
@ -1624,8 +1623,8 @@ 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;
|
||||
|
||||
|
@ -1684,7 +1683,7 @@ void CFuncTrackTrain :: DesiredAction( void ) // 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;
|
||||
|
||||
UTIL_SetVelocity( this, (nextPos - pev->origin) * 10 ); //LRC
|
||||
|
@ -2039,7 +2038,7 @@ void CFuncTrackTrain::Find( void )
|
|||
UTIL_AssignOrigin ( this, nextPos ); //LRC
|
||||
// ALERT(at_console, "Train Find; origin %f %f %f\n", pev->origin.x, pev->origin.y, pev->origin.z);
|
||||
//UTIL_SetOrigin( this, nextPos );
|
||||
NextThink( 0.1, FALSE );
|
||||
NextThink( 0.1f, FALSE );
|
||||
// NextThink( 8, FALSE ); //LRC - What was this for?!
|
||||
// SetThink( Next );
|
||||
SetThink(&CFuncTrackTrain :: PostponeNext );
|
||||
|
@ -2090,14 +2089,14 @@ void CFuncTrackTrain::NearestPath( void )
|
|||
|
||||
if( pev->speed != 0 )
|
||||
{
|
||||
NextThink( 0.1, FALSE );
|
||||
SetThink(&CFuncTrackTrain :: PostponeNext );
|
||||
NextThink( 0.1f, FALSE );
|
||||
SetThink( &CFuncTrackTrain::PostponeNext );
|
||||
}
|
||||
}
|
||||
|
||||
void CFuncTrackTrain::OverrideReset( void )
|
||||
{
|
||||
NextThink( 0.1, FALSE );
|
||||
NextThink( 0.1f, FALSE );
|
||||
SetThink( &CFuncTrackTrain::NearestPath );
|
||||
}
|
||||
|
||||
|
@ -2273,7 +2272,7 @@ void CFuncTrackChange::Spawn( void )
|
|||
}
|
||||
|
||||
EnableUse();
|
||||
pev->nextthink = pev->ltime + 2.0;
|
||||
pev->nextthink = pev->ltime + 2.0f;
|
||||
SetThink( &CFuncTrackChange::Find );
|
||||
Precache();
|
||||
}
|
||||
|
@ -2320,7 +2319,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 );
|
||||
}
|
||||
|
||||
|
@ -2341,7 +2340,7 @@ void CFuncTrackChange::Find( void )
|
|||
if ( pTarget && FClassnameIs(pTarget->pev, "func_tracktrain"))
|
||||
{
|
||||
m_train = (CFuncTrackTrain*)pTarget;
|
||||
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 );
|
||||
|
@ -2426,7 +2425,7 @@ void CFuncTrackChange::UpdateTrain( Vector &dest )
|
|||
local.z = DotProduct( offset, gpGlobals->v_up );
|
||||
|
||||
local = local - offset;
|
||||
m_train->pev->velocity = vel + (local * (1.0/time));
|
||||
m_train->pev->velocity = vel + ( local * ( 1.0f/ time ) );
|
||||
|
||||
// ALERT(at_console, "set trainvel %f %f %f\n", m_train->pev->velocity.x, m_train->pev->velocity.y, m_train->pev->velocity.z);
|
||||
}
|
||||
|
@ -2741,7 +2740,7 @@ void CGunTarget::Spawn( void )
|
|||
if( pev->spawnflags & FGUNTARGET_START_ON )
|
||||
{
|
||||
SetThink( &CGunTarget::Start );
|
||||
SetNextThink( 0.3 );
|
||||
SetNextThink( 0.3f );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2754,7 +2753,7 @@ void CGunTarget::Activate( void )
|
|||
if( pTarg )
|
||||
{
|
||||
m_hTargetEnt = pTarg;
|
||||
UTIL_SetOrigin( this, pTarg->pev->origin - (pev->mins + pev->maxs) * 0.5 );
|
||||
UTIL_SetOrigin( this, pTarg->pev->origin - ( pev->mins + pev->maxs ) * 0.5f );
|
||||
}
|
||||
CBaseMonster::Activate();
|
||||
}
|
||||
|
@ -2777,7 +2776,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 )
|
||||
|
|
129
dlls/player.cpp
129
dlls/player.cpp
|
@ -69,8 +69,8 @@ extern CGraph WorldGraph;
|
|||
#define TRAIN_FAST 0x04
|
||||
#define TRAIN_BACK 0x05
|
||||
|
||||
#define FLASH_DRAIN_TIME 0.12 //100 units/12 seconds
|
||||
#define FLASH_CHARGE_TIME 0.3 // 100 units/3 seconds (seconds per unit)
|
||||
#define FLASH_DRAIN_TIME 0.12f //100 units/12 seconds
|
||||
#define FLASH_CHARGE_TIME 0.3f // 100 units/3 seconds (seconds per unit)
|
||||
|
||||
#ifdef XENWARRIOR
|
||||
float g_fEnvFadeTime = 0; // flashlight can't be used until this time expires.
|
||||
|
@ -270,11 +270,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 );
|
||||
|
@ -285,7 +285,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
|
||||
|
@ -342,15 +342,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;
|
||||
|
@ -1062,7 +1062,7 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
|
|||
pev->angles.z = 0;
|
||||
|
||||
SetThink( &CBasePlayer::PlayerDeathThink );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
// Set the activity based on an event or current state
|
||||
|
@ -1879,7 +1879,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 ) )
|
||||
{
|
||||
|
@ -1897,7 +1897,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 )
|
||||
|
@ -2029,7 +2029,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 ) )
|
||||
|
@ -2182,7 +2182,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;
|
||||
|
@ -2336,7 +2336,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 )
|
||||
{
|
||||
|
@ -2373,8 +2373,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()
|
||||
{
|
||||
|
@ -2792,23 +2792,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 );
|
||||
}*/
|
||||
}
|
||||
|
||||
|
@ -2818,23 +2818,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;
|
||||
|
@ -2938,7 +2938,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 ) )
|
||||
|
@ -2979,8 +2979,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;
|
||||
|
@ -2994,12 +2994,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();
|
||||
|
@ -3052,6 +3052,8 @@ void CBasePlayer::Spawn( void )
|
|||
|
||||
m_flNextChatTime = gpGlobals->time;
|
||||
|
||||
m_iAutoWepSwitch = 1;
|
||||
|
||||
g_pGameRules->PlayerSpawn( this );
|
||||
}
|
||||
|
||||
|
@ -3356,7 +3358,7 @@ void CSprayCan::Spawn( entvars_t *pevOwner )
|
|||
pev->owner = ENT( pevOwner );
|
||||
pev->frame = 0;
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "player/sprayer.wav", 1, ATTN_NORM );
|
||||
}
|
||||
|
||||
|
@ -3395,7 +3397,7 @@ void CSprayCan::Think( void )
|
|||
UTIL_Remove( this );
|
||||
}
|
||||
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
class CBloodSplat : public CBaseEntity
|
||||
|
@ -3412,7 +3414,7 @@ void CBloodSplat::Spawn( entvars_t *pevOwner )
|
|||
pev->owner = ENT( pevOwner );
|
||||
|
||||
SetThink( &CBloodSplat::Spray );
|
||||
SetNextThink( 0.1 );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
void CBloodSplat::Spray( void )
|
||||
|
@ -3426,8 +3428,8 @@ void CBloodSplat::Spray( void )
|
|||
|
||||
UTIL_BloodDecalTrace( &tr, BLOOD_COLOR_RED );
|
||||
}
|
||||
SetThink(&CBloodSplat:: SUB_Remove );
|
||||
SetNextThink( 0.1 );
|
||||
SetThink( &CBloodSplat::SUB_Remove );
|
||||
SetNextThink( 0.1f );
|
||||
}
|
||||
|
||||
//==============================================
|
||||
|
@ -3456,7 +3458,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;
|
||||
|
@ -3619,7 +3621,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;
|
||||
|
@ -3645,7 +3647,7 @@ void CBasePlayer::ImpulseCommands()
|
|||
void CBasePlayer::CheatImpulseCommands( int iImpulse )
|
||||
{
|
||||
#if !defined( HLDEMO_BUILD )
|
||||
if( g_flWeaponCheat == 0.0 )
|
||||
if( g_flWeaponCheat == 0.0f )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -3803,7 +3805,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 );
|
||||
|
@ -4353,7 +4355,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.
|
||||
|
@ -4459,6 +4461,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 )
|
||||
|
@ -4497,7 +4511,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!
|
||||
|
@ -4540,11 +4554,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;
|
||||
|
@ -4642,16 +4656,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;
|
||||
|
@ -4730,7 +4744,7 @@ int CBasePlayer::GetCustomDecalFrames( void )
|
|||
//=========================================================
|
||||
void CBasePlayer::DropPlayerItem( const char *pszItemName )
|
||||
{
|
||||
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.
|
||||
|
@ -5222,8 +5236,7 @@ void CInfoIntermission::Spawn( void )
|
|||
pev->effects = EF_NODRAW;
|
||||
pev->v_angle = g_vecZero;
|
||||
|
||||
SetNextThink( 2 );// let targets spawn!
|
||||
|
||||
SetNextThink( 2.0f );// let targets spawn!
|
||||
}
|
||||
|
||||
void CInfoIntermission::Think( void )
|
||||
|
|
|
@ -333,7 +333,7 @@ public:
|
|||
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];
|
||||
|
@ -342,8 +342,12 @@ 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.
|
||||
|
|
|
@ -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 && m_pPlayer->pev->watertype > CONTENT_FLYFIELD)
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15f;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ void CPython::PrimaryAttack()
|
|||
else
|
||||
{
|
||||
PlayEmptySound();
|
||||
m_flNextPrimaryAttack = 0.15;
|
||||
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.15f;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -206,8 +206,8 @@ void CPython::PrimaryAttack()
|
|||
// HEV suit - indicate out of ammo condition
|
||||
m_pPlayer->SetSuitUpdate( "!HEV_AMO0", FALSE, 0 );
|
||||
|
||||
m_flNextPrimaryAttack = 0.75;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
|
||||
m_flNextPrimaryAttack = 0.75f;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10.0f, 15.0f );
|
||||
}
|
||||
|
||||
void CPython::Reload( void )
|
||||
|
@ -227,9 +227,9 @@ void CPython::Reload( void )
|
|||
#else
|
||||
bUseScope = g_pGameRules->IsMultiplayer();
|
||||
#endif
|
||||
if( DefaultReload( PYTHON_MAX_CLIP, PYTHON_RELOAD, 2.0, bUseScope ) )
|
||||
if( DefaultReload( PYTHON_MAX_CLIP, PYTHON_RELOAD, 2.0f, bUseScope ) )
|
||||
{
|
||||
m_flSoundDelay = 1.5;
|
||||
m_flSoundDelay = 1.5f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,8 +242,8 @@ void CPython::WeaponIdle( void )
|
|||
// ALERT( at_console, "%.2f\n", gpGlobals->time - m_flSoundDelay );
|
||||
if( m_flSoundDelay != 0 && m_flSoundDelay <= UTIL_WeaponTimeBase() )
|
||||
{
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/357_reload1.wav", RANDOM_FLOAT( 0.8, 0.9 ), ATTN_NORM );
|
||||
m_flSoundDelay = 0;
|
||||
EMIT_SOUND( ENT( m_pPlayer->pev ), CHAN_WEAPON, "weapons/357_reload1.wav", RANDOM_FLOAT( 0.8f, 0.9f ), ATTN_NORM );
|
||||
m_flSoundDelay = 0.0f;
|
||||
}
|
||||
|
||||
if( m_flTimeWeaponIdle > UTIL_WeaponTimeBase() )
|
||||
|
@ -251,25 +251,25 @@ void CPython::WeaponIdle( void )
|
|||
|
||||
int iAnim;
|
||||
float flRand = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.0f, 1.0f );
|
||||
if( flRand <= 0.5 )
|
||||
if( flRand <= 0.5f )
|
||||
{
|
||||
iAnim = PYTHON_IDLE1;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 70.0 / 30.0 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 70.0f / 30.0f );
|
||||
}
|
||||
else if( flRand <= 0.7 )
|
||||
else if( flRand <= 0.7f )
|
||||
{
|
||||
iAnim = PYTHON_IDLE2;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 60.0 / 30.0 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 60.0f / 30.0f );
|
||||
}
|
||||
else if( flRand <= 0.9 )
|
||||
else if( flRand <= 0.9f )
|
||||
{
|
||||
iAnim = PYTHON_IDLE3;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 88.0 / 30.0 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 88.0f / 30.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
iAnim = PYTHON_FIDGET;
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 170.0 / 30.0 );
|
||||
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + ( 170.0f / 30.0f );
|
||||
}
|
||||
|
||||
int bUseScope = FALSE;
|
||||
|
|
|
@ -194,9 +194,9 @@ void CRoach::Killed( entvars_t *pevAttacker, int iGib )
|
|||
void CRoach::MonsterThink( void )
|
||||
{
|
||||
if( FNullEnt( FIND_CLIENT_IN_PVS( edict() ) ) )
|
||||
SetNextThink( RANDOM_FLOAT(1,1.5) );
|
||||
SetNextThink( RANDOM_FLOAT( 1.0f, 1.5f ) );
|
||||
else
|
||||
SetNextThink( 0.1 );// keep monster thinking
|
||||
SetNextThink( 0.1f );// keep monster thinking
|
||||
|
||||
float flInterval = StudioFrameAdvance(); // animate
|
||||
|
||||
|
@ -268,7 +268,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 );
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue