예제 #1
0
int Menu_LightEditor::Update()
{
  if (LightObject && (PrevLightObject != LightObject))
  {
   PrevLightObject = LightObject;
   obj_LampBulb *L = (obj_LampBulb *)LightObject;

   Light_R = (float)L->Color.R;
   Light_G = (float)L->Color.G;
   Light_B = (float)L->Color.B;
   Light_Radius = L->Radius;
  }


  // NOTE: process all logic (button clicks & keyboard) here
  //  if Update() return 0 - menu will become inactive in floating menu manager

  if (!bLightEditorActive)
  {
      Deactivate();
      layerVisible = false;
	  return 0;
  }

  switch(released_id) 
  {
    case bClose:
      Deactivate();
      layerVisible = false;
	  bLightEditorActive = 0;
      return 0;
      
    case bButton1: 
		{
			FILE *f;
				
				char FName[256];
   
				sprintf(FName,"Levels\\%s\\Light.dat", MissionInfo.MissionDir);

				f = fopen(FName, "wt");

				for(const GameObject* obj = GameWorld.GetFirstObject(); obj; obj = GameWorld.GetNextObject(obj)) 
				{
					if(obj->Class->Name == "obj_LampBulb")
					{
						obj_LampBulb *L = (obj_LampBulb *)obj;
						fprintf(f,"%d %d %d %d %d %d %d\n", int(L->Position.X), int(L->Position.Y), int(L->Position.Z), 
							L->Color.R, L->Color.G, L->Color.B, int(L->Radius));
					}
				}
				fclose (f);
		}
		break;
		
  }

  return 1;
}
예제 #2
0
void APathFollower::Tick ()
{
	if (!bActive)
		return;

	if (bJustStepped)
	{
		bJustStepped = false;
		if (CurrNode->args[2])
		{
			HoldTime = gametic + CurrNode->args[2] * TICRATE / 8;
			x = CurrNode->x;
			y = CurrNode->y;
			z = CurrNode->z;
		}
	}

	if (HoldTime > gametic)
		return;

	// Splines must have a previous node.
	if (PrevNode == NULL && !(args[2] & 1))
	{
		bActive = false;
		return;
	}

	// All paths must have a current node.
	if (CurrNode->Next == NULL)
	{
		bActive = false;
		return;
	}

	if (Interpolate ())
	{
		Time += 8.f / ((float)CurrNode->args[1] * (float)TICRATE);
		if (Time > 1.f)
		{
			Time -= 1.f;
			bJustStepped = true;
			PrevNode = CurrNode;
			CurrNode = CurrNode->Next;
			if (CurrNode != NULL)
				NewNode ();
			if (CurrNode == NULL || CurrNode->Next == NULL)
				Deactivate (this);
			if ((args[2] & 1) == 0 && CurrNode->Next->Next == NULL)
				Deactivate (this);
		}
	}
}
예제 #3
0
void Resource::Set(unsigned int aSourceId, float aValue)
{
	const ResourceTemplate &resource = Database::resourcetemplate.Get(mId).Get(mSubId);

	// if empty...
	if (aValue <= 0)
	{
		aValue = 0;

		// notify all empty listeners
		Database::resourceempty.Get(mId).Get(mSubId)(mId, mSubId, aSourceId);

		if (resource.mAdd < 0)
			Deactivate();
	}

	// if full...
	if (aValue >= resource.mMaximum)
	{
		aValue = resource.mMaximum;
		
		// notify all full listeners
		Database::resourcefull.Get(mId).Get(mSubId)(mId, mSubId, aSourceId);

		if (resource.mAdd > 0)
			Deactivate();
	}

	if (mValue != aValue)
	{
		// if something dropped the value...
		if ((mValue - aValue) * (resource.mAdd) > 0)
		{
			// reset timer
			mTimer = Database::resourcetemplate.Get(mId).Get(mSubId).mDelay;
			Activate();
		}

#ifdef DEBUG_RESOURCE
		DebugPrint("\"%s\" resource=\"%s\" value=%f->%f\n", Database::name.Get(mId).c_str(), Database::name.Get(mSubId).c_str(), mValue, aValue);
#endif

		// update the value
		mValue = aValue;

		// notify all change listeners
		Database::resourcechange.Get(mId).Get(mSubId)(mId, mSubId, aSourceId, aValue);
	}
}
예제 #4
0
    void AndroidEventLoop::ProcessAppEvent(int32_t pCommand)
    {
        switch (pCommand)
        {
			case APP_CMD_CONFIG_CHANGED:
				m_pActivityHandler->onConfigurationChanged();
				break;
			case APP_CMD_INIT_WINDOW:
				m_pActivityHandler->onCreateWindow();
				break;
			case APP_CMD_DESTROY:
				m_pActivityHandler->onDestroy();
				break;
			case APP_CMD_GAINED_FOCUS:
				Activate();
				m_pActivityHandler->onGainFocus();
				break;
			case APP_CMD_LOST_FOCUS:
				m_pActivityHandler->onLostFocus();
				Deactivate();
				break;
			case APP_CMD_LOW_MEMORY:
				m_pActivityHandler->onLowMemory();
				break;
			case APP_CMD_PAUSE:
				m_pActivityHandler->onPause();
				Deactivate();
				break;
			case APP_CMD_RESUME:
				m_pActivityHandler->onResume();
				break;
			case APP_CMD_SAVE_STATE:
				m_pActivityHandler->onSaveState(&Global::pAndroidApp->savedState,
					&Global::pAndroidApp->savedStateSize);
				break;
			case APP_CMD_START:
				m_pActivityHandler->onStart();
				break;
			case APP_CMD_STOP:
				m_pActivityHandler->onStop();
				break;
			case APP_CMD_TERM_WINDOW:
				m_pActivityHandler->onDestroyWindow();
				Deactivate();
				break;
			default:
				break;
        }
    }
예제 #5
0
파일: Turret.cpp 프로젝트: Arc0re/lithtech
void Turret::HandleDeactivateMsg( HOBJECT hSender, const CParsedMsg &crParsedMsg )
{
	if( IsInUse( ))
	{
		Deactivate( );
	}
}
void
GAddressBookTreeDir::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == itsCloseButton && message.Is(JXButton::kPushed))
		{
		Deactivate();
		}
	else if (sender == itsTimerTask && message.Is(JXTimerTask::kTimerWentOff))
		{
		itsWidget->Update();
		}
	else if (sender == itsHelpMenu && message.Is(JXMenu::kItemSelected))
		{
		 const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		HandleHelpMenu(selection->GetIndex());
		}
	else
		{
		GMManagedDirector::Receive(sender, message);
		}
}
//-----------------------------------------------------------------------------
//  Destructor
//-----------------------------------------------------------------------------
CPhysicObjSimple::~CPhysicObjSimple (void)
{
    if ( IsActivated() )
    {
        Deactivate();
    }
}
LRESULT 
CContextSamplePropPage::OnInitDialog( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
    ATLTRACE( "== CContextSamplePropPage::OnInitDialog\n" );

    EnableThemeDialogTexture( m_hWnd, ETDT_ENABLETAB );

    HRESULT hr = S_OK;
    m_fInitializing = TRUE;

    hr = Connect();
    if ( FAILED( hr ) )
    {
        MessageBox( IDS_SERVER_CONNECT_ERROR );
        Deactivate();
        return( m_fInitializing = FALSE );
    }

    hr = GetPluginSetting();
    if( SUCCEEDED( hr ) )
    {
        hr = PopulateControls();
    }

    return( m_fInitializing = FALSE );
} //end of OnInitDialog.
예제 #9
0
파일: SnowFX.cpp 프로젝트: Arc0re/lithtech
CSnowFXAirspace::~CSnowFXAirspace()
{
	Deactivate();

	if( m_Effect )
		m_Parent->m_pClientDE->RemoveObject( m_Effect );
}
예제 #10
0
void CPHCapture::RemoveConnection(IPhysicsShellHolder* O)
{
    if( m_taget_object==O )
    {
        Deactivate();
    }
}
예제 #11
0
vncVideoDriver::~vncVideoDriver()
{
	UnMapSharedbuffers();
	Deactivate();
	_ASSERTE(!m_fIsActive);
	_ASSERTE(!m_fDirectAccessInEffect);
}
예제 #12
0
void CPlayAreaEntity::Destroy()
{
	Deactivate();
	m_dRTRadius=0;
	m_EntityType.Detach();
	CPlayAreaElementBase::Destroy();
}
예제 #13
0
//
// IFVar::Done
//
// Release the memory used by the var
//
void IFaceVar::Done()
{
  // Dipose of var pointer
  if (varPtr)
  {
    Deactivate();

    switch (varType)
    {
      case VarSys::VI_INTEGER:
      {
        delete varInteger;
        varInteger = NULL;
        break;
      }

      case VarSys::VI_FPOINT:
      {
        delete varFloat;
        varFloat = NULL;
        break;
      }

      case VarSys::VI_STRING:
      {
        delete varString;
        varString = NULL;
        break;
      }
    }

    varPtr = NULL;
  }
}
예제 #14
0
	void Update(float aStep)
	{
		if (Capturable *capturable =Database::capturable.Get(mId))
			capturable->Capture();
		Deactivate();
		delete this;
	}
void CSoundAnimationObject::CheckActivation(unsigned int dwCurrentTime)
{
	unsigned int dwRelativeTime=dwCurrentTime-m_piAnimation->GetCurrentTimeBase();
	if(m_piSound==NULL)
	{
		if(m_pType->m_SoundType.m_piSoundType && dwRelativeTime>=m_pType->m_nStartTime)
		{
			m_piSound=m_pType->m_SoundType.m_piSoundType->CreateInstance();
			if(m_piSound)
			{
				m_piSound->SetVolume(m_pType->m_dVolume);
				m_piSound->SetLoop(m_pType->m_bLoop);
				m_piSound->Play();
			}
		}
	}
	else
	{
		if(m_pType->m_SoundType.m_piSoundType && m_pType->m_nEndTime && dwRelativeTime>=m_pType->m_nEndTime)
		{
			if(m_piSound){m_piSound->Stop();}
			Deactivate();
		}
	}
}
예제 #16
0
STDAPI CMarkTextService::Activate(ITfThreadMgr *pThreadMgr, TfClientId tfClientId)
{
    _pThreadMgr = pThreadMgr;
    _pThreadMgr->AddRef();

    _tfClientId = tfClientId;

    if (!_InitLanguageBar())
        goto ExitError;

    if (!_InitThreadMgrSink())
        goto ExitError;

    if (!_InitDisplayAttributeGuidAtom())
        goto ExitError;

    if (!_InitCleanupContextDurationSink())
        goto ExitError;

    if (!_InitGlobalCompartment())
        goto ExitError;

    if (!_InitWorkerWnd())
        goto ExitError;

    if (!_InitKeystrokeSink())
        goto ExitError;

    return S_OK;

ExitError:
    Deactivate(); // cleanup any half-finished init
    return E_FAIL;
}
예제 #17
0
파일: Dock.cpp 프로젝트: treeman/Sat-E
bool Dock::HandleEvent( sf::Event &e )
{
    if( e.Type == sf::Event::KeyPressed ) {
        switch( e.Key.Code ) {
            case sf::Key::Escape:
                Deactivate();
                break;
            case sf::Key::Up:
                MoveUp();
                break;
            case sf::Key::Down:
                MoveDown();
                break;
            case sf::Key::Left:
                MoveLeft();
                break;
            case sf::Key::Right:
                MoveRight();
                break;
            case sf::Key::Return:
            case sf::Key::Space:
                Execute();
                break;
            default:
                break;
        }
    }
    return true;
}
예제 #18
0
	void Update(float aStep)
	{
		if (Cancelable *cancelable = Database::cancelable.Get(Updatable::mId))
			cancelable->Cancel(Updatable::mId, mSourceId);
		Deactivate();
		delete this;
	}
예제 #19
0
void GLPort::ResetSize(bool mkcur)
{
    if (mkcur)
    {
        Activate();
    }

    w = MainForm->pnlView->ClientWidth;
    h = MainForm->pnlView->ClientHeight;

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    // From JED
    double dpx = (double)w/ppUnit*CamScale;
    double dpy = (double)h/ppUnit*CamScale;
    glOrtho(-dpx/2.0, dpx/2.0, -dpy/2.0, dpy/2.0,
            Proj.dMax*100.0, Proj.dMin*100.0);
    glViewport(0, 0, w, h);

    if (mkcur)
    {
        Deactivate();
    }
}
STDAPI CTextService::Activate(ITfThreadMgr *pThreadMgr, TfClientId tfClientId)
{
    _pThreadMgr = pThreadMgr;
    _pThreadMgr->AddRef();

    //
    // Initialize ThreadMgrEventSink.
    //
    if (!_InitThreadMgrEventSink())
        goto ExitError;

    // 
    //  If there is the focus document manager already,
    //  we advise the TextEditSink.
    // 
    ITfDocumentMgr *pDocMgrFocus;
    if ((_pThreadMgr->GetFocus(&pDocMgrFocus) == S_OK) &&
        (pDocMgrFocus != NULL))
    {
        _InitTextEditSink(pDocMgrFocus);
        pDocMgrFocus->Release();
    }

    //
    // Initialize Language Bar.
    //
    if (!_InitLanguageBar())
        goto ExitError;

    return S_OK;

ExitError:
    Deactivate(); // cleanup any half-finished init
    return E_FAIL;
}
예제 #21
0
void OutputTarget::End (int dontkill /* =-1 */)
{
	AskForEnd ();	/// this thread doesn't respond to std AskForEnd() - not very elegant.
	Deactivate ();
	something_to_send.Post();
	Join ();
}
예제 #22
0
파일: control.c 프로젝트: barak/ivtools-cvs
void ControlState::Pop() {
    if (prev != nil) {
	prev->next = next;
	prev = nil;
    }
    Deactivate();
}
예제 #23
0
void plProgressMgr::IUnregisterOperation(plOperationProgress* op)
{
    plOperationProgress* last = nil;
    plOperationProgress* cur = fOperations;

    while (cur)
    {
        if (cur == op)
        {
            if (cur->fNext)
                cur->fNext->fBack = last;

            if (last)
                last->fNext = cur->fNext;
            else
                fOperations = cur->fNext;

            break;
        }

        last = cur;
        cur = cur->fNext;
    }

    if (fOperations == nil)
    {
        fCurrentStaticText = kNone;
        Deactivate();
    }
}
예제 #24
0
파일: Camera.cpp 프로젝트: Neproify/ivmp
	void Camera::isActive::set(bool value){
		NON_EXISTING_CHECK();
		if (value)
			Activate();
		else
			Deactivate();
	}
예제 #25
0
//-------------------------------------------------------------------------------------------
//!
//-------------------------------------------------------------------------------------------
void tContextPanelCommon::OnExitButtonPressed()
{
    if( m_PanelActive || isVisible() )
    {
        Deactivate();
    }
}
예제 #26
0
EditCurve::EditCurve(BezierCurve *targetCurve, Color curveColor) : UIElement() {

    this->targetCurve = targetCurve;

    poly = new Polycode::Polygon();

    for(int i=0; i < CURVE_SIZE; i++) {
        poly->addVertex(0.0, 0.0, 0.0);
    }

    visMesh = new ScreenMesh(Mesh::LINE_STRIP_MESH);
    visMesh->getMesh()->addPolygon(poly);

    visMesh->lineSmooth = true;
    visMesh->lineWidth = 2.0;

    addChild(visMesh);
    visMesh->setPosition(0, 254);
    visMesh->color = curveColor;

    pointsBase = new UIElement();
    addChild(pointsBase);

    pointToRemove = NULL;

    updateCurve();
    updatePoints();

    Deactivate();
}
예제 #27
0
BOOL CPSerialPort::ClosePort()
{
	Deactivate();
	if(m_hComm!=INVALID_HANDLE_VALUE)
	{
		if(IsActive())
			Deactivate();
		SetCommMask(m_hComm,0);		
		PurgeComm(m_hComm,PURGE_TXCLEAR|PURGE_RXCLEAR);
		CloseHandle(m_hComm);
		m_hComm=INVALID_HANDLE_VALUE;
		return TRUE;
	}
	
	return TRUE;	
}
예제 #28
0
CEXIETHERNET::~CEXIETHERNET()
{
	Deactivate();

	delete tx_fifo;
	delete mBbaMem;
	delete mRecvBuffer;
}
 //-----------------------------------------------------------
 void EditableTextUIComponent::OnReleasedOutside(Widget* widget, const Pointer& pointer, Pointer::InputType inputType) noexcept
 {
     // If user presses outside of element, defocus and deactivate.
     if (m_active)
     {
         Deactivate();
     }
 }
예제 #30
0
int CPageSite::CloseSite()
{
	if (page) {
		if (active) Deactivate();
		page = NULL;
	}
	return 0;
}