void C_BaseAnimatingOverlay::GetRenderBounds( Vector& theMins, Vector& theMaxs ) { BaseClass::GetRenderBounds( theMins, theMaxs ); if ( !IsRagdoll() ) { CStudioHdr *pStudioHdr = GetModelPtr(); if ( !pStudioHdr || !pStudioHdr->SequencesAvailable() ) return; int nSequences = pStudioHdr->GetNumSeq(); int i; for (i = 0; i < m_AnimOverlay.Count(); i++) { if (m_AnimOverlay[i].m_flWeight > 0.0) { if ( m_AnimOverlay[i].m_nSequence >= nSequences ) { continue; } mstudioseqdesc_t &seqdesc = pStudioHdr->pSeqdesc( m_AnimOverlay[i].m_nSequence ); VectorMin( seqdesc.bbmin, theMins, theMins ); VectorMax( seqdesc.bbmax, theMaxs, theMaxs ); } } } }
bool C_SDKPlayer::ShouldDraw( void ) { // If we're dead, our ragdoll will be drawn for us instead. if ( !IsAlive() ) return false; if( GetTeamNumber() == TEAM_SPECTATOR ) return false; if ( State_Get() == STATE_WELCOME ) return false; #if defined ( SDK_USE_TEAMS ) if ( State_Get() == STATE_PICKINGTEAM ) return false; #endif #if defined ( SDK_USE_PLAYERCLASSES ) if ( State_Get() == STATE_PICKINGCLASS ) return false; #endif if( IsLocalPlayer() && IsRagdoll() ) return true; return BaseClass::ShouldDraw(); }
bool C_HL2MP_Player::ShouldDraw( void ) { // If we're dead, our ragdoll will be drawn for us instead. if ( !IsAlive() ) return false; if( GetTeamNumber() == TEAM_SPECTATOR ) return false; if( IsLocalPlayer() && IsRagdoll() ) return true; if ( IsRagdoll() ) return false; return BaseClass::ShouldDraw(); }
const QAngle& C_NEOPlayer::GetRenderAngles() { if ( IsRagdoll() ) return vec3_angle; else return m_PlayerAnimState->GetRenderAngles(); }
//----------------------------------------------------------------------------- // Makes ragdolls ignore npcclip brushes //----------------------------------------------------------------------------- unsigned int C_AI_BaseNPC::PhysicsSolidMaskForEntity( void ) const { // This allows ragdolls to move through npcclip brushes if ( !IsRagdoll() ) { return MASK_NPCSOLID; } return MASK_SOLID; }
const QAngle& C_HL2MP_Player::GetRenderAngles() { if ( IsRagdoll() ) { return vec3_angle; } else { return m_PlayerAnimState->GetRenderAngles(); } }
bool C_CFPlayer::ShouldDraw( void ) { // If we're dead, our ragdoll will be drawn for us instead. if ( !IsAlive() && !IsKnockedOut() ) return false; if( GetTeamNumber() == TEAM_SPECTATOR ) return false; if( IsLocalPlayer() && IsRagdoll() ) return true; if (m_hCameraCinematic != NULL) return false; // Skip C_BasePlayer::ShouldDraw() because it has a bunch of logic we don't care for. return C_BaseCombatCharacter::ShouldDraw(); }
const Vector& C_SDKPlayer::GetRenderOrigin( void ) { if ( IsRagdoll() ) { return m_pRagdoll->GetRagdollOrigin(); } else { static Vector origin = vec3_origin; origin = BaseClass::GetRenderOrigin(); //origin.z = origin.z - VEC_HULL_MAX.z + VEC_HULL_MAX.z * m_nModelScale / 100.0f; origin.z += VEC_HULL_MAX.z / 2.0f * (m_nModelScale / 100.0f - 1.0f); if (this == GetLocalSDKPlayer()) { Vector vSmoothOffset; GetPredictionErrorSmoothingVector( vSmoothOffset ); origin += Vector(vSmoothOffset.x, vSmoothOffset.y, 0); return origin; } else return origin; } }
//----------------------------------------------------------------------------- // Purpose: Draws the object //----------------------------------------------------------------------------- int C_NPC_Barnacle::InternalDrawModel( int flags ) { if ( !GetModel() ) return 0; // Make sure hdr is valid for drawing if ( !GetModelPtr() ) return 0; // UNDONE: With a bit of work on the model->world transform, we can probably // move the frustum culling into the client DLL entirely. Then TestVisibility() // can just return true/false and only be called when frustumcull is set. if ( flags & STUDIO_FRUSTUMCULL ) { switch ( TestVisibility() ) { // not visible, don't draw case VIS_NOT_VISIBLE: return 0; // definitely visible, disable engine check case VIS_IS_VISIBLE: flags &= ~STUDIO_FRUSTUMCULL; break; default: case VIS_USE_ENGINE: break; } } Vector vecMins, vecMaxs; GetRenderBounds( vecMins, vecMaxs ); int drawn = modelrender->DrawModel( flags, this, GetModelInstance(), index, GetModel(), GetAbsOrigin(), GetAbsAngles(), GetSequence(), m_nSkin, m_nBody, m_nHitboxSet, &GetAbsMins(), &GetAbsMaxs() ); if ( vcollide_wireframe.GetBool() ) { if ( IsRagdoll() ) { m_pRagdoll->DrawWireframe(); } else { vcollide_t *pCollide = modelinfo->GetVCollide( GetModelIndex() ); if ( pCollide && pCollide->solidCount == 1 ) { static color32 debugColor = {0,255,255,0}; matrix3x4_t matrix; AngleMatrix( GetAbsAngles(), GetAbsOrigin(), matrix ); engine->DebugDrawPhysCollide( pCollide->solids[0], NULL, matrix, debugColor ); } } } return drawn; }