Actor Class Reference

#include <Actor.h>

Inheritance diagram for Actor:

Container Item Object MainActor List of all members.

Public Types

 ACT_INVINCIBLE = 0x000001
 ACT_ASCENDING = 0x000002
 ACT_DESCENDING = 0x000004
 ACT_ANIMLOCK = 0x000008
 ACT_FIRSTSTEP = 0x000400
 ACT_INCOMBAT = 0x000800
 ACT_DEAD = 0x001000
 ACT_COMBATRUN = 0x008000
 ACT_AIRWALK = 0x010000
 ACT_IMMORTAL = 0x040000
 ACT_WITHSTANDDEATH = 0x080000
 ACT_FEIGNDEATH = 0x100000
 ACT_STUNNED = 0x200000
 ACT_POISONED = 0x400000
 ACT_PATHFINDING = 0x800000
enum  ActorFlags {
  ACT_INVINCIBLE = 0x000001, ACT_ASCENDING = 0x000002, ACT_DESCENDING = 0x000004, ACT_ANIMLOCK = 0x000008,
  ACT_FIRSTSTEP = 0x000400, ACT_INCOMBAT = 0x000800, ACT_DEAD = 0x001000, ACT_COMBATRUN = 0x008000,
  ACT_AIRWALK = 0x010000, ACT_IMMORTAL = 0x040000, ACT_WITHSTANDDEATH = 0x080000, ACT_FEIGNDEATH = 0x100000,
  ACT_STUNNED = 0x200000, ACT_POISONED = 0x400000, ACT_PATHFINDING = 0x800000
}

Public Member Functions

 Actor ()
 ~Actor ()
sint16 getStr () const
void setStr (sint16 str)
sint16 getDex () const
void setDex (sint16 dex)
sint16 getInt () const
void setInt (sint16 int_)
uint16 getHP () const
void setHP (uint16 hp)
sint16 getMana () const
void setMana (sint16 mp)
sint16 getMaxMana () const
uint16 getMaxHP () const
bool isDead () const
bool isInCombat () const
void toggleInCombat ()
CombatProcessgetCombatProcess ()
virtual void setInCombat ()
virtual void clearInCombat ()
uint16 getAlignment () const
void setAlignment (uint16 a)
uint16 getEnemyAlignment () const
void setEnemyAlignment (uint16 a)
Animation::Sequence getLastAnim () const
void setLastAnim (Animation::Sequence anim)
uint16 getDir () const
void setDir (uint16 dir)
sint32 getFallStart () const
void setFallStart (sint32 z)
void setUnk0C (uint8 b)
uint32 getActorFlags () const
void setActorFlag (uint32 mask)
void clearActorFlag (uint32 mask)
bool loadMonsterStats ()
bool giveTreasure ()
virtual void teleport (int mapnum, sint32 x, sint32 y, sint32 z)
virtual bool removeItem (Item *item)
uint16 schedule (uint32 time)
bool setEquip (Item *item, bool checkwghtvol=false)
uint16 getEquip (uint32 type)
virtual uint32 getArmourClass ()
virtual uint16 getDefenseType ()
virtual sint16 getAttackingDex ()
virtual sint16 getDefendingDex ()
virtual uint16 getDamageType ()
virtual int getDamageAmount ()
int calculateAttackDamage (uint16 other, int damage, uint16 type)
virtual void receiveHit (uint16 other, int dir, int damage, uint16 type)
virtual ProcId die (uint16 damageType)
void killAllButCombatProcesses ()
ProcId killAllButFallAnims (bool death)
bool areEnemiesNear ()
uint16 cSetActivity (int activity)
uint16 doAnim (Animation::Sequence anim, int dir, unsigned int steps=0)
bool hasAnim (Animation::Sequence anim)
Animation::Result tryAnim (Animation::Sequence anim, int dir, unsigned int steps=0, PathfindingState *state=0)
virtual uint16 assignObjId ()
virtual void dumpInfo ()
bool loadData (IDataSource *ids, uint32 version)
 ENABLE_RUNTIME_CLASSTYPE ()
 INTRINSIC (I_isNPC)
 INTRINSIC (I_getDir)
 INTRINSIC (I_getLastAnimSet)
 INTRINSIC (I_pathfindToItem)
 INTRINSIC (I_pathfindToPoint)
 INTRINSIC (I_getStr)
 INTRINSIC (I_getDex)
 INTRINSIC (I_getInt)
 INTRINSIC (I_getHp)
 INTRINSIC (I_getMana)
 INTRINSIC (I_getAlignment)
 INTRINSIC (I_getEnemyAlignment)
 INTRINSIC (I_setStr)
 INTRINSIC (I_setDex)
 INTRINSIC (I_setInt)
 INTRINSIC (I_setHp)
 INTRINSIC (I_setMana)
 INTRINSIC (I_setAlignment)
 INTRINSIC (I_setEnemyAlignment)
 INTRINSIC (I_getMap)
 INTRINSIC (I_teleport)
 INTRINSIC (I_doAnim)
 INTRINSIC (I_isInCombat)
 INTRINSIC (I_setInCombat)
 INTRINSIC (I_clrInCombat)
 INTRINSIC (I_setTarget)
 INTRINSIC (I_getTarget)
 INTRINSIC (I_isEnemy)
 INTRINSIC (I_isDead)
 INTRINSIC (I_setDead)
 INTRINSIC (I_clrDead)
 INTRINSIC (I_isImmortal)
 INTRINSIC (I_setImmortal)
 INTRINSIC (I_clrImmortal)
 INTRINSIC (I_isWithstandDeath)
 INTRINSIC (I_setWithstandDeath)
 INTRINSIC (I_clrWithstandDeath)
 INTRINSIC (I_isFeignDeath)
 INTRINSIC (I_setFeignDeath)
 INTRINSIC (I_clrFeignDeath)
 INTRINSIC (I_areEnemiesNear)
 INTRINSIC (I_isBusy)
 INTRINSIC (I_createActor)
 INTRINSIC (I_cSetActivity)
 INTRINSIC (I_setAirWalkEnabled)
 INTRINSIC (I_getAirWalkEnabled)
 INTRINSIC (I_schedule)
 INTRINSIC (I_getEquip)
 INTRINSIC (I_setEquip)

Static Public Member Functions

static ActorcreateActor (uint32 shape, uint32 frame)

Protected Member Functions

virtual void saveData (ODataSource *ods)

Protected Attributes

sint16 strength
sint16 dexterity
sint16 intelligence
uint16 hitpoints
sint16 mana
uint16 alignment
uint16 enemyalignment
Animation::Sequence lastanim
uint16 animframe
uint16 direction
sint32 fallstart
uint8 unk0C
uint32 actorflags

Friends

class ActorAnimProcess
class AnimationTracker

Detailed Description

Definition at line 30 of file Actor.h.


Member Enumeration Documentation

enum Actor::ActorFlags

Enumerator:
ACT_INVINCIBLE 
ACT_ASCENDING 
ACT_DESCENDING 
ACT_ANIMLOCK 
ACT_FIRSTSTEP 
ACT_INCOMBAT 
ACT_DEAD 
ACT_COMBATRUN 
ACT_AIRWALK 
ACT_IMMORTAL 
ACT_WITHSTANDDEATH 
ACT_FEIGNDEATH 
ACT_STUNNED 
ACT_POISONED 
ACT_PATHFINDING 

Definition at line 215 of file Actor.h.


Constructor & Destructor Documentation

Actor::Actor (  ) 

Definition at line 59 of file Actor.cpp.

Actor::~Actor (  ) 

Definition at line 68 of file Actor.cpp.


Member Function Documentation

bool Actor::areEnemiesNear (  ) 

check if NPCs are near which are in combat mode and hostile

Definition at line 1055 of file Actor.cpp.

References ACT_DEAD, ACT_FEIGNDEATH, ACT_INCOMBAT, CurrentMap::areaSearch(), World::get_instance(), getActor(), World::getCurrentMap(), UCList::getSize(), and UCList::getuint16().

uint16 Actor::assignObjId (  )  [virtual]

Assign self and contents an objID

Returns:
the assiged ID

Reimplemented from Container.

Definition at line 73 of file Actor.cpp.

References ObjectManager::assignActorObjId(), Container::contents, ObjectManager::get_instance(), and Object::objid.

Referenced by ItemFactory::createActor().

int Actor::calculateAttackDamage ( uint16  other,
int  damage,
uint16  type 
)

calculate the damage an attack against this Actor does.

Parameters:
other the attacker (can be zero)
damage base damage
type damage type
Returns:
the amount of damage to be applied. Zero if attack missed.

Definition at line 906 of file Actor.cpp.

References MainActor::accumulateDex(), ACT_STUNNED, WeaponInfo::DMG_BLADE, WeaponInfo::DMG_FIRE, WeaponInfo::DMG_MAGIC, WeaponInfo::DMG_PIERCE, WeaponInfo::DMG_SLAYER, WeaponInfo::DMG_UNDEAD, getActor(), getActorFlags(), getArmourClass(), getAttackingDex(), getDefendingDex(), getDefenseType(), getLastAnim(), getMainActor(), getStr(), Animation::startBlock, and Animation::stopBlock.

Referenced by receiveHit().

void Actor::clearActorFlag ( uint32  mask  )  [inline]

Definition at line 78 of file Actor.h.

References actorflags.

Referenced by MainActor::clearInCombat(), clearInCombat(), MainActor::ConCmd_toggleInvincibility(), die(), AvatarMoverProcess::handleNormalMode(), World::loadItemCachNPCData(), receiveHit(), ResurrectionProcess::run(), ClearFeignDeathProcess::run(), PathfinderProcess::terminate(), CombatProcess::terminate(), ActorAnimProcess::terminate(), and AnimationTracker::updateActorFlags().

void Actor::clearInCombat (  )  [virtual]

Reimplemented in MainActor.

Definition at line 1045 of file Actor.cpp.

References ACT_INCOMBAT, actorflags, clearActorFlag(), getCombatProcess(), and CombatProcess::terminate().

Referenced by toggleInCombat().

Actor * Actor::createActor ( uint32  shape,
uint32  frame 
) [static]

create an actor, assign objid, make it ethereal and load monster stats.

Definition at line 1093 of file Actor.cpp.

References ItemFactory::createActor(), World::etherealPush(), Item::FLG_ETHEREAL, Item::FLG_IN_NPC_LIST, World::get_instance(), getMainActor(), Item::getMapNum(), Object::getObjId(), loadMonsterStats(), perr, Item::setFlag(), Item::setMapNum(), and Item::setNpcNum().

Referenced by ActorAnimProcess::doSpecial().

uint16 Actor::cSetActivity ( int  activity  ) 

starts an activity

Returns:
processID of process handling the activity or zero

Definition at line 540 of file Actor.cpp.

References Kernel::addProcess(), doAnim(), Kernel::get_instance(), perr, setInCombat(), and Animation::stand.

Referenced by MonsterEgg::hatch().

ProcId Actor::die ( uint16  damageType  )  [virtual]

die

Parameters:
damageType damage type that caused the death
Returns:
the process ID of the death animation

Reimplemented in MainActor.

Definition at line 755 of file Actor.cpp.

References ACT_DEAD, ACT_INCOMBAT, Kernel::addProcess(), clearActorFlag(), ItemFactory::createItem(), Container::destroyContents(), Animation::die, WeaponInfo::DMG_FIRE, doAnim(), MonsterInfo::explode, Item::FLG_FAST_ONLY, Shape::frameCount(), GameData::get_instance(), MusicProcess::get_instance(), Kernel::get_instance(), getAlignment(), getDir(), getEnemyAlignment(), getMainActor(), GameData::getMainShapes(), Object::getObjId(), Kernel::getProcess(), ShapeArchive::getShape(), Item::getShapeInfo(), giveTreasure(), isInCombat(), killAllButFallAnims(), Kernel::killProcesses(), ShapeInfo::monsterinfo, Item::move(), MusicProcess::playCombatMusic(), pout, MusicProcess::queueMusic(), MonsterInfo::resurrection, setActorFlag(), setHP(), Animation::standUp, Process::waitFor(), Item::x, Item::y, and Item::z.

Referenced by MainActor::die(), and receiveHit().

uint16 Actor::doAnim ( Animation::Sequence  anim,
int  dir,
unsigned int  steps = 0 
)

run the given animation

Returns:
the PID of the ActorAnimProcess

Definition at line 451 of file Actor.cpp.

References ActorAnimProcess, Kernel::addProcess(), Kernel::get_instance(), perr, and tryAnim().

Referenced by AvatarMoverProcess::checkTurn(), cSetActivity(), die(), ActorAnimProcess::doSpecial(), GameMapGump::DropItem(), AvatarMoverProcess::handleCombatMode(), AvatarMoverProcess::handleHangingMode(), AvatarMoverProcess::handleNormalMode(), AvatarMoverProcess::jump(), receiveHit(), PathfinderProcess::run(), LoiterProcess::run(), CombatProcess::run(), AvatarGravityProcess::run(), ActorBarkNotifyProcess::run(), AvatarMoverProcess::step(), GravityProcess::terminate(), CombatProcess::turnToDirection(), AvatarMoverProcess::turnToDirection(), and CombatProcess::waitForTarget().

void Actor::dumpInfo (  )  [virtual]

dump some info about this item to pout

Reimplemented from Container.

Definition at line 1118 of file Actor.cpp.

References actorflags, dexterity, Container::dumpInfo(), getAlignment(), getArmourClass(), getDefenseType(), getEnemyAlignment(), hitpoints, intelligence, mana, pout, and strength.

Referenced by AnimationTracker::checkWeaponHit().

Actor::ENABLE_RUNTIME_CLASSTYPE (  ) 

Reimplemented from Container.

Reimplemented in MainActor.

uint32 Actor::getActorFlags (  )  const [inline]

Definition at line 76 of file Actor.h.

References actorflags.

Referenced by calculateAttackDamage(), AvatarMoverProcess::checkTurn(), MainActor::ConCmd_toggleInvincibility(), ActorAnimProcess::doHitSpecial(), AnimAction::getAnimRange(), AvatarMoverProcess::handleNormalMode(), AnimationTracker::init(), ActorAnimProcess::init(), AvatarMoverProcess::jump(), PathfindingState::load(), MenuGump::OnKeyDown(), MusicProcess::playMusic(), receiveHit(), PathfinderProcess::run(), AvatarMoverProcess::run(), AvatarDeathProcess::run(), GUIApp::saveGame(), MenuGump::selectEntry(), and AvatarMoverProcess::turnToDirection().

uint16 Actor::getAlignment (  )  const [inline]

Definition at line 63 of file Actor.h.

References alignment.

Referenced by die(), and dumpInfo().

uint32 Actor::getArmourClass (  )  [virtual]

Reimplemented in MainActor.

Definition at line 562 of file Actor.cpp.

References MonsterInfo::armour_class, Item::getShapeInfo(), and ShapeInfo::monsterinfo.

Referenced by calculateAttackDamage(), dumpInfo(), and PaperdollGump::PaintStats().

sint16 Actor::getAttackingDex (  )  [virtual]

Reimplemented in MainActor.

Definition at line 585 of file Actor.cpp.

References getDex().

Referenced by calculateAttackDamage().

CombatProcess * Actor::getCombatProcess (  ) 

Definition at line 1013 of file Actor.cpp.

References Kernel::findProcess(), Kernel::get_instance(), and Object::objid.

Referenced by clearInCombat(), ActorAnimProcess::doSpecial(), receiveHit(), AmbushProcess::run(), and setInCombat().

int Actor::getDamageAmount (  )  [virtual]

Reimplemented in MainActor.

Definition at line 600 of file Actor.cpp.

References Item::getShapeInfo(), max(), MonsterInfo::max_dmg, min(), MonsterInfo::min_dmg, and ShapeInfo::monsterinfo.

Referenced by receiveHit().

uint16 Actor::getDamageType (  )  [virtual]

get the damage type this object does when hitting something

Reimplemented from Item.

Reimplemented in MainActor.

Definition at line 590 of file Actor.cpp.

References MonsterInfo::damage_type, WeaponInfo::DMG_NORMAL, Item::getShapeInfo(), and ShapeInfo::monsterinfo.

Referenced by MainActor::getDamageType().

sint16 Actor::getDefendingDex (  )  [virtual]

Reimplemented in MainActor.

Definition at line 580 of file Actor.cpp.

References getDex().

Referenced by calculateAttackDamage().

uint16 Actor::getDefenseType (  )  [virtual]

Reimplemented in MainActor.

Definition at line 571 of file Actor.cpp.

References MonsterInfo::defense_type, Item::getShapeInfo(), and ShapeInfo::monsterinfo.

Referenced by calculateAttackDamage(), dumpInfo(), and CombatProcess::isValidTarget().

sint16 Actor::getDex (  )  const [inline]

Definition at line 40 of file Actor.h.

References dexterity.

Referenced by AvatarMoverProcess::canAttack(), GameMapGump::DropItem(), MainActor::getAttackingDex(), getAttackingDex(), MainActor::getDefendingDex(), getDefendingDex(), PaperdollGump::PaintStats(), CombatProcess::run(), U8Game::writeSaveInfo(), and RemorseGame::writeSaveInfo().

uint16 Actor::getDir (  )  const [inline]

Definition at line 70 of file Actor.h.

References direction.

Referenced by AvatarMoverProcess::checkTurn(), die(), ActorAnimProcess::doSpecial(), AnimAction::getAnimRange(), AvatarMoverProcess::handleCombatMode(), AvatarMoverProcess::handleNormalMode(), CombatProcess::inAttackRange(), ActorAnimProcess::init(), PathfindingState::load(), CombatProcess::run(), AvatarGravityProcess::run(), GravityProcess::terminate(), tryAnim(), CombatProcess::turnToDirection(), and AvatarMoverProcess::turnToDirection().

uint16 Actor::getEnemyAlignment (  )  const [inline]

Definition at line 65 of file Actor.h.

References enemyalignment.

Referenced by die(), dumpInfo(), and CombatProcess::isEnemy().

uint16 Actor::getEquip ( uint32  type  ) 

Definition at line 402 of file Actor.cpp.

References Container::contents, and Item::FLG_EQUIPPED.

Referenced by Container::CanAddItem(), U8Game::ConCmd_cheatEquip(), U8Game::ConCmd_cheatItems(), MainActor::ConCmd_useBackpack(), ActorAnimProcess::doHitSpecial(), ActorAnimProcess::doSpecial(), PaperdollGump::DraggingItem(), GameMapGump::DraggingItem(), PaperdollGump::DropItem(), GameMapGump::DropItem(), MainActor::getAttackingDex(), MainActor::getDamageAmount(), MainActor::getDamageType(), MainActor::getDefendingDex(), MainActor::getWeaponOverlay(), PaperdollGump::PaintThis(), PaperdollGump::TraceObjId(), U8Game::writeSaveInfo(), and RemorseGame::writeSaveInfo().

sint32 Actor::getFallStart (  )  const [inline]

Definition at line 72 of file Actor.h.

References fallstart.

Referenced by GravityProcess::run(), and GravityProcess::terminate().

uint16 Actor::getHP (  )  const [inline]

Definition at line 44 of file Actor.h.

References hitpoints.

Referenced by HealProcess::feedAvatar(), PaperdollGump::PaintStats(), MiniStatsGump::PaintThis(), HealProcess::run(), GravityProcess::terminate(), U8Game::writeSaveInfo(), and RemorseGame::writeSaveInfo().

sint16 Actor::getInt (  )  const [inline]

Definition at line 42 of file Actor.h.

References intelligence.

Referenced by getMaxMana(), PaperdollGump::PaintStats(), U8Game::writeSaveInfo(), and RemorseGame::writeSaveInfo().

Animation::Sequence Actor::getLastAnim (  )  const [inline]

Definition at line 68 of file Actor.h.

References lastanim.

Referenced by calculateAttackDamage(), AvatarMoverProcess::checkTurn(), AnimAction::getAnimRange(), MainActor::getDamageAmount(), AvatarMoverProcess::handleCombatMode(), AvatarMoverProcess::handleNormalMode(), PathfindingState::load(), receiveHit(), AvatarMoverProcess::run(), AvatarGravityProcess::run(), ActorBarkNotifyProcess::run(), AvatarMoverProcess::step(), and GravityProcess::terminate().

sint16 Actor::getMana (  )  const [inline]

Definition at line 46 of file Actor.h.

References mana.

Referenced by PaperdollGump::PaintStats(), MiniStatsGump::PaintThis(), HealProcess::run(), U8Game::writeSaveInfo(), and RemorseGame::writeSaveInfo().

uint16 Actor::getMaxHP (  )  const

Definition at line 92 of file Actor.cpp.

References getStr().

Referenced by MainActor::ConCmd_heal(), MainActor::ConCmd_maxstats(), HealProcess::feedAvatar(), MiniStatsGump::PaintThis(), receiveHit(), U8Game::writeSaveInfo(), and RemorseGame::writeSaveInfo().

sint16 Actor::getMaxMana (  )  const

Definition at line 87 of file Actor.cpp.

References getInt().

Referenced by MainActor::ConCmd_heal(), MainActor::ConCmd_maxstats(), MiniStatsGump::PaintThis(), U8Game::writeSaveInfo(), and RemorseGame::writeSaveInfo().

sint16 Actor::getStr (  )  const [inline]

Definition at line 38 of file Actor.h.

References strength.

Referenced by calculateAttackDamage(), Container::CanAddItem(), GameMapGump::DraggingItem(), GameMapGump::DropItem(), MainActor::getDamageAmount(), getMaxHP(), Item::getThrowRange(), AvatarMoverProcess::jump(), PaperdollGump::PaintStats(), U8Game::writeSaveInfo(), and RemorseGame::writeSaveInfo().

bool Actor::giveTreasure (  ) 

add treasure according to the TreasureInfo in the MonsterInfo

Returns:
true if a MonsterInfo struct was found, false otherwise

Definition at line 126 of file Actor.cpp.

References Item::callUsecodeEvent_combine(), ItemFactory::createItem(), Item::FLG_DISPOSABLE, Item::frame, World::get_instance(), GameData::get_instance(), Pentagram::Archive::getCount(), World::getCurrentMap(), GameData::getMainShapes(), CurrentMap::getNum(), MainShapeArchive::getShapeInfo(), Item::getShapeInfo(), ShapeInfo::hasQuantity(), ShapeInfo::monsterinfo, Item::moveToContainer(), n, perr, pout, Item::quality, Item::randomGumpLocation(), Item::shape, MonsterInfo::treasure, WeaponInfo::treasure_chance, and ShapeInfo::weaponinfo.

Referenced by die().

bool Actor::hasAnim ( Animation::Sequence  anim  ) 

check if this actor has a specific animation

Definition at line 471 of file Actor.cpp.

References AnimationTracker::init().

Referenced by LoiterProcess::run(), CombatProcess::run(), and ActorBarkNotifyProcess::run().

Actor::INTRINSIC ( I_setEquip   ) 

Actor::INTRINSIC ( I_getEquip   ) 

Actor::INTRINSIC ( I_schedule   ) 

Actor::INTRINSIC ( I_getAirWalkEnabled   ) 

Actor::INTRINSIC ( I_setAirWalkEnabled   ) 

Actor::INTRINSIC ( I_cSetActivity   ) 

Actor::INTRINSIC ( I_createActor   ) 

Actor::INTRINSIC ( I_isBusy   ) 

Actor::INTRINSIC ( I_areEnemiesNear   ) 

Actor::INTRINSIC ( I_clrFeignDeath   ) 

Actor::INTRINSIC ( I_setFeignDeath   ) 

Actor::INTRINSIC ( I_isFeignDeath   ) 

Actor::INTRINSIC ( I_clrWithstandDeath   ) 

Actor::INTRINSIC ( I_setWithstandDeath   ) 

Actor::INTRINSIC ( I_isWithstandDeath   ) 

Actor::INTRINSIC ( I_clrImmortal   ) 

Actor::INTRINSIC ( I_setImmortal   ) 

Actor::INTRINSIC ( I_isImmortal   ) 

Actor::INTRINSIC ( I_clrDead   ) 

Actor::INTRINSIC ( I_setDead   ) 

Actor::INTRINSIC ( I_isDead   ) 

Actor::INTRINSIC ( I_isEnemy   ) 

Actor::INTRINSIC ( I_getTarget   ) 

Actor::INTRINSIC ( I_setTarget   ) 

Actor::INTRINSIC ( I_clrInCombat   ) 

Actor::INTRINSIC ( I_setInCombat   ) 

Actor::INTRINSIC ( I_isInCombat   ) 

Actor::INTRINSIC ( I_doAnim   ) 

Actor::INTRINSIC ( I_teleport   )