diff --git a/AMBuildScript b/AMBuildScript index 25bfdb5..13cebfe 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -401,7 +401,7 @@ class ExtensionConfig(object): cxx.defines += ['WIN32', '_WINDOWS'] def configure_shared(self, cxx): - cxx.defines += ['EXT_DEBUG_DRAW_TIME=0.0f', 'RAD_TELEMETRY_DISABLED'] + cxx.defines += ['RAD_TELEMETRY_DISABLED'] if builder.options.debugmode == '1': cxx.defines += ['EXT_DEBUG'] @@ -464,6 +464,7 @@ class ExtensionConfig(object): ] return compiler + def ExtLibrary(self, context, compiler, name): binary = self.Library(context, compiler, name) SetArchFlags(compiler) @@ -514,6 +515,11 @@ class ExtensionConfig(object): return binary + def CPPLibrary(self, project, context, compiler, name): + binary = project.Configure(compiler, name, '{0}'.format(compiler.target.arch)) + self.AddCxxCompat(binary) + return binary + def HL2Library(self, context, compiler, name, sdk): binary = self.Library(context, compiler, name) self.ConfigureForExtension(context, binary.compiler) diff --git a/extension/mods/tf2/nav/tfnav_edit.cpp b/extension/mods/tf2/nav/tfnav_edit.cpp index 7532032..2b1e64a 100644 --- a/extension/mods/tf2/nav/tfnav_edit.cpp +++ b/extension/mods/tf2/nav/tfnav_edit.cpp @@ -30,6 +30,54 @@ inline static CTFNavArea::TFNavPathAttributes NameToTFNavPathAttribute(const cha } } +inline static CTFNavArea::TFNavAttributes NameToTFNavAttributes(const char* name) +{ + if (strncasecmp(name, "limit_red", 9) == 0) + { + return CTFNavArea::TFNAV_LIMIT_TO_REDTEAM; + } + else if (strncasecmp(name, "limit_blu", 9) == 0) + { + return CTFNavArea::TFNAV_LIMIT_TO_BLUTEAM; + } + else if (strncasecmp(name, "sentry_gun_hint", 15) == 0) + { + return CTFNavArea::TFNAV_SENTRYGUN_HINT; + } + else if (strncasecmp(name, "dispenser_hint", 14) == 0) + { + return CTFNavArea::TFNAV_DISPENSER_HINT; + } + else if (strncasecmp(name, "tele_entrance_hint", 18) == 0) + { + return CTFNavArea::TFNAV_TELE_ENTRANCE_HINT; + } + else if (strncasecmp(name, "tele_exit_hint", 14) == 0) + { + return CTFNavArea::TFNAV_TELE_EXIT_HINT; + } + else if (strncasecmp(name, "sniper_spot_hint", 16) == 0) + { + return CTFNavArea::TFNAV_SNIPER_HINT; + } + else + { + return CTFNavArea::TFNAV_INVALID; + } +} + +inline static CTFNavArea::MvMNavAttributes NameToMvMAttributes(const char* name) +{ + if (strncasecmp(name, "frontlines", 10) == 0) + { + return CTFNavArea::MVMNAV_FRONTLINES; + } + else + { + return CTFNavArea::MVMNAV_INVALID; + } +} + class CTFNavEditTogglePathAttribute { public: @@ -58,6 +106,62 @@ class CTFNavEditTogglePathAttribute CTFNavArea::TFNavPathAttributes m_attribute; }; +class CTFNavEditToggleAttribute +{ +public: + CTFNavEditToggleAttribute(CTFNavArea::TFNavAttributes attribute) + { + m_attribute = attribute; + } + + bool operator() (CNavArea* baseArea) + { + CTFNavArea* area = static_cast(baseArea); + + if (TheNavMesh->IsSelectedSetEmpty() && area->HasTFAttributes(m_attribute)) + { + area->ClearTFAttributes(m_attribute); + } + else + { + area->SetTFAttributes(m_attribute); + } + + return true; + } + +private: + CTFNavArea::TFNavAttributes m_attribute; +}; + +class CTFNavEditToggleMvMAttribute +{ +public: + CTFNavEditToggleMvMAttribute(CTFNavArea::MvMNavAttributes attribute) + { + m_attribute = attribute; + } + + bool operator() (CNavArea* baseArea) + { + CTFNavArea* area = static_cast(baseArea); + + if (TheNavMesh->IsSelectedSetEmpty() && area->HasMVMAttributes(m_attribute)) + { + area->ClearMVMAttributes(m_attribute); + } + else + { + area->SetMVMAttributes(m_attribute); + } + + return true; + } + +private: + CTFNavArea::MvMNavAttributes m_attribute; +}; + CON_COMMAND_F(sm_tf_nav_toggle_path_attrib, "Toggles NavBot TF Path Attributes on the selected set", FCVAR_CHEAT) { if (args.ArgC() < 2) @@ -83,5 +187,61 @@ CON_COMMAND_F(sm_tf_nav_toggle_path_attrib, "Toggles NavBot TF Path Attributes o } } + TheNavMesh->ClearSelectedSet(); +} + +CON_COMMAND_F(sm_tf_nav_toggle_attrib, "Toggles NavBot TF Attributes on the selected set", FCVAR_CHEAT) +{ + if (args.ArgC() < 2) + { + Msg("Usage: sm_tf_nav_toggle_attrib ... \n"); + Msg("Valid Attributes: limit_red limit_blu sentry_gun_hint dispenser_hint tele_entrance_hint tele_exit_hint sniper_spot_hint \n"); + return; + } + + for (int i = 1; i < args.ArgC(); i++) + { + auto attrib = NameToTFNavAttributes(args[i]); + + if (attrib != CTFNavArea::TFNAV_INVALID) + { + CTFNavEditToggleAttribute toggle(attrib); + TheNavMesh->ForAllSelectedAreas(toggle); + Msg("Toggling TF Attribute \"%s\". \n", args[i]); + } + else + { + Warning("Unknown TF Attribute \"%s\"! \n", args[i]); + } + } + + TheNavMesh->ClearSelectedSet(); +} + +CON_COMMAND_F(sm_tf_nav_toggle_mvm_attrib, "Toggles NavBot TF MvM Attributes on the selected set", FCVAR_CHEAT) +{ + if (args.ArgC() < 2) + { + Msg("Usage: sm_tf_nav_toggle_mvm_attrib ... \n"); + Msg("Valid Attributes: frontlines \n"); + return; + } + + for (int i = 1; i < args.ArgC(); i++) + { + auto attrib = NameToMvMAttributes(args[i]); + + if (attrib != CTFNavArea::MVMNAV_INVALID) + { + CTFNavEditToggleMvMAttribute toggle(attrib); + TheNavMesh->ForAllSelectedAreas(toggle); + Msg("Toggling TF MvM Attribute \"%s\". \n", args[i]); + } + else + { + Warning("Unknown TF MvM Attribute \"%s\"! \n", args[i]); + } + } + TheNavMesh->ClearSelectedSet(); } \ No newline at end of file diff --git a/extension/mods/tf2/nav/tfnavarea.cpp b/extension/mods/tf2/nav/tfnavarea.cpp index ed1ecc1..8a5fe9e 100644 --- a/extension/mods/tf2/nav/tfnavarea.cpp +++ b/extension/mods/tf2/nav/tfnavarea.cpp @@ -118,19 +118,19 @@ void CTFNavArea::Debug_ShowTFPathAttributes() const if (HasTFPathAttributes(TFNAV_PATH_NO_RED_TEAM)) { ke::SafeStrcat(message, TEXT_SIZE, " NO_RED_TEAM"); - DrawFilled(153, 204, 255, 255, EXT_DEBUG_DRAW_TIME, true); + DrawFilled(153, 204, 255, 255, NDEBUG_PERSIST_FOR_ONE_TICK, true); } if (HasTFPathAttributes(TFNAV_PATH_NO_BLU_TEAM)) { ke::SafeStrcat(message, TEXT_SIZE, " NO_BLU_TEAM"); - DrawFilled(255, 64, 64, 255, EXT_DEBUG_DRAW_TIME, true); + DrawFilled(255, 64, 64, 255, NDEBUG_PERSIST_FOR_ONE_TICK, true); } if (HasTFPathAttributes(TFNAV_PATH_NO_CARRIERS)) { ke::SafeStrcat(message, TEXT_SIZE, " NO_FLAG_CARRIERS"); - DrawFilled(255, 69, 0, 255, EXT_DEBUG_DRAW_TIME, true); + DrawFilled(255, 69, 0, 255, NDEBUG_PERSIST_FOR_ONE_TICK, true); } if (HasTFPathAttributes(TFNAV_PATH_CARRIERS_AVOID)) @@ -146,13 +146,72 @@ void CTFNavArea::Debug_ShowTFPathAttributes() const if (m_spawnroomteam == static_cast(TeamFortress2::TFTeam::TFTeam_Blue)) { - DrawFilled(153, 204, 255, 255, EXT_DEBUG_DRAW_TIME, true); + DrawFilled(153, 204, 255, 255, NDEBUG_PERSIST_FOR_ONE_TICK, true); } else if (m_spawnroomteam == static_cast(TeamFortress2::TFTeam::TFTeam_Red)) { - DrawFilled(255, 64, 64, 255, EXT_DEBUG_DRAW_TIME, true); + DrawFilled(255, 64, 64, 255, NDEBUG_PERSIST_FOR_ONE_TICK, true); } } - NDebugOverlay::Text(GetCenter() + Vector(0.0f, 0.0f, 12.0f), message, true, EXT_DEBUG_DRAW_TIME); + NDebugOverlay::Text(GetCenter() + Vector(0.0f, 0.0f, 12.0f), message, true, NDEBUG_PERSIST_FOR_ONE_TICK); +} + +void CTFNavArea::Debug_ShowTFAttributes() const +{ + constexpr auto TEXT_SIZE = 256; + char message[TEXT_SIZE]{}; + + if (HasTFAttributes(TFNAV_LIMIT_TO_REDTEAM)) + { + ke::SafeStrcat(message, TEXT_SIZE, " LIMIT_TO_RED_TEAM"); + DrawFilled(153, 204, 255, 255, NDEBUG_PERSIST_FOR_ONE_TICK, true); + } + + if (HasTFAttributes(TFNAV_LIMIT_TO_BLUTEAM)) + { + ke::SafeStrcat(message, TEXT_SIZE, " LIMIT_TO_BLU_TEAM"); + DrawFilled(255, 64, 64, 255, NDEBUG_PERSIST_FOR_ONE_TICK, true); + } + + if (HasTFAttributes(TFNAV_SENTRYGUN_HINT)) + { + ke::SafeStrcat(message, TEXT_SIZE, " SENTRYGUN_HINT"); + } + + if (HasTFAttributes(TFNAV_DISPENSER_HINT)) + { + ke::SafeStrcat(message, TEXT_SIZE, " DISPENSER_HINT"); + } + + if (HasTFAttributes(TFNAV_TELE_ENTRANCE_HINT)) + { + ke::SafeStrcat(message, TEXT_SIZE, " TELE_ENTRANCE_HINT"); + } + + if (HasTFAttributes(TFNAV_TELE_EXIT_HINT)) + { + ke::SafeStrcat(message, TEXT_SIZE, " TELE_EXIT_HINT"); + } + + if (HasTFAttributes(TFNAV_SNIPER_HINT)) + { + ke::SafeStrcat(message, TEXT_SIZE, " SNIPER_HINT"); + } + + NDebugOverlay::Text(GetCenter() + Vector(0.0f, 0.0f, 12.0f), message, true, NDEBUG_PERSIST_FOR_ONE_TICK); +} + +void CTFNavArea::Debug_ShowMvMAttributes() const +{ + constexpr auto TEXT_SIZE = 256; + char message[TEXT_SIZE]{}; + + if (HasMVMAttributes(MVMNAV_FRONTLINES)) + { + ke::SafeStrcat(message, TEXT_SIZE, " FRONTLINES"); + DrawFilled(0, 153, 0, 255, NDEBUG_PERSIST_FOR_ONE_TICK, true); + } + + NDebugOverlay::Text(GetCenter() + Vector(0.0f, 0.0f, 12.0f), message, true, NDEBUG_PERSIST_FOR_ONE_TICK); } diff --git a/extension/mods/tf2/nav/tfnavarea.h b/extension/mods/tf2/nav/tfnavarea.h index 5fc705d..954473e 100644 --- a/extension/mods/tf2/nav/tfnavarea.h +++ b/extension/mods/tf2/nav/tfnavarea.h @@ -70,6 +70,7 @@ class CTFNavArea : public CNavArea enum TFNavAttributes { + TFNAV_INVALID = 0, TFNAV_LIMIT_TO_REDTEAM = (1 << 0), // Hints are limited to RED team only, this does not block pathing! TFNAV_LIMIT_TO_BLUTEAM = (1 << 1), // Hints are limited to BLU team only, this does not block pathing! TFNAV_SENTRYGUN_HINT = (1 << 2), // This is a good spot to build a sentry gun @@ -96,6 +97,7 @@ class CTFNavArea : public CNavArea enum MvMNavAttributes { + MVMNAV_INVALID = 0, MVMNAV_FRONTLINES = (1 << 0), // Bots will move here while waiting for the wave to start }; @@ -117,6 +119,8 @@ class CTFNavArea : public CNavArea void UpdateDynamicSpawnRoom(); void Debug_ShowTFPathAttributes() const; + void Debug_ShowTFAttributes() const; + void Debug_ShowMvMAttributes() const; private: int m_tfpathattributes; diff --git a/extension/mods/tf2/nav/tfnavmesh.cpp b/extension/mods/tf2/nav/tfnavmesh.cpp index f9d45e1..c6cd808 100644 --- a/extension/mods/tf2/nav/tfnavmesh.cpp +++ b/extension/mods/tf2/nav/tfnavmesh.cpp @@ -7,7 +7,9 @@ extern NavAreaVector TheNavAreas; -ConVar sm_nav_tf_show_path_attributes("sm_nav_tf_show_path_attributes", "0", FCVAR_GAMEDLL, "Shows TF Path Attributes"); +ConVar sm_tf_nav_show_path_attributes("sm_tf_nav_show_path_attributes", "0", FCVAR_GAMEDLL, "Shows TF Path Attributes"); +ConVar sm_tf_nav_show_attributes("sm_tf_nav_show_attributes", "0", FCVAR_GAMEDLL, "Shows TF Attributes"); +ConVar sm_tf_nav_show_mvm_attributes("sm_tf_nav_show_mvm_attributes", "0", FCVAR_GAMEDLL, "Shows TF MvM Attributes"); CTFNavMesh::CTFNavMesh() : CNavMesh() { @@ -53,7 +55,9 @@ void CTFNavMesh::Update() bool CTFNavMesh::Save(void) { - sm_nav_tf_show_path_attributes.SetValue(0); // disable rendering to avoid crashes during map change + sm_tf_nav_show_path_attributes.SetValue(0); // disable rendering to avoid crashes during map change + sm_tf_nav_show_attributes.SetValue(0); + sm_tf_nav_show_mvm_attributes.SetValue(0); return CNavMesh::Save(); } @@ -100,7 +104,7 @@ void CTFNavMesh::PostCustomAnalysis(void) } } - if (!hasfrontline) + if (!hasfrontline && mod->GetCurrentGameMode() == TeamFortress2::GameModeType::GM_MVM) { smutils->LogError(myself, "Mann vs Machine navmesh without \"Frontlines\" areas!"); } @@ -112,10 +116,20 @@ void CTFNavMesh::UpdateDebugDraw() { CTFNavArea* area = static_cast(TheNavAreas[it]); - if (sm_nav_tf_show_path_attributes.GetBool()) + if (sm_tf_nav_show_path_attributes.GetBool()) { area->Debug_ShowTFPathAttributes(); } + + if (sm_tf_nav_show_attributes.GetBool()) + { + area->Debug_ShowTFAttributes(); + } + + if (sm_tf_nav_show_mvm_attributes.GetBool()) + { + area->Debug_ShowMvMAttributes(); + } } } diff --git a/extension/navmesh/nav_area.cpp b/extension/navmesh/nav_area.cpp index d35c705..a9a1857 100644 --- a/extension/navmesh/nav_area.cpp +++ b/extension/navmesh/nav_area.cpp @@ -2963,7 +2963,7 @@ void CNavArea::Draw( void ) const NavEditColor color; bool useAttributeColors = true; - const float DebugDuration = EXT_DEBUG_DRAW_TIME; + const float DebugDuration = NDEBUG_PERSIST_FOR_ONE_TICK; if ( TheNavMesh->IsEditMode( CNavMesh::PLACE_PAINTING ) ) { @@ -3332,7 +3332,7 @@ void CNavArea::DrawFilled( int r, int g, int b, int a, float deltaT, bool noDept //-------------------------------------------------------------------------------------------------------- void CNavArea::DrawSelectedSet( const Vector &shift ) const { - const float deltaT = EXT_DEBUG_DRAW_TIME; + const float deltaT = NDEBUG_PERSIST_FOR_ONE_TICK; int r = s_selectedSetColor.r(); int g = s_selectedSetColor.g(); int b = s_selectedSetColor.b(); @@ -3359,7 +3359,7 @@ void CNavArea::DrawSelectedSet( const Vector &shift ) const //-------------------------------------------------------------------------------------------------------- void CNavArea::DrawDragSelectionSet( Color &dragSelectionSetColor ) const { - const float deltaT = EXT_DEBUG_DRAW_TIME; + const float deltaT = NDEBUG_PERSIST_FOR_ONE_TICK; int r = dragSelectionSetColor.r(); int g = dragSelectionSetColor.g(); int b = dragSelectionSetColor.b(); @@ -3543,10 +3543,10 @@ void CNavArea::DrawConnectedAreas( CNavMesh* TheNavMesh ) const const Vector& start = link.GetPosition(); const Vector& end = link.m_link.area->GetCenter(); link.m_link.area->Draw(); - NDebugOverlay::Line(start, end, 0, 255, 0, true, EXT_DEBUG_DRAW_TIME); + NDebugOverlay::Line(start, end, 0, 255, 0, true, NDEBUG_PERSIST_FOR_ONE_TICK); char message[64]; ke::SafeSprintf(message, sizeof(message), "Nav Link <%s>", NavSpecialLink::LinkTypeToString(link.m_type)); - NDebugOverlay::Text(start, message, false, EXT_DEBUG_DRAW_TIME); + NDebugOverlay::Text(start, message, false, NDEBUG_PERSIST_FOR_ONE_TICK); } } @@ -5361,13 +5361,13 @@ void NavHintPoint::Draw() const Vector top = m_pos + Vector(0.0f, 0.0f, NavHintPointHeight); Vector half = m_pos + Vector(0.0f, 0.0f, NavHintTextHeight); - NDebugOverlay::Line(m_pos, top, 0, 230, 255, false, EXT_DEBUG_DRAW_TIME); + NDebugOverlay::Line(m_pos, top, 0, 230, 255, false, NDEBUG_PERSIST_FOR_ONE_TICK); Vector forward; AngleVectors(m_angle, &forward); forward.NormalizeInPlace(); - NDebugOverlay::HorzArrow(half, half + (forward * 24.0f), 4.0f, 0, 110, 0, 255, false, EXT_DEBUG_DRAW_TIME); + NDebugOverlay::HorzArrow(half, half + (forward * 24.0f), 4.0f, 0, 110, 0, 255, false, NDEBUG_PERSIST_FOR_ONE_TICK); auto name = TheNavMesh->NavHintTypeIDToString(m_hintType); - NDebugOverlay::Text(half, name, true, EXT_DEBUG_DRAW_TIME); + NDebugOverlay::Text(half, name, true, NDEBUG_PERSIST_FOR_ONE_TICK); } diff --git a/extension/navmesh/nav_colors.cpp b/extension/navmesh/nav_colors.cpp index dafbdc5..ea3a1af 100644 --- a/extension/navmesh/nav_colors.cpp +++ b/extension/navmesh/nav_colors.cpp @@ -13,9 +13,7 @@ #include "Color.h" #include -#include - -extern IVDebugOverlay* debugoverlay; +#include //-------------------------------------------------------------------------------------------------------------- /** @@ -78,9 +76,9 @@ void NavDrawLine(const Vector& from, const Vector& to, NavEditColor navColor) { Color color = NavColors[navColor]; debugoverlay->AddLineOverlay(from + offset, to + offset, color[0], color[1], - color[2], false, EXT_DEBUG_DRAW_TIME); + color[2], false, NDEBUG_PERSIST_FOR_ONE_TICK); debugoverlay->AddLineOverlay(from + offset, to + offset, color[0] / 2, - color[1] / 2, color[2] / 2, true, EXT_DEBUG_DRAW_TIME); + color[1] / 2, color[2] / 2, true, NDEBUG_PERSIST_FOR_ONE_TICK); } //-------------------------------------------------------------------------------------------------------------- @@ -101,7 +99,7 @@ void NavDrawFilledTriangle(const Vector& point1, const Vector& point2, } } debugoverlay->AddTriangleOverlay(point1, point2, point3, color[0], color[1], - color[2], 255, true, EXT_DEBUG_DRAW_TIME); + color[2], 255, true, NDEBUG_PERSIST_FOR_ONE_TICK); } void HorzArrow(const Vector &startPos, const Vector &endPos, float width, int r, @@ -141,9 +139,9 @@ void NavDrawHorizontalArrow(const Vector& from, const Vector& to, float width, Color color = NavColors[navColor]; HorzArrow(from + offset, to + offset, width, color[0], color[1], color[2], - 255, false, EXT_DEBUG_DRAW_TIME); + 255, false, NDEBUG_PERSIST_FOR_ONE_TICK); HorzArrow(from + offset, to + offset, width, color[0] / 2, color[1] / 2, - color[2] / 2, 255, true, EXT_DEBUG_DRAW_TIME); + color[2] / 2, 255, true, NDEBUG_PERSIST_FOR_ONE_TICK); } //-------------------------------------------------------------------------------------------------------------- @@ -170,10 +168,10 @@ void NavDrawDashedLine(const Vector& from, const Vector& to, distance += solidLen + gapLen; debugoverlay->AddLineOverlay(start + offset, end + offset, color[0], - color[1], color[2], false, EXT_DEBUG_DRAW_TIME); + color[1], color[2], false, NDEBUG_PERSIST_FOR_ONE_TICK); debugoverlay->AddLineOverlay(start + offset, end + offset, color[0] / 2, color[1] / 2, color[2] / 2, true, - EXT_DEBUG_DRAW_TIME); + NDEBUG_PERSIST_FOR_ONE_TICK); } } diff --git a/extension/navmesh/nav_edit.cpp b/extension/navmesh/nav_edit.cpp index 4812b1c..50dc3eb 100644 --- a/extension/navmesh/nav_edit.cpp +++ b/extension/navmesh/nav_edit.cpp @@ -702,7 +702,7 @@ void CNavMesh::DrawEditMode( void ) if ( player == nullptr || IsGenerating() ) return; - // TODO: remove this when host_thread_mode 1 stops breaking EXT_DEBUG_DRAW_TIME overlays + // TODO: remove this when host_thread_mode 1 stops breaking NDEBUG_PERSIST_FOR_ONE_TICK overlays static ConVarRef host_thread_mode( "host_thread_mode" ); host_thread_mode.SetValue( 0 ); @@ -779,7 +779,7 @@ void CNavMesh::DrawEditMode( void ) if ( m_climbableSurface ) { - Cross3D( m_editCursorPos, cursorSize, 0, 255, 0, true, EXT_DEBUG_DRAW_TIME ); + Cross3D( m_editCursorPos, cursorSize, 0, 255, 0, true, NDEBUG_PERSIST_FOR_ONE_TICK ); } else { @@ -792,19 +792,19 @@ void CNavMesh::DrawEditMode( void ) const float offset = cursorSize * 1.5f; Vector pos = m_editCursorPos; AddDirectionVector( &pos, NORTH, offset ); - Text( pos, "N", false, EXT_DEBUG_DRAW_TIME ); + Text( pos, "N", false, NDEBUG_PERSIST_FOR_ONE_TICK ); pos = m_editCursorPos; AddDirectionVector( &pos, SOUTH, offset ); - Text( pos, "S", false, EXT_DEBUG_DRAW_TIME ); + Text( pos, "S", false, NDEBUG_PERSIST_FOR_ONE_TICK ); pos = m_editCursorPos; AddDirectionVector( &pos, EAST, offset ); - Text( pos, "E", false, EXT_DEBUG_DRAW_TIME ); + Text( pos, "E", false, NDEBUG_PERSIST_FOR_ONE_TICK ); pos = m_editCursorPos; AddDirectionVector( &pos, WEST, offset ); - Text( pos, "W", false, EXT_DEBUG_DRAW_TIME ); + Text( pos, "W", false, NDEBUG_PERSIST_FOR_ONE_TICK ); } } @@ -873,7 +873,7 @@ void CNavMesh::DrawEditMode( void ) { V_snprintf( buffer, sizeof( buffer ), "Ladder #%d\n", m_selectedLadder->GetID() ); } - debugoverlay->AddScreenTextOverlay(0.5, 0.53, EXT_DEBUG_DRAW_TIME, 255, 255, + debugoverlay->AddScreenTextOverlay(0.5, 0.53, NDEBUG_PERSIST_FOR_ONE_TICK, 255, 255, 0, 128, buffer); } @@ -976,7 +976,7 @@ void CNavMesh::DrawEditMode( void ) } Q_snprintf( buffer, sizeof( buffer ), "Area #%d %s %s\n", m_selectedArea->GetID(), locName, attrib ); - debugoverlay->AddScreenTextOverlay(0.5, 0.53, EXT_DEBUG_DRAW_TIME, 255, 255, + debugoverlay->AddScreenTextOverlay(0.5, 0.53, NDEBUG_PERSIST_FOR_ONE_TICK, 255, 255, 0, 128, buffer); // do "place painting" diff --git a/extension/navmesh/nav_entities.cpp b/extension/navmesh/nav_entities.cpp index 77ce94a..e937e97 100644 --- a/extension/navmesh/nav_entities.cpp +++ b/extension/navmesh/nav_entities.cpp @@ -10,6 +10,7 @@ // Author: Michael S. Booth (mike@turtlerockstudios.com), January 2003 #include +#include #include "nav_entities.h" #include "nav_area.h" @@ -17,13 +18,10 @@ #include #include #include -#include // the global singleton interface extern CNavMesh *TheNavMesh; -extern IPlayerInfoManager* playerinfomanager; extern NavAreaVector TheNavAreas; -extern IVDebugOverlay* debugoverlay; #if SOURCE_ENGINE == SE_DODS @@ -348,7 +346,7 @@ void EntityText(ICollideable* collision, int text_offset, const char *text, floa { VectorTransform(vecLocalCenter, collision->CollisionToWorldTransform(), origin); } - debugoverlay->AddTextOverlayRGB(origin, text_offset, EXT_DEBUG_DRAW_TIME, r, g, b, a, "%s", text); + debugoverlay->AddTextOverlayRGB(origin, text_offset, NDEBUG_PERSIST_FOR_ONE_TICK, r, g, b, a, "%s", text); } int NavEntity::DrawDebugTextOverlays() { @@ -404,7 +402,7 @@ int CFuncNavBlocker::DrawDebugTextOverlays( void ) { Extent areaExtent; collector.m_area[i]->GetExtent( &areaExtent ); - debugoverlay->AddBoxOverlay( vec3_origin, areaExtent.lo, areaExtent.hi, vec3_angle, 0, 255, 0, 10, EXT_DEBUG_DRAW_TIME ); + debugoverlay->AddBoxOverlay( vec3_origin, areaExtent.lo, areaExtent.hi, vec3_angle, 0, 255, 0, 10, NDEBUG_PERSIST_FOR_ONE_TICK ); } */ @@ -552,7 +550,7 @@ int CFuncNavObstruction::DrawDebugTextOverlays( void ) { int offset = NavEntity::DrawDebugTextOverlays(); EntityText(pEnt->GetCollideable(), offset++, CanObstructNavAreas() ? "Obstructing nav" : "Not obstructing nav", - EXT_DEBUG_DRAW_TIME); + NDEBUG_PERSIST_FOR_ONE_TICK); return offset; } diff --git a/extension/navmesh/nav_mesh.cpp b/extension/navmesh/nav_mesh.cpp index 969793a..71931ff 100644 --- a/extension/navmesh/nav_mesh.cpp +++ b/extension/navmesh/nav_mesh.cpp @@ -14,6 +14,7 @@ #include "extension.h" #include #include +#include #include "nav_mesh.h" @@ -21,7 +22,6 @@ #include "nav_node.h" #include #include -#include #include #include #include @@ -31,7 +31,7 @@ #include #include -#define DrawLine( from, to, duration, red, green, blue ) debugoverlay->AddLineOverlay( from, to, red, green, blue, true, EXT_DEBUG_DRAW_TIME ) +#define DrawLine( from, to, duration, red, green, blue ) debugoverlay->AddLineOverlay( from, to, red, green, blue, true, NDEBUG_PERSIST_FOR_ONE_TICK ) /** * The singleton for accessing the navigation mesh @@ -1626,7 +1626,7 @@ void CNavMesh::DrawPlayerCounts( void ) const Text(area->GetCenter(), msg.sprintf("%d (%d/%d)", area->GetPlayerCount(), area->GetPlayerCount(1), area->GetPlayerCount(2)), - false, EXT_DEBUG_DRAW_TIME); + false, NDEBUG_PERSIST_FOR_ONE_TICK); } } */ diff --git a/extension/sdkports/debugoverlay_shared.h b/extension/sdkports/debugoverlay_shared.h index d2f6264..248b910 100644 --- a/extension/sdkports/debugoverlay_shared.h +++ b/extension/sdkports/debugoverlay_shared.h @@ -13,6 +13,10 @@ #include "engine/ivdebugoverlay.h" #include "mathlib/vector.h" +// When used as a duration by a server-side NDebugOverlay:: call, +// causes the overlay to persist until the next server update. +#define NDEBUG_PERSIST_FOR_ONE_TICK (0.0f) + //============================================================================= // NDebugOverlay //=============================================================================