DM: Add F0368_COMMAND_SetLeader, G0411_i_LeaderIndex, G0299_ui_CandidateChampionOrdinal

This commit is contained in:
Bendegúz Nagy 2016-06-18 16:23:44 +02:00
parent d6e90e8a90
commit 40e4cceb3f
4 changed files with 44 additions and 7 deletions

View file

@ -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;

View file

@ -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);
};

View file

@ -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

View file

@ -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
};
}