예제 #1
0
void SimGroup::popObject()
{
   MutexHandle handle;
   handle.lock( mMutex );

   if( objectList.empty() )
   {
      AssertWarn( false, "SimGroup::popObject - Stack underflow" );
      return;
   }

   SimObject* object = objectList.last();
   objectList.pop_back();

   object->onGroupRemove();
   object->mGroup = NULL;

   clearNotify( object );
   mNameDictionary.remove( object );
      
   getSetModificationSignal().trigger( SetObjectAdded, this, object );
   if( object->isProperlyAdded() )
      onObjectRemoved_callback( object );
   
   object->decRefCount();
}
예제 #2
0
파일: item.cpp 프로젝트: Bloodknight/GMK
void Item::setCollisionTimeout(ShapeBase* obj)
{
   if (mCollisionObject)
      clearNotify(mCollisionObject);
   deleteNotify(obj);
   mCollisionObject = obj;
   mCollisionTimeout = sCollisionTimeout;
   setMaskBits(ThrowSrcMask);
}
예제 #3
0
afxEA_ParticleEmitter::~afxEA_ParticleEmitter()
{
  if (emitter)
  {
    clearNotify(emitter);
    emitter->deleteWhenEmpty();
    emitter = 0;
  }
}
예제 #4
0
void SceneObject::onUnmount( SceneObject *obj, S32 node )
{
   clearNotify(obj);

   if ( !isGhost() ) 
   {           
      setMaskBits( MountedMask );      
      //onUnmount_callback( node );
   }
}
void GhostManager::setScopeObject(SimNetObject *obj)
{
   if(obj == scopeObject)
      return;

   if(scopeObject)
      clearNotify(scopeObject);
   scopeObject = obj;
   if(scopeObject)
      deleteNotify(scopeObject);
}
예제 #6
0
void GameBase::onUnmount( SceneObject *obj, S32 node )
{
   clearNotify(obj);

   GameBase *gbaseObj = dynamic_cast<GameBase*>( obj );

   if ( gbaseObj && gbaseObj->getControlObject() != this )
      clearProcessAfter();

   if (!isGhost()) {
      setMaskBits(MountedMask);
      mDataBlock->onUnmount_callback( this, obj, node );
   }
}
예제 #7
0
void Trigger::processTick(const Move* move)
{
   Parent::processTick(move);

   if (!mDataBlock)
      return;
   if (mDataBlock->isClientSide && isServerObject())
      return;
   if (!mDataBlock->isClientSide && isClientObject())
      return;

   //
   if (mObjects.size() == 0)
      return;

   if (mLastThink + mDataBlock->tickPeriodMS < mCurrTick)
   {
      mCurrTick  = 0;
      mLastThink = 0;

      for (S32 i = S32(mObjects.size() - 1); i >= 0; i--)
      {
         if (testObject(mObjects[i]) == false)
         {
            GameBase* remove = mObjects[i];
            mObjects.erase(i);
            clearNotify(remove);
            
            if (!mLeaveCommand.isEmpty())
            {
               String command = String("%obj = ") + remove->getIdString() + ";" + mLeaveCommand;
               Con::evaluate(command.c_str());
            }

            mDataBlock->onLeaveTrigger_callback( this, remove );
         }
      }

      if (!mTickCommand.isEmpty())
         Con::evaluate(mTickCommand.c_str());

      if (mObjects.size() != 0)
         mDataBlock->onTickTrigger_callback( this );
   }
   else
   {
      mCurrTick += TickMs;
   }
}
예제 #8
0
void GuiControlProfile::setChildrenProfile(GuiControlProfile *prof)
{
   if(prof == mChildrenProfile)
      return;

   // Clear the delete notification we previously set up
   if (mChildrenProfile)
      clearNotify(mChildrenProfile);

   mChildrenProfile = prof;

   // Make sure that the new profile will notify us when it is deleted
   if (mChildrenProfile)
      deleteNotify(mChildrenProfile);
}
예제 #9
0
void
Turret::unshoot()
{
   AssertFatal(m_pProjectile != NULL, "Error, no projectile?");

   m_beganState = wg->currentTime;
   m_fireState  = Reloading;

   m_pProjectile->shutOffProjectile();
   m_pProjectile = NULL;
   
   if (m_pTarget != NULL)
      clearNotify(m_pTarget);
   m_pTarget     = NULL;
}
예제 #10
0
CompoundUndoAction::~CompoundUndoAction()
{
   while( !mChildren.empty() )
   {
      UndoAction* action = mChildren.last();
      if( action->isProperlyAdded() )
         action->deleteObject();
      else
      {
         clearNotify( action );  // need to clear the delete notification manually in this case
         delete action;
      }

      mChildren.pop_back();
   }
}
예제 #11
0
void SimSet::removeObject( SimObject* obj )
{
   lock();
   
   const bool removed = objectList.remove( obj );
   if( removed )
      clearNotify( obj );
   
   unlock();

   if( removed )
   {
      getSetModificationSignal().trigger( SetObjectRemoved, this, obj );
      if( obj->isProperlyAdded() )
         onObjectRemoved_callback( obj );
   }
}
예제 #12
0
void SimSet::popObject()
{
   if( objectList.empty() )
   {
      AssertWarn(false, "Stack underflow in SimSet::popObject");
      return;
   }

   lock();
   SimObject* object = objectList.last();
   objectList.pop_back();

   clearNotify( object );
   unlock();
   
   getSetModificationSignal().trigger( SetObjectRemoved, this, object );
   if( object->isProperlyAdded() )
      onObjectRemoved_callback( object );
}
예제 #13
0
void afxEA_ParticleEmitter::ea_finish(bool was_stopped)
{
  if (arcaneFX::isShutdown())
    return;

  if (emitter)
  {
    // make sure particles are fully faded.
    //   note - fully faded particles are not always
    //     invisible, so they are still kept alive and 
    //     deleted via deleteWhenEmpty().
    if (ew_timing.fade_out_time > 0.0f)
      emitter->setFadeAmount(0.0f);
    if (dynamic_cast<afxParticleEmitter*>(emitter))
      ((afxParticleEmitter*)emitter)->setAFXOwner(0);
    clearNotify(emitter);
    emitter->deleteWhenEmpty();
    emitter = 0;
  }
}
예제 #14
0
void SimSet::onRemove()
{
   MutexHandle handle;
   handle.lock( mMutex );

   if( !objectList.empty() )
   {
      objectList.sortId();
      
      // This backwards iterator loop doesn't work if the
      // list is empty, check the size first.
      
      for( SimObjectList::iterator ptr = objectList.end() - 1;
            ptr >= objectList.begin(); ptr -- )
         clearNotify( *ptr );
   }

   handle.unlock();

   Parent::onRemove();
}
예제 #15
0
void Player::setMountObject (GameBase *object, int in_mountPoint)
{
   if(mount)
      clearNotify(mount);

   setMaskBits(MountMask);
   mount = object;
   mountPoint = in_mountPoint;
   if(mount)
		{
	      deleteNotify(mount);

		   TMat3F tmat;
			mount->getObjectMountTransform(mountPoint, &tmat);
			if (!mountPoint)
				{
					Point3F rot = getRot ();
					tmat.set (EulerF (rot.x, rot.y, rot.z), tmat.p);
				}
		   setTransform(tmat);
			EulerF angles;
			tmat.angles(&angles);
			if (mountPoint < 1)
				setRot (Point3F (0, 0, angles.z));
			else
				if (mountPoint == 1)
					setRot (Point3F (0, 0, 0));
				else
					{
						Point3F rot = getRot ();
						rot.z -= angles.z;
						setRot (rot);
					}

         setImageTriggerUp(0);

			setLinearVelocity (Point3F (0, 0, 0));
		}
}