AnimationTracker Class Reference

#include <AnimationTracker.h>

List of all members.

Public Member Functions

 AnimationTracker ()
 ~AnimationTracker ()
bool init (Actor *actor, Animation::Sequence action, uint32 dir, PathfindingState *state=0)
void evaluateMaxAnimTravel (sint32 &max_endx, sint32 &max_endy, uint32 dir)
bool step ()
bool stepFrom (sint32 x, sint32 y, sint32 z)
void updateState (PathfindingState &state)
void updateActorFlags ()
void getPosition (sint32 &x_, sint32 &y_, sint32 &z_)
void getInterpolatedPosition (sint32 &x_, sint32 &y_, sint32 &z_, int fc)
void getSpeed (sint32 &dx, sint32 &dy, sint32 &dz)
uint32 getFrame ()
AnimActiongetAnimAction ()
AnimFramegetAnimFrame ()
void setTargetedMode (sint32 x_, sint32 y_, sint32 z_)
bool isDone () const
bool isBlocked () const
bool isUnsupported () const
ObjId hitSomething () const
bool load (IDataSource *ids, uint32 version)
void save (ODataSource *ods)

Private Types

 NormalMode = 0
 TargetMode
enum  Mode { NormalMode = 0, TargetMode }

Private Member Functions

unsigned int getNextFrame (unsigned int frame)
void checkWeaponHit ()

Private Attributes

unsigned int startframe
unsigned int endframe
bool firstframe
unsigned int currentframe
ObjId actor
unsigned int dir
AnimActionanimaction
sint32 prevx
sint32 prevy
sint32 prevz
sint32 x
sint32 y
sint32 z
sint32 startx
sint32 starty
sint32 startz
sint32 target_dx
sint32 target_dy
bool firststep
bool flipped
uint32 shapeframe
bool done
bool blocked
bool unsupported
ObjId hitobject
Mode mode


Detailed Description

Definition at line 31 of file AnimationTracker.h.


Member Enumeration Documentation

enum AnimationTracker::Mode [private]

Enumerator:
NormalMode 
TargetMode 

Definition at line 92 of file AnimationTracker.h.


Constructor & Destructor Documentation

AnimationTracker::AnimationTracker (  ) 

Definition at line 44 of file AnimationTracker.cpp.

AnimationTracker::~AnimationTracker (  ) 

Definition at line 49 of file AnimationTracker.cpp.


Member Function Documentation

void AnimationTracker::checkWeaponHit (  )  [private]

Definition at line 412 of file AnimationTracker.cpp.

References actor, animaction, CurrentMap::areaSearch(), currentframe, dir, Actor::dumpInfo(), AnimAction::frames, World::get_instance(), getActor(), World::getCurrentMap(), Object::getObjId(), UCList::getSize(), UCList::getuint16(), Item::getWorldBox(), hitobject, Pentagram::Box::MoveAbs(), Pentagram::Box::MoveRel(), Pentagram::Box::Overlaps(), pout, watchactor, Pentagram::Box::x, x, x_fact, Pentagram::Box::xd, Pentagram::Box::y, y, y_fact, Pentagram::Box::yd, Pentagram::Box::z, z, and Pentagram::Box::zd.

Referenced by step().

void AnimationTracker::evaluateMaxAnimTravel ( sint32 max_endx,
sint32 max_endy,
uint32  dir 
)

evaluate the maximum distance the actor will travel if the current animation runs to completion by incremental calls to step

Definition at line 134 of file AnimationTracker.cpp.

References actor, animaction, currentframe, done, endframe, firstframe, AnimAction::frames, getActor(), getNextFrame(), startframe, x, x_fact, y, and y_fact.

Referenced by Pathfinder::expandNode().

AnimAction* AnimationTracker::getAnimAction (  )  [inline]

get the current AnimAction

Definition at line 76 of file AnimationTracker.h.

References animaction.

Referenced by ActorAnimProcess::run(), and Actor::tryAnim().

AnimFrame * AnimationTracker::getAnimFrame (  ) 

get the current AnimFrame

Definition at line 380 of file AnimationTracker.cpp.

References animaction, currentframe, dir, and AnimAction::frames.

Referenced by ActorAnimProcess::run().

uint32 AnimationTracker::getFrame (  )  [inline]

get the current (shape)frame

Definition at line 73 of file AnimationTracker.h.

References shapeframe.

Referenced by ActorAnimProcess::run().

void AnimationTracker::getInterpolatedPosition ( sint32 x_,
sint32 y_,
sint32 z_,
int  fc 
)

Definition at line 508 of file AnimationTracker.cpp.

References animaction, AnimAction::framerepeat, prevx, prevy, prevz, x, y, and z.

Referenced by ActorAnimProcess::run().

unsigned int AnimationTracker::getNextFrame ( unsigned int  frame  )  [private]

Definition at line 104 of file AnimationTracker.cpp.

References AnimAction::AAF_LOOPING, AnimAction::AAF_LOOPING2, animaction, endframe, AnimAction::flags, and AnimAction::size.

Referenced by evaluateMaxAnimTravel(), setTargetedMode(), and step().

void AnimationTracker::getPosition ( sint32 x_,
sint32 y_,
sint32 z_ 
) [inline]

get the current position

Definition at line 64 of file AnimationTracker.h.

Referenced by Actor::tryAnim().

void AnimationTracker::getSpeed ( sint32 dx,
sint32 dy,
sint32 dz 
)

get the difference between current position and previous position

Definition at line 520 of file AnimationTracker.cpp.

References prevx, prevy, prevz, x, y, and z.

Referenced by ActorAnimProcess::run().

ObjId AnimationTracker::hitSomething (  )  const [inline]

Definition at line 86 of file AnimationTracker.h.

References hitobject.

Referenced by PathfindingState::checkHit(), CombatProcess::inAttackRange(), and ActorAnimProcess::run().

bool AnimationTracker::init ( Actor actor,
Animation::Sequence  action,
uint32  dir,
PathfindingState state = 0 
)

initialize the AnimationTracker for the given actor, action, dir if state is non-zero, start from that state instead of the Actor's current state

Definition at line 54 of file AnimationTracker.cpp.

References Actor::ACT_FIRSTSTEP, actor, animaction, blocked, dir, PathfindingState::direction, done, endframe, firstframe, PathfindingState::firststep, firststep, AnimAction::flags, Item::FLG_FLIPPED, PathfindingState::flipped, flipped, GameData::get_instance(), Actor::getActorFlags(), AnimAction::getAnimRange(), Item::getFlags(), Item::getLocation(), GameData::getMainShapes(), Object::getObjId(), Item::getShape(), hitobject, PathfindingState::lastanim, mode, NormalMode, pout, startframe, startx, starty, startz, unsupported, watchactor, PathfindingState::x, x, PathfindingState::y, y, PathfindingState::z, and z.

Referenced by PathfindingState::checkHit(), Pathfinder::expandNode(), Actor::hasAnim(), CombatProcess::inAttackRange(), ActorAnimProcess::init(), and Actor::tryAnim().

bool AnimationTracker::isBlocked (  )  const [inline]

Definition at line 84 of file AnimationTracker.h.

References blocked.

Referenced by ActorAnimProcess::run(), and Actor::tryAnim().

bool AnimationTracker::isDone (  )  const [inline]

Definition at line 83 of file AnimationTracker.h.

References done.

Referenced by Pathfinder::expandNode(), and ActorAnimProcess::run().

bool AnimationTracker::isUnsupported (  )  const [inline]

Definition at line 85 of file AnimationTracker.h.

References unsupported.

Referenced by ActorAnimProcess::run(), and Actor::tryAnim().

bool AnimationTracker::load ( IDataSource ids,
uint32  version 
)

Definition at line 574 of file AnimationTracker.cpp.

References actor, animaction, blocked, currentframe, dir, done, endframe, firstframe, firststep, flipped, GameData::get_instance(), GameData::getMainShapes(), hitobject, mode, prevx, prevy, prevz, IDataSource::read1(), IDataSource::read2(), IDataSource::read4(), shapeframe, shapenum, startframe, target_dx, target_dy, TargetMode, unsupported, x, y, and z.

Referenced by ActorAnimProcess::loadData().

void AnimationTracker::save ( ODataSource ods  ) 

Definition at line 528 of file AnimationTracker.cpp.

References AnimAction::action, actor, animaction, blocked, currentframe, dir, done, endframe, firstframe, firststep, flipped, hitobject, mode, prevx, prevy, prevz, shapeframe, AnimAction::shapenum, startframe, target_dx, target_dy, TargetMode, unsupported, ODataSource::write1(), ODataSource::write2(), ODataSource::write4(), x, y, and z.

Referenced by ActorAnimProcess::saveData().

void AnimationTracker::setTargetedMode ( sint32  x_,
sint32  y_,
sint32  z_ 
)

Definition at line 385 of file AnimationTracker.cpp.

References AnimFrame::AFF_ONGROUND, animaction, dir, endframe, AnimAction::frames, getNextFrame(), if(), mode, startframe, target_dx, target_dy, TargetMode, x, x_fact, y, and y_fact.

Referenced by TargetedAnimProcess::init().

bool AnimationTracker::step (  ) 

do a single step of the animation returns true if everything ok, false if not caller must decide if animation should continue after a 'false'

Definition at line 164 of file AnimationTracker.cpp.

References AnimAction::AAF_ATTACK, AnimAction::AAF_TWOSTEP, actor, AnimFrame::AFF_ONGROUND, animaction, AnimFrame::attack_range(), blocked, checkWeaponHit(), currentframe, AnimFrame::deltadir, AnimFrame::deltaz, dir, done, endframe, firstframe, firststep, ShapeInfo::flags, AnimFrame::flags, AnimAction::flags, Item::FLG_FLIPPED, flipped, AnimFrame::frame, AnimAction::frames, World::get_instance(), getActor(), World::getCurrentMap(), Item::getFlags(), Item::getFootpadWorld(), getItem(), getNextFrame(), Object::getObjId(), Item::getShapeInfo(), hitobject, AnimFrame::is_flipped(), ShapeInfo::is_land(), CurrentMap::isValidPosition(), mode, pout, prevx, prevy, prevz, CurrentMap::scanForValidPosition(), shapeframe, startframe, startx, starty, startz, target_dx, target_dy, TargetMode, unsupported, watchactor, x, x_fact, y, y_fact, and z.

Referenced by PathfindingState::checkHit(), Pathfinder::expandNode(), CombatProcess::inAttackRange(), stepFrom(), and Actor::tryAnim().

bool AnimationTracker::stepFrom ( sint32  x,
sint32  y,
sint32  z 
)

do a single step of the animation, starting at (x,y,z) returns true if everything ok, false if not caller must decide if animation should continue after a 'false'

Definition at line 125 of file AnimationTracker.cpp.

References step(), x, y, and z.

Referenced by ActorAnimProcess::run().

void AnimationTracker::updateActorFlags (  ) 

update the Actor with latest flags and animframe

Definition at line 481 of file AnimationTracker.cpp.

References AnimAction::AAF_HANGING, Actor::ACT_FIRSTSTEP, actor, animaction, Actor::animframe, Actor::clearActorFlag(), Item::clearFlag(), currentframe, endframe, firststep, AnimAction::flags, Item::FLG_FLIPPED, Item::FLG_HANGING, flipped, getActor(), Actor::setActorFlag(), and Item::setFlag().

Referenced by ActorAnimProcess::run().

void AnimationTracker::updateState ( PathfindingState state  ) 

update the PathfindingState with latest coordinates and flags

Definition at line 471 of file AnimationTracker.cpp.

References firststep, PathfindingState::firststep, flipped, PathfindingState::flipped, x, PathfindingState::x, y, PathfindingState::y, z, and PathfindingState::z.

Referenced by Pathfinder::expandNode(), and Actor::tryAnim().


Member Data Documentation

ObjId AnimationTracker::actor [private]

Definition at line 105 of file AnimationTracker.h.

Referenced by checkWeaponHit(), evaluateMaxAnimTravel(), init(), load(), save(), step(), and updateActorFlags().

AnimAction* AnimationTracker::animaction [private]

Definition at line 108 of file AnimationTracker.h.

Referenced by checkWeaponHit(), evaluateMaxAnimTravel(), getAnimAction(), getAnimFrame(), getInterpolatedPosition(), getNextFrame(), init(), load(), save(), setTargetedMode(), step(), and updateActorFlags().

bool AnimationTracker::blocked [private]

Definition at line 120 of file AnimationTracker.h.

Referenced by init(), isBlocked(), load(), save(), and step().

unsigned int AnimationTracker::currentframe [private]

Definition at line 103 of file AnimationTracker.h.

Referenced by checkWeaponHit(), evaluateMaxAnimTravel(), getAnimFrame(), load(), save(), step(), and updateActorFlags().

unsigned int AnimationTracker::dir [private]

Definition at line 106 of file AnimationTracker.h.

Referenced by checkWeaponHit(), getAnimFrame(), init(), load(), save(), setTargetedMode(), and step().

bool AnimationTracker::done [private]

Definition at line 119 of file AnimationTracker.h.

Referenced by evaluateMaxAnimTravel(), init(), isDone(), load(), save(), and step().

unsigned int AnimationTracker::endframe [private]

Definition at line 101 of file AnimationTracker.h.

Referenced by evaluateMaxAnimTravel(), getNextFrame(), init(), load(), save(), setTargetedMode(), step(), and updateActorFlags().

bool AnimationTracker::firstframe [private]

Definition at line 102 of file AnimationTracker.h.

Referenced by evaluateMaxAnimTravel(), init(), load(), save(), and step().

bool AnimationTracker::firststep [private]

Definition at line 115 of file AnimationTracker.h.

Referenced by init(), load(), save(), step(), updateActorFlags(), and updateState().

bool AnimationTracker::flipped [private]

Definition at line 115 of file AnimationTracker.h.

Referenced by init(), load(), save(), step(), updateActorFlags(), and updateState().

ObjId AnimationTracker::hitobject [private]

Definition at line 122 of file AnimationTracker.h.

Referenced by checkWeaponHit(), hitSomething(), init(), load(), save(), and step().

Mode AnimationTracker::mode [private]

Definition at line 124 of file AnimationTracker.h.

Referenced by init(), load(), save(), setTargetedMode(), and step().

sint32 AnimationTracker::prevx [private]

Definition at line 111 of file AnimationTracker.h.

Referenced by getInterpolatedPosition(), getSpeed(), load(), save(), and step().

sint32 AnimationTracker::prevy [private]

Definition at line 111 of file AnimationTracker.h.

Referenced by getInterpolatedPosition(), getSpeed(), load(), save(), and step().

sint32 AnimationTracker::prevz [private]

Definition at line 111 of file AnimationTracker.h.

Referenced by getInterpolatedPosition(), getSpeed(), load(), save(), and step().

uint32 AnimationTracker::shapeframe [private]

Definition at line 116 of file AnimationTracker.h.

Referenced by getFrame(), load(), save(), and step().

unsigned int AnimationTracker::startframe [private]

Definition at line 101 of file AnimationTracker.h.

Referenced by evaluateMaxAnimTravel(), init(), load(), save(), setTargetedMode(), and step().

sint32 AnimationTracker::startx [private]

Definition at line 113 of file AnimationTracker.h.

Referenced by init(), and step().

sint32 AnimationTracker::starty [private]

Definition at line 113 of file AnimationTracker.h.

Referenced by init(), and step().

sint32 AnimationTracker::startz [private]

Definition at line 113 of file AnimationTracker.h.

Referenced by init(), and step().

sint32 AnimationTracker::target_dx [private]

Definition at line 114 of file AnimationTracker.h.

Referenced by load(), save(), setTargetedMode(), and step().

sint32 AnimationTracker::target_dy [private]

Definition at line 114 of file AnimationTracker.h.

Referenced by load(), save(), setTargetedMode(), and step().

bool AnimationTracker::unsupported [private]

Definition at line 121 of file AnimationTracker.h.

Referenced by init(), isUnsupported(), load(), save(), and step().

sint32 AnimationTracker::x [private]

Definition at line 112 of file AnimationTracker.h.

Referenced by checkWeaponHit(), evaluateMaxAnimTravel(), getInterpolatedPosition(), getSpeed(), init(), load(), save(), setTargetedMode(), step(), stepFrom(), and updateState().

sint32 AnimationTracker::y [private]

Definition at line 112 of file AnimationTracker.h.

Referenced by checkWeaponHit(), evaluateMaxAnimTravel(), getInterpolatedPosition(), getSpeed(), init(), load(), save(), setTargetedMode(), step(), stepFrom(), and updateState().

sint32 AnimationTracker::z [private]

Definition at line 112 of file AnimationTracker.h.

Referenced by checkWeaponHit(), getInterpolatedPosition(), getSpeed(), init(), load(), save(), step(), stepFrom(), and updateState().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:28:39 2007 for pentagram by  doxygen 1.4.7