From d451122521975c8cfddae971ee37ee849d1cd7f2 Mon Sep 17 00:00:00 2001 From: Walter Julius Hennecke Date: Sun, 9 Mar 2014 22:17:37 +0100 Subject: [PATCH] reformatting --- dlls/game/gotoHelperNodeEX.hpp | 304 ++++++++++++++++----------------- 1 file changed, 147 insertions(+), 157 deletions(-) diff --git a/dlls/game/gotoHelperNodeEX.hpp b/dlls/game/gotoHelperNodeEX.hpp index 71f869d..049dee5 100644 --- a/dlls/game/gotoHelperNodeEX.hpp +++ b/dlls/game/gotoHelperNodeEX.hpp @@ -1,157 +1,147 @@ -//----------------------------------------------------------------------------- -// -// $Logfile:: /Code/DLLs/game/gotoHelperNodeEX.hpp $ -// $Revision:: 169 $ -// $Author:: sketcher $ -// $Date:: 4/26/02 2:22p $ -// -// Copyright (C) 2002 by Ritual Entertainment, Inc. -// All rights reserved. -// -// This source may not be distributed and/or modified without -// expressly written permission by Ritual Entertainment, Inc. -// -// -// DESCRIPTION: -// gotoHelperNodeEX Behavior Definition -// -//-------------------------------------------------------------------------------- - -//============================== -// Forward Declarations -//============================== -class GotoHelperNodeEX; - -#ifndef __GOTO_HELPER_NODE_EX___ -#define __GOTO_HELPER_NODE_EX___ - -#include "behavior.h" -#include "behaviors_general.h" - -//------------------------- CLASS ------------------------------ -// -// Name: GotoHelperNodeEX -// Base Class: Behavior -// -// Description: Moves the Actor to the closest appropriate -// helper node, using data from the GPDB -// -// Method of Use: Called From State Machine -//-------------------------------------------------------------- -class GotoHelperNodeEX : public Behavior - { - //------------------------------------ - // States - //------------------------------------ - public: - typedef enum - { - GOTO_HNODE_FIND_NODE, - GOTO_HNODE_MOVE_TO_NODE, - GOTO_HNODE_SUCCESS, - GOTO_HNODE_FAILED - } GotoHelperNodeStates_t; - - //------------------------------------ - // Parameters - //------------------------------------ - private: - str _nodeType; - str _movementAnim; - HelperNodePtr _node; - float _maxDistance; - - //------------------------------------- - // Internal Functionality - //------------------------------------- - protected: - void transitionToState ( GotoHelperNodeStates_t state ); - void setInternalState ( GotoHelperNodeStates_t state , const str &stateName ); - void init ( Actor &self ); - void think (); - - - void setupStateMoveToNode (); - BehaviorReturnCode_t evaluateStateMoveToNode (); - void failureStateFindNode ( const str& failureReason ); - - void setupStateFindNode (); - BehaviorReturnCode_t evaluateStateFindNode (); - void failureStateMoveToNode ( const str& failureReason ); - - //------------------------------------- - // Public Interface - //------------------------------------- - public: - CLASS_PROTOTYPE( GotoHelperNodeEX ); - - GotoHelperNodeEX(); - ~GotoHelperNodeEX(); - - void SetArgs ( Event *ev ); - void AnimDone ( Event *ev ); - - void Begin ( Actor &self ); - BehaviorReturnCode_t Evaluate ( Actor &self ); - void End ( Actor &self ); - - // Accessors - void SetNode ( HelperNode *node ); - void SetMovementAnim ( const str &anim ); - - - virtual void Archive ( Archiver &arc ); - - //------------------------------------- - // Components - //------------------------------------- - private: - GotoPoint _gotoPoint; - - - //------------------------------------- - // Member Variables - //------------------------------------- - private: - GotoHelperNodeStates_t _state; - - static const float NODE_RADIUS; - - }; - -inline void GotoHelperNodeEX::SetNode ( HelperNode *node ) -{ - assert ( node ); - _node = node; -} - -inline void GotoHelperNodeEX::SetMovementAnim ( const str &anim ) -{ - _movementAnim = anim; -} - - -inline void GotoHelperNodeEX::Archive( Archiver &arc ) -{ - Behavior::Archive ( arc ); - - // - // Archive Parameters - // - arc.ArchiveString( &_nodeType ); - arc.ArchiveString( &_movementAnim ); - arc.ArchiveSafePointer( &_node ); - arc.ArchiveFloat ( &_maxDistance ); - // - // Archive Components - // - arc.ArchiveObject ( &_gotoPoint ); - - // - // Archive Member Variables - // - ArchiveEnum ( _state, GotoHelperNodeStates_t ); -} - -#endif /* __GOTO_HELPER_NODE_EX___ */ - +//----------------------------------------------------------------------------- +// +// $Logfile:: /Code/DLLs/game/gotoHelperNodeEX.hpp $ +// $Revision:: 169 $ +// $Author:: sketcher $ +// $Date:: 4/26/02 2:22p $ +// +// Copyright (C) 2002 by Ritual Entertainment, Inc. +// All rights reserved. +// +// This source may not be distributed and/or modified without +// expressly written permission by Ritual Entertainment, Inc. +// +// +// DESCRIPTION: +// gotoHelperNodeEX Behavior Definition +// +//-------------------------------------------------------------------------------- + +//============================== +// Forward Declarations +//============================== +class GotoHelperNodeEX; + +#ifndef __GOTO_HELPER_NODE_EX___ +#define __GOTO_HELPER_NODE_EX___ + +#include "behavior.h" +#include "behaviors_general.h" + +//------------------------- CLASS ------------------------------ +// +// Name: GotoHelperNodeEX +// Base Class: Behavior +// +// Description: Moves the Actor to the closest appropriate +// helper node, using data from the GPDB +// +// Method of Use: Called From State Machine +//-------------------------------------------------------------- +class GotoHelperNodeEX : public Behavior { + public: + //------------------------------------ + // States + //------------------------------------ + typedef enum { + GOTO_HNODE_FIND_NODE, + GOTO_HNODE_MOVE_TO_NODE, + GOTO_HNODE_SUCCESS, + GOTO_HNODE_FAILED + } GotoHelperNodeStates_t; + + //------------------------------------- + // Public Interface + //------------------------------------- + CLASS_PROTOTYPE(GotoHelperNodeEX); + + GotoHelperNodeEX(); + ~GotoHelperNodeEX(); + + void SetArgs(Event* ev); + void AnimDone(Event* ev); + + void Begin(Actor& self); + BehaviorReturnCode_t Evaluate(Actor& self); + void End(Actor& self); + + // Accessors + void SetNode(HelperNode* node); + void SetMovementAnim(const str& anim); + + + virtual void Archive(Archiver& arc); + + protected: + //------------------------------------- + // Internal Functionality + //------------------------------------- + void transitionToState(GotoHelperNodeStates_t state); + void setInternalState(GotoHelperNodeStates_t state, const str& stateName); + void init(Actor& self); + void think(); + + void setupStateMoveToNode(); + BehaviorReturnCode_t evaluateStateMoveToNode(); + void failureStateFindNode(const str& failureReason); + + void setupStateFindNode(); + BehaviorReturnCode_t evaluateStateFindNode(); + void failureStateMoveToNode(const str& failureReason); + + private: + //------------------------------------ + // Parameters + //------------------------------------ + str _nodeType; + str _movementAnim; + HelperNodePtr _node; + float _maxDistance; + + //------------------------------------- + // Components + //------------------------------------- + GotoPoint _gotoPoint; + + //------------------------------------- + // Member Variables + //------------------------------------- + GotoHelperNodeStates_t _state; + + static const float NODE_RADIUS; + +}; + +inline void GotoHelperNodeEX::SetNode(HelperNode* node) { + assert(node); + _node = node; +} + +inline void GotoHelperNodeEX::SetMovementAnim(const str& anim) { + _movementAnim = anim; +} + + +inline void GotoHelperNodeEX::Archive(Archiver& arc) { + Behavior::Archive(arc); + + // + // Archive Parameters + // + arc.ArchiveString(&_nodeType); + arc.ArchiveString(&_movementAnim); + arc.ArchiveSafePointer(&_node); + arc.ArchiveFloat(&_maxDistance); + // + // Archive Components + // + arc.ArchiveObject(&_gotoPoint); + + // + // Archive Member Variables + // + ArchiveEnum(_state, GotoHelperNodeStates_t); +} + +#endif /* __GOTO_HELPER_NODE_EX___ */ +