コード例 #1
0
	cWorld3D::~cWorld3D()
	{
		if(cHaptic::GetIsUsed())
		{
			//mpHaptic->GetLowLevel()->DestroyAllShapes();
			//Not so good to do it here..
		}

		STLDeleteAll(mlstMeshEntities);
		STLDeleteAll(mlstLights);
		STLDeleteAll(mlstBillboards);
		STLDeleteAll(mlstBeams);
		STLDeleteAll(mlstColliders);
		STLDeleteAll(mlstParticleSystems);
		STLDeleteAll(mlstStartPosEntities);
		STLMapDeleteAll(m_mapAreaEntities);

		STLDeleteAll(mlstAINodeContainers);
		STLDeleteAll(mlstAStarHandlers);
		STLMapDeleteAll(m_mapTempNodes);

		if(mpScript){
			mpResources->GetScriptManager()->Destroy(mpScript);
		}

		if(mpPhysicsWorld && mbAutoDeletePhysicsWorld)
			mpPhysics->DestroyWorld(mpPhysicsWorld);

		//So that bodies can stop sound entities on destruction.
		STLDeleteAll(mlstSoundEntities);

		hplDelete(mpPortalContainer);

		hplDelete(mpRootNode);
	}
コード例 #2
0
ファイル: Scene.cpp プロジェクト: WhatIsXO/HPL1Engine
	cScene::~cScene()
	{
		Log("Exiting Scene Module\n");
		Log("--------------------------------------------------------\n");

		STLDeleteAll(mlstWorld3D);
		STLDeleteAll(mlstCamera);

		hplDelete(mpCollider2D);

		Log("--------------------------------------------------------\n\n");

	}
コード例 #3
0
ファイル: AnimationState.cpp プロジェクト: MIFOZ/EFE-Engine
	cAnimationState::~cAnimationState()
	{
		STLDeleteAll(m_vEvents);

		if (m_pAnimationManager)
			m_pAnimationManager->Destroy(m_pAnimation);
	}
コード例 #4
0
void cMapHandler::Reset()
{
#ifdef DEMO_VERSION
	glNumOfLoads = 0;
#endif

	mMapChanger.mbActive = false;
	msCurrentMap = "";

	if(mpInit->mbResetCache) mpWorldCache->DecResources();

	mvLoadedMaps.clear();

	//Timers
	STLDeleteAll(mlstTimers);

	DestroyAll();

	//Haptic
	if(mpInit->mbHasHaptics)
	{
		mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyAllShapes();
		mpInit->mpGame->GetHaptic()->GetLowLevel()->StopAllForces();
	}

	//World3D
	if(mpScene->GetWorld3D()) mpScene->DestroyWorld3D(mpScene->GetWorld3D());
	mpScene->SetWorld3D(NULL);

	//Make sure no occulssion queries are left.
	mpInit->mpGame->GetGraphics()->GetRenderer3D()->GetRenderList()->Clear();
}
コード例 #5
0
void cGameMessageHandler::Update(float afTimeStep)
{
	if(mpInit->mpPlayer->IsDead())
	{
		STLDeleteAll(mlstMessages);
		mlstMessages.clear();
		return;
	}
	
	int lCount=0;
	tGameMessageListIt it = mlstMessages.begin();
	for(;it != mlstMessages.end(); ++lCount)
	{
		cGameMessage *pMess = *it;
		
		pMess->Update(afTimeStep);
		
		if(lCount==0 && pMess->mbActive==false)
		{
			hplDelete( pMess );
			it = mlstMessages.erase(it);
		}
		else
		{
			++it;
		}
	}
}
コード例 #6
0
void cGameMessageHandler::Reset()
{
	STLDeleteAll(mlstMessages);
	mlstMessages.clear();

	mbFocusIsedUsed = false;
}
コード例 #7
0
	void iPhysicsWorld::DestroyAll()
	{
		STLDeleteAll(mlstCharBodies);

		//Bodies
		tPhysicsBodyListIt it = mlstBodies.begin();
		for(; it != mlstBodies.end(); ++it)
		{
			iPhysicsBody *pBody = *it;
			pBody->Destroy();
			hplDelete(pBody);
		}
		mlstBodies.clear();

		STLDeleteAll(mlstShapes);
		STLDeleteAll(mlstJoints);
		STLDeleteAll(mlstControllers);
		STLMapDeleteAll(m_mapMaterials);
	}
コード例 #8
0
ファイル: Physics.cpp プロジェクト: ArchyInf/HPL1Engine
	cPhysics::~cPhysics()
	{
		Log("Exiting Physics Module\n");
		Log("--------------------------------------------------------\n");

		STLDeleteAll(mlstWorlds);
		STLMapDeleteAll(m_mapSurfaceData);

		Log("--------------------------------------------------------\n\n");
	}
コード例 #9
0
void cMapHandler::DestroyAll()
{
	mbDestroyingAll = true;
	RemoveLocalTimers();

	//Game entities
	STLMapDeleteAll(m_mapGameEntities);
	m_mapGameEntities.clear();
	mlstGameEnemies.clear();
	mlstGameItems.clear();

	//Light flashes
	STLDeleteAll(mlstLightFlashes);
	mlstLightFlashes.clear();
	mbDestroyingAll = false;
}
コード例 #10
0
cGraphicsDrawer::~cGraphicsDrawer()
{
    ClearBackgrounds();

    STLDeleteAll(mlstGfxObjects);
}
コード例 #11
0
ファイル: GuiSet.cpp プロジェクト: AugRob/Innsmouth-Engine
void cGuiClipRegion::Clear()
{
    STLDeleteAll(mlstChildren);
}
コード例 #12
0
	cSurfaceData::~cSurfaceData()
	{
		STLDeleteAll(mvImpactData);
		STLDeleteAll(mvHitData);
	}
コード例 #13
0
cNumericalPanel::~cNumericalPanel(void)
{
	STLDeleteAll(mlstButtons);
}
コード例 #14
0
	cSector::~cSector()
	{
		STLDeleteAll(mlstPortals);
	}
コード例 #15
0
ファイル: AStar.cpp プロジェクト: ArchyInf/HPL1Engine
	cAStarHandler::~cAStarHandler()
	{
		STLDeleteAll(m_setClosedList);
		STLDeleteAll(m_setOpenList);
	}
コード例 #16
0
cVideoManager::~cVideoManager()
{
    STLDeleteAll(mlstVideoLoaders);
}
コード例 #17
0
iGameEntity::~iGameEntity()
{
	cWorld3D *pWorld = mpInit->mpGame->GetScene()->GetWorld3D();

	//////////////////////////////////////////////
	// Remove all references to from all otter
	//Log("Deleting '%s'\n",msName.c_str());

	//Player
	mpInit->mpPlayer->RemoveCollideScriptWithChildEntity(this);

	//Other entities (check so not all entities are being destroyed, 
	//                 in that case it is not needed and might be bad).
	if(mpInit->mpMapHandler->IsDestroyingAll()==false)
	{
		tGameEntityIterator it = mpInit->mpMapHandler->GetGameEntityIterator();
		while(it.HasNext())
		{
			iGameEntity *pEntity = it.Next();
			pEntity->RemoveCollideScriptWithChildEntity(this);
		}
	}

	////////////////////////////////////////////
	// Destroy haptic
	for(size_t i=0; i< mvHapticShapes.size(); ++i)
	{
		if(mvHapticShapes[i])
		{
			mpInit->mpGame->GetHaptic()->GetLowLevel()->DestroyShape(mvHapticShapes[i]);
		}
	}
	
	//////////////////////////////////////////////
	// Destroy all graphics in the entity!
    if(pWorld && mpInit->mbDestroyGraphics)
	{
		for(size_t i=0; i<mvBodies.size(); ++i)
		{
			//Make sure that this body is not picked!
			if(mpInit->mpPlayer->GetPickedBody() == mvBodies[i])
				mpInit->mpPlayer->GetPickRay()->mpPickedBody = NULL;

			if(mpInit->mpPlayer->GetPushBody() == mvBodies[i])
			{
				ePlayerState state = mpInit->mpPlayer->GetState();
				if(	state == ePlayerState_Move ||
					state == ePlayerState_Grab ||
					state == ePlayerState_Push)
				{
					ePlayerState prevState = mpInit->mpPlayer->GetStateData(state)->mPreviuosState;
					if(prevState == ePlayerState_InteractMode)
						mpInit->mpPlayer->ChangeState(ePlayerState_InteractMode);
					else
						mpInit->mpPlayer->ChangeState(ePlayerState_Normal);
				}

				mpInit->mpPlayer->SetPushBody(NULL);
			}
			
			
			pWorld->GetPhysicsWorld()->DestroyBody(mvBodies[i]);
		}
		if(mpMeshEntity) pWorld->DestroyMeshEntity(mpMeshEntity);
	
		for(size_t i=0; i<mvLights.size(); ++i) 
			pWorld->DestroyLight(mvLights[i]);
		for(size_t i=0; i<mvParticleSystems.size(); ++i) 
			if(mvParticleSystems[i]) mvParticleSystems[i]->Kill();
		for(size_t i=0; i<mvBillboards.size(); ++i) 
			pWorld->DestroyBillboard(mvBillboards[i]);
		for(size_t i=0; i<mvBeams.size(); ++i) 
			pWorld->DestroyBeam(mvBeams[i]);
		for(size_t i=0; i<mvSoundEntities.size(); ++i) 
		{
			pWorld->DestroySoundEntity(mvSoundEntities[i]);
		}

		if(mpCharBody)
			pWorld->GetPhysicsWorld()->DestroyCharacterBody(mpCharBody);
	}
	
	//Delete callbacks
	for(int i=0; i< eGameEntityScriptType_LastEnum; ++i) 
	{
		if( mvCallbackScripts[i]) hplDelete( mvCallbackScripts[i] );
	}
	STLMapDeleteAll(m_mapCollideCallbacks);

	STLDeleteAll(mvTransMaterials);

	for(size_t i=0; i<mvPreloadedBreakMeshes.size();++i)
	{
		mpInit->mpGame->GetResources()->GetMeshManager()->Destroy(mvPreloadedBreakMeshes[i]);
	}
}
コード例 #18
0
cGameMessageHandler::~cGameMessageHandler(void)
{
	STLDeleteAll(mlstMessages);
}
コード例 #19
0
ファイル: Animation.cpp プロジェクト: AugRob/Innsmouth-Engine
cAnimation::~cAnimation()
{
    STLDeleteAll(mvTracks);
}
コード例 #20
0
ファイル: AStar.cpp プロジェクト: ArchyInf/HPL1Engine
	bool cAStarHandler::GetPath(const cVector3f& avStart, const cVector3f& avGoal,tAINodeList *apNodeList)
	{
		/////////////////////////////////////////////////
		// check if there is free path from start to goal
		if(mpContainer->FreePath(avStart,avGoal,3))
		{
			mpGoalNode = NULL;
			return true;
		}

		////////////////////////////////////////////////
		//Reset all variables
		//These should just be cleared and pools used instead.
		STLDeleteAll(m_setClosedList);
		STLDeleteAll(m_setOpenList);
		m_setGoalNodes.clear();
		mpGoalNode=NULL;

		//Set goal position
		mvGoal = avGoal;
		
		float fMaxHeight = mpContainer->GetMaxHeight()*1.5f;

		////////////////////////////////////////////////
		//Find nodes reachable from the start and goal position (use double 2*2 distance)
		float fMaxDist = mpContainer->GetMaxEdgeDistance()*2; //float fMaxDist = mpContainer->GetMaxEdgeDistance()*mpContainer->GetMaxEdgeDistance()*4;
		
		/////////////////////
		//Check with Start
		//Log(" Get Start\n");
		cAINodeIterator startNodeIt =  mpContainer->GetNodeIterator(avStart,fMaxDist);
		while(startNodeIt.HasNext())
		{
			cAINode *pAINode = startNodeIt.Next();
			//Log("Check node: %s\n",pAINode->GetName().c_str());

			float fHeight = fabs(avStart.y - pAINode->GetPosition().y);
			float fDist = cMath::Vector3Dist(avStart,pAINode->GetPosition()); //float fDist = cMath::Vector3DistSqr(avStart,pAINode->GetPosition());
			if(fDist < fMaxDist && fHeight <= fMaxHeight)
			{
				//Check if path is clear
				if(mpContainer->FreePath(avStart,pAINode->GetPosition(),-1,
										eAIFreePathFlag_SkipDynamic))
				{
					AddOpenNode(pAINode,NULL,fDist);
				}
			}
		}
		//Log(" Found start\n");

		////////////////////////////////
		//Check with Goal
		//Log(" Get Goal\n");
		cAINodeIterator goalNodeIt =  mpContainer->GetNodeIterator(avGoal,fMaxDist);
		while(goalNodeIt.HasNext())
		{
			cAINode *pAINode = goalNodeIt.Next();
			//Log("Check node: %s\n",pAINode->GetName().c_str());
			
			float fHeight = fabs(avGoal.y - pAINode->GetPosition().y);
			float fDist = cMath::Vector3Dist(avGoal,pAINode->GetPosition()); //fDist = cMath::Vector3DistSqr(avGoal,pAINode->GetPosition());
			if(fDist < fMaxDist && fHeight <= fMaxHeight)
			{
				//Check if path is clear
				if(mpContainer->FreePath(avGoal,pAINode->GetPosition(),3))
				{
					m_setGoalNodes.insert(pAINode);
				}
			}
		}
		//Log(" Found goal\n");
		
		/*for(int i=0; i<mpContainer->GetNodeNum(); ++i)
		{
			cAINode *pAINode = mpContainer->GetNode(i);

			////////////////////////////////
			//Check with Start
			float fHeight = fabs(avStart.y - pAINode->GetPosition().y);
			float fDist = cMath::Vector3Dist(avStart,pAINode->GetPosition());
			//float fDist = cMath::Vector3DistSqr(avStart,pAINode->GetPosition());
			if(fDist < fMaxDist && fHeight <= fMaxHeight)
			{
				//Check if path is clear
				if(mpContainer->FreePath(avStart,pAINode->GetPosition(),-1))
				{
					AddOpenNode(pAINode,NULL,fDist);
				}
			}

			////////////////////////////////
			//Check with Goal
			fHeight = fabs(avGoal.y - pAINode->GetPosition().y);
			fDist = cMath::Vector3Dist(avGoal,pAINode->GetPosition());
			//fDist = cMath::Vector3DistSqr(avGoal,pAINode->GetPosition());
			if(fDist < fMaxDist && fHeight <= fMaxHeight)
			{
				//Check if path is clear
				if(mpContainer->FreePath(avGoal,pAINode->GetPosition(),3))
				{
					m_setGoalNodes.insert(pAINode);
				}
			}
		}*/

		////////////////////////////////////////////////
		//Iterate the algorithm
		IterateAlgorithm();

		////////////////////////////////////////////////
		//Check if goal was found, if so build path.
		if(mpGoalNode)
		{
			if(apNodeList)
			{
				cAStarNode *pParentNode = mpGoalNode;
				while(pParentNode != NULL)
				{
					apNodeList->push_back(pParentNode->mpAINode);
					pParentNode = pParentNode->mpParent;
				}
			}

			return true;
		}
		else
		{
			 return false;
		}
	}
コード例 #21
0
	cAnimationTrack::~cAnimationTrack()
	{
		STLDeleteAll(mvKeyFrames);
	}