aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBendegúz Nagy2016-06-18 12:08:05 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commite744d8a42710ae9219e0b48ffb7094b08c0f5f5f (patch)
tree1a4c543f8679c887e45c407726ace8956e2d4f30
parent332a515d2cb718fdaa46f8c01875f430dbd03036 (diff)
downloadscummvm-rg350-e744d8a42710ae9219e0b48ffb7094b08c0f5f5f.tar.gz
scummvm-rg350-e744d8a42710ae9219e0b48ffb7094b08c0f5f5f.tar.bz2
scummvm-rg350-e744d8a42710ae9219e0b48ffb7094b08c0f5f5f.zip
DM: Add F0279_CHAMPION_GetDecodedValue, M27_PORTRAIT_X, M28_PORTRAIT_Y
-rw-r--r--engines/dm/champion.cpp18
-rw-r--r--engines/dm/champion.h11
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
};
}