Recast: remove jumpType from off-mesh links

Probably incorrect for MSET 5, null it.
This commit is contained in:
Kawe Mazidjatari 2024-08-08 11:59:24 +02:00
parent 848fbabc79
commit 55c230aab8
10 changed files with 12 additions and 27 deletions

View File

@ -485,7 +485,6 @@ bool Editor_SoloMesh::handleBuild()
params.offMeshConVerts = m_geom->getOffMeshConnectionVerts(); params.offMeshConVerts = m_geom->getOffMeshConnectionVerts();
params.offMeshConRad = m_geom->getOffMeshConnectionRads(); params.offMeshConRad = m_geom->getOffMeshConnectionRads();
params.offMeshConDir = m_geom->getOffMeshConnectionDirs(); params.offMeshConDir = m_geom->getOffMeshConnectionDirs();
params.offMeshConJumps = m_geom->getOffMeshConnectionJumps();
params.offMeshConAreas = m_geom->getOffMeshConnectionAreas(); params.offMeshConAreas = m_geom->getOffMeshConnectionAreas();
params.offMeshConFlags = m_geom->getOffMeshConnectionFlags(); params.offMeshConFlags = m_geom->getOffMeshConnectionFlags();
params.offMeshConUserID = m_geom->getOffMeshConnectionId(); params.offMeshConUserID = m_geom->getOffMeshConnectionId();

View File

@ -201,7 +201,6 @@ struct MeshProcess : public dtTileCacheMeshProcess
params->offMeshConVerts = m_geom->getOffMeshConnectionVerts(); params->offMeshConVerts = m_geom->getOffMeshConnectionVerts();
params->offMeshConRad = m_geom->getOffMeshConnectionRads(); params->offMeshConRad = m_geom->getOffMeshConnectionRads();
params->offMeshConDir = m_geom->getOffMeshConnectionDirs(); params->offMeshConDir = m_geom->getOffMeshConnectionDirs();
params->offMeshConJumps = m_geom->getOffMeshConnectionJumps();
params->offMeshConAreas = m_geom->getOffMeshConnectionAreas(); params->offMeshConAreas = m_geom->getOffMeshConnectionAreas();
params->offMeshConFlags = m_geom->getOffMeshConnectionFlags(); params->offMeshConFlags = m_geom->getOffMeshConnectionFlags();
params->offMeshConUserID = m_geom->getOffMeshConnectionId(); params->offMeshConUserID = m_geom->getOffMeshConnectionId();

View File

@ -1022,7 +1022,6 @@ unsigned char* Editor_TileMesh::buildTileMesh(const int tx, const int ty, const
params.offMeshConVerts = m_geom->getOffMeshConnectionVerts(); params.offMeshConVerts = m_geom->getOffMeshConnectionVerts();
params.offMeshConRad = m_geom->getOffMeshConnectionRads(); params.offMeshConRad = m_geom->getOffMeshConnectionRads();
params.offMeshConDir = m_geom->getOffMeshConnectionDirs(); params.offMeshConDir = m_geom->getOffMeshConnectionDirs();
params.offMeshConJumps = m_geom->getOffMeshConnectionJumps();
params.offMeshConAreas = m_geom->getOffMeshConnectionAreas(); params.offMeshConAreas = m_geom->getOffMeshConnectionAreas();
params.offMeshConFlags = m_geom->getOffMeshConnectionFlags(); params.offMeshConFlags = m_geom->getOffMeshConnectionFlags();
params.offMeshConUserID = m_geom->getOffMeshConnectionId(); params.offMeshConUserID = m_geom->getOffMeshConnectionId();

View File

@ -284,17 +284,16 @@ bool InputGeom::loadGeomSet(rcContext* ctx, const std::string& filepath)
float* refs = &m_offMeshConRefPos[m_offMeshConCount*3]; float* refs = &m_offMeshConRefPos[m_offMeshConCount*3];
float rad; float rad;
float yaw; float yaw;
int bidir, area = 0, jump = 0, flags = 0; int bidir, area = 0, flags = 0;
sscanf(row+1, "%f %f %f %f %f %f %f %d %d %d %d %f %f %f %f", sscanf(row+1, "%f %f %f %f %f %f %f %d %d %d %f %f %f %f",
&verts[0], &verts[1], &verts[2], &verts[0], &verts[1], &verts[2],
&verts[3], &verts[4], &verts[5], &verts[3], &verts[4], &verts[5],
&rad, &rad,
&bidir, &jump, &area, &flags, &bidir, &area, &flags,
&refs[0], &refs[1], &refs[2], &refs[0], &refs[1], &refs[2],
&yaw); &yaw);
m_offMeshConRads[m_offMeshConCount] = rad; m_offMeshConRads[m_offMeshConCount] = rad;
m_offMeshConDirs[m_offMeshConCount] = (unsigned char)bidir; m_offMeshConDirs[m_offMeshConCount] = (unsigned char)bidir;
m_offMeshConJumps[m_offMeshConCount] = (unsigned char)jump;
m_offMeshConAreas[m_offMeshConCount] = (unsigned char)area; m_offMeshConAreas[m_offMeshConCount] = (unsigned char)area;
m_offMeshConFlags[m_offMeshConCount] = (unsigned short)flags; m_offMeshConFlags[m_offMeshConCount] = (unsigned short)flags;
m_offMeshConRefYaws[m_offMeshConCount] = yaw; m_offMeshConRefYaws[m_offMeshConCount] = yaw;
@ -431,14 +430,13 @@ bool InputGeom::saveGeomSet(const BuildSettings* settings)
const float rad = m_offMeshConRads[i]; const float rad = m_offMeshConRads[i];
const float yaw = m_offMeshConRefYaws[i]; const float yaw = m_offMeshConRefYaws[i];
const int bidir = m_offMeshConDirs[i]; const int bidir = m_offMeshConDirs[i];
const int jump = m_offMeshConJumps[i];
const int area = m_offMeshConAreas[i]; const int area = m_offMeshConAreas[i];
const int flags = m_offMeshConFlags[i]; const int flags = m_offMeshConFlags[i];
fprintf(fp, "c %f %f %f %f %f %f %f %d %d %d %d %f %f %f %f\n", fprintf(fp, "c %f %f %f %f %f %f %f %d %d %d %f %f %f %f\n",
verts[0], verts[1], verts[2], verts[0], verts[1], verts[2],
verts[3], verts[4], verts[5], verts[3], verts[4], verts[5],
rad, rad,
bidir, jump, area, flags, bidir, area, flags,
refs[0], refs[1], refs[2], refs[0], refs[1], refs[2],
yaw); yaw);
} }
@ -537,7 +535,7 @@ bool InputGeom::raycastMesh(float* src, float* dst, float& tmin)
} }
void InputGeom::addOffMeshConnection(const float* spos, const float* epos, const float rad, void InputGeom::addOffMeshConnection(const float* spos, const float* epos, const float rad,
unsigned char bidir, unsigned char jump, unsigned char area, unsigned short flags) unsigned char bidir, unsigned char area, unsigned short flags)
{ {
if (m_offMeshConCount >= MAX_OFFMESH_CONNECTIONS) return; if (m_offMeshConCount >= MAX_OFFMESH_CONNECTIONS) return;
float* refs = &m_offMeshConRefPos[m_offMeshConCount*3]; float* refs = &m_offMeshConRefPos[m_offMeshConCount*3];
@ -549,7 +547,6 @@ void InputGeom::addOffMeshConnection(const float* spos, const float* epos, const
m_offMeshConRads[m_offMeshConCount] = rad; m_offMeshConRads[m_offMeshConCount] = rad;
m_offMeshConRefYaws[m_offMeshConCount] = yaw; m_offMeshConRefYaws[m_offMeshConCount] = yaw;
m_offMeshConDirs[m_offMeshConCount] = bidir; m_offMeshConDirs[m_offMeshConCount] = bidir;
m_offMeshConJumps[m_offMeshConCount] = jump;
m_offMeshConAreas[m_offMeshConCount] = area; m_offMeshConAreas[m_offMeshConCount] = area;
m_offMeshConFlags[m_offMeshConCount] = flags; m_offMeshConFlags[m_offMeshConCount] = flags;
m_offMeshConId[m_offMeshConCount] = 1000 + m_offMeshConCount; m_offMeshConId[m_offMeshConCount] = 1000 + m_offMeshConCount;
@ -571,7 +568,6 @@ void InputGeom::deleteOffMeshConnection(int i)
m_offMeshConRads[i] = m_offMeshConRads[m_offMeshConCount]; m_offMeshConRads[i] = m_offMeshConRads[m_offMeshConCount];
m_offMeshConRefYaws[i] = m_offMeshConRefYaws[m_offMeshConCount]; m_offMeshConRefYaws[i] = m_offMeshConRefYaws[m_offMeshConCount];
m_offMeshConDirs[i] = m_offMeshConDirs[m_offMeshConCount]; m_offMeshConDirs[i] = m_offMeshConDirs[m_offMeshConCount];
m_offMeshConJumps[i] = m_offMeshConJumps[m_offMeshConCount];
m_offMeshConAreas[i] = m_offMeshConAreas[m_offMeshConCount]; m_offMeshConAreas[i] = m_offMeshConAreas[m_offMeshConCount];
m_offMeshConFlags[i] = m_offMeshConFlags[m_offMeshConCount]; m_offMeshConFlags[i] = m_offMeshConFlags[m_offMeshConCount];
} }

View File

@ -31,9 +31,9 @@ OffMeshConnectionTool::OffMeshConnectionTool() :
m_editor(0), m_editor(0),
m_hitPosSet(0), m_hitPosSet(0),
m_bidir(true), m_bidir(true),
m_jumpType(0),
m_oldFlags(0) m_oldFlags(0)
{ {
rdVset(m_hitPos, 0.0f,0.0f,0.0f);
} }
OffMeshConnectionTool::~OffMeshConnectionTool() OffMeshConnectionTool::~OffMeshConnectionTool()
@ -70,10 +70,6 @@ void OffMeshConnectionTool::handleMenu()
if (ImGui::Checkbox("Bidirectional", &isBiDirectional)) if (ImGui::Checkbox("Bidirectional", &isBiDirectional))
m_bidir = true; m_bidir = true;
ImGui::PushItemWidth(140);
ImGui::SliderInt("Jump Type", &m_jumpType, 0, 31);
ImGui::PopItemWidth();
} }
void OffMeshConnectionTool::handleClick(const float* /*s*/, const float* p, bool shift) void OffMeshConnectionTool::handleClick(const float* /*s*/, const float* p, bool shift)
@ -118,7 +114,7 @@ void OffMeshConnectionTool::handleClick(const float* /*s*/, const float* p, bool
{ {
const unsigned char area = EDITOR_POLYAREA_JUMP; const unsigned char area = EDITOR_POLYAREA_JUMP;
const unsigned short flags = EDITOR_POLYFLAGS_WALK; const unsigned short flags = EDITOR_POLYFLAGS_WALK;
geom->addOffMeshConnection(m_hitPos, p, m_editor->getAgentRadius(), m_bidir ? 1 : 0, (unsigned char)m_jumpType, area, flags); geom->addOffMeshConnection(m_hitPos, p, m_editor->getAgentRadius(), m_bidir ? 1 : 0, area, flags);
m_hitPosSet = false; m_hitPosSet = false;
} }
} }

View File

@ -45,6 +45,7 @@ enum EditorToolType
TOOL_NAVMESH_TESTER, TOOL_NAVMESH_TESTER,
TOOL_NAVMESH_PRUNE, TOOL_NAVMESH_PRUNE,
TOOL_OFFMESH_CONNECTION, TOOL_OFFMESH_CONNECTION,
TOOL_TRAVERSE_LINK,
TOOL_CONVEX_VOLUME, TOOL_CONVEX_VOLUME,
TOOL_CROWD, TOOL_CROWD,
MAX_TOOLS MAX_TOOLS

View File

@ -89,7 +89,6 @@ class InputGeom
float m_offMeshConVerts[MAX_OFFMESH_CONNECTIONS*3*2]; float m_offMeshConVerts[MAX_OFFMESH_CONNECTIONS*3*2];
float m_offMeshConRads[MAX_OFFMESH_CONNECTIONS]; float m_offMeshConRads[MAX_OFFMESH_CONNECTIONS];
unsigned char m_offMeshConDirs[MAX_OFFMESH_CONNECTIONS]; unsigned char m_offMeshConDirs[MAX_OFFMESH_CONNECTIONS];
unsigned char m_offMeshConJumps[MAX_OFFMESH_CONNECTIONS];
unsigned char m_offMeshConAreas[MAX_OFFMESH_CONNECTIONS]; unsigned char m_offMeshConAreas[MAX_OFFMESH_CONNECTIONS];
unsigned short m_offMeshConFlags[MAX_OFFMESH_CONNECTIONS]; unsigned short m_offMeshConFlags[MAX_OFFMESH_CONNECTIONS];
unsigned short m_offMeshConId[MAX_OFFMESH_CONNECTIONS]; unsigned short m_offMeshConId[MAX_OFFMESH_CONNECTIONS];
@ -140,14 +139,13 @@ public:
const float* getOffMeshConnectionVerts() const { return m_offMeshConVerts; } const float* getOffMeshConnectionVerts() const { return m_offMeshConVerts; }
const float* getOffMeshConnectionRads() const { return m_offMeshConRads; } const float* getOffMeshConnectionRads() const { return m_offMeshConRads; }
const unsigned char* getOffMeshConnectionDirs() const { return m_offMeshConDirs; } const unsigned char* getOffMeshConnectionDirs() const { return m_offMeshConDirs; }
const unsigned char* getOffMeshConnectionJumps() const { return m_offMeshConJumps; }
const unsigned char* getOffMeshConnectionAreas() const { return m_offMeshConAreas; } const unsigned char* getOffMeshConnectionAreas() const { return m_offMeshConAreas; }
const unsigned short* getOffMeshConnectionFlags() const { return m_offMeshConFlags; } const unsigned short* getOffMeshConnectionFlags() const { return m_offMeshConFlags; }
const unsigned short* getOffMeshConnectionId() const { return m_offMeshConId; } const unsigned short* getOffMeshConnectionId() const { return m_offMeshConId; }
const float* getOffMeshConnectionRefPos() const { return m_offMeshConRefPos; } const float* getOffMeshConnectionRefPos() const { return m_offMeshConRefPos; }
const float* getOffMeshConnectionRefYaws() const { return m_offMeshConRefYaws; } const float* getOffMeshConnectionRefYaws() const { return m_offMeshConRefYaws; }
void addOffMeshConnection(const float* spos, const float* epos, const float rad, void addOffMeshConnection(const float* spos, const float* epos, const float rad,
unsigned char bidir, unsigned char jump, unsigned char area, unsigned short flags); unsigned char bidir, unsigned char area, unsigned short flags);
void deleteOffMeshConnection(int i); void deleteOffMeshConnection(int i);
void drawOffMeshConnections(struct duDebugDraw* dd, const float* offset, bool hilight = false); void drawOffMeshConnections(struct duDebugDraw* dd, const float* offset, bool hilight = false);
///@} ///@}

View File

@ -29,7 +29,6 @@ class OffMeshConnectionTool : public EditorTool
float m_hitPos[3]; float m_hitPos[3];
bool m_hitPosSet; bool m_hitPosSet;
bool m_bidir; bool m_bidir;
int m_jumpType;
unsigned int m_oldFlags; unsigned int m_oldFlags;
public: public:

View File

@ -71,8 +71,6 @@ struct dtNavMeshCreateParams
/// 0 = Travel only from endpoint A to endpoint B.<br/> /// 0 = Travel only from endpoint A to endpoint B.<br/>
/// #DT_OFFMESH_CON_BIDIR = Bidirectional travel. /// #DT_OFFMESH_CON_BIDIR = Bidirectional travel.
const unsigned char* offMeshConDir; const unsigned char* offMeshConDir;
/// The user defined jump type of the off-mesh connection. [Size: #offMeshConCount]
const unsigned char* offMeshConJumps;
/// The user defined ids of the off-mesh connection. [Size: #offMeshConCount] /// The user defined ids of the off-mesh connection. [Size: #offMeshConCount]
const unsigned short* offMeshConUserID; const unsigned short* offMeshConUserID;
/// Off-mesh connection reference positions. [(x, y, z) * #offMeshConCount] [Unit: wu] /// Off-mesh connection reference positions. [(x, y, z) * #offMeshConCount] [Unit: wu]

View File

@ -1030,8 +1030,8 @@ bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData,
con->flags = params->offMeshConDir[i] ? DT_OFFMESH_CON_BIDIR : 0; con->flags = params->offMeshConDir[i] ? DT_OFFMESH_CON_BIDIR : 0;
con->side = offMeshConClass[i*2+1]; con->side = offMeshConClass[i*2+1];
#if DT_NAVMESH_SET_VERSION == 5 #if DT_NAVMESH_SET_VERSION == 5
con->jumpType = params->offMeshConJumps[i]; con->jumpType = 0; // unknown
con->unk1 = 1; con->unk1 = 1; // unknown
#endif #endif
con->userId = params->offMeshConUserID[i]; con->userId = params->offMeshConUserID[i];
#if DT_NAVMESH_SET_VERSION >= 7 #if DT_NAVMESH_SET_VERSION >= 7