Ejemplo n.º 1
0
void CCharactersManager::CleanUp ( void )
{
	CHECKED_DELETE ( m_pPropertiesManager );		// Eliminamos las propiedades por defecto
	CHECKED_DELETE ( m_pAnimatedStatesManager );	// Eliminamos los estados por defecto
	CHECKED_DELETE ( m_pPlayer );
	Destroy();
}
Ejemplo n.º 2
0
CPhysicController::~CPhysicController()
{
	//delete m_pPhXControllerDesc->callback;
	CHECKED_DELETE ( m_pPhXCapsuleControllerDesc );
	CHECKED_DELETE ( m_pPhXBoxControllerDesc );
	CHECKED_DELETE ( m_pReport );
}
/// <summary>
/// Libera memoria.
/// </summary>
void CTriggerManager::Release()
{
//free memory
  std::vector<CPhysicUserData*>::iterator l_iter = m_vUserDatas.begin();
  for(;l_iter != m_vUserDatas.end();++l_iter)
  {
    CHECKED_DELETE(*l_iter);
  }

  std::vector<CPhysicActor*>::iterator l_iter2 = m_vTriggerActors.begin();
  for(;l_iter2 != m_vTriggerActors.end();++l_iter2)
  {
    CHECKED_DELETE(*l_iter2);
  }

  /*std::vector<CTrigger*>::iterator l_iter3 = m_vTriggers.begin();
  for(;l_iter3 != m_vTriggers.end();++l_iter3)
  {
    //CHECKED_DELETE(*l_iter3);
    if(*l_iter3) delete *l_iter3; *l_iter3=0;
  }*/


  m_vUserDatas.clear();
  m_vTriggers.clear();
	m_vTriggerActors.clear();
  
  Destroy();
}
Ejemplo n.º 4
0
void CComponentPhysXController::Release(void)
{
  //treure controller del physic manager
  CORE->GetPhysicsManager()->ReleasePhysicController(m_pPhysXController);

  CHECKED_DELETE(m_pPhysXController);
  CHECKED_DELETE(m_pPhysXData);
}
Ejemplo n.º 5
0
CProcessIA4::~CProcessIA4()
{
//  CHECKED_DELETE(m_pPlayer);
  //CHECKED_DELETE(m_pPlayer12);
 CHECKED_DELETE(gController1);
//  CHECKED_DELETE(userdata);
 CHECKED_DELETE(m_pCoregame);
}
Ejemplo n.º 6
0
//----------------------------------------------
void CTrigger::CleanUp()
{
	CPhysicUserData *l_pUserData = m_pTriggerActor->GetUserData();
	CORE->GetPhysicsManager()->ReleasePhysicActor(m_pTriggerActor);

	CHECKED_DELETE(l_pUserData);
	CHECKED_DELETE(m_pTriggerActor);
}
Ejemplo n.º 7
0
//----------------------------------------------------------------------------
// Free memory
//----------------------------------------------------------------------------
void CZombie::Release(){
//free memory
  CHECKED_DELETE(m_pUserData);
  CHECKED_DELETE(m_actManoDerecha);
  CHECKED_DELETE(m_actManoIzquierda);
  /*CHECKED_DELETE(m_triggerManoDerecha);
  CHECKED_DELETE(m_triggerManoIzquierda);*/
  CHECKED_DELETE(m_movIA);
}
Ejemplo n.º 8
0
// -----------------------------------------
//			  MÈTODES PRINCIPALS
// -----------------------------------------
void CPhysicController::CreateController ( NxController* _pController, NxScene* _pScene)
{
	m_pPhXScene			= _pScene;
	m_pPhXController	= _pController;
	assert ( m_pPhXScene );
	assert ( m_pPhXController );
	CHECKED_DELETE ( m_pPhXBoxControllerDesc );
	CHECKED_DELETE ( m_pPhXCapsuleControllerDesc );
}
Ejemplo n.º 9
0
//----------------------------------------------------------------------------
// Free memory
//----------------------------------------------------------------------------
void CInputManager::Release () 
{
	LOGGER->AddNewLog(ELL_INFORMATION, "InputManager:: shutting down DirectInput");

	CHECKED_DELETE(m_pKB);
	CHECKED_DELETE(m_pMouse);
	CHECKED_DELETE(m_pGamePad);
	CHECKED_RELEASE(m_pDI);
  CHECKED_DELETE(m_pAction);

	LOGGER->AddNewLog(ELL_INFORMATION, "InputManager:: offline (ok)");
}
bool CRenderableObjectsLayersManager::LoadRenderableObject( const std::string& l_FilePath, const std::string& l_Name, const std::string& l_RoomName )
{
    bool lOk = true;
    CXMLTreeNode l_Node, l_Root;

    if (!l_Root.LoadAndFindNode(l_FilePath.c_str(), "RenderableObjects", l_Node))
    {
        return false;
    }

    CRenderableObjectsManager *lRenderableObjectManager = new CRenderableObjectsManager();
    uint32 l_NumChilds = l_Node.GetNumChildren();
    m_ResourcesVector.reserve( l_NumChilds );

    for (uint32 i = 0; i < l_NumChilds; ++i)
    {
        const CXMLTreeNode& lNode = l_Node( i );
        const std::string& lTagName = lNode.GetName();
        const std::string& lName = lNode.GetAttribute<std::string>( "name", "" );

        CRenderableObject* p_object = NULL;
        if ( lTagName == "MeshInstance" )
        {
            const std::string& lType = lNode.GetAttribute<std::string>( "type", "static" );
            p_object = ( lType == "static" ) ? AddStatic( lNode ) : AddDynamic( lNode );
        }
        else if ( lTagName == "AnimatedInstance" )
        {
            p_object = new CAnimatedInstanceModel( lNode );
        }

        if( p_object )
        {
            p_object->SetRoomName( l_RoomName );
            if (!lRenderableObjectManager->AddResource(lName, p_object))
            {
                LOG_ERROR_APPLICATION( "Error adding renderable object %s!", lName.c_str() );
                CHECKED_DELETE( p_object );
            }
        }
    }

     if(!AddResource(l_Name, lRenderableObjectManager))
     {
         CHECKED_DELETE(lRenderableObjectManager);
         ASSERT(false, "The layer %s could not be added", l_Name.c_str());

         return false;
     }

     return true;
}
Ejemplo n.º 11
0
CDebugRender::~CDebugRender()
{
    CHECKED_DELETE(m_AxisRenderableVertexs);
    CHECKED_DELETE(m_GridRenderableVertexs);
    CHECKED_DELETE(m_CubeRenderableVertexs);
    CHECKED_DELETE(m_SphereRenderableVertexs);

    CHECKED_RELEASE(m_DrawQuadBlendState);
    CHECKED_DELETE(m_DrawQuadRV);

    CHECKED_RELEASE(m_WireframeRenderState);
    CHECKED_RELEASE(m_SolidRenderState);
}
void CPlayerPhysicProcess::DeleteController( CPhysicUserData* PUD )
{
  std::vector<CPhysicController*>::iterator it = std::find( m_vController.begin(), m_vController.end(),
      PUD->GetController() );

  if ( it != m_vController.end() )
  {
    CHECKED_DELETE( *it );
    std::vector<CPhysicUserData*>::iterator itPUD = std::find( m_vPUD.begin(), m_vPUD.end(), PUD );

    if ( itPUD != m_vPUD.end() )
      CHECKED_DELETE( *itPUD );
  }
}
Ejemplo n.º 13
0
CAStarProcess::~CAStarProcess()
{
  CHECKED_DELETE( m_pAStarScene );

  for ( size_t i = 0; i < m_vPA.size(); ++i )
    CHECKED_DELETE( m_vPA[i] );

  m_vPA.clear();

  for ( size_t i = 0; i < m_vPUD.size(); ++i )
    CHECKED_DELETE( m_vPUD[i] );

  m_vPUD.clear();

  CHECKED_DELETE( m_PhysicController );
}
Ejemplo n.º 14
0
//----------------------------------------------------------------------------
// Free memory
//----------------------------------------------------------------------------
void CSpirit::Release()
{
//free memory
  CHECKED_DELETE(m_eje);
//  CHECKED_DELETE(m_emitter);

}
CElevatorAnimatedPhysicModel::~CElevatorAnimatedPhysicModel()
{
	if (m_PhysicElement!=NULL)
		CORE->GetPhysicsManager()->ReleasePhysicActor(m_PhysicElement->m_PhysicActor);
	
	CHECKED_DELETE(m_PhysicElement);
}
void CParticleSystemManager::LoadXML()
{
  // Parse all the particle systems
    CXMLTreeNode l_XML, l_Node;

    if ( l_XML.LoadAndFindNode( mConfigPath.c_str(), "particles_systems", l_Node ) )
    {
        mEmitterFactory->SetEmittersPath( l_Node.GetAttribute<std::string>( "emitters_path", "" ) );
        for ( uint32 i = 0, lCount = l_Node.GetNumChildren(); i < lCount; ++i )
        {
            const CXMLTreeNode& lCurrentSystem = l_Node( i );
            const std::string& lSystemCoreName = lCurrentSystem.GetAttribute<std::string>( "name", "" );

            CParticleSystemCore* lSystemCore = new CParticleSystemCore( lCurrentSystem, mEmitterFactory );

            ASSERT( lSystemCore, "Null PSystemCore" );

            if ( lSystemCoreName == "" || !mCores.AddResource( lSystemCoreName, lSystemCore ) )
            {
                LOG_ERROR_APPLICATION( "Error initing emitter %s", lSystemCoreName );
                CHECKED_DELETE( lSystemCore );
            }
        }
    }
}
Ejemplo n.º 17
0
void CTriggerManager::AddTrigger(CTrigger* lTrigger)
{
  if(!AddResource(lTrigger->GetName(), lTrigger))
  {
      CHECKED_DELETE(lTrigger);
  }
}
///<summary>
/// CAnimatedInstanceModel:: Destroy
///</summary>
void CAnimatedInstanceModel::Destroy()
{
  CHECKED_DELETE(m_CalModel);
  CHECKED_RELEASE(m_pVB);
  CHECKED_RELEASE(m_pIB);
	m_TextureList.clear();
}
Ejemplo n.º 19
0
bool CTriggerManager::LoadXML( const std::string& FileName )
{
    mConfigPath = FileName;
    CXMLTreeNode newFile;

    if ( !newFile.LoadFile( FileName.c_str() ) )
    {
        LOG_ERROR_APPLICATION( "CTriggerManager::LoadXML=> ERROR loading the file %s.\n", FileName.c_str() );
        return false;
    }

    CXMLTreeNode  m = newFile["triggers"];

    if ( m.Exists() )
    {
        int count = m.GetNumChildren();

        for ( int i = 0; i < count; ++i )
        {
            const std::string l_TagName = m( i ).GetName();

            if ( l_TagName == "trigger" )
            {
                CTrigger* l_Trigger = new CTrigger( m( i ) );
                if(!AddResource(l_Trigger->GetName(), l_Trigger))
                {
                    CHECKED_DELETE(l_Trigger);
                }
            }
        }
    }

    return true;
}
///<summary>
/// CParticleManager:: Release : Liberación de memoria.
///</summary>
///<param name="void"></param>
///<returns name="void"></returns>
void CParticleManager::Release()
{
    //vector de ParticleEmitter
    std::vector<CParticleEmitter*>::iterator l_Iter = m_vParticleEmitter.begin();
    for(; l_Iter != m_vParticleEmitter.end(); ++l_Iter)
    {
        CHECKED_DELETE(*l_Iter);
    }
    m_vParticleEmitter.clear();
    m_stInfo.vColor.clear();
    m_stInfo.vDir.clear();
    m_stInfo.vInstance.clear();
    m_vInfo.clear();
    m_vColor.clear();
    m_vTimeColor.clear();
    m_vDir.clear();
    m_vTimeDir.clear();
    m_vSize.clear();
    m_vTimeSize.clear();
    m_vVelocity.clear();
    m_vTimeVel.clear();
    m_vAngle.clear();
    m_vTimeAngle.clear();

    m_vInstance.clear();
    m_vPEmitterByInstance.clear();
}
Ejemplo n.º 21
0
CEmiterInstance* CEmiterManager::CreateEmiter(const string &_szName, const string &_szCore, const CObject3D& _Position, const Vect3f& _vDimensions, int _iMaxParticles, bool _bBillboardMode)
{
  CEmiterInstance* l_pEI = GetResource(_szName);

  if(l_pEI)
  {
    l_pEI->Reset(_szCore,_Position,_vDimensions, _iMaxParticles, _bBillboardMode);
  }
  else
  {
    l_pEI = new CEmiterInstance();
    if(l_pEI->Init(_szCore,_Position,_vDimensions, _iMaxParticles, _bBillboardMode))
    {
      AddResource(_szName, l_pEI);
    }
    else
    {
      LOGGER->AddNewLog(ELL_ERROR, "CEmiterManager::CreateEmiter Error a l'inicialitzar un emiter");
      LOGGER->AddNewLog(ELL_ERROR, "\tName: %s", _szName.c_str());
      LOGGER->AddNewLog(ELL_ERROR, "\tCore: %s", _szCore.c_str());
      CHECKED_DELETE( l_pEI );
    }
  }

  return l_pEI;
}
CInstanceMesh* CRenderableObjectsLayersManager::AddDynamic( const CXMLTreeNode& atts )
{
    CInstanceMesh* l_InstanceMesh = new CInstanceMesh( atts );
    if(!l_InstanceMesh->IsOk())
    {
        LOG_WARNING_APPLICATION("The instance mesh %s, is not correct, it would not be rendererd", l_InstanceMesh->GetName().c_str());
        CHECKED_DELETE(l_InstanceMesh);

        return NULL;
    }

    // User data
    CPhysicUserData * lData = new CPhysicUserData(l_InstanceMesh->GetName());
    lData->SetGroup(ECG_DYNAMIC_OBJECTS);

    // Phyx actor
    CPhysicActor* l_MeshActor = new CPhysicActor(lData);
    l_MeshActor->SetCollisionGroup(ECG_DYNAMIC_OBJECTS);

    // Obtain a box from the static mesh aabb
    CStaticMesh* l_StaticMesh = l_InstanceMesh->GetStaticMesh();
    Math::AABB3f l_AABB = l_StaticMesh->GetAABB();
    Math::Vect3f l_Pos = l_InstanceMesh->GetTransform() * l_AABB.GetCenter();

    l_MeshActor->AddBoxShape(Vect3f(l_AABB.GetWidth() * 0.5f, l_AABB.GetHeight() * 0.5f, l_AABB.GetDepth() * 0.5f), l_Pos);
    l_MeshActor->CreateBody(1.0f);

    l_InstanceMesh->SetActor(l_MeshActor);
    l_InstanceMesh->SetType("dynamic");

    PhysXMInstance->AddPhysicActor(l_MeshActor, false);

    return l_InstanceMesh;
}
Ejemplo n.º 23
0
CMap::~CMap()
{
  CHECKED_DELETE( m_Player );

  std::vector<CItemMap*>::iterator it = m_vItems.begin(),
                                   it_end = m_vItems.end();

  for ( ; it != it_end ; ++it )
    CHECKED_DELETE( *it );

  std::vector<CEnemyMap*>::iterator it2 = m_vEnemy.begin(),
                                    it_end2 = m_vEnemy.end();

  for ( ; it2 != it_end2 ; ++it2 )
    CHECKED_DELETE( *it2 );
}
Ejemplo n.º 24
0
void CMoveTask::destroy()
{
	for(unsigned int i=0; i < m_Sons.size(); i++)
	{
		CHECKED_DELETE(m_Sons[i]);
	}
	m_Sons.clear();
}
Ejemplo n.º 25
0
CMaterial::~CMaterial()
{
	for(size_t i=0;i<m_Parameters.size();++i)
	{
		CHECKED_DELETE(m_Parameters[i]);
	}
	Destroy();
}
Ejemplo n.º 26
0
CLightProbe::~CLightProbe()
{
    for(std::map<std::string, CLightProbeVertex*>::iterator it = mVertexs.begin(); it != mVertexs.end(); it++)
    {
        CHECKED_DELETE(it->second);
    }

    mVertexs.clear();
}
CPlayerPhysicProcess::~CPlayerPhysicProcess()
{
  CLogger::GetSingletonPtr()->SaveLogsInFile();

  for ( size_t i = 0; i < m_vPA.size(); ++i )
    CHECKED_DELETE( m_vPA[i] );

  m_vPA.clear();

  for ( size_t i = 0; i < m_vPUD.size(); ++i )
    CHECKED_DELETE( m_vPUD[i] );

  m_vPUD.clear();

  for ( size_t i = 0; i < m_vController.size(); ++i )
    CHECKED_DELETE( m_vController[i] );

  m_vController.clear();
}
Ejemplo n.º 28
0
CGizmo::~CGizmo()
{
    std::vector<CGizmoElement*>::iterator it = m_Elements.begin(),
                                          it_end = m_Elements.end();

    for ( ; it != it_end; ++it )
    { CHECKED_DELETE(*it); }

    m_Elements.clear();
}
Ejemplo n.º 29
0
bool CStaticMesh::ExtractTexture(FILE* modelFile, std::vector<CTexture*>& textVector)
{
	assert(modelFile);

	uint16 length = 0;
	char* path;
	std::string sPath = "";

	//Read Length of the texture path
	fread(&length, sizeof(uint16), 1, modelFile);

	path = new char[length];
	memset(path, 0, length);
			
	//Read Path
	fread(path, 1, length, modelFile);
	sPath = std::string(path);
	CHECKED_DELETE(path);

	std::string texName = m_MeshName + "_" + sPath;

	CTexture* texture = CORE->GetTextureManager()->GetResource(texName);

	if(texture == NULL)
	{
		texture = new CTexture();
		texture->SetName(texName);
			
		if(!texture->Load(sPath))
		{
			CHECKED_DELETE(texture);
			texture = CORE->GetTextureManager()->GetNoTexture();

			std::string err = "CStaticMesh::ExtractTexture->No se ha podido crear la textura: " + sPath;
			LOGGER->AddNewLog(ELL_WARNING, err.c_str() );
		}
	}

	textVector.push_back(texture);

	return true;
}
Ejemplo n.º 30
0
void CStaticMesh::ClearRenderableVertex()
{
	for(uint32 i = 0; i < m_RVs.size(); ++i)
	{
		CRenderableVertexs* rndVtx = m_RVs[i];

		CHECKED_DELETE(rndVtx);
	}

	m_RVs.clear();
}