diff --git a/.gitignore b/.gitignore index 75b1186..467fe91 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,6 @@ Intermediate/* # Cache files for the editor to use DerivedDataCache/* + +# OS X +.DS_Store diff --git a/README.md b/README.md index 81f2dd7..31fdf8a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -# Cover Generator +# Message from fork owner: + +I'm doing some changes for this plugin, such as minor fixes and optimizations, more EQS tests, maybe something else. + +# Cover Generator The cover generator is a plugin for Unreal Engine 4. diff --git a/Source/CoverGenerator/Private/EnvQuery/Generators/EnvQueryGenerator_CoverFMemory.cpp b/Source/CoverGenerator/Private/EnvQuery/Generators/EnvQueryGenerator_CoverFMemory.cpp index b7c818e..76a96bd 100644 --- a/Source/CoverGenerator/Private/EnvQuery/Generators/EnvQueryGenerator_CoverFMemory.cpp +++ b/Source/CoverGenerator/Private/EnvQuery/Generators/EnvQueryGenerator_CoverFMemory.cpp @@ -14,7 +14,7 @@ UEnvQueryGenerator_CoverFMemory::UEnvQueryGenerator_CoverFMemory(const FObjectIn ItemType = UEnvQueryItemType_Cover::StaticClass(); GenerateAround = UEnvQueryContext_Querier::StaticClass(); SquareExtent.DefaultValue = 750.f; - BoxHeight.DefaultValue = 200.f; + BoxHeight.DefaultValue = 400.f; } @@ -41,7 +41,7 @@ void UEnvQueryGenerator_CoverFMemory::GenerateItems(FEnvQueryInstance& QueryInst for (int32 ContextIndex = 0; ContextIndex < ContextLocations.Num(); ContextIndex++) { - TArray Covers = CoverGenerator->GetCoverWithinBounds(FBoxCenterAndExtent(ContextLocations[ContextIndex], FVector(SquareE, SquareE, BoxH))); + TArray Covers = CoverGenerator->GetCoverWithinBounds(FBoxCenterAndExtent(ContextLocations[ContextIndex] - FVector(0.f, 0.f, BoxH / 2), FVector(SquareE, SquareE, BoxH))); QueryInstance.AddItemData(Covers); } } diff --git a/Source/CoverGenerator/Private/EnvQuery/Tests/EnvQueryTest_FilterCoverPoints.cpp b/Source/CoverGenerator/Private/EnvQuery/Tests/EnvQueryTest_FilterCoverPoints.cpp new file mode 100644 index 0000000..d69a571 --- /dev/null +++ b/Source/CoverGenerator/Private/EnvQuery/Tests/EnvQueryTest_FilterCoverPoints.cpp @@ -0,0 +1,64 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#include "CoverGeneratorPrivatePCH.h" +#include "EnvQueryTest_FilterCoverPoints.h" +#include "EnvQueryItemType_Cover.h" + + +UEnvQueryTest_FilterCoverPoints::UEnvQueryTest_FilterCoverPoints(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) +{ + Cost = EEnvTestCost::Low; + ValidItemType = UEnvQueryItemType_Cover::StaticClass(); + SetWorkOnFloatValues(false); +} + +void UEnvQueryTest_FilterCoverPoints::RunTest(FEnvQueryInstance& QueryInstance) const +{ + UObject* QueryOwner = QueryInstance.Owner.Get(); + if (QueryOwner == nullptr) + { + return; + } + + BoolValue.BindData(QueryOwner, QueryInstance.QueryID); + bool bWantsValid = BoolValue.GetValue(); + + for (FEnvQueryInstance::ItemIterator It(this, QueryInstance); It; ++It) + { + UCoverPoint* CurrentCoverPoint = UEnvQueryItemType_Cover::GetValue(QueryInstance.RawData.GetData() + QueryInstance.Items[It.GetIndex()].DataOffset); + + bool Uno = false; + if (bFrontCoverCrouched) + { + Uno = CurrentCoverPoint->bFrontCoverCrouched && !CurrentCoverPoint->bLeftCoverStanding && !CurrentCoverPoint->bRightCoverStanding; + } + + bool Dos = false; + if (bLeftCoverCrouched) + { + Dos = CurrentCoverPoint->bLeftCoverCrouched && !CurrentCoverPoint->bLeftCoverStanding && !CurrentCoverPoint->bRightCoverStanding; + } + + bool Tres = false; + if (bRightCoverCrouched) + { + Tres = CurrentCoverPoint->bRightCoverCrouched && !CurrentCoverPoint->bLeftCoverStanding && !CurrentCoverPoint->bRightCoverStanding; + } + + bool Cuatro = false; + if (bLeftCoverStanding) + { + Cuatro = CurrentCoverPoint->bLeftCoverStanding; + } + + bool Cinco = false; + if (bRightCoverStanding) + { + Cinco = CurrentCoverPoint->bRightCoverStanding; + } + + bool bCoverWithFilter = Uno || Dos || Tres || Cuatro || Cinco; + + It.SetScore(TestPurpose, FilterType, bCoverWithFilter, bWantsValid); + } +} diff --git a/Source/CoverGenerator/Public/EnvQuery/Tests/EnvQueryTest_FilterCoverPoints.h b/Source/CoverGenerator/Public/EnvQuery/Tests/EnvQueryTest_FilterCoverPoints.h new file mode 100644 index 0000000..74e0f35 --- /dev/null +++ b/Source/CoverGenerator/Public/EnvQuery/Tests/EnvQueryTest_FilterCoverPoints.h @@ -0,0 +1,36 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "EnvironmentQuery/EnvQueryTest.h" +#include "EnvQueryTest_FilterCoverPoints.generated.h" + +/** + * + */ +UCLASS() +class COVERGENERATOR_API UEnvQueryTest_FilterCoverPoints : public UEnvQueryTest +{ + GENERATED_UCLASS_BODY() + + //UPROPERTY(EditDefaultsOnly, Category = Filter) + //bool bAllFlagsTogether = true; + + UPROPERTY(EditDefaultsOnly, Category = Filter) + bool bFrontCoverCrouched; + + UPROPERTY(EditDefaultsOnly, Category = Filter) + bool bLeftCoverCrouched; + + UPROPERTY(EditDefaultsOnly, Category = Filter) + bool bRightCoverCrouched; + + UPROPERTY(EditDefaultsOnly, Category = Filter) + bool bLeftCoverStanding; + + UPROPERTY(EditDefaultsOnly, Category = Filter) + bool bRightCoverStanding; + + virtual void RunTest(FEnvQueryInstance& QueryInstance) const override; + +};