diff options
-rw-r--r-- | engines/dm/champion.cpp | 18 | ||||
-rw-r--r-- | engines/dm/champion.h | 11 |
2 files changed, 25 insertions, 4 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 0ae05396f7..3aabfb0fa5 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -3,7 +3,23 @@ namespace DM { -ChampionMan::ChampionMan(DMEngine *vm): _vm(vm) {} +ChampionMan::ChampionMan(DMEngine *vm) : _vm(vm) {} + +uint16 ChampionMan::getChampionPortraitX(uint16 index) { + return ((index) & 0x7) << 5; +} + +uint16 ChampionMan::getChampionPortraitY(uint16 index) { + return ((index) >> 3) * 29; +} + +int16 ChampionMan::getDecodedValue(char *string, uint16 characterCount) { + int val = 0; + for (uint16 i = 0; i < characterCount; ++i) { + val = (val << 4) + (string[i] - 'A'); + } + return val; +} ChampionIndex ChampionMan::getIndexInCell(ViewCell cell) { for (uint16 i = 0; i < _partyChampionCount; ++i) { diff --git a/engines/dm/champion.h b/engines/dm/champion.h index 536d3676b2..dc0e11c6ab 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -228,7 +228,7 @@ public: _attributes &= ~flag; } } - void clearAttributes(){ _attributes = kChampionAttributNone; } + void clearAttributes() { _attributes = kChampionAttributNone; } uint16 getWounds() { return _wounds; } void setWoundsFlag(ChampionWound flag, bool value) { @@ -238,19 +238,24 @@ public: _wounds &= ~flag; } } - void clearWounds(){ _wounds = kChampionWoundNone; } + void clearWounds() { _wounds = kChampionWoundNone; } }; // @ CHAMPION_INCLUDING_PORTRAIT class ChampionMan { DMEngine *_vm; Champion _champions[4]; + + uint16 getChampionPortraitX(uint16 index); // @ M27_PORTRAIT_X + uint16 getChampionPortraitY(uint16 index); // @ M28_PORTRAIT_Y + + ChampionIndex getIndexInCell(ViewCell cell); // @ F0285_CHAMPION_GetIndexInCell + int16 getDecodedValue(char *string, uint16 characterCount); // @ F0279_CHAMPION_GetDecodedValue public: uint16 _partyChampionCount; bool _partyDead; // @ G0303_B_PartyDead Thing _leaderHand; ChampionMan(DMEngine *vm); - ChampionIndex getIndexInCell(ViewCell cell); // @ F0285_CHAMPION_GetIndexInCell }; } |