diff options
author | Paul Gilbert | 2015-02-01 16:51:04 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-02-01 16:51:04 -0500 |
commit | 2b2ce19012c6b51e35704331d8b322f38c97f462 (patch) | |
tree | a74142d69211943ecee83600576ba6c48e8d14c6 | |
parent | d57c9f20213e66539fc7686a8b8abc26090aaa59 (diff) | |
download | scummvm-rg350-2b2ce19012c6b51e35704331d8b322f38c97f462.tar.gz scummvm-rg350-2b2ce19012c6b51e35704331d8b322f38c97f462.tar.bz2 scummvm-rg350-2b2ce19012c6b51e35704331d8b322f38c97f462.zip |
XEEN: Fixes for Character Info dialog stat details display
-rw-r--r-- | engines/xeen/dialogs_char_info.cpp | 15 | ||||
-rw-r--r-- | engines/xeen/party.cpp | 22 | ||||
-rw-r--r-- | engines/xeen/party.h | 10 | ||||
-rw-r--r-- | engines/xeen/town.cpp | 14 | ||||
-rw-r--r-- | engines/xeen/town.h | 2 |
5 files changed, 33 insertions, 30 deletions
diff --git a/engines/xeen/dialogs_char_info.cpp b/engines/xeen/dialogs_char_info.cpp index 1c0d0bfe31..44ce73e541 100644 --- a/engines/xeen/dialogs_char_info.cpp +++ b/engines/xeen/dialogs_char_info.cpp @@ -243,7 +243,7 @@ void CharacterInfo::loadDrawStructs() { * Set up the button list for the dialog */ void CharacterInfo::addButtons() { - addButton(Common::Rect(10, 24, 34, 64), 1001, &_iconSprites); + addButton(Common::Rect(10, 24, 34, 44), 1001, &_iconSprites); addButton(Common::Rect(10, 47, 34, 67), 1002, &_iconSprites); addButton(Common::Rect(10, 70, 34, 90), 1003, &_iconSprites); addButton(Common::Rect(10, 93, 34, 113), 1004, &_iconSprites); @@ -343,7 +343,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) { Common::Rect bounds(STAT_POS[0][attrib], STAT_POS[1][attrib], STAT_POS[0][attrib] + 143, STAT_POS[1][attrib] + 52); Party &party = *_vm->_party; - int stat1, stat2; + uint stat1, stat2; uint idx; Common::String msg; @@ -371,7 +371,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) { stat1 = c.getAge(false); stat2 = c.getAge(true); msg = Common::String::format(AGE_TEXT, STAT_NAMES[attrib], - stat2, c._dbDay, c._ybDay); + stat1, stat2, c._birthDay, c._birthYear); break; case 8: { @@ -422,6 +422,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) { c._poisonResistence._permanent + c.itemScan(14) + c._poisonResistence._temporary, c._energyResistence._permanent + c.itemScan(15) + c._energyResistence._temporary, c._magicResistence._permanent + c.itemScan(16) + c._magicResistence._temporary); + bounds.setHeight(80); break; case 13: { @@ -466,10 +467,10 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) { case 15: // Experience stat1 = c.getCurrentExperience(); - stat2 = c.nextExperienceLevel(); + stat2 = c.experienceToNextLevel(); msg = Common::String::format(EXPERIENCE_TEXT, STAT_NAMES[attrib], stat1, - stat2 == 0 ? ELIGIBLE : Common::String::format("%d", stat2) + stat2 == 0 ? ELIGIBLE : Common::String::format("%d", stat2).c_str() ); bounds.setHeight(43); break; @@ -478,6 +479,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) { // Gold msg = Common::String::format(IN_PARTY_IN_BANK, STAT_NAMES[attrib], party._gold, party._bankGold); + bounds.setHeight(43); break; case 17: @@ -516,6 +518,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) { Condition condition = c.worstCondition(); if (condition == NO_CONDITION) { lines[0] = Common::String::format("\n\t020%s", GOOD); + ++total; } if (party._blessed) @@ -537,7 +540,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) { lines[17].c_str(), lines[18].c_str(), lines[19].c_str() ); - bounds.top = ((total - 1) / 2) * 8; + bounds.top -= ((total - 1) / 2) * 8; bounds.setHeight(total * 9 + 26); if (bounds.bottom >= SCREEN_HEIGHT) bounds.moveTo(bounds.left, SCREEN_HEIGHT - bounds.height() - 1); diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index 42500ddcfe..d046595579 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -49,7 +49,7 @@ Character::Character() { _xeenSide = 0; _class = CLASS_KNIGHT; _ACTemp = 0; - _dbDay = 0; + _birthDay = 0; _tempAge = 0; Common::fill(&_skills[0], &_skills[18], 0); Common::fill(&_awards[0], &_awards[128], false); @@ -64,7 +64,7 @@ Character::Character() { _savedMazeId = 0; _currentHp = 0; _currentSp = 0; - _ybDay = 0; + _birthYear = 0; _experience = 0; _currentAdventuringSpell = 0; _currentCombatSpell = 0; @@ -93,7 +93,7 @@ void Character::synchronize(Common::Serializer &s) { _luck.synchronize(s); s.syncAsByte(_ACTemp); _level.synchronize(s); - s.syncAsByte(_dbDay); + s.syncAsByte(_birthDay); s.syncAsByte(_tempAge); // Synchronize the skill list @@ -144,7 +144,7 @@ void Character::synchronize(Common::Serializer &s) { s.syncAsByte(_savedMazeId); s.syncAsUint16LE(_currentHp); s.syncAsUint16LE(_currentSp); - s.syncAsUint16LE(_ybDay); + s.syncAsUint16LE(_birthYear); s.syncAsUint32LE(_experience); s.syncAsByte(_currentAdventuringSpell); s.syncAsByte(_currentCombatSpell); @@ -160,7 +160,7 @@ Condition Character::worstCondition() const { } int Character::getAge(bool ignoreTemp) const { - int year = MIN(Party::_vm->_party->_year - _ybDay, 254); + int year = MIN(Party::_vm->_party->_year - _birthYear, (uint)254); return ignoreTemp ? year : year + _tempAge; } @@ -796,22 +796,22 @@ bool Character::guildMember() const { } } -uint Character::nextExperienceLevel() const { - uint base = currentExperienceLevel(); +uint Character::experienceToNextLevel() const { + uint next = nextExperienceLevel(); uint curr = getCurrentExperience(); - return (curr < base) ? 0 : curr - base; + return (curr >= next) ? 0 : next - curr; } -uint Character::currentExperienceLevel() const { +uint Character::nextExperienceLevel() const { int shift, base; if (_level._permanent >= 12) { base = _level._permanent - 12; shift = 10; } else { base = 0; - shift = _level._permanent; + shift = _level._permanent - 1; } - + return (base * 1024000) + (CLASS_EXP_LEVELS[_class] << shift); } diff --git a/engines/xeen/party.h b/engines/xeen/party.h index b793b5c696..5adc9b1c7f 100644 --- a/engines/xeen/party.h +++ b/engines/xeen/party.h @@ -105,7 +105,7 @@ public: AttributePair _luck; int _ACTemp; AttributePair _level; - int _dbDay; + uint _birthDay; int _tempAge; int _skills[18]; bool _awards[128]; @@ -131,7 +131,7 @@ public: int _savedMazeId; int _currentHp; int _currentSp; - int _ybDay; + uint _birthYear; uint32 _experience; int _currentAdventuringSpell; int _currentCombatSpell; @@ -173,9 +173,9 @@ public: bool guildMember() const; - uint nextExperienceLevel() const; + uint experienceToNextLevel() const; - uint currentExperienceLevel() const; + uint nextExperienceLevel() const; uint getCurrentExperience() const; @@ -223,7 +223,7 @@ public: bool _worldEnd; int _ctr24; // TODO: Figure out proper name int _day; - int _year; + uint _year; int _minutes; uint _food; int _lightCount; diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp index 2f31113146..3449c2e3c3 100644 --- a/engines/xeen/town.cpp +++ b/engines/xeen/town.cpp @@ -51,7 +51,7 @@ Town::Town(XeenEngine *vm) : _vm(vm) { _dayOfWeek = 0; _uncurseCost = 0; _flag1 = false; - _nextExperienceLevel = 0; + _experienceToNextLevel = 0; _drawCtr1 = _drawCtr2 = 0; } @@ -458,14 +458,14 @@ Common::String Town::createTownText(Character &ch) { } } - _nextExperienceLevel = ch.nextExperienceLevel(); + _experienceToNextLevel = ch.experienceToNextLevel(); - if (_nextExperienceLevel >= 0x10000 && ch._level._permanent < _v20) { + if (_experienceToNextLevel >= 0x10000 && ch._level._permanent < _v20) { int nextLevel = ch._level._permanent + 1; return Common::String::format(EXPERIENCE_FOR_LEVEL, - ch._name.c_str(), _nextExperienceLevel, nextLevel); + ch._name.c_str(), _experienceToNextLevel, nextLevel); } else if (ch._level._permanent >= 20) { - _nextExperienceLevel = 1; + _experienceToNextLevel = 1; msg = Common::String::format(LEARNED_ALL, ch._name.c_str()); } else { msg = Common::String::format(ELIGIBLE_FOR_LEVEL, @@ -906,7 +906,7 @@ Character *Town::doTrainingOptions(Character *c) { break; case Common::KEYCODE_t: - if (_nextExperienceLevel) { + if (_experienceToNextLevel) { sound.playSample(nullptr, 0); _drawFrameIndex = 0; @@ -927,7 +927,7 @@ Character *Town::doTrainingOptions(Character *c) { File f(isDarkCc ? "prtygd.voc" : "trainin2.voc"); sound.playSample(&f, 1); - c->_experience -= c->currentExperienceLevel() - + c->_experience -= c->nextExperienceLevel() - (c->getCurrentExperience() - c->_experience); c->_level._permanent++; diff --git a/engines/xeen/town.h b/engines/xeen/town.h index 807f6b5138..de87f03b23 100644 --- a/engines/xeen/town.h +++ b/engines/xeen/town.h @@ -58,7 +58,7 @@ private: int _arr1[6]; int _currentCharLevel; bool _flag1; - uint _nextExperienceLevel; + uint _experienceToNextLevel; int _drawFrameIndex; int _drawCtr1, _drawCtr2; |