xoreos  0.0.5
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Engines::NWN::Item Class Reference

#include <item.h>

Inheritance diagram for Engines::NWN::Item:
Inheritance graph
[legend]
Collaboration diagram for Engines::NWN::Item:
Collaboration graph
[legend]

Public Types

enum  Color {
  kColorMetal1 = 0, kColorMetal2, kColorLeather1, kColorLeather2,
  kColorCloth1, kColorCloth2, kColorMAX
}
 

Public Member Functions

 Item (const Aurora::GFF3Struct &item)
 
 ~Item ()
 
void loadModel ()
 Load the item's model. More...
 
void unloadModel ()
 Unload the item's model. More...
 
void show ()
 Show the item's model. More...
 
void hide ()
 Hide the item's model. More...
 
bool isArmor () const
 
uint32 getColor (Color color) const
 
uint32 getArmorPart (size_t index) const
 
- Public Member Functions inherited from Engines::NWN::Object
 Object (ObjectType type=kObjectTypeInvalid)
 
virtual ~Object ()
 
ObjectType getType () const
 Return the exact type of the object. More...
 
const std::list< uint32 > & getIDs () const
 Return the object's model IDs. More...
 
const Common::UStringgetName () const
 Return the object's name. More...
 
const Common::UStringgetDescription () const
 Return the object's description. More...
 
const Common::UStringgetPortrait () const
 Return the object's portrait. More...
 
const Common::UStringgetConversation () const
 Return the object's default conversation (DLG). More...
 
const Aurora::SSFFilegetSSF ()
 Return the object's sound set. More...
 
bool isStatic () const
 Is the object static (not manipulable at all)? More...
 
bool isUsable () const
 Can the object be used by the PC? More...
 
bool isClickable () const
 Can the player click the object? More...
 
Aurora::NWScript::ObjectgetPCSpeaker () const
 Return the PC currently speaking with this object. More...
 
void setPCSpeaker (Aurora::NWScript::Object *pc)
 Set the PC currently speaking with this object. More...
 
AreagetArea () const
 Return the area this object is currently in. More...
 
virtual void setArea (Area *)
 Set the area this object is currently in. More...
 
virtual void getPosition (float &x, float &y, float &z) const
 Return the object's position within its area. More...
 
virtual void getOrientation (float &x, float &y, float &z, float &angle) const
 Return the object's orientation. More...
 
virtual void setPosition (float x, float y, float z)
 Set the object's position within its area. More...
 
virtual void setOrientation (float x, float y, float z, float angle)
 Set the object's orientation. More...
 
Location getLocation () const
 Create a Location out of the object's area, position and orientation. More...
 
virtual void enter ()
 The cursor entered the object. More...
 
virtual void leave ()
 The cursor left the object. More...
 
virtual void highlight (bool enabled)
 (Un)Highlight the object. More...
 
virtual bool click (Object *triggerer=0)
 The object was clicked. More...
 
virtual void speakString (const Common::UString &string, uint32 volume)
 Speak the specified string. More...
 
void speakOneLiner (Common::UString conv, Object *tokenTarget=0)
 Speak an one-liner from the specified conversation file. More...
 
void stopSound ()
 Stop the current object sound. More...
 
void playSound (const Common::UString &sound, bool pitchVariance=false)
 Play an object sound. More...
 
virtual void playAnimation (const Common::UString &animation="", bool restart=true, float length=0.0f, float speed=1.0f)
 Play an object animation. More...
 
virtual void playAnimation (Animation animation, bool restart=true, float length=0.0f, float speed=1.0f)
 Play a default object animation. More...
 
- Public Member Functions inherited from Aurora::NWScript::Object
 Object ()
 
uint32 getID () const
 
const Common::UStringgetTag () const
 
- Public Member Functions inherited from Aurora::NWScript::VariableContainer
 VariableContainer ()
 
virtual ~VariableContainer ()
 
bool hasVariable (const Common::UString &var) const
 
VariablegetVariable (const Common::UString &var, Type type=kTypeVoid)
 
const VariablegetVariable (const Common::UString &var) const
 
void setVariable (const Common::UString &var, const Variable &value)
 
void removeVariable (const Common::UString &var)
 
void clearVariables ()
 
- Public Member Functions inherited from Engines::NWN::ScriptContainer
 ScriptContainer ()
 
 ~ScriptContainer ()
 
const Common::UStringgetScript (Script script) const
 
bool hasScript (Script script) const
 
bool runScript (Script script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
 

Private Types

enum  ArmorPartType {
  kArmorPartHead = 0, kArmorPartNeck, kArmorPartTorso, kArmorPartPelvis,
  kArmorPartBelt, kArmorPartRightFoot, kArmorPartLeftFoot, kArmorPartRightShin,
  kArmorPartLeftShin, kArmorPartLeftThigh, kArmorPartRightThigh, kArmorPartRightFArm,
  kArmorPartLeftFArm, kArmorPartRightBicep, kArmorPartLeftBicep, kArmorPartRightShoul,
  kArmorPartLeftShoul, kArmorPartRightHand, kArmorPartLeftHand, kArmorPartMAX
}
 Parts of an armor set. More...
 

Private Member Functions

void load (const Aurora::GFF3Struct &item)
 
void load (const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint)
 
void loadProperties (const Aurora::GFF3Struct &gff)
 
void loadPortrait (const Aurora::GFF3Struct &gff)
 
void loadArmorParts (const Aurora::GFF3Struct &gff)
 

Private Attributes

Common::UString _modelName
 The model's resource name. More...
 
uint32 _baseItem
 The index within the baseitem 2DA. More...
 
uint32 _colors [kColorMAX]
 The item's colors. More...
 
uint32 _armorParts [kArmorPartMAX]
 The item's armor parts. More...
 
Common::ScopedPtr< Graphics::Aurora::Model_model
 The item's model. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Engines::NWN::ScriptContainer
static bool runScript (const Common::UString &script, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
 
static bool runScript (const Common::UString &script, const Aurora::NWScript::ScriptState &state, const Aurora::NWScript::ObjectReference owner=Aurora::NWScript::ObjectReference(), const Aurora::NWScript::ObjectReference triggerer=Aurora::NWScript::ObjectReference())
 
- Protected Member Functions inherited from Engines::NWN::Object
void loadSSF ()
 Load the object's sound set. More...
 
bool beginConversation (Object *triggerer)
 Begin a conversation between the triggerer and this object. More...
 
virtual bool createTooltip (Tooltip::Type type)
 Create an empty tooltip. More...
 
bool createFeedbackTooltip ()
 Create a tooltip with the name and/or portrait of the object. More...
 
bool createSpeechTooltip (const Common::UString &line)
 Create a tooltip with a line the object should speak. More...
 
void destroyTooltip ()
 Destroy all tooltips on this object. More...
 
bool showFeedbackTooltip ()
 Create and show a tooltip with the name and/or portrait of the object. More...
 
bool showSpeechTooltip (const Common::UString &line)
 Create and show a tooltip with a line the object speaks. More...
 
void hideTooltip ()
 Hide the tooltip again. More...
 
- Protected Member Functions inherited from Engines::NWN::ScriptContainer
void clearScripts ()
 
void readScripts (const Aurora::GFF3Struct &gff)
 
void readScripts (const ScriptContainer &container)
 
- Protected Attributes inherited from Engines::NWN::Object
ObjectType _type
 The object's type. More...
 
Common::UString _name
 The object's display name. More...
 
Common::UString _description
 The object's description. More...
 
Common::UString _portrait
 The object's portrait. More...
 
Common::UString _conversation
 The object's default conversation. More...
 
uint32 _soundSet
 The object's sound set, as an index into soundset.2da. More...
 
Common::ScopedPtr< Aurora::SSFFile_ssf
 The object's sound set. More...
 
bool _static
 Is the object static? More...
 
bool _usable
 Is the object usable? More...
 
std::list< uint32_ids
 The object's model IDs. More...
 
Aurora::NWScript::Object_pcSpeaker
 The current PC speaking with the object. More...
 
Area_area
 The area the object is currently in. More...
 
float _position [3]
 The object's position. More...
 
float _orientation [4]
 The object's orientation. More...
 
Sound::ChannelHandle _sound
 The currently playing object sound. More...
 
Common::ScopedPtr< Tooltip_tooltip
 The tooltip displayed over the object. More...
 
- Protected Attributes inherited from Aurora::NWScript::Object
uint32 _id
 
Common::UString _tag
 

Detailed Description

Definition at line 40 of file item.h.

Member Enumeration Documentation

◆ ArmorPartType

Parts of an armor set.

Enumerator
kArmorPartHead 
kArmorPartNeck 
kArmorPartTorso 
kArmorPartPelvis 
kArmorPartBelt 
kArmorPartRightFoot 
kArmorPartLeftFoot 
kArmorPartRightShin 
kArmorPartLeftShin 
kArmorPartLeftThigh 
kArmorPartRightThigh 
kArmorPartRightFArm 
kArmorPartLeftFArm 
kArmorPartRightBicep 
kArmorPartLeftBicep 
kArmorPartRightShoul 
kArmorPartLeftShoul 
kArmorPartRightHand 
kArmorPartLeftHand 
kArmorPartMAX 

Definition at line 73 of file item.h.

◆ Color

Enumerator
kColorMetal1 
kColorMetal2 
kColorLeather1 
kColorLeather2 
kColorCloth1 
kColorCloth2 
kColorMAX 

Definition at line 42 of file item.h.

Constructor & Destructor Documentation

◆ Item()

Engines::NWN::Item::Item ( const Aurora::GFF3Struct item)

Definition at line 44 of file item.cpp.

References _armorParts, _colors, kArmorPartMAX, kColorMAX, Aurora::kFieldIDInvalid, and load().

Here is the call graph for this function:

◆ ~Item()

Engines::NWN::Item::~Item ( )

Definition at line 55 of file item.cpp.

Member Function Documentation

◆ getArmorPart()

uint32 Engines::NWN::Item::getArmorPart ( size_t  index) const

Definition at line 212 of file item.cpp.

References _armorParts, and kArmorPartMAX.

Referenced by Engines::NWN::Creature::getArmorModels().

Here is the caller graph for this function:

◆ getColor()

uint32 Engines::NWN::Item::getColor ( Color  color) const

Definition at line 206 of file item.cpp.

References _colors, and kColorMAX.

Referenced by Engines::NWN::Creature::getArmorModels().

Here is the caller graph for this function:

◆ hide()

void Engines::NWN::Item::hide ( )
virtual

Hide the item's model.

Reimplemented from Engines::NWN::Object.

Definition at line 113 of file item.cpp.

References _model.

Referenced by unloadModel().

Here is the caller graph for this function:

◆ isArmor()

bool Engines::NWN::Item::isArmor ( ) const

Definition at line 200 of file item.cpp.

References _armorParts, kArmorPartTorso, and Aurora::kFieldIDInvalid.

Referenced by Engines::NWN::Creature::getArmorModels().

Here is the caller graph for this function:

◆ load() [1/2]

void Engines::NWN::Item::load ( const Aurora::GFF3Struct item)
private

Definition at line 58 of file item.cpp.

References Common::UString::empty(), Aurora::GFF3Struct::getString(), Aurora::kFileTypeUTI, Engines::loadOptionalGFF3(), MKTAG, and Common::ScopedPtrBase< T, Deallocator >::reset().

Referenced by Item().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load() [2/2]

void Engines::NWN::Item::load ( const Aurora::GFF3Struct instance,
const Aurora::GFF3Struct blueprint 
)
private

Definition at line 118 of file item.cpp.

References loadProperties().

Here is the call graph for this function:

◆ loadArmorParts()

void Engines::NWN::Item::loadArmorParts ( const Aurora::GFF3Struct gff)
private

Definition at line 180 of file item.cpp.

References _armorParts, Aurora::GFF3Struct::getUint(), and kArmorPartMAX.

Referenced by loadProperties().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadModel()

void Engines::NWN::Item::loadModel ( )
virtual

◆ loadPortrait()

void Engines::NWN::Item::loadPortrait ( const Aurora::GFF3Struct gff)
private

Definition at line 167 of file item.cpp.

References Engines::NWN::Object::_portrait, Common::UString::empty(), Aurora::TwoDAFile::getRow(), Aurora::TwoDARow::getString(), Aurora::GFF3Struct::getString(), Aurora::GFF3Struct::getUint(), and TwoDAReg.

Referenced by loadProperties().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadProperties()

void Engines::NWN::Item::loadProperties ( const Aurora::GFF3Struct gff)
private

◆ show()

void Engines::NWN::Item::show ( )
virtual

Show the item's model.

Reimplemented from Engines::NWN::Object.

Definition at line 108 of file item.cpp.

References _model.

◆ unloadModel()

void Engines::NWN::Item::unloadModel ( )
virtual

Unload the item's model.

Reimplemented from Engines::NWN::Object.

Definition at line 102 of file item.cpp.

References _model, hide(), and Common::ScopedPtrBase< T, Deallocator >::reset().

Here is the call graph for this function:

Member Data Documentation

◆ _armorParts

uint32 Engines::NWN::Item::_armorParts[kArmorPartMAX]
private

The item's armor parts.

Definition at line 102 of file item.h.

Referenced by getArmorPart(), isArmor(), Item(), and loadArmorParts().

◆ _baseItem

uint32 Engines::NWN::Item::_baseItem
private

The index within the baseitem 2DA.

Definition at line 99 of file item.h.

Referenced by loadProperties().

◆ _colors

uint32 Engines::NWN::Item::_colors[kColorMAX]
private

The item's colors.

Definition at line 101 of file item.h.

Referenced by getColor(), Item(), and loadProperties().

◆ _model

Common::ScopedPtr<Graphics::Aurora::Model> Engines::NWN::Item::_model
private

The item's model.

Definition at line 104 of file item.h.

Referenced by hide(), loadModel(), show(), and unloadModel().

◆ _modelName

Common::UString Engines::NWN::Item::_modelName
private

The model's resource name.

Definition at line 97 of file item.h.

Referenced by loadModel().


The documentation for this class was generated from the following files: