diff options
author | Bendegúz Nagy | 2016-06-18 16:23:44 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 40e4cceb3feb9da805f2c2dde47802b404a7e5cc (patch) | |
tree | 104d65e18c30a432b9d6c0bd6a191486174934ae | |
parent | d6e90e8a9090ad29406d25ee317332a5500a31de (diff) | |
download | scummvm-rg350-40e4cceb3feb9da805f2c2dde47802b404a7e5cc.tar.gz scummvm-rg350-40e4cceb3feb9da805f2c2dde47802b404a7e5cc.tar.bz2 scummvm-rg350-40e4cceb3feb9da805f2c2dde47802b404a7e5cc.zip |
DM: Add F0368_COMMAND_SetLeader, G0411_i_LeaderIndex, G0299_ui_CandidateChampionOrdinal
-rw-r--r-- | engines/dm/champion.cpp | 4 | ||||
-rw-r--r-- | engines/dm/champion.h | 14 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 29 | ||||
-rw-r--r-- | engines/dm/eventman.h | 4 |
4 files changed, 44 insertions, 7 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 3aabfb0fa5..5ba529d263 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -3,7 +3,9 @@ namespace DM { -ChampionMan::ChampionMan(DMEngine *vm) : _vm(vm) {} +ChampionMan::ChampionMan(DMEngine *vm) : _vm(vm) { + _leaderIndex = kChampionNone; +} uint16 ChampionMan::getChampionPortraitX(uint16 index) { return ((index) & 0x7) << 5; diff --git a/engines/dm/champion.h b/engines/dm/champion.h index dc0e11c6ab..353fcf0194 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -182,6 +182,9 @@ class Skill { class Champion { Thing _slots[30]; Skill _skills[20]; + uint16 _attributes; + byte _statistics[7][3]; + uint16 _wounds; public: char _name[8]; char _title[20]; @@ -195,8 +198,6 @@ public: uint16 _poisonEventCount; int16 _enableActionEventIndex; int16 _hideDamageReceivedIndex; - uint16 _attributes; - uint16 _wounds; int16 _currHealth; int16 _maxHealth; int16 _currStamina; @@ -206,7 +207,6 @@ public: int16 _actionDefense; int16 _food; int16 _water; - byte _statistics[7][3]; uint16 _load; int16 _shieldDefense; byte Portrait[464]; // 32 x 29 pixel portrait @@ -243,7 +243,6 @@ public: class ChampionMan { DMEngine *_vm; - Champion _champions[4]; uint16 getChampionPortraitX(uint16 index); // @ M27_PORTRAIT_X uint16 getChampionPortraitY(uint16 index); // @ M28_PORTRAIT_Y @@ -251,9 +250,12 @@ class ChampionMan { ChampionIndex getIndexInCell(ViewCell cell); // @ F0285_CHAMPION_GetIndexInCell int16 getDecodedValue(char *string, uint16 characterCount); // @ F0279_CHAMPION_GetDecodedValue public: - uint16 _partyChampionCount; + Champion _champions[4]; + uint16 _partyChampionCount; // @ G0305_ui_PartyChampionCount bool _partyDead; // @ G0303_B_PartyDead - Thing _leaderHand; + Thing _leaderHand; // @ G0414_T_LeaderHandObject + ChampionIndex _leaderIndex; // @ G0411_i_LeaderIndex + uint16 _candidateChampionOrdinal; // @ G0299_ui_CandidateChampionOrdinal ChampionMan(DMEngine *vm); }; diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 626887ebab..8728dd76f6 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -420,5 +420,34 @@ void EventManager::commandMoveParty(CommandType cmdType) { // MISSING CODE: Lots of code } +void EventManager::commandSetLeader(ChampionIndex index) { + ChampionMan &cm = *_vm->_championMan; + ChampionIndex leaderIndex; + + if ((cm._leaderIndex == index) || ((index != kChampionNone) && !cm._champions[index]._currHealth)) + return; + + if (cm._leaderIndex != kChampionNone) { + leaderIndex = cm._leaderIndex; + cm._champions[leaderIndex].setAttributeFlag(kChampionAttributeLoad, true); + cm._champions[leaderIndex].setAttributeFlag(kChampionAttributeNameTitle, true); + cm._champions[leaderIndex]._load -= _vm->_dungeonMan->getObjectWeight(cm._leaderHand); + cm._leaderIndex = kChampionNone; + warning("MISSING CODE: F0292_CHAMPION_DrawState"); + } + if (index == kChampionNone) { + cm._leaderIndex = kChampionNone; + return; + } + cm._leaderIndex = index; + Champion *champion = &cm._champions[cm._leaderIndex]; + champion->_dir = _vm->_dungeonMan->_currMap.partyDir; + cm._champions[index]._load += _vm->_dungeonMan->getObjectWeight(cm._leaderHand); + if (indexToOrdinal(index) != cm._candidateChampionOrdinal) { + champion->setAttributeFlag(kChampionAttributeIcon, true); + champion->setAttributeFlag(kChampionAttributeNameTitle, true); + warning("MISSING CODE: F0292_CHAMPION_DrawState"); + } +} }; // end of namespace DM diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h index ed6bba20b1..8984b02f27 100644 --- a/engines/dm/eventman.h +++ b/engines/dm/eventman.h @@ -3,7 +3,9 @@ #include "common/events.h" #include "common/queue.h" + #include "gfx.h" +#include "champion.h" namespace DM { @@ -208,6 +210,8 @@ public: void processClick(Common::Point mousePos, MouseButton button); // @ F0359_COMMAND_ProcessClick_CPSC CommandType getCommandTypeFromMouseInput(MouseInput *input, Common::Point mousePos, MouseButton button); // @ F0358_COMMAND_GetCommandFromMouseInput_CPSC void processCommandQueue(); // @ F0380_COMMAND_ProcessQueue_CPSC + + void commandSetLeader(ChampionIndex index); // @ F0368_COMMAND_SetLeader }; } |