Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

*Add missing recast files

  • Loading branch information...
commit 46f3b3912a26ae3509272aea39271d1ab3f1f710 1 parent 8057982
@Pepsi1x1 Pepsi1x1 authored
View
6 .gitignore
@@ -18,4 +18,8 @@ Addons/.gitignore
Addons/GossipMenus/bin
wcelladdon/
*.docstates
-TestResults/
+TestResults/
+*.svn
+/Logs
+/Utilities/WCell.Tools/output
+/.code_swarm
View
2  Run/Content/Battlegrounds.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Battlegrounds xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<Battlegrounds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Setting>
<Name>AlteracValley</Name>
<Type>WCell.Addons.Default.Battlegrounds.AlteracValley.AlteracValley</Type>
View
2  Run/Content/Instances.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Instances xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<Instances xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Setting>
<Name>Unkkk</Name>
<Type> </Type>
View
3  Run/RealmServerAutoExec/_Startup.txt
@@ -1,4 +1,5 @@
# Add a list of commands to be executed upon server startup
# Comments are preceeded by "#"
# For more info: http://wiki.wcell.org/index.php?title=Automatic_execution_of_files
-# load all
+load npcs
+load items
View
104 Services/WCell.RealmServer/AI/Actions/Movement/AIWaypointMoveAction.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using WCell.Constants.NPCs;
using WCell.Constants.Updates;
@@ -12,28 +13,28 @@ namespace WCell.RealmServer.AI.Actions.Movement
/// </summary>
public class AIWaypointMoveAction : AIAction
{
- protected LinkedList<WaypointEntry> m_waypoints;
- protected LinkedListNode<WaypointEntry> m_currentWaypoint;
- protected LinkedListNode<WaypointEntry> m_targetWaypoint;
+ protected LinkedList<WaypointEntry> Waypoints;
+ protected LinkedListNode<WaypointEntry> CurrentWaypoint;
+ protected LinkedListNode<WaypointEntry> TargetWaypoint;
/// <summary>
/// The direction of movement on waypoints. True - moving backwards, false - moving forward
/// Only used for AIMovementType.ForwardThenBack
/// </summary>
- protected bool m_goingBack;
+ protected bool GoingBack;
/// <summary>
/// Whether we are staying on a waypoint (pause)
/// </summary>
- protected bool m_stayingOnWaypoint;
+ protected bool StayingOnWaypoint;
/// <summary>
/// When to start moving again
/// </summary>
- protected uint m_desiredStartMovingTime;
+ protected uint DesiredStartMovingTime;
- protected AIMovementType _waypointSequence;
+ protected AIMovementType WaypointSequence;
public AIWaypointMoveAction(Unit owner)
: this(owner, AIMovementType.ForwardThenStop)
@@ -43,54 +44,47 @@ public AIWaypointMoveAction(Unit owner)
public AIWaypointMoveAction(Unit owner, AIMovementType waypointSequence)
: base(owner)
{
- m_waypoints = new LinkedList<WaypointEntry>();
+ Waypoints = new LinkedList<WaypointEntry>();
- _waypointSequence = waypointSequence;
+ WaypointSequence = waypointSequence;
}
public AIWaypointMoveAction(Unit owner, AIMovementType waypointSequence,
LinkedList<WaypointEntry> waypoints)
: this(owner, waypointSequence)
{
- if (waypoints == null)
- {
- m_waypoints = WaypointEntry.EmptyList;
- }
- else
- {
- m_waypoints = waypoints;
- }
+ Waypoints = waypoints ?? WaypointEntry.EmptyList;
}
/// <summary>
/// Amount of Waypoints
/// </summary>
- public int Count { get { return m_waypoints.Count; } }
+ public int Count { get { return Waypoints.Count; } }
public bool IsStayingOnWaypoint
{
- get { return m_stayingOnWaypoint; }
+ get { return StayingOnWaypoint; }
}
public override void Start()
{
- m_stayingOnWaypoint = true;
- m_desiredStartMovingTime = 0;
+ StayingOnWaypoint = true;
+ DesiredStartMovingTime = 0;
m_owner.Movement.MoveType = AIMoveType.Walk;
}
public override void Update()
{
- if (m_waypoints.Count == 0)
+ if (Waypoints.Count == 0)
{
return;
}
- if (m_stayingOnWaypoint)
+ if (StayingOnWaypoint)
{
- if (Utility.GetSystemTime() >= m_desiredStartMovingTime)
+ if (Utility.GetSystemTime() >= DesiredStartMovingTime)
{
- m_targetWaypoint = GetNextWaypoint();
+ TargetWaypoint = GetNextWaypoint();
MoveToTargetWaypoint();
}
}
@@ -98,17 +92,17 @@ public override void Update()
{
if (m_owner.Movement.Update())
{
- m_currentWaypoint = m_targetWaypoint;
- if (m_currentWaypoint.Value.Orientation != 0)
+ CurrentWaypoint = TargetWaypoint;
+ if (Math.Abs(CurrentWaypoint.Value.Orientation - 0) > float.Epsilon)
{
- m_owner.Face(m_currentWaypoint.Value.Orientation);
+ m_owner.Face(CurrentWaypoint.Value.Orientation);
}
- var waitTime = m_targetWaypoint.Value.WaitTime;
+ var waitTime = TargetWaypoint.Value.WaitTime;
// need to wait on this waypoint
- m_stayingOnWaypoint = true;
- m_desiredStartMovingTime = Utility.GetSystemTime() + waitTime;
+ StayingOnWaypoint = true;
+ DesiredStartMovingTime = Utility.GetSystemTime() + waitTime;
}
//else if (m_owner.MayMove)
//{
@@ -124,65 +118,65 @@ public override void Stop()
protected void MoveToTargetWaypoint()
{
- if (m_targetWaypoint == null)
+ if (TargetWaypoint == null)
{
// there is no next Waypoint (usually means there are no waypoints at all)
//m_owner.Movement.MoveTo(m_owner.Position, false);
}
else
{
- m_stayingOnWaypoint = false;
+ StayingOnWaypoint = false;
- m_owner.Brain.SourcePoint = m_targetWaypoint.Value.Position;
- m_owner.Movement.MoveTo(m_targetWaypoint.Value.Position, false);
+ m_owner.Brain.SourcePoint = TargetWaypoint.Value.Position;
+ m_owner.Movement.MoveTo(TargetWaypoint.Value.Position, false);
}
}
protected LinkedListNode<WaypointEntry> GetNextWaypoint()
{
- if (m_waypoints.Count == 0)
+ if (Waypoints.Count == 0)
return null;
- if (m_currentWaypoint == null)
- return m_waypoints.First;
+ if (CurrentWaypoint == null)
+ return Waypoints.First;
- switch (_waypointSequence)
+ switch (WaypointSequence)
{
case AIMovementType.ForwardThenStop:
- return m_currentWaypoint.Next;
+ return CurrentWaypoint.Next;
case AIMovementType.ForwardThenBack:
- if (!m_goingBack)
+ if (!GoingBack)
{
- if (m_currentWaypoint.Next != null)
- return m_currentWaypoint.Next;
+ if (CurrentWaypoint.Next != null)
+ return CurrentWaypoint.Next;
- if (m_currentWaypoint.Previous != null)
+ if (CurrentWaypoint.Previous != null)
{
- m_goingBack = true;
- return m_currentWaypoint.Previous;
+ GoingBack = true;
+ return CurrentWaypoint.Previous;
}
}
- if (m_goingBack)
+ if (GoingBack)
{
- if (m_currentWaypoint.Previous != null)
- return m_currentWaypoint.Previous;
+ if (CurrentWaypoint.Previous != null)
+ return CurrentWaypoint.Previous;
- if (m_currentWaypoint.Next != null)
+ if (CurrentWaypoint.Next != null)
{
- m_goingBack = false;
- return m_currentWaypoint.Next;
+ GoingBack = false;
+ return CurrentWaypoint.Next;
}
}
return null;
case AIMovementType.ForwardThenFirst:
- if (m_currentWaypoint.Next != null)
- return m_currentWaypoint.Next;
+ if (CurrentWaypoint.Next != null)
+ return CurrentWaypoint.Next;
- return m_waypoints.First;
+ return Waypoints.First;
}
return null;
View
17 Services/WCell.RealmServer/AI/Actions/States/AIRoamAction.cs
@@ -14,9 +14,7 @@ public class AIRoamAction : AIAction, IAIStateAction
{
public static int DefaultRoamSpellCastDelay = 30000;
- private DateTime lastSpellCast;
-
- private AIAction _strategy;
+ private DateTime _lastSpellCast;
public AIRoamAction(Unit owner)
: base(owner)
@@ -39,14 +37,7 @@ public int MinimumRoamSpellCastDelay
/// <summary>
/// The strategy to be used while roaming
/// </summary>
- public AIAction Strategy
- {
- get { return _strategy; }
- set
- {
- _strategy = value;
- }
- }
+ public AIAction Strategy { get; set; }
public override void Start()
{
@@ -60,11 +51,11 @@ public override void Update()
{
if (!m_owner.Brain.CheckCombat())
{
- if (UsesSpells && HasSpellReady && m_owner.CanCastSpells && lastSpellCast + TimeSpan.FromMilliseconds(MinimumRoamSpellCastDelay) < DateTime.Now)
+ if (UsesSpells && HasSpellReady && m_owner.CanCastSpells && _lastSpellCast + TimeSpan.FromMilliseconds(MinimumRoamSpellCastDelay) < DateTime.Now)
{
if (TryCastSpell())
{
- lastSpellCast = DateTime.Now;
+ _lastSpellCast = DateTime.Now;
m_owner.Movement.Stop();
return;
}
View
17 Services/WCell.RealmServer/AI/DefaultAIActionCollection.cs
@@ -23,10 +23,21 @@ public override void Init(Unit owner)
this[BrainState.Dead] = this[BrainState.Idle];
this[BrainState.Evade] = new AIEvadeAction(owner);
- this[BrainState.Roam] = new AIRoamAction(owner)
+
+ if (owner is NPC && ((NPC)owner).SpawnEntry.MoveType == AIMotionGenerationType.RandomMotion)
+ {
+ this[BrainState.Roam] = new AIRoamAction(owner)
+ {
+ Strategy = new AIWanderMoveAction(owner as NPC, AIMovementType.ForwardThenBack, owner.Waypoints)
+ };
+ }
+ else
{
- Strategy = new AIWaypointMoveAction(owner, AIMovementType.ForwardThenBack, owner.Waypoints)
- };
+ this[BrainState.Roam] = new AIRoamAction(owner)
+ {
+ Strategy = new AIWaypointMoveAction(owner, AIMovementType.ForwardThenBack, owner.Waypoints)
+ };
+ }
this[BrainState.Follow] = new AIFollowMasterAction(owner);
this[BrainState.Guard] = new AIGuardMasterAction(owner);
View
4 Services/WCell.RealmServer/NPCs/Spawns/NPCSpawnEntry.cs
@@ -167,8 +167,8 @@ public override void FinalizeDataHolder(bool addToPool)
}
- if(MoveType == AIMotionGenerationType.RandomMotion)
- CreateRandomWaypoints();
+ //if(MoveType == AIMotionGenerationType.RandomMotion)
+ //CreateRandomWaypoints();
// finished initializing, now call the hooks
foreach (var handler in Entry.SpawnTypeHandlers)
View
1  Services/WCell.RealmServer/WCell.RealmServer.csproj
@@ -198,6 +198,7 @@
<Compile Include="Achievements\AchievementCriteriaRequirement.cs" />
<Compile Include="Achievements\AchievementReward.cs" />
<Compile Include="AI\Actions\Movement\AIFollowPathAction.cs" />
+ <Compile Include="AI\Actions\Movement\AIWanderMoveAction.cs" />
<Compile Include="AI\Brains\IAIEventsHandler.cs" />
<Compile Include="Commands\WorldEventCommands.cs" />
<Compile Include="Content\IModDataHolder.cs" />
View
6 Services/WCell.RealmServer/Waypoints/RandomWaypointGenerator.cs
@@ -38,11 +38,11 @@ public Vector3[] GenerateWaypoints(ITerrain terrain, Vector3 lastPos, int min, i
{
if (min < 1)
{
- throw new ArgumentException("The minimum point count must be greater than 1", "min");
+ throw new ArgumentException(@"The minimum point count must be greater than 1", "min");
}
if (max < min)
{
- throw new ArgumentException("The maximum point count must be greater than the minimum", "max");
+ throw new ArgumentException(@"The maximum point count must be greater than the minimum", "max");
}
var count = Utility.Random(min, max);
@@ -71,7 +71,7 @@ public static Vector3[] GenerateWaypoints(ITerrain terrain, Vector3 lastPos, flo
{
if(maxDist < minDist)
{
- throw new ArgumentException("The maximum waypoint distance must be greater than the minimum", "maxDist");
+ throw new ArgumentException(@"The maximum waypoint distance must be greater than the minimum", "maxDist");
}
var wps = new Vector3[count];
View
51 WCell-Terrain/Recast/RecastDemo/Include/NavmeshPruneTool.h
@@ -0,0 +1,51 @@
+//
+// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+//
+
+#ifndef NAVMESHPRUNETOOL_H
+#define NAVMESHPRUNETOOL_H
+
+#include "Sample.h"
+
+// Prune navmesh to accessible locations from a point.
+
+class NavmeshPruneTool : public SampleTool
+{
+ Sample* m_sample;
+
+ class NavmeshFlags* m_flags;
+
+ float m_hitPos[3];
+ bool m_hitPosSet;
+
+public:
+ NavmeshPruneTool();
+ ~NavmeshPruneTool();
+
+ virtual int type() { return TOOL_NAVMESH_PRUNE; }
+ virtual void init(Sample* sample);
+ virtual void reset();
+ virtual void handleMenu();
+ virtual void handleClick(const float* s, const float* p, bool shift);
+ virtual void handleToggle();
+ virtual void handleStep();
+ virtual void handleUpdate(const float dt);
+ virtual void handleRender();
+ virtual void handleRenderOverlay(double* proj, double* model, int* view);
+};
+
+#endif // NAVMESHPRUNETOOL_H
View
349 WCell-Terrain/Recast/RecastDemo/Source/NavmeshPruneTool.cpp
@@ -0,0 +1,349 @@
+//
+// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source distribution.
+//
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include <float.h>
+#include "SDL.h"
+#include "SDL_opengl.h"
+#include "imgui.h"
+#include "NavmeshPruneTool.h"
+#include "InputGeom.h"
+#include "Sample.h"
+#include "DetourNavMesh.h"
+#include "DetourCommon.h"
+#include "DetourAssert.h"
+#include "DetourDebugDraw.h"
+
+#ifdef WIN32
+# define snprintf _snprintf
+#endif
+
+
+
+// Copy/paste from Recast int array
+class PolyRefArray
+{
+ dtPolyRef* m_data;
+ int m_size, m_cap;
+ inline PolyRefArray(const PolyRefArray&);
+ inline PolyRefArray& operator=(const PolyRefArray&);
+public:
+
+ inline PolyRefArray() : m_data(0), m_size(0), m_cap(0) {}
+ inline PolyRefArray(int n) : m_data(0), m_size(0), m_cap(0) { resize(n); }
+ inline ~PolyRefArray() { dtFree(m_data); }
+ void resize(int n)
+ {
+ if (n > m_cap)
+ {
+ if (!m_cap) m_cap = n;
+ while (m_cap < n) m_cap *= 2;
+ dtPolyRef* newData = (dtPolyRef*)dtAlloc(m_cap*sizeof(dtPolyRef), DT_ALLOC_TEMP);
+ if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(dtPolyRef));
+ dtFree(m_data);
+ m_data = newData;
+ }
+ m_size = n;
+ }
+ inline void push(int item) { resize(m_size+1); m_data[m_size-1] = item; }
+ inline dtPolyRef pop() { if (m_size > 0) m_size--; return m_data[m_size]; }
+ inline const dtPolyRef& operator[](int i) const { return m_data[i]; }
+ inline dtPolyRef& operator[](int i) { return m_data[i]; }
+ inline int size() const { return m_size; }
+};
+
+
+
+
+class NavmeshFlags
+{
+ struct TileFlags
+ {
+ inline void purge() { dtFree(flags); }
+ unsigned char* flags;
+ int nflags;
+ dtPolyRef base;
+ };
+
+ const dtNavMesh* m_nav;
+ TileFlags* m_tiles;
+ int m_ntiles;
+
+public:
+ NavmeshFlags() :
+ m_nav(0), m_tiles(0), m_ntiles(0)
+ {
+ }
+
+ ~NavmeshFlags()
+ {
+ for (int i = 0; i < m_ntiles; ++i)
+ m_tiles[i].purge();
+ dtFree(m_tiles);
+ }
+
+ bool init(const dtNavMesh* nav)
+ {
+ m_ntiles = nav->getMaxTiles();
+ if (!m_ntiles)
+ return true;
+ m_tiles = (TileFlags*)dtAlloc(sizeof(TileFlags)*m_ntiles, DT_ALLOC_TEMP);
+ if (!m_tiles)
+ {
+ return false;
+ }
+ memset(m_tiles, 0, sizeof(TileFlags)*m_ntiles);
+
+ // Alloc flags for each tile.
+ for (int i = 0; i < nav->getMaxTiles(); ++i)
+ {
+ const dtMeshTile* tile = nav->getTile(i);
+ if (!tile->header) continue;
+ TileFlags* tf = &m_tiles[i];
+ tf->nflags = tile->header->polyCount;
+ tf->base = nav->getPolyRefBase(tile);
+ if (tf->nflags)
+ {
+ tf->flags = (unsigned char*)dtAlloc(tf->nflags, DT_ALLOC_TEMP);
+ if (!tf->flags)
+ return false;
+ memset(tf->flags, 0, tf->nflags);
+ }
+ }
+
+ m_nav = nav;
+
+ return false;
+ }
+
+ inline void clearAllFlags()
+ {
+ for (int i = 0; i < m_ntiles; ++i)
+ {
+ TileFlags* tf = &m_tiles[i];
+ if (tf->nflags)
+ memset(tf->flags, 0, tf->nflags);
+ }
+ }
+
+ inline unsigned char getFlags(dtPolyRef ref)
+ {
+ dtAssert(m_nav);
+ dtAssert(m_ntiles);
+ // Assume the ref is valid, no bounds checks.
+ unsigned int salt, it, ip;
+ m_nav->decodePolyId(ref, salt, it, ip);
+ return m_tiles[it].flags[ip];
+ }
+
+ inline void setFlags(dtPolyRef ref, unsigned char flags)
+ {
+ dtAssert(m_nav);
+ dtAssert(m_ntiles);
+ // Assume the ref is valid, no bounds checks.
+ unsigned int salt, it, ip;
+ m_nav->decodePolyId(ref, salt, it, ip);
+ m_tiles[it].flags[ip] = flags;
+ }
+
+};
+
+static void floodNavmesh(dtNavMesh* nav, NavmeshFlags* flags, dtPolyRef start, unsigned char flag)
+{
+ // If already visited, skip.
+ if (flags->getFlags(start))
+ return;
+
+ PolyRefArray openList;
+ openList.push(start);
+
+ while (openList.size())
+ {
+ const dtPolyRef ref = openList.pop();
+ // Get current poly and tile.
+ // The API input has been cheked already, skip checking internal data.
+ const dtMeshTile* tile = 0;
+ const dtPoly* poly = 0;
+ nav->getTileAndPolyByRefUnsafe(ref, &tile, &poly);
+
+ // Visit linked polygons.
+ for (unsigned int i = poly->firstLink; i != DT_NULL_LINK; i = tile->links[i].next)
+ {
+ const dtPolyRef neiRef = tile->links[i].ref;
+ // Skip invalid and already visited.
+ if (!neiRef || flags->getFlags(neiRef))
+ continue;
+ // Mark as visited
+ flags->setFlags(neiRef, flag);
+ // Visit neighbours
+ openList.push(neiRef);
+ }
+ }
+}
+
+static void disableUnvisitedPolys(dtNavMesh* nav, NavmeshFlags* flags)
+{
+ for (int i = 0; i < nav->getMaxTiles(); ++i)
+ {
+ const dtMeshTile* tile = ((const dtNavMesh*)nav)->getTile(i);
+ if (!tile->header) continue;
+ const dtPolyRef base = nav->getPolyRefBase(tile);
+ for (int j = 0; j < tile->header->polyCount; ++j)
+ {
+ const dtPolyRef ref = base | (unsigned int)j;
+ if (!flags->getFlags(ref))
+ {
+ unsigned short f = 0;
+ nav->getPolyFlags(ref, &f);
+ nav->setPolyFlags(ref, f | SAMPLE_POLYFLAGS_DISABLED);
+ }
+ }
+ }
+}
+
+NavmeshPruneTool::NavmeshPruneTool() :
+ m_flags(0),
+ m_hitPosSet(false)
+{
+}
+
+NavmeshPruneTool::~NavmeshPruneTool()
+{
+ delete m_flags;
+}
+
+void NavmeshPruneTool::init(Sample* sample)
+{
+ m_sample = sample;
+}
+
+void NavmeshPruneTool::reset()
+{
+ m_hitPosSet = false;
+ delete m_flags;
+ m_flags = 0;
+}
+
+void NavmeshPruneTool::handleMenu()
+{
+ dtNavMesh* nav = m_sample->getNavMesh();
+ if (!nav) return;
+ if (!m_flags) return;
+
+ if (imguiButton("Clear Selection"))
+ {
+ m_flags->clearAllFlags();
+ }
+
+ if (imguiButton("Prune Unselected"))
+ {
+ disableUnvisitedPolys(nav, m_flags);
+ delete m_flags;
+ m_flags = 0;
+ }
+}
+
+void NavmeshPruneTool::handleClick(const float* /*s*/, const float* p, bool shift)
+{
+ if (!m_sample) return;
+ InputGeom* geom = m_sample->getInputGeom();
+ if (!geom) return;
+ dtNavMesh* nav = m_sample->getNavMesh();
+ if (!nav) return;
+ dtNavMeshQuery* query = m_sample->getNavMeshQuery();
+ if (!query) return;
+
+ dtVcopy(m_hitPos, p);
+ m_hitPosSet = true;
+
+ if (!m_flags)
+ {
+ m_flags = new NavmeshFlags;
+ m_flags->init(nav);
+ }
+
+ const float ext[3] = {2,4,2};
+ dtQueryFilter filter;
+ dtPolyRef ref = 0;
+ query->findNearestPoly(p, ext, &filter, &ref, 0);
+
+ floodNavmesh(nav, m_flags, ref, 1);
+}
+
+void NavmeshPruneTool::handleToggle()
+{
+}
+
+void NavmeshPruneTool::handleStep()
+{
+}
+
+void NavmeshPruneTool::handleUpdate(const float /*dt*/)
+{
+}
+
+void NavmeshPruneTool::handleRender()
+{
+ DebugDrawGL dd;
+
+ if (m_hitPosSet)
+ {
+ const float s = m_sample->getAgentRadius();
+ const unsigned int col = duRGBA(255,255,255,255);
+ dd.begin(DU_DRAW_LINES);
+ dd.vertex(m_hitPos[0]-s,m_hitPos[1],m_hitPos[2], col);
+ dd.vertex(m_hitPos[0]+s,m_hitPos[1],m_hitPos[2], col);
+ dd.vertex(m_hitPos[0],m_hitPos[1]-s,m_hitPos[2], col);
+ dd.vertex(m_hitPos[0],m_hitPos[1]+s,m_hitPos[2], col);
+ dd.vertex(m_hitPos[0],m_hitPos[1],m_hitPos[2]-s, col);
+ dd.vertex(m_hitPos[0],m_hitPos[1],m_hitPos[2]+s, col);
+ dd.end();
+ }
+
+ const dtNavMesh* nav = m_sample->getNavMesh();
+ if (m_flags && nav)
+ {
+ for (int i = 0; i < nav->getMaxTiles(); ++i)
+ {
+ const dtMeshTile* tile = nav->getTile(i);
+ if (!tile->header) continue;
+ const dtPolyRef base = nav->getPolyRefBase(tile);
+ for (int j = 0; j < tile->header->polyCount; ++j)
+ {
+ const dtPolyRef ref = base | (unsigned int)j;
+ if (m_flags->getFlags(ref))
+ {
+ duDebugDrawNavMeshPoly(&dd, *nav, ref, duRGBA(255,255,255,128));
+ }
+ }
+ }
+ }
+
+}
+
+void NavmeshPruneTool::handleRenderOverlay(double* proj, double* model, int* view)
+{
+ // Tool help
+ const int h = view[3];
+
+ imguiDrawText(280, h-40, IMGUI_ALIGN_LEFT, "LMB: Click fill area.", imguiRGBA(255,255,255,192));
+
+}
View
3  WCell-Terrain/Terra/Terra.csproj.vs10x
@@ -1,3 +0,0 @@
-This file contains Alternate Data Streams, storing configuration information used by CodeSMART 10 and VS10X Extensions.
-
-PLEASE DO NOT DELETE.
View
11 WCell-Terrain/WCell.Terrain.Extractor/Extractor.cs
@@ -118,6 +118,7 @@ public static void ExtractAllADTs()
public static void CreateAndWriteAllMeshes()
{
+ GC.AddMemoryPressure(int.MaxValue);
foreach (MapId mapId in Enum.GetValues(typeof(MapId)))
{
var name = TileIdentifier.GetName(mapId);
@@ -143,13 +144,14 @@ public static void CreateAndWriteAllMeshes()
var adt = WDT.LoadTile(mapId, tileX, tileY);
if (adt != null)
{
- // try loading again
+ // try loading
Console.WriteLine(@"Loading extracted tile and generating Navigation mesh...");
terrain.ForceLoadTile(tileX, tileY);
if (terrain.IsAvailable(tileX, tileY))
{
Console.WriteLine(@"Done. Tile ({0}, {1}) in Map {2} has been loaded successfully.", tileX, tileY, mapId);
+ terrain.Tiles[tileX, tileY] = null;
continue;
}
}
@@ -157,11 +159,18 @@ public static void CreateAndWriteAllMeshes()
catch (ArgumentException)
{
}
+ catch(OutOfMemoryException)
+ {
+ GC.Collect();
+ tileY--;
+ continue;
+ }
Console.WriteLine(@"Extracting FAILED: Tile ({0}, {1}) in Map {2} could not be loaded", tileX, tileY, mapId);
}
}
}
+ GC.RemoveMemoryPressure(int.MaxValue);
}
}
}
View
3  WCell-Terrain/WCell.Terrain.sln
@@ -20,6 +20,9 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WCell.RealmServer", "..\Services\WCell.RealmServer\WCell.RealmServer.csproj", "{A38FAA6D-86B5-4429-85D0-BC93EB5E2C56}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WCell.Terrain.Extractor", "WCell.Terrain.Extractor\WCell.Terrain.Extractor.csproj", "{B02815C5-A0CB-443F-A005-8AC8F8F2D3EB}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7097CF5A-3389-45BD-93B3-EA9AB09286F4} = {7097CF5A-3389-45BD-93B3-EA9AB09286F4}
+ EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WCell.Addons.Terrain", "..\Addons\WCell.Addons.Terrain\WCell.Addons.Terrain.csproj", "{6C52AEC1-2920-4E34-83A2-93E6E719D1B8}"
EndProject
View
17 WCell.sln
@@ -170,6 +170,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packets", "Packets", "{D18C
Run\Content\Packets\World.xml = Run\Content\Packets\World.xml
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IRCAddon", "Addons\WCell.IrcAddon\IRCAddon.csproj", "{E8F36B44-3596-42A5-9380-4386CF04EDD6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -422,6 +424,16 @@ Global
{5F96293A-1276-4515-8048-EBC49CD81D71}.Release|x64.Build.0 = Release|x64
{5F96293A-1276-4515-8048-EBC49CD81D71}.Release|x86.ActiveCfg = Release|x86
{5F96293A-1276-4515-8048-EBC49CD81D71}.Release|x86.Build.0 = Release|x86
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Debug|Itanium.ActiveCfg = Debug|Any CPU
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Release|Itanium.ActiveCfg = Release|Any CPU
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Release|x64.ActiveCfg = Release|Any CPU
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -441,6 +453,7 @@ Global
{42F497A4-0347-491D-8FA8-50E4D8AD19EB} = {372CB0F3-1BA6-4157-8CCB-E10D0912AD02}
{71AB07AD-4D94-4693-8560-47862E5B6E61} = {372CB0F3-1BA6-4157-8CCB-E10D0912AD02}
{38846B91-92C5-4ED0-A77C-5480FA06EDBE} = {A5244776-5B87-4499-A1BA-4CC318FDAAE0}
+ {E8F36B44-3596-42A5-9380-4386CF04EDD6} = {A5244776-5B87-4499-A1BA-4CC318FDAAE0}
{F753AF28-A251-4C12-9335-07E8236184F2} = {E858B607-246D-4056-A56E-A27312A4FDEE}
{009B84F0-3E1E-4674-9318-7B6BECF748E1} = {352C7D18-D5CA-41EA-815F-65DECA33D17E}
{22AD2989-C47E-499D-B4EB-72A2D43EF5B7} = {352C7D18-D5CA-41EA-815F-65DECA33D17E}
@@ -450,9 +463,9 @@ Global
{B6E8E045-B27D-47A8-A2F1-94B7BB351A80} = {009B84F0-3E1E-4674-9318-7B6BECF748E1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- UnLocked = True
- Locked = False
ISWCFSolution = True
+ Locked = False
+ UnLocked = True
EndGlobalSection
GlobalSection(TextTemplating) = postSolution
TextTemplating = 1
Please sign in to comment.
Something went wrong with that request. Please try again.