mirror of
https://github.com/UberGames/EF2GameSource.git
synced 2024-11-10 06:31:42 +00:00
reformat
This commit is contained in:
parent
66f262fd5f
commit
a52143e29c
1 changed files with 158 additions and 166 deletions
|
@ -1,166 +1,158 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Logfile:: /Code/DLLs/game/holdPosition.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:
|
||||
// holdPosition Behavior Definition
|
||||
//
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//==============================
|
||||
// Forward Declarations
|
||||
//==============================
|
||||
class HoldPosition;
|
||||
|
||||
#ifndef __HOLD_POSITION__
|
||||
#define __HOLD_POSITION__
|
||||
|
||||
#include "behavior.h"
|
||||
#include "behaviors_general.h"
|
||||
|
||||
//------------------------- CLASS ------------------------------
|
||||
//
|
||||
// Name: HoldPosition
|
||||
// Base Class: Behavior
|
||||
//
|
||||
// Description: Makes the actor idle in position, holding its
|
||||
// weapon appropriately, and occassionally twitch
|
||||
//
|
||||
//
|
||||
// Method of Use: Called From State Machine
|
||||
//--------------------------------------------------------------
|
||||
class HoldPosition : public Behavior
|
||||
{
|
||||
//------------------------------------
|
||||
// States
|
||||
//------------------------------------
|
||||
public:
|
||||
typedef enum
|
||||
{
|
||||
HOLD_POSITION_HOLD,
|
||||
HOLD_POSITION_TWITCH,
|
||||
HOLD_POSITION_WEAPON_TWITCH,
|
||||
HOLD_POSITION_SUCCESS,
|
||||
HOLD_POSITION_FAILED
|
||||
} HoldPositionStates_t;
|
||||
|
||||
//------------------------------------
|
||||
// Parameters
|
||||
//------------------------------------
|
||||
private:
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
// Internal Functionality
|
||||
//-------------------------------------
|
||||
protected:
|
||||
void transitionToState ( HoldPositionStates_t state );
|
||||
void setInternalState ( HoldPositionStates_t state , const str &stateName );
|
||||
void init ( Actor &self );
|
||||
void think ();
|
||||
|
||||
void setupStateHold ();
|
||||
BehaviorReturnCode_t evaluateStateHold ();
|
||||
void failureStateHold ( const str& failureReason );
|
||||
|
||||
void setupStateTwitch ();
|
||||
BehaviorReturnCode_t evaluateStateTwitch ();
|
||||
void failureStateTwitch ( const str& failureReason );
|
||||
|
||||
void setupStateWeaponTwitch ();
|
||||
BehaviorReturnCode_t evaluateStateWeaponTwitch ();
|
||||
void failureStateWeaponTwitch ( const str& failureReason );
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
// Public Interface
|
||||
//-------------------------------------
|
||||
public:
|
||||
CLASS_PROTOTYPE( HoldPosition );
|
||||
|
||||
HoldPosition();
|
||||
~HoldPosition();
|
||||
|
||||
void SetArgs ( Event *ev );
|
||||
void AnimDone ( Event *ev );
|
||||
|
||||
void Begin ( Actor &self );
|
||||
BehaviorReturnCode_t Evaluate ( Actor &self );
|
||||
void End ( Actor &self );
|
||||
|
||||
// Accessors
|
||||
virtual void Archive ( Archiver &arc );
|
||||
|
||||
//-------------------------------------
|
||||
// Components
|
||||
//-------------------------------------
|
||||
private:
|
||||
str _legAnim;
|
||||
str _torsoAnim;
|
||||
str _twitchAnim;
|
||||
str _weaponTwitchAnim;
|
||||
|
||||
float _holdTimeMin;
|
||||
float _holdTimeMax;
|
||||
float _endHoldTime;
|
||||
float _nextTwitchTime;
|
||||
float _twitchInterval;
|
||||
bool _canTwitch;
|
||||
bool _animDone;
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
// Member Variables
|
||||
//-------------------------------------
|
||||
private:
|
||||
HoldPositionStates_t _state;
|
||||
Actor *_self;
|
||||
|
||||
|
||||
};
|
||||
|
||||
inline void HoldPosition::Archive( Archiver &arc )
|
||||
{
|
||||
Behavior::Archive ( arc );
|
||||
|
||||
//
|
||||
// Archive Parameters
|
||||
//
|
||||
|
||||
//
|
||||
// Archive Components
|
||||
//
|
||||
|
||||
//
|
||||
// Archive Member Variables
|
||||
//
|
||||
ArchiveEnum ( _state, HoldPositionStates_t );
|
||||
arc.ArchiveObjectPointer( ( Class ** )&_self );
|
||||
|
||||
arc.ArchiveString( &_legAnim );
|
||||
arc.ArchiveString( &_torsoAnim );
|
||||
arc.ArchiveString( &_twitchAnim );
|
||||
arc.ArchiveString( &_weaponTwitchAnim );
|
||||
arc.ArchiveFloat( &_holdTimeMin );
|
||||
arc.ArchiveFloat( &_holdTimeMax );
|
||||
arc.ArchiveFloat( &_endHoldTime );
|
||||
arc.ArchiveFloat( &_nextTwitchTime );
|
||||
arc.ArchiveFloat( &_twitchInterval );
|
||||
arc.ArchiveBool ( &_canTwitch );
|
||||
arc.ArchiveBool ( &_animDone );
|
||||
}
|
||||
|
||||
|
||||
#endif /* __HOLD_POSITION__ */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Logfile:: /Code/DLLs/game/holdPosition.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:
|
||||
// holdPosition Behavior Definition
|
||||
//
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//==============================
|
||||
// Forward Declarations
|
||||
//==============================
|
||||
class HoldPosition;
|
||||
|
||||
#ifndef __HOLD_POSITION__
|
||||
#define __HOLD_POSITION__
|
||||
|
||||
#include "behavior.h"
|
||||
#include "behaviors_general.h"
|
||||
|
||||
//------------------------- CLASS ------------------------------
|
||||
//
|
||||
// Name: HoldPosition
|
||||
// Base Class: Behavior
|
||||
//
|
||||
// Description: Makes the actor idle in position, holding its
|
||||
// weapon appropriately, and occassionally twitch
|
||||
//
|
||||
//
|
||||
// Method of Use: Called From State Machine
|
||||
//--------------------------------------------------------------
|
||||
class HoldPosition : public Behavior {
|
||||
public:
|
||||
//------------------------------------
|
||||
// States
|
||||
//------------------------------------
|
||||
typedef enum {
|
||||
HOLD_POSITION_HOLD,
|
||||
HOLD_POSITION_TWITCH,
|
||||
HOLD_POSITION_WEAPON_TWITCH,
|
||||
HOLD_POSITION_SUCCESS,
|
||||
HOLD_POSITION_FAILED
|
||||
} HoldPositionStates_t;
|
||||
|
||||
//-------------------------------------
|
||||
// Public Interface
|
||||
//-------------------------------------
|
||||
CLASS_PROTOTYPE(HoldPosition);
|
||||
|
||||
HoldPosition();
|
||||
~HoldPosition();
|
||||
|
||||
void SetArgs(Event* ev);
|
||||
void AnimDone(Event* ev);
|
||||
|
||||
void Begin(Actor& self);
|
||||
BehaviorReturnCode_t Evaluate(Actor& self);
|
||||
void End(Actor& self);
|
||||
|
||||
// Accessors
|
||||
virtual void Archive(Archiver& arc);
|
||||
|
||||
//-------------------------------------
|
||||
// Internal Functionality
|
||||
//-------------------------------------
|
||||
protected:
|
||||
void transitionToState(HoldPositionStates_t state);
|
||||
void setInternalState(HoldPositionStates_t state, const str& stateName);
|
||||
void init(Actor &self);
|
||||
void think();
|
||||
|
||||
void setupStateHold();
|
||||
BehaviorReturnCode_t evaluateStateHold();
|
||||
void failureStateHold(const str& failureReason);
|
||||
|
||||
void setupStateTwitch();
|
||||
BehaviorReturnCode_t evaluateStateTwitch();
|
||||
void failureStateTwitch(const str& failureReason);
|
||||
|
||||
void setupStateWeaponTwitch();
|
||||
BehaviorReturnCode_t evaluateStateWeaponTwitch();
|
||||
void failureStateWeaponTwitch(const str& failureReason);
|
||||
|
||||
private:
|
||||
//------------------------------------
|
||||
// Parameters
|
||||
//------------------------------------
|
||||
|
||||
//-------------------------------------
|
||||
// Components
|
||||
//-------------------------------------
|
||||
str _legAnim;
|
||||
str _torsoAnim;
|
||||
str _twitchAnim;
|
||||
str _weaponTwitchAnim;
|
||||
|
||||
float _holdTimeMin;
|
||||
float _holdTimeMax;
|
||||
float _endHoldTime;
|
||||
float _nextTwitchTime;
|
||||
float _twitchInterval;
|
||||
bool _canTwitch;
|
||||
bool _animDone;
|
||||
|
||||
|
||||
//-------------------------------------
|
||||
// Member Variables
|
||||
//-------------------------------------
|
||||
HoldPositionStates_t _state;
|
||||
Actor* _self;
|
||||
|
||||
|
||||
};
|
||||
|
||||
inline void HoldPosition::Archive(Archiver& arc) {
|
||||
Behavior::Archive(arc);
|
||||
|
||||
//
|
||||
// Archive Parameters
|
||||
//
|
||||
|
||||
//
|
||||
// Archive Components
|
||||
//
|
||||
|
||||
//
|
||||
// Archive Member Variables
|
||||
//
|
||||
ArchiveEnum(_state, HoldPositionStates_t);
|
||||
arc.ArchiveObjectPointer((Class **)&_self);
|
||||
|
||||
arc.ArchiveString(&_legAnim);
|
||||
arc.ArchiveString(&_torsoAnim);
|
||||
arc.ArchiveString(&_twitchAnim);
|
||||
arc.ArchiveString(&_weaponTwitchAnim);
|
||||
arc.ArchiveFloat(&_holdTimeMin);
|
||||
arc.ArchiveFloat(&_holdTimeMax);
|
||||
arc.ArchiveFloat(&_endHoldTime);
|
||||
arc.ArchiveFloat(&_nextTwitchTime);
|
||||
arc.ArchiveFloat(&_twitchInterval);
|
||||
arc.ArchiveBool(&_canTwitch);
|
||||
arc.ArchiveBool(&_animDone);
|
||||
}
|
||||
|
||||
|
||||
#endif /* __HOLD_POSITION__ */
|
||||
|
||||
|
|
Loading…
Reference in a new issue