// This function makes sure that the vehicle is properly animated. static void AnimateVehicle( Vehicle_t *pVeh ) { animNumber_t Anim = BOTH_STAND1; int iFlags = SETANIM_FLAG_NORMAL, iBlend = 300; gentity_t *parent = (gentity_t *)pVeh->m_pParentEntity; float fSpeedPercToMax; // We're dead (boarding is reused here so I don't have to make another variable :-). if ( parent->health <= 0 ) { /* if ( pVeh->m_iBoarding != -999 ) // Animate the death just once! { pVeh->m_iBoarding = -999; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; // FIXME! Why do you keep repeating over and over!!?!?!? Bastard! //Vehicle_SetAnim( parent, SETANIM_LEGS, BOTH_VT_DEATH1, iFlags, iBlend ); } */ return; } // Following is redundant to g_vehicles.c // if ( pVeh->m_iBoarding ) // { // //we have no boarding anim // if (pVeh->m_iBoarding < level.time) // { //we are on now // pVeh->m_iBoarding = 0; // } // else // { // return; // } // } // Percentage of maximum speed relative to current speed. //float fSpeed = VectorLength( client->ps.velocity ); fSpeedPercToMax = parent->client->ps.speed / pVeh->m_pVehicleInfo->speedMax; // If we're moving... if ( fSpeedPercToMax > 0.0f ) //fSpeedPercToMax >= 0.85f ) { float fYawDelta; iBlend = 300; iFlags = SETANIM_FLAG_OVERRIDE; fYawDelta = pVeh->m_vPrevOrientation[YAW] - pVeh->m_vOrientation[YAW]; // NOTE: Mikes suggestion for fixing the stuttering walk (left/right) is to maintain the // current frame between animations. I have no clue how to do this and have to work on other // stuff so good luck to him :-p AReis // If we're walking (or our speed is less than .275%)... if ( ( pVeh->m_ucmd.buttons & BUTTON_WALKING ) || fSpeedPercToMax < 0.275f ) { // Make them lean if we're turning. /*if ( fYawDelta < -0.0001f ) { Anim = BOTH_VT_WALK_FWD_L; } else if ( fYawDelta > 0.0001 ) { Anim = BOTH_VT_WALK_FWD_R; } else*/ { Anim = BOTH_WALK1; } } // otherwise we're running. else { // Make them lean if we're turning. /*if ( fYawDelta < -0.0001f ) { Anim = BOTH_VT_RUN_FWD_L; } else if ( fYawDelta > 0.0001 ) { Anim = BOTH_VT_RUN_FWD_R; } else*/ { Anim = BOTH_RUN1; } } } else { // Going in reverse... if ( fSpeedPercToMax < -0.018f ) { iFlags = SETANIM_FLAG_NORMAL; Anim = BOTH_WALKBACK1; iBlend = 500; } else { //int iChance = Q_irand( 0, 20000 ); // Every once in a while buck or do a different idle... iFlags = SETANIM_FLAG_NORMAL | SETANIM_FLAG_RESTART | SETANIM_FLAG_HOLD; iBlend = 600; #ifdef _JK2MP if (parent->client->ps.m_iVehicleNum) #else if ( pVeh->m_pVehicleInfo->Inhabited( pVeh ) ) #endif {//occupado Anim = BOTH_STAND1; } else {//wide open for you, baby Anim = BOTH_STAND2; } } } Vehicle_SetAnim( parent, SETANIM_LEGS, Anim, iFlags, iBlend ); }
//rwwFIXMEFIXME: This is all going to have to be predicted I think, or it will feel awful //and lagged // This function makes sure that the rider's in this vehicle are properly animated. static void AnimateRiders( Vehicle_t *pVeh ) { animNumber_t Anim = BOTH_VT_IDLE; int iFlags = SETANIM_FLAG_NORMAL, iBlend = 500; gentity_t *pilot = (gentity_t *)pVeh->m_pPilot; gentity_t *parent = (gentity_t *)pVeh->m_pParentEntity; playerState_t *pilotPS; float fSpeedPercToMax; pilotPS = pVeh->m_pPilot->playerState; // Boarding animation. if ( pVeh->m_iBoarding != 0 ) { return; } // Percentage of maximum speed relative to current speed. fSpeedPercToMax = parent->client->ps.speed / pVeh->m_pVehicleInfo->speedMax; // Going in reverse... if (0) { Anim = BOTH_VT_WALK_REV; iBlend = 600; } else { qboolean HasWeapon = ((pilotPS->weapon != WP_NONE) && (pilotPS->weapon != WP_MELEE)); qboolean Attacking = (HasWeapon && !!(pVeh->m_ucmd.buttons&BUTTON_ATTACK)); qboolean Right = (pVeh->m_ucmd.rightmove>0); qboolean Left = (pVeh->m_ucmd.rightmove<0); qboolean Turbo = (fSpeedPercToMax>0.0f && level.time<pVeh->m_iTurboTime); qboolean Walking = (fSpeedPercToMax>0.0f && ((pVeh->m_ucmd.buttons&BUTTON_WALKING) || fSpeedPercToMax<=0.275f)); qboolean Running = (fSpeedPercToMax>0.275f); EWeaponPose WeaponPose = WPOSE_NONE; // Remove Crashing Flag //---------------------- pVeh->m_ulFlags &= ~VEH_CRASHING; // Put Away Saber When It Is Not Active //-------------------------------------- // Don't Interrupt Attack Anims //------------------------------ if (pilotPS->weaponTime>0) { return; } // Compute The Weapon Pose //-------------------------- if (pilotPS->weapon==WP_BLASTER) { WeaponPose = WPOSE_BLASTER; } else if (pilotPS->weapon==WP_SABER) { if ( (pVeh->m_ulFlags&VEH_SABERINLEFTHAND) && pilotPS->torsoAnim==BOTH_VT_ATL_TO_R_S) { pVeh->m_ulFlags &= ~VEH_SABERINLEFTHAND; } if (!(pVeh->m_ulFlags&VEH_SABERINLEFTHAND) && pilotPS->torsoAnim==BOTH_VT_ATR_TO_L_S) { pVeh->m_ulFlags |= VEH_SABERINLEFTHAND; } WeaponPose = (pVeh->m_ulFlags&VEH_SABERINLEFTHAND)?(WPOSE_SABERLEFT):(WPOSE_SABERRIGHT); } if (Attacking && WeaponPose) {// Attack! iBlend = 100; iFlags = SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_RESTART; if (Turbo) { Right = qtrue; Left = qfalse; } // Auto Aiming //=============================================== if (!Left && !Right) // Allow player strafe keys to override { if (pilotPS->weapon==WP_SABER && !Left && !Right) { Left = (WeaponPose==WPOSE_SABERLEFT); Right = !Left; } } if (Left) {// Attack Left switch(WeaponPose) { case WPOSE_BLASTER: Anim = BOTH_VT_ATL_G; break; case WPOSE_SABERLEFT: Anim = BOTH_VT_ATL_S; break; case WPOSE_SABERRIGHT: Anim = BOTH_VT_ATR_TO_L_S; break; default: assert(0); } } else if (Right) {// Attack Right switch(WeaponPose) { case WPOSE_BLASTER: Anim = BOTH_VT_ATR_G; break; case WPOSE_SABERLEFT: Anim = BOTH_VT_ATL_TO_R_S; break; case WPOSE_SABERRIGHT: Anim = BOTH_VT_ATR_S; break; default: assert(0); } } else {// Attack Ahead switch(WeaponPose) { case WPOSE_BLASTER: Anim = BOTH_VT_ATF_G; break; default: assert(0); } } } else if (Turbo) {// Kicked In Turbo iBlend = 50; iFlags = SETANIM_FLAG_OVERRIDE; Anim = BOTH_VT_TURBO; } else {// No Special Moves iBlend = 300; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLDLESS; if (WeaponPose==WPOSE_NONE) { if (Walking) { Anim = BOTH_VT_WALK_FWD; } else if (Running) { Anim = BOTH_VT_RUN_FWD; } else { Anim = BOTH_VT_IDLE1;//(Q_irand(0,1)==0)?(BOTH_VT_IDLE):(BOTH_VT_IDLE1); } } else { switch(WeaponPose) { case WPOSE_BLASTER: Anim = BOTH_VT_IDLE_G; break; case WPOSE_SABERLEFT: Anim = BOTH_VT_IDLE_SL; break; case WPOSE_SABERRIGHT: Anim = BOTH_VT_IDLE_SR; break; default: assert(0); } } }// No Special Moves } Vehicle_SetAnim( pilot, SETANIM_BOTH, Anim, iFlags, iBlend ); }
static void AnimateVehicle( Vehicle_t *pVeh ) { animNumber_t Anim = BOTH_VT_IDLE; int iFlags = SETANIM_FLAG_NORMAL, iBlend = 300; gentity_t * pilot = (gentity_t *)pVeh->m_pPilot; gentity_t * parent = (gentity_t *)pVeh->m_pParentEntity; float fSpeedPercToMax; // We're dead (boarding is reused here so I don't have to make another variable :-). if ( parent->health <= 0 ) { /* if ( pVeh->m_iBoarding != -999 ) // Animate the death just once! { pVeh->m_iBoarding = -999; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; // FIXME! Why do you keep repeating over and over!!?!?!? Bastard! //Vehicle_SetAnim( parent, SETANIM_LEGS, BOTH_VT_DEATH1, iFlags, iBlend ); } */ return; } // If they're bucking, play the animation and leave... if ( parent->client->ps.legsAnim == BOTH_VT_BUCK ) { // Done with animation? Erase the flag. if ( parent->client->ps.legsTimer <= 0 ) { pVeh->m_ulFlags &= ~VEH_BUCKING; } else { return; } } else if ( pVeh->m_ulFlags & VEH_BUCKING ) { iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; Anim = BOTH_VT_BUCK; iBlend = 500; Vehicle_SetAnim( parent, SETANIM_LEGS, BOTH_VT_BUCK, iFlags, iBlend ); return; } // Boarding animation. if ( pVeh->m_iBoarding != 0 ) { // We've just started boarding, set the amount of time it will take to finish boarding. if ( pVeh->m_iBoarding < 0 ) { int iAnimLen; // Boarding from left... if ( pVeh->m_iBoarding == -1 ) { Anim = BOTH_VT_MOUNT_L; } else if ( pVeh->m_iBoarding == -2 ) { Anim = BOTH_VT_MOUNT_R; } else if ( pVeh->m_iBoarding == -3 ) { Anim = BOTH_VT_MOUNT_B; } // Set the delay time (which happens to be the time it takes for the animation to complete). // NOTE: Here I made it so the delay is actually 70% (0.7f) of the animation time. iAnimLen = BG_AnimLength( parent->localAnimIndex, Anim ) * 0.7f; pVeh->m_iBoarding = level.time + iAnimLen; // Set the animation, which won't be interrupted until it's completed. // TODO: But what if he's killed? Should the animation remain persistant??? iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; Vehicle_SetAnim( parent, SETANIM_LEGS, Anim, iFlags, iBlend ); if (pilot) { Vehicle_SetAnim(pilot, SETANIM_BOTH, Anim, iFlags, iBlend ); } return; } // Otherwise we're done. else if ( pVeh->m_iBoarding <= level.time ) { pVeh->m_iBoarding = 0; } } // Percentage of maximum speed relative to current speed. //float fSpeed = VectorLength( client->ps.velocity ); fSpeedPercToMax = parent->client->ps.speed / pVeh->m_pVehicleInfo->speedMax; // Going in reverse... if ( fSpeedPercToMax < -0.01f ) { Anim = BOTH_VT_WALK_REV; iBlend = 600; } else { qboolean Turbo = (fSpeedPercToMax>0.0f && level.time<pVeh->m_iTurboTime); qboolean Walking = (fSpeedPercToMax>0.0f && ((pVeh->m_ucmd.buttons&BUTTON_WALKING) || fSpeedPercToMax<=0.275f)); qboolean Running = (fSpeedPercToMax>0.275f); // Remove Crashing Flag //---------------------- pVeh->m_ulFlags &= ~VEH_CRASHING; if (Turbo) {// Kicked In Turbo iBlend = 50; iFlags = SETANIM_FLAG_OVERRIDE; Anim = BOTH_VT_TURBO; } else {// No Special Moves iBlend = 300; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLDLESS; Anim = (Walking)?(BOTH_VT_WALK_FWD ):((Running)?(BOTH_VT_RUN_FWD ):(BOTH_VT_IDLE1)); } } Vehicle_SetAnim( parent, SETANIM_LEGS, Anim, iFlags, iBlend ); }
//rwwFIXMEFIXME: This is all going to have to be predicted I think, or it will feel awful //and lagged // This function makes sure that the rider's in this vehicle are properly animated. static void AnimateRiders( Vehicle_t *pVeh ) { animNumber_t Anim = BOTH_VT_IDLE; int iFlags = SETANIM_FLAG_NORMAL, iBlend = 500; gentity_t *pilot = (gentity_t *)pVeh->m_pPilot; gentity_t *parent = (gentity_t *)pVeh->m_pParentEntity; playerState_t *pilotPS; playerState_t *parentPS; float fSpeedPercToMax; #ifdef _JK2MP pilotPS = pVeh->m_pPilot->playerState; parentPS = pVeh->m_pPilot->playerState; #else pilotPS = &pVeh->m_pPilot->client->ps; parentPS = &pVeh->m_pParentEntity->client->ps; #endif // Boarding animation. if ( pVeh->m_iBoarding != 0 ) { return; } // Percentage of maximum speed relative to current speed. fSpeedPercToMax = parent->client->ps.speed / pVeh->m_pVehicleInfo->speedMax; // Going in reverse... #ifdef _JK2MP //handled in pmove in mp if (0) #else if ( fSpeedPercToMax < -0.01f ) #endif { Anim = BOTH_VT_WALK_REV; iBlend = 600; } else { bool HasWeapon = (qboolean)((pilotPS->weapon != WP_NONE) && (pilotPS->weapon != WP_MELEE)); bool Attacking = (qboolean)(HasWeapon && !!(pVeh->m_ucmd.buttons&BUTTON_ATTACK)); bool Right = (qboolean)(pVeh->m_ucmd.rightmove>0); bool Left = (qboolean)(pVeh->m_ucmd.rightmove<0); bool Turbo = (qboolean)(fSpeedPercToMax>0.0f && level.time<pVeh->m_iTurboTime); bool Walking = (qboolean)(fSpeedPercToMax>0.0f && ((pVeh->m_ucmd.buttons&BUTTON_WALKING) || fSpeedPercToMax<=0.275f)); bool Running = (qboolean)(fSpeedPercToMax>0.275f); EWeaponPose WeaponPose = WPOSE_NONE; // Remove Crashing Flag //---------------------- pVeh->m_ulFlags &= ~VEH_CRASHING; // Put Away Saber When It Is Not Active //-------------------------------------- #ifndef _JK2MP if (HasWeapon && (Turbo || (pilotPS->weapon==WP_SABER && !pilotPS->SaberActive()))) { if (pVeh->m_pPilot->s.number<MAX_CLIENTS) { CG_ChangeWeapon(WP_NONE); } pVeh->m_pPilot->client->ps.weapon = WP_NONE; G_RemoveWeaponModels(pVeh->m_pPilot); } #endif // Don't Interrupt Attack Anims //------------------------------ #ifdef _JK2MP if (pilotPS->weaponTime>0) { return; } #else if (pilotPS->torsoAnim>=BOTH_VT_ATL_S && pilotPS->torsoAnim<=BOTH_VT_ATF_G) { float bodyCurrent = 0.0f; int bodyEnd = 0; if (!!gi.G2API_GetBoneAnimIndex(&pVeh->m_pPilot->ghoul2[pVeh->m_pPilot->playerModel], pVeh->m_pPilot->rootBone, level.time, &bodyCurrent, NULL, &bodyEnd, NULL, NULL, NULL)) { if (bodyCurrent<=((float)(bodyEnd)-1.5f)) { return; } } } #endif // Compute The Weapon Pose //-------------------------- if (pilotPS->weapon==WP_BLASTER) { WeaponPose = WPOSE_BLASTER; } else if (pilotPS->weapon==WP_SABER) { if ( (pVeh->m_ulFlags&VEH_SABERINLEFTHAND) && pilotPS->torsoAnim==BOTH_VT_ATL_TO_R_S) { pVeh->m_ulFlags &= ~VEH_SABERINLEFTHAND; } if (!(pVeh->m_ulFlags&VEH_SABERINLEFTHAND) && pilotPS->torsoAnim==BOTH_VT_ATR_TO_L_S) { pVeh->m_ulFlags |= VEH_SABERINLEFTHAND; } WeaponPose = (pVeh->m_ulFlags&VEH_SABERINLEFTHAND)?(WPOSE_SABERLEFT):(WPOSE_SABERRIGHT); } if (Attacking && WeaponPose) {// Attack! iBlend = 100; iFlags = SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD|SETANIM_FLAG_RESTART; if (Turbo) { Right = true; Left = false; } // Auto Aiming //=============================================== if (!Left && !Right) // Allow player strafe keys to override { #ifndef _JK2MP if (pVeh->m_pPilot->enemy) { vec3_t toEnemy; float toEnemyDistance; vec3_t actorRight; float actorRightDot; VectorSubtract(pVeh->m_pPilot->currentOrigin, pVeh->m_pPilot->enemy->currentOrigin, toEnemy); toEnemyDistance = VectorNormalize(toEnemy); AngleVectors(pVeh->m_pParentEntity->currentAngles, 0, actorRight, 0); actorRightDot = DotProduct(toEnemy, actorRight); if (fabsf(actorRightDot)>0.5f || pilotPS->weapon==WP_SABER) { Left = (actorRightDot>0.0f); Right = !Left; } else { Right = Left = false; } } else #endif if (pilotPS->weapon==WP_SABER && !Left && !Right) { Left = (qboolean)(WeaponPose==WPOSE_SABERLEFT); Right = (qboolean)(!Left); } } if (Left) {// Attack Left switch(WeaponPose) { case WPOSE_BLASTER: Anim = BOTH_VT_ATL_G; break; case WPOSE_SABERLEFT: Anim = BOTH_VT_ATL_S; break; case WPOSE_SABERRIGHT: Anim = BOTH_VT_ATR_TO_L_S; break; default: assert(0); } } else if (Right) {// Attack Right switch(WeaponPose) { case WPOSE_BLASTER: Anim = BOTH_VT_ATR_G; break; case WPOSE_SABERLEFT: Anim = BOTH_VT_ATL_TO_R_S; break; case WPOSE_SABERRIGHT: Anim = BOTH_VT_ATR_S; break; default: assert(0); } } else {// Attack Ahead switch(WeaponPose) { case WPOSE_BLASTER: Anim = BOTH_VT_ATF_G; break; default: assert(0); } } } else if (Turbo) {// Kicked In Turbo iBlend = 50; iFlags = SETANIM_FLAG_OVERRIDE; Anim = BOTH_VT_TURBO; } else {// No Special Moves iBlend = 300; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLDLESS; if (WeaponPose==WPOSE_NONE) { if (Walking) { Anim = BOTH_VT_WALK_FWD; } else if (Running) { Anim = BOTH_VT_RUN_FWD; } else { Anim = BOTH_VT_IDLE1;//(Q_irand(0,1)==0)?(BOTH_VT_IDLE):(BOTH_VT_IDLE1); } } else { switch(WeaponPose) { case WPOSE_BLASTER: Anim = BOTH_VT_IDLE_G; break; case WPOSE_SABERLEFT: Anim = BOTH_VT_IDLE_SL; break; case WPOSE_SABERRIGHT: Anim = BOTH_VT_IDLE_SR; break; default: assert(0); } } }// No Special Moves } Vehicle_SetAnim( pilot, SETANIM_BOTH, Anim, iFlags, iBlend ); }
// This function makes sure that the vehicle is properly animated. static void AnimateVehicle( Vehicle_t *pVeh ) { animNumber_t Anim = BOTH_STAND1; int iFlags = SETANIM_FLAG_NORMAL; gentity_t *parent = (gentity_t *)pVeh->m_pParentEntity; float fSpeedPercToMax; // We're dead (boarding is reused here so I don't have to make another variable :-). if ( parent->health <= 0 ) { return; } // Percentage of maximum speed relative to current speed. //float fSpeed = VectorLength( client->ps.velocity ); fSpeedPercToMax = parent->client->ps.speed / pVeh->m_pVehicleInfo->speedMax; // If we're moving... if ( fSpeedPercToMax > 0.0f ) //fSpeedPercToMax >= 0.85f ) { float fYawDelta; iFlags = SETANIM_FLAG_OVERRIDE; fYawDelta = pVeh->m_vPrevOrientation[YAW] - pVeh->m_vOrientation[YAW]; // NOTE: Mikes suggestion for fixing the stuttering walk (left/right) is to maintain the // current frame between animations. I have no clue how to do this and have to work on other // stuff so good luck to him :-p AReis // If we're walking (or our speed is less than .275%)... if ( ( pVeh->m_ucmd.buttons & BUTTON_WALKING ) || fSpeedPercToMax < 0.275f ) { // Make them lean if we're turning. /*if ( fYawDelta < -0.0001f ) { Anim = BOTH_VT_WALK_FWD_L; } else if ( fYawDelta > 0.0001 ) { Anim = BOTH_VT_WALK_FWD_R; } else*/ { Anim = BOTH_WALK1; } } // otherwise we're running. else { // Make them lean if we're turning. /*if ( fYawDelta < -0.0001f ) { Anim = BOTH_VT_RUN_FWD_L; } else if ( fYawDelta > 0.0001 ) { Anim = BOTH_VT_RUN_FWD_R; } else*/ { Anim = BOTH_RUN1; } } } else { // Going in reverse... if ( fSpeedPercToMax < -0.018f ) { iFlags = SETANIM_FLAG_NORMAL; Anim = BOTH_WALKBACK1; } else { //int iChance = Q_irand( 0, 20000 ); // Every once in a while buck or do a different idle... iFlags = SETANIM_FLAG_NORMAL | SETANIM_FLAG_RESTART | SETANIM_FLAG_HOLD; if (parent->client->ps.m_iVehicleNum) {//occupado Anim = BOTH_STAND1; } else {//wide open for you, baby Anim = BOTH_STAND2; } } } Vehicle_SetAnim( parent, SETANIM_LEGS, Anim, iFlags ); }
// This function makes sure that the vehicle is properly animated. static void AnimateVehicle( Vehicle_t *pVeh ) { animNumber_t Anim = BOTH_STAND1; int iFlags = SETANIM_FLAG_NORMAL, iBlend = 300; gentity_t *parent = (gentity_t *)pVeh->m_pParentEntity; float fSpeedPercToMax; // We're dead (boarding is reused here so I don't have to make another variable :-). if ( parent->health <= 0 ) { /* if ( pVeh->m_iBoarding != -999 ) // Animate the death just once! { pVeh->m_iBoarding = -999; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; // FIXME! Why do you keep repeating over and over!!?!?!? Bastard! //Vehicle_SetAnim( parent, SETANIM_LEGS, BOTH_VT_DEATH1, iFlags, iBlend ); } */ return; } // Following is redundant to g_vehicles.c // if ( pVeh->m_iBoarding ) // { // //we have no boarding anim // if (pVeh->m_iBoarding < level.time) // { //we are on now // pVeh->m_iBoarding = 0; // } // else // { // return; // } // } // Percentage of maximum speed relative to current speed. //float fSpeed = VectorLength( client->ps.velocity ); fSpeedPercToMax = parent->client->ps.speed / pVeh->m_pVehicleInfo->speedMax; // If we're moving... if ( fSpeedPercToMax > 0.0f ) //fSpeedPercToMax >= 0.85f ) { float fYawDelta; iBlend = 300; iFlags = SETANIM_FLAG_OVERRIDE; fYawDelta = pVeh->m_vPrevOrientation[YAW] - pVeh->m_vOrientation[YAW]; // NOTE: Mikes suggestion for fixing the stuttering walk (left/right) is to maintain the // current frame between animations. I have no clue how to do this and have to work on other // stuff so good luck to him :-p AReis // If we're walking (or our speed is less than .275%)... if ( ( pVeh->m_ucmd.buttons & BUTTON_WALKING ) || fSpeedPercToMax < 0.275f ) { // Make them lean if we're turning. /*if ( fYawDelta < -0.0001f ) { Anim = BOTH_VT_WALK_FWD_L; } else if ( fYawDelta > 0.0001 ) { Anim = BOTH_VT_WALK_FWD_R; } else*/ { Anim = BOTH_WALK1; //ROP VEHICLE_IMP START SetVehicleMode(pVeh, VEHICLE_MODE_WALKING); //ROP VEHICLE_IMP END } } // otherwise we're running. else { // Make them lean if we're turning. /*if ( fYawDelta < -0.0001f ) { Anim = BOTH_VT_RUN_FWD_L; } else if ( fYawDelta > 0.0001 ) { Anim = BOTH_VT_RUN_FWD_R; } else*/ { Anim = BOTH_RUN1; //ROP VEHICLE_IMP START SetVehicleMode(pVeh, VEHICLE_MODE_RUNNING); //ROP VEHICLE_IMP END } } } else { // Going in reverse... if ( fSpeedPercToMax < -0.018f ) { iFlags = SETANIM_FLAG_NORMAL; Anim = BOTH_WALKBACK1; iBlend = 500; //ROP VEHICLE_IMP START SetVehicleMode(pVeh, VEHICLE_MODE_BACKWARDS); //ROP VEHICLE_IMP END } else { //int iChance = Q_irand( 0, 20000 ); // Every once in a while buck or do a different idle... iFlags = SETANIM_FLAG_NORMAL | SETANIM_FLAG_RESTART | SETANIM_FLAG_HOLD; iBlend = 600; #ifdef _JK2MP if (parent->client->ps.m_iVehicleNum) #else if ( pVeh->m_pVehicleInfo->Inhabited( pVeh ) ) #endif {//occupado //ROP VEHICLE_IMP START if(pVeh->eTurningOnSpot == VEHICLE_TURNING_LEFT) { //Were turning - use the walk anim (for now I guess) iBlend = 300; iFlags = SETANIM_FLAG_OVERRIDE; Anim = BOTH_TURN_LEFT1; SetVehicleMode(pVeh, VEHICLE_MODE_TURNING); } else if(pVeh->eTurningOnSpot == VEHICLE_TURNING_RIGHT) { //Were turning - use the walk anim (for now I guess) iBlend = 300; iFlags = SETANIM_FLAG_OVERRIDE; Anim = BOTH_TURN_RIGHT1; SetVehicleMode(pVeh, VEHICLE_MODE_TURNING); } else { Anim = BOTH_STAND1; SetVehicleMode(pVeh, VEHICLE_MODE_STILL); } //ROP VEHICLE_IMP END } else {//wide open for you, baby //ROP VEHICLE_IMP START Anim = BOTH_STAND2; //ROP VEHICLE_IMP END } } } //ROP VEHICLE_IMP START if(pVeh->eCurrentMode == VEHICLE_MODE_STILL) { if(pVeh->m_ucmd.buttons & BUTTON_ATTACK) { //Play primary attack anim Anim = BOTH_ATTACK1; } else if(pVeh->m_ucmd.buttons & BUTTON_ALT_ATTACK) { //Play alt attack anim Anim = BOTH_ATTACK2; } } if(pVeh->m_pParentEntity->playerState->groundEntityNum == ENTITYNUM_NONE) { if(pVeh->eCurrentMode == VEHICLE_MODE_RUNNING) { //Play running in-air anim Anim = BOTH_FORCEINAIR1; } else { //Play 'normal' in-air anim Anim = BOTH_INAIR1; } } if(pVeh->eChangedModeFrom != pVeh->eCurrentMode && pVeh->m_pVehicleInfo->VehicleMovementModesActive) { //We've just changed modes //Do any nessesary change modes tasks //Shields if((pVeh->m_pVehicleInfo->MBFdisableshields & pVeh->eCurrentMode) && (!(pVeh->m_pVehicleInfo->MBFdisableshields & pVeh->eChangedModeFrom))) { //We've just changed to a mode which disables shields //We need to remembe the current shield value //and set the real armour value to 0 pVeh->m_iDisabledShieldStore = parent->client->ps.stats[STAT_ARMOR]; parent->client->ps.stats[STAT_ARMOR] = 0; } else if((pVeh->m_pVehicleInfo->MBFdisableshields & pVeh->eChangedModeFrom) && (!(pVeh->m_pVehicleInfo->MBFdisableshields & pVeh->eCurrentMode))) { //We've just changed to a mode which enables shields //We need to put the shields back up to the stored value parent->client->ps.stats[STAT_ARMOR] = pVeh->m_iDisabledShieldStore; } //WalkToRun if(pVeh->eChangedModeFrom == VEHICLE_MODE_WALKING && pVeh->eCurrentMode == VEHICLE_MODE_RUNNING) { pVeh->nTransAnim = BOTH_RUN1START; pVeh->bTransAnimFlag = qtrue; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; } //RunToWalk else if(pVeh->eChangedModeFrom == VEHICLE_MODE_RUNNING && pVeh->eCurrentMode == VEHICLE_MODE_WALKING) { pVeh->nTransAnim = BOTH_RUN1STOP; pVeh->bTransAnimFlag = qtrue; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; } //StandToWalk else if((pVeh->eChangedModeFrom == VEHICLE_MODE_STILL || pVeh->eChangedModeFrom == VEHICLE_MODE_TURNING) && pVeh->eCurrentMode == VEHICLE_MODE_WALKING) { pVeh->nTransAnim = BOTH_STAND1TO2; pVeh->bTransAnimFlag = qtrue; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; } //WalkToStand else if(pVeh->eChangedModeFrom == VEHICLE_MODE_WALKING && pVeh->eCurrentMode == VEHICLE_MODE_STILL) { pVeh->nTransAnim = BOTH_STAND2TO1; pVeh->bTransAnimFlag = qtrue; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; } //StandToBack else if(pVeh->eChangedModeFrom == VEHICLE_MODE_STILL && pVeh->eCurrentMode == VEHICLE_MODE_BACKWARDS) { pVeh->nTransAnim = BOTH_STAND2TO4; pVeh->bTransAnimFlag = qtrue; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; } //BackToStand else if(pVeh->eChangedModeFrom == VEHICLE_MODE_BACKWARDS && pVeh->eCurrentMode == VEHICLE_MODE_STILL) { pVeh->nTransAnim = BOTH_STAND4TO2; pVeh->bTransAnimFlag = qtrue; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; } //StandToTurn else if(pVeh->eChangedModeFrom == VEHICLE_MODE_STILL && pVeh->eCurrentMode == VEHICLE_MODE_TURNING) { pVeh->nTransAnim = BOTH_STAND5SHIFTWEIGHTSTART; pVeh->bTransAnimFlag = qtrue; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; } //TurnToStand else if(pVeh->eChangedModeFrom == VEHICLE_MODE_TURNING && pVeh->eCurrentMode == VEHICLE_MODE_STILL) { pVeh->nTransAnim = BOTH_STAND5SHIFTWEIGHTSTOP; pVeh->bTransAnimFlag = qtrue; iFlags = SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD; } } //Syncronise the mode change check pVeh->eChangedModeFrom = pVeh->eCurrentMode; //Over-ride with transition anims //if(pVeh->nTransAnimTime > pm->cmd.serverTime) if(pVeh->bTransAnimFlag) { Anim = pVeh->nTransAnim; } //ROP VEHICLE_IMP END Vehicle_SetAnim( parent, SETANIM_LEGS, Anim, iFlags, iBlend ); }