/*******************************************************************************
  Function:  inline void SetRangeAndBandwidth(void)
  *****************************************************************************/
inline void SetRangeAndBandwidth(uint8_t accl_range)
{
    ACCEL_BMA250_REG        reg;
    uint16_t                idx;

    idx = ReadByteSequence(0, ACCEL_BMA250_ADDR14);
    AccelRxBuffer = (uint8_t *)®
    accelData[idx].cmd = ACCEL_DONE;
    ACCELStartCommandSequence();
#ifndef ACCEL_USE_POLLING
    while(IsBusy())
        ;
#else
    while(ACCELTask() == ACCEL_VALID)
        ;
#endif

//    reg.range       = accl_range;
//    reg.bandwidth	= ACCEL_BMA250_BW_50;
//    idx = WriteByteSequence(0, ACCEL_BMA250_ADDR14, reg.val);
    idx = WriteByteSequence(0, ACCEL_BMA250_ADDR0F, accl_range);
//    idx = WriteByteSequence(idx, ACCEL_BMA250_ADDR10, 0x08);
    idx = WriteByteSequence(idx, ACCEL_BMA250_ADDR10, 0x0f); //0x0f, bandwidth 1000Hz, updata time 0.5ms
    accelData[idx].cmd = ACCEL_DONE;
    ACCELStartCommandSequence();

#ifndef ACCEL_USE_POLLING
    while(IsBusy())
        ;
#else
    while(ACCELTask() == ACCEL_VALID)
        ;
#endif
}
Example #2
0
void CEMSocket::OnSend(int iErrorCode)
{
	if (iErrorCode)
	{
		OnError(iErrorCode);
		return;
	}

//	EMTrace("CEMSocket::OnSend linked: %i, controlcount %i, standardcount %i, isbusy: %i",m_bLinkedPackets, m_controlPacketQueue.GetCount(), m_standardPacketQueue.GetCount(), IsBusy());

	if (m_eConnectionState == ES_DISCONNECTED)
		return;
	else
		m_eConnectionState = ES_CONNECTED;

//	If there's data left in the send buffer, continue sending
	if (IsBusy())
		Send(NULL, 0, 0);
//	If there's _still_ data left...
	if (IsBusy())
		return;
	while ((m_controlPacketQueue.GetHeadPosition() != NULL) && !IsBusy() && IsConnected() && !m_bLinkedPackets)
	{
		Packet		*pPacket = m_controlPacketQueue.GetHead();

//		EMTrace("CEMSocket::OnSend sending control packet on %d, size=%u",(SOCKET)this, pPacket->GetRealPacketSize());
		Send(pPacket->DetachPacket(),pPacket->GetRealPacketSize());
		m_controlPacketQueue.RemoveHead();
		delete pPacket;
	}

	while ((m_standardPacketQueue.GetHeadPosition() != NULL) && !IsBusy() && IsConnected())
	{
		Packet		*pPacket = m_standardPacketQueue.GetHead();

		if (pPacket->IsLastSplit())
			m_bLinkedPackets = false;
		else if (pPacket->IsSplit())
			m_bLinkedPackets = true;
		else if (m_bLinkedPackets)
		{
			ASSERT(false);
		}
//		EMTrace("CEMSocket::OnSend sending standard packet on %d, size=%u",(SOCKET)this, pPacket->GetRealPacketSize());
		Send(pPacket->DetachPacket(), pPacket->GetRealPacketSize());
		m_standardPacketQueue.RemoveHead();
		delete pPacket;
	}

	while ((m_controlPacketQueue.GetHeadPosition() != NULL) && !IsBusy() && IsConnected() && !m_bLinkedPackets)
	{
		Packet		*pPacket = m_controlPacketQueue.GetHead();

//		EMTrace("CEMSocket::OnSend sending control packet on %d, size=%u",(SOCKET)this, pPacket->GetRealPacketSize());
		Send(pPacket->DetachPacket(), pPacket->GetRealPacketSize());
		m_controlPacketQueue.RemoveHead();
		delete pPacket;
	}
}
Example #3
0
// will url encode var and value.
void WebRequestObject::RequestAddPair(const char* var, int value)
{
    MyAssert( IsBusy() == false );
    if( IsBusy() )
        return;

    char valuestring[20];
    sprintf_s( valuestring, 20, "%d", value );

    RequestAddPair( var, valuestring );

    //LOGInfo( LOGTag, "WebRequestObject - RequestAddPair %s\n", m_PageWanted );
}
/*******************************************************************************
  Function:  ACCEL_RESULT ACCELTask(void)
  *****************************************************************************/
ACCEL_RESULT ACCELTask(void)
{
    if(IsBusy())
    {
        ACCEL_BMA250InterruptHandler();

        // one last check to see if we are busy
        if(IsBusy())
            return ACCEL_VALID;
    }

    return ACCEL_INVALID;
}
/*******************************************************************************
  Function:  inline void SetThershold(void)
  *****************************************************************************/
inline void SetThershold(void)
{
    ACCEL_BMA250_REG    reg;
    uint16_t                idx;

    idx = ReadByteSequence(0, ACCEL_BMA250_ADDR11);

    AccelRxBuffer = (uint8_t *)®

    accelData[idx].cmd = ACCEL_DONE;

    ACCELStartCommandSequence();

#ifndef ACCEL_USE_POLLING
    while(IsBusy())
        ;
#else
    while(ACCELTask() == ACCEL_VALID)
        ;
#endif

    idx = WriteByteSequence(0, ACCEL_BMA250_ADDR14, ACCEL_BMA250_THES);

    accelData[idx].cmd = ACCEL_DONE;

    ACCELStartCommandSequence();

#ifndef ACCEL_USE_POLLING
    while(IsBusy())
        ;
#else
    while(ACCELTask() == ACCEL_VALID)
        ;
#endif

    idx = ReadByteSequence(0, ACCEL_BMA250_ADDR11);

    AccelRxBuffer = (uint8_t *)®

    accelData[idx].cmd = ACCEL_DONE;

    ACCELStartCommandSequence();

#ifndef ACCEL_USE_POLLING
    while(IsBusy())
        ;
#else
    while(ACCELTask() == ACCEL_VALID)
        ;
#endif
}
Example #6
0
void WebRequestObject::RequestStart(const char* page)
{
    MyAssert( IsBusy() == false );
    if( IsBusy() )
        return;

    ClearResult();
    Reset();

    sprintf_s( m_PageWanted, MAX_URLLength, page );
    strcat_s( m_PageWanted, MAX_URLLength, "?" );

    //LOGInfo( LOGTag, "WebRequestObject - RequestStart %s\n", m_PageWanted );
}
Example #7
0
int CFileZillaApi::Rename(CString oldName, CString newName, const CServerPath &path /*=CServerPath()*/, const CServerPath &newPath /*=CServerPath()*/)
{
	//Check if call allowed
	if (!m_bInitialized)
		return FZ_REPLY_NOTINITIALIZED;
	if (IsConnected()==FZ_REPLY_NOTCONNECTED)
		return FZ_REPLY_NOTCONNECTED;
	if (IsBusy()==FZ_REPLY_BUSY)
		return FZ_REPLY_BUSY;
	if (oldName==_MPT("") || newName==_MPT(""))
		return FZ_REPLY_INVALIDPARAM;

	CServerPath path2 = path;
	if (path2.IsEmpty())
	{
		m_pMainThread->GetCurrentPath(path2);
		if (path2.IsEmpty())
			return FZ_REPLY_INVALIDPARAM;
	}

	t_command command;
	command.id = FZ_COMMAND_RENAME;
	command.param1 = oldName;
	command.param2 = newName;
	command.path = path2;
	command.newPath = newPath;
	m_pMainThread->Command(command);
	if (m_hOwnerWnd)
		return FZ_REPLY_WOULDBLOCK;
	else
		return m_pMainThread->LastOperationSuccessful()?FZ_REPLY_OK:FZ_REPLY_ERROR;
	
	return FZ_REPLY_ERROR;
}
Example #8
0
int CFileZillaApi::CustomCommand(CString CustomCommand)
{
	//Check if call allowed
	if (!m_bInitialized)
		return FZ_REPLY_NOTINITIALIZED;
	if (IsConnected()==FZ_REPLY_NOTCONNECTED)
		return FZ_REPLY_NOTCONNECTED;
	if (IsBusy()==FZ_REPLY_BUSY)
		return FZ_REPLY_BUSY;
	t_server server;
	int res=GetCurrentServer(server);
	if (res!=FZ_REPLY_OK)
		return res;
#ifndef MPEXT_NO_SFTP
	if (server.nServerType&FZ_SERVERTYPE_SUB_FTP_SFTP)
		return FZ_REPLY_NOTSUPPORTED;
#endif
	if (CustomCommand==_MPT(""))
		return FZ_REPLY_INVALIDPARAM;

	t_command command;
	command.id=FZ_COMMAND_CUSTOMCOMMAND;
	command.param1=CustomCommand;
	m_pMainThread->Command(command);
	if (m_hOwnerWnd)
		return FZ_REPLY_WOULDBLOCK;
	else
		return m_pMainThread->LastOperationSuccessful()?FZ_REPLY_OK:FZ_REPLY_ERROR;
}
Example #9
0
//---------------------------------------------------------
bool CWeapon::OnActionReload(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	if(activationMode==eAAM_OnPress)
	{
		COffHand * offHandWeapon = NULL;
		bool isOffHandSelected = false;
		GetOffHandInfo(this,isOffHandSelected,&offHandWeapon);

		if (!IsBusy() && !m_modifying && !isOffHandSelected)
		{
			bool isDualWield = false;
			CWeapon *dualWield = NULL;
			GetDualWieldInfo(this,isDualWield,&dualWield);

			if(IsWeaponRaised() && m_fm && m_fm->CanReload())
				RaiseWeapon(false);

			Reload();

			if (isDualWield)
			{
				if(dualWield->IsWeaponRaised() && dualWield->CanReload())
					dualWield->RaiseWeapon(false);
				dualWield->Reload();
			}
		}
	}

	return true;
}
Example #10
0
int CFileZillaEngine::Execute(const CCommand &command)
{
	if (command.GetId() != Command::cancel && IsBusy())
		return FZ_REPLY_BUSY;

	m_bIsInCommand = true;

	int res = FZ_REPLY_INTERNALERROR;
	switch (command.GetId())
	{
	case Command::connect:
		res = Connect(reinterpret_cast<const CConnectCommand &>(command));
		break;
	case Command::disconnect:
		res = Disconnect(reinterpret_cast<const CDisconnectCommand &>(command));
		break;
	case Command::cancel:
		res = Cancel(reinterpret_cast<const CCancelCommand &>(command));
		break;
	case Command::list:
		res = List(reinterpret_cast<const CListCommand &>(command));
		break;
	case Command::transfer:
		res = FileTransfer(reinterpret_cast<const CFileTransferCommand &>(command));
		break;
	case Command::raw:
		res = RawCommand(reinterpret_cast<const CRawCommand&>(command));
		break;
	case Command::del:
		res = Delete(reinterpret_cast<const CDeleteCommand&>(command));
		break;
	case Command::removedir:
		res = RemoveDir(reinterpret_cast<const CRemoveDirCommand&>(command));
		break;
	case Command::mkdir:
		res = Mkdir(reinterpret_cast<const CMkdirCommand&>(command));
		break;
	case Command::rename:
		res = Rename(reinterpret_cast<const CRenameCommand&>(command));
		break;
	case Command::chmod:
		res = Chmod(reinterpret_cast<const CChmodCommand&>(command));
		break;
	default:
		return FZ_REPLY_SYNTAXERROR;
	}

	if (res != FZ_REPLY_WOULDBLOCK)
		ResetOperation(res);

	m_bIsInCommand = false;

	if (command.GetId() != Command::disconnect)
		res |= m_nControlSocketError;
	else if (res & FZ_REPLY_DISCONNECTED)
		res = FZ_REPLY_OK;
	m_nControlSocketError = 0;

	return res;
}
Example #11
0
CZipDecompressor::~CZipDecompressor()
{
    if ( IsBusy() ) {
        // Abnormal session termination
        End();
    }
}
Example #12
0
// Command handlers
int CFileZillaEnginePrivate::Connect(const CConnectCommand &command)
{
	if (IsConnected())
		return FZ_REPLY_ALREADYCONNECTED;

	if (IsBusy())
		return FZ_REPLY_BUSY;

	m_retryCount = 0;

	if (m_pControlSocket)
	{
		// Need to delete before setting m_pCurrentCommand.
		// The destructor can call CFileZillaEnginePrivate::ResetOperation
		// which would delete m_pCurrentCommand
		delete m_pControlSocket;
		m_pControlSocket = 0;
		m_nControlSocketError = 0;
	}

	m_pCurrentCommand = command.Clone();

	if (command.GetServer().GetPort() != CServer::GetDefaultPort(command.GetServer().GetProtocol()))
	{
		ServerProtocol protocol = CServer::GetProtocolFromPort(command.GetServer().GetPort(), true);
		if (protocol != UNKNOWN && protocol != command.GetServer().GetProtocol())
			m_pLogging->LogMessage(Status, _("Selected port usually in use by a different protocol."));
	}
	
	return ContinueConnect();
}
/*******************************************************************************
  Function:  ACCEL_RESULT ACCELGetXYAxis(ACCEL_DATA *acc_x, ACCEL_DATA *acc_y)
  *****************************************************************************/
ACCEL_RESULT ACCELGetXYAxis(ACCEL_DATA *acc_x, ACCEL_DATA *acc_y)
{
    if(IsBusy())
        return ACCEL_INVALID;

    if((accelXYZData.acc_x_lsb.new_data_x) && (accelXYZData.acc_y_lsb.new_data_y))
    {
        uint32_t data;
        uint8_t size = 0;

        if(ACCEL_BMA250_AXIS_BIT > (sizeof(ACCEL_DATA) * 8))
            size = (uint8_t)(ACCEL_BMA250_AXIS_BIT - (sizeof(ACCEL_DATA) * 8));

        data = (uint32_t)accelXYZData.acc_x_msb.val << 8;
        data |= (uint32_t)accelXYZData.acc_x_lsb.val;
        data >>= 6;

        *acc_x = (ACCEL_DATA)(data >> size) ;

        data = (uint32_t)accelXYZData.acc_y_msb.val << 8;
        data |= (uint32_t)accelXYZData.acc_y_lsb.val;
        data >>= 6;

        *acc_y = (ACCEL_DATA)(data >> size);


        accelXYZData.acc_x_lsb.new_data_x = 0;
        accelXYZData.acc_y_lsb.new_data_y = 0;
        accelXYZData.acc_z_lsb.new_data_z = 0;

        return ACCEL_VALID;
    }
Example #14
0
//---------------------------------------------------------
bool CWeapon::OnActionReload(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	bool playerCanStartReload = false;
	
	if (activationMode == eAAM_OnPress && (CheckPickupInteraction(this) == false))
		playerCanStartReload = true;
	// this condition results from the interaction between reload and item pickups. If on front on an item and press reload/pick button but not for long enought,
	// then the player should still reload the weapon instead of picking up the item.
	else if(activationMode == eAAM_OnRelease && CheckPickupInteraction(this) == true)
		playerCanStartReload = true;

	float currentTime = gEnv->pTimer->GetCurrTime();
	if (!playerCanStartReload && activationMode == eAAM_OnPress)
		m_reloadButtonTimeStamp = currentTime;
	else if (activationMode == eAAM_OnRelease && playerCanStartReload && currentTime > m_reloadButtonTimeStamp+g_pGameCVars->pl_useItemHoldTime)
		playerCanStartReload = false;
	
	if (!playerCanStartReload)
		return true;

	if (!IsBusy() && !AreAnyItemFlagsSet(eIF_Modifying))
	{
		ReloadWeapon();
	}
	else if (!IsReloading() && activationMode == eAAM_OnPress)
	{
		SetInputFlag(eWeaponAction_Reload);
	}

	return true;
}
Example #15
0
CCompressionProcessor::EStatus CZipCompressor::Init(void)
{
    if ( IsBusy() ) {
        // Abnormal previous session termination
        End();
    }
    // Initialize members
    Reset();
    SetBusy();

    m_CRC32 = 0;
    m_NeedWriteHeader = true;
    m_Cache.erase();

    // Initialize the compressor stream structure
    memset(STREAM, 0, sizeof(z_stream));
    // Create a compressor stream
    int errcode = deflateInit2_(STREAM, GetLevel(), Z_DEFLATED,
                                F_ISSET(fWriteGZipFormat) ? -m_WindowBits :
                                m_WindowBits,
                                m_MemLevel, m_Strategy,
                                ZLIB_VERSION, (int)sizeof(z_stream));
    SetError(errcode, zError(errcode));
    if ( errcode == Z_OK ) {
        return eStatus_Success;
    }
    ERR_COMPRESS(60, FormatErrorMessage("CZipCompressor::Init", GetProcessedSize()));
    return eStatus_Error;
}
Example #16
0
int CFileZillaEnginePrivate::Cancel(const CCancelCommand &command)
{
	if (!IsBusy())
		return FZ_REPLY_OK;

	if (m_retryTimer.IsRunning())
	{
		wxASSERT(m_pCurrentCommand && m_pCurrentCommand->GetId() == cmd_connect);

		delete m_pControlSocket;
		m_pControlSocket = 0;
		
		delete m_pCurrentCommand;
		m_pCurrentCommand = 0;

		m_retryTimer.Stop();

		m_pLogging->LogMessage(::Error, _("Connection attempt interrupted by user"));
		COperationNotification *notification = new COperationNotification();
		notification->nReplyCode = FZ_REPLY_DISCONNECTED|FZ_REPLY_CANCELED;
		notification->commandId = cmd_connect;
		AddNotification(notification);

		return FZ_REPLY_WOULDBLOCK;
	}

	SendEvent(engineCancel);

	return FZ_REPLY_WOULDBLOCK;
}
Example #17
0
//------------------------------------------------------------------------------
void 
OMAPDDGPE::WaitForNotBusy() 
{
    //  Wait for any active DMA operation to complete
    while( IsBusy() );
    return; 
}
Example #18
0
//-----------------------------------------------------------------------
void CSpectacularKill::End(bool bKillerDied/* = false*/)
{
	CRY_ASSERT_MESSAGE(IsBusy(), "spectacular kill cannot be stopped if it is not in progress");
	if (!IsBusy())
		return;

	ICooperativeAnimationManager* pCooperativeAnimationManager = gEnv->pGame->GetIGameFramework()->GetICooperativeAnimationManager();

	CActor* pTarget = GetTarget();
	CRY_ASSERT(pTarget);
	if(pTarget)
	{
		pCooperativeAnimationManager->StopCooperativeAnimationOnActor(m_pOwner->GetAnimatedCharacter(), pTarget->GetAnimatedCharacter());

		// Enable AI again (for what it's worth - this helps editor)
		if (!pTarget->IsPlayer() && pTarget->GetEntity()->GetAI())
			pTarget->GetEntity()->GetAI()->Event(AIEVENT_ENABLE, 0);

		if (bKillerDied && (m_deathBlowState == eDBS_None) && static_cast<CPlayer*> (pTarget)->CanFall())
		{
			// Enable Fall n Play on target if killer dies before death blowing it
			pTarget->Fall();
		}
		else if (m_deathBlowState != eDBS_Done)
		{
			DeathBlow(*pTarget); // Call this in case the notification from the animation system got skipped or missed for some reason
		}

		SActorStats* pTargetStats = pTarget->GetActorStats();
		pTargetStats->spectacularKillPartner = 0;
	}
	else
	{
		pCooperativeAnimationManager->StopCooperativeAnimationOnActor(m_pOwner->GetAnimatedCharacter());
	}

	// Enable AI again (for what it's worth - this helps editor)
	if (m_pOwner && m_pOwner->GetEntity()->GetAI())
		m_pOwner->GetEntity()->GetAI()->Event(AIEVENT_ENABLE, 0);

	ClearState();

  assert(m_pOwner);
	SActorStats* pStats = m_pOwner->GetActorStats();
	if(pStats)
		pStats->spectacularKillPartner = 0;
}
Example #19
0
int CFileZillaEnginePrivate::List(const CListCommand &command)
{
	if (!IsConnected())
		return FZ_REPLY_NOTCONNECTED;

	if (command.GetPath().IsEmpty() && command.GetSubDir() != _T(""))
		return FZ_REPLY_SYNTAXERROR;

	if (command.GetFlags() & LIST_FLAG_LINK && command.GetSubDir() == _T(""))
		return FZ_REPLY_SYNTAXERROR;

	bool refresh = (command.GetFlags() & LIST_FLAG_REFRESH) != 0;
	bool avoid = (command.GetFlags() & LIST_FLAG_AVOID) != 0;
	if (refresh && avoid)
		return FZ_REPLY_SYNTAXERROR;

	if (!refresh && !command.GetPath().IsEmpty())
	{
		const CServer* pServer = m_pControlSocket->GetCurrentServer();
		if (pServer)
		{
			CServerPath path(CPathCache::Lookup(*pServer, command.GetPath(), command.GetSubDir()));
			if (path.IsEmpty() && command.GetSubDir().IsEmpty())
				path = command.GetPath();
			if (!path.IsEmpty())
			{
				CDirectoryListing *pListing = new CDirectoryListing;
				CDirectoryCache cache;
				bool is_outdated = false;
				bool found = cache.Lookup(*pListing, *pServer, path, true, is_outdated);
				if (found && !is_outdated)
				{
					if (pListing->m_hasUnsureEntries)
						refresh = true;
					else
					{
						if (!avoid)
						{
							m_lastListDir = pListing->path;
							m_lastListTime = wxDateTime::Now();
							CDirectoryListingNotification *pNotification = new CDirectoryListingNotification(pListing->path);
							AddNotification(pNotification);
						}
						delete pListing;
						return FZ_REPLY_OK;
					}
				}
				if (is_outdated)
					refresh = true;
				delete pListing;
			}
		}
	}
	if (IsBusy())
		return FZ_REPLY_BUSY;

	m_pCurrentCommand = command.Clone();
	return m_pControlSocket->List(command.GetPath(), command.GetSubDir(), command.GetFlags());
}
Example #20
0
//
/// Sends the MCI command to the device if it's not busy.
//
uint32
TMci::SendCommand(uint msg, uint32 command, uint32 param)
{
  if (IsBusy())
    return MCI_NOTIFY_ABORTED;

  return SendCommand(GetDeviceId(), msg, command, param);
}
	void GPUFence::Wait()
	{
		if (IsBusy())
		{
			Utility::ThrowOnFail(Fence->SetEventOnCompletion(ReadyValue, FenceEvent));
			WaitForSingleObjectEx(FenceEvent, INFINITE, FALSE);
		}
	}
Example #22
0
// Decide if we should move to help the player, return true if we will
bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange)
{
	if (IsRogue())
		return false;

	// if we're busy, ignore
	if (IsBusy())
		return false;

	// if we are too far away, ignore
	if (maxRange > 0.0f)
	{
		// compute actual travel distance
		PathCost pc(this);
		real_t travelDistance = NavAreaTravelDistance(m_lastKnownArea, TheNavAreaGrid.GetNearestNavArea(&them->pev->origin), pc);
		if (travelDistance < 0.0f)
			return false;

		if (travelDistance > maxRange)
			return false;
	}

	if (place == UNDEFINED_PLACE)
	{
		// if we have no "place" identifier, go directly to them

		// if we are already there, ignore
		float rangeSq = (them->pev->origin - pev->origin).LengthSquared();
		const float close = 750.0f * 750.0f;

		if (rangeSq < close)
			return true;

		MoveTo(&them->pev->origin, FASTEST_ROUTE);
	}
	else
	{
		// if we are already there, ignore
		if (GetPlace() == place)
			return true;

		// go to where help is needed
		const Vector *pos = GetRandomSpotAtPlace(place);
		if (pos)
		{
			MoveTo(pos, FASTEST_ROUTE);
		}
		else
		{
			MoveTo(&them->pev->origin, FASTEST_ROUTE);
		}
	}

	// acknowledge
	GetChatter()->Say("OnMyWay");

	return true;
}
Example #23
0
void WhenReady(libusb_device_handle *alienfx)
{
    int is_busy = 0;
    do {
        IsBusy(alienfx, & is_busy);
        if(is_busy)
            usleep(1000);
    } while(is_busy);
}
Example #24
0
void
StandbyThread::WaitDone()
{
  assert(!IsInside());
  assert(mutex.IsLockedByCurrent());

  while (alive && IsBusy())
    cond.wait(mutex);
}
Example #25
0
void DVDWorker::StartItem(DVDItem* newItem) {

	// Wait till we are not busy
	while(IsBusy())
		Sleep(100);

	m_WaitingToStart = TRUE;
	m_CurrentItem = newItem;
}
Example #26
0
//-------------------------------------------------------------------------
bool CWeapon::OnActionModify(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
	COffHand * offHandWeapon = NULL;
	bool isOffHandSelected = false;
	GetOffHandInfo(this,isOffHandSelected,&offHandWeapon);

	if (!IsBusy() && !isOffHandSelected)
	{
		if (m_fm)
			m_fm->StopFire();

		if(m_zm && m_zm->IsZoomed())
			m_zm->StopZoom();

		if(m_weaponRaised)
			RaiseWeapon(false,true);

		if (m_modifying && !m_transitioning)
		{
			StopLayer(g_pItemStrings->modify_layer, eIPAF_Default, false);
			PlayAction(g_pItemStrings->leave_modify, 0);
			m_dofSpeed = -1.0f/((float)GetCurrentAnimationTime(eIGS_FirstPerson)/1000.0f);
			m_dofValue = 1.0f;
			m_focusValue = -1.0f;

			GetScheduler()->TimerAction(GetCurrentAnimationTime(eIGS_FirstPerson), CSchedulerAction<ScheduleLayer_Leave>::Create(this), false);
			m_transitioning = true;

			SAFE_HUD_FUNC(WeaponAccessoriesInterface(false));
			m_modifying = false;

			GetGameObject()->InvokeRMI(CItem::SvRequestLeaveModify(), CItem::EmptyParams(), eRMI_ToServer);
		}
		else if (!m_modifying && !m_transitioning)
		{
			gEnv->p3DEngine->SetPostEffectParam("Dof_Active", 1.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_FocusRange", -1.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_FocusMin", 0.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_FocusMax", 5.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_FocusLimit", 20.0f);
			gEnv->p3DEngine->SetPostEffectParam("Dof_UseMask", 0.0f);

			PlayAction(g_pItemStrings->enter_modify, 0, false, eIPAF_Default | eIPAF_RepeatLastFrame);
			m_dofSpeed = 1.0f/((float)GetCurrentAnimationTime(eIGS_FirstPerson)/1000.0f);
			m_dofValue = 0.0f;
			m_transitioning = true;

			GetScheduler()->TimerAction(GetCurrentAnimationTime(eIGS_FirstPerson), CSchedulerAction<ScheduleLayer_Enter>::Create(this), false);
			m_modifying = true;

			GetGameObject()->InvokeRMI(CItem::SvRequestEnterModify(), CItem::EmptyParams(), eRMI_ToServer);
		}
	}

	return true;
}
Example #27
0
int CFileZillaApi::Cancel()
{
	//Check if call allowed
	if (!m_bInitialized)
		return FZ_REPLY_NOTINITIALIZED;
	if (IsBusy()!=FZ_REPLY_BUSY)
		return FZ_REPLY_NOTBUSY;
	m_pMainThread->PostThreadMessage(m_nInternalMessageID, FZAPI_THREADMSG_CANCEL, 0);
	return FZ_REPLY_WOULDBLOCK;
}
Example #28
0
void Newton::DestroyJoint(dgConstraint* const joint)
{
	if (IsBusy()) {		
		// the engine is busy in the previous update, deferred the deletion
		NewtonDeadJoints& jointList = *this;
		jointList.Insert (joint, joint);
	} else {
		dgWorld::DestroyConstraint (joint);
	}
}
Example #29
0
void Newton::DestroyBody(dgBody* const body)
{
	if (IsBusy()) {		
		// the engine is busy in the previous update, deferred the deletion
		NewtonDeadBodies& bodyList = *this;
		bodyList.Insert (body, body);
	} else {
		dgWorld::DestroyBody(body);
	}
}
Example #30
0
// will url encode var and value.
void WebRequestObject::RequestAddPair(const char* var, const char* value)
{
    MyAssert( IsBusy() == false );
    if( IsBusy() )
        return;

    char* varencoded = url_encode( var );
    char* valueencoded = url_encode( value );

    strcat_s( m_PageWanted, MAX_URLLength, varencoded );
    strcat_s( m_PageWanted, MAX_URLLength, "=" );
    strcat_s( m_PageWanted, MAX_URLLength, valueencoded );
    strcat_s( m_PageWanted, MAX_URLLength, "&" );

    free( varencoded );
    free( valueencoded );

    //LOGInfo( LOGTag, "WebRequestObject - RequestAddPair %s\n", m_PageWanted );
}