Reformatting

This commit is contained in:
Walter Julius Hennecke 2014-03-09 02:04:09 +01:00
parent 21894316f9
commit 33680e8e7a

View file

@ -1,294 +1,285 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Logfile:: /Code/DLLs/game/corridorCombatWithRangedWeapon.hpp $ // $Logfile:: /Code/DLLs/game/corridorCombatWithRangedWeapon.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:
// CooridorCombatWithRangedWeapon Behavior Definition // CooridorCombatWithRangedWeapon Behavior Definition
// //
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
//============================== //==============================
// Forward Declarations // Forward Declarations
//============================== //==============================
class CorridorCombatWithRangedWeapon; class CorridorCombatWithRangedWeapon;
#ifndef __CORRIDORCOMBAT_WITH_RANGEDWEAPON_HPP__ #ifndef __CORRIDORCOMBAT_WITH_RANGEDWEAPON_HPP__
#define __CORRIDORCOMBAT_WITH_RANGEDWEAPON_HPP__ #define __CORRIDORCOMBAT_WITH_RANGEDWEAPON_HPP__
#include "behavior.h" #include "behavior.h"
#include "behaviors_general.h" #include "behaviors_general.h"
//------------------------- CLASS ------------------------------ //------------------------- CLASS ------------------------------
// //
// Name: CooridorCombatWithRangedWeapon // Name: CooridorCombatWithRangedWeapon
// Base Class: Behavior // Base Class: Behavior
// //
// Description: // Description:
// //
// Method of Use: Called From State Machine // Method of Use: Called From State Machine
//-------------------------------------------------------------- //--------------------------------------------------------------
class CorridorCombatWithRangedWeapon : public Behavior class CorridorCombatWithRangedWeapon : public Behavior {
{ public:
//------------------------------------ //------------------------------------
// States // States
//------------------------------------ //------------------------------------
public: typedef enum {
typedef enum CORRIDORCOMBAT_WRW_FINDNODE,
{ CORRIDORCOMBAT_WRW_MOVETONODE,
CORRIDORCOMBAT_WRW_FINDNODE, CORRIDORCOMBAT_WRW_BACKPEDAL,
CORRIDORCOMBAT_WRW_MOVETONODE, CORRIDORCOMBAT_WRW_FINDBETTERNODE,
CORRIDORCOMBAT_WRW_BACKPEDAL, CORRIDORCOMBAT_WRW_MOVETOBETTERNODE,
CORRIDORCOMBAT_WRW_FINDBETTERNODE, CORRIDORCOMBAT_WRW_CHANGEPOSTURE_DUCK,
CORRIDORCOMBAT_WRW_MOVETOBETTERNODE, CORRIDORCOMBAT_WRW_CHANGEPOSTURE_STAND,
CORRIDORCOMBAT_WRW_CHANGEPOSTURE_DUCK, CORRIDORCOMBAT_WRW_DUCKED,
CORRIDORCOMBAT_WRW_CHANGEPOSTURE_STAND, CORRIDORCOMBAT_WRW_DUCKED_FIRING,
CORRIDORCOMBAT_WRW_DUCKED, CORRIDORCOMBAT_WRW_STAND,
CORRIDORCOMBAT_WRW_DUCKED_FIRING, CORRIDORCOMBAT_WRW_STAND_FIRING,
CORRIDORCOMBAT_WRW_STAND, CORRIDORCOMBAT_WRW_HOLD_POSITION,
CORRIDORCOMBAT_WRW_STAND_FIRING, CORRIDORCOMBAT_WRW_SUCCESS,
CORRIDORCOMBAT_WRW_HOLD_POSITION, CORRIDORCOMBAT_WRW_FAILED
CORRIDORCOMBAT_WRW_SUCCESS, } corridorCombatStates_t;
CORRIDORCOMBAT_WRW_FAILED
} corridorCombatStates_t; //-------------------------------------
// Public Interface
//------------------------------------ //-------------------------------------
// Parameters CLASS_PROTOTYPE(CorridorCombatWithRangedWeapon);
//------------------------------------
private: CorridorCombatWithRangedWeapon();
str _movementAnim; ~CorridorCombatWithRangedWeapon();
str _torsoAnim;
str _fireAnim; void SetArgs(Event* ev);
str _preFireAnim; void AnimDone(Event* ev);
str _postFireAnim; void PostureDone(Event* ev);
float _postureChangeChance;
float _maxDistance; void Begin(Actor& self);
float _retreatDistance; BehaviorReturnCode_t Evaluate(Actor& self);
float _threatDistance; void End(Actor& self);
float _fireTimeMin;
float _fireTimeMax;
float _pauseTimeMin; void SetMovementAnim(const str& movementAnim) { _movementAnim = movementAnim; }
float _pauseTimeMax; const str& GetMovementAnim() { return _movementAnim; }
//------------------------------------- void SetTorsoAnim(const str& torsoAnim) { _torsoAnim = torsoAnim; }
// Internal Functionality const str& GetTorsoAnim() { return _torsoAnim; }
//-------------------------------------
protected: void SetFireAnim(const str& fireAnim) { _fireAnim = fireAnim; }
void transitionToState ( corridorCombatStates_t state ); const str& GetFireAnim() { return _fireAnim; }
void setInternalState ( corridorCombatStates_t state , const str &stateName );
void init ( Actor &self ); void SetPreFireAnim(const str& preFireAnim) { _preFireAnim = preFireAnim; }
void think (); const str& GetPreFireAnim() { return _preFireAnim; }
void updateEnemy ();
void setTorsoAnim (); void SetPostFireAnim(const str& postFireAnim) { _postFireAnim = postFireAnim; }
const str& GetPostFireAnim() { return _postFireAnim; }
bool checkShouldDuck ();
bool checkShouldStand (); void SetPostureChangeChance(float chance) { _postureChangeChance = chance; }
bool checkShouldRetreat (); float GetPostureChangeChance() { return _postureChangeChance; }
void setupRotate(); void SetMaxDistance(float maxDistance) { _maxDistance = maxDistance; }
BehaviorReturnCode_t evaluateRotate(); float GetMaxDistance() { return _maxDistance; }
void setupStateFindNode (); void SetRetreatDistance(float retreatDistance) { _retreatDistance = retreatDistance; }
BehaviorReturnCode_t evaluateStateFindNode (); float GetRetreatDistance() { return _retreatDistance; }
void failureStateFindNode ( const str& failureReason );
void SetThreatDistance(float threatDistance) { _threatDistance = threatDistance; }
void setupStateMoveToNode (); float GetThreatDistance() { return _threatDistance; }
BehaviorReturnCode_t evaluateStateMoveToNode ();
void failureStateMoveToNode ( const str& failureReason ); void SetFireTimeMin(float fireTimeMin) { _fireTimeMin = fireTimeMin; }
float GetFireTimeMin() { return _fireTimeMin; }
void setupStateBackPedal ();
BehaviorReturnCode_t evaluateStateBackPedal (); void SetFireTimeMax(float fireTimeMax) { _fireTimeMax = fireTimeMax; }
void failureStateBackPedal ( const str& failureReason ); float GetFireTimeMax() { return _fireTimeMax; }
void setupStateFindBetterNode (); void SetPauseTimeMin(float pauseTimeMin) { _pauseTimeMin = pauseTimeMin; }
BehaviorReturnCode_t evaluateStateFindBetterNode (); float GetPauseTimeMin() { return _pauseTimeMin; }
void failureStateFindBetterNode ( const str& failureReason );
void SetPauseTimeMax(float pauseTimeMax) { _pauseTimeMax = pauseTimeMax; }
void setupStateMoveToBetterNode (); float GetPauseTimeMax() { return _pauseTimeMax; }
BehaviorReturnCode_t evaluateStateMoveToBetterNode ();
void failureStateMoveToBetterNode ( const str& failureReason ); virtual void Archive(Archiver& arc);
void setupStateChangePostureDuck (); static bool CanExecute(float maxDistance, Actor& self);
BehaviorReturnCode_t evaluateStateChangePostureDuck ();
void failureStateChangePostureDuck ( const str& failureReason ); protected:
//-------------------------------------
void setupStateChangePostureStand (); // Internal Functionality
BehaviorReturnCode_t evaluateStateChangePostureStand (); //-------------------------------------
void failureStateChangePostureStand ( const str& failureReason ); void transitionToState(corridorCombatStates_t state);
void setInternalState(corridorCombatStates_t state, const str &stateName);
void setupStateDucked (); void init(Actor &self);
BehaviorReturnCode_t evaluateStateDucked (); void think();
void failureStateDucked ( const str& failureReason ); void updateEnemy();
void setTorsoAnim();
void setupStateFireDucked ();
BehaviorReturnCode_t evaluateStateFireDucked (); bool checkShouldDuck();
void failureStateFireDucked ( const str& failureReason ); bool checkShouldStand();
bool checkShouldRetreat();
void setupStateFirePauseDucked ();
BehaviorReturnCode_t evaluateStateFirePauseDucked (); void setupRotate();
void failureStateFirePauseDucked ( const str& failureReason ); BehaviorReturnCode_t evaluateRotate();
void setupStateStanding (); void setupStateFindNode();
BehaviorReturnCode_t evaluateStateStanding (); BehaviorReturnCode_t evaluateStateFindNode();
void failureStateStanding ( const str& failureReason ); void failureStateFindNode(const str& failureReason);
void setupStateFireStanding (); void setupStateMoveToNode();
BehaviorReturnCode_t evaluateStateFireStanding (); BehaviorReturnCode_t evaluateStateMoveToNode();
void failureStateFireStanding ( const str& failureReason ); void failureStateMoveToNode(const str& failureReason);
void setupStateFirePauseStanding (); void setupStateBackPedal();
BehaviorReturnCode_t evaluateStateFirePauseStanding (); BehaviorReturnCode_t evaluateStateBackPedal();
void failureStateFirePauseStanding ( const str& failureReason ); void failureStateBackPedal(const str& failureReason);
void setupStateHoldPosition (); void setupStateFindBetterNode();
BehaviorReturnCode_t evaluateStateHoldPosition (); BehaviorReturnCode_t evaluateStateFindBetterNode();
void failureStateHoldPosition ( const str& failureReason ); void failureStateFindBetterNode(const str& failureReason);
void setupStateMoveToBetterNode();
//------------------------------------- BehaviorReturnCode_t evaluateStateMoveToBetterNode();
// Public Interface void failureStateMoveToBetterNode(const str& failureReason);
//-------------------------------------
public: void setupStateChangePostureDuck();
CLASS_PROTOTYPE( CorridorCombatWithRangedWeapon ); BehaviorReturnCode_t evaluateStateChangePostureDuck();
void failureStateChangePostureDuck(const str& failureReason);
CorridorCombatWithRangedWeapon();
~CorridorCombatWithRangedWeapon(); void setupStateChangePostureStand();
BehaviorReturnCode_t evaluateStateChangePostureStand();
void SetArgs ( Event *ev ); void failureStateChangePostureStand(const str& failureReason);
void AnimDone ( Event *ev );
void PostureDone ( Event *ev ); void setupStateDucked();
BehaviorReturnCode_t evaluateStateDucked();
void Begin ( Actor &self ); void failureStateDucked(const str& failureReason);
BehaviorReturnCode_t Evaluate ( Actor &self );
void End ( Actor &self ); void setupStateFireDucked();
BehaviorReturnCode_t evaluateStateFireDucked();
void failureStateFireDucked(const str& failureReason);
void SetMovementAnim( const str& movementAnim ) { _movementAnim = movementAnim; }
const str& GetMovementAnim() { return _movementAnim; } void setupStateFirePauseDucked();
BehaviorReturnCode_t evaluateStateFirePauseDucked();
void SetTorsoAnim( const str& torsoAnim ) { _torsoAnim = torsoAnim; } void failureStateFirePauseDucked(const str& failureReason);
const str& GetTorsoAnim() { return _torsoAnim; }
void setupStateStanding();
void SetFireAnim( const str& fireAnim ) { _fireAnim = fireAnim; } BehaviorReturnCode_t evaluateStateStanding();
const str& GetFireAnim() { return _fireAnim; } void failureStateStanding(const str& failureReason);
void SetPreFireAnim( const str& preFireAnim ) { _preFireAnim = preFireAnim; } void setupStateFireStanding();
const str& GetPreFireAnim() { return _preFireAnim; } BehaviorReturnCode_t evaluateStateFireStanding();
void failureStateFireStanding(const str& failureReason);
void SetPostFireAnim( const str& postFireAnim ) { _postFireAnim = postFireAnim; }
const str& GetPostFireAnim() { return _postFireAnim; } void setupStateFirePauseStanding();
BehaviorReturnCode_t evaluateStateFirePauseStanding();
void SetPostureChangeChance( float chance ) { _postureChangeChance = chance; } void failureStateFirePauseStanding(const str& failureReason);
float GetPostureChangeChance() { return _postureChangeChance; }
void setupStateHoldPosition();
void SetMaxDistance( float maxDistance ) { _maxDistance = maxDistance; } BehaviorReturnCode_t evaluateStateHoldPosition();
float GetMaxDistance() { return _maxDistance; } void failureStateHoldPosition(const str& failureReason);
void SetRetreatDistance( float retreatDistance ) { _retreatDistance = retreatDistance; } private:
float GetRetreatDistance() { return _retreatDistance; } //------------------------------------
// Parameters
void SetThreatDistance( float threatDistance ) { _threatDistance = threatDistance; } //------------------------------------
float GetThreatDistance() { return _threatDistance; } str _movementAnim;
str _torsoAnim;
void SetFireTimeMin( float fireTimeMin ) { _fireTimeMin = fireTimeMin; } str _fireAnim;
float GetFireTimeMin() { return _fireTimeMin; } str _preFireAnim;
str _postFireAnim;
void SetFireTimeMax( float fireTimeMax ) { _fireTimeMax = fireTimeMax; } float _postureChangeChance;
float GetFireTimeMax() { return _fireTimeMax; } float _maxDistance;
float _retreatDistance;
void SetPauseTimeMin( float pauseTimeMin ) { _pauseTimeMin = pauseTimeMin; } float _threatDistance;
float GetPauseTimeMin() { return _pauseTimeMin; } float _fireTimeMin;
float _fireTimeMax;
void SetPauseTimeMax( float pauseTimeMax ) { _pauseTimeMax = pauseTimeMax; } float _pauseTimeMin;
float GetPauseTimeMax() { return _pauseTimeMax; } float _pauseTimeMax;
virtual void Archive ( Archiver &arc ); //-------------------------------------
// Components
static bool CanExecute( float maxDistance , Actor &self ); //-------------------------------------
GotoPoint _gotoPoint;
//------------------------------------- FireWeapon _fireWeapon;
// Components MoveRandomDirection _moveRandomDir;
//------------------------------------- RotateToEntity _rotate;
private:
GotoPoint _gotoPoint;
FireWeapon _fireWeapon; //-------------------------------------
MoveRandomDirection _moveRandomDir; // Member Variables
RotateToEntity _rotate; //-------------------------------------
corridorCombatStates_t _state;
HelperNodePtr _node;
//------------------------------------- Actor* _self;
// Member Variables EntityPtr _currentEnemy;
//------------------------------------- bool _finishedPostureTransition;
private: float _nextFireTime;
corridorCombatStates_t _state; float _nextPauseTime;
HelperNodePtr _node; float _holdPositionTime;
Actor *_self; float _enemyUpdateTime;
EntityPtr _currentEnemy;
bool _finishedPostureTransition; static const float NODE_RADIUS;
float _nextFireTime; };
float _nextPauseTime;
float _holdPositionTime;
float _enemyUpdateTime; inline void CorridorCombatWithRangedWeapon::Archive(Archiver& arc) {
Behavior::Archive(arc);
static const float NODE_RADIUS;
//
// Archive Parameters
}; //
arc.ArchiveString(&_movementAnim);
arc.ArchiveString(&_torsoAnim);
inline void CorridorCombatWithRangedWeapon::Archive( Archiver &arc ) arc.ArchiveString(&_fireAnim);
{ arc.ArchiveString(&_preFireAnim);
Behavior::Archive ( arc ); arc.ArchiveString(&_postFireAnim);
arc.ArchiveFloat(&_postureChangeChance);
// arc.ArchiveFloat(&_maxDistance);
// Archive Parameters arc.ArchiveFloat(&_retreatDistance);
// arc.ArchiveFloat(&_threatDistance);
arc.ArchiveString ( &_movementAnim ); arc.ArchiveFloat(&_fireTimeMin);
arc.ArchiveString ( &_torsoAnim ); arc.ArchiveFloat(&_fireTimeMax);
arc.ArchiveString ( &_fireAnim ); arc.ArchiveFloat(&_pauseTimeMin);
arc.ArchiveString ( &_preFireAnim ); arc.ArchiveFloat(&_pauseTimeMax);
arc.ArchiveString ( &_postFireAnim );
arc.ArchiveFloat ( &_postureChangeChance );
arc.ArchiveFloat ( &_maxDistance ); //
arc.ArchiveFloat ( &_retreatDistance ); // Archive Components
arc.ArchiveFloat ( &_threatDistance ); //
arc.ArchiveFloat ( &_fireTimeMin ); arc.ArchiveObject(&_gotoPoint);
arc.ArchiveFloat ( &_fireTimeMax ); arc.ArchiveObject(&_fireWeapon);
arc.ArchiveFloat ( &_pauseTimeMin ); arc.ArchiveObject(&_moveRandomDir);
arc.ArchiveFloat ( &_pauseTimeMax ); arc.ArchiveObject(&_rotate);
//
// // Archive Member Variables
// Archive Components //
// ArchiveEnum(_state, corridorCombatStates_t);
arc.ArchiveObject ( &_gotoPoint ); arc.ArchiveSafePointer(&_node);
arc.ArchiveObject ( &_fireWeapon ); arc.ArchiveObjectPointer((Class **)&_self);
arc.ArchiveObject ( &_moveRandomDir ); arc.ArchiveSafePointer(&_currentEnemy);
arc.ArchiveObject ( &_rotate ); arc.ArchiveBool(&_finishedPostureTransition);
arc.ArchiveFloat(&_nextFireTime);
// arc.ArchiveFloat(&_nextPauseTime);
// Archive Member Variables arc.ArchiveFloat(&_holdPositionTime);
// arc.ArchiveFloat(&_enemyUpdateTime);
ArchiveEnum ( _state, corridorCombatStates_t);
arc.ArchiveSafePointer ( &_node ); }
arc.ArchiveObjectPointer( ( Class ** )&_self );
arc.ArchiveSafePointer ( &_currentEnemy );
arc.ArchiveBool ( &_finishedPostureTransition ); #endif /* __CORRIDORCOMBAT_WITH_RANGEDWEAPON_HPP__ */
arc.ArchiveFloat ( &_nextFireTime );
arc.ArchiveFloat ( &_nextPauseTime );
arc.ArchiveFloat ( &_holdPositionTime );
arc.ArchiveFloat ( &_enemyUpdateTime );
}
#endif /* __CORRIDORCOMBAT_WITH_RANGEDWEAPON_HPP__ */