reformat
This commit is contained in:
parent
a24940bed2
commit
b9f90d4305
|
@ -1,161 +1,151 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $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 SelectBestWeapon;
|
class SelectBestWeapon;
|
||||||
|
|
||||||
#ifndef __SELECT_BEST_WEAPON_HPP__
|
#ifndef __SELECT_BEST_WEAPON_HPP__
|
||||||
#define __SELECT_BEST_WEAPON_HPP__
|
#define __SELECT_BEST_WEAPON_HPP__
|
||||||
|
|
||||||
#include "behavior.h"
|
#include "behavior.h"
|
||||||
#include "behaviors_general.h"
|
#include "behaviors_general.h"
|
||||||
|
|
||||||
//------------------------- CLASS ------------------------------
|
//------------------------- CLASS ------------------------------
|
||||||
//
|
//
|
||||||
// Name: SelectBestWeapon
|
// Name: SelectBestWeapon
|
||||||
// Base Class: Behavior
|
// Base Class: Behavior
|
||||||
//
|
//
|
||||||
// Description: Selects and "Equips" the "best" weapon in the
|
// Description: Selects and "Equips" the "best" weapon in the
|
||||||
// Actor's inventory
|
// Actor's inventory
|
||||||
//
|
//
|
||||||
// Method of Use: Called From State Machine
|
// Method of Use: Called From State Machine
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
class SelectBestWeapon : public Behavior
|
class SelectBestWeapon : public Behavior {
|
||||||
{
|
public:
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
// States
|
// States
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
public:
|
typedef enum {
|
||||||
typedef enum
|
SBW_SELECT_WEAPON,
|
||||||
{
|
SBW_PUT_AWAY_CURRENT_WEAPON,
|
||||||
SBW_SELECT_WEAPON,
|
SBW_PULL_OUT_NEW_WEAPON,
|
||||||
SBW_PUT_AWAY_CURRENT_WEAPON,
|
SBW_READY_NEW_WEAPON,
|
||||||
SBW_PULL_OUT_NEW_WEAPON,
|
SBW_SUCCESS,
|
||||||
SBW_READY_NEW_WEAPON,
|
SBW_FAILED
|
||||||
SBW_SUCCESS,
|
} selectBestWeaponStates_t;
|
||||||
SBW_FAILED
|
|
||||||
} selectBestWeaponStates_t;
|
//-------------------------------------
|
||||||
|
// Public Interface
|
||||||
//------------------------------------
|
//-------------------------------------
|
||||||
// Parameters
|
CLASS_PROTOTYPE(SelectBestWeapon);
|
||||||
//------------------------------------
|
|
||||||
private:
|
SelectBestWeapon();
|
||||||
EntityPtr _currentEnemy;
|
~SelectBestWeapon();
|
||||||
|
|
||||||
//-------------------------------------
|
void SetArgs(Event* ev);
|
||||||
// Internal Functionality
|
void AnimDone(Event* ev);
|
||||||
//-------------------------------------
|
void PostureDone(Event* ev);
|
||||||
protected:
|
|
||||||
void transitionToState ( selectBestWeaponStates_t state );
|
void Begin(Actor& self);
|
||||||
void setInternalState ( selectBestWeaponStates_t state , const str &stateName );
|
BehaviorReturnCode_t Evaluate(Actor& self);
|
||||||
void init ( Actor &self );
|
void End(Actor& self);
|
||||||
void think ();
|
|
||||||
|
void SetCurrentEnemy(Entity* enemy);
|
||||||
void setupStateSelectWeapon ();
|
|
||||||
BehaviorReturnCode_t evaluateStateSelectWeapon();
|
static bool CanExecute(Actor& self);
|
||||||
void failureStateSelectWeapon( const str& failureReason );
|
virtual void Archive(Archiver& arc);
|
||||||
|
|
||||||
void setupStatePutAwayCurrentWeapon();
|
protected:
|
||||||
BehaviorReturnCode_t evaluateStatePutAwayCurrentWeapon();
|
//-------------------------------------
|
||||||
void failureStatePutAwayCurrentWeapon(const str& failureReason);
|
// Internal Functionality
|
||||||
|
//-------------------------------------
|
||||||
void setupStatePullOutNewWeapon();
|
void transitionToState(selectBestWeaponStates_t state);
|
||||||
BehaviorReturnCode_t evaluateStatePullOutNewWeapon();
|
void setInternalState(selectBestWeaponStates_t state, const str& stateName);
|
||||||
void failureStatePullOutNewWeapon(const str& failureReason);
|
void init(Actor& self);
|
||||||
|
void think();
|
||||||
void setupStateReadyNewWeapon();
|
|
||||||
BehaviorReturnCode_t evaluateStateReadyNewWeapon();
|
void setupStateSelectWeapon();
|
||||||
void failureStateReadyNewWeapon( const str& failureReason );
|
BehaviorReturnCode_t evaluateStateSelectWeapon();
|
||||||
|
void failureStateSelectWeapon(const str& failureReason);
|
||||||
//-------------------------------------
|
|
||||||
// Public Interface
|
void setupStatePutAwayCurrentWeapon();
|
||||||
//-------------------------------------
|
BehaviorReturnCode_t evaluateStatePutAwayCurrentWeapon();
|
||||||
public:
|
void failureStatePutAwayCurrentWeapon(const str& failureReason);
|
||||||
CLASS_PROTOTYPE( SelectBestWeapon );
|
|
||||||
|
void setupStatePullOutNewWeapon();
|
||||||
SelectBestWeapon();
|
BehaviorReturnCode_t evaluateStatePullOutNewWeapon();
|
||||||
~SelectBestWeapon();
|
void failureStatePullOutNewWeapon(const str& failureReason);
|
||||||
|
|
||||||
void SetArgs ( Event *ev );
|
void setupStateReadyNewWeapon();
|
||||||
void AnimDone ( Event *ev );
|
BehaviorReturnCode_t evaluateStateReadyNewWeapon();
|
||||||
void PostureDone ( Event *ev );
|
void failureStateReadyNewWeapon(const str& failureReason);
|
||||||
|
|
||||||
void Begin ( Actor &self );
|
private:
|
||||||
BehaviorReturnCode_t Evaluate ( Actor &self );
|
//------------------------------------
|
||||||
void End ( Actor &self );
|
// Parameters
|
||||||
|
//------------------------------------
|
||||||
void SetCurrentEnemy ( Entity* enemy );
|
EntityPtr _currentEnemy;
|
||||||
|
|
||||||
static bool CanExecute( Actor &self );
|
//-------------------------------------
|
||||||
virtual void Archive ( Archiver &arc );
|
// Components
|
||||||
|
//-------------------------------------
|
||||||
|
|
||||||
|
//-------------------------------------
|
||||||
//-------------------------------------
|
// Member Variables
|
||||||
// Components
|
//-------------------------------------
|
||||||
//-------------------------------------
|
selectBestWeaponStates_t _state;
|
||||||
private:
|
Actor* _self;
|
||||||
|
WeaponPtr _bestWeapon;
|
||||||
|
str _currentWeaponName;
|
||||||
//-------------------------------------
|
str _bestWeaponName;
|
||||||
// Member Variables
|
bool _animDone;
|
||||||
//-------------------------------------
|
|
||||||
private:
|
};
|
||||||
selectBestWeaponStates_t _state;
|
|
||||||
Actor *_self;
|
inline void SelectBestWeapon::SetCurrentEnemy(Entity* enemy) {
|
||||||
WeaponPtr _bestWeapon;
|
_currentEnemy = enemy;
|
||||||
str _currentWeaponName;
|
}
|
||||||
str _bestWeaponName;
|
|
||||||
bool _animDone;
|
inline void SelectBestWeapon::Archive(Archiver& arc) {
|
||||||
|
Behavior::Archive(arc);
|
||||||
};
|
|
||||||
|
//
|
||||||
inline void SelectBestWeapon::SetCurrentEnemy( Entity *enemy )
|
// Archive Parameters
|
||||||
{
|
//
|
||||||
_currentEnemy = enemy;
|
arc.ArchiveSafePointer(&_currentEnemy);
|
||||||
}
|
|
||||||
|
//
|
||||||
inline void SelectBestWeapon::Archive( Archiver &arc )
|
// Archive Components
|
||||||
{
|
//
|
||||||
Behavior::Archive ( arc );
|
|
||||||
|
//
|
||||||
//
|
// Archive Member Variables
|
||||||
// Archive Parameters
|
//
|
||||||
//
|
ArchiveEnum(_state, selectBestWeaponStates_t);
|
||||||
arc.ArchiveSafePointer( &_currentEnemy );
|
arc.ArchiveObjectPointer((Class **)&_self);
|
||||||
|
arc.ArchiveSafePointer(&_bestWeapon);
|
||||||
//
|
arc.ArchiveString(&_currentWeaponName);
|
||||||
// Archive Components
|
arc.ArchiveString(&_bestWeaponName);
|
||||||
//
|
arc.ArchiveBool(&_animDone);
|
||||||
|
}
|
||||||
//
|
|
||||||
// Archive Member Variables
|
|
||||||
//
|
#endif /* __SELECT_BEST_WEAPON_HPP__ */
|
||||||
ArchiveEnum ( _state, selectBestWeaponStates_t );
|
|
||||||
arc.ArchiveObjectPointer( ( Class ** )&_self );
|
|
||||||
arc.ArchiveSafePointer ( &_bestWeapon );
|
|
||||||
arc.ArchiveString ( &_currentWeaponName );
|
|
||||||
arc.ArchiveString ( &_bestWeaponName );
|
|
||||||
arc.ArchiveBool ( &_animDone );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __SELECT_BEST_WEAPON_HPP__ */
|
|
||||||
|
|
Loading…
Reference in New Issue