|
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
|
01-14-2011
, 18:56
Re: Module: Orpheu2.3a
|
#649
|
May I kindly ask for code to disable the minimum speed check for playing footsteps ?
Here's the HLSDK code:
Quote:
void PM_UpdateStepSound( void )
{
int fWalking;
float fvol;
vec3_t knee;
vec3_t feet;
vec3_t center;
float height;
float speed;
float velrun;
float velwalk;
float flduck;
int fLadder;
int step;
if ( pmove->flTimeStepSound > 0 )
return;
if ( pmove->flags & FL_FROZEN )
return;
PM_CatagorizeTextureType();
speed = Length( pmove->velocity );
// determine if we are on a ladder
fLadder = ( pmove->movetype == MOVETYPE_FLY );// IsOnLadder();
// UNDONE: need defined numbers for run, walk, crouch, crouch run velocities!!!!
if ( ( pmove->flags & FL_DUCKING) || fLadder )
{
velwalk = 60; // These constants should be based on cl_movespeedkey * cl_forwardspeed somehow
velrun = 80; // UNDONE: Move walking to server
flduck = 100;
}
else
{
velwalk = 120;
velrun = 210;
flduck = 0;
}
// If we're on a ladder or on the ground, and we're moving fast enough,
// play step sound. Also, if pmove->flTimeStepSound is zero, get the new
// sound right away - we just started moving in new level.
if ( (fLadder || ( pmove->onground != -1 ) ) &&
( Length( pmove->velocity ) > 0.0 ) &&
( speed >= velwalk || !pmove->flTimeStepSound ) )
{
fWalking = speed < velrun;
VectorCopy( pmove->origin, center );
VectorCopy( pmove->origin, knee );
VectorCopy( pmove->origin, feet );
height = pmove->player_maxs[ pmove->usehull ][ 2 ] - pmove->player_mins[ pmove->usehull ][ 2 ];
knee[2] = pmove->origin[2] - 0.3 * height;
feet[2] = pmove->origin[2] - 0.5 * height;
// find out what we're stepping in or on...
if (fLadder)
{
step = STEP_LADDER;
fvol = 0.35;
pmove->flTimeStepSound = 350;
}
else if ( pmove->PM_PointContents ( knee, NULL ) == CONTENTS_WATER )
{
step = STEP_WADE;
fvol = 0.65;
pmove->flTimeStepSound = 600;
}
else if ( pmove->PM_PointContents ( feet, NULL ) == CONTENTS_WATER )
{
step = STEP_SLOSH;
fvol = fWalking ? 0.2 : 0.5;
pmove->flTimeStepSound = fWalking ? 400 : 300;
}
else
{
// find texture under player, if different from current texture,
// get material type
step = PM_MapTextureTypeStepType( pmove->chtexturetype );
switch ( pmove->chtexturetype )
{
default:
case CHAR_TEX_CONCRETE:
fvol = fWalking ? 0.2 : 0.5;
pmove->flTimeStepSound = fWalking ? 400 : 300;
break;
case CHAR_TEX_METAL:
fvol = fWalking ? 0.2 : 0.5;
pmove->flTimeStepSound = fWalking ? 400 : 300;
break;
case CHAR_TEX_DIRT:
fvol = fWalking ? 0.25 : 0.55;
pmove->flTimeStepSound = fWalking ? 400 : 300;
break;
case CHAR_TEX_VENT:
fvol = fWalking ? 0.4 : 0.7;
pmove->flTimeStepSound = fWalking ? 400 : 300;
break;
case CHAR_TEX_GRATE:
fvol = fWalking ? 0.2 : 0.5;
pmove->flTimeStepSound = fWalking ? 400 : 300;
break;
case CHAR_TEX_TILE:
fvol = fWalking ? 0.2 : 0.5;
pmove->flTimeStepSound = fWalking ? 400 : 300;
break;
case CHAR_TEX_SLOSH:
fvol = fWalking ? 0.2 : 0.5;
pmove->flTimeStepSound = fWalking ? 400 : 300;
break;
}
}
pmove->flTimeStepSound += flduck; // slower step time if ducking
// play the sound
// 35% volume if ducking
if ( pmove->flags & FL_DUCKING )
{
fvol *= 0.35;
}
PM_PlayStepSound( step, fvol );
}
}
|
__________________
Last edited by Voi; 01-14-2011 at 18:58.
|
|
|
|