Code:
bool Owner3D::LoadMap (const char* mapname)
{
view1.Invalidate();
engine->DeleteAll();
vfs->ChDir (mapname);
if (!loader->LoadMapFile ("world")) return false;
engine->Prepare ();
return true;
}
{
view1.Invalidate();
engine->DeleteAll();
vfs->ChDir (mapname);
if (!loader->LoadMapFile ("world")) return false;
engine->Prepare ();
return true;
}
And this one for seting the camera.
Code:
bool Owner3D::StartCamera()
{
iGraphics2D* g2d = g3d->GetDriver2D ();
view1.AttachNew(new csView (engine, g3d));
view1->SetRectangle (0, 0, g2d->GetWidth (), g2d->GetHeight ());
csVector3 pos (0);
if (engine->GetCameraPositions ()->GetCount () > 0)
{
iCameraPosition* campos = engine->GetCameraPositions ()->Get (0);
room = engine->GetSectors ()->FindByName (campos->GetSector ());
pos = campos->GetPosition ();
}
else
{
room = engine->GetSectors ()->FindByName ("room");
pos = csVector3 (0, 0, 0);
}
if (!room)
return false;
view1->GetCamera ()->SetSector (room);
view1->GetCamera ()->GetTransform ().SetOrigin (pos);
}
{
iGraphics2D* g2d = g3d->GetDriver2D ();
view1.AttachNew(new csView (engine, g3d));
view1->SetRectangle (0, 0, g2d->GetWidth (), g2d->GetHeight ());
csVector3 pos (0);
if (engine->GetCameraPositions ()->GetCount () > 0)
{
iCameraPosition* campos = engine->GetCameraPositions ()->Get (0);
room = engine->GetSectors ()->FindByName (campos->GetSector ());
pos = campos->GetPosition ();
}
else
{
room = engine->GetSectors ()->FindByName ("room");
pos = csVector3 (0, 0, 0);
}
if (!room)
return false;
view1->GetCamera ()->SetSector (room);
view1->GetCamera ()->GetTransform ().SetOrigin (pos);
}
The thing is that when i load the 1st map everithing goes smooth bu the instant i want to load a second level, it throws me an error.
any sugestions¿?
PD:
this is the order for calling the methods
Code:
owner3d.LoadMap(gameMap);
owner3d.StartCamera();
owner3d.StartCamera();





