aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-24 09:29:17 -0500
committerPaul Gilbert2015-01-24 09:29:17 -0500
commit1f8a5ea24a8c031979289953fdb674029338d9bc (patch)
treea962349347e0529e817965a0df255f7fdac755b0 /engines
parentb533822c0666ade51d2da2047e87351d3047fb58 (diff)
downloadscummvm-rg350-1f8a5ea24a8c031979289953fdb674029338d9bc.tar.gz
scummvm-rg350-1f8a5ea24a8c031979289953fdb674029338d9bc.tar.bz2
scummvm-rg350-1f8a5ea24a8c031979289953fdb674029338d9bc.zip
XEEN: Changed PlayerStruct to Character
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/interface.cpp8
-rw-r--r--engines/xeen/party.cpp40
-rw-r--r--engines/xeen/party.h10
-rw-r--r--engines/xeen/scripts.cpp4
4 files changed, 31 insertions, 31 deletions
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index a23cee69e5..44e2326c1f 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -106,7 +106,7 @@ start:
// Build up a list of characters on the same Xeen side being loaded
for (int i = 0; i < XEEN_TOTAL_CHARACTERS; ++i) {
- PlayerStruct &player = _vm->_roster[i];
+ Character &player = _vm->_roster[i];
if (player._name.empty() || player._xeenSide != (map._loadDarkSide ? 1 : 0))
continue;
@@ -300,7 +300,7 @@ void Interface::setupFaces(int charIndex, Common::Array<int> xeenSideChars, bool
Common::Rect &b = _buttons[7 + posIndex]._bounds;
b.moveTo((posIndex & 1) ? 117 : 16, b.top);
- PlayerStruct &ps = _vm->_roster[xeenSideChars[charIndex + posIndex]];
+ Character &ps = _vm->_roster[xeenSideChars[charIndex + posIndex]];
playerNames[posIndex] = isInParty ? IN_PARTY : ps._name;
playerRaces[posIndex] = RACE_NAMES[ps._race];
playerSex[posIndex] = SEX_NAMES[ps._sex];
@@ -336,7 +336,7 @@ void Interface::charIconsPrint(bool updateFlag) {
for (int idx = 0; idx < (stateFlag ? _vm->_party->_combatPartyCount :
_vm->_party->_partyCount); ++idx) {
int charIndex = stateFlag ? _combatCharIds[idx] : idx;
- PlayerStruct &ps = _vm->_party->_activeParty[charIndex];
+ Character &ps = _vm->_party->_activeParty[charIndex];
Condition charCondition = ps.worstCondition();
int charFrame = FACE_CONDITION_FRAMES[charCondition];
@@ -352,7 +352,7 @@ void Interface::charIconsPrint(bool updateFlag) {
for (int idx = 0; idx < (stateFlag ? _vm->_party->_combatPartyCount :
_vm->_party->_partyCount); ++idx) {
int charIndex = stateFlag ? _combatCharIds[idx] : idx;
- PlayerStruct &ps = _vm->_party->_activeParty[charIndex];
+ Character &ps = _vm->_party->_activeParty[charIndex];
// Draw the Hp bar
int maxHp = ps.getMaxHP();
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index b19e39aa2e..791a19ff4f 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -42,7 +42,7 @@ void AttributePair::synchronize(Common::Serializer &s) {
/*------------------------------------------------------------------------*/
-PlayerStruct::PlayerStruct() {
+Character::Character() {
_sex = MALE;
_race = HUMAN;
_xeenSide = 0;
@@ -69,7 +69,7 @@ PlayerStruct::PlayerStruct() {
_currentCombatSpell = 0;
}
-void PlayerStruct::synchronize(Common::Serializer &s) {
+void Character::synchronize(Common::Serializer &s) {
char name[16];
Common::fill(&name[0], &name[16], '\0');
strncpy(name, _name.c_str(), 16);
@@ -149,7 +149,7 @@ void PlayerStruct::synchronize(Common::Serializer &s) {
s.syncAsByte(_currentCombatSpell);
}
-Condition PlayerStruct::worstCondition() const {
+Condition Character::worstCondition() const {
for (int cond = ERADICATED; cond >= CURSED; --cond) {
if (_conditions[cond])
return (Condition)cond;
@@ -158,13 +158,13 @@ Condition PlayerStruct::worstCondition() const {
return NO_CONDITION;
}
-int PlayerStruct::getAge(bool ignoreTemp) const {
+int Character::getAge(bool ignoreTemp) const {
int year = MIN(Party::_vm->_party->_year - _ybDay, 254);
return ignoreTemp ? year : year + _tempAge;
}
-int PlayerStruct::getMaxHP() const {
+int Character::getMaxHP() const {
int hp = BASE_HP_BY_CLASS[_class];
hp += statBonus(getStat(ENDURANCE, false));
hp += RACE_HP_BONUSES[_race];
@@ -182,7 +182,7 @@ int PlayerStruct::getMaxHP() const {
return hp;
}
-int PlayerStruct::getMaxSP() const {
+int Character::getMaxSP() const {
int result = 0;
bool flag = false;
int amount;
@@ -240,7 +240,7 @@ int PlayerStruct::getMaxSP() const {
/**
* Get the effective value of a given stat for the character
*/
-int PlayerStruct::getStat(Attribute attrib, bool applyMod) const {
+int Character::getStat(Attribute attrib, bool applyMod) const {
AttributePair attr;
int mode = 0;
@@ -291,14 +291,14 @@ int PlayerStruct::getStat(Attribute attrib, bool applyMod) const {
return (attr._permanent >= 1) ? attr._permanent : 0;
}
-int PlayerStruct::statBonus(int statValue) const {
+int Character::statBonus(int statValue) const {
for (int idx = 0; STAT_VALUES[idx] <= statValue; ++idx)
return STAT_BONUSES[idx];
return 0;
}
-bool PlayerStruct::charSavingThrow(DamageType attackType) const {
+bool Character::charSavingThrow(DamageType attackType) const {
int v, vMax;
if (attackType == DT_PHYSICAL) {
@@ -335,7 +335,7 @@ bool PlayerStruct::charSavingThrow(DamageType attackType) const {
return Party::_vm->getRandomNumber(1, vMax) <= v;
}
-bool PlayerStruct::noActions() {
+bool Character::noActions() {
Condition condition = worstCondition();
switch (condition) {
@@ -355,7 +355,7 @@ bool PlayerStruct::noActions() {
}
}
-void PlayerStruct::setAward(int awardId, bool value) {
+void Character::setAward(int awardId, bool value) {
int v = awardId;
if (awardId == 73)
v = 126;
@@ -365,7 +365,7 @@ void PlayerStruct::setAward(int awardId, bool value) {
_awards[v] = value;
}
-bool PlayerStruct::hasAward(int awardId) const {
+bool Character::hasAward(int awardId) const {
int v = awardId;
if (awardId == 73)
v = 126;
@@ -375,7 +375,7 @@ bool PlayerStruct::hasAward(int awardId) const {
return _awards[v];
}
-int PlayerStruct::getArmorClass(bool baseOnly) const {
+int Character::getArmorClass(bool baseOnly) const {
Party &party = *Party::_vm->_party;
int result = statBonus(getStat(SPEED, false)) + itemScan(9);
@@ -388,7 +388,7 @@ int PlayerStruct::getArmorClass(bool baseOnly) const {
/**
* Returns the thievery skill level, adjusted by class and race
*/
-int PlayerStruct::getThievery() const {
+int Character::getThievery() const {
int result = getCurrentLevel() * 2;
if (_class == CLASS_NINJA)
@@ -420,11 +420,11 @@ int PlayerStruct::getThievery() const {
return MAX(result, 0);
}
-int PlayerStruct::getCurrentLevel() const {
+int Character::getCurrentLevel() const {
return MAX(_level._permanent + _level._temporary, 0);
}
-int PlayerStruct::itemScan(int itemId) const {
+int Character::itemScan(int itemId) const {
int result = 0;
for (int accessIdx = 0; accessIdx < 3; ++accessIdx) {
@@ -510,7 +510,7 @@ int PlayerStruct::itemScan(int itemId) const {
/**
* Modifies a passed attribute value based on player's condition
*/
-int PlayerStruct::conditionMod(Attribute attrib) const {
+int Character::conditionMod(Attribute attrib) const {
if (_conditions[DEAD] || _conditions[STONED] || _conditions[ERADICATED])
return 0;
@@ -757,7 +757,7 @@ void Party::changeTime(int numMinutes) {
if (((_minutes + numMinutes) / 480) != (_minutes / 480)) {
for (int idx = 0; idx < _partyCount; ++idx) {
- PlayerStruct &player = _activeParty[idx];
+ Character &player = _activeParty[idx];
if (!player._conditions[DEAD] && !player._conditions[STONED] &&
!player._conditions[ERADICATED]) {
@@ -833,7 +833,7 @@ void Party::changeTime(int numMinutes) {
addTime(numMinutes);
for (int idx = 0; idx < _partyCount; ++idx) {
- PlayerStruct &player = _activeParty[idx];
+ Character &player = _activeParty[idx];
if (player._conditions[CONFUSED] && _vm->getRandomNumber(2) == 1) {
if (player.charSavingThrow(DT_PHYSICAL)) {
@@ -899,7 +899,7 @@ void Party::addTime(int numMinutes) {
void Party::resetTemps() {
for (int idx = 0; idx < _partyCount; ++idx) {
- PlayerStruct &player = _activeParty[idx];
+ Character &player = _activeParty[idx];
player._magicResistence._temporary = 0;
player._energyResistence._temporary = 0;
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index 5d35b0f726..f56190982d 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -86,7 +86,7 @@ public:
void synchronize(Common::Serializer &s);
};
-class PlayerStruct {
+class Character {
private:
int conditionMod(Attribute attrib) const;
public:
@@ -135,7 +135,7 @@ public:
int _currentAdventuringSpell;
int _currentCombatSpell;
public:
- PlayerStruct();
+ Character();
void synchronize(Common::Serializer &s);
Condition worstCondition() const;
@@ -167,7 +167,7 @@ public:
int itemScan(int itemId) const;
};
-class Roster: public Common::Array<PlayerStruct> {
+class Roster: public Common::Array<Character> {
public:
Roster() {}
@@ -175,7 +175,7 @@ public:
};
class Party {
- friend class PlayerStruct;
+ friend class Character;
private:
static XeenEngine *_vm;
public:
@@ -235,7 +235,7 @@ public:
bool _characterFlags[30][24];
public:
// Other party related runtime data
- Common::Array<PlayerStruct> _activeParty;
+ Common::Array<Character> _activeParty;
int _combatPartyCount;
bool _partyDead;
bool _newDay;
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index 6f14be20b7..10ba972d8d 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -667,7 +667,7 @@ void Scripts::doEndGame2() {
int v2 = 0;
for (int idx = 0; idx < party._partyCount; ++idx) {
- PlayerStruct &player = party._activeParty[idx];
+ Character &player = party._activeParty[idx];
if (player.hasAward(77)) {
v2 = 2;
break;
@@ -696,7 +696,7 @@ void Scripts::doEnding(const Common::String &endStr, int v2) {
*/
bool Scripts::ifProc(int action, uint32 mask, int mode, int charIndex) {
Party &party = *_vm->_party;
- PlayerStruct &ps = party._activeParty[charIndex];
+ Character &ps = party._activeParty[charIndex];
uint v = 0;
switch (action) {