From 15916bb611ac8be90f1719ca84144149bbc97ca1 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Wed, 1 Oct 2003 23:47:46 +0000 Subject: * bobCycle added to classAttributes_t --- src/game/bg_misc.c | 34 +++++++++++++++++++++++++++++++++- src/game/bg_pmove.c | 4 +++- src/game/bg_public.h | 2 ++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index e23dc962..485bc7ce 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1209,6 +1209,7 @@ classAttributes_t bg_classList[ ] = 95.0f, //float buildDist; 80, //int fov; 0.001f, //float bob; + 1.0f, //float bobCycle; 350, //int steptime; ABUILDER_SPEED, //float speed; 10.0f, //float acceleration; @@ -1242,6 +1243,7 @@ classAttributes_t bg_classList[ ] = 95.0f, //float buildDist; 110, //int fov; 0.001f, //float bob; + 1.0f, //float bobCycle; 200, //int steptime; ABUILDER_UPG_SPEED, //float speed; 10.0f, //float acceleration; @@ -1275,6 +1277,7 @@ classAttributes_t bg_classList[ ] = 0.0f, //float buildDist; 140, //int fov; 0.0f, //float bob; + 1.0f, //float bobCycle; 25, //int steptime; SOLDIER_SPEED, //float speed; 10.0f, //float acceleration; @@ -1309,6 +1312,7 @@ classAttributes_t bg_classList[ ] = 0.0f, //float buildDist; 120, //int fov; 0.001f, //float bob; + 1.0f, //float bobCycle; 25, //int steptime; HYDRA_SPEED, //float speed; 10.0f, //float acceleration; @@ -1343,6 +1347,7 @@ classAttributes_t bg_classList[ ] = 0.0f, //float buildDist; 120, //int fov; 0.001f, //float bob; + 1.0f, //float bobCycle; 25, //int steptime; HYDRA_UPG_SPEED, //float speed; 10.0f, //float acceleration; @@ -1376,6 +1381,7 @@ classAttributes_t bg_classList[ ] = 0.0f, //float buildDist; 110, //int fov; 0.0005f, //float bob; + 1.0f, //float bobCycle; 25, //int steptime; DRAGOON_SPEED, //float speed; 10.0f, //float acceleration; @@ -1409,6 +1415,7 @@ classAttributes_t bg_classList[ ] = 0.0f, //float buildDist; 110, //int fov; 0.0005f, //float bob; + 1.0f, //float bobCycle; 25, //int steptime; DRAGOON_UPG_SPEED, //float speed; 10.0f, //float acceleration; @@ -1442,6 +1449,7 @@ classAttributes_t bg_classList[ ] = 0.0f, //float buildDist; 90, //int fov; 0.0f, //float bob; + 1.0f, //float bobCycle; 60, //int steptime; CHIMERA_SPEED, //float speed; 10.0f, //float acceleration; @@ -1475,6 +1483,7 @@ classAttributes_t bg_classList[ ] = 0.0f, //float buildDist; 90, //int fov; 0.0f, //float bob; + 1.0f, //float bobCycle; 60, //int steptime; CHIMERA_UPG_SPEED, //float speed; 10.0f, //float acceleration; @@ -1508,6 +1517,7 @@ classAttributes_t bg_classList[ ] = 0.0f, //float buildDist; 90, //int fov; 0.001f, //float bob; + 1.0f, //float bobCycle; 60, //int steptime; BMOFO_SPEED, //float speed; 5.0f, //float acceleration; @@ -1541,6 +1551,7 @@ classAttributes_t bg_classList[ ] = 110.0f, //float buildDist; 90, //int fov; 0.002f, //float bob; + 1.0f, //float bobCycle; 200, //int steptime; 1.0f, //float speed; 10.0f, //float acceleration; @@ -1561,7 +1572,7 @@ classAttributes_t bg_classList[ ] = "bsuit", ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), { 0, 0, 0 }, { 0, 0, 0, }, { 0, 0, 0, }, { 0, 0, 0, }, { 0, 0, 0, }, 0, 0, 0, 0.0f, 0, 0, WP_NONE, 0.0f, 0, - 0.0f, 0, 1.0f, 1.0f, 1.0f, 1.0f, { PCL_NONE, PCL_NONE, PCL_NONE }, 0, 0 + 0.0f, 1.0f, 0, 1.0f, 1.0f, 1.0f, 1.0f, { PCL_NONE, PCL_NONE, PCL_NONE }, 0, 0 } }; @@ -1914,6 +1925,27 @@ float BG_FindBobForClass( int pclass ) return 0.002; } +/* +============== +BG_FindBobCycleForClass +============== +*/ +float BG_FindBobCycleForClass( int pclass ) +{ + int i; + + for( i = 0; i < bg_numPclasses; i++ ) + { + if( bg_classList[ i ].classNum == pclass ) + { + return bg_classList[ i ].bobCycle; + } + } + + Com_Printf( S_COLOR_YELLOW "WARNING: fallthrough in BG_FindBobCycleForClass\n" ); + return 1.0f; +} + /* ============== BG_FindSpeedForClass diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 39ac8c12..53593573 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2201,7 +2201,7 @@ static void PM_Footsteps( void ) // if not trying to move if( !pm->cmd.forwardmove && !pm->cmd.rightmove ) { - if( pm->xyspeed < 5 ) + if( pm->xyspeed < 5 ) { pm->ps->bobCycle = 0; // start at beginning of cycle again if( pm->ps->pm_flags & PMF_DUCKED ) @@ -2342,6 +2342,8 @@ static void PM_Footsteps( void ) } } + bobmove *= BG_FindBobCycleForClass( pm->ps->stats[ STAT_PCLASS ] ); + // check for footstep / splash sounds old = pm->ps->bobCycle; pm->ps->bobCycle = (int)( old + bobmove * pml.msec ) & 255; diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 8a505c1a..550c7f2f 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -888,6 +888,7 @@ typedef struct int fov; float bob; + float bobCycle; int steptime; float speed; @@ -1080,6 +1081,7 @@ float BG_FindFallDamageForClass( int pclass ); int BG_FindRegenRateForClass( int pclass ); int BG_FindFovForClass( int pclass ); float BG_FindBobForClass( int pclass ); +float BG_FindBobCycleForClass( int pclass ); float BG_FindSpeedForClass( int pclass ); float BG_FindAccelerationForClass( int pclass ); float BG_FindFrictionForClass( int pclass ); -- cgit