diff --git a/.hgtags b/.hgtags index 09f29bcc8..5f0958f4c 100644 --- a/.hgtags +++ b/.hgtags @@ -1,4 +1,3 @@ -950d650ca92e6041611258d7e5131ccf661e4ec2 compatibility-merge 4eddbaff0c5e5d685db96ee3e8427aa0fd96ac83 ryzomcore/v0.8.0 00d9b6e29e95f56785fbf85abe60afd34674f402 ryzomcore/v0.9.0 79776c337176dd5b02e1a74fe5dfb703b91747aa ryzomcore/v0.9.1 @@ -17,11 +16,13 @@ d4060f217f4f834cc62a33f2f1ccdf3c28298066 ryzom-patch-3.1.0-hotfix 4036ecf59e83960f03acebc2089eb2ff5eeaed0a ryzom-patch-3.2.0 18403bb9485da3d9742c6f007a16d5619ebfb196 ryzom-patch-3.2.1 822ff8f8917ad66e09e2c21c983282f6f693b9f6 ryzom-patch-3.3.0 -00dde390a394fce9da06c2f3264140282158d39f 3.3.0 -0000000000000000000000000000000000000000 3.3.0 +00dde390a394fce9da06c2f3264140282158d39f ryzom-patch-3.3.0 +dcd4c4d161ef775136e18c7e8f5072b75dede27e ryzom-patch-3.3.1 fc4be8ebec5ca754ef4453bc6a9faef90837c674 ryzom-patch-3.4.0 70eba02e8eab6920586dbabf74e9e8180c729980 ryzom-patch-3.4.0 Steam Fix 3941482843f9cd130cfc16634efc08d34a98ed35 ryzom-patch-3.4.0 Atysmas ecae9feb4cceb78103e5d7236caccaf450796cdb ryzom-patch-3.5.0 95783afa226f241062134eb62f4323295d29ac84 ryzom-patch-3.5.0.9637 2102fb276eb69d49ed4923042215312a63c47c08 Live-746 +8eb94c3549be898fdc4a7c6d791d2477bdc11a18 ryzomcore/v1.0.1 +3e92c7104c20d6bc6c2147b4b5fc289e8621d322 ryzomcore/v1.0.0 diff --git a/code/nel/src/pacs/move_container.cpp b/code/nel/src/pacs/move_container.cpp index c302b53ab..b885712d9 100644 --- a/code/nel/src/pacs/move_container.cpp +++ b/code/nel/src/pacs/move_container.cpp @@ -415,7 +415,7 @@ void CMoveContainer::updateCells (CMovePrimitive *primitive, uint8 worldImage) CPrimitiveWorldImage *wI=primitive->getWorldImage (worldImage); #if !FINAL_VERSION - // Check BB width not too large +/* // Check BB width not too large if (wI->getBBXMax() - wI->getBBXMin() > _CellWidth) { nlwarning ("Primitives have moved more than a cell."); @@ -426,6 +426,7 @@ void CMoveContainer::updateCells (CMovePrimitive *primitive, uint8 worldImage) { nlwarning ("Primitives have moved more than a cell."); } +*/ #endif // Get coordinate in the cell array diff --git a/code/ryzom/client/src/continent.cpp b/code/ryzom/client/src/continent.cpp index a30604282..51334195b 100644 --- a/code/ryzom/client/src/continent.cpp +++ b/code/ryzom/client/src/continent.cpp @@ -38,6 +38,8 @@ #include "nel/georges/u_form.h" #include "nel/georges/u_form_elm.h" #include "nel/georges/u_form_loader.h" +// Gui +#include "nel/gui/lua_manager.h" // Client #include "global.h" #include "continent.h" @@ -108,7 +110,7 @@ extern UVisualCollisionManager *CollisionManager; extern bool InitCloudScape; extern bool FirstFrame; extern CContinentManager ContinentMngr; - +extern CEntityManager EntitiesMngr; //----------------------------------------------- // CUserLandMark @@ -385,6 +387,23 @@ static uint getNumZones() return (uint)zoneLoaded.size(); } +static uint16 getZoneIdFromName(const string &zoneName) +{ + uint16 zoneId = 0; + CVector2f pos; + if (getPosFromZoneName(zoneName, pos)) + { + uint x = (uint)pos.x / 160; + uint y = -(uint)pos.y / 160; + zoneId = (x&255) + (y<<8); + } + else + { + nlinfo("no zone..."); + } + return zoneId; +} + //----------------------------------------------- // select : // Update global parameters like the texture for the micro veget. @@ -717,6 +736,26 @@ void CContinent::select(const CVectorD &pos, NLMISC::IProgressCallback &progress vector zonesRemoved; completeIsland = R2::CScenarioEntryPoints::getInstance().getCompleteIslandFromCoords(CVector2f((float) UserEntity->pos().x, (float) UserEntity->pos().y)); Landscape->refreshAllZonesAround(pos, ClientCfg.Vision + ExtraZoneLoadingVision, zonesAdded, zonesRemoved, progress, completeIsland ? &(completeIsland->ZoneIDs) : NULL); + + for (uint i = 0; i < zonesRemoved.size(); i++) + EntitiesMngr.removeInstancesInIgZone(getZoneIdFromName(zonesRemoved[i])); + + for (uint i = 0; i < zonesAdded.size(); i++) + { + CSString luaScript; + string luaScriptName = CPath::lookup(zonesAdded[i]+".lua", false); + if (!luaScriptName.empty()) + { + luaScript.readFromFile(luaScriptName); + CLuaManager::getInstance().executeLuaScript(luaScript, true); + nlinfo("loading %s", luaScriptName.c_str()); + } + else + { + nlinfo("file not found %s", luaScriptName.c_str()); + } + } + LandscapeIGManager.unloadArrayZoneIG(zonesRemoved); LandscapeIGManager.loadArrayZoneIG(zonesAdded, &igAdded); } diff --git a/code/ryzom/client/src/entities.cpp b/code/ryzom/client/src/entities.cpp index 495471da1..ab3de2b99 100644 --- a/code/ryzom/client/src/entities.cpp +++ b/code/ryzom/client/src/entities.cpp @@ -529,7 +529,7 @@ void CEntityManager::reinit() initialize(_NbMaxEntity); } -CShapeInstanceReference CEntityManager::createInstance(const string& shape, const CVector &pos, const string& text, const string& url, bool haveCollisions, sint32& idx) +CShapeInstanceReference CEntityManager::createInstance(const string& shape, const CVector &pos, const string& text, const string& url, bool haveCollisions, uint16 inIgZone, sint32& idx) { idx = -1; CShapeInstanceReference nullinstref(UInstance(), string(""), string("")); @@ -557,17 +557,42 @@ CShapeInstanceReference CEntityManager::createInstance(const string& shape, cons _ShapeInstances[idx].ContextURL = url; _ShapeInstances[idx].BboxActive = !text.empty() || !url.empty(); _ShapeInstances[idx].Deleted = false; + _ShapeInstances[idx].InIGZone = inIgZone > 0; _LastRemovedInstance = _ShapeInstances[idx].LastDeleted; _ShapeInstances[idx].LastDeleted = -1; + TIGZoneShapes::iterator it = _IgZoneShapes.find(inIgZone); + if (it == _IgZoneShapes.end()) + { + vector shapes; + shapes.push_back(idx); + _IgZoneShapes.insert(make_pair(inIgZone, shapes)); + } + else + { + vector &shapes = (*it).second; + shapes.push_back(idx); + } return _ShapeInstances[idx]; } else { - CShapeInstanceReference instref = CShapeInstanceReference(instance, text, url, !text.empty() || !url.empty()); + CShapeInstanceReference instref = CShapeInstanceReference(instance, text, url, !text.empty() || !url.empty(), inIgZone > 0); instref.Primitive = primitive; idx = _ShapeInstances.size(); _ShapeInstances.push_back(instref); + TIGZoneShapes::iterator it = _IgZoneShapes.find(inIgZone); + if (it == _IgZoneShapes.end()) + { + vector shapes; + shapes.push_back(idx); + _IgZoneShapes.insert(make_pair(inIgZone, shapes)); + } + else + { + vector &shapes = (*it).second; + shapes.push_back(idx); + } return instref; } } @@ -583,9 +608,7 @@ bool CEntityManager::deleteInstance(uint32 idx) Scene->deleteInstance(_ShapeInstances[idx].Instance); UMovePrimitive *primitive = _ShapeInstances[idx].Primitive; if (primitive) - { PACS->removePrimitive(primitive); - } if (!_ShapeInstances[idx].Deleted) { @@ -598,6 +621,22 @@ bool CEntityManager::deleteInstance(uint32 idx) return true; } +void CEntityManager::removeInstancesInIgZone(uint16 igZone) +{ + if (!Scene) + return; + + TIGZoneShapes::iterator it = _IgZoneShapes.find(igZone); + if (it != _IgZoneShapes.end()) + { + vector &shapes = (*it).second; + for (uint i = 0; i < shapes.size(); i++) + deleteInstance(shapes[i]); + _IgZoneShapes.erase(it); + } + +} + CVector CEntityManager::getInstancePos(uint32 idx) { if (!Scene || idx >= _ShapeInstances.size() || _ShapeInstances[idx].Deleted) @@ -758,31 +797,15 @@ CVector CEntityManager::getInstanceBBoxMax(uint32 idx) bool CEntityManager::removeInstances() { if (!Scene) return false; - // Remove all instances. + for(uint i=0; i<_ShapeInstances.size(); ++i) { - if (!_ShapeInstances[i].Instance.empty()) - Scene->deleteInstance(_ShapeInstances[i].Instance); - - UMovePrimitive *primitive = _ShapeInstances[i].Primitive; - if (primitive) - { - PACS->removePrimitive(primitive); - } + if (!_ShapeInstances[i].InIGZone) + deleteInstance(i); } - _ShapeInstances.clear(); - _InstancesRemoved = true; - _LastRemovedInstance = -1; return true; } -bool CEntityManager::instancesRemoved() -{ - bool instRemoved = _InstancesRemoved; - _InstancesRemoved = false; - return instRemoved; -} - bool CEntityManager::setupInstance(uint32 idx, const vector &keys, const vector &values) { if (!Scene || idx >= _ShapeInstances.size() || _ShapeInstances[idx].Deleted) diff --git a/code/ryzom/client/src/entities.h b/code/ryzom/client/src/entities.h index 1151a367d..8372429db 100644 --- a/code/ryzom/client/src/entities.h +++ b/code/ryzom/client/src/entities.h @@ -95,7 +95,7 @@ public: class CShapeInstanceReference { public: - CShapeInstanceReference (NL3D::UInstance instance, const string &text, const string &url, bool bbox_active=true) + CShapeInstanceReference (NL3D::UInstance instance, const string &text, const string &url, bool bbox_active=true, bool in_ig_zone = false) { Instance = instance; ContextText = text; @@ -103,6 +103,7 @@ public: BboxActive = bbox_active; Deleted = false; LastDeleted = -1; + InIGZone = in_ig_zone; Primitive = NULL; PrimSize = CVector(1.f, 1.f, 1.f); PrimHeight = 1.f; @@ -118,6 +119,7 @@ public: string ContextURL; bool BboxActive; bool Deleted; + bool InIGZone; sint32 LastDeleted; }; @@ -143,6 +145,8 @@ private: std::vector _VisibleEntities; /// Shapes Instances caches + typedef std::map> TIGZoneShapes; + TIGZoneShapes _IgZoneShapes; std::vector _ShapeInstances; sint32 _LastRemovedInstance; bool _InstancesRemoved; @@ -226,9 +230,10 @@ public: void reinit(); - CShapeInstanceReference createInstance(const string& shape, const CVector &pos, const string &text, const string &url, bool haveCollisions, sint32 &idx); + CShapeInstanceReference createInstance(const string& shape, const CVector &pos, const string &text, const string &url, bool haveCollisions, uint16 inIgZone, sint32 &idx); bool deleteInstance(uint32 idx); bool removeInstances(); + void removeInstancesInIgZone(uint16 igZone); CVector getInstancePos(uint32 idx); bool setInstancePos(uint32 idx, CVector pos); CVector getInstanceRot(uint32 idx); @@ -239,7 +244,6 @@ public: CVector getInstanceBBoxMin(uint32 idx); CVector getInstanceBBoxMax(uint32 idx); bool setInstanceRot(uint32 idx, CVector pos); - bool instancesRemoved(); bool setupInstance(uint32 idx, const std::vector &keys, const std::vector &values); CShapeInstanceReference getShapeInstanceUnderPos(float x, float y, sint32 &idx); diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 9699e4a9d..d25173982 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -2594,7 +2594,7 @@ class CAHAddShape : public IActionHandler } sint32 idx; - CShapeInstanceReference instref = EntitiesMngr.createInstance(shape, CVector((float)x, (float)y, (float)z), c, u, false, idx); + CShapeInstanceReference instref = EntitiesMngr.createInstance(shape, CVector((float)x, (float)y, (float)z), c, u, false, 0, idx); UInstance instance = instref.Instance; if(!instance.empty()) diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 89f8496a1..c323c324b 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -2071,14 +2071,14 @@ int CLuaIHMRyzom::getIslandId(CLuaState &ls) // *************************************************************************** // -// addShape("shape", .x, .y, .z, "angle", .scale, collision?, "context", "url", highlight?, transparency?, "texture", "skeleton") +// addShape("shape", .x, .y, .z, "angle", .scale, collision?, "context", "url", highlight?, transparency?, "texture", "skeleton", "inIgZone?") // //******** int CLuaIHMRyzom::addShape(CLuaState &ls) { const char* funcName = "addShape"; CLuaIHM::checkArgMin(ls, funcName, 1); - CLuaIHM::checkArgMax(ls, funcName, 13); + CLuaIHM::checkArgMax(ls, funcName, 14); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); sint32 idx = -1; @@ -2098,6 +2098,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) bool highlight = false; bool transparency = false; bool collision = true; + bool inIgZone = false; if (ls.getTop() >= 2) { @@ -2188,7 +2189,13 @@ int CLuaIHMRyzom::addShape(CLuaState &ls) skeleton = ls.toString(13); } - CShapeInstanceReference instref = EntitiesMngr.createInstance(shape, CVector(x, y, z), context, url, collision, idx); + if (ls.getTop() >= 14) + { + CLuaIHM::checkArgType(ls, funcName, 14, LUA_TBOOLEAN); + inIgZone = ls.toBoolean(14); + } + + CShapeInstanceReference instref = EntitiesMngr.createInstance(shape, CVector(x, y, z), context, url, collision, inIgZone, idx); UInstance instance = instref.Instance; if(!instance.empty())