NavMesh Place name support - #2092
Conversation
|
I'm not happy with how client side the place names are loaded within the same function that reads the nav file, ideally that function should take a pointer to a CUtlVector and be moved to a separate file, with the original file calling it then going through all the place names and configuring how they look etc. but I'm tired. |
|
Ok fixed some last minute issues and included a video showing the feature |
set text length after copy Co-authored-by: Dan Peavey <sunMachine@users.noreply.github.com>
Update place nav area counts Co-authored-by: Dan Peavey <sunMachine@users.noreply.github.com>
remove incrementreferencecount Co-authored-by: Dan Peavey <sunMachine@users.noreply.github.com>
pragma once Co-authored-by: Dan Peavey <sunMachine@users.noreply.github.com>
…ide and textXPos textYPos
…adeusz/neo into 376_navPlaceNameHudSupport
| @@ -0,0 +1,339 @@ | |||
| #include "c_neo_point_world_text.h" | |||
| #include "view_scene.h" | |||
| #include "view.h" | |||
There was a problem hiding this comment.
nit: by any chance do we want to add
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"after these includes?
|
|
||
| if (TheNavMesh) | ||
| { | ||
| const char* placeName = TheNavMesh->PlaceToName(TheNavMesh->GetPlace(GetAbsOrigin())); |
There was a problem hiding this comment.
Could probably just use GetLastKnownArea() instead of neeting to query the NavMesh for GetPlace.
Something like:
const CNavArea* pArea = GetLastKnownArea();
const char* placeName = pArea ? TheNavMesh->PlaceToName(pArea->GetPlace()) : NULL;|
|
||
| CNEOHud_PlaceName::~CNEOHud_PlaceName() | ||
| { | ||
| if (g_PlaceName == this) |
There was a problem hiding this comment.
Just before, should we also call
IGameSystem::Remove(this);?
| { | ||
| char name[MAX_PLACE_NAME_LENGTH]; | ||
| int count; | ||
| Vector averageCenter; |
There was a problem hiding this comment.
Would it be easier/safer to also set vec3_origin here?
Vector averageCenter = vec3_origin;| animationAlpha = shouldDrawPlaceNames ? min(1.0f, animationAlpha + (gpGlobals->frametime * ANIMATION_SPEED)) | ||
| : max(0.0f, animationAlpha - (gpGlobals->frametime * ANIMATION_SPEED)); | ||
|
|
||
| for (PlaceNameCallout place : places) |
There was a problem hiding this comment.
Maybe this could be a reference to avoid a copy?
for (PlaceNameCallout &place : places)| for( int i=0; i<placeCount; ++i ) | ||
| { | ||
| len = fileBuffer.GetUnsignedShort(); | ||
| fileBuffer.Get( placeName, MIN( sizeof( placeName ), len ) ); |
There was a problem hiding this comment.
At this point, might be a good idea to initalize all the placeName(s) to either have their placeName or to cap off the string with a null terminator like:
placeName[ MIN( sizeof( placeName ) - 1, len ) ] = '\0';| { | ||
| entry -= 1; | ||
| Vector newNavCenter = (nwCorner + seCorner) / 2.f; | ||
| places[entry].origin = ((places[entry].origin * places[entry].navAreaCount) + newNavCenter) / ++places[entry].navAreaCount; |
There was a problem hiding this comment.
embedding the ++ preincrement might be kind of hard to reason about so it might be easier to evaluate that up front and change this line in response:
places[entry].navAreaCount++;
places[entry].origin = ((places[entry].origin * (places[entry].navAreaCount - 1)) + newNavCenter) / places[entry].navAreaCount;also, might be undefined behavior when the preincrement is evaluated as an operand of /
Description
NeoAssets PR NeotokyoRebuild/neoAssets#132
Adds a hud element that displays the name of the closest nav area's place name, if any. Intended for incorporating call-outs from callout maps into the navigation meshes.
Also adds a command for displaying all nearby place names
placeCallouts.mp4
Toolchain