diff options
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/party.cpp | 209 | ||||
-rw-r--r-- | engines/xeen/party.h | 2 | ||||
-rw-r--r-- | engines/xeen/scripts.cpp | 42 | ||||
-rw-r--r-- | engines/xeen/scripts.h | 2 |
4 files changed, 252 insertions, 3 deletions
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index 2822e41769..388b8de261 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -182,7 +182,7 @@ int Character::getMaxHP() const { int Character::getMaxSP() const { int result = 0; bool flag = false; - int amount; + int amount = 0; Attribute attrib; Skill skill; @@ -550,6 +550,213 @@ int Character::conditionMod(Attribute attrib) const { return v[attrib]; } +void Character::setValue(int id, uint value) { + Party &party = *Party::_vm->_party; + Scripts &scripts = *Party::_vm->_scripts; + + switch (id) { + case 3: + // Set character sex + _sex = (Sex)value; + break; + case 4: + // Set race + _race = (Race)value; + break; + case 5: + // Set class + _class = (CharacterClass)value; + break; + case 8: + // Set the current Hp + _currentHp = value; + break; + case 9: + // Set the current Sp + _currentSp = value; + break; + case 10: + case 77: + // Set temporary armor class + _ACTemp = value; + break; + case 11: + // Set temporary level + _level._temporary = value; + break; + case 12: + // Set the character's temporary age + _tempAge = value; + break; + case 16: + // Set character experience + _experience = value; + break; + case 17: + // Set party poison resistence + party._poisonResistence = value; + break; + case 18: + // Set condition + if (value == 16) { + // Clear all the conditions + Common::fill(&_conditions[CURSED], &_conditions[NO_CONDITION], false); + } else if (value == 6) { + _conditions[value] = 1; + } else { + ++_conditions[value]; + } + + if (value >= DEAD && value <= ERADICATED && _currentHp > 0) + _currentHp = 0; + break; + case 25: + // Set time of day in minutes (0-1440) + party._minutes = value; + break; + case 34: + // Set party gold + party._gold = value; + break; + case 35: + // Set party gems + party._gems = value; + break; + case 37: + _might._temporary = value; + break; + case 38: + _intellect._temporary = value; + break; + case 39: + _personality._temporary = value; + break; + case 40: + _endurance._temporary = value; + break; + case 41: + _speed._temporary = value; + break; + case 42: + _accuracy._temporary = value; + break; + case 43: + _luck._temporary = value; + break; + case 45: + _might._permanent = value; + break; + case 46: + _intellect._permanent = value; + break; + case 47: + _personality._permanent = value; + break; + case 48: + _endurance._permanent = value; + break; + case 49: + _speed._permanent = value; + break; + case 50: + _accuracy._permanent = value; + break; + case 51: + _luck._permanent = value; + break; + case 52: + _fireResistence._permanent = value; + break; + case 53: + _electricityResistence._permanent = value; + break; + case 54: + _coldResistence._permanent = value; + break; + case 55: + _poisonResistence._permanent = value; + break; + case 56: + _energyResistence._permanent = value; + break; + case 57: + _magicResistence._permanent = value; + break; + case 58: + _fireResistence._temporary = value; + break; + case 59: + _electricityResistence._temporary = value; + break; + case 60: + _coldResistence._temporary = value; + break; + case 61: + _poisonResistence._temporary = value; + break; + case 62: + _energyResistence._temporary = value; + break; + case 63: + _magicResistence._temporary = value; + break; + case 64: + _level._permanent = value; + break; + case 65: + // Set party food + party._food = value; + break; + case 69: + // Set levitate active + party._levitateActive = value != 0; + break; + case 70: + party._lightCount = value; + break; + case 71: + party._fireResistence = value; + break; + case 72: + party._electricityResistence = value; + break; + case 73: + party._coldResistence = value; + break; + case 74: + party._walkOnWaterActive = value != 0; + party._poisonResistence = value; + party._wizardEyeActive = value != 0; + party._coldResistence = value; + party._electricityResistence = value; + party._fireResistence = value; + party._lightCount = value; + party._levitateActive = value != 0; + break; + case 76: + // Set day of the year (0-99) + party._day = value; + break; + case 79: + party._wizardEyeActive = true; + break; + case 83: + scripts._nEdamageType = value; + break; + case 84: + party._mazeDirection = (Direction)value; + break; + case 85: + party._year = value; + break; + case 94: + party._walkOnWaterActive = value != 0; + break; + default: + break; + } +} + /*------------------------------------------------------------------------*/ void Roster::synchronize(Common::Serializer &s) { diff --git a/engines/xeen/party.h b/engines/xeen/party.h index dc87e88bd8..c77364bd10 100644 --- a/engines/xeen/party.h +++ b/engines/xeen/party.h @@ -165,6 +165,8 @@ public: int getCurrentLevel() const; int itemScan(int itemId) const; + + void setValue(int id, uint value); }; class Roster: public Common::Array<Character> { diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 5abd63a77e..57196af8b1 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -381,6 +381,10 @@ void Scripts::cmdSetChar(Common::Array<byte> ¶ms) { * Spawn a monster */ void Scripts::cmdSpawn(Common::Array<byte> ¶ms) { + Map &map = *_vm->_map; + if (params[0] >= map._mobData._monsters.size()) + map._mobData._monsters.resize(params[0] + 1); + MazeMonster &monster = _vm->_map->_mobData._monsters[params[0]]; MonsterStruct &monsterData = _vm->_map->_monsterData[monster._spriteId]; monster._position.x = params[1]; @@ -580,7 +584,43 @@ void Scripts::cmdReturn(Common::Array<byte> ¶ms) { cmdNoAction(params); } -void Scripts::cmdSetVar(Common::Array<byte> ¶ms) { error("TODO"); } +void Scripts::cmdSetVar(Common::Array<byte> ¶ms) { + Party &party = *_vm->_party; + bool flag = true; + uint val; + + switch (params[0]) { + case 25: + case 35: + case 101: + case 106: + val = (params[2] << 8) | params[1]; + break; + case 16: + case 34: + case 100: + val = (params[4] << 24) | (params[3] << 16) | (params[2] << 8) | params[3]; + break; + default: + val = params[1]; + break; + } + + if (_charIndex != 0 && _charIndex != 8) { + party._activeParty[_charIndex - 1].setValue(params[0], val); + } else { + // Set value for entire party + for (int idx = 0; idx < party._partyCount; ++idx) { + if (_charIndex == 0 || (_charIndex == 8 && _v2 != idx)) { + party._activeParty[idx].setValue(params[0], val); + } + } + } + + _var4F = true; + cmdNoAction(params); +} + void Scripts::cmdCutsceneEndClouds(Common::Array<byte> ¶ms) { error("TODO"); } void Scripts::cmdWhoWill(Common::Array<byte> ¶ms) { diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h index 66dcb9b70b..6193153250 100644 --- a/engines/xeen/scripts.h +++ b/engines/xeen/scripts.h @@ -137,7 +137,6 @@ private: int _v2; int _var4F; - int _nEdamageType; MazeEvent *_event; Common::Point _currentPos; Common::Stack<StackEntry> _stack; @@ -214,6 +213,7 @@ public: int _animCounter; bool _eventSkipped; int _whoWill; + int _nEdamageType; public: Scripts(XeenEngine *vm); |