Esempio n. 1
0
//.gm active
bool ChatHandler::HandleGMActiveCommand(const char* args, WorldSession* m_session)
{
    auto player = m_session->GetPlayer();
    bool toggle_no_notice = std::string(args) == "no_notice" ? true : false;
    if (player->isGMFlagSet())
    {
        if (!toggle_no_notice)
        {
            SystemMessage(m_session, "GM Flag removed.");
            BlueSystemMessage(m_session, "<GM> Will no longer show in chat messages or above your name until you use this command again.");
        }
        player->removePlayerFlags(PLAYER_FLAG_GM);
        player->SetFaction(player->GetInitialFactionId());
        player->UpdatePvPArea();
        player->UpdateVisibility();
    }
    else
    {
        if (player->hasPlayerFlags(PLAYER_FLAG_DEVELOPER))
            HandleGMDevTagCommand("no_notice", m_session);

        SystemMessage(m_session, "GM Flag set.");
        BlueSystemMessage(m_session, "<GM> will now appear above your name and in chat messages until you use this command again.");
        player->addPlayerFlags(PLAYER_FLAG_GM);
        player->SetFaction(35);
        player->RemovePvPFlag();
        player->UpdateVisibility();
    }
    return true;
}
//-----------------------------------------------------------------------------
C_BaseAnimating * C_CHostage::BecomeRagdollOnClient()
{
	if ( g_RagdollLVManager.IsLowViolence() )
	{
		// We can't just play the low-violence anim ourselves, since we're about to be deleted by the server.
		// So, let's create another entity that can play the anim and stick around.
		C_LowViolenceHostageDeathModel *pLowViolenceModel = new C_LowViolenceHostageDeathModel();
		m_createdLowViolenceRagdoll = pLowViolenceModel->SetupLowViolenceModel( this );
		if ( m_createdLowViolenceRagdoll )
		{
			UpdateVisibility();
			g_HostageRagdolls.AddToTail( pLowViolenceModel );
			return pLowViolenceModel;
		}
		else
		{
			// if we don't have a low-violence death anim, don't create a ragdoll.
			return NULL;
		}
	}

	C_BaseAnimating *pRagdoll = BaseClass::BecomeRagdollOnClient();
	if ( pRagdoll && pRagdoll != this )
	{
		g_HostageRagdolls.AddToTail( pRagdoll );
	}
	return pRagdoll;
}
Esempio n. 3
0
    void DiInstanceBatch::CullingUpdate( DiRenderBatchGroup* group, DiCamera* )
    {
        mDirtyAnimation = false;

        UpdateVisibility();

        mPrimitiveCount = mMeshReference->GetSubMesh(mCreator->mSubMeshIdx)->GetPrimitiveCount();
        mPrimitiveCount *= GetModelNums();

        if( mVisible )
        {
            if (HasSkeleton())
            {
                InstancedModelVec::const_iterator itor = mInstancedModels.begin();
                InstancedModelVec::const_iterator end  = mInstancedModels.end();

                while( itor != end )    
                {
                    mDirtyAnimation |= (*itor)->UpdateAnimation();
                    ++itor;
                }
            }

            group->AddRenderUnit( this );
        }

        mVisible = true;
    }
Esempio n. 4
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_NPC_Puppet::ClientThink( void )
{
	if ( m_hAnimationTarget == NULL )
		return;

	C_BaseAnimating *pTarget = m_hAnimationTarget->GetBaseAnimating();
	if ( pTarget == NULL )
		return;

	int nTargetSequence = pTarget->GetSequence();
	const char *pSequenceName = pTarget->GetSequenceName( nTargetSequence );

	int nSequence = LookupSequence( pSequenceName );
	if ( nSequence >= 0 )
	{
		if ( nSequence != GetSequence() )
		{
			SetSequence( nSequence );
			UpdateVisibility();
		}

		SetCycle( pTarget->GetCycle() );
		SetPlaybackRate( pTarget->GetPlaybackRate() );	
	}
}
Esempio n. 5
0
void SuggestionsSidebarBlock::ClearMessage()
{
    m_msgPresent = false;
    m_msgText->SetAndWrapLabel("");
    UpdateVisibility();
    m_parent->Layout();
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool C_FuncPhysicsRespawnZone::Initialize( void )
{
	if ( InitializeAsClientEntity( STRING(GetModelName()), RENDER_GROUP_OPAQUE_ENTITY ) == false )
		return false;

	SetSolid( SOLID_BSP );	
	AddSolidFlags( FSOLID_NOT_SOLID );
	AddSolidFlags( FSOLID_TRIGGER );	
	SetMoveType( MOVETYPE_NONE );

	const model_t *mod = GetModel();
	if ( mod )
	{
		Vector mins, maxs;
		modelinfo->GetModelBounds( mod, mins, maxs );
		SetCollisionBounds( mins, maxs );
	}

	Spawn();

	AddEffects( EF_NODRAW );

	UpdatePartitionListEntry();

	CollisionProp()->UpdatePartition();

	UpdateVisibility();

	SetNextClientThink( gpGlobals->curtime + (cl_phys_props_respawnrate.GetFloat() * RandomFloat(1.0,1.1)) );

	return true;
}
bool CGUIFixedListContainer::OnMessage(CGUIMessage& message)
{
  if (message.GetControlId() == GetID() )
  {
    if (message.GetMessage() == GUI_MSG_ITEM_SELECT)
    {
      if (m_loading)
      {
        m_savedSelected = message.GetParam1();
      }
      else
      {
        UpdateVisibility();
        SelectItem(message.GetParam1());
      }
      return true;
    }
    else if (message.GetMessage() == GUI_MSG_PAGE_UP)
    {
      CAction action;
      action.id = ACTION_PAGE_UP;
      return OnAction(action);
    }
    else if (message.GetMessage() == GUI_MSG_PAGE_DOWN)
    {
      CAction action;
      action.id = ACTION_PAGE_DOWN;
      return OnAction(action);
    }
  }
  return CGUIBaseContainer::OnMessage(message);
}
Esempio n. 8
0
    void DiInstanceBatch::Update(DiCamera* camera)
    {
        mCurrentCamera = camera;
        mDirtyAnimation = false;

        UpdateVisibility();

        mPrimitiveCount = mMeshReference->GetSubMesh(mCreator->mSubMeshIdx)->GetPrimitiveCount();
        mPrimitiveCount *= GetModelNums();

        if (mVisible)
        {
            if (HasSkeleton())
            {
                auto itor = mInstancedModels.begin();
                auto end = mInstancedModels.end();

                while (itor != end)
                {
                    mDirtyAnimation |= (*itor)->UpdateAnimation();
                    ++itor;
                }
            }

            mAddToBatch = true;
        }

        mVisible = true;
    }
Esempio n. 9
0
void SuggestionsSidebarBlock::ClearSuggestions()
{
    m_pendingQueries = 0;
    m_suggestions.clear();
    UpdateSuggestionsMenu();
    UpdateVisibility();
}
Esempio n. 10
0
  void Show(const PixelRect &rc) override {
    assert(!visible);
    visible = true;

    UpdatePositions(rc);
    UpdateVisibility();
  }
bool psEntityLabels::HandleEvent(iEvent& /*ev*/)
{
    static unsigned int count = 0;
    if (++count%10 != 0)  // Update once every 10th frame
        return false;

    if (celClient->GetMainPlayer() == NULL)
        return false;  // Not loaded yet

    if (visItems == LABEL_ALWAYS || visCreatures == LABEL_ALWAYS)
    {
        UpdateVisibility();
    }

    if (visItems == LABEL_ONMOUSE || visCreatures == LABEL_ONMOUSE)
    {
        UpdateMouseover();
    }

    if (visItems == LABEL_ONTARGET || visCreatures == LABEL_ONTARGET)
    {
        UpdateTarget();
    }   

    return false;
}
Esempio n. 12
0
void SuggestionsSidebarBlock::SetMessage(const wxString& icon, const wxString& text)
{
    m_msgPresent = true;
    m_msgIcon->SetBitmap(wxArtProvider::GetBitmap(icon));
    m_msgText->SetAndWrapLabel(text);
    UpdateVisibility();
    m_parent->Layout();
}
Esempio n. 13
0
void C_NEOPlayer::OnDataChanged( DataUpdateType_t updateType )
{
	BaseClass::OnDataChanged( updateType );

	if ( updateType == DATA_UPDATE_CREATED )
		SetNextClientThink( -1293.f );

	UpdateVisibility();
}
Esempio n. 14
0
  void Update(bool _edit, bool _mutate, bool _down, bool _up) {
    show_edit = _edit;
    show_mutate = _mutate;
    show_down = _down;
    show_up = _up;

    if (visible)
      UpdateVisibility();
  }
Esempio n. 15
0
void MySwitchableTextEditor::SetEditorMode(bool edit)
{
    if(edit == m_editor_mode)
        return;
    QString text = GetTextHtml();
    m_editor_mode = edit;
    UpdateVisibility();
    SetTextHtml(text);
}
Esempio n. 16
0
void MySwitchableTextEditor::SetLineMode(bool en)
{
    if(m_line_mode == en)
        return;
    QString text = GetTextHtml();
    m_line_mode = en;
    SetTextHtml(text);
    UpdateVisibility();
}
void CCustomDetector::UpdateCL() 
{
	inherited::UpdateCL();

	UpdateVisibility		();

	if( !IsWorking() )		return;
	UpfateWork				();
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : bnewentity - 
//-----------------------------------------------------------------------------
void C_BaseCombatWeapon::OnDataChanged( DataUpdateType_t updateType )
{
	BaseClass::OnDataChanged(updateType);

	CHandle< C_BaseCombatWeapon > handle;
	handle = this;

	// If it's being carried by the *local* player, on the first update,
	// find the registered weapon for this ID
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if (!pPlayer || !IsBeingCarried() || (GetOwner() != pPlayer) )
	{
		// BRJ 10/14/02
		// FIXME: Remove when Yahn's client-side prediction is done
		// It's a hacky workaround for the model indices fighting
		// (GetRenderBounds uses the model index, which is for the view model)
		SetModelIndex( GetWorldModelIndex() );
		UpdateVisibility();
		m_iOldState = m_iState;
		return;
	}

	// If I was just picked up, or created & immediately carried, add myself to this client's list of weapons
	if ( (m_iState != WEAPON_NOT_CARRIED ) && (m_iOldState == WEAPON_NOT_CARRIED) )
	{
		// Tell the HUD this weapon's been picked up
		if ( ShouldDrawPickup() )
		{
			CBaseHudWeaponSelection *pHudSelection = GetHudWeaponSelection();
			if ( pHudSelection )
			{
				pHudSelection->OnWeaponPickup( this );
			}

			pPlayer->EmitSound( "Player.PickupWeapon" );
		}
	}

	UpdateVisibility();

	m_iOldState = m_iState;

	m_bJustRestored = false;
}
Esempio n. 19
0
void C_HL2MP_Player::OnDataChanged( DataUpdateType_t type )
{
	BaseClass::OnDataChanged( type );

	if ( type == DATA_UPDATE_CREATED )
	{
		SetNextClientThink( CLIENT_THINK_ALWAYS );
	}

	UpdateVisibility();
}
Esempio n. 20
0
void SuggestionsSidebarBlock::Show(bool show)
{
    SidebarBlock::Show(show);
    if (show)
    {
        UpdateVisibility();
    }
    else
    {
        ClearSuggestionsMenu();
    }
}
Esempio n. 21
0
void C_RotatingPickup::PostDataUpdate(DataUpdateType_t updateType)
{
	if (m_bRespawning_Cache != m_bRespawning)
	{
		// Appear/disappear
		UpdateVisibility();
		ClientRotAng.y = 0;
		m_bRespawning_Cache = m_bRespawning;
	}
 
	return BaseClass::PostDataUpdate(updateType);
}
void SLogVisualizerTimeline::AddEntry(const FVisualLogDevice::FVisualLogEntryItem& Entry) 
{ 
	//Entries.Add(Entry); 

	ULogVisualizerSettings* Settings = ULogVisualizerSettings::StaticClass()->GetDefaultObject<ULogVisualizerSettings>();
	
	FVisualLoggerDBRow& DataRow = FVisualLoggerDatabase::Get().GetRowByName(GetName());
	const TArray<FVisualLogDevice::FVisualLogEntryItem>& Entries = DataRow.GetItems();

	UpdateVisibility();

}
Esempio n. 23
0
void CGUIDialog::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
{
  UpdateVisibility();

  // if we were running but now we're not, mark us dirty
  if (!m_active && m_wasRunning)
    dirtyregions.push_back(m_renderRegion);

  if (m_active)
    CGUIWindow::DoProcess(currentTime, dirtyregions);

  m_wasRunning = m_active;
}
Esempio n. 24
0
//================================================================================
// Update hitbox positions and visibility
// This function can be very expensive, it should only be called for the active enemy.
//================================================================================
void CEntityMemory::UpdateHitboxAndVisibility()
{
	VPROF_BUDGET("CEntityMemory::UpdateHitboxAndVisibility", VPROF_BUDGETGROUP_BOTS_EXPENSIVE);

	// For now let's assume that we do not know Hitbox and therefore we have no vision
	UpdateVisibility(false);

	m_Hitbox.Reset();
	m_VisibleHitbox.Reset();

	// We obtain the positions of the Hitbox
	Utils::GetHitboxPositions(GetEntity(), m_Hitbox);

	if (!m_Hitbox.IsValid())
		return;

	{
		VPROF_BUDGET("UpdateVisibility", VPROF_BUDGETGROUP_BOTS_EXPENSIVE);

		// Now let's check if we can see any of them
		if (m_pBot->GetDecision()->IsAbleToSee(m_Hitbox.head)) {
			m_VisibleHitbox.head = m_Hitbox.head;
			UpdateVisibility(true);
		}

		if (m_pBot->GetDecision()->IsAbleToSee(m_Hitbox.chest)) {
			m_VisibleHitbox.chest = m_Hitbox.chest;
			UpdateVisibility(true);
		}

		if (m_pBot->GetDecision()->IsAbleToSee(m_Hitbox.feet)) {
			m_VisibleHitbox.feet = m_Hitbox.feet;
			UpdateVisibility(true);
		}
	}

	// We update the ideal position
	GetVisibleHitboxPosition(m_vecIdealPosition, m_pBot->GetProfile()->GetFavoriteHitbox());
}
//-----------------------------------------------------------------------------
// Purpose: Scales the bones based on the current scales
//-----------------------------------------------------------------------------
void C_PropPuzzleBox::ApplyBoneMatrixTransform( matrix3x4_t& transform )
{
	BaseClass::ApplyBoneMatrixTransform( transform );

	// Find the scale for this frame
	CalculateScale();

	VectorScale( transform[0], m_flCurrentScale[0], transform[0] );
	VectorScale( transform[1], m_flCurrentScale[1], transform[1] );
	VectorScale( transform[2], m_flCurrentScale[2], transform[2] );

	UpdateVisibility();
}
Esempio n. 26
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : bnewentity - 
//-----------------------------------------------------------------------------
void C_BaseCombatWeapon::OnDataChanged( DataUpdateType_t updateType )
{
	BaseClass::OnDataChanged(updateType);

	CHandle< C_BaseCombatWeapon > handle = this;

	// If it's being carried by the *local* player, on the first update,
	// find the registered weapon for this ID

	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	C_BaseCombatCharacter *pOwner = GetOwner();

	// check if weapon is carried by local player
	bool bIsLocalPlayer = pPlayer && pPlayer == pOwner;
	if ( bIsLocalPlayer && ShouldDrawLocalPlayerViewModel() )		// TODO: figure out the purpose of the ShouldDrawLocalPlayer() test.
	{
		// If I was just picked up, or created & immediately carried, add myself to this client's list of weapons
		if ( (m_iState != WEAPON_NOT_CARRIED ) && (m_iOldState == WEAPON_NOT_CARRIED) )
		{
			// Tell the HUD this weapon's been picked up
			if ( ShouldDrawPickup() )
			{
				CBaseHudWeaponSelection *pHudSelection = GetHudWeaponSelection();
				if ( pHudSelection )
				{
					pHudSelection->OnWeaponPickup( this );
				}

				pPlayer->EmitSound( "Player.PickupWeapon" );
			}
		}
	}
	else // weapon carried by other player or not at all
	{
		int overrideModelIndex = CalcOverrideModelIndex();
		if( overrideModelIndex != -1 && overrideModelIndex != GetModelIndex() )
		{
			SetModelIndex( overrideModelIndex );
		}
	}

	if ( updateType == DATA_UPDATE_CREATED )
	{
		UpdateVisibility();
	}

	m_iOldState = m_iState;

	m_bJustRestored = false;
}
Esempio n. 27
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CSprite::OnDataChanged( DataUpdateType_t updateType )
{
	BaseClass::OnDataChanged( updateType );

	// Only think when sapping
	SetNextClientThink( CLIENT_THINK_ALWAYS );
	if ( updateType == DATA_UPDATE_CREATED )
	{
		m_flStartScale = m_flDestScale = m_flSpriteScale;
		m_nStartBrightness = m_nDestBrightness = m_nBrightness;
	}

	UpdateVisibility();
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : bnewentity - 
//-----------------------------------------------------------------------------
void C_BaseCombatWeapon::OnDataChanged( DataUpdateType_t updateType )
{
	BaseClass::OnDataChanged(updateType);

	CHandle< C_BaseCombatWeapon > handle = this;

	// If it's being carried by the *local* player, on the first update,
	// find the registered weapon for this ID

	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	C_BaseCombatCharacter *pOwner = GetOwner();

	// check if weapon is carried by local player
	bool bIsLocalPlayer = pPlayer && pPlayer == pOwner;
	if ( bIsLocalPlayer && !ShouldDrawLocalPlayer() )
	{
		// If I was just picked up, or created & immediately carried, add myself to this client's list of weapons
		if ( (m_iState != WEAPON_NOT_CARRIED ) && (m_iOldState == WEAPON_NOT_CARRIED) )
		{
			// Tell the HUD this weapon's been picked up
			if ( ShouldDrawPickup() )
			{
				CBaseHudWeaponSelection *pHudSelection = GetHudWeaponSelection();
				if ( pHudSelection )
				{
					pHudSelection->OnWeaponPickup( this );
				}

				pPlayer->EmitSound( "Player.PickupWeapon" );
			}
		}
	}
	else // weapon carried by other player or not at all
	{
		// See comment below
		EnsureCorrectRenderingModel();
	}

	UpdateVisibility();

	m_iOldState = m_iState;

	m_bJustRestored = false;
}
Esempio n. 29
0
void CClientObject::StreamedInPulse ( void )
{
    // Some things to do if low LOD object
    if ( m_bIsLowLod )
    {
        // Manually update attaching in case other object is streamed out
        DoAttaching ();

        // Be hidden if all HighLodObjects are fully visible
        m_IsHiddenLowLod = true;
        if ( m_HighLodObjectList.empty () )
            m_IsHiddenLowLod = false;
        for ( std::vector < CClientObject* >::iterator iter = m_HighLodObjectList.begin () ; iter != m_HighLodObjectList.end () ; ++iter )
        {
            CObject* pObject = (*iter)->m_pObject;
            if ( !pObject || !pObject->IsFullyVisible () )
            {
                m_IsHiddenLowLod = false;
                break;
            }
        }

        UpdateVisibility ();
    }


    // Are we not a static object (allowed to move by physics)
    if ( !m_bIsStatic )
    {
        // Grab our actual position (as GTA moves it too)
        CVector vecPosition = *m_pObject->GetPosition ();

        // Has it moved without MTA knowing?
        if ( vecPosition != m_vecPosition )
        {
            m_vecPosition = vecPosition;

            // Update our streaming position
            UpdateStreamPosition ( m_vecPosition );
        }
    }
}
Esempio n. 30
0
/**
 * MySwitchableTextEditor
 */
MySwitchableTextEditor::MySwitchableTextEditor(QWidget *parent)
    :QWidget(parent)
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    m_edit = new MyTextEditor(this);
    m_label = new QLabel(this);
    m_label->setTextFormat(Qt::RichText);
    m_label->setAlignment(Qt::AlignTop);
    m_line = new QLineEdit(this);

    layout->addWidget(m_label);
    layout->addWidget(m_edit);
    layout->addWidget(m_line);

    setLayout(layout);

    m_editor_mode = false;
    m_line_mode = false;
    UpdateVisibility();
}