Example #1
0
void CPerPlayerEntity::RemovePlayersBelow(CElement* pElement, std::set<CPlayer*>& Removed)
{
    assert(pElement);

    // Is this a player?
    if (IS_PLAYER(pElement))
    {
        // Remove the reference
        CPlayer* pPlayer = static_cast<CPlayer*>(pElement);
        RemovePlayerReference(pPlayer);

        // Did we just loose the last reference to that player? Add him to the list over removed players.
        if (!IsVisibleToPlayer(*pPlayer))
        {
            MapInsert(Removed, pPlayer);
        }
    }

    // Call ourself on all our children
    CChildListType ::const_iterator iterChildren = pElement->IterBegin();
    for (; iterChildren != pElement->IterEnd(); iterChildren++)
    {
        CElement* pElement = *iterChildren;
        if (pElement->CountChildren() || IS_PLAYER(pElement))            // This check reduces cpu usage when unloading large maps (due to recursion)
            RemovePlayersBelow(pElement, Removed);
    }
}
Example #2
0
void CPerPlayerEntity::AddPlayersBelow(CElement* pElement, std::set<CPlayer*>& Added)
{
    assert(pElement);

    // Is this a player?
    if (IS_PLAYER(pElement))
    {
        // Are we not already visible to that player? Add it to the list
        CPlayer* pPlayer = static_cast<CPlayer*>(pElement);
        if (!IsVisibleToPlayer(*pPlayer))
        {
            MapInsert(Added, pPlayer);
        }

        // Add it to our reference list
        AddPlayerReference(pPlayer);
    }

    // Call ourself on all its children elements
    CChildListType ::const_iterator iterChildren = pElement->IterBegin();
    for (; iterChildren != pElement->IterEnd(); iterChildren++)
    {
        CElement* pElement = *iterChildren;
        if (pElement->CountChildren() || IS_PLAYER(pElement))            // This check reduces cpu usage when loading large maps (due to recursion)
            AddPlayersBelow(pElement, Added);
    }
}
Example #3
0
BOOL KTeamClient::SetTeamMark(int nMarkType, DWORD dwTargetID)
{
    BOOL        bResult     = false;
    KCharacter* pCharacter  = NULL;

    for (int i = 0; i < PARTY_MARK_COUNT; i++)
    {
        if (m_dwTeamMark[i] == dwTargetID)
        {
            m_dwTeamMark[i] = 0;
        }
    }

    KG_PROCESS_SUCCESS(nMarkType == 0); // 0表示取消标记
    KGLOG_PROCESS_ERROR(nMarkType > 0 && nMarkType <= PARTY_MARK_COUNT);

    if (IS_PLAYER(m_dwTeamMark[nMarkType - 1]))
    {
        pCharacter = g_pSO3World->m_PlayerSet.GetObj(m_dwTeamMark[nMarkType - 1]);
    }
    else
    {
        pCharacter = g_pSO3World->m_NpcSet.GetObj(m_dwTeamMark[nMarkType - 1]);
    }
    if (pCharacter && g_pGameWorldRepresentHandler) // 取不到Character是很正常的逻辑
    {
        m_dwTeamMark[nMarkType - 1] = 0;
        g_pGameWorldRepresentHandler->OnCharacterUpdateTitleMark(pCharacter);
    }

    m_dwTeamMark[nMarkType - 1] = dwTargetID;

Exit1:
    if (IS_PLAYER(dwTargetID))
    {
        pCharacter = g_pSO3World->m_PlayerSet.GetObj(dwTargetID);
    }
    else
    {
        pCharacter = g_pSO3World->m_NpcSet.GetObj(dwTargetID);
    }

    if (pCharacter && g_pGameWorldRepresentHandler)
    {
        g_pGameWorldRepresentHandler->OnCharacterUpdateTitleMark(pCharacter);
    }

    bResult = true;
Exit0:
    return bResult;
}
Example #4
0
void CPickup::Callback_OnLeave ( CColShape& Shape, CElement& Element )
{
    if ( IS_PLAYER ( &Element ) )
    {
        CPlayer& Player = static_cast < CPlayer& > ( Element );

        // Matching interior
        if ( GetInterior () == Element.GetInterior () )
        {
            // Matching dimension
            if ( GetDimension () == Element.GetDimension () )
            {
                // Is he alive?
                if ( !Player.IsDead () )
                {
                    // Call the onPickupHit event
                    CLuaArguments Arguments;
                    Arguments.PushElement ( &Player );
                    CallEvent ( "onPickupLeave", Arguments );

                    CLuaArguments Arguments2;
                    Arguments2.PushElement ( this );       // pickup
                    Element.CallEvent ( "onPlayerPickupLeave", Arguments2 );            
                }
            }
        }
    }
}
Example #5
0
	// -------------------------------------------------------------------------
	// @ClientSvr(C/S)	: S
	// @ClassName		: --
	// @LuaApiName		: RecordDropItems
	// @Description		: 记录掉落道具
	// @ReturnCode		: 
	// @ArgumentFlag	: ?ddddd
	// @ArgumentComment	: nPlayerId/pPlayer:角色Id或者对象
	// @ArgumentComment	: g
	// @ArgumentComment	: d
	// @ArgumentComment	: p
	// @ArgumentComment	: l
	// @ArgumentComment	: amount
	// @LuaMarkEnd
	// -------------------------------------------------------------------------
	INT LuaRecordDropItems(QLuaScript &sc)
	{
		KPlayer* pPlayer = NULL;
		KCrossSvCtrl* pCrossSvCtrl = NULL;

		if (sc.IsNumber(1))
		{
			INT nPlayerId = sc.GetInt(1);
			QCONFIRM_RET_FALSE(IS_PLAYER(nPlayerId));
			pPlayer = (KPlayer*)g_cCharacterMgr.GetById(nPlayerId);
		}
		else
		{
			KLuaPlayer *pLuaPlayer = dynamic_cast<KLuaPlayer *>(sc.GetObj(1));
			if (pLuaPlayer)
				pPlayer = pLuaPlayer->GetHim();
		}
		QCONFIRM_RET_FALSE(pPlayer);

		pCrossSvCtrl = pPlayer->GetCtrl<KCrossSvCtrl>();
		QCONFIRM_RET_FALSE(pCrossSvCtrl);

		INT nGenre = sc.GetInt(2);
		INT nDetail = sc.GetInt(3);
		INT nParticular = sc.GetInt(4);
		INT nLevel = sc.GetInt(5);
		INT nAmount = sc.GetInt(6);

		pCrossSvCtrl->RecordDropItems(nGenre, nDetail, nParticular, nLevel, nAmount);

		return 0;
	}
Example #6
0
bool CPlayer::IsPlayerIgnoringElement( CElement* pElement )
{
    // For each ignored element
    for ( list < CElement* > ::const_iterator iter = m_lstIgnoredList.begin () ; iter != m_lstIgnoredList.end () ; ++iter )
    {
        CElement* pIgnoredElement = *iter;
        if ( IS_TEAM ( pIgnoredElement ) )
        {
            // Check team
            CTeam* pTeam = static_cast < CTeam* > ( pIgnoredElement );
            // If the broadcast-to player is in the ignored team
            list < CPlayer* > ::const_iterator iter = pTeam->PlayersBegin ();
            for ( ; iter != pTeam->PlayersEnd (); iter++ )
            {
                if ( *iter == pElement )
                    return true;
            }
        }
        else if ( IS_PLAYER( pIgnoredElement ) )
        {
            // Check player
            if ( pIgnoredElement == pElement )
                return true;
        }
        else
        {
            // Check element decendants
            if ( pIgnoredElement->IsMyChild ( pElement , true ) )
                return true;
        }
    }
    return false;
}
Example #7
0
	// -------------------------------------------------------------------------
	// @ClientSvr(C/S)	: S
	// @ClassName		: --
	// @LuaApiName		: TakeOffRide
	// @Description		: 卸下人物坐骑
	// @ReturnCode		: 成功返回1
	// @ArgumentFlag	: ?d
	// @ArgumentComment	: nPlayerId/pPlayer:角色Id或者对象
	// @ArgumentComment	: 坐骑ID
	// @LuaMarkEnd
	// -------------------------------------------------------------------------
	INT LuaTakeOffRide(QLuaScript &sc)
	{
		KPlayer* pPlayer = NULL;
		if (sc.IsNumber(1))
		{
			INT nPlayerId = sc.GetInt(1);
			QCONFIRM_RET_FALSE(IS_PLAYER(nPlayerId));
			pPlayer = (KPlayer*)g_cCharacterMgr.GetById(nPlayerId);
		}
		else
		{
			KLuaPlayer *pLuaPlayer = dynamic_cast<KLuaPlayer *>(sc.GetObj(1));
			if (pLuaPlayer)
				pPlayer = pLuaPlayer->GetHim();
		}
		QCONFIRM_RET_FALSE(pPlayer);

		DWORD dwRideId = sc.GetInt(2);
		KRide* pRide = g_cPetMgr.GetRideById(dwRideId);
		QCONFIRM_RET_FALSE(pRide);

		KRideCtrl* pRideCtrl = pPlayer->GetCtrl<KRideCtrl>();
		QCONFIRM_RET_FALSE(pRideCtrl);

		BOOL bRet = pRideCtrl->TakeOffRide(pRide);

		g_cCharacterHelper.CalcFightScore(*pPlayer);

		sc.PushNumber(bRet);
		return 1;
	}
int
player_tell (Player *player)
{
	g_return_val_if_fail (IS_PLAYER (player), -1);

	return player->priv->pos / GST_SECOND;
}
Example #9
0
void KAIBase::OnClearThreat(KCharacter* pCharater)
{
	BOOL bResult = FALSE;

	bResult = IS_PLAYER(m_pSelf->m_dwID);
	KG_PROCESS_SUCCESS(bResult == TRUE);

	// Npc仇恨链接时,会连锁清空仇恨
	if (m_pNpcTeam)
	{
		KNpc* pNpc = NULL;
		int nIndex = 0;
		int nMemberCount = m_pNpcTeam->GetMemberCount();

		for (nIndex = 0; nIndex < nMemberCount; nIndex++)
		{
			pNpc = m_pNpcTeam->GetMember(nIndex);
			if (pNpc && pNpc != m_pSelf && pNpc != pCharater)
			{
				bResult = pNpc->m_ThreatList.ClearThreat(pCharater);
				KGLOG_PROCESS_ERROR(bResult);
			}
		}
	}

Exit1:
	return;
Exit0:
	return;
}
Example #10
0
void CPedRPCs::SetPedRotation ( CClientEntity* pSource, NetBitStreamInterface& bitStream )
{
    SPedRotationSync rotation;
    unsigned char ucTimeContext;
    if ( bitStream.Read ( &rotation ) &&
         bitStream.Read ( ucTimeContext ) )
    {
        uchar ucNewWay = 0;
        if ( bitStream.GetNumberOfBytesUsed () > 0 )
            bitStream.Read ( ucNewWay );

        CClientPed* pPed = m_pPedManager->Get ( pSource->GetID (), true );
        if ( pPed )
        {
            if ( ucNewWay == 1 )
                pPed->SetCurrentRotationNew ( rotation.data.fRotation );
            else
                pPed->SetCurrentRotation ( rotation.data.fRotation );

            if ( !IS_PLAYER ( pPed ) )
                pPed->SetCameraRotation ( rotation.data.fRotation );
            pPed->SetSyncTimeContext ( ucTimeContext );
        }
    }
}
int
player_get_volume (Player *player)
{
	g_return_val_if_fail (IS_PLAYER (player), -1);

	return player->priv->cur_volume;
}
Example #12
0
void KRLRemoteCharacter::UpdateLifeState(BOOL bUpdateDisplayData)
{
    int nRetCode = false;
    HRESULT hr = E_FAIL;
    BOOL bShowLifeBar = TRUE;
    int nCharacterType = CHARACTER_TYPE_REMOTE_PLAYER;
    KForceRelationModel const* pForceRelationModel = NULL;

    KGLOG_PROCESS_ERROR(m_FrameData.m_pCharacter);

    KG_PROCESS_SUCCESS(!m_FrameData.IsLifeChanged() && !bUpdateDisplayData);

    if (!IS_PLAYER(m_RLCharacter.GetObjectID()))
    {
        KNpc* pNPC = (KNpc*)m_FrameData.m_pCharacter;

        bShowLifeBar = pNPC->m_pTemplate->bCanSeeLifeBar;

        nCharacterType = CHARACTER_TYPE_NPC;
    }

    KG_PROCESS_SUCCESS(!g_pRL->m_Option.bHeadSFXEnabled[nCharacterType][CHARACTER_SFX_LIFE - CHARACTER_SFX_BBOX_BALLOON_BEGIN]);

    KG_PROCESS_SUCCESS(!bShowLifeBar);

    pForceRelationModel = GetForceRelationModel(m_RLCharacter.GetObjectID(), g_pRL->m_pSO3World->m_dwClientPlayerID);
    KGLOG_PROCESS_ERROR(pForceRelationModel);

    hr = m_RLCharacter.m_RenderData.SetPercentage(pForceRelationModel->dwColor, m_FrameData.m_Current.fLifePercentage);
    KGLOG_COM_PROCESS_ERROR(hr);

Exit1:
Exit0:
    return;
}
void
player_play (Player *player)
{
	g_return_if_fail (IS_PLAYER (player));

	gst_element_set_state (GST_ELEMENT (player->priv->play), GST_STATE_PLAYING);
}
void
player_set_replaygain (Player *player, double gain, double peak)
{
	double scale;

	g_return_if_fail (IS_PLAYER (player));

	if (gain == 0) {
		player->priv->volume_scale = 1.0;
		update_volume (player);

		return;
	}

	scale = pow (10., gain / 20);

	/* anti clip */
	if (peak != 0 && (scale * peak) > 1)
		scale = 1.0 / peak;

	/* For security */
	if (scale > 15)
		scale = 15;

	player->priv->volume_scale = scale;
	update_volume (player);
}
Example #15
0
	// -------------------------------------------------------------------------
	// @ClientSvr(C/S)	: S
	// @ClassName		: --
	// @LuaApiName		: GetRide
	// @Description		: 得到玩家的当前坐骑
	// @ReturnCode		: 成功返回坐骑对象,失败返回nil
	// @ArgumentFlag	: ?
	// @ArgumentComment	: nPlayerId/pPlayer:角色Id或者对象
	// @LuaMarkEnd
	// -------------------------------------------------------------------------
	INT LuaGetRide(QLuaScript &sc)
	{
		KPlayer* pPlayer = NULL;
		if (sc.IsNumber(1))
		{
			INT nPlayerId = sc.GetInt(1);
			QCONFIRM_RET_FALSE(IS_PLAYER(nPlayerId));
			pPlayer = (KPlayer*)g_cCharacterMgr.GetById(nPlayerId);
		}
		else
		{
			KLuaPlayer *pLuaPlayer = dynamic_cast<KLuaPlayer *>(sc.GetObj(1));
			if (pLuaPlayer)
				pPlayer = pLuaPlayer->GetHim();
		}
		QCONFIRM_RET_FALSE(pPlayer);

		KRideCtrl* pRideCtrl = pPlayer->GetCtrl<KRideCtrl>();
		QCONFIRM_RET_FALSE(pRideCtrl);
		KRide* pRide = pRideCtrl->GetCurrentRide();
		if(pRide)
		{
			sc.PushObj((QLunaBase*)pRide->GetScriptInterface());
			return 1;
		}
		
		return 0;
	}
Example #16
0
	// -------------------------------------------------------------------------
	// @ClientSvr(C/S)	: S
	// @ClassName		: --
	// @LuaApiName		: GetPetIslandRefreshCount
	// @Description		: 获取宠物岛刷新过的次数
	// @ReturnCode		: 成功返回刷新次数,失败返回nil
	// @ArgumentFlag	: ?
	// @ArgumentComment	: nPlayerId/pPlayer:角色Id或者对象
	// @LuaMarkEnd
	// -------------------------------------------------------------------------
	INT LuaGetPetIslandRefreshCount(QLuaScript &sc)
	{
		KPlayer* pPlayer = NULL;
		if (sc.IsNumber(1))
		{
			INT nPlayerId = sc.GetInt(1);
			QCONFIRM_RET_FALSE(IS_PLAYER(nPlayerId));
			pPlayer = (KPlayer*)g_cCharacterMgr.GetById(nPlayerId);
		}
		else
		{
			KLuaPlayer *pLuaPlayer = dynamic_cast<KLuaPlayer *>(sc.GetObj(1));
			if (pLuaPlayer)
				pPlayer = pLuaPlayer->GetHim();
		}
		QCONFIRM_RET_FALSE(pPlayer);

		INT nQuality = sc.GetInt(2);

		KPetCtrl* pPetCtrl = pPlayer->GetCtrl<KPetCtrl>();
		QCONFIRM_RET_FALSE(pPetCtrl);

		sc.PushNumber(pPetCtrl->m_nPetIslandRefreshCount);

		return 1;
	}
Example #17
0
	// -------------------------------------------------------------------------
	// @ClientSvr(C/S)	: S
	// @ClassName		: --
	// @LuaApiName		: ClearDropItems
	// @Description		: 清空记录掉落道具
	// @ReturnCode		: 
	// @ArgumentFlag	: ?
	// @ArgumentComment	: nPlayerId/pPlayer:角色Id或者对象
	// @LuaMarkEnd
	// -------------------------------------------------------------------------
	INT LuaClearDropItems(QLuaScript &sc)
	{
		KPlayer* pPlayer = NULL;
		KCrossSvCtrl* pCrossSvCtrl = NULL;

		if (sc.IsNumber(1))
		{
			INT nPlayerId = sc.GetInt(1);
			QCONFIRM_RET_FALSE(IS_PLAYER(nPlayerId));
			pPlayer = (KPlayer*)g_cCharacterMgr.GetById(nPlayerId);
		}
		else
		{
			KLuaPlayer *pLuaPlayer = dynamic_cast<KLuaPlayer *>(sc.GetObj(1));
			if (pLuaPlayer)
				pPlayer = pLuaPlayer->GetHim();
		}
		QCONFIRM_RET_FALSE(pPlayer);

		pCrossSvCtrl = pPlayer->GetCtrl<KCrossSvCtrl>();
		QCONFIRM_RET_FALSE(pCrossSvCtrl);

		pCrossSvCtrl->ClearDropItems();

		return 0;
	}
Example #18
0
	// -------------------------------------------------------------------------
	// @ClientSvr(C/S)	: S
	// @ClassName		: --
	// @LuaApiName		: AddPlayerPet
	// @Description		: 给指定角色一只新的宠物
	// @ReturnCode		: 成功返回宠物对象,失败返回nil
	// @ArgumentFlag	: ?d[d]
	// @ArgumentComment	: nPlayerId/pPlayer:角色Id或者对象
	// @ArgumentComment	: nType:宠物表现id
	// @ArgumentComment	: nCharacter
	// @LuaMarkEnd
	// -------------------------------------------------------------------------
	INT LuaAddPlayerPet(QLuaScript &sc)
	{
		KPlayer* pPlayer = NULL;
		if (sc.IsNumber(1))
		{
			INT nPlayerId = sc.GetInt(1);
			QCONFIRM_RET_FALSE(IS_PLAYER(nPlayerId));
			pPlayer = (KPlayer*)g_cCharacterMgr.GetById(nPlayerId);
		}
		else
		{
			KLuaPlayer *pLuaPlayer = dynamic_cast<KLuaPlayer *>(sc.GetObj(1));
			if (pLuaPlayer)
				pPlayer = pLuaPlayer->GetHim();
		}
		QCONFIRM_RET_FALSE(pPlayer);

		INT nType = sc.GetInt(2);
		//INT nQuality = sc.GetInt(3);
		INT nCharacter = 0;
		if (sc.IsNumber(3))
		{
			nCharacter = sc.GetInt(3);
		}

		KPet* pPet = g_cPetMgr.AddPlayerPet(pPlayer, nType, nCharacter);
		if(pPet)
		{
			sc.PushObj((QLunaBase*)pPet->GetScriptInterface());
			return 1;
		}

		return 0;
	}
Example #19
0
	// -------------------------------------------------------------------------
	// @ClientSvr(C/S)	: S
	// @ClassName		: --
	// @LuaApiName		: GetPlayerPetMaxPower
	// @Description		: 得到所有宠物中最大战斗力
	// @ReturnCode		: 
	// @ArgumentFlag	: ?
	// @ArgumentComment	: nPlayerId/pPlayer:角色Id或者对象
	// @LuaMarkEnd
	// -------------------------------------------------------------------------
	INT LuaGetPlayerPetMaxPower(QLuaScript &sc)
	{
		KPlayer* pPlayer = NULL;
		if (sc.IsNumber(1))
		{
			INT nPlayerId = sc.GetInt(1);
			QCONFIRM_RET_FALSE(IS_PLAYER(nPlayerId));
			pPlayer = (KPlayer*)g_cCharacterMgr.GetById(nPlayerId);
		}
		else
		{
			KLuaPlayer *pLuaPlayer = dynamic_cast<KLuaPlayer *>(sc.GetObj(1));
			if (pLuaPlayer)
				pPlayer = pLuaPlayer->GetHim();
		}
		QCONFIRM_RET_FALSE(pPlayer);

		KPetCtrl* pPetCtrl = pPlayer->GetCtrl<KPetCtrl>();
		QCONFIRM_RET_NULL(pPetCtrl);

		//INT nCount = pPetCtrl->GetPetsCount();
		INT nMaxPower = pPetCtrl->GetMaxPower();
		sc.PushNumber(nMaxPower);
		/*sc.PushTable();
		for (INT i = 0; i < nCount; ++i)
		{
			KPet* pPet = pPetCtrl->GetPetByIdx(i);
			QCONFIRM_RET_NULL(pPet);
			sc.PushNumber(pPet->GetId());
			sc.SetTableIndex(i + 1);
		}*/

		return 1;
	}
void
player_seek (Player *player, int t)
{
	g_return_if_fail (IS_PLAYER (player));

	gst_play_seek_to_time (player->priv->play, t * GST_SECOND);
}
Example #21
0
bool CVehicle::SetOccupant ( CPed* pPed, unsigned int uiSeat )
{
    // CPlayer::SetOccupiedVehicle will also call this so we need to prevent an infinite recursive loop
    static bool bAlreadySetting = false;
    if ( !bAlreadySetting )
    {
        // Set the Player
        if ( m_pOccupants [uiSeat] != pPed )
        {
            if ( g_pBandwidthSettings->bLightSyncEnabled )
            {
                if ( uiSeat == 0 && m_pOccupants[0] && IS_PLAYER(m_pOccupants[0]) )
                    g_pGame->GetPlayerManager()->BroadcastOnlyJoined ( CVehicleResyncPacket(this) );
            }
            m_pOccupants [uiSeat] = pPed;
        }

        // Make sure the Player record is up to date
        if ( pPed )
        {
            bAlreadySetting = true;
            pPed->SetOccupiedVehicle ( this, uiSeat );
            bAlreadySetting = false;
        }

        // Ensure idle timer is stopped when the vehicle has any occupants
        if ( GetFirstOccupant () )
            StopIdleTimer ();

        return true;
    }

    return true;
}
BOOL KPlayerBaseProcess::OnSyncTeleport( LPCBYTE pData, UINT uDataLen )
{
	KS2C_SYNC_TELEPORT* pReceived = (KS2C_SYNC_TELEPORT*)pData;
	KSceneObject* pSceneObj = NULL;

	if (IS_PLAYER(pReceived->dwId))
	{
		pSceneObj = g_cPlayerMgr.GetById(pReceived->dwId);
	}
	else if (IS_NPC(pReceived->dwId))
	{
		pSceneObj = g_cNpcMgr.GetById(pReceived->dwId);
	}
	else if (IS_DOODAD(pReceived->dwId))
	{
		pSceneObj = g_cDoodadMgr.GetById(pReceived->dwId);
	}
	else
	{
		Q_Printl("Unknown SceneObject " << pReceived->dwId);
	}
	QCONFIRM_RET_FALSE(pSceneObj);

	pSceneObj->SetPosition(pReceived->nX, pReceived->nY, pReceived->nZ);
	pSceneObj->StopMoving();

	return TRUE;
}
Example #23
0
CPlayer* lua_toplayer ( lua_State* luaVM, int iArgument )
{
    CElement* pElement = lua_toelement ( luaVM, iArgument );
    if ( pElement && IS_PLAYER ( pElement ) )
        return static_cast < CPlayer* > ( pElement );
    else
        return NULL;
}
void
player_pause (Player *player)
{
	g_return_if_fail (IS_PLAYER (player));

	gst_element_set_state (GST_ELEMENT (player->priv->play), GST_STATE_PAUSED);
	gst_element_set_state (GST_ELEMENT (player->priv->sink), GST_STATE_NULL);
}
Example #25
0
BOOL KCharacterServer::SyncVarChange( WORD wVarGroup, WORD wVarId )
{
	if (IS_PLAYER(m_rcCharacter.GetId()) && g_cCharacterVarSetting.CheckSyncSelf(wVarGroup, wVarId))
		DoSyncVarSelf(wVarGroup, wVarId);
	if (g_cCharacterVarSetting.CheckSyncOther(wVarGroup, wVarId))
		SyncVarAround(wVarGroup, wVarId);
	return TRUE;
}
void
player_set_volume (Player *player, int volume)
{
	g_return_if_fail (IS_PLAYER (player));
	g_return_if_fail (volume >= 0 && volume <= 100);

	player->priv->cur_volume = volume;

	update_volume (player);
}
Example #27
0
void CPedSync::Update ( unsigned long ulCurrentTime )
{
    // Update all the ped's sync states
    list < CPed* > ::const_iterator iter = m_pPedManager->IterBegin ();
    for ( ; iter != m_pPedManager->IterEnd (); iter++ )
    {
        // It is a ped, yet not a player
        if ( IS_PED ( *iter ) && !IS_PLAYER ( *iter ) )
            UpdatePed ( *iter );
    }
}
Example #28
0
void CClientMarker::Callback_OnLeave ( CClientColShape& Shape, CClientEntity& Entity )
{
    if ( IS_PLAYER ( &Entity ) )
    {
        // Call the marker hit event
        CLuaArguments Arguments;
        Arguments.PushElement ( &Entity );            // player that hit it
        Arguments.PushBoolean ( ( Shape.GetDimension () == Entity.GetDimension () ) ); // matching dimension?
        CallEvent ( "onClientMarkerLeave", Arguments, true );
    }
}
Example #29
0
VOID KCharacterServer::SetVisible( BOOL bVisible )
{
	// 显身 --> 隐身
	if (m_rcCharacter.m_bVisible && ! bVisible)
	{
		if (IS_PLAYER(m_rcCharacter.GetId()))
		{
			KPlayer& rPlayer = static_cast<KPlayer&>(m_rcCharacter);
			g_cPlayerBaseProcess.DoSyncVisible(&rPlayer, m_rcCharacter.GetId(), bVisible);
		}
		g_cPlayerBaseProcess.DoSyncLeave(m_rcCharacter);
	}
	// 隐身 --> 显身
	if (bVisible && ! m_rcCharacter.m_bVisible)
	{
		IKScene* pScene = m_rcCharacter.GetScene();
		QCONFIRM(pScene);
		if (pScene)
		{
			TKTraverseHelper<KPlayer> cTravHelper;
			pScene->TraverseNearbyPlayers(cTravHelper, &m_rcCharacter);
			if (IS_PLAYER(m_rcCharacter.GetId()))
			{
				KPlayer& rPlayer = static_cast<KPlayer&>(m_rcCharacter);
				g_cPlayerBaseProcess.DoSyncVisible(&rPlayer, m_rcCharacter.GetId(), bVisible);
				rPlayer.m_cPlayerServer.SyncToNeighborPlayers(cTravHelper.m_vObjList);
			}
			else if (IS_NPC(m_rcCharacter.GetId()))
			{
				KNpc& rNpc = static_cast<KNpc&>(m_rcCharacter);
				rNpc.m_cNpcServer.SyncToNeighborPlayers(cTravHelper.m_vObjList);
			}
			else
			{
				Q_Error("Unexpected SObj [" << m_rcCharacter.GetId() << "][" << m_rcCharacter.GetName() << "]");
			}
		}
	}
	m_rcCharacter.SetVisible(bVisible);
}
void
player_stop (Player *player)
{
	g_return_if_fail (IS_PLAYER (player));

	g_free (player->priv->current_file);
	player->priv->current_file = NULL;

	player->priv->pos = 0;

	gst_element_set_state (GST_ELEMENT (player->priv->play), GST_STATE_READY);
	gst_element_set_state (GST_ELEMENT (player->priv->sink), GST_STATE_NULL);
}