diff --git a/src/naveditor/ConvexVolumeTool.cpp b/src/naveditor/ConvexVolumeTool.cpp index d3bfba7c..47faf97f 100644 --- a/src/naveditor/ConvexVolumeTool.cpp +++ b/src/naveditor/ConvexVolumeTool.cpp @@ -131,9 +131,9 @@ void ConvexVolumeTool::handleMenu() if (ImGui::Checkbox("Clip", &isEnabled)) m_areaType = RC_NULL_AREA; - isEnabled = m_areaType == EDITOR_POLYAREA_DOOR; + isEnabled = m_areaType == EDITOR_POLYAREA_TRIGGER; if (ImGui::Checkbox("Trigger", &isEnabled)) - m_areaType = EDITOR_POLYAREA_DOOR; + m_areaType = EDITOR_POLYAREA_TRIGGER; // todo(amos): also allow setting flags and store this in .gset. ImGui::Unindent(); diff --git a/src/naveditor/Editor.cpp b/src/naveditor/Editor.cpp index 3126b8f3..2ce5fd3a 100644 --- a/src/naveditor/Editor.cpp +++ b/src/naveditor/Editor.cpp @@ -42,7 +42,7 @@ unsigned int EditorDebugDraw::areaToCol(unsigned int area) // Jump : purple case EDITOR_POLYAREA_JUMP: return duRGBA(255, 0, 255, 255); // Trigger : light green - case EDITOR_POLYAREA_DOOR: return duRGBA(20, 245, 0, 255); + case EDITOR_POLYAREA_TRIGGER: return duRGBA(20, 245, 0, 255); // Unexpected : white default: return duRGBA(255, 255, 255, 255); } diff --git a/src/naveditor/Editor_SoloMesh.cpp b/src/naveditor/Editor_SoloMesh.cpp index b38e9142..314a25f2 100644 --- a/src/naveditor/Editor_SoloMesh.cpp +++ b/src/naveditor/Editor_SoloMesh.cpp @@ -461,7 +461,7 @@ bool Editor_SoloMesh::handleBuild() //{ // m_pmesh->flags[i] = EDITOR_POLYFLAGS_SWIM; //} - else if (m_pmesh->areas[i] == EDITOR_POLYAREA_DOOR) + else if (m_pmesh->areas[i] == EDITOR_POLYAREA_TRIGGER) { m_pmesh->flags[i] = EDITOR_POLYFLAGS_WALK /*| EDITOR_POLYFLAGS_DOOR*/; } diff --git a/src/naveditor/Editor_TempObstacles.cpp b/src/naveditor/Editor_TempObstacles.cpp index c159c713..2f824db1 100644 --- a/src/naveditor/Editor_TempObstacles.cpp +++ b/src/naveditor/Editor_TempObstacles.cpp @@ -189,7 +189,7 @@ struct MeshProcess : public dtTileCacheMeshProcess //{ // polyFlags[i] = EDITOR_POLYFLAGS_SWIM; //} - else if (polyAreas[i] == EDITOR_POLYAREA_DOOR) + else if (polyAreas[i] == EDITOR_POLYAREA_TRIGGER) { polyFlags[i] = EDITOR_POLYFLAGS_WALK /*| EDITOR_POLYFLAGS_DOOR*/; } diff --git a/src/naveditor/Editor_TileMesh.cpp b/src/naveditor/Editor_TileMesh.cpp index f2562d84..1ffd918b 100644 --- a/src/naveditor/Editor_TileMesh.cpp +++ b/src/naveditor/Editor_TileMesh.cpp @@ -1077,9 +1077,9 @@ unsigned char* Editor_TileMesh::buildTileMesh(const int tx, const int ty, const //{ // m_pmesh->flags[i] = EDITOR_POLYFLAGS_SWIM; //} - else if (m_pmesh->areas[i] == EDITOR_POLYAREA_DOOR) + else if (m_pmesh->areas[i] == EDITOR_POLYAREA_TRIGGER) { - m_pmesh->flags[i] = EDITOR_POLYFLAGS_WALK | EDITOR_POLYFLAGS_DOOR; + m_pmesh->flags[i] = EDITOR_POLYFLAGS_WALK /*| EDITOR_POLYFLAGS_DOOR*/; } } diff --git a/src/naveditor/NavMeshTesterTool.cpp b/src/naveditor/NavMeshTesterTool.cpp index 889124bf..07886f9a 100644 --- a/src/naveditor/NavMeshTesterTool.cpp +++ b/src/naveditor/NavMeshTesterTool.cpp @@ -199,7 +199,7 @@ void NavMeshTesterTool::init(Editor* editor) m_filter.setAreaCost(EDITOR_POLYAREA_GROUND, 1.0f); m_filter.setAreaCost(EDITOR_POLYAREA_JUMP, 1.5f); //m_filter.setAreaCost(EDITOR_POLYAREA_ROAD, 1.0f); - m_filter.setAreaCost(EDITOR_POLYAREA_DOOR, 1.0f); + m_filter.setAreaCost(EDITOR_POLYAREA_TRIGGER, 1.0f); //m_filter.setAreaCost(EDITOR_POLYAREA_GRASS, 2.0f); //m_filter.setAreaCost(EDITOR_POLYAREA_WATER, 10.0f); } @@ -394,27 +394,11 @@ void NavMeshTesterTool::handleMenu() recalc(); } - isEnabled = (m_filter.getIncludeFlags() & EDITOR_POLYFLAGS_JUMP) != 0; + isEnabled = (m_filter.getIncludeFlags() & EDITOR_POLYFLAGS_SKIP) != 0; - if (ImGui::Checkbox("Jump##IncludeFlags", &isEnabled)) + if (ImGui::Checkbox("Skip##IncludeFlags", &isEnabled)) { - m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ EDITOR_POLYFLAGS_JUMP); - recalc(); - } - - isEnabled = (m_filter.getIncludeFlags() & EDITOR_POLYFLAGS_DOOR) != 0; - - if (ImGui::Checkbox("Door##IncludeFlags", &isEnabled)) - { - m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ EDITOR_POLYFLAGS_DOOR); - recalc(); - } - - isEnabled = (m_filter.getIncludeFlags() & EDITOR_POLYFLAGS_SWIM) != 0; - - if (ImGui::Checkbox("Swim##IncludeFlags", &isEnabled)) - { - m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ EDITOR_POLYFLAGS_SWIM); + m_filter.setIncludeFlags(m_filter.getIncludeFlags() ^ EDITOR_POLYFLAGS_SKIP); recalc(); } @@ -433,27 +417,11 @@ void NavMeshTesterTool::handleMenu() recalc(); } - isEnabled = (m_filter.getExcludeFlags() & EDITOR_POLYFLAGS_JUMP) != 0; + isEnabled = (m_filter.getExcludeFlags() & EDITOR_POLYFLAGS_SKIP) != 0; - if (ImGui::Checkbox("Jump##ExcludeFlags", &isEnabled)) + if (ImGui::Checkbox("Skip##ExcludeFlags", &isEnabled)) { - m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ EDITOR_POLYFLAGS_JUMP); - recalc(); - } - - isEnabled = (m_filter.getExcludeFlags() & EDITOR_POLYFLAGS_DOOR) != 0; - - if (ImGui::Checkbox("Door##ExcludeFlags", &isEnabled)) - { - m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ EDITOR_POLYFLAGS_DOOR); - recalc(); - } - - isEnabled = (m_filter.getExcludeFlags() & EDITOR_POLYFLAGS_SWIM) != 0; - - if (ImGui::Checkbox("Swim##ExcludeFlags", &isEnabled)) - { - m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ EDITOR_POLYFLAGS_SWIM); + m_filter.setExcludeFlags(m_filter.getExcludeFlags() ^ EDITOR_POLYFLAGS_SKIP); recalc(); } diff --git a/src/naveditor/include/Editor.h b/src/naveditor/include/Editor.h index 86ca3717..1b051e4e 100644 --- a/src/naveditor/include/Editor.h +++ b/src/naveditor/include/Editor.h @@ -69,31 +69,67 @@ enum EditorToolType // EDITOR_POLYAREA_WATER, //}; -#if DT_NAVMESH_SET_VERSION >= 7 +#if DT_NAVMESH_SET_VERSION >= 9 enum EditorPolyAreas { EDITOR_POLYAREA_JUMP, EDITOR_POLYAREA_GROUND, EDITOR_POLYAREA_RESERVED, - EDITOR_POLYAREA_DOOR, // rename to trigger + EDITOR_POLYAREA_TRIGGER, }; #else enum EditorPolyAreas { EDITOR_POLYAREA_GROUND, EDITOR_POLYAREA_JUMP, - EDITOR_POLYAREA_DOOR, + + // NOTE: not sure if anything beyond EDITOR_POLYAREA_JUMP belongs to MSET5, + // this needs to be confirmed, for now its been kept in for MSET5. + EDITOR_POLYAREA_JUMP_REVERSE, + EDITOR_POLYAREA_TRIGGER, + EDITOR_POLYAREA_WALLJUMP_LEFT, + EDITOR_POLYAREA_WALLJUMP_RIGHT, + EDITOR_POLYAREA_WALLJUMP_LEFT_REVERSE, + EDITOR_POLYAREA_WALLJUMP_RIGHT_REVERSE, }; #endif +//enum EditorPolyFlags // note: original poly flags for reference. +//{ +// // Most common polygon flags. +// EDITOR_POLYFLAGS_WALK = 1<<0, // Ability to walk (ground, grass, road) +// EDITOR_POLYFLAGS_JUMP = 1<<1, // Ability to jump. +// EDITOR_POLYFLAGS_DOOR = 1<<2, // Ability to move through doors. +// EDITOR_POLYFLAGS_SWIM = 1<<3, // Ability to swim (water). +// EDITOR_POLYFLAGS_DISABLED = 1<<4, // Disabled polygon +// EDITOR_POLYFLAGS_ALL = 0xffff // All abilities. +//}; + enum EditorPolyFlags { - EDITOR_POLYFLAGS_WALK = 0x01, // Ability to walk (ground, grass, road) - EDITOR_POLYFLAGS_JUMP = 0x02, // Ability to jump. - EDITOR_POLYFLAGS_DOOR = 0x04, // Ability to move through doors. - EDITOR_POLYFLAGS_SWIM = 0x08, // Ability to swim (water). - EDITOR_POLYFLAGS_DISABLED = 0x10, // Disabled polygon - EDITOR_POLYFLAGS_ALL = 0xffff // All abilities. + // Most common polygon flags. + EDITOR_POLYFLAGS_WALK = 1<<0, // Ability to walk (ground, grass, road). + EDITOR_POLYFLAGS_SKIP = 1<<1, // Skipped during AIN script nodes generation, NavMesh_RandomPositions, dtNavMeshQuery::findLocalNeighbourhood, etc. + EDITOR_POLYFLAGS_UNK0 = 1<<2, // Unknown, most polygon have this flag. + + // Off-mesh connection flags + EDITOR_POLYFLAGS_JUMP = 1<<3, // Ability to jump (exclusively used on off-mesh connection polygons). + EDITOR_POLYFLAGS_JUMP_LINKED = 1<<4, // Off-mesh connections who's start and end verts link to other polygons need this flag. + + EDITOR_POLYFLAGS_UNK2 = 1<<5, // Unknown, no use cases found yet. + + // Only used along with poly area 'EDITOR_POLYAREA_TRIGGER'. + EDITOR_POLYFLAGS_OBSTACLE = 1<<6, // Unknown, used for small road blocks and other small but easily climbable obstacles. + EDITOR_POLYFLAGS_UNK4 = 1<<7, // Unknown, no use cases found yet. + EDITOR_POLYFLAGS_DISABLED = 1<<8, // Used for ToggleNPCPathsForEntity. Also, see [r5apex_ds + 0xC96EA8]. Used for toggling poly's when a door closes during runtime. + // Also used to disable poly's in the navmesh file itself when we do happen to build navmesh on lava or other very hazardous areas. + EDITOR_POLYFLAGS_HAZARD = 1<<9, // see [r5apex_ds + 0xC96ED0], used for hostile objects such as electric fences. + EDITOR_POLYFLAGS_DOOR = 1<<10, // See [r5apex_ds + 0xECBAE0], used for large bunker style doors (vertical and horizontal opening ones), perhaps also shooting cover hint?. + EDITOR_POLYFLAGS_UNK8 = 1<<11, // Unknown, no use cases found yet. + EDITOR_POLYFLAGS_UNK9 = 1<<12, // Unknown, no use cases found yet. + EDITOR_POLYFLAGS_DOOR_BREACHABLE = 1<<13, // Used for doors that need to be breached, such as the Explosive Holds doors. + + EDITOR_POLYFLAGS_ALL = 0xffff // All abilities. }; class EditorDebugDraw : public DebugDrawGL