mirror of
https://github.com/UberGames/EF2GameSource.git
synced 2025-02-21 11:01:40 +00:00
reformat
This commit is contained in:
parent
51e9513177
commit
d8bb50f96e
1 changed files with 179 additions and 191 deletions
|
@ -1,191 +1,179 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// $Logfile:: /Code/DLLs/game/rangedCombatWithWeapon.hpp $
|
// $Logfile:: /Code/DLLs/game/rangedCombatWithWeapon.hpp $
|
||||||
// $Revision:: 169 $
|
// $Revision:: 169 $
|
||||||
// $Author:: Bschofield $
|
// $Author:: Bschofield $
|
||||||
// $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:
|
||||||
// GeneralCombatWithMeleeWeapon Behavior Definition
|
// GeneralCombatWithMeleeWeapon Behavior Definition
|
||||||
//
|
//
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|
||||||
//==============================
|
//==============================
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
//==============================
|
//==============================
|
||||||
class GeneralCombatWithRangedWeapon;
|
class GeneralCombatWithRangedWeapon;
|
||||||
|
|
||||||
#ifndef __RANGEDCOMBAT_WITH_WEAPON_HPP__
|
#ifndef __RANGEDCOMBAT_WITH_WEAPON_HPP__
|
||||||
#define __RANGEDCOMBAT_WITH_WEAPON_HPP__
|
#define __RANGEDCOMBAT_WITH_WEAPON_HPP__
|
||||||
|
|
||||||
#include "behavior.h"
|
#include "behavior.h"
|
||||||
#include "behaviors_general.h"
|
#include "behaviors_general.h"
|
||||||
#include "generalCombatWithRangedWeapon.hpp"
|
#include "generalCombatWithRangedWeapon.hpp"
|
||||||
#include "corridorCombatWithRangedWeapon.hpp"
|
#include "corridorCombatWithRangedWeapon.hpp"
|
||||||
#include "coverCombatWithRangedWeapon.hpp"
|
#include "coverCombatWithRangedWeapon.hpp"
|
||||||
#include "selectBestWeapon.hpp"
|
#include "selectBestWeapon.hpp"
|
||||||
|
|
||||||
|
|
||||||
//------------------------- CLASS ------------------------------
|
//------------------------- CLASS ------------------------------
|
||||||
//
|
//
|
||||||
// Name: RangedCombatWithWeapon
|
// Name: RangedCombatWithWeapon
|
||||||
// Base Class: Behavior
|
// Base Class: Behavior
|
||||||
//
|
//
|
||||||
// Description: Template that can be copied and pasted to
|
// Description: Template that can be copied and pasted to
|
||||||
// generate new behavior
|
// generate new behavior
|
||||||
//
|
//
|
||||||
// Method of Use: State machine or another behavior
|
// Method of Use: State machine or another behavior
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
|
||||||
class RangedCombatWithWeapon : public Behavior
|
class RangedCombatWithWeapon : public Behavior {
|
||||||
{
|
public:
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
// States
|
// States
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
public:
|
typedef enum {
|
||||||
typedef enum
|
RCWW_EVALUATE_OPTIONS,
|
||||||
{
|
RCWW_CHANGE_WEAPON,
|
||||||
RCWW_EVALUATE_OPTIONS,
|
RCWW_GENERAL_COMBAT,
|
||||||
RCWW_CHANGE_WEAPON,
|
RCWW_CORRIDOR_COMBAT,
|
||||||
RCWW_GENERAL_COMBAT,
|
RCWW_COVER_COMBAT,
|
||||||
RCWW_CORRIDOR_COMBAT,
|
RCWW_FAILED,
|
||||||
RCWW_COVER_COMBAT,
|
} RangedCombatWithWeapon_t;
|
||||||
RCWW_FAILED,
|
|
||||||
} RangedCombatWithWeapon_t;
|
|
||||||
|
//-------------------------------------
|
||||||
|
// Public Interface
|
||||||
//------------------------------------
|
//-------------------------------------
|
||||||
// Parameters
|
CLASS_PROTOTYPE(RangedCombatWithWeapon);
|
||||||
//------------------------------------
|
|
||||||
private:
|
RangedCombatWithWeapon();
|
||||||
str _aimAnim; // --Animation used to aim the weapon
|
~RangedCombatWithWeapon();
|
||||||
str _fireAnim; // --The animation used to fire the weapon
|
|
||||||
float _approachDist;
|
void SetArgs(Event* ev);
|
||||||
float _retreatDist;
|
void AnimDone(Event* ev);
|
||||||
float _strafeChance;
|
void PostureDone(Event* ev);
|
||||||
float _postureChangeChance;
|
|
||||||
|
void Begin(Actor& self);
|
||||||
//-------------------------------------
|
BehaviorReturnCode_t Evaluate(Actor& self);
|
||||||
// Internal Functionality
|
void End(Actor& self);
|
||||||
//-------------------------------------
|
|
||||||
protected:
|
virtual void Archive(Archiver& arc);
|
||||||
void transitionToState ( RangedCombatWithWeapon_t state );
|
|
||||||
void setInternalState ( RangedCombatWithWeapon_t state , const str &stateName );
|
// Mutators
|
||||||
void init ( Actor &self );
|
void SetFireAnim(const str& anim);
|
||||||
void think ();
|
|
||||||
void updateEnemy ();
|
protected:
|
||||||
|
//-------------------------------------
|
||||||
bool checkShouldDoCorridorCombat();
|
// Internal Functionality
|
||||||
bool checkShouldDoGeneralCombat();
|
//-------------------------------------
|
||||||
bool checkShouldDoCoverCombat();
|
void transitionToState(RangedCombatWithWeapon_t state);
|
||||||
bool checkShouldCheckWeapon();
|
void setInternalState(RangedCombatWithWeapon_t state, const str& stateName);
|
||||||
|
void init(Actor& self);
|
||||||
void setupStateEvaluateOptions();
|
void think();
|
||||||
BehaviorReturnCode_t evaluateStateEvaluateOptions();
|
void updateEnemy();
|
||||||
void failureStateEvaluateOptions();
|
|
||||||
|
bool checkShouldDoCorridorCombat();
|
||||||
void setupStateChangeWeapon();
|
bool checkShouldDoGeneralCombat();
|
||||||
BehaviorReturnCode_t evaluateStateChangeWeapon();
|
bool checkShouldDoCoverCombat();
|
||||||
void failureStateChangeWeapon();
|
bool checkShouldCheckWeapon();
|
||||||
|
|
||||||
void setupStateGeneralCombat();
|
void setupStateEvaluateOptions();
|
||||||
BehaviorReturnCode_t evaluateStateGeneralCombat();
|
BehaviorReturnCode_t evaluateStateEvaluateOptions();
|
||||||
void failureStateGeneralCombat();
|
void failureStateEvaluateOptions();
|
||||||
|
|
||||||
void setupStateCoverCombat();
|
void setupStateChangeWeapon();
|
||||||
BehaviorReturnCode_t evaluateStateCoverCombat();
|
BehaviorReturnCode_t evaluateStateChangeWeapon();
|
||||||
void failureStateCoverCombat();
|
void failureStateChangeWeapon();
|
||||||
|
|
||||||
void setupStateCorridorCombat();
|
void setupStateGeneralCombat();
|
||||||
BehaviorReturnCode_t evaluateStateCorridorCombat();
|
BehaviorReturnCode_t evaluateStateGeneralCombat();
|
||||||
void failureStateCorridorCombat();
|
void failureStateGeneralCombat();
|
||||||
|
|
||||||
|
void setupStateCoverCombat();
|
||||||
//-------------------------------------
|
BehaviorReturnCode_t evaluateStateCoverCombat();
|
||||||
// Public Interface
|
void failureStateCoverCombat();
|
||||||
//-------------------------------------
|
|
||||||
public:
|
void setupStateCorridorCombat();
|
||||||
CLASS_PROTOTYPE( RangedCombatWithWeapon );
|
BehaviorReturnCode_t evaluateStateCorridorCombat();
|
||||||
|
void failureStateCorridorCombat();
|
||||||
RangedCombatWithWeapon();
|
|
||||||
~RangedCombatWithWeapon();
|
private:
|
||||||
|
//------------------------------------
|
||||||
void SetArgs ( Event *ev );
|
// Parameters
|
||||||
void AnimDone ( Event *ev );
|
//------------------------------------
|
||||||
void PostureDone ( Event *ev );
|
str _aimAnim; // --Animation used to aim the weapon
|
||||||
|
str _fireAnim; // --The animation used to fire the weapon
|
||||||
void Begin ( Actor &self );
|
float _approachDist;
|
||||||
BehaviorReturnCode_t Evaluate ( Actor &self );
|
float _retreatDist;
|
||||||
void End ( Actor &self );
|
float _strafeChance;
|
||||||
|
float _postureChangeChance;
|
||||||
virtual void Archive ( Archiver &arc );
|
|
||||||
|
//-------------------------------------
|
||||||
// Mutators
|
// Member Variables
|
||||||
void SetFireAnim ( const str &anim );
|
//-------------------------------------
|
||||||
|
// Component Behaviors
|
||||||
|
CloseInOnEnemy _gotoEnemy;
|
||||||
|
GeneralCombatWithRangedWeapon _generalCombat;
|
||||||
|
CorridorCombatWithRangedWeapon _corridorCombat;
|
||||||
//-------------------------------------
|
CoverCombatWithRangedWeapon _coverCombat;
|
||||||
// Member Variables
|
SelectBestWeapon _selectBestWeapon;
|
||||||
//-------------------------------------
|
|
||||||
private:
|
// Member Vars
|
||||||
// Component Behaviors
|
int _state; //-- Maintains our Behavior's current State
|
||||||
CloseInOnEnemy _gotoEnemy;
|
Actor* _self;
|
||||||
GeneralCombatWithRangedWeapon _generalCombat;
|
EntityPtr _currentEnemy;
|
||||||
CorridorCombatWithRangedWeapon _corridorCombat;
|
float _nextSelectWeaponTime;
|
||||||
CoverCombatWithRangedWeapon _coverCombat;
|
float _recheckTime;
|
||||||
SelectBestWeapon _selectBestWeapon;
|
// Constants
|
||||||
|
};
|
||||||
|
|
||||||
// Member Vars
|
|
||||||
int _state; //-- Maintains our Behavior's current State
|
inline void RangedCombatWithWeapon::Archive(Archiver& arc) {
|
||||||
Actor* _self;
|
Behavior::Archive(arc);
|
||||||
EntityPtr _currentEnemy;
|
|
||||||
float _nextSelectWeaponTime;
|
// Archive Parameters
|
||||||
float _recheckTime;
|
arc.ArchiveString(&_aimAnim);
|
||||||
// Constants
|
arc.ArchiveString(&_fireAnim);
|
||||||
|
arc.ArchiveFloat(&_approachDist);
|
||||||
};
|
arc.ArchiveFloat(&_retreatDist);
|
||||||
|
arc.ArchiveFloat(&_strafeChance);
|
||||||
|
arc.ArchiveFloat(&_postureChangeChance);
|
||||||
inline void RangedCombatWithWeapon::Archive( Archiver &arc )
|
|
||||||
{
|
// Archive Components
|
||||||
Behavior::Archive( arc );
|
arc.ArchiveObject(&_gotoEnemy);
|
||||||
|
arc.ArchiveObject(&_generalCombat);
|
||||||
// Archive Parameters
|
arc.ArchiveObject(&_corridorCombat);
|
||||||
arc.ArchiveString ( &_aimAnim );
|
arc.ArchiveObject(&_coverCombat);
|
||||||
arc.ArchiveString ( &_fireAnim );
|
arc.ArchiveObject(&_selectBestWeapon);
|
||||||
arc.ArchiveFloat ( &_approachDist );
|
|
||||||
arc.ArchiveFloat ( &_retreatDist );
|
// Archive Member Variables
|
||||||
arc.ArchiveFloat ( &_strafeChance );
|
arc.ArchiveInteger(&_state);
|
||||||
arc.ArchiveFloat ( &_postureChangeChance );
|
arc.ArchiveObjectPointer((Class **)&_self);
|
||||||
|
arc.ArchiveSafePointer(&_currentEnemy);
|
||||||
// Archive Components
|
arc.ArchiveFloat(&_nextSelectWeaponTime);
|
||||||
arc.ArchiveObject ( &_gotoEnemy );
|
arc.ArchiveFloat(&_recheckTime);
|
||||||
arc.ArchiveObject ( &_generalCombat );
|
}
|
||||||
arc.ArchiveObject ( &_corridorCombat );
|
|
||||||
arc.ArchiveObject ( &_coverCombat );
|
inline void RangedCombatWithWeapon::SetFireAnim(const str &anim) {
|
||||||
arc.ArchiveObject ( &_selectBestWeapon );
|
_fireAnim = anim;
|
||||||
|
}
|
||||||
// Archive Member Variables
|
|
||||||
arc.ArchiveInteger ( &_state );
|
#endif /* __RANGEDCOMBAT_WITH_WEAPON_HPP__ */
|
||||||
arc.ArchiveObjectPointer ( ( Class ** )&_self );
|
|
||||||
arc.ArchiveSafePointer( &_currentEnemy );
|
|
||||||
arc.ArchiveFloat ( &_nextSelectWeaponTime );
|
|
||||||
arc.ArchiveFloat ( &_recheckTime );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void RangedCombatWithWeapon::SetFireAnim( const str &anim )
|
|
||||||
{
|
|
||||||
_fireAnim = anim;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __RANGEDCOMBAT_WITH_WEAPON_HPP__ */
|
|
||||||
|
|
Loading…
Reference in a new issue