//----------------------------------------------------------------------------- // Purpose: // Output : RenderGroup_t //----------------------------------------------------------------------------- RenderGroup_t C_VGuiScreen::GetRenderGroup() { if ( IsAttachedToViewModel() ) return RENDER_GROUP_VIEW_MODEL_TRANSLUCENT; return BaseClass::GetRenderGroup(); }
int CVGuiScreen::ShouldTransmit( const CCheckTransmitInfo *pInfo ) { Assert( IsAttachedToViewModel() ); CBaseEntity *pViewModel = GetOwnerEntity(); if ( pViewModel ) { return pViewModel->ShouldTransmit( pInfo ); } return BaseClass::ShouldTransmit( pInfo ); }
//----------------------------------------------------------------------------- // Returns the attachment render origin + origin //----------------------------------------------------------------------------- void C_VGuiScreen::GetAimEntOrigin( IClientEntity *pAttachedTo, Vector *pOrigin, QAngle *pAngles ) { C_BaseEntity *pEnt = pAttachedTo->GetBaseEntity(); if (pEnt && (m_nAttachmentIndex > 0)) { pEnt->GetAttachment( m_nAttachmentIndex, *pOrigin, *pAngles ); if ( IsAttachedToViewModel() ) { FormatViewModelAttachment( *pOrigin, true ); } } else { BaseClass::GetAimEntOrigin( pAttachedTo, pOrigin, pAngles ); } }
//----------------------------------------------------------------------------- // Returns the attachment render origin + origin //----------------------------------------------------------------------------- void C_VGuiScreen::GetAimEntOrigin( IClientEntity *pAttachedTo, Vector *pOrigin, QAngle *pAngles ) { C_BaseEntity *pEnt = pAttachedTo->GetBaseEntity(); const char* panelName = PanelName(); vgui::Panel panel = m_PanelWrapper.GetPanel(); if ( Q_strcmp(panelName, "health_screen") == 0 ) { QAngle weapAngles = pEnt->GetAbsAngles(); Vector weapForward, weapRight, weapUp; AngleVectors(weapAngles, &weapForward, &weapRight, &weapUp); VMatrix worldFromPanel; AngleMatrix(weapAngles, worldFromPanel.As3x4()); MatrixRotate(worldFromPanel, Vector(0, 0, 1), 180.f); MatrixRotate(worldFromPanel, Vector(1, 0, 0), -90.f); MatrixAngles(worldFromPanel.As3x4(), *pAngles); // move it right and over *pOrigin = pEnt->GetAbsOrigin() + weapRight*1.75 + weapUp*2.3 + weapForward*5; return; } //todo: set alpha per view ... m_PanelWrapper.GetPanel()->SetAlpha(200); if (pEnt && (m_nAttachmentIndex > 0)) { { C_BaseAnimating::AutoAllowBoneAccess boneaccess( true, true ); pEnt->GetAttachment( m_nAttachmentIndex, *pOrigin, *pAngles ); } if ( IsAttachedToViewModel() ) { FormatViewModelAttachment( *pOrigin, true ); } } else { BaseClass::GetAimEntOrigin( pAttachedTo, pOrigin, pAngles ); } // Msg("%s origin %.1f %.1f %.1f angles %.1f %.1f %.1f \n", PanelName(), pOrigin->x, pOrigin->y, pOrigin->z, pAngles->x, pAngles->y, pAngles->z); }
//----------------------------------------------------------------------------- // Purpose: Screens attached to view models only go to client if viewmodel is being sent, too. // Input : *recipient - // *pvs - // clientArea - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- int CVGuiScreen::UpdateTransmitState() { if ( IsAttachedToViewModel() ) { // only send to the owner, or someone spectating the owner. return SetTransmitState( FL_EDICT_FULLCHECK ); } else if ( GetMoveParent() ) { // Let the parent object trigger the send. This is more efficient than having it call CBaseEntity::ShouldTransmit // for all the vgui screens in the map. return SetTransmitState( FL_EDICT_PVSCHECK ); } else { return BaseClass::UpdateTransmitState(); } }