Exemplo n.º 1
0
void ObjectManager::SetLocalPlayerLocation(int newLocation)
{
  if (m_location == newLocation)
  {
std::cout << "Er, setting location to current value!\n";
    // We want to download new location mesh etc....
    if (GetGameMode() != AMJU_MODE_EDIT)
    {
      //return;
    }
  }

  // Why not do this ??
  if (GetLocalPlayer())
  {
    GetLocalPlayer()->SetLocation(newLocation);
  }

  m_location = newLocation;

  TheGame::Instance()->ClearGameObjects();
  // If using Sweep and Prune for collisions, clear list of objects
  ////TheSAP::Instance()->Clear();

  ClearVe1SceneGraph();

  // Clear the current terrain, which is the important thing the new location must have!
  ClearTerrain();

//std::cout << " ..old location trashed, adding game objects in new location...\n";

  for (GameObjects::iterator it = m_allGameObjects.begin(); it != m_allGameObjects.end(); ++it)
  {
    PGameObject go = it->second;
    Ve1Object* v = dynamic_cast<Ve1Object*>(go.GetPtr());
    if (v)
    {
      if (v->GetLocation() == m_location)
      {
//std::cout << " ..Game object: " << go->GetTypeName() << ", id: " << go->GetId() << "\n";
        AddGameObjectToGame(go); ////TheGame::Instance()->AddGameObject(go);
        ////TheSAP::Instance()->AddBox(go);
        v->OnLocationEntry();
      }
    }
    else
    {
std::cout << "Rather unexpected type of game object: " << go->GetTypeName() << ", id: " << go->GetId() << "\n";
      AddGameObjectToGame(go); ////TheGame::Instance()->AddGameObject(go);
    } 
  }

  // Change to waiting state: some objects required for this new location might not exist yet
  TheGame::Instance()->SetCurrentState(TheGSFileUpdateCheck::Instance()); //TheGSWaitForNewLocation::Instance());
}
Exemplo n.º 2
0
void CUDAMarcher::GenerateTerrain(GenerateInfo gInfo)
{
	int now = timeGetTime();

	gInfo.floor = (float)((m_GridY * 32) / 2);
	gInfo.spherePos[0] = (float)((m_GridX * 32) / 2);
	gInfo.spherePos[1] = gInfo.floor;
	gInfo.spherePos[2] = (float)((m_GridZ * 32) / 2);

	mGenInfo = gInfo;
	ClearTerrain();
	Cubemarch();

	int result = timeGetTime() - now;
	printf("> Created terrain, took %i ms\n", result);
}