summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_players.c2
-rw-r--r--src/game/bg_pmove.c150
-rw-r--r--src/game/bg_public.h1
-rw-r--r--src/game/g_client.c64
4 files changed, 194 insertions, 23 deletions
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index bfbd039e..a1135bd0 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -1211,7 +1211,7 @@ static void CG_PlayerNonSegAnimation( centity_t *cent, int *nonSegOld,
if( cent->pe.nonseg.yawing && ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == NSPA_STAND )
CG_RunLerpFrame( ci, &cent->pe.nonseg, NSPA_TURN, speedScale );
else
- CG_RunLerpFrame( ci, &cent->pe.legs, cent->currentState.legsAnim, speedScale );
+ CG_RunLerpFrame( ci, &cent->pe.nonseg, cent->currentState.legsAnim, speedScale );
*nonSegOld = cent->pe.nonseg.oldFrame;
*nonSeg = cent->pe.nonseg.frame;
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index a528b484..e126f626 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -511,12 +511,20 @@ static qboolean PM_CheckJump( void )
if( pm->cmd.forwardmove >= 0 )
{
- PM_ForceLegsAnim( LEGS_JUMP );
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ForceLegsAnim( LEGS_JUMP );
+ else
+ PM_ForceLegsAnim( NSPA_JUMP );
+
pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
}
else
{
- PM_ForceLegsAnim( LEGS_JUMPB );
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ForceLegsAnim( LEGS_JUMPB );
+ else
+ PM_ForceLegsAnim( NSPA_JUMPBACK );
+
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
}
@@ -707,7 +715,10 @@ static void PM_JetPackMove( void )
PM_StepSlideMove( qfalse, qfalse );
- PM_ForceLegsAnim( LEGS_LAND );
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ForceLegsAnim( LEGS_LAND );
+ else
+ PM_ForceLegsAnim( NSPA_LAND );
}
@@ -1226,9 +1237,19 @@ static void PM_CrashLand( void )
// decide which landing animation to use
if( pm->ps->pm_flags & PMF_BACKWARDS_JUMP )
- PM_ForceLegsAnim( LEGS_LANDB );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ForceLegsAnim( LEGS_LANDB );
+ else
+ PM_ForceLegsAnim( NSPA_LANDBACK );
+ }
else
- PM_ForceLegsAnim( LEGS_LAND );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ForceLegsAnim( LEGS_LAND );
+ else
+ PM_ForceLegsAnim( NSPA_LAND );
+ }
pm->ps->legsTimer = TIMER_LAND;
@@ -1374,12 +1395,20 @@ static void PM_GroundTraceMissed( void )
{
if( pm->cmd.forwardmove >= 0 )
{
- PM_ForceLegsAnim( LEGS_JUMP );
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ForceLegsAnim( LEGS_JUMP );
+ else
+ PM_ForceLegsAnim( NSPA_JUMP );
+
pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
}
else
{
- PM_ForceLegsAnim( LEGS_JUMPB );
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ForceLegsAnim( LEGS_JUMPB );
+ else
+ PM_ForceLegsAnim( NSPA_JUMPBACK );
+
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
}
}
@@ -1758,12 +1787,20 @@ static void PM_GroundTrace( void )
// go into jump animation
if( pm->cmd.forwardmove >= 0 )
{
- PM_ForceLegsAnim( LEGS_JUMP );
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ForceLegsAnim( LEGS_JUMP );
+ else
+ PM_ForceLegsAnim( NSPA_JUMP );
+
pm->ps->pm_flags &= ~PMF_BACKWARDS_JUMP;
}
else
{
- PM_ForceLegsAnim( LEGS_JUMPB );
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ForceLegsAnim( LEGS_JUMPB );
+ else
+ PM_ForceLegsAnim( NSPA_JUMPBACK );
+
pm->ps->pm_flags |= PMF_BACKWARDS_JUMP;
}
@@ -1971,7 +2008,12 @@ static void PM_Footsteps( void )
{
// airborne leaves position in cycle intact, but doesn't advance
if( pm->waterlevel > 1 )
- PM_ContinueLegsAnim( LEGS_SWIM );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ContinueLegsAnim( LEGS_SWIM );
+ else
+ PM_ContinueLegsAnim( NSPA_SWIM );
+ }
return;
}
@@ -1983,9 +2025,19 @@ static void PM_Footsteps( void )
{
pm->ps->bobCycle = 0; // start at beginning of cycle again
if( pm->ps->pm_flags & PMF_DUCKED )
- PM_ContinueLegsAnim( LEGS_IDLECR );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ContinueLegsAnim( LEGS_IDLECR );
+ else
+ PM_ContinueLegsAnim( NSPA_STAND );
+ }
else
- PM_ContinueLegsAnim( LEGS_IDLE );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ContinueLegsAnim( LEGS_IDLE );
+ else
+ PM_ContinueLegsAnim( NSPA_STAND );
+ }
}
return;
}
@@ -1998,9 +2050,19 @@ static void PM_Footsteps( void )
bobmove = 0.5; // ducked characters bob much faster
if( pm->ps->pm_flags & PMF_BACKWARDS_RUN )
- PM_ContinueLegsAnim( LEGS_BACKCR );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ContinueLegsAnim( LEGS_BACKCR );
+ else
+ PM_ContinueLegsAnim( NSPA_WALKBACK );
+ }
else
- PM_ContinueLegsAnim( LEGS_WALKCR );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ContinueLegsAnim( LEGS_WALKCR );
+ else
+ PM_ContinueLegsAnim( NSPA_WALK );
+ }
// ducked characters never play footsteps
/*
@@ -2022,9 +2084,19 @@ static void PM_Footsteps( void )
{
bobmove = 0.4f; // faster speeds bob faster
if( pm->ps->pm_flags & PMF_BACKWARDS_RUN )
- PM_ContinueLegsAnim( LEGS_BACK );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ContinueLegsAnim( LEGS_BACK );
+ else
+ PM_ContinueLegsAnim( NSPA_RUNBACK );
+ }
else
- PM_ContinueLegsAnim( LEGS_RUN );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ContinueLegsAnim( LEGS_RUN );
+ else
+ PM_ContinueLegsAnim( NSPA_RUN );
+ }
footstep = qtrue;
}
@@ -2032,9 +2104,19 @@ static void PM_Footsteps( void )
{
bobmove = 0.3f; // walking bobs slow
if( pm->ps->pm_flags & PMF_BACKWARDS_RUN )
- PM_ContinueLegsAnim( LEGS_BACKWALK );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ContinueLegsAnim( LEGS_BACKWALK );
+ else
+ PM_ContinueLegsAnim( NSPA_WALKBACK );
+ }
else
- PM_ContinueLegsAnim( LEGS_WALK );
+ {
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_ContinueLegsAnim( LEGS_WALK );
+ else
+ PM_ContinueLegsAnim( NSPA_WALK );
+ }
}
}
@@ -2124,7 +2206,9 @@ static void PM_BeginWeaponChange( int weapon )
PM_AddEvent( EV_CHANGE_WEAPON );
pm->ps->weaponstate = WEAPON_DROPPING;
pm->ps->weaponTime += 200;
- PM_StartTorsoAnim( TORSO_DROP );
+
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_StartTorsoAnim( TORSO_DROP );
}
@@ -2147,7 +2231,9 @@ static void PM_FinishWeaponChange( void )
pm->ps->weapon = weapon;
pm->ps->weaponstate = WEAPON_RAISING;
pm->ps->weaponTime += 250;
- PM_StartTorsoAnim( TORSO_RAISE );
+
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_StartTorsoAnim( TORSO_RAISE );
}
@@ -2159,6 +2245,9 @@ PM_TorsoAnimation
*/
static void PM_TorsoAnimation( void )
{
+ if( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL )
+ return;
+
if( pm->ps->weaponstate == WEAPON_READY )
PM_ContinueTorsoAnim( TORSO_STAND );
}
@@ -2258,7 +2347,10 @@ static void PM_Weapon( void )
if ( pm->ps->weaponstate == WEAPON_RAISING )
{
pm->ps->weaponstate = WEAPON_READY;
- PM_StartTorsoAnim( TORSO_STAND );
+
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_StartTorsoAnim( TORSO_STAND );
+
return;
}
@@ -2427,7 +2519,10 @@ static void PM_Weapon( void )
}
}
- PM_StartTorsoAnim( TORSO_ATTACK );
+ if( !( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ PM_StartTorsoAnim( TORSO_ATTACK );
+ else
+ PM_StartLegsAnim( NSPA_ATTACK1 );
pm->ps->weaponstate = WEAPON_FIRING;
@@ -2485,9 +2580,20 @@ static void PM_Animate( void )
if( pm->ps->torsoTimer == 0 )
{
PM_StartTorsoAnim( TORSO_GESTURE );
+
pm->ps->torsoTimer = TIMER_GESTURE;
PM_AddEvent( EV_TAUNT );
}
+ else if( pm->ps->legsTimer == 0 )
+ {
+ if( ( pm->ps->persistant[ PERS_STATE ] & PS_NONSEGMODEL ) )
+ {
+ PM_StartLegsAnim( NSPA_GESTURE );
+ pm->ps->legsTimer = TIMER_GESTURE;
+
+ PM_AddEvent( EV_TAUNT );
+ }
+ }
}
}
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index feadfcd1..89eae495 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -257,6 +257,7 @@ typedef enum
} persEnum_t;
#define PS_WALLCLIMBINGFOLLOW 0x00000001
+#define PS_NONSEGMODEL 0x00000002
// entityState_t->eFlags
#define EF_DEAD 0x00000001 // don't draw a foe marker over players with EF_DEAD
diff --git a/src/game/g_client.c b/src/game/g_client.c
index c943faa8..224c4bca 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -949,6 +949,61 @@ static void ClientCleanName( const char *in, char *out, int outSize )
/*
+======================
+G_NonSegModel
+
+Reads an animation.cfg to check for nonsegmentation
+======================
+*/
+static qboolean G_NonSegModel( const char *filename )
+{
+ char *text_p;
+ int len;
+ char *token;
+ char text[ 20000 ];
+ fileHandle_t f;
+
+ // load the file
+ len = trap_FS_FOpenFile( filename, &f, FS_READ );
+ if( !f )
+ {
+ G_Printf( "File not found: %s\n", filename );
+ return qfalse;
+ }
+
+ if( len <= 0 )
+ return qfalse;
+
+ if( len >= sizeof( text ) - 1 )
+ {
+ G_Printf( "File %s too long\n", filename );
+ return qfalse;
+ }
+
+ trap_FS_Read( text, len, f );
+ text[ len ] = 0;
+ trap_FS_FCloseFile( f );
+
+ // parse the text
+ text_p = text;
+
+ // read optional parameters
+ while( 1 )
+ {
+ token = COM_Parse( &text_p );
+
+ //EOF
+ if( !token[ 0 ] )
+ break;
+
+ if( !Q_stricmp( token, "nonsegmented" ) )
+ return qtrue;
+ }
+
+ return qfalse;
+}
+
+/*
===========
ClientUserInfoChanged
@@ -966,6 +1021,7 @@ void ClientUserinfoChanged( int clientNum )
char *s;
char model[ MAX_QPATH ];
char buffer[ MAX_QPATH ];
+ char filename[ MAX_QPATH ];
char oldname[ MAX_STRING_CHARS ];
gclient_t *client;
char c1[ MAX_INFO_STRING ];
@@ -1033,6 +1089,14 @@ void ClientUserinfoChanged( int clientNum )
BG_FindSkinNameForClass( client->pers.pclass ) );
Q_strncpyz( model, buffer, sizeof( model ) );
+ //model segmentation
+ Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg",
+ BG_FindModelNameForClass( client->pers.pclass ) );
+ if( G_NonSegModel( filename ) )
+ client->ps.persistant[ PERS_STATE ] |= PS_NONSEGMODEL;
+ else
+ client->ps.persistant[ PERS_STATE ] &= ~PS_NONSEGMODEL;
+
// wallwalk follow
s = Info_ValueForKey( userinfo, "cg_wwFollow" );