From 6a57cea9efe640d2ae759f3403f51b52cab89b29 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 30 Jun 2024 18:36:51 +0200 Subject: [PATCH] Recast: save off-mesh connection reference positions and yaws to geometry sets Allow storing and loading of additional off-mesh connection data (newly added for titanfall and apex). --- src/naveditor/InputGeom.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/naveditor/InputGeom.cpp b/src/naveditor/InputGeom.cpp index 3be34925..62e210e7 100644 --- a/src/naveditor/InputGeom.cpp +++ b/src/naveditor/InputGeom.cpp @@ -273,15 +273,23 @@ bool InputGeom::loadGeomSet(rcContext* ctx, const std::string& filepath) // Off-mesh connection if (m_offMeshConCount < MAX_OFFMESH_CONNECTIONS) { - float* v = &m_offMeshConVerts[m_offMeshConCount*3*2]; - int bidir, area = 0, flags = 0; + float* verts = &m_offMeshConVerts[m_offMeshConCount*3*2]; + float* refs = &m_offMeshConRefPos[m_offMeshConCount*3]; float rad; - sscanf(row+1, "%f %f %f %f %f %f %f %d %d %d", - &v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &rad, &bidir, &area, &flags); + float yaw; + int bidir, area = 0, flags = 0; + sscanf(row+1, "%f %f %f %f %f %f %f %d %d %d %f %f %f %f", + &verts[0], &verts[1], &verts[2], + &verts[3], &verts[4], &verts[5], + &rad, + &bidir, &area, &flags, + &refs[0], &refs[1], &refs[2], + &yaw); m_offMeshConRads[m_offMeshConCount] = rad; m_offMeshConDirs[m_offMeshConCount] = (unsigned char)bidir; m_offMeshConAreas[m_offMeshConCount] = (unsigned char)area; m_offMeshConFlags[m_offMeshConCount] = (unsigned short)flags; + m_offMeshConRefYaws[m_offMeshConCount] = yaw; m_offMeshConCount++; } } @@ -403,13 +411,20 @@ bool InputGeom::saveGeomSet(const BuildSettings* settings) // Store off-mesh links. for (int i = 0; i < m_offMeshConCount; ++i) { - const float* v = &m_offMeshConVerts[i*3*2]; + const float* verts = &m_offMeshConVerts[i*3*2]; + const float* refs = &m_offMeshConRefPos[i*3]; const float rad = m_offMeshConRads[i]; + const float yaw = m_offMeshConRefYaws[i]; const int bidir = m_offMeshConDirs[i]; const int area = m_offMeshConAreas[i]; const int flags = m_offMeshConFlags[i]; - fprintf(fp, "c %f %f %f %f %f %f %f %d %d %d\n", - v[0], v[1], v[2], v[3], v[4], v[5], rad, bidir, area, flags); + 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[3], verts[4], verts[5], + rad, + bidir, area, flags, + refs[0], refs[1], refs[2], + yaw); } // Convex volumes