Reformatting

This commit is contained in:
Walter Julius Hennecke 2014-03-09 02:15:48 +01:00
parent f98ce24dec
commit 28213f6679

View file

@ -1,129 +1,122 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Logfile:: /Code/DLLs/game/doAttack.hpp $ // $Logfile:: /Code/DLLs/game/doAttack.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:
// DoAttack Behavior Definition // DoAttack Behavior Definition
// //
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
//============================== //==============================
// Forward Declarations // Forward Declarations
//============================== //==============================
class RotateToEntity; class RotateToEntity;
#ifndef __DO_ATTACK_H__ #ifndef __DO_ATTACK_H__
#define __DO_ATTACK_H__ #define __DO_ATTACK_H__
#include "behavior.h" #include "behavior.h"
#include "rotateToEntity.hpp" #include "rotateToEntity.hpp"
//------------------------- CLASS ------------------------------ //------------------------- CLASS ------------------------------
// //
// Name: DoAttack // Name: DoAttack
// Base Class: Behavior // Base Class: Behavior
// //
// Description: Rotates the Actor towards its enemy then // Description: Rotates the Actor towards its enemy then
// plays the specified attack animation // plays the specified attack animation
// This is good for actors that aren't using // This is good for actors that aren't using
// "real" weapons and are relying on animations // "real" weapons and are relying on animations
// to attack // to attack
// //
// Method of Use: State machine or called from another behavior // Method of Use: State machine or called from another behavior
//-------------------------------------------------------------- //--------------------------------------------------------------
class DoAttack : public Behavior class DoAttack : public Behavior {
{ public:
public: // States // States
typedef enum typedef enum {
{ ATTACK_STATE_SETUP,
ATTACK_STATE_SETUP, ATTACK_STATE_ROTATE,
ATTACK_STATE_ROTATE, ATTACK_STATE_START_ANIM,
ATTACK_STATE_START_ANIM, ATTACK_STATE_ANIMATING,
ATTACK_STATE_ANIMATING, ATTACK_STATE_COMPLETE,
ATTACK_STATE_COMPLETE, ATTACK_STATE_FAILED
ATTACK_STATE_FAILED } attackStates_t;
} attackStates_t;
CLASS_PROTOTYPE(DoAttack);
private: // Parameters
str _anim; void SetArgs(Event* ev);
float _turnspeed; void AnimDone(Event* ev);
bool _forceAttack; void Begin(Actor& self);
str _rotateAnim; BehaviorReturnCode_t Evaluate(Actor& self);
void End(Actor& self);
protected: virtual void Archive(Archiver& arc);
void _setupRotate ( Actor &self );
void _rotate ( Actor &self ); void SetAnim(const str& animName);
void _playAttackAnim ( Actor &self ); void SetTurnSpeed(float turnSpeed);
void SetForceAttack(bool force);
bool _canAttack ( Actor &self ); void SetRotateAnim(const str& animName);
void init ( Actor &self );
protected:
public: void _setupRotate(Actor& self);
CLASS_PROTOTYPE( DoAttack ); void _rotate(Actor& self);
void _playAttackAnim(Actor& self);
void SetArgs ( Event *ev );
void AnimDone ( Event *ev ); bool _canAttack(Actor& self);
void Begin ( Actor &self ); void init(Actor& self);
BehaviorReturnCode_t Evaluate ( Actor &self );
void End ( Actor &self ); private:
virtual void Archive ( Archiver &arc ); // Parameters
str _anim;
void SetAnim ( const str &animName ); float _turnspeed;
void SetTurnSpeed ( float turnSpeed ); bool _forceAttack;
void SetForceAttack ( bool force ); str _rotateAnim;
void SetRotateAnim ( const str &animName );
unsigned int _state;
private: RotateToEntity _rotateBehavior;
unsigned int _state; };
RotateToEntity _rotateBehavior;
};
inline void DoAttack::SetAnim(const str& animName) {
_anim = animName;
inline void DoAttack::SetAnim( const str &animName ) }
{
_anim = animName; inline void DoAttack::SetTurnSpeed(float turnSpeed) {
} _turnspeed = turnSpeed;
}
inline void DoAttack::SetTurnSpeed( float turnSpeed )
{ inline void DoAttack::SetForceAttack(bool force) {
_turnspeed = turnSpeed; _forceAttack = force;
} }
inline void DoAttack::SetForceAttack( bool force ) inline void DoAttack::SetRotateAnim(const str& animName) {
{ _rotateAnim = animName;
_forceAttack = force; }
}
inline void DoAttack::Archive(Archiver& arc) {
inline void DoAttack::SetRotateAnim( const str &animName ) Behavior::Archive(arc);
{
_rotateAnim = animName; // Archive Parameters
} arc.ArchiveString(&_anim);
arc.ArchiveFloat(&_turnspeed);
inline void DoAttack::Archive( Archiver &arc ) arc.ArchiveBool(&_forceAttack);
{ arc.ArchiveString(&_rotateAnim);
Behavior::Archive( arc );
// Archive Components
// Archive Parameters
arc.ArchiveString ( &_anim ); // Archive Member Vars
arc.ArchiveFloat ( &_turnspeed ); arc.ArchiveUnsigned(&_state);
arc.ArchiveBool ( &_forceAttack ); arc.ArchiveObject(&_rotateBehavior);
arc.ArchiveString ( &_rotateAnim ); }
// Archive Components #endif /* __DO_ATTACK_H__ */
// Archive Member Vars
arc.ArchiveUnsigned ( &_state );
arc.ArchiveObject ( &_rotateBehavior );
}
#endif /* __DO_ATTACK_H__ */