Character Class Reference

Class representing a character and its associated sprites. More...

#include <character.h>

List of all members.

Public Types

enum  Gender { GENDER_MALE = 0, GENDER_FEMALE, GENDER_UNKNOWN }
 The character's gender.

Public Member Functions

 Character (const ustring &internal="", const ustring &name="", const ustring &caption="", const ustring &description="")
 Constructor.
void addTalkOption (const ustring &viewStr, const ustring &block)
 Add a talk option.
void removeTalkOption (const ustring &id)
 Remove a talk option.
void clearTalkOptions ()
 Clear all talk options.
std::vector< StringPair > getTalkOptions () const
 Get a vector of all talk options.
void addPresentable (const ustring &id, const ustring &targetBlock)
 Add a presentable piece of evidence/profile.
void removePresentable (const ustring &id)
 Remove a presentable evidence/profile.
void clearPresentableItems ()
 Clear all accepted evidence/profiles.
void setBadPresentableBlock (const ustring &id)
 Set the block ID to use when a bad item is presented.
ustring getBadPresentableBlock () const
 Get the block to use when a bad item is presented.
std::vector< StringPair > getPresentableItems () const
 Get all the evidence and profiles that can be presented.
void setInternalName (const ustring &name)
 Set the internal character name.
ustring getInternalName () const
 Get the internal character name.
void setName (const ustring &name)
 Set the display name.
ustring getName () const
 Get the display name.
void setGender (const Gender &g)
 Set gender of this character.
Gender getGender () const
 Get the gender of this character.
void setCaption (const ustring &caption)
 Set the caption for this character.
ustring getCaption () const
 Get the caption for this character.
void setDescription (const ustring &desc)
 Set the description for this character.
ustring getDescription () const
 Get the description for this character.
void setSprite (const Sprite &spr)
 Set the sprite for this character.
SpritegetSprite ()
 Get the sprite for this character.
void setSpriteName (const ustring &name)
 Set the name of the sprite file to associate with this character.
ustring getSpriteName () const
 Get sprite file name associated with this character.
void setRootAnimation (const ustring &anim)
 Set the root sprite animation (normal, smirk, etc).
ustring getRootAnimation () const
 Get the root sprite animation.
void setHasTextBoxTag (bool b)
 Set if this character has a textbox tag.
bool hasTextBoxTag () const
 Check if this character has a textbox tag.
void setTextBoxTag (SDL_Surface *surface)
 Set the textbox tag image.
SDL_Surface * getTextBoxTag ()
 Get the textbox tag image.
void setHasHeadshot (bool b)
 Set if this character has a headshot image.
bool hasHeadshot () const
 Check if this character has a headshot image.
void setHeadshot (SDL_Surface *full, SDL_Surface *thumb)
 Set the headshot (profile) image.
SDL_Surface * getHeadshot ()
 Get the headshot (profile) image.
SDL_Surface * getHeadshotThumb ()
 Get the scaled headshot image.

Private Attributes

ustring m_InternalName
 The internal name.
ustring m_Name
 The displayed name.
ustring m_Caption
 The caption.
ustring m_Description
 The description.
ustring m_SpriteName
 The sprite name.
ustring m_RootAnim
 The ID of the root animation.
bool m_HasTextBoxTag
 Flag whether or not this character has a textbox tag.
SDL_Surface * m_TextBoxTag
 The textbox tag image.
Sprite m_Sprite
 Sprite associated with this character.
Gender m_Gender
 Character's gender.
std::vector< StringPair > m_TalkOptions
 Vector of talk options.
std::vector< StringPair > m_AcceptedItems
 Vector of presentable evidence/profile IDs and target blocks.
ustring m_BadPresentableBlock
 Block to execute if a useless item is presented.
bool m_HasHeadshot
 Flag whether or not this character has a headshot (profile) image.
SDL_Surface * m_Headshot
 The headshot image.
SDL_Surface * m_HeadshotThumb
 The scaled headshot image.


Detailed Description

Class representing a character and its associated sprites.

Each character in the case has his or her own set of attributes, and an associated sprite. All of this data is condensed in this class.


Constructor & Destructor Documentation

Character::Character ( const ustring &  internal = "",
const ustring &  name = "",
const ustring &  caption = "",
const ustring &  description = "" 
)

Constructor.

Parameters:
internal The internal name
name The display name
caption The text displayed in the green box in the Court Record
description Text displayed below the caption in the Court Record


Member Function Documentation

void Character::addTalkOption ( const ustring &  viewStr,
const ustring &  block 
)

Add a talk option.

Parameters:
viewStr The display string for this option
block The block to execute if selected

void Character::removeTalkOption ( const ustring &  id  ) 

Remove a talk option.

Parameters:
id The name of the talk option to remove

std::vector<StringPair> Character::getTalkOptions (  )  const [inline]

Get a vector of all talk options.

Returns:
A string vector of all talk options

void Character::addPresentable ( const ustring &  id,
const ustring &  targetBlock 
)

Add a presentable piece of evidence/profile.

Parameters:
id The ID of the item
targetBlock Block to execute if selected

void Character::removePresentable ( const ustring &  id  ) 

Remove a presentable evidence/profile.

Parameters:
id The ID of the item to remove

void Character::setBadPresentableBlock ( const ustring &  id  )  [inline]

Set the block ID to use when a bad item is presented.

Parameters:
id The ID of the block

ustring Character::getBadPresentableBlock (  )  const [inline]

Get the block to use when a bad item is presented.

Returns:
The ID of the block

std::vector<StringPair> Character::getPresentableItems (  )  const [inline]

Get all the evidence and profiles that can be presented.

Returns:
String vector of item IDs

void Character::setInternalName ( const ustring &  name  )  [inline]

Set the internal character name.

Parameters:
name The new internal name

ustring Character::getInternalName (  )  const [inline]

Get the internal character name.

Returns:
The internal name

void Character::setName ( const ustring &  name  )  [inline]

Set the display name.

Parameters:
name The character's new display name

ustring Character::getName (  )  const [inline]

Get the display name.

Returns:
The character's display name

void Character::setGender ( const Gender g  )  [inline]

Set gender of this character.

Parameters:
g The new gender type

Gender Character::getGender (  )  const [inline]

Get the gender of this character.

Returns:
The character's gender

void Character::setCaption ( const ustring &  caption  )  [inline]

Set the caption for this character.

Parameters:
cap The caption

ustring Character::getCaption (  )  const [inline]

Get the caption for this character.

Returns:
The character's caption

void Character::setDescription ( const ustring &  desc  )  [inline]

Set the description for this character.

Parameters:
desc The description

ustring Character::getDescription (  )  const [inline]

Get the description for this character.

Returns:
This character's description

void Character::setSprite ( const Sprite spr  )  [inline]

Set the sprite for this character.

Parameters:
spr The sprite to set

Sprite* Character::getSprite (  )  [inline]

Get the sprite for this character.

Returns:
Pointer to the sprite, or NULL if there is none

void Character::setSpriteName ( const ustring &  name  )  [inline]

Set the name of the sprite file to associate with this character.

Parameters:
spr Path relative to case file for the sprite

ustring Character::getSpriteName (  )  const [inline]

Get sprite file name associated with this character.

Returns:
The file path

void Character::setRootAnimation ( const ustring &  anim  )  [inline]

Set the root sprite animation (normal, smirk, etc).

Parameters:
anim The ID of the root animation

ustring Character::getRootAnimation (  )  const [inline]

Get the root sprite animation.

Returns:
The ID of the root animation

void Character::setHasTextBoxTag ( bool  b  )  [inline]

Set if this character has a textbox tag.

Parameters:
b true if this character has a tag, false otherwise

bool Character::hasTextBoxTag (  )  const [inline]

Check if this character has a textbox tag.

Returns:
true if yes, false otherwise

void Character::setTextBoxTag ( SDL_Surface *  surface  )  [inline]

Set the textbox tag image.

Parameters:
surface The textbox tag image

SDL_Surface* Character::getTextBoxTag (  )  [inline]

Get the textbox tag image.

Returns:
The textbox tag image, if it exists

void Character::setHasHeadshot ( bool  b  )  [inline]

Set if this character has a headshot image.

Parameters:
b true if yes, false otherwise

bool Character::hasHeadshot (  )  const [inline]

Check if this character has a headshot image.

Returns:
true if yes, false otherwise

void Character::setHeadshot ( SDL_Surface *  full,
SDL_Surface *  thumb 
) [inline]

Set the headshot (profile) image.

Parameters:
pixbuf The image for the profile headshot

SDL_Surface* Character::getHeadshot (  )  [inline]

Get the headshot (profile) image.

Returns:
The headshot image, if it exists

SDL_Surface* Character::getHeadshotThumb (  )  [inline]

Get the scaled headshot image.

The scaled image is used in certain animations, and it automatically generated when ever the headshot image gets updated or changed

Returns:
The scaled headshot iamge, if it exists


The documentation for this class was generated from the following files:
Generated on Fri Feb 22 22:29:23 2008 for Phoenix Wright Case Player API by  doxygen 1.5.3