aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-12-29 21:36:24 -0500
committerPaul Gilbert2017-12-29 21:36:24 -0500
commit27c3e44551870339cd9709f06d8200933d4406f5 (patch)
treef23f9bff7e93f8171ef4102f2dee4c2779c4d2cf
parent8f8166236c7aa9c37868131ccf0fb77e40655d4b (diff)
downloadscummvm-rg350-27c3e44551870339cd9709f06d8200933d4406f5.tar.gz
scummvm-rg350-27c3e44551870339cd9709f06d8200933d4406f5.tar.bz2
scummvm-rg350-27c3e44551870339cd9709f06d8200933d4406f5.zip
XEEN: Comments for the Character class methods
-rw-r--r--engines/xeen/character.cpp2
-rw-r--r--engines/xeen/character.h91
-rw-r--r--engines/xeen/dialogs_party.cpp2
3 files changed, 91 insertions, 4 deletions
diff --git a/engines/xeen/character.cpp b/engines/xeen/character.cpp
index e68cb192ae..d70ea8a08b 100644
--- a/engines/xeen/character.cpp
+++ b/engines/xeen/character.cpp
@@ -1818,7 +1818,7 @@ void Character::subtractHitPoints(int amount) {
}
}
-bool Character::hasSpecialItem() const {
+bool Character::hasSlayerSword() const {
for (uint idx = 0; idx < INV_ITEMS_TOTAL; ++idx) {
if (_weapons[idx]._id == 34)
// Character has Xeen Slayer sword
diff --git a/engines/xeen/character.h b/engines/xeen/character.h
index 76b1dae461..4dde3415db 100644
--- a/engines/xeen/character.h
+++ b/engines/xeen/character.h
@@ -104,14 +104,29 @@ public:
public:
XeenItem();
+ /**
+ * Clear the data for the item
+ */
void clear();
+ /**
+ * Returns true if no item is set
+ */
bool empty() const { return _id != 0; }
+ /**
+ * Synchronizes the data for the item
+ */
void synchronize(Common::Serializer &s);
+ /**
+ * Gets the elemental category for the item
+ */
ElementalCategory getElementalCategory() const;
+ /**
+ * Gets the attribute category for the item
+ */
AttributeCategory getAttributeCategory() const;
};
@@ -130,6 +145,9 @@ public:
InventoryItems(Character *character, ItemCategory category);
virtual ~InventoryItems() {}
+ /**
+ * Clears the set of items
+ */
void clear();
/**
@@ -144,6 +162,9 @@ public:
virtual Common::String getFullDescription(int itemIndex, int displayNum = 15) = 0;
+ /**
+ * Returns the identified details for an item
+ */
Common::String getIdentifiedDetails(int itemIndex);
/**
@@ -151,6 +172,9 @@ public:
*/
bool discardItem(int itemIndex);
+ /**
+ * Equips an item
+ */
virtual void equipItem(int itemIndex) {}
/**
@@ -163,6 +187,9 @@ public:
*/
void sort();
+ /**
+ * Enchants an item
+ */
virtual void enchantItem(int itemIndex, int amount);
/**
@@ -189,6 +216,9 @@ public:
*/
virtual Common::String getFullDescription(int itemIndex, int displayNum);
+ /**
+ * Enchants a weapon
+ */
virtual void enchantItem(int itemIndex, int amount);
};
@@ -210,6 +240,9 @@ public:
*/
virtual Common::String getFullDescription(int itemIndex, int displayNum);
+ /**
+ * Enchants an armor
+ */
virtual void enchantItem(int itemIndex, int amount);
};
@@ -328,8 +361,14 @@ public:
public:
Character();
+ /**
+ * Clears the data for a character
+ */
void clear();
+ /**
+ * Synchronizes data for the character
+ */
void synchronize(Common::Serializer &s);
/**
@@ -357,8 +396,14 @@ public:
*/
int getAge(bool ignoreTemp = false) const;
+ /**
+ * Gets the maximum hit points for a character
+ */
int getMaxHP() const;
+ /**
+ * Gets the maximum spell points for a character
+ */
int getMaxSP() const;
/**
@@ -372,10 +417,19 @@ public:
*/
static int statColor(int amount, int threshold);
+ /**
+ * Returns the bonus the character gets for stats
+ */
int statBonus(uint statValue) const;
+ /**
+ * Returns true if the character passes a saving throw for a given attack type
+ */
bool charSavingThrow(DamageType attackType) const;
+ /**
+ * Returns true if the character is unable to perform any action
+ */
bool noActions();
/**
@@ -388,6 +442,9 @@ public:
*/
bool hasAward(int awardId) const;
+ /**
+ * Returns the character's armor class
+ */
int getArmorClass(bool baseOnly = false) const;
/**
@@ -397,16 +454,34 @@ public:
uint getCurrentLevel() const;
+ /**
+ * Scans the character's inventory for the given item
+ */
int itemScan(int itemId) const;
+ /**
+ * Sets various attributes of a character
+ */
void setValue(int id, uint value);
+ /**
+ * Returns true if the character is a member of the current town's guild
+ */
bool guildMember() const;
+ /**
+ * Returns the experience required to reach the next level
+ */
uint experienceToNextLevel() const;
+ /**
+ * Returns the next level the character will reach
+ */
uint nextExperienceLevel() const;
+ /**
+ * Returns the character's current experience
+ */
uint getCurrentExperience() const;
/**
@@ -419,6 +494,9 @@ public:
*/
int getNumAwards() const;
+ /**
+ * Creates an item and adds it to the inventory
+ */
int makeItem(int p1, int itemIndex, int p3);
/**
@@ -427,14 +505,23 @@ public:
void addHitPoints(int amount);
/**
- * Remove hit points fromo the character
+ * Remove hit points from the character
*/
void subtractHitPoints(int amount);
- bool hasSpecialItem() const;
+ /**
+ * Returns true if the character has the Xeen Slayer Sword
+ */
+ bool hasSlayerSword() const;
+ /**
+ * Returns true if the character has a missile weapon, such as a bow
+ */
bool hasMissileWeapon() const;
+ /**
+ * Returns a category index for a character, used such for indexing into spell data
+ */
int getClassCategory() const;
};
diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp
index 39b4615ad5..f4d95ca612 100644
--- a/engines/xeen/dialogs_party.cpp
+++ b/engines/xeen/dialogs_party.cpp
@@ -222,7 +222,7 @@ void PartyDialog::execute() {
if (charButtonValue != 0) {
int charIndex = charButtonValue - Common::KEYCODE_1 + startingChar;
Character &c = party._roster[_charList[charIndex]];
- if (c.hasSpecialItem()) {
+ if (c.hasSlayerSword()) {
ErrorScroll::show(_vm, Res.HAS_SLAYER_SWORD);
} else {
Common::String msg = Common::String::format(Res.SURE_TO_DELETE_CHAR,