Reformatting

This commit is contained in:
Walter Julius Hennecke 2014-03-09 02:10:14 +01:00
parent 33680e8e7a
commit f98ce24dec

View file

@ -1,326 +1,298 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Logfile:: /Code/DLLs/game/coverCombatWithRangedWeapon.hpp $ // $Logfile:: /Code/DLLs/game/coverCombatWithRangedWeapon.hpp $
// $Revision:: 169 $ // $Revision:: 169 $
// $Author:: sketcher $ // $Author:: sketcher $
// $Date:: 4/26/02 2:22p $ // $Date:: 4/26/02 2:22p $
// //
// Copyright (C) 2002 by Ritual Entertainment, Inc. // Copyright (C) 2002 by Ritual Entertainment, Inc.
// All rights reserved. // All rights reserved.
// //
// This source may not be distributed and/or modified without // This source may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc. // expressly written permission by Ritual Entertainment, Inc.
// //
// //
// DESCRIPTION: // DESCRIPTION:
// CoverCombatWithRangedWeapon Behavior Definition // CoverCombatWithRangedWeapon Behavior Definition
// //
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
//============================== //==============================
// Forward Declarations // Forward Declarations
//============================== //==============================
class CoverCombatWithRangedWeapon; class CoverCombatWithRangedWeapon;
#ifndef __COVERCOMBAT_WITH_RANGEDWEAPON_HPP__ #ifndef __COVERCOMBAT_WITH_RANGEDWEAPON_HPP__
#define __COVERCOMBAT_WITH_RANGEDWEAPON_HPP__ #define __COVERCOMBAT_WITH_RANGEDWEAPON_HPP__
#include "behavior.h" #include "behavior.h"
#include "behaviors_general.h" #include "behaviors_general.h"
//------------------------- CLASS ------------------------------ //------------------------- CLASS ------------------------------
// //
// Name: CoverCombatWithRangedWeapon // Name: CoverCombatWithRangedWeapon
// Base Class: Behavior // Base Class: Behavior
// //
// Description: // Description:
// //
// Method of Use: Called From State Machine // Method of Use: Called From State Machine
//-------------------------------------------------------------- //--------------------------------------------------------------
class CoverCombatWithRangedWeapon : public Behavior class CoverCombatWithRangedWeapon : public Behavior {
{ public:
//------------------------------------ //------------------------------------
// States // States
//------------------------------------ //------------------------------------
public: typedef enum {
typedef enum COVERCOMBAT_WRW_FIND_COVER,
{ COVERCOMBAT_WRW_FIND_BETTER_COVER,
COVERCOMBAT_WRW_FIND_COVER, COVERCOMBAT_WRW_MOVE_TO_COVER,
COVERCOMBAT_WRW_FIND_BETTER_COVER, COVERCOMBAT_WRW_CHANGE_POSTURE_DUCK,
COVERCOMBAT_WRW_MOVE_TO_COVER, COVERCOMBAT_WRW_CHANGE_POSTURE_STAND,
COVERCOMBAT_WRW_CHANGE_POSTURE_DUCK, COVERCOMBAT_WRW_FIRE_STANDING,
COVERCOMBAT_WRW_CHANGE_POSTURE_STAND, COVERCOMBAT_WRW_FIRE_PAUSE_STANDING,
COVERCOMBAT_WRW_FIRE_STANDING, COVERCOMBAT_WRW_SPOTTED,
COVERCOMBAT_WRW_FIRE_PAUSE_STANDING, COVERCOMBAT_WRW_DUCKED,
COVERCOMBAT_WRW_SPOTTED, COVERCOMBAT_WRW_STANDING,
COVERCOMBAT_WRW_DUCKED, COVERCOMBAT_WRW_SUCCESS,
COVERCOMBAT_WRW_STANDING, COVERCOMBAT_WRW_FAILED
COVERCOMBAT_WRW_SUCCESS, } coverCombatStates_t;
COVERCOMBAT_WRW_FAILED
} coverCombatStates_t; //-------------------------------------
// Public Interface
//------------------------------------ //-------------------------------------
// Parameters CLASS_PROTOTYPE(CoverCombatWithRangedWeapon);
//------------------------------------
private: CoverCombatWithRangedWeapon();
str _movementAnim; ~CoverCombatWithRangedWeapon();
str _torsoAnim;
str _fireAnim; void SetArgs(Event* ev);
float _maxDistance; void AnimDone(Event* ev);
float _fireTimeMin; void PostureDone(Event* ev);
float _fireTimeMax;
float _pauseTimeMin; void Begin(Actor& self);
float _pauseTimeMax; BehaviorReturnCode_t Evaluate(Actor& self);
void End(Actor& self);
//------------------------------------- void SetMovementAnim(const str& movementAnim);
// Internal Functionality const str& GetMovementAnim();
//-------------------------------------
protected: void SetTorsoAnim(const str& torsoAnim);
void transitionToState ( coverCombatStates_t state ); const str& GetTorsoAnim();
void setInternalState ( coverCombatStates_t state , const str &stateName );
void init ( Actor &self ); void SetFireAnim(const str& fireAnim);
void think (); const str& GetFireAnim();
void updateEnemy ();
void setTorsoAnim (); void SetMaxDistance(float maxDistance);
float GetMaxDistance();
void setupRotate();
BehaviorReturnCode_t evaluateRotate(); void SetFireTimeMin(float fireTimeMin);
float GetFireTimeMin();
void setupStateFindCover ();
BehaviorReturnCode_t evaluateStateFindCover (); void SetFireTimeMax(float fireTimeMax);
void failureStateFindCover ( const str& failureReason ); float GetFireTimeMax();
void setupStateMoveToCover (); void SetPauseTimeMin(float pauseTimeMin);
BehaviorReturnCode_t evaluateStateMoveToCover (); float GetPauseTimeMin();
void failureStateMoveToCover ( const str& failureReason );
void SetPauseTimeMax(float pauseTimeMax);
void setupStateChangePostureDuck (); float GetPauseTimeMax();
BehaviorReturnCode_t evaluateStateChangePostureDuck ();
void failureStateChangePostureDuck ( const str& failureReason ); static bool CanExecute(Actor& self, float maxDistance);
virtual void Archive(Archiver& arc);
void setupStateChangePostureStand ();
BehaviorReturnCode_t evaluateStateChangePostureStand (); protected:
void failureStateChangePostureStand ( const str& failureReason ); //-------------------------------------
// Internal Functionality
void setupStateSpotted (); //-------------------------------------
BehaviorReturnCode_t evaluateStateSpotted (); void transitionToState(coverCombatStates_t state);
void failureStateSpotted ( const str& failureReason ); void setInternalState(coverCombatStates_t state, const str& stateName);
void init(Actor& self);
void setupStateDucked (); void think();
BehaviorReturnCode_t evaluateStateDucked (); void updateEnemy();
void failureStateDucked ( const str& failureReason ); void setTorsoAnim();
void setupStateStanding (); void setupRotate();
BehaviorReturnCode_t evaluateStateStanding (); BehaviorReturnCode_t evaluateRotate();
void failureStateStanding ( const str& failureReason );
void setupStateFindCover();
void setupStateFindBetterCover (); BehaviorReturnCode_t evaluateStateFindCover();
BehaviorReturnCode_t evaluateStateFindBetterCover (); void failureStateFindCover(const str& failureReason);
void failureStateFindBetterCover ( const str& failureReason );
void setupStateMoveToCover();
void setupStateFireStanding (); BehaviorReturnCode_t evaluateStateMoveToCover();
BehaviorReturnCode_t evaluateStateFireStanding (); void failureStateMoveToCover(const str& failureReason);
void failureStateFireStanding ( const str& failureReason );
void setupStateChangePostureDuck();
void setupStateFirePauseStanding (); BehaviorReturnCode_t evaluateStateChangePostureDuck();
BehaviorReturnCode_t evaluateStateFirePauseStanding (); void failureStateChangePostureDuck(const str& failureReason);
void failureStateFirePauseStanding ( const str& failureReason );
void setupStateChangePostureStand();
BehaviorReturnCode_t evaluateStateChangePostureStand();
void failureStateChangePostureStand(const str& failureReason);
//-------------------------------------
// Public Interface void setupStateSpotted();
//------------------------------------- BehaviorReturnCode_t evaluateStateSpotted();
public: void failureStateSpotted(const str& failureReason);
CLASS_PROTOTYPE( CoverCombatWithRangedWeapon );
void setupStateDucked();
CoverCombatWithRangedWeapon(); BehaviorReturnCode_t evaluateStateDucked();
~CoverCombatWithRangedWeapon(); void failureStateDucked(const str& failureReason);
void SetArgs ( Event *ev ); void setupStateStanding();
void AnimDone ( Event *ev ); BehaviorReturnCode_t evaluateStateStanding();
void PostureDone ( Event *ev ); void failureStateStanding(const str& failureReason);
void Begin ( Actor &self ); void setupStateFindBetterCover();
BehaviorReturnCode_t Evaluate ( Actor &self ); BehaviorReturnCode_t evaluateStateFindBetterCover();
void End ( Actor &self ); void failureStateFindBetterCover(const str& failureReason);
void SetMovementAnim( const str& movementAnim ); void setupStateFireStanding();
const str& GetMovementAnim(); BehaviorReturnCode_t evaluateStateFireStanding();
void failureStateFireStanding(const str& failureReason);
void SetTorsoAnim( const str& torsoAnim );
const str& GetTorsoAnim(); void setupStateFirePauseStanding();
BehaviorReturnCode_t evaluateStateFirePauseStanding();
void SetFireAnim( const str& fireAnim ); void failureStateFirePauseStanding(const str& failureReason);
const str& GetFireAnim();
private:
void SetMaxDistance( float maxDistance ); //------------------------------------
float GetMaxDistance(); // Parameters
//------------------------------------
void SetFireTimeMin( float fireTimeMin ); str _movementAnim;
float GetFireTimeMin(); str _torsoAnim;
str _fireAnim;
void SetFireTimeMax( float fireTimeMax ); float _maxDistance;
float GetFireTimeMax(); float _fireTimeMin;
float _fireTimeMax;
void SetPauseTimeMin( float pauseTimeMin ); float _pauseTimeMin;
float GetPauseTimeMin(); float _pauseTimeMax;
void SetPauseTimeMax( float pauseTimeMax ); //-------------------------------------
float GetPauseTimeMax(); // Components
//-------------------------------------
static bool CanExecute( Actor &self , float maxDistance ); GotoPoint _gotoPoint;
virtual void Archive ( Archiver &arc ); FireWeapon _fireWeapon;
RotateToEntity _rotate;
//-------------------------------------
// Components //-------------------------------------
//------------------------------------- // Member Variables
private: //-------------------------------------
GotoPoint _gotoPoint; coverCombatStates_t _state;
FireWeapon _fireWeapon; HelperNodePtr _node;
RotateToEntity _rotate; Actor* _self;
EntityPtr _currentEnemy;
bool _finishedPostureTransition;
//------------------------------------- bool _spotted;
// Member Variables float _nextSpotCheck;
//------------------------------------- float _nextStandTime;
private: float _nextDuckTime;
coverCombatStates_t _state; float _nextFireTime;
HelperNodePtr _node; float _nextPauseTime;
Actor *_self;
EntityPtr _currentEnemy; static const float NODE_RADIUS;
bool _finishedPostureTransition; };
bool _spotted;
float _nextSpotCheck; inline void CoverCombatWithRangedWeapon::SetMovementAnim(const str& movementAnim) {
float _nextStandTime; _movementAnim = movementAnim;
float _nextDuckTime; }
float _nextFireTime;
float _nextPauseTime; inline const str& CoverCombatWithRangedWeapon::GetMovementAnim() {
return _movementAnim;
static const float NODE_RADIUS; }
inline void CoverCombatWithRangedWeapon::SetTorsoAnim(const str& torsoAnim) {
}; _torsoAnim = torsoAnim;
}
inline void CoverCombatWithRangedWeapon::SetMovementAnim( const str& movementAnim )
{ inline const str& CoverCombatWithRangedWeapon::GetTorsoAnim() {
_movementAnim = movementAnim; return _torsoAnim;
} }
inline const str& CoverCombatWithRangedWeapon::GetMovementAnim() inline void CoverCombatWithRangedWeapon::SetFireAnim(const str& fireAnim) {
{ _fireAnim = fireAnim;
return _movementAnim; }
}
inline const str& CoverCombatWithRangedWeapon::GetFireAnim() {
inline void CoverCombatWithRangedWeapon::SetTorsoAnim( const str& torsoAnim ) return _fireAnim;
{ }
_torsoAnim = torsoAnim;
} inline void CoverCombatWithRangedWeapon::SetMaxDistance(float maxDistance) {
_maxDistance = maxDistance;
inline const str& CoverCombatWithRangedWeapon::GetTorsoAnim() }
{
return _torsoAnim; inline float CoverCombatWithRangedWeapon::GetMaxDistance() {
} return _maxDistance;
}
inline void CoverCombatWithRangedWeapon::SetFireAnim( const str& fireAnim )
{ inline void CoverCombatWithRangedWeapon::SetFireTimeMin(float fireTimeMin) {
_fireAnim = fireAnim; _fireTimeMin = fireTimeMin;
} }
inline const str& CoverCombatWithRangedWeapon::GetFireAnim() inline float CoverCombatWithRangedWeapon::GetFireTimeMin() {
{ return _fireTimeMin;
return _fireAnim; }
}
inline void CoverCombatWithRangedWeapon::SetFireTimeMax(float fireTimeMax) {
inline void CoverCombatWithRangedWeapon::SetMaxDistance( float maxDistance ) _fireTimeMax = fireTimeMax;
{ }
_maxDistance = maxDistance;
} inline float CoverCombatWithRangedWeapon::GetFireTimeMax() {
return _fireTimeMax;
inline float CoverCombatWithRangedWeapon::GetMaxDistance() }
{
return _maxDistance; inline void CoverCombatWithRangedWeapon::SetPauseTimeMin(float pauseTimeMin) {
} _pauseTimeMin = pauseTimeMin;
}
inline void CoverCombatWithRangedWeapon::SetFireTimeMin( float fireTimeMin )
{ inline float CoverCombatWithRangedWeapon::GetPauseTimeMin() {
_fireTimeMin = fireTimeMin; return _pauseTimeMin;
} }
inline float CoverCombatWithRangedWeapon::GetFireTimeMin() inline void CoverCombatWithRangedWeapon::SetPauseTimeMax(float pauseTimeMax) {
{ _pauseTimeMax = pauseTimeMax;
return _fireTimeMin; }
}
inline float CoverCombatWithRangedWeapon::GetPauseTimeMax() {
inline void CoverCombatWithRangedWeapon::SetFireTimeMax( float fireTimeMax ) return _pauseTimeMax;
{ }
_fireTimeMax = fireTimeMax;
} inline void CoverCombatWithRangedWeapon::Archive(Archiver& arc) {
Behavior::Archive(arc);
inline float CoverCombatWithRangedWeapon::GetFireTimeMax()
{ //
return _fireTimeMax; // Archive Parameters
} //
arc.ArchiveString(&_movementAnim);
inline void CoverCombatWithRangedWeapon::SetPauseTimeMin( float pauseTimeMin ) arc.ArchiveString(&_torsoAnim);
{ arc.ArchiveString(&_fireAnim);
_pauseTimeMin = pauseTimeMin; arc.ArchiveFloat(&_maxDistance);
} arc.ArchiveFloat(&_fireTimeMin);
arc.ArchiveFloat(&_fireTimeMax);
inline float CoverCombatWithRangedWeapon::GetPauseTimeMin() arc.ArchiveFloat(&_pauseTimeMin);
{ arc.ArchiveFloat(&_pauseTimeMax);
return _pauseTimeMin;
} //
// Archive Components
inline void CoverCombatWithRangedWeapon::SetPauseTimeMax( float pauseTimeMax ) //
{ arc.ArchiveObject(&_gotoPoint);
_pauseTimeMax = pauseTimeMax; arc.ArchiveObject(&_fireWeapon);
} arc.ArchiveObject(&_rotate);
inline float CoverCombatWithRangedWeapon::GetPauseTimeMax() //
{ // Archive Member Variables
return _pauseTimeMax; //
} ArchiveEnum(_state, coverCombatStates_t);
arc.ArchiveSafePointer(&_node);
inline void CoverCombatWithRangedWeapon::Archive( Archiver &arc ) arc.ArchiveObjectPointer((Class **)&_self);
{ arc.ArchiveSafePointer(&_currentEnemy);
Behavior::Archive ( arc ); arc.ArchiveBool(&_finishedPostureTransition);
arc.ArchiveBool(&_spotted);
// arc.ArchiveFloat(&_nextSpotCheck);
// Archive Parameters arc.ArchiveFloat(&_nextStandTime);
// arc.ArchiveFloat(&_nextDuckTime);
arc.ArchiveString ( &_movementAnim ); arc.ArchiveFloat(&_nextFireTime);
arc.ArchiveString ( &_torsoAnim ); arc.ArchiveFloat(&_nextPauseTime);
arc.ArchiveString ( &_fireAnim ); }
arc.ArchiveFloat ( &_maxDistance );
arc.ArchiveFloat ( &_fireTimeMin );
arc.ArchiveFloat ( &_fireTimeMax ); #endif /* __COVERCOMBAT_WITH_RANGEDWEAPON_HPP__ */
arc.ArchiveFloat ( &_pauseTimeMin );
arc.ArchiveFloat ( &_pauseTimeMax );
//
// Archive Components
//
arc.ArchiveObject ( &_gotoPoint );
arc.ArchiveObject ( &_fireWeapon );
arc.ArchiveObject ( &_rotate );
//
// Archive Member Variables
//
ArchiveEnum ( _state, coverCombatStates_t );
arc.ArchiveSafePointer ( &_node );
arc.ArchiveObjectPointer( ( Class ** )&_self );
arc.ArchiveSafePointer ( &_currentEnemy );
arc.ArchiveBool ( &_finishedPostureTransition );
arc.ArchiveBool ( &_spotted );
arc.ArchiveFloat ( &_nextSpotCheck );
arc.ArchiveFloat ( &_nextStandTime );
arc.ArchiveFloat ( &_nextDuckTime );
arc.ArchiveFloat ( &_nextFireTime );
arc.ArchiveFloat ( &_nextPauseTime );
}
#endif /* __COVERCOMBAT_WITH_RANGEDWEAPON_HPP__ */