rendered paste bodyIndex: src/common/bgloader/loader.cpp===================================================================--- src/common/bgloader/loader.cpp (revision 5731)+++ src/common/bgloader/loader.cpp (working copy)@@ -206,7 +206,7 @@ if(!force) { // Check if we've moved.- if(csVector3(lastPos - pos).Norm() < loadRange/10)+ if(csVector3(lastPos - pos).Norm() < loadRange/10 && lastSector->name == sectorName) { return; }@@ -709,19 +709,9 @@ csBox3 wwUnloadBox = unloadBox; if(sector->portals[i]->warp) {- csVector3& transform = sector->portals[i]->transform;- wwLoadBox.SetMin(0, wwLoadBox.MinX()-transform.x);- wwLoadBox.SetMin(1, wwLoadBox.MinY()-transform.y);- wwLoadBox.SetMin(2, wwLoadBox.MinZ()-transform.z);- wwLoadBox.SetMax(0, wwLoadBox.MaxX()-transform.x);- wwLoadBox.SetMax(1, wwLoadBox.MaxY()-transform.y);- wwLoadBox.SetMax(2, wwLoadBox.MaxZ()-transform.z);- wwUnloadBox.SetMin(0, wwUnloadBox.MinX()-transform.x);- wwUnloadBox.SetMin(1, wwUnloadBox.MinY()-transform.y);- wwUnloadBox.SetMin(2, wwUnloadBox.MinZ()-transform.z);- wwUnloadBox.SetMax(0, wwUnloadBox.MaxX()-transform.x);- wwUnloadBox.SetMax(1, wwUnloadBox.MaxY()-transform.y);- wwUnloadBox.SetMax(2, wwUnloadBox.MaxZ()-transform.z);+ csReversibleTransform t(sector->portals[i]->matrix, sector->portals[i]->transform);+ t.This2Other(wwLoadBox);+ t.This2Other(wwUnloadBox); } LoadSector(wwLoadBox, wwUnloadBox, sector->portals[i]->targetSector, depth+1, false, loadMeshes); }@@ -761,19 +751,9 @@ csBox3 wwUnloadBox = unloadBox; if(sector->portals[i]->warp) {- csVector3& transform = sector->portals[i]->transform;- wwLoadBox.SetMin(0, wwLoadBox.MinX()-transform.x);- wwLoadBox.SetMin(1, wwLoadBox.MinY()-transform.y);- wwLoadBox.SetMin(2, wwLoadBox.MinZ()-transform.z);- wwLoadBox.SetMax(0, wwLoadBox.MaxX()-transform.x);- wwLoadBox.SetMax(1, wwLoadBox.MaxY()-transform.y);- wwLoadBox.SetMax(2, wwLoadBox.MaxZ()-transform.z);- wwUnloadBox.SetMin(0, wwUnloadBox.MinX()-transform.x);- wwUnloadBox.SetMin(1, wwUnloadBox.MinY()-transform.y);- wwUnloadBox.SetMin(2, wwUnloadBox.MinZ()-transform.z);- wwUnloadBox.SetMax(0, wwUnloadBox.MaxX()-transform.x);- wwUnloadBox.SetMax(1, wwUnloadBox.MaxY()-transform.y);- wwUnloadBox.SetMax(2, wwUnloadBox.MaxZ()-transform.z);+ csReversibleTransform t(sector->portals[i]->matrix, sector->portals[i]->transform);+ t.This2Other(wwLoadBox);+ t.This2Other(wwUnloadBox); } LoadSector(wwLoadBox, wwUnloadBox, sector->portals[i]->targetSector, depth+1, false, loadMeshes); }Index: src/common/engine/psworld.h===================================================================--- src/common/engine/psworld.h (revision 5731)+++ src/common/engine/psworld.h (working copy)@@ -97,7 +97,6 @@ csArray<sectorTransformation> transarray; - void BuildWarpCache(); public: psWorld(); ~psWorld();@@ -129,6 +128,7 @@ static float Matrix2YRot(const csMatrix3& mat); void DumpWarpCache();+ void BuildWarpCache(); }; Index: src/common/engine/psworld.cpp===================================================================--- src/common/engine/psworld.cpp (revision 5731)+++ src/common/engine/psworld.cpp (working copy)@@ -151,7 +151,7 @@ return true; // No need to transform, pos ok. int i = engine->GetSectors()->Find((iSector*)from);- if (i == -1)+ if (i == csArrayItemNotFound) { return false; // Didn't find transformation, pos not ok. }@@ -172,7 +172,7 @@ return true; int i = engine->GetSectors()->Find((iSector*)from);- if (i == -1)+ if (i == csArrayItemNotFound) return false; csReversibleTransform* transform = transarray[i].Get((iSector*)to);Index: src/client/zonehandler.cpp===================================================================--- src/client/zonehandler.cpp (revision 5731)+++ src/client/zonehandler.cpp (working copy)@@ -184,8 +184,11 @@ if (celclient->GetMainPlayer()) oldsector = celclient->GetMainPlayer()->GetSector(); - if (oldsector && newsector)+ if (oldsector && newsector && celclient->GetWorld())+ {+ celclient->GetWorld()->BuildWarpCache(); // we need an up-to-date warp cache here connected = celclient->GetWorld()->Connected(newsector, oldsector);+ } ZoneLoadInfo* zone = FindZone(sectorToLoad); if (zone == NULL)