Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<!-- Every [SourceDll] assembly links Usings/GlobalUsings.cs. Those get the ConVar/ConCommand registration generator,
which emits Source.Generated.CvarRegistration for EngineBuilder.ConVar_Register to use instead of reflection. -->
<ItemGroup Condition="'@(Compile->WithMetadataValue('Identity', '..\Usings\GlobalUsings.cs'))' != ''">
<ProjectReference Include="$(MSBuildThisFileDirectory)Source.CodeAnalysis.ConVars\Source.CodeAnalysis.ConVars.csproj" PrivateAssets="all" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
</ItemGroup>
</Project>
7 changes: 6 additions & 1 deletion Game.Client/IClientLeafSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Source.Common.Engine;

using System.Numerics;
using System.Runtime.InteropServices;

namespace Game.Client;

Expand Down Expand Up @@ -32,7 +33,11 @@ public struct Entry
public readonly int[] RenderGroupCounts = new int[RENDER_GROUP_COUNT];

public void Init() {
Array.Clear(RenderGroups);
for (int i = 0; i < RENDER_GROUP_COUNT; i++) {
int count = RenderGroupCounts[i];
if (count > 0)
MemoryMarshal.CreateSpan(ref RenderGroups[i, 0], count).Clear();
}
Array.Clear(RenderGroupCounts);
}

Expand Down
4 changes: 2 additions & 2 deletions Game.Server/AI_BaseNPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6674,11 +6674,11 @@ public void CheckTarget(BaseEntity target) {
UpdateTargetPos();
}

public void RememberUnreachable(BaseEntity entity, float duration = -1) {
public void RememberUnreachable(BaseEntity entity, TimeUnit_t duration = -1) {
if (entity == GetEnemy())
ForceChooseNewEnemy();

float NPC_UNREACHABLE_TIMEOUT = (duration > 0.0) ? duration : 3;
TimeUnit_t NPC_UNREACHABLE_TIMEOUT = (duration > 0.0) ? duration : 3;
for (int i = UnreachableEnts.Count - 1; i >= 0; i--) {
if (entity == UnreachableEnts[i].UnreachableEntity.Get()) {
UnreachableEnt existing = UnreachableEnts[i];
Expand Down
33 changes: 28 additions & 5 deletions Game.Server/BaseFlex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
using System.Numerics;

namespace Game.Server;

using FIELD = Source.FIELD<BaseFlex>;
using EventType = Game.Shared.ChoreoEvent.EventType;

[LinkEntityToClass("funCBaseFlex")]
[NetworkName("CBaseFlex")]
public class BaseFlex : BaseAnimatingOverlay {
public class BaseFlex : BaseAnimatingOverlay
{
public static readonly SendTable DT_BaseFlex = new(DT_BaseAnimatingOverlay, [
SendPropArray3 (FIELD.OF_ARRAY(nameof(FlexWeight)), SendPropFloat(FIELD.OF_ARRAY(nameof(FlexWeight)), 12, PropFlags.RoundDown, 0.0f, 1.0f )),
SendPropInt (FIELD.OF(nameof(BlinkToggle)), 1, PropFlags.Unsigned ),
Expand Down Expand Up @@ -286,7 +288,7 @@ public void AddSceneEvent(ChoreoScene? scene, ChoreoEvent? ev, BaseEntity? targe

ChoreoActor? actor = ev.GetActor();
if (actor == null) {
Msg("CBaseFlex::AddSceneEvent: event->GetActor() was NULL!!!\n");
Msg("CBaseFlex::AddSceneEvent: event.GetActor() was NULL!!!\n");
return;
}

Expand Down Expand Up @@ -434,7 +436,7 @@ bool HandleStartGestureSceneEvent(SceneEventInfo info, ChoreoScene scene, Choreo
EventAbsoluteTag? origTag = ev.FindAbsoluteTag(ChoreoEvent.AbsTagType.Original, kvTags.Name);
if (origTag != null) {
if (MathF.Abs(origTag.GetPercentage() - percentage) > 0.05) {
DevWarning($"{scene.GetFilename()} repositioned tag: {kvTags.Name} : {origTag.GetPercentage():F3} -> {percentage:F3} ({scene.GetFilename()}:{actor.GetName()}:{ev.GetParameters()})\n");
DevWarning($"{scene.GetFilename()} repositioned tag: {kvTags.Name} : {origTag.GetPercentage():F3} . {percentage:F3} ({scene.GetFilename()}:{actor.GetName()}:{ev.GetParameters()})\n");
origTag.SetPercentage(percentage);
}
}
Expand Down Expand Up @@ -830,10 +832,31 @@ bool ProcessMoveToSceneEvent(SceneEventInfo info, ChoreoScene scene, ChoreoEvent
if (ev.GetForceShortMovement())
distTolerance = 0.1f;

AI_NavGoal goal = new AI_NavGoal(NavGoalType.TargetEnt, moveActivity, distTolerance, AI_NavGoalFlags.UpdateTargetPos);
float dist = (info.Target.Get()!.EyePosition() - GetAbsOrigin()).Length2D();

if (dist > Math.Max(Math.Max(distTolerance, 0.1f), ev.GetDistanceToTarget()))
throw new NotImplementedException();
if (dist > Math.Max(Math.Max(distTolerance, 0.1f), ev.GetDistanceToTarget())) {
bool result = false;

if (!myNpc.IsUnreachable(info.Target.Get()!)) {
result = myNpc.GetNavigator()!.SetGoal(in goal, AI_NavSetGoalFlags.ClearTarget);
if (!result)
myNpc.RememberUnreachable(info.Target.Get()!, 1.5);
}

if (result) {
myNpc.GetNavigator()!.SetMovementActivity(moveActivity);
myNpc.GetNavigator()!.SetArrivalDistance(ev.GetDistanceToTarget());
info.IsMoving = true;
}
else {
if (developer.GetInt() > 0 && scene_showmoveto.GetBool()) {
myNpc.GetMoveProbe()!.FloorPoint(info.Target.Get()!.EyePosition(), Mask.NPCSolid, 0, -64, out Vector3 testPoint);
DebugOverlay.HorzArrow(GetAbsOrigin() + new Vector3(0, 0, 1), testPoint + new Vector3(0, 0, 1), 4, 255, 0, 255, 0, false, 0.12f);
DebugOverlay.Box(testPoint, myNpc.GetHullMins(), myNpc.GetHullMaxs(), 255, 0, 255, 0, 0.12f);
}
}
}
else
info.HasArrived = true;
}
Expand Down
Loading
Loading