diff options
author | Paul Gilbert | 2017-12-10 11:32:48 -0500 |
---|---|---|
committer | Paul Gilbert | 2017-12-10 11:32:48 -0500 |
commit | 6420add46c79d1ebb23654ad904ce913513797fe (patch) | |
tree | 64cc792572d4814d9949afb4d6fc5d23ba30e140 /engines/xeen | |
parent | 14f70d216abe98cc7150589a5cc92e13eefe98ec (diff) | |
download | scummvm-rg350-6420add46c79d1ebb23654ad904ce913513797fe.tar.gz scummvm-rg350-6420add46c79d1ebb23654ad904ce913513797fe.tar.bz2 scummvm-rg350-6420add46c79d1ebb23654ad904ce913513797fe.zip |
XEEN: Move location specific fields into their own subclasses
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/town.cpp | 58 | ||||
-rw-r--r-- | engines/xeen/town.h | 43 |
2 files changed, 54 insertions, 47 deletions
diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp index 82093f87d8..c2622818d8 100644 --- a/engines/xeen/town.cpp +++ b/engines/xeen/town.cpp @@ -37,33 +37,11 @@ TownLocation::TownLocation(TownAction action) : ButtonContainer(g_vm), _songName = Res.TOWN_ACTION_MUSIC[_isDarkCc][action]; _townSprites.resize(Res.TOWN_ACTION_FILES[_isDarkCc][action]); - Common::fill(&_arr1[0], &_arr1[6], 0); _animFrame = 0; _drawFrameIndex = 0; - _currentCharLevel = 0; - _v1 = 0; - _v2 = 0; - _donation = 0; - _healCost = 0; - _v5 = _v6 = 0; - _v10 = _v11 = 0; - _v12 = _v13 = 0; - _v14 = 0; - _maxLevel = 0; - _v21 = 0; - _v22 = 0; - _v23 = 0; - _v24 = 0; - _dayOfWeek = 0; - _uncurseCost = 0; - _flag1 = false; - _experienceToNextLevel = 0; + _farewellTime = 0; _drawCtr1 = _drawCtr2 = 0; _townPos = Common::Point(8, 8); - - clearButtons(); - _icons1.clear(); - _icons2.clear(); } TownLocation::~TownLocation() { @@ -126,8 +104,8 @@ int TownLocation::show() { int result; if (party._mazeId != 0) { map.load(party._mazeId); - _v1 += 1440; - party.addTime(_v1); + _farewellTime += 1440; + party.addTime(_farewellTime); result = 0; } else { _vm->_saves->saveChars(); @@ -564,6 +542,11 @@ Character *GuildLocation::doOptions(Character *c) { /*------------------------------------------------------------------------*/ TavernLocation::TavernLocation() : TownLocation(TAVERN) { + _v21 = 0; + _v22 = 0; + _v23 = 0; + _v24 = 0; + loadStrings("tavern.bin"); _icons1.load("tavern.icn"); addButton(Common::Rect(281, 108, 305, 128), Common::KEYCODE_ESCAPE, &_icons1); @@ -800,6 +783,17 @@ void TavernLocation::farewell() { /*------------------------------------------------------------------------*/ TempleLocation::TempleLocation() : TownLocation(TEMPLE) { + _currentCharLevel = 0; + _donation = 0; + _healCost = 0; + _uncurseCost = 0; + _dayOfWeek = 0; + _v10 = _v11 = 0; + _v12 = _v13 = 0; + _v14 = 0; + _flag1 = false; + _v5 = _v6 = 0; + _icons1.load("esc.icn"); addButton(Common::Rect(261, 108, 285, 128), Common::KEYCODE_ESCAPE, &_icons1); addButton(Common::Rect(234, 54, 308, 62), Common::KEYCODE_h); @@ -941,7 +935,7 @@ Character *TempleLocation::doOptions(Character *c) { c->_currentHp = c->getMaxHP(); Common::fill(&c->_conditions[HEART_BROKEN], &c->_conditions[NO_CONDITION], 0); - _v1 = 1440; + _farewellTime = 1440; intf.drawParty(true); sound.stopSound(); sound.playSound("ahh.voc", 1); @@ -957,7 +951,7 @@ Character *TempleLocation::doOptions(Character *c) { c->_misc[idx]._bonusFlags &= ~ITEMFLAG_CURSED; } - _v1 = 1440; + _farewellTime = 1440; intf.drawParty(true); sound.stopSound(); sound.playSound("ahh.voc", 1); @@ -974,6 +968,10 @@ Character *TempleLocation::doOptions(Character *c) { /*------------------------------------------------------------------------*/ TrainingLocation::TrainingLocation() : TownLocation(TRAINING) { + Common::fill(&_charsTrained[0], &_charsTrained[6], 0); + _maxLevel = 0; + _experienceToNextLevel = 0; + _icons1.load("train.icn"); addButton(Common::Rect(281, 108, 305, 128), Common::KEYCODE_ESCAPE, &_icons1); addButton(Common::Rect(242, 108, 266, 128), Common::KEYCODE_t, &_icons1); @@ -1056,7 +1054,7 @@ Character *TrainingLocation::doOptions(Character *c) { // Switch character _buttonValue -= Common::KEYCODE_F1; if (_buttonValue < (int)party._activeParty.size()) { - _v2 = _buttonValue; + _charIndex = _buttonValue; c = &party._activeParty[_buttonValue]; intf.highlightChar(_buttonValue); } @@ -1086,9 +1084,9 @@ Character *TrainingLocation::doOptions(Character *c) { (c->getCurrentExperience() - c->_experience); c->_level._permanent++; - if (!_arr1[_v2]) { + if (!_charsTrained[_charIndex]) { party.addTime(1440); - _arr1[_v2] = 1; + _charsTrained[_charIndex] = true; } party.resetTemps(); diff --git a/engines/xeen/town.h b/engines/xeen/town.h index 7381a60076..03f29e7b2a 100644 --- a/engines/xeen/town.h +++ b/engines/xeen/town.h @@ -50,26 +50,15 @@ protected: const bool &_isDarkCc; int _animFrame; Common::String _vocName, _songName; - int _v1, _v2; - int _donation; - int _healCost; - int _v5, _v6; - int _v10, _v11, _v12; - int _v13, _v14; - uint _maxLevel; - int _v21; - uint _v22; - int _v23; - int _v24; - int _dayOfWeek; - int _uncurseCost; Common::Point _townPos; - int _arr1[6]; - int _currentCharLevel; - bool _flag1; - uint _experienceToNextLevel; int _drawFrameIndex; + uint _farewellTime; int _drawCtr1, _drawCtr2; + +/* + int _v1, _v2; + int _dayOfWeek; + */ protected: /** * Load a set of text strings from the given resource @@ -184,6 +173,11 @@ public: }; class TavernLocation : public TownLocation { +private: + int _v21; + uint _v22; + int _v23; + int _v24; protected: /** * Generates the display text for the location, for a given character @@ -205,6 +199,16 @@ public: }; class TempleLocation : public TownLocation { +private: + int _currentCharLevel; + int _donation; + int _healCost; + int _uncurseCost; + int _dayOfWeek; + int _v10, _v11, _v12; + int _v13, _v14; + bool _flag1; + int _v5, _v6; protected: /** * Generates the display text for the location, for a given character @@ -221,6 +225,11 @@ public: }; class TrainingLocation : public TownLocation { +private: + int _charIndex; + bool _charsTrained[MAX_ACTIVE_PARTY]; + uint _experienceToNextLevel; + uint _maxLevel; protected: /** * Generates the display text for the location, for a given character |