aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBendegúz Nagy2016-06-20 19:39:36 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commitef2411f7afe060ce60b6b2d6d607dc3d8d339021 (patch)
tree8358b8894b704b1ac76ad5005b31ad420164ef6d /engines
parentd5e4448ec619dd724fbdcbda38a5d3db8f74122a (diff)
downloadscummvm-rg350-ef2411f7afe060ce60b6b2d6d607dc3d8d339021.tar.gz
scummvm-rg350-ef2411f7afe060ce60b6b2d6d607dc3d8d339021.tar.bz2
scummvm-rg350-ef2411f7afe060ce60b6b2d6d607dc3d8d339021.zip
DM: Add F0287_CHAMPION_DrawBarGraph
Diffstat (limited to 'engines')
-rw-r--r--engines/dm/champion.cpp68
-rw-r--r--engines/dm/champion.h1
-rw-r--r--engines/dm/inventory.cpp1
-rw-r--r--engines/dm/inventory.h2
4 files changed, 69 insertions, 3 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 052c7e89e0..b30d3390c5 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -13,8 +13,8 @@ Box gBoxChampionIcons[4] = { // @ G0054_ai_Graphic562_Box_ChampionIcons
Box(281, 299, 0, 13),
Box(301, 319, 0, 13),
Box(301, 319, 15, 28),
- Box(281, 299, 15, 28) };
-byte gChampionColor[4] = {7, 11, 8, 14}; // @ G0046_auc_Graphic562_ChampionColor
+ Box(281, 299, 15, 28)};
+Color gChampionColor[4] = {(Color)7, (Color)11, (Color)8, (Color)14}; // @ G0046_auc_Graphic562_ChampionColor
uint16 gSlotMasks[38] = { // @ G0038_ai_Graphic562_SlotMasks
/* 30 for champion inventory, 8 for chest */
@@ -272,4 +272,68 @@ T0280048:
_vm->_menuMan->drawDisabledMenu();
}
+void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) {
+
+ Champion *AL_6_champion = &_champions[champIndex];
+ int16 AL_2_barGraphIndex = 0;
+ int16 barGraphHeightArray[3];
+
+ if (AL_6_champion->_currHealth > 0) {
+ uint32 AL_4_barGraphHeight = (((uint32)(AL_6_champion->_currHealth) << 10) * 25) / AL_6_champion->_maxHealth;
+ if (AL_4_barGraphHeight & 0x3FF) {
+ barGraphHeightArray[AL_2_barGraphIndex++] = (AL_4_barGraphHeight >> 10) + 1;
+ } else {
+ barGraphHeightArray[AL_2_barGraphIndex++] = (AL_4_barGraphHeight >> 10);
+ }
+ } else {
+ barGraphHeightArray[AL_2_barGraphIndex++] = 0;
+ }
+
+ if (AL_6_champion->_currStamina > 0) {
+ uint32 AL_4_barGraphHeight = (((uint32)(AL_6_champion->_currStamina) << 10) * 25) / AL_6_champion->_maxStamina;
+ if (AL_4_barGraphHeight & 0x3FF) {
+ barGraphHeightArray[AL_2_barGraphIndex++] = (AL_4_barGraphHeight >> 10) + 1;
+ } else {
+ barGraphHeightArray[AL_2_barGraphIndex++] = (AL_4_barGraphHeight >> 10);
+ }
+ } else {
+ barGraphHeightArray[AL_2_barGraphIndex++] = 0;
+ }
+
+ if (AL_6_champion->_currMana > 0) {
+ uint32 AL_4_barGraphHeight = (((uint32)(AL_6_champion->_currMana) << 10) * 25) / AL_6_champion->_maxMana;
+ if (AL_4_barGraphHeight & 0x3FF) {
+ barGraphHeightArray[AL_2_barGraphIndex++] = (AL_4_barGraphHeight >> 10) + 1;
+ } else {
+ barGraphHeightArray[AL_2_barGraphIndex++] = (AL_4_barGraphHeight >> 10);
+ }
+ } else {
+ barGraphHeightArray[AL_2_barGraphIndex++] = 0;
+ }
+ warning("MISSING CODE: F0077_MOUSE_HidePointer_CPSE");
+
+ Box box;
+ box._x1 = champIndex * kChampionStatusBoxSpacing + 46;
+ box._x2 = box._x1 + 3;
+ box._y1 = 2;
+ box._y2 = 26;
+
+ for (int16 AL_0_barGraphIndex = 0; AL_0_barGraphIndex < 3; AL_0_barGraphIndex++) {
+ int16 AL_2_barGraphHeight = barGraphHeightArray[AL_0_barGraphIndex];
+ if (AL_2_barGraphHeight < 25) {
+ box._y1 = 2;
+ box._y1 = 27 - AL_2_barGraphHeight;
+ _vm->_displayMan->clearScreenBox(gChampionColor[champIndex], box);
+ }
+ if (AL_2_barGraphHeight) {
+ box._y1 = 27 - AL_2_barGraphHeight;
+ box._y2 = 26;
+ _vm->_displayMan->clearScreenBox(gChampionColor[champIndex], box);
+ }
+ box._x1 += 7;
+ box._x2 += 7;
+ }
+ warning("MISSING CODE: F0078_MOUSE_ShowPointer");
+}
+
} \ No newline at end of file
diff --git a/engines/dm/champion.h b/engines/dm/champion.h
index 8f202612d3..b92462d61c 100644
--- a/engines/dm/champion.h
+++ b/engines/dm/champion.h
@@ -404,6 +404,7 @@ public:
ChampionMan(DMEngine *vm);
void resetDataToStartGame(); // @ F0278_CHAMPION_ResetDataToStartGame
void addCandidateChampionToParty(uint16 championPortraitIndex); // @ F0280_CHAMPION_AddCandidateChampionToParty
+ void drawChampionBarGraphs(ChampionIndex champIndex); // @ F0287_CHAMPION_DrawBarGraphs
};
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index c62bf15905..15dbd7e82f 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -82,7 +82,6 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
warning("MISSING CODE: F0357_COMMAND_DiscardAllInput");
}
-#define kChampionStatusBoxSpacing 69 // @ C69_CHAMPION_STATUS_BOX_SPACING
void InventoryMan::drawStatusBoxPortrait(ChampionIndex championIndex) {
DisplayMan &dispMan = *_vm->_displayMan;
dispMan._useByteBoxCoordinates = false;
diff --git a/engines/dm/inventory.h b/engines/dm/inventory.h
index 90565f57ce..eb4b458b82 100644
--- a/engines/dm/inventory.h
+++ b/engines/dm/inventory.h
@@ -6,6 +6,8 @@
namespace DM {
+#define kChampionStatusBoxSpacing 69 // @ C69_CHAMPION_STATUS_BOX_SPACING
+
class InventoryMan {
DMEngine *_vm;
public: