mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-22 14:56:13 +00:00
Fixed: Removing some nlinfo and correction getMouseRightDown
This commit is contained in:
parent
2a7615b2f4
commit
448da5375d
5 changed files with 40 additions and 42 deletions
|
@ -2011,7 +2011,6 @@ namespace NLGUI
|
||||||
it = styles.find("background-image");
|
it = styles.find("background-image");
|
||||||
if (it != styles.end())
|
if (it != styles.end())
|
||||||
{
|
{
|
||||||
nlinfo("found background-image %s", it->second.c_str());
|
|
||||||
string image = (*it).second;
|
string image = (*it).second;
|
||||||
string::size_type texExt = toLower(image).find("url(");
|
string::size_type texExt = toLower(image).find("url(");
|
||||||
// Url image
|
// Url image
|
||||||
|
|
|
@ -1046,7 +1046,7 @@ void CClientConfig::setValues()
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// NEW PATCHING SYSTEM //
|
// NEW PATCHING SYSTEM //
|
||||||
READ_BOOL_DEV(PatchWanted)
|
READ_BOOL_FV(PatchWanted)
|
||||||
|
|
||||||
#ifdef RZ_USE_CUSTOM_PATCH_SERVER
|
#ifdef RZ_USE_CUSTOM_PATCH_SERVER
|
||||||
READ_STRING_FV(PatchUrl)
|
READ_STRING_FV(PatchUrl)
|
||||||
|
|
|
@ -548,7 +548,6 @@ CShapeInstanceReference CEntityManager::createInstance(const string& shape, cons
|
||||||
if (_LastRemovedInstance != -1)
|
if (_LastRemovedInstance != -1)
|
||||||
{
|
{
|
||||||
idx = _LastRemovedInstance;
|
idx = _LastRemovedInstance;
|
||||||
nlinfo("OK adding to index : %d", idx);
|
|
||||||
_ShapeInstances[idx].Instance = instance;
|
_ShapeInstances[idx].Instance = instance;
|
||||||
_ShapeInstances[idx].Primitive = primitive;
|
_ShapeInstances[idx].Primitive = primitive;
|
||||||
_ShapeInstances[idx].ContextText = text;
|
_ShapeInstances[idx].ContextText = text;
|
||||||
|
@ -562,7 +561,6 @@ CShapeInstanceReference CEntityManager::createInstance(const string& shape, cons
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nlinfo("OK url, text = %s, %s", url.c_str(), text.c_str());
|
|
||||||
CShapeInstanceReference instref = CShapeInstanceReference(instance, text, url, !text.empty() || !url.empty());
|
CShapeInstanceReference instref = CShapeInstanceReference(instance, text, url, !text.empty() || !url.empty());
|
||||||
instref.Primitive = primitive;
|
instref.Primitive = primitive;
|
||||||
idx = _ShapeInstances.size();
|
idx = _ShapeInstances.size();
|
||||||
|
@ -585,11 +583,15 @@ bool CEntityManager::deleteInstance(uint32 idx)
|
||||||
{
|
{
|
||||||
PACS->removePrimitive(primitive);
|
PACS->removePrimitive(primitive);
|
||||||
}
|
}
|
||||||
_ShapeInstances[idx].Primitive = NULL;
|
|
||||||
_ShapeInstances[idx].Deleted = true;
|
if (!_ShapeInstances[idx].Deleted)
|
||||||
_ShapeInstances[idx].LastDeleted = _LastRemovedInstance;
|
{
|
||||||
_LastRemovedInstance = idx;
|
_ShapeInstances[idx].Primitive = NULL;
|
||||||
|
_ShapeInstances[idx].Deleted = true;
|
||||||
|
_ShapeInstances[idx].LastDeleted = _LastRemovedInstance;
|
||||||
|
_LastRemovedInstance = idx;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,8 +743,6 @@ bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const
|
||||||
|
|
||||||
for (uint32 i=0; i < keys.size(); i++)
|
for (uint32 i=0; i < keys.size(); i++)
|
||||||
{
|
{
|
||||||
nlinfo("Setup [%s] with [%s]", keys[i].c_str(), values[i].c_str());
|
|
||||||
|
|
||||||
string param = keys[i];
|
string param = keys[i];
|
||||||
if (param == "transparency")
|
if (param == "transparency")
|
||||||
{
|
{
|
||||||
|
@ -915,15 +915,23 @@ CShapeInstanceReference CEntityManager::getShapeInstanceUnderPos(float x, float
|
||||||
//= _ShapeInstances[i].SelectionBox;
|
//= _ShapeInstances[i].SelectionBox;
|
||||||
if(!_ShapeInstances[i].Instance.empty()) {
|
if(!_ShapeInstances[i].Instance.empty()) {
|
||||||
_ShapeInstances[i].Instance.getShapeAABBox(bbox);
|
_ShapeInstances[i].Instance.getShapeAABBox(bbox);
|
||||||
|
CVector bbox_min;
|
||||||
|
CVector bbox_max;
|
||||||
|
|
||||||
if (bbox.getCenter() == CVector::Null)
|
if (bbox.getCenter() == CVector::Null)
|
||||||
{
|
{
|
||||||
bbox.setMinMax(CVector(-0.3f, -0.3f, -0.3f)+_ShapeInstances[i].Instance.getPos(), CVector(0.3f, 0.3f, 0.3f)+_ShapeInstances[i].Instance.getPos());
|
bbox_min = CVector(-0.5f, -0.5f, -0.5f);
|
||||||
|
bbox_max = CVector(-0.5f, -0.5f, -0.5f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bbox.setMinMax((bbox.getMin()*_ShapeInstances[i].Instance.getScale().x)+_ShapeInstances[i].Instance.getPos(), (bbox.getMax()*_ShapeInstances[i].Instance.getScale().x)+_ShapeInstances[i].Instance.getPos());
|
bbox_min = bbox.getMin();
|
||||||
|
bbox_max = bbox.getMax();
|
||||||
}
|
}
|
||||||
if(bbox.intersect(pos, pos+dir*50.0f))
|
|
||||||
|
bbox.setMinMax((bbox_min*_ShapeInstances[i].Instance.getScale().x)+_ShapeInstances[i].Instance.getPos(), (bbox_max*_ShapeInstances[i].Instance.getScale().x)+_ShapeInstances[i].Instance.getPos());
|
||||||
|
|
||||||
|
if(bbox.intersect(pos, pos+dir*100.0f))
|
||||||
{
|
{
|
||||||
float dist = (bbox.getCenter()-pos).norm();
|
float dist = (bbox.getCenter()-pos).norm();
|
||||||
if (dist < bestDist)
|
if (dist < bestDist)
|
||||||
|
|
|
@ -1204,8 +1204,20 @@ int CLuaIHMRyzom::getShapeIdAt(CLuaState &ls)
|
||||||
|
|
||||||
uint32 x = (uint32)ls.toInteger(1);
|
uint32 x = (uint32)ls.toInteger(1);
|
||||||
uint32 y = (uint32)ls.toInteger(2);
|
uint32 y = (uint32)ls.toInteger(2);
|
||||||
|
|
||||||
|
uint32 w, h;
|
||||||
|
CViewRenderer &viewRender = *CViewRenderer::getInstance();
|
||||||
|
viewRender.getScreenSize(w, h);
|
||||||
|
if(x >= w || y >= h) {
|
||||||
|
ls.push(-1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float cursX = (float)x/(float)w;
|
||||||
|
float cursY = (float)y/(float)h;
|
||||||
|
|
||||||
sint32 instance_idx;
|
sint32 instance_idx;
|
||||||
EntitiesMngr.getShapeInstanceUnderPos(x, y, instance_idx);
|
EntitiesMngr.getShapeInstanceUnderPos(cursX, cursY, instance_idx);
|
||||||
ls.push(instance_idx);
|
ls.push(instance_idx);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2177,7 +2189,6 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
|
||||||
UMovePrimitive *primitive = instref.Primitive;
|
UMovePrimitive *primitive = instref.Primitive;
|
||||||
if (primitive)
|
if (primitive)
|
||||||
{
|
{
|
||||||
nlinfo("ok");
|
|
||||||
NLMISC::CAABBox bbox;
|
NLMISC::CAABBox bbox;
|
||||||
instance.getShapeAABBox(bbox);
|
instance.getShapeAABBox(bbox);
|
||||||
|
|
||||||
|
@ -2188,11 +2199,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
|
||||||
primitive->setPrimitiveType(UMovePrimitive::_2DOrientedBox);
|
primitive->setPrimitiveType(UMovePrimitive::_2DOrientedBox);
|
||||||
primitive->setSize((bbox.getMax().x - bbox.getMin().x)*scale, (bbox.getMax().y - bbox.getMin().y)*scale);
|
primitive->setSize((bbox.getMax().x - bbox.getMin().x)*scale, (bbox.getMax().y - bbox.getMin().y)*scale);
|
||||||
primitive->setHeight((bbox.getMax().z - bbox.getMin().z)*scale);
|
primitive->setHeight((bbox.getMax().z - bbox.getMin().z)*scale);
|
||||||
//primitive->setSize(9.0f, 9.0f);
|
|
||||||
//primitive->setHeight(12.0f);
|
|
||||||
|
|
||||||
nlinfo("%f, %f, %f", (bbox.getMax().x - bbox.getMin().x)*scale, (bbox.getMax().y - bbox.getMin().y)*scale, (bbox.getMax().z - bbox.getMin().z)*scale );
|
|
||||||
|
|
||||||
primitive->setCollisionMask(MaskColPlayer | MaskColNpc | MaskColDoor);
|
primitive->setCollisionMask(MaskColPlayer | MaskColNpc | MaskColDoor);
|
||||||
primitive->setOcclusionMask(MaskColPlayer | MaskColNpc | MaskColDoor);
|
primitive->setOcclusionMask(MaskColPlayer | MaskColNpc | MaskColDoor);
|
||||||
primitive->setObstacle(true);
|
primitive->setObstacle(true);
|
||||||
|
|
|
@ -202,7 +202,7 @@ void CTool::getMouseRightDown(bool &down, sint32 &x, sint32 &y)
|
||||||
x = y = -1;
|
x = y = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
down = cursor->getPointerMiddleDown(x, y);
|
down = cursor->getPointerRightDown(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -372,7 +372,6 @@ bool CTool::raytrace(const NLMISC::CVector &segmentStart, const NLMISC::CVector
|
||||||
{
|
{
|
||||||
if (Landscape)
|
if (Landscape)
|
||||||
{
|
{
|
||||||
nlinfo("landscape=%d,%d", segmentStart.x, segmentStart.y);
|
|
||||||
// use a shortest distance for collision manager (for speed)
|
// use a shortest distance for collision manager (for speed)
|
||||||
CVector segmentEnd = segmentStart + 100.f * dir;
|
CVector segmentEnd = segmentStart + 100.f * dir;
|
||||||
float dist = Landscape->getRayCollision(segmentStart, segmentEnd);
|
float dist = Landscape->getRayCollision(segmentStart, segmentEnd);
|
||||||
|
@ -485,27 +484,19 @@ bool CTool::computeNearestValidSurfaceFromHeightMap(float x, float y, NLMISC::CV
|
||||||
|
|
||||||
const CScenarioEntryPoints::CCompleteIsland *islandDesc = getEditor().getIslandCollision().getCurrIslandDesc();
|
const CScenarioEntryPoints::CCompleteIsland *islandDesc = getEditor().getIslandCollision().getCurrIslandDesc();
|
||||||
if (!islandDesc) return false;
|
if (!islandDesc) return false;
|
||||||
|
|
||||||
nlinfo("have island");
|
|
||||||
|
|
||||||
sint mapX = (sint) (x - islandDesc->XMin);
|
sint mapX = (sint) (x - islandDesc->XMin);
|
||||||
sint mapY = (sint) (y - islandDesc->YMin);
|
sint mapY = (sint) (y - islandDesc->YMin);
|
||||||
|
|
||||||
nlinfo("mapX,mapY=%d,%d island=%d,%d-%d,%d", mapX, mapY, islandDesc->XMin, islandDesc->YMin, islandDesc->XMax, islandDesc->YMax);
|
|
||||||
if (mapX < 0 || mapY < 0 || mapX >= (islandDesc->XMax - islandDesc->XMin) || mapY >= (islandDesc->YMax - islandDesc->YMin)) return false;
|
if (mapX < 0 || mapY < 0 || mapX >= (islandDesc->XMax - islandDesc->XMin) || mapY >= (islandDesc->YMax - islandDesc->YMin)) return false;
|
||||||
sint hmZ = heightMap(mapX, mapY);
|
sint hmZ = heightMap(mapX, mapY);
|
||||||
nlinfo("HeightMap = %d", hmZ);
|
|
||||||
if (hmZ >= 0x7ffe) return false; // not an accessible pos
|
if (hmZ >= 0x7ffe) return false; // not an accessible pos
|
||||||
|
|
||||||
nlinfo("accessible pos");
|
|
||||||
|
|
||||||
if (!isIslandValidPos(heightMap, *islandDesc, x + 0.5f, y) ||
|
if (!isIslandValidPos(heightMap, *islandDesc, x + 0.5f, y) ||
|
||||||
!isIslandValidPos(heightMap, *islandDesc, x - 0.5f, y) ||
|
!isIslandValidPos(heightMap, *islandDesc, x - 0.5f, y) ||
|
||||||
!isIslandValidPos(heightMap, *islandDesc, x, y + 0.5f) ||
|
!isIslandValidPos(heightMap, *islandDesc, x, y + 0.5f) ||
|
||||||
!isIslandValidPos(heightMap, *islandDesc, x, y - 0.5f)) return false;
|
!isIslandValidPos(heightMap, *islandDesc, x, y - 0.5f)) return false;
|
||||||
|
|
||||||
nlinfo("valid pos");
|
|
||||||
|
|
||||||
float z = 1.f + 2.f * hmZ;
|
float z = 1.f + 2.f * hmZ;
|
||||||
// this is a possibly valid position
|
// this is a possibly valid position
|
||||||
// compute nearest surface from here, and see if not far from the intersection
|
// compute nearest surface from here, and see if not far from the intersection
|
||||||
|
@ -524,9 +515,7 @@ bool CTool::computeNearestValidSurfaceFromHeightMap(float x, float y, NLMISC::CV
|
||||||
inter1Found = inter1Found && normal1.z >= minAngleSin;
|
inter1Found = inter1Found && normal1.z >= minAngleSin;
|
||||||
inter2Found = inter2Found && normal2.z >= minAngleSin;
|
inter2Found = inter2Found && normal2.z >= minAngleSin;
|
||||||
if (!inter1Found && !inter2Found) return false;
|
if (!inter1Found && !inter2Found) return false;
|
||||||
|
|
||||||
nlinfo("inter foud");
|
|
||||||
|
|
||||||
if (inter1Found && inter2Found)
|
if (inter1Found && inter2Found)
|
||||||
{
|
{
|
||||||
// because z in heightmap in usually a 'ceil' of real height, tends to favor surface below
|
// because z in heightmap in usually a 'ceil' of real height, tends to favor surface below
|
||||||
|
@ -543,7 +532,6 @@ bool CTool::computeNearestValidSurfaceFromHeightMap(float x, float y, NLMISC::CV
|
||||||
{
|
{
|
||||||
inter = inter2;
|
inter = inter2;
|
||||||
}
|
}
|
||||||
nlinfo("inter = %d,%d", inter.x, inter.y);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +561,6 @@ CTool::TRayIntersectionType CTool::computeLandscapeRayIntersection(const CWorldV
|
||||||
{
|
{
|
||||||
CVector delta = bias * (cardinals[k].x * worldViewRay.Right + cardinals[k].y * worldViewRay.Up);
|
CVector delta = bias * (cardinals[k].x * worldViewRay.Right + cardinals[k].y * worldViewRay.Up);
|
||||||
found = raytrace(worldViewRay.Origin + delta, worldViewRay.Dir, inter);
|
found = raytrace(worldViewRay.Origin + delta, worldViewRay.Dir, inter);
|
||||||
nlinfo("found");
|
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
|
@ -585,12 +572,10 @@ CTool::TRayIntersectionType CTool::computeLandscapeRayIntersection(const CWorldV
|
||||||
const CArray2D<sint16> &heightMap = getEditor().getIslandCollision().getHeightMap();
|
const CArray2D<sint16> &heightMap = getEditor().getIslandCollision().getHeightMap();
|
||||||
if (!heightMap.empty())
|
if (!heightMap.empty())
|
||||||
{
|
{
|
||||||
nlinfo("okidoi : %d, %d", inter.x, inter.y);
|
|
||||||
// if heightmap is present, use it because it gives us more reliable information
|
// if heightmap is present, use it because it gives us more reliable information
|
||||||
CVector surfPos;
|
CVector surfPos;
|
||||||
if (!computeNearestValidSurfaceFromHeightMap(inter.x, inter.y, surfPos)) return InvalidPacsPos;
|
if (!computeNearestValidSurfaceFromHeightMap(inter.x, inter.y, surfPos)) return InvalidPacsPos;
|
||||||
static volatile float threshold = 2.f;
|
static volatile float threshold = 2.f;
|
||||||
nlinfo("found");
|
|
||||||
return (inter - surfPos).norm() < threshold ? ValidPacsPos : InvalidPacsPos;
|
return (inter - surfPos).norm() < threshold ? ValidPacsPos : InvalidPacsPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +586,6 @@ CTool::TRayIntersectionType CTool::computeLandscapeRayIntersection(const CWorldV
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nlinfo("GR");
|
|
||||||
// see if pacs collisions are ok at that pos
|
// see if pacs collisions are ok at that pos
|
||||||
NLPACS::UGlobalPosition dummyPos;
|
NLPACS::UGlobalPosition dummyPos;
|
||||||
return getPacsType(inter, 2.f, dummyPos);
|
return getPacsType(inter, 2.f, dummyPos);
|
||||||
|
|
Loading…
Reference in a new issue