Hi guys,

Just a quick note:  If you have guys making vehicles for your mod, and they
forget to put in an exit animation, your mod will crash when the player gets
out of the vehicle.

sdk_vehicle_jeep.cpp in CJeepFourWheelServerVehicle::GetExitAnimToUse

At:
pAnimating->GetAttachment( m_ExitAnimations[0].iAttachment,
vehicleExitOrigin, vehicleExitAngles );

Ok the reason for this is m_ExitAnimations is not populated when no exit
anims exist.

A simple check (on m_ExitAnimations.Count()) to see if theres any data in
that vector fixes the problem.  Heres my fix:



int CJeepFourWheelServerVehicle::GetExitAnimToUse( Vector
&vecEyeExitEndpoint, bool &bAllPointsBlocked )
{
bAllPointsBlocked = false;

if ( !m_bParsedAnimations )
{
 // Load the entry/exit animations from the vehicle
 ParseEntryExitAnims();
 m_bParsedAnimations = true;
}

CBaseAnimating *pAnimating = dynamic_cast<CBaseAnimating *>(m_pVehicle);

// If we don't have the gun anymore, we want to get out using the
"gun-less" animation
// Scott McNaught: Fix for vehicles without exit animations
if ( pAnimating && m_ExitAnimations.Count() )
{
 // HACK: We know the tau-cannon removed exit anim uses the first upright
anim's exit details
 trace_t tr;
 Vector vehicleExitOrigin;
 QAngle vehicleExitAngles;

 // If we have an exit point, use it
 pAnimating->GetAttachment( m_ExitAnimations[0].iAttachment,
vehicleExitOrigin, vehicleExitAngles );

 // Ensure the endpoint is clear by dropping a point down from above
 vehicleExitOrigin -= VEC_VIEW;
 Vector vecMove = Vector(0,0,64);
 Vector vecStart = vehicleExitOrigin + vecMove;
 Vector vecEnd = vehicleExitOrigin - vecMove;
   UTIL_TraceHull( vecStart, vecEnd, VEC_HULL_MIN, VEC_HULL_MAX,
MASK_SOLID, NULL, COLLISION_GROUP_NONE, &tr );

 Assert( !tr.startsolid && tr.fraction < 1.0 );
 m_vecCurrentExitEndPoint = vecStart + ((vecEnd - vecStart) * tr.fraction);

 vecEyeExitEndpoint = m_vecCurrentExitEndPoint + VEC_VIEW;
 m_iCurrentExitAnim = 0;
 return pAnimating->LookupSequence( "exit_tauremoved" );
}

return BaseClass::GetExitAnimToUse( vecEyeExitEndpoint,
bAllPointsBlocked );
}



Hope this helps someone,

FragMented / Scott McNaught
HL Rally - http://hlrally.net




_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders



Reply via email to