From bc2cd13cc132251abcea3bd0e9ce66e1fc21f35e Mon Sep 17 00:00:00 2001 From: Kevin Poretti Date: Tue, 17 Sep 2024 20:55:40 -0400 Subject: [PATCH] Good ol' documentation --- .../Input/FFPlayerController.h | 9 +++- .../UnrealFightingFramework/State/FFState.h | 52 ++++++++++++++++--- .../State/FFStateMachineComponent.h | 26 ++++++++-- 3 files changed, 73 insertions(+), 14 deletions(-) diff --git a/Source/UnrealFightingFramework/Input/FFPlayerController.h b/Source/UnrealFightingFramework/Input/FFPlayerController.h index f436614..952e0a1 100644 --- a/Source/UnrealFightingFramework/Input/FFPlayerController.h +++ b/Source/UnrealFightingFramework/Input/FFPlayerController.h @@ -54,10 +54,15 @@ public: UFUNCTION(BlueprintPure) bool HasMoveInput(); - // TODO: document + /** + * @brief Zeroes out the raw movement axes after input has been processed + */ void ConsumeMoveInput(); - // TODO: document + /** + * @brief Adds the current state of the player input to the input buffer for processing and + * interpretation after input has been cleaned + */ void AddCurrentInputToBuffer(); // IFFStateOwnerInterface diff --git a/Source/UnrealFightingFramework/State/FFState.h b/Source/UnrealFightingFramework/State/FFState.h index 2481d2e..27198cd 100644 --- a/Source/UnrealFightingFramework/State/FFState.h +++ b/Source/UnrealFightingFramework/State/FFState.h @@ -35,6 +35,11 @@ struct FFFStateContext DECLARE_DYNAMIC_DELEGATE_OneParam(FFFInputEventDelegate, const FFFStateContext&, InStateContext); +/* + * TODO: check if this is even used anymore and if not delete? I recall using this in a few + * states/actions but it was a pain to use and I switched to checking an input sequence directly in + * a state's update function + */ USTRUCT(BlueprintType) struct FFFInputEventHandler { @@ -52,10 +57,15 @@ struct FFFInputEventHandler UENUM(BlueprintType) enum class EFFStateFinishReason : uint8 { - // TODO: document + /** State ended due to another state's entry condition being satisfied */ SFT_Interrupted UMETA(DisplayName="Interrupted"), + + /** State ended because the number of ticks in this state exceeded state's duration property */ SFT_DurationMetOrExceeded UMETA(DisplayName="Duration Reached"), + + /** State ended because the owner is no longer in the movement mode required by the state */ SFT_NotInReqMovementMode UMETA(DisplayName="Not In Required Movement Mode"), + SFT_MAX UMETA(Hidden) }; @@ -187,7 +197,7 @@ public: * * Calls appropriate Blueprint hooks. * - * TODO: document StateFinishReason + * @param StateFinishReason the reason the state is ending i.e. the state's duration elapse */ virtual void Exit(const FFFStateContext& InStateContext, EFFStateFinishReason StateFinishReason); @@ -200,10 +210,25 @@ public: */ virtual void Update(float OneFrame, const FFFStateContext& InStateContext); - // TODO: document + /** + * Called whenever state owners lands on a walkable surface after they were previously falling. + * + * Calls appropriate Blueprint hooks. + * + * @param Hit Hit result for the surface that was landed on + */ virtual void Landed(const FHitResult& Hit, const FFFStateContext& InStateContext); - // TODO: document + /** + * @brief Called whenever the state's owner current movement mode changes + * + * Calls appropriate Blueprint hooks. + * + * @param PrevMovementMode previous movement mode. + * @param PreviousCustomMode previous movement mode if PrevMovementMode is MOVE_Custom + * @param NewMovementMode new movement mode + * @param NewCustomMode new movement mode if NewMovementMode is MOVE_Custom + */ virtual void MovementModeChanged(EMovementMode PrevMovementMode, uint8 PreviousCustomMode, EMovementMode NewMovementMode, uint8 NewCustomMode, const FFFStateContext& InStateContext); @@ -236,7 +261,7 @@ public: UFUNCTION(BlueprintCallable) virtual void Finish(const FFFStateContext& InStateContext, EFFStateFinishReason StateFinishReason); - // TODO: document + /** @brief Blueprint hook for when the state is first created. */ UFUNCTION(BlueprintNativeEvent, Category="UFF|State|Events") void OnInit(const FFFStateContext& InStateContext); @@ -290,11 +315,23 @@ public: UFUNCTION(BlueprintNativeEvent, Category="UFF|State|Events") void OnPlayMontage(const FFFStateContext& InStateContext); - // TODO: document + /** + * @brief Blueprint hook for whenever state owners lands on a walkable surface after they were + * previously falling. + * + * @param Hit Hit result for the surface that was landed on + */ UFUNCTION(BlueprintImplementableEvent, Category="UFF|State|Events") void OnLanded(const FHitResult& Hit, const FFFStateContext& InStateContext); - // TODO: document + /** + * @brief Blueprint hook whenever the state's owner current movement mode changes + * + * @param PrevMovementMode previous movement mode. + * @param PreviousCustomMode previous movement mode if PrevMovementMode is MOVE_Custom + * @param NewMovementMode new movement mode + * @param NewCustomMode new movement mode if NewMovementMode is MOVE_Custom + */ UFUNCTION(BlueprintImplementableEvent, Category="UFF|State|Events") void OnMovementModeChanged(EMovementMode PrevMovementMode, uint8 PreviousCustomMode, EMovementMode NewMovementMode, uint8 NewCustomMode, const FFFStateContext& InStateContext); @@ -304,6 +341,7 @@ public: UFUNCTION(BlueprintImplementableEvent, Category="UFF|State|Events") void OnAttackHit(const FHitResult& Hit, const FFFStateContext& InStateContext); + // TODO: document UFUNCTION(BlueprintImplementableEvent, Category="UFF|State|Events") void OnHitTaken(/*const FHitParams,*/ const FFFStateContext& InStateContext); diff --git a/Source/UnrealFightingFramework/State/FFStateMachineComponent.h b/Source/UnrealFightingFramework/State/FFStateMachineComponent.h index 65f9a5f..b00e849 100644 --- a/Source/UnrealFightingFramework/State/FFStateMachineComponent.h +++ b/Source/UnrealFightingFramework/State/FFStateMachineComponent.h @@ -73,7 +73,8 @@ public: * * Triggers the Exit callback on the CurrentState and the Enter callback on the new state * - * TODO: document StateFinishReason + * @param StateFinishReason the reason the current state is ending i.e. the current state's + * duration elapsed */ UFUNCTION(BlueprintCallable) void GoToState(FName NewStateName, EFFStateFinishReason StateFinishReason); @@ -83,14 +84,16 @@ public: * * Triggers the Exit callback on the CurrentState and the Enter callback on the new state * - * TODO: document StateFinishReason + * @param StateFinishReason the reason the current state is ending i.e. the current state's + * duration elapsed */ void GoToState(UFFState* NewState, EFFStateFinishReason StateFinishReason); /** * Transitions from CurrentState to the default entry state * - * TODO: document StateFinishReason + * @param StateFinishReason the reason the current state is ending i.e. the current state's + * duration elapsed */ void GoToEntryState(EFFStateFinishReason StateFinishReason); @@ -137,10 +140,23 @@ public: FFFStateContext GetCurrentStateContext(); // Events - // TODO: document + /** + * Called whenever state machine's owner lands on a walkable surface after they were previously falling. + * + * @param Hit Hit result for the surface that was landed on + */ virtual void Landed(const FHitResult& Hit); - // TODO: document + /** + * @brief Called whenever the state machine's owner current movement mode changes + * + * Calls appropriate Blueprint hooks. + * + * @param PrevMovementMode previous movement mode. + * @param PreviousCustomMode previous movement mode if PrevMovementMode is MOVE_Custom + * @param NewMovementMode new movement mode + * @param NewCustomMode new movement mode if NewMovementMode is MOVE_Custom + */ virtual void MovementModeChanged(EMovementMode PrevMovementMode, uint8 PreviousCustomMode, EMovementMode NewMovementMode, uint8 NewCustomMode);