hoa_global::GlobalCharacter Class Reference

Represents playable game characters. More...

#include <global_actors.h>

Inheritance diagram for hoa_global::GlobalCharacter:

Inheritance graph
[legend]
Collaboration diagram for hoa_global::GlobalCharacter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

bool AddExperiencePoints (uint32 xp)
 Adds experience points to the character.
void AddSkill (uint32 skill_id)
 Adds a new skill to the actor's skill set.
GlobalArmorEquipArmArmor (GlobalArmor *armor)
GlobalArmorEquipHeadArmor (GlobalArmor *armor)
GlobalArmorEquipLegArmor (GlobalArmor *armor)
GlobalArmorEquipTorsoArmor (GlobalArmor *armor)
 GlobalCharacter (uint32 id, bool initial=true)
 Constructs a new character from its definition in a script file.
bool IsCharacter ()
 A purely virtual function used for actor type identification.
virtual ~GlobalCharacter ()
void AddBattleAnimation (const std::string &name, hoa_video::AnimatedImage anim)
std::vector< hoa_video::StillImage > * GetBattlePortraits ()
hoa_video::AnimatedImageRetrieveBattleAnimation (const std::string &name)
Public Member Access Functions
GlobalArmorGetArmArmorEquipped ()
std::vector< GlobalSkill * > * GetAttackSkills ()
std::vector< GlobalSkill * > * GetDefenseSkills ()
uint32 GetExperienceForNextLevel () const
GlobalCharacterGrowthGetGrowth ()
GlobalArmorGetHeadArmorEquipped ()
GlobalArmorGetLegArmorEquipped ()
std::vector< GlobalSkill * > * GetSupportSkills ()
GlobalArmorGetTorsoArmorEquipped ()

Protected Attributes

GlobalCharacterGrowth _growth
 A manager object for monitoring the character's growth This object contains information such as what is required for the next level experience level to be reached, the amount that each stat will grow by on the next level, whether any new skills will be learned, etc. It is updated whenever the character's experience_points or experience_level are changed.
std::vector< GlobalSkill * > _attack_skills
 The skills that the character may use Skills are broken up into three types: attack, defense, and support. There is really no distinguishment between the various skill types, they just serve an organizational means and are used to identify a skill's general purpose/use. Characters keep their skills in these seperate containers because they are presented in this way to the player.
std::vector< GlobalSkill * > _defense_skills
std::vector< GlobalSkill * > _support_skills
Character Images
Note:
Although many of the names of these members would imply that they are only used in one particular mode of operation (map, battle, etc.), these members may be freely used by different game modes for which they were not specifically designed for. The names are simply meant to indicate the primary game mode where the images are intended to be used.


std::map< std::string, hoa_video::AnimatedImage_battle_animation
 The frame images for the character's battle sprite. This map container contains various animated images for the character's battle sprites. The key to the map is a simple string which describes the animation, such as "idle".
std::vector< hoa_video::StillImage_battle_portraits
 The frame images for the character's battle portrait Each character has 5 battle portraits which represent the character's health with damage levels of 0%, 25%, 50%, 75%, and 100% (this is also the order in which the frames are stored, starting with the 0% frame at index 0). Thus, the size of this vector is always five elements. Each portait is 100x100 pixels in size.
std::vector< hoa_video::StillImage_map_frames_standard
 The standard frame images for the character's map sprite. This container holds the standard frames for the character's map sprite, which include standing and walking frames. This set includes 24 frames in total, 6 each for the down, up, left, and right orientations.
hoa_video::StillImage _map_portrait_standard
 The character's standard map portrait image The standard map portrait is ususally used in dialogues, but may also be used in other modes where appropriate. The size of the map portrait is 200x200 pixels.
hoa_video::StillImage _menu_portrait
 The character's full-body portrait image for use in menu mode This image is a detailed, full-scale portait of the character and is intended for use in menu mode. The size of the image is 150x350 pixels.

Friends

class GlobalCharacterGrowth

Detailed Description

Represents playable game characters.

****************************************************************************

This calls represents playable game characters only (those that you can control, equip, and send into battle). It does not cover NPCs. This class also holds numerous images that represent the character in a variety of contexts (maps, battle, menus, etc.). This class may be used as a parent class by game modes that need to add further data or methods to manipulate the character than is provided here.

Note:
A character has four, and only four, attack points. They are the head, torso, arms, and legs of the character.

Definition at line 807 of file global_actors.h.


Constructor & Destructor Documentation

hoa_global::GlobalCharacter::GlobalCharacter ( uint32  id,
bool  initial = true 
)

Constructs a new character from its definition in a script file.

Parameters:
id The integer ID of the character to create
initial If true, the character's stats, equipment, and skills are set to the character's initial status
Note:
If initial is set to false, the character's stats, equipment, and skills must be set by external code, otherwise they will remain 0/NULL/empty.

Definition at line 591 of file global_actors.cpp.

References hoa_global::GlobalActor::_agility, hoa_global::GlobalActor::_armor_equipped, hoa_global::GlobalActor::_attack_points, _battle_animation, _battle_portraits, hoa_global::GlobalCharacterGrowth::_ConstructPeriodicGrowth(), hoa_global::GlobalCharacterGrowth::_DetermineNextLevelExperience(), hoa_global::GlobalActor::_evade, hoa_global::GlobalCharacterGrowth::_experience_for_last_level, hoa_global::GlobalCharacterGrowth::_experience_for_next_level, hoa_global::GlobalActor::_experience_level, hoa_global::GlobalActor::_experience_points, hoa_global::GlobalActor::_filename, hoa_global::GlobalActor::_fortitude, _growth, hoa_global::GlobalActor::_hit_points, hoa_global::GlobalActor::_id, hoa_global::GlobalActor::_max_hit_points, hoa_global::GlobalActor::_max_skill_points, hoa_global::GlobalActor::_name, hoa_global::GlobalActor::_protection, hoa_global::GlobalActor::_skill_points, hoa_global::GlobalActor::_strength, hoa_global::GlobalActor::_vigor, hoa_global::GlobalActor::_weapon_equipped, hoa_video::AnimatedImage::AddFrame(), AddSkill(), hoa_script::ReadScriptDescriptor::CloseFile(), hoa_script::ReadScriptDescriptor::CloseTable(), hoa_script::ScriptDescriptor::GetErrorMessages(), hoa_script::ReadScriptDescriptor::GetLuaState(), hoa_global::GLOBAL_DEBUG, hoa_global::GLOBAL_POSITION_HEAD, hoa_global::GLOBAL_POSITION_LEGS, hoa_script::GameScript::HandleCastError(), hoa_script::GameScript::HandleLuaError(), hoa_script::ScriptDescriptor::IsErrorDetected(), hoa_video::GameVideo::LoadAnimatedImageFromNumberElements(), hoa_video::GameVideo::LoadMultiImageFromNumberElements(), hoa_utils::MakeUnicodeString(), hoa_script::ReadScriptDescriptor::OpenFile(), hoa_script::ReadScriptDescriptor::OpenTable(), hoa_script::ReadScriptDescriptor::ReadFloat(), hoa_script::ReadScriptDescriptor::ReadString(), hoa_script::ReadScriptDescriptor::ReadTableKeys(), hoa_script::ReadScriptDescriptor::ReadUInt(), hoa_script::ScriptManager, hoa_video::StillImage::SetDimensions(), hoa_video::AnimatedImage::SetFrameIndex(), and hoa_video::VideoManager.

Here is the call graph for this function:

hoa_global::GlobalCharacter::~GlobalCharacter (  )  [virtual]

Definition at line 781 of file global_actors.cpp.


Member Function Documentation

void hoa_global::GlobalCharacter::AddBattleAnimation ( const std::string &  name,
hoa_video::AnimatedImage  anim 
) [inline]

Definition at line 877 of file global_actors.h.

References _battle_animation.

bool hoa_global::GlobalCharacter::AddExperiencePoints ( uint32  xp  ) 

Adds experience points to the character.

Parameters:
xp The amount of experience points to add
Returns:
True if the new experience points triggered character growth

Definition at line 829 of file global_actors.cpp.

References hoa_global::GlobalCharacterGrowth::_CheckForGrowth(), hoa_global::GlobalActor::_experience_points, _growth, and hoa_global::GlobalCharacterGrowth::IsGrowthDetected().

Here is the call graph for this function:

void hoa_global::GlobalCharacter::AddSkill ( uint32  skill_id  )  [virtual]

Adds a new skill to the actor's skill set.

Parameters:
skill_id The id number of the skill to add
No skill may be added more than once. If this case is detected or an error occurs when trying to load the skill data, it will not be added.

Implements hoa_global::GlobalActor.

Definition at line 787 of file global_actors.cpp.

References _attack_skills, _defense_skills, hoa_global::GlobalActor::_skills, _support_skills, hoa_global::GlobalSkill::GetID(), hoa_global::GlobalSkill::GetType(), hoa_global::GLOBAL_DEBUG, hoa_global::GLOBAL_SKILL_ATTACK, hoa_global::GLOBAL_SKILL_DEFEND, and hoa_global::GLOBAL_SKILL_SUPPORT.

Referenced by hoa_global::GameGlobal::_LoadCharacter(), and GlobalCharacter().

Here is the call graph for this function:

GlobalArmor* hoa_global::GlobalCharacter::EquipArmArmor ( GlobalArmor armor  )  [inline]

Definition at line 869 of file global_actors.h.

References hoa_global::GlobalActor::EquipArmor(), and hoa_global::GLOBAL_POSITION_ARMS.

Referenced by hoa_global::GameGlobal::_LoadCharacter().

Here is the call graph for this function:

GlobalArmor* hoa_global::GlobalCharacter::EquipHeadArmor ( GlobalArmor armor  )  [inline]

Definition at line 863 of file global_actors.h.

References hoa_global::GlobalActor::EquipArmor(), and hoa_global::GLOBAL_POSITION_HEAD.

Referenced by hoa_global::GameGlobal::_LoadCharacter().

Here is the call graph for this function:

GlobalArmor* hoa_global::GlobalCharacter::EquipLegArmor ( GlobalArmor armor  )  [inline]

Definition at line 872 of file global_actors.h.

References hoa_global::GlobalActor::EquipArmor(), and hoa_global::GLOBAL_POSITION_LEGS.

Referenced by hoa_global::GameGlobal::_LoadCharacter().

Here is the call graph for this function:

GlobalArmor* hoa_global::GlobalCharacter::EquipTorsoArmor ( GlobalArmor armor  )  [inline]

Definition at line 866 of file global_actors.h.

References hoa_global::GlobalActor::EquipArmor(), and hoa_global::GLOBAL_POSITION_TORSO.

Referenced by hoa_global::GameGlobal::_LoadCharacter().

Here is the call graph for this function:

GlobalArmor* hoa_global::GlobalCharacter::GetArmArmorEquipped (  )  [inline]

Definition at line 839 of file global_actors.h.

References hoa_global::GlobalActor::_armor_equipped.

Referenced by hoa_menu::MenuMode::_DrawBottomMenu(), hoa_global::GameGlobal::_SaveCharacter(), hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), and hoa_menu::private_menu::EquipWindow::EquipWindow().

std::vector<GlobalSkill*>* hoa_global::GlobalCharacter::GetAttackSkills (  )  [inline]

Definition at line 845 of file global_actors.h.

References _attack_skills.

Referenced by hoa_battle::private_battle::ActionWindow::_ConstructActionSelectionList(), hoa_global::GameGlobal::_SaveCharacter(), hoa_menu::private_menu::SkillsWindow::_UpdateSkillList(), hoa_menu::private_menu::SkillsWindow::Draw(), and hoa_battle::private_battle::ActionWindow::Initialize().

std::vector<hoa_video::StillImage>* hoa_global::GlobalCharacter::GetBattlePortraits (  )  [inline]

Definition at line 883 of file global_actors.h.

References _battle_portraits.

Referenced by hoa_battle::private_battle::BattleCharacterActor::DrawPortrait().

std::vector<GlobalSkill*>* hoa_global::GlobalCharacter::GetDefenseSkills (  )  [inline]

Definition at line 848 of file global_actors.h.

References _defense_skills.

Referenced by hoa_battle::private_battle::ActionWindow::_ConstructActionSelectionList(), hoa_global::GameGlobal::_SaveCharacter(), and hoa_battle::private_battle::ActionWindow::Initialize().

uint32 hoa_global::GlobalCharacter::GetExperienceForNextLevel (  )  const [inline]

Definition at line 827 of file global_actors.h.

References hoa_global::GlobalCharacterGrowth::_experience_for_next_level, and _growth.

Referenced by hoa_global::GameGlobal::_SaveCharacter(), hoa_menu::private_menu::StatusWindow::Draw(), and hoa_menu::private_menu::CharacterWindow::Draw().

GlobalCharacterGrowth* hoa_global::GlobalCharacter::GetGrowth (  )  [inline]

Definition at line 830 of file global_actors.h.

References _growth.

GlobalArmor* hoa_global::GlobalCharacter::GetHeadArmorEquipped (  )  [inline]

Definition at line 833 of file global_actors.h.

References hoa_global::GlobalActor::_armor_equipped.

Referenced by hoa_menu::MenuMode::_DrawBottomMenu(), hoa_global::GameGlobal::_SaveCharacter(), hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), and hoa_menu::private_menu::EquipWindow::EquipWindow().

GlobalArmor* hoa_global::GlobalCharacter::GetLegArmorEquipped (  )  [inline]

Definition at line 842 of file global_actors.h.

References hoa_global::GlobalActor::_armor_equipped.

Referenced by hoa_menu::MenuMode::_DrawBottomMenu(), hoa_global::GameGlobal::_SaveCharacter(), hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), and hoa_menu::private_menu::EquipWindow::EquipWindow().

std::vector<GlobalSkill*>* hoa_global::GlobalCharacter::GetSupportSkills (  )  [inline]

Definition at line 851 of file global_actors.h.

References _support_skills.

Referenced by hoa_battle::private_battle::ActionWindow::_ConstructActionSelectionList(), hoa_global::GameGlobal::_SaveCharacter(), and hoa_battle::private_battle::ActionWindow::Initialize().

GlobalArmor* hoa_global::GlobalCharacter::GetTorsoArmorEquipped (  )  [inline]

Definition at line 836 of file global_actors.h.

References hoa_global::GlobalActor::_armor_equipped.

Referenced by hoa_menu::MenuMode::_DrawBottomMenu(), hoa_global::GameGlobal::_SaveCharacter(), hoa_menu::private_menu::EquipWindow::_UpdateEquipList(), and hoa_menu::private_menu::EquipWindow::EquipWindow().

bool hoa_global::GlobalCharacter::IsCharacter (  )  [inline, virtual]

A purely virtual function used for actor type identification.

Returns:
True if the actor is a character, false if it is an enemy
This function is implemented primarily because GlobalActor requires at least one purely virtual function to be an abstract class. FIX ME Obsolete. Moved to BattleActor and now called IsEnemy().

Implements hoa_global::GlobalActor.

Definition at line 822 of file global_actors.h.

hoa_video::AnimatedImage* hoa_global::GlobalCharacter::RetrieveBattleAnimation ( const std::string &  name  )  [inline]

Definition at line 880 of file global_actors.h.

References _battle_animation.

Referenced by hoa_battle::private_battle::BattleCharacterActor::DrawSprite(), and hoa_battle::private_battle::BattleCharacterActor::Update().


Friends And Related Function Documentation

friend class GlobalCharacterGrowth [friend]

Definition at line 808 of file global_actors.h.


Member Data Documentation

std::vector<GlobalSkill*> hoa_global::GlobalCharacter::_attack_skills [protected]

The skills that the character may use Skills are broken up into three types: attack, defense, and support. There is really no distinguishment between the various skill types, they just serve an organizational means and are used to identify a skill's general purpose/use. Characters keep their skills in these seperate containers because they are presented in this way to the player.

Definition at line 895 of file global_actors.h.

Referenced by AddSkill(), and GetAttackSkills().

std::map<std::string, hoa_video::AnimatedImage> hoa_global::GlobalCharacter::_battle_animation [protected]

The frame images for the character's battle sprite. This map container contains various animated images for the character's battle sprites. The key to the map is a simple string which describes the animation, such as "idle".

Definition at line 931 of file global_actors.h.

Referenced by AddBattleAnimation(), GlobalCharacter(), and RetrieveBattleAnimation().

std::vector<hoa_video::StillImage> hoa_global::GlobalCharacter::_battle_portraits [protected]

The frame images for the character's battle portrait Each character has 5 battle portraits which represent the character's health with damage levels of 0%, 25%, 50%, 75%, and 100% (this is also the order in which the frames are stored, starting with the 0% frame at index 0). Thus, the size of this vector is always five elements. Each portait is 100x100 pixels in size.

Definition at line 939 of file global_actors.h.

Referenced by GetBattlePortraits(), and GlobalCharacter().

std::vector<GlobalSkill*> hoa_global::GlobalCharacter::_defense_skills [protected]

Definition at line 896 of file global_actors.h.

Referenced by AddSkill(), and GetDefenseSkills().

GlobalCharacterGrowth hoa_global::GlobalCharacter::_growth [protected]

A manager object for monitoring the character's growth This object contains information such as what is required for the next level experience level to be reached, the amount that each stat will grow by on the next level, whether any new skills will be learned, etc. It is updated whenever the character's experience_points or experience_level are changed.

Definition at line 905 of file global_actors.h.

Referenced by AddExperiencePoints(), GetExperienceForNextLevel(), GetGrowth(), and GlobalCharacter().

std::vector<hoa_video::StillImage> hoa_global::GlobalCharacter::_map_frames_standard [protected]

The standard frame images for the character's map sprite. This container holds the standard frames for the character's map sprite, which include standing and walking frames. This set includes 24 frames in total, 6 each for the down, up, left, and right orientations.

Definition at line 919 of file global_actors.h.

hoa_video::StillImage hoa_global::GlobalCharacter::_map_portrait_standard [protected]

The character's standard map portrait image The standard map portrait is ususally used in dialogues, but may also be used in other modes where appropriate. The size of the map portrait is 200x200 pixels.

Definition at line 925 of file global_actors.h.

hoa_video::StillImage hoa_global::GlobalCharacter::_menu_portrait [protected]

The character's full-body portrait image for use in menu mode This image is a detailed, full-scale portait of the character and is intended for use in menu mode. The size of the image is 150x350 pixels.

Definition at line 945 of file global_actors.h.

std::vector<GlobalSkill*> hoa_global::GlobalCharacter::_support_skills [protected]

Definition at line 897 of file global_actors.h.

Referenced by AddSkill(), and GetSupportSkills().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:14:14 2007 for Hero of Allacrost by  doxygen 1.5.1