diff options
-rw-r--r-- | src/cgame/cg_ents.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 160 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 58 | ||||
-rw-r--r-- | src/game/bg_misc.c | 87 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 60 | ||||
-rw-r--r-- | src/game/bg_public.h | 20 | ||||
-rw-r--r-- | src/game/g_active.c | 5 |
7 files changed, 207 insertions, 185 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 615727cc..6d1dac68 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -805,7 +805,7 @@ static void CG_AddCEntity( centity_t *cent ) { if ( cent->currentState.eType >= ET_EVENTS ) { return; } - + // calculate the current origin CG_CalcEntityLerpPositions( cent ); diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 5d465616..7f9dc88d 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -907,7 +907,7 @@ static void CG_SetLerpFrameAnimation( clientInfo_t *ci, lerpFrame_t *lf, int new animation_t *anim; lf->animationNumber = newAnimation; - newAnimation &= ~( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ); + newAnimation &= ~ANIM_TOGGLEBIT; if ( newAnimation < 0 || newAnimation >= MAX_PLAYER_TOTALANIMATIONS ) { CG_Error( "Bad animation number: %i", newAnimation ); @@ -1052,7 +1052,7 @@ static void CG_PlayerAnimation( centity_t *cent, int *legsOld, int *legs, float ci = &cgs.clientinfo[ clientNum ]; // do the shuffle turn frames locally - if ( cent->pe.legs.yawing && ( cent->currentState.legsAnim & ~( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ) ) == LEGS_IDLE ) { + if ( cent->pe.legs.yawing && ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_IDLE ) { CG_RunLerpFrame( ci, ¢->pe.legs, LEGS_TURN, speedScale ); } else { CG_RunLerpFrame( ci, ¢->pe.legs, cent->currentState.legsAnim, speedScale ); @@ -1176,7 +1176,8 @@ Handles seperate torso motion if < 45 degrees, also show in torso =============== */ -static void CG_PlayerAngles( centity_t *cent, vec3_t legs[3], vec3_t torso[3], vec3_t head[3] ) { +static void CG_PlayerAngles( centity_t *cent, vec3_t srcAngles, vec3_t legs[3], vec3_t torso[3], vec3_t head[3] ) +{ vec3_t legsAngles, torsoAngles, headAngles; float dest; static int movementOffsets[8] = { 0, 22, 45, -22, 0, 22, -45, -22 }; @@ -1185,7 +1186,7 @@ static void CG_PlayerAngles( centity_t *cent, vec3_t legs[3], vec3_t torso[3], v int dir, clientNum; clientInfo_t *ci; - VectorCopy( cent->lerpAngles, headAngles ); + VectorCopy( srcAngles, headAngles ); headAngles[YAW] = AngleMod( headAngles[YAW] ); VectorClear( legsAngles ); VectorClear( torsoAngles ); @@ -1193,8 +1194,8 @@ static void CG_PlayerAngles( centity_t *cent, vec3_t legs[3], vec3_t torso[3], v // --------- yaw ------------- // allow yaw to drift a bit - if ( ( cent->currentState.legsAnim & ~( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ) ) != LEGS_IDLE - || ( cent->currentState.torsoAnim & ~(ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ) ) != TORSO_STAND ) { + if ( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) != LEGS_IDLE + || ( cent->currentState.torsoAnim & ~ANIM_TOGGLEBIT ) != TORSO_STAND ) { // if not standing still, always point all in the same direction cent->pe.torso.yawing = qtrue; // always center cent->pe.torso.pitching = qtrue; // always center @@ -1312,7 +1313,7 @@ static void CG_HasteTrail( centity_t *cent ) { if ( cent->trailTime > cg.time ) { return; } - anim = cent->pe.legs.animationNumber & ~( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ); + anim = cent->pe.legs.animationNumber & ~ANIM_TOGGLEBIT; if ( anim != LEGS_RUN && anim != LEGS_BACK ) { return; } @@ -1392,24 +1393,28 @@ static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *torso ) if( held & ( 1 << UP_JETPACK ) ) { //FIXME: add model to back + //CG_PositionRotatedEntityOnTag( &head, &torso, ci->torsoModel, "tag_back" ); if( active & ( 1 << UP_JETPACK ) ) { if( cent->currentState.pos.trDelta[ 2 ] > 10.0f ) { - trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.media.jetpackAscendSound ); + trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, + vec3_origin, cgs.media.jetpackAscendSound ); addTime = 80; vel[ 2 ] = -60.0f; } else if( cent->currentState.pos.trDelta[ 2 ] < -10.0f ) { - trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.media.jetpackDescendSound ); + trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, + vec3_origin, cgs.media.jetpackDescendSound ); addTime = 110; vel[ 2 ] = -45.0f; } else { - trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, cgs.media.jetpackIdleSound ); + trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, + vec3_origin, cgs.media.jetpackIdleSound ); addTime = 100; vel[ 2 ] = -50.0f; } @@ -1528,21 +1533,6 @@ static void CG_PlayerSprites( centity_t *cent ) { return; } - if ( cent->currentState.eFlags & EF_AWARD_IMPRESSIVE ) { - CG_PlayerFloatSprite( cent, cgs.media.medalImpressive ); - return; - } - - if ( cent->currentState.eFlags & EF_AWARD_EXCELLENT ) { - CG_PlayerFloatSprite( cent, cgs.media.medalExcellent ); - return; - } - - if ( cent->currentState.eFlags & EF_AWARD_GAUNTLET ) { - CG_PlayerFloatSprite( cent, cgs.media.medalGauntlet ); - return; - } - team = cgs.clientinfo[ cent->currentState.clientNum ].team; if ( !(cent->currentState.eFlags & EF_DEAD) && cg.snap->ps.persistant[PERS_TEAM] == team && @@ -1868,40 +1858,58 @@ void CG_Player( centity_t *cent ) qboolean shadow; float shadowPlane; entityState_t *es = ¢->currentState; + int class = ( es->powerups >> 8 ) & 0xFF; + float scale; + vec3_t tempAxis[ 3 ], tempAxis2[ 3 ]; + vec3_t angles; // the client number is stored in clientNum. It can't be derived // from the entity number, because a single client may have // multiple corpses on the level using the same clientinfo clientNum = cent->currentState.clientNum; - if ( clientNum < 0 || clientNum >= MAX_CLIENTS ) { - CG_Error( "Bad clientNum on player entity"); - } + if( clientNum < 0 || clientNum >= MAX_CLIENTS ) + CG_Error( "Bad clientNum on player entity" ); + ci = &cgs.clientinfo[ clientNum ]; // it is possible to see corpses from disconnected players that may // not have valid clientinfo - if ( !ci->infoValid ) { + if( !ci->infoValid ) return; - } // get the player model information renderfx = 0; - if ( cent->currentState.number == cg.snap->ps.clientNum) { - if (!cg.renderingThirdPerson) { + if( cent->currentState.number == cg.snap->ps.clientNum ) + { + if( !cg.renderingThirdPerson ) renderfx = RF_THIRD_PERSON; // only draw in mirrors - } else { - if (cg_cameraMode.integer) { - return; - } - } + else if( cg_cameraMode.integer ) + return; } - memset( &legs, 0, sizeof(legs) ); - memset( &torso, 0, sizeof(torso) ); - memset( &head, 0, sizeof(head) ); + memset( &legs, 0, sizeof( legs ) ); + memset( &torso, 0, sizeof( torso ) ); + memset( &head, 0, sizeof( head ) ); + + VectorCopy( cent->lerpAngles, angles ); + AnglesToAxis( cent->lerpAngles, tempAxis ); + + //rotate lerpAngles to floor + if( BG_rotateAxis( es->angles2, tempAxis, tempAxis2, qtrue, es->eFlags & EF_WALLCLIMBCEILING ) ) + AxisToAngles( tempAxis2, angles ); + else + VectorCopy( cent->lerpAngles, angles ); + + //normalise the pitch + if( angles[ PITCH ] < -180.0f ) + angles[ PITCH ] += 360.0f; // get the rotation information - CG_PlayerAngles( cent, legs.axis, torso.axis, head.axis ); + CG_PlayerAngles( cent, angles, legs.axis, torso.axis, head.axis ); + + //rotate the legs axis to back to the wall + if( BG_rotateAxis( es->angles2, legs.axis, tempAxis, qfalse, es->eFlags & EF_WALLCLIMBCEILING ) ) + AxisCopy( tempAxis, legs.axis ); // get the animation state (after rotation, to allow feet shuffle) CG_PlayerAnimation( cent, &legs.oldframe, &legs.frame, &legs.backlerp, @@ -1918,9 +1926,9 @@ void CG_Player( centity_t *cent ) // add a water splash if partially in and out of water CG_PlayerSplash( cent ); - if ( cg_shadows.integer == 3 && shadow ) { + if( cg_shadows.integer == 3 && shadow ) renderfx |= RF_SHADOW_PLANE; - } + renderfx |= RF_LIGHTING_ORIGIN; // use the same origin for all // @@ -1934,32 +1942,20 @@ void CG_Player( centity_t *cent ) VectorCopy( cent->lerpOrigin, legs.lightingOrigin ); legs.shadowPlane = shadowPlane; legs.renderfx = renderfx; - VectorCopy (legs.origin, legs.oldorigin); // don't positionally lerp at all + VectorCopy( legs.origin, legs.oldorigin ); // don't positionally lerp at all - //TA: rotate the model so it sits on a wall - if( cent->currentState.legsAnim & ANIM_WALLCLIMBING && - !( cent->currentState.eFlags & EF_DEAD ) && - !( cg.intermissionStarted ) ) + //move the origin closer into the wall with a CapTrace + if( es->eFlags & EF_WALLCLIMB && !( es->eFlags & EF_DEAD ) && !( cg.intermissionStarted ) ) { - vec3_t forward, surfNormal, start, end, mins, maxs; + vec3_t surfNormal, start, end, mins, maxs; trace_t tr; - VectorCopy( cent->currentState.angles2, surfNormal ); - BG_FindBBoxForClass( ( es->powerups >> 8 ) & 0xFF, mins, maxs, NULL, NULL, NULL ); - - AngleVectors( cent->lerpAngles, forward, NULL, NULL ); - VectorCopy( surfNormal, legs.axis[2] ); - ProjectPointOnPlane( legs.axis[0], forward, legs.axis[2] ); - if( !VectorNormalize( legs.axis[0] ) ) - { - AngleVectors( cent->lerpAngles, NULL, NULL, forward ); - ProjectPointOnPlane( legs.axis[0], forward, legs.axis[2] ); - VectorNormalize( legs.axis[0] ); - } - CrossProduct( legs.axis[0], legs.axis[2], legs.axis[1] ); - legs.axis[1][0] = -legs.axis[1][0]; - legs.axis[1][1] = -legs.axis[1][1]; - legs.axis[1][2] = -legs.axis[1][2]; + if( es->eFlags & EF_WALLCLIMBCEILING ) + VectorSet( surfNormal, 0.0f, 0.0f, -1.0f ); + else + VectorCopy( cent->currentState.angles2, surfNormal ); + + BG_FindBBoxForClass( class, mins, maxs, NULL, NULL, NULL ); VectorMA( legs.origin, -TRACE_DEPTH, surfNormal, end ); VectorMA( legs.origin, 1.0f, surfNormal, start ); @@ -1970,8 +1966,18 @@ void CG_Player( centity_t *cent ) VectorCopy( legs.origin, legs.oldorigin ); // don't positionally lerp at all } + //rescale the model + scale = BG_FindModelScaleForClass( class ); + + if( scale != 1.0f ) + { + VectorScale( legs.axis[ 0 ], scale, legs.axis[ 0 ] ); + VectorScale( legs.axis[ 1 ], scale, legs.axis[ 1 ] ); + VectorScale( legs.axis[ 2 ], scale, legs.axis[ 2 ] ); + + legs.nonNormalizedAxes = qtrue; + } - //CG_AddRefEntityWithPowerups( &legs, cent->currentState.powerups, ci->team ); trap_R_AddRefEntityToScene( &legs ); // if the model failed, allow the default nullmodel to be displayed @@ -1989,17 +1995,11 @@ void CG_Player( centity_t *cent ) VectorCopy( cent->lerpOrigin, torso.lightingOrigin ); - CG_PositionRotatedEntityOnTag( &torso, &legs, ci->legsModel, "tag_torso"); + CG_PositionRotatedEntityOnTag( &torso, &legs, ci->legsModel, "tag_torso" ); - if( cent->currentState.legsAnim & ANIM_WALLCLIMBING && - !( cent->currentState.eFlags & EF_DEAD ) && - !( cg.intermissionStarted ) ) - AnglesToAxis( cent->lerpAngles, torso.axis ); - torso.shadowPlane = shadowPlane; torso.renderfx = renderfx; - //CG_AddRefEntityWithPowerups( &torso, cent->currentState.powerups, ci->team ); trap_R_AddRefEntityToScene( &torso ); // @@ -2013,17 +2013,11 @@ void CG_Player( centity_t *cent ) VectorCopy( cent->lerpOrigin, head.lightingOrigin ); - CG_PositionRotatedEntityOnTag( &head, &torso, ci->torsoModel, "tag_head"); - - if( cent->currentState.legsAnim & ANIM_WALLCLIMBING && - !( cent->currentState.eFlags & EF_DEAD ) && - !( cg.intermissionStarted ) ) - AnglesToAxis( cent->lerpAngles, head.axis ); + CG_PositionRotatedEntityOnTag( &head, &torso, ci->torsoModel, "tag_head" ); head.shadowPlane = shadowPlane; head.renderfx = renderfx; - //CG_AddRefEntityWithPowerups( &head, cent->currentState.powerups, ci->team ); trap_R_AddRefEntityToScene( &head ); // @@ -2032,10 +2026,6 @@ void CG_Player( centity_t *cent ) CG_AddPlayerWeapon( &torso, NULL, cent ); CG_PlayerUpgrades( cent, &torso ); - -/* if( ( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS ) && - ( ( cent->currentState.powerups & 0xFF ) == PTE_HUMANS ) ) - trap_R_AddAdditiveLightToScene( cent->lerpOrigin, 64, 0.1, 0.1, 0.4 );*/ } /* @@ -2076,7 +2066,7 @@ void CG_Corpse( centity_t *cent ) VectorCopy( cent->currentState.angles, cent->lerpAngles ); // get the rotation information - CG_PlayerAngles( cent, legs.axis, torso.axis, head.axis ); + CG_PlayerAngles( cent, cent->lerpAngles, legs.axis, torso.axis, head.axis ); //set the correct frame (should always be dead) if ( cg_noPlayerAnims.integer ) diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 2d56f353..3002c66b 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -212,29 +212,33 @@ CG_OffsetThirdPersonView =============== */ #define FOCUS_DISTANCE 512 -static void CG_OffsetThirdPersonView( void ) { - vec3_t forward, right, up; - vec3_t view; - vec3_t focusAngles; - trace_t trace; +static void CG_OffsetThirdPersonView( void ) +{ + vec3_t forward, right, up; + vec3_t view; + vec3_t focusAngles; + trace_t trace; static vec3_t mins = { -4, -4, -4 }; static vec3_t maxs = { 4, 4, 4 }; - vec3_t focusPoint; - float focusDist; - float forwardScale, sideScale; + vec3_t focusPoint; + float focusDist; + float forwardScale, sideScale; + vec3_t surfNormal; - //TA: when wall climbing the viewheight is not straight up - if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING ) - VectorMA( cg.refdef.vieworg, cg.predictedPlayerState.viewheight, cg.predictedPlayerState.grapplePoint, cg.refdef.vieworg ); + if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) + VectorSet( surfNormal, 0.0f, 0.0f, -1.0f ); else - cg.refdef.vieworg[2] += cg.predictedPlayerState.viewheight; + VectorCopy( cg.predictedPlayerState.grapplePoint, surfNormal ); + + VectorMA( cg.refdef.vieworg, cg.predictedPlayerState.viewheight, surfNormal, cg.refdef.vieworg ); VectorCopy( cg.refdefViewAngles, focusAngles ); // if dead, look at killer - if ( cg.predictedPlayerState.stats[STAT_HEALTH] <= 0 ) { - focusAngles[YAW] = cg.predictedPlayerState.generic1; - cg.refdefViewAngles[YAW] = cg.predictedPlayerState.generic1; + if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 ) + { + focusAngles[ YAW ] = cg.predictedPlayerState.generic1; + cg.refdefViewAngles[ YAW ] = cg.predictedPlayerState.generic1; } //if ( focusAngles[PITCH] > 45 ) { @@ -246,11 +250,7 @@ static void CG_OffsetThirdPersonView( void ) { VectorCopy( cg.refdef.vieworg, view ); - //TA: when wall climbing the viewheight is not straight up - if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING ) - VectorMA( view, 8, cg.predictedPlayerState.grapplePoint, view ); - else - view[2] += 8; + VectorMA( view, 8, surfNormal, view ); //cg.refdefViewAngles[PITCH] *= 0.5; @@ -264,12 +264,14 @@ static void CG_OffsetThirdPersonView( void ) { // trace a ray from the origin to the viewpoint to make sure the view isn't // in a solid block. Use an 8 by 8 block to prevent the view from near clipping anything - if (!cg_cameraMode.integer) { + if( !cg_cameraMode.integer ) + { CG_Trace( &trace, cg.refdef.vieworg, mins, maxs, view, cg.predictedPlayerState.clientNum, MASK_SOLID ); - if ( trace.fraction != 1.0 ) { + if( trace.fraction != 1.0 ) + { VectorCopy( trace.endpos, view ); - view[2] += (1.0 - trace.fraction) * 32; + view[ 2 ] += ( 1.0 - trace.fraction ) * 32; // try another trace to this position, because a tunnel may have the ceiling // close enogh that this is poking out @@ -282,12 +284,12 @@ static void CG_OffsetThirdPersonView( void ) { // select pitch to look at focus point from vieword VectorSubtract( focusPoint, cg.refdef.vieworg, focusPoint ); - focusDist = sqrt( focusPoint[0] * focusPoint[0] + focusPoint[1] * focusPoint[1] ); + focusDist = sqrt( focusPoint[ 0 ] * focusPoint[ 0 ] + focusPoint[ 1 ] * focusPoint[ 1 ] ); if ( focusDist < 1 ) { focusDist = 1; // should never happen } - cg.refdefViewAngles[PITCH] = -180 / M_PI * atan2( focusPoint[2], focusDist ); - cg.refdefViewAngles[YAW] -= cg_thirdPersonAngle.value; + cg.refdefViewAngles[ PITCH ] = -180 / M_PI * atan2( focusPoint[ 2 ], focusDist ); + cg.refdefViewAngles[ YAW ] -= cg_thirdPersonAngle.value; } @@ -1204,10 +1206,6 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo } } - if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS && - cg.predictedPlayerState.persistant[PERS_TEAM] != TEAM_SPECTATOR ) - trap_R_AddAdditiveLightToScene( cg.predictedPlayerState.origin, 2000, 0.02f, 0.00f, 0.00f ); - // actually issue the rendering calls CG_DrawActive( stereoView ); diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index cc97f387..1fef2b5c 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -1282,6 +1282,7 @@ classAttributes_t bg_classList[ ] = "Builder", //char *className; "Builder", //char *humanName; "lucy", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1310,6 +1311,7 @@ classAttributes_t bg_classList[ ] = "BuilderLevel1", //char *classname; "Advanced Builder", //char *humanname; "lucy", //char *modelname; + 1.0f, //float modelScale; "angel", //char *skinname; "alien_hud", //char *hudname; ( 1 << S2 )|( 1 << S3 ), //int stages @@ -1338,6 +1340,7 @@ classAttributes_t bg_classList[ ] = "Offensive", //char *classname; "Offensive", //char *humanname; "klesk", //char *modelname; + 0.5f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1366,6 +1369,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel1", //char *classname; "Offensive Level 1", //char *humanname; "anarki", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1394,6 +1398,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel1-Upgrade", //char *classname; "Offensive Level 1 Upgrade", //char *humanname; "anarki", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1422,6 +1427,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel2", //char *classname; "Offensive Level 2", //char *humanname; "bones", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1450,6 +1456,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel2-Upgrade", //char *classname; "Offensive Level 2 Upgrade", //char *humanname; "bones", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1478,6 +1485,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel3", //char *classname; "Offensive Level 3", //char *humanname; "orbb", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1506,6 +1514,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel3-Upgrade", //char *classname; "Offensive Level 3 Upgrade", //char *humanname; "orbb", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1534,6 +1543,7 @@ classAttributes_t bg_classList[ ] = "OffensiveLevel4", //char *classname; "Offensive Level 4", //char *humanname; "xaero", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "alien_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1562,6 +1572,7 @@ classAttributes_t bg_classList[ ] = "Human", //char *classname; "Human", //char *humanname; "sarge", //char *modelname; + 1.0f, //float modelScale; "default", //char *skinname; "human_hud", //char *hudname; ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int stages @@ -1667,6 +1678,26 @@ char *BG_FindModelNameForClass( int pclass ) /* ============== +BG_FindModelScaleForClass +============== +*/ +float BG_FindModelScaleForClass( int pclass ) +{ + int i; + + for( i = 0; i < bg_numPclasses; i++ ) + { + if( bg_classList[ i ].classNum == pclass ) + { + return bg_classList[ i ].modelScale; + } + } + + return 1.0f; +} + +/* +============== BG_FindSkinNameForClass ============== */ @@ -3699,10 +3730,9 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean s->powerups = ps->stats[ STAT_PTEAM ] | ( ps->stats[ STAT_PCLASS ] << 8 ); //TA: have to get the surfNormal thru somehow... + VectorCopy( ps->grapplePoint, s->angles2 ); if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) - VectorCopy( ceilingNormal, s->angles2 ); - else - VectorCopy( ps->grapplePoint, s->angles2 ); + s->eFlags |= EF_WALLCLIMBCEILING; s->loopSound = ps->loopSound; s->generic1 = ps->generic1; @@ -3799,10 +3829,9 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s s->powerups = ps->stats[ STAT_PTEAM ] | ( ps->stats[ STAT_PCLASS ] << 8 ); //TA: have to get the surfNormal thru somehow... + VectorCopy( ps->grapplePoint, s->angles2 ); if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) - VectorCopy( ceilingNormal, s->angles2 ); - else - VectorCopy( ps->grapplePoint, s->angles2 ); + s->eFlags |= EF_WALLCLIMBCEILING; s->loopSound = ps->loopSound; s->generic1 = ps->generic1; @@ -3929,3 +3958,49 @@ qboolean BG_activated( int item, int stats[ ] ) return( stats[ STAT_ACTIVEITEMS ] & ( 1 << item ) ); } +qboolean BG_rotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], + vec3_t outAxis[ 3 ], qboolean inverse, qboolean ceiling ) +{ + vec3_t refNormal = { 0.0f, 0.0f, 1.0f }; + vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f }; + vec3_t localNormal, xNormal; + float rotAngle; + + //the grapplePoint being a surfNormal rotation Normal hack... see above :) + if( ceiling ) + { + VectorCopy( ceilingNormal, localNormal ); + VectorCopy( surfNormal, xNormal ); + } + else + { + //cross the reference normal and the surface normal to get the rotation axis + VectorCopy( surfNormal, localNormal ); + CrossProduct( localNormal, refNormal, xNormal ); + VectorNormalize( xNormal ); + } + + //if we're a wall climber.. and we're climbing rotate the axis + if( VectorLength( xNormal ) != 0.0f ) + { + //if the normal pointing straight down then the rotAngle will always be 180deg + if( surfNormal[ 2 ] == -1.0f ) + rotAngle = 180.0f; + else + rotAngle = RAD2DEG( acos( DotProduct( localNormal, refNormal ) ) ); + + if( inverse ) + rotAngle = -rotAngle; + + AngleNormalize180( rotAngle ); + + //hmmm could get away with only one rotation and some clever stuff later... but i'm lazy + RotatePointAroundVector( outAxis[ 0 ], xNormal, inAxis[ 0 ], -rotAngle ); + RotatePointAroundVector( outAxis[ 1 ], xNormal, inAxis[ 1 ], -rotAngle ); + RotatePointAroundVector( outAxis[ 2 ], xNormal, inAxis[ 2 ], -rotAngle ); + } + else + return qfalse; + + return qtrue; +} diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 7c948e91..9b274e2f 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -97,12 +97,12 @@ static void PM_StartLegsAnim( int anim ) { if ( pm->ps->legsTimer > 0 ) { return; // a high priority animation is running } - pm->ps->legsAnim = ( ( pm->ps->legsAnim & ( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ) ) ^ ANIM_TOGGLEBIT ) + pm->ps->legsAnim = ( ( pm->ps->legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; } static void PM_ContinueLegsAnim( int anim ) { - if ( ( pm->ps->legsAnim & ~( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ) ) == anim ) { + if ( ( pm->ps->legsAnim & ~ANIM_TOGGLEBIT ) == anim ) { return; } if ( pm->ps->legsTimer > 0 ) { @@ -112,7 +112,7 @@ static void PM_ContinueLegsAnim( int anim ) { } static void PM_ContinueTorsoAnim( int anim ) { - if ( ( pm->ps->torsoAnim & ~( ANIM_TOGGLEBIT | ANIM_WALLCLIMBING ) ) == anim ) { + if ( ( pm->ps->torsoAnim & ~ANIM_TOGGLEBIT ) == anim ) { return; } if ( pm->ps->torsoTimer > 0 ) { @@ -1358,7 +1358,7 @@ static void PM_GroundClimbTrace( void ) vec3_t surfNormal, movedir, lookdir, forward, right, point; vec3_t refNormal = { 0.0f, 0.0f, 1.0f }; vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f }; - float toAngles[3], surfAngles[3]; + vec3_t toAngles, surfAngles; trace_t trace; int i; @@ -1578,7 +1578,7 @@ static void PM_GroundClimbTrace( void ) pml.groundTrace = trace; //so everything knows where we're wallclimbing (ie client side) - pm->ps->legsAnim |= ANIM_WALLCLIMBING; + pm->ps->eFlags |= EF_WALLCLIMB; //if we're not stuck to the ceiling then set grapplePoint to be a surface normal if( !VectorCompare( trace.plane.normal, ceilingNormal ) ) @@ -1606,7 +1606,7 @@ static void PM_GroundClimbTrace( void ) PM_GroundTraceMissed(); pml.groundPlane = qfalse; pml.walking = qfalse; - pm->ps->legsAnim &= ~ANIM_WALLCLIMBING; + pm->ps->eFlags &= ~EF_WALLCLIMB; pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING; @@ -1642,7 +1642,6 @@ PM_GroundTrace static void PM_GroundTrace( void ) { vec3_t point, forward, srotAxis; vec3_t refNormal = { 0.0f, 0.0f, 1.0f }; - vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f }; trace_t trace; float srotAngle; @@ -1673,7 +1672,7 @@ static void PM_GroundTrace( void ) { pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBING; pm->ps->stats[ STAT_STATE ] &= ~SS_WALLCLIMBINGCEILING; - pm->ps->legsAnim &= ~ANIM_WALLCLIMBING; + pm->ps->eFlags &= ~EF_WALLCLIMB; //make sure that the surfNormal is reset to the ground if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) ) @@ -2488,13 +2487,9 @@ are being updated instead of a full move */ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) { - short temp[3]; + short temp[ 3 ]; int i; - vec3_t surfNormal, xNormal; - vec3_t axis[3], rotaxis[3]; - vec3_t refNormal = { 0.0f, 0.0f, 1.0f }; - vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f }; - float rotAngle; + vec3_t axis[ 3 ], rotaxis[ 3 ]; vec3_t tempang; if( ps->pm_type == PM_INTERMISSION || ps->pm_type == PM_SPINTERMISSION ) @@ -2528,42 +2523,9 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) //convert viewangles -> axis AnglesToAxis( tempang, axis ); - //the grapplePoint being a surfNormal rotation Normal hack... see above :) - if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) - { - VectorCopy( ceilingNormal, surfNormal ); - VectorCopy( ps->grapplePoint, xNormal ); - } - else - { - //cross the reference normal and the surface normal to get the rotation axis - VectorCopy( ps->grapplePoint, surfNormal ); - CrossProduct( surfNormal, refNormal, xNormal ); - VectorNormalize( xNormal ); - } - - //if we're a wall climber.. and we're climbing rotate the axis - if( BG_ClassHasAbility( pm->ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) && - ( pm->ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) && - ( VectorLength( xNormal ) != 0 ) ) - { - //if the normal pointing straight down then the rotAngle will always be 180deg - if( surfNormal[2] == -1 ) - rotAngle = 180; - else - rotAngle = RAD2DEG( acos( DotProduct( surfNormal, refNormal ) ) ); - - //hmmm could get away with only one rotation and some clever stuff later... but i'm lazy - RotatePointAroundVector( rotaxis[0], xNormal, axis[0], -rotAngle ); - RotatePointAroundVector( rotaxis[1], xNormal, axis[1], -rotAngle ); - RotatePointAroundVector( rotaxis[2], xNormal, axis[2], -rotAngle ); - } - else - { - //we can't wall climb/aren't wall climbing - rotAngle = 0; + if( !BG_rotateAxis( ps->grapplePoint, axis, rotaxis, qfalse, + ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) ) AxisCopy( axis, rotaxis ); - } //convert the new axis back to angles AxisToAngles( rotaxis, tempang ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index ab3a1a61..cce117f8 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -278,11 +278,11 @@ typedef enum { // entityState_t->eFlags #define EF_DEAD 0x00000001 // don't draw a foe marker over players with EF_DEAD #define EF_TELEPORT_BIT 0x00000002 // toggled every time the origin abruptly changes -#define EF_AWARD_EXCELLENT 0x00000004 // draw an excellent sprite -#define EF_PLAYER_EVENT 0x00000008 -#define EF_BOUNCE 0x00000010 // for missiles -#define EF_BOUNCE_HALF 0x00000020 // for missiles -#define EF_AWARD_GAUNTLET 0x00000040 // draw a gauntlet sprite +#define EF_PLAYER_EVENT 0x00000004 +#define EF_BOUNCE 0x00000008 // for missiles +#define EF_BOUNCE_HALF 0x00000010 // for missiles +#define EF_WALLCLIMB 0x00000020 // TA: wall walking +#define EF_WALLCLIMBCEILING 0x00000040 // TA: wall walking ceiling hack #define EF_NODRAW 0x00000080 // may have an event, but no model (unspawned items) #define EF_FIRING 0x00000100 // for lightning gun #define EF_FIRING2 0x00000200 // alt fire @@ -291,9 +291,8 @@ typedef enum { #define EF_CONNECTION 0x00001000 // draw a connection trouble sprite #define EF_VOTED 0x00002000 // already cast a vote #define EF_TEAMVOTED 0x00004000 // already cast a vote -#define EF_AWARD_IMPRESSIVE 0x00008000 // draw an impressive sprite -#define EF_OVERDRAW_OFF 0x00010000 // TA: disable overdraw protection on sprites -#define EF_REAL_LIGHT 0x00020000 // TA: light sprites according to ambient light +#define EF_OVERDRAW_OFF 0x00008000 // TA: disable overdraw protection on sprites +#define EF_REAL_LIGHT 0x00010000 // TA: light sprites according to ambient light typedef enum { PW_NONE, @@ -720,7 +719,6 @@ typedef struct animation_s { // flip the togglebit every time an animation // changes so a restart of the same anim can be detected #define ANIM_TOGGLEBIT 128 -#define ANIM_WALLCLIMBING 64 typedef enum { @@ -853,6 +851,7 @@ typedef struct char *humanName; char *modelName; + float modelScale; char *skinName; char *hudName; @@ -1017,6 +1016,8 @@ qboolean BG_gotItem( int item, int stats[ ] ); void BG_activateItem( int item, int stats[ ] ); void BG_deactivateItem( int item, int stats[ ] ); qboolean BG_activated( int item, int stats[ ] ); +qboolean BG_rotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], + vec3_t outAxis[ 3 ], qboolean inverse, qboolean ceiling ); int BG_FindBuildNumForName( char *name ); int BG_FindBuildNumForEntityName( char *name ); @@ -1053,6 +1054,7 @@ int BG_FindClassNumForName( char *name ); char *BG_FindNameForClassNum( int pclass ); char *BG_FindHumanNameForClassNum( int pclass ); char *BG_FindModelNameForClass( int pclass ); +float BG_FindModelScaleForClass( int pclass ); char *BG_FindSkinNameForClass( int pclass ); char *BG_FindHudNameForClass( int pclass ); qboolean BG_FindStagesForClass( int pclass, stage_t stage ); diff --git a/src/game/g_active.c b/src/game/g_active.c index f6a76c70..077acecd 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -852,11 +852,6 @@ void ClientThink_real( gentity_t *ent ) { return; } - // clear the rewards if time - if ( level.time > client->rewardTime ) { - client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET ); - } - if( client->noclip ) client->ps.pm_type = PM_NOCLIP; else if( client->ps.stats[STAT_HEALTH] <= 0 ) |