aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBendegúz Nagy2016-06-19 15:23:37 +0200
committerBendegúz Nagy2016-08-26 23:02:22 +0200
commit7782754d68e87d5bfd9980aa1c78a01c29a87574 (patch)
treefbfe9d0a8861eb62f1098ecd736d03a2f03517cf /engines
parentd9ed599de6a4c362f9d3eaf6e37b9fb1f86edfb3 (diff)
downloadscummvm-rg350-7782754d68e87d5bfd9980aa1c78a01c29a87574.tar.gz
scummvm-rg350-7782754d68e87d5bfd9980aa1c78a01c29a87574.tar.bz2
scummvm-rg350-7782754d68e87d5bfd9980aa1c78a01c29a87574.zip
DM: Add F0386_MENUS_DrawActionIcon
Diffstat (limited to 'engines')
-rw-r--r--engines/dm/champion.h1
-rw-r--r--engines/dm/gfx.h4
-rw-r--r--engines/dm/menus.cpp102
-rw-r--r--engines/dm/menus.h2
-rw-r--r--engines/dm/objectman.cpp2
-rw-r--r--engines/dm/objectman.h2
6 files changed, 78 insertions, 35 deletions
diff --git a/engines/dm/champion.h b/engines/dm/champion.h
index 89a1d059b9..0c8a46fae0 100644
--- a/engines/dm/champion.h
+++ b/engines/dm/champion.h
@@ -297,6 +297,7 @@ public:
void setStatistic(ChampionStatisticType type, ChampionStatisticValue valType, byte newVal) { _statistics[type][valType] = newVal; }
uint16 getAttributes() { return _attributes; }
+ uint16 getAttributes(ChampionAttribute flag) { return _attributes & flag; }
void setAttributeFlag(ChampionAttribute flag, bool value) {
if (value) {
_attributes |= flag;
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 46ce6e3d93..99d3f8f417 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -44,6 +44,7 @@ public:
uint16 _y2;
Box(uint16 x1, uint16 x2, uint16 y1, uint16 y2): _x1(x1), _x2(x2 + 1), _y1(y1), _y2(y2 + 1) {}
+ Box() {}
bool isPointInside(Common::Point point) {
return (_x1 <= point.x) && (point.x < _x2) && (_y1 <= point.y) && (point.y < _y2);
}
@@ -257,9 +258,10 @@ class DisplayMan {
bool isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex); // @ F0107_DUNGEONVIEW_IsDrawnWallOrnamentAnAlcove_CPSF
+public:
// some methods use this for a stratchpad, don't make assumptions about content between function calls
byte *_tmpBitmap;
-public:
+
DisplayMan(DMEngine *dmEngine);
~DisplayMan();
diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp
index 075543bffb..530ac24e4a 100644
--- a/engines/dm/menus.cpp
+++ b/engines/dm/menus.cpp
@@ -1,32 +1,70 @@
-#include "menus.h"
-#include "gfx.h"
-#include "champion.h"
-#include "dungeonman.h"
-
-
-namespace DM {
-
-byte gPalChangesActionAreaObjectIcon[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0}; // @ G0498_auc_Graphic560_PaletteChanges_ActionAreaObjectIcon
-
-MenuMan::MenuMan(DMEngine *vm): _vm(vm) {}
-
-void MenuMan::drawMovementArrows() {
- DisplayMan &disp = *_vm->_displayMan;
- byte *arrowsBitmap = disp.getBitmap(kMovementArrowsIndice);
- Box &dest = gBoxMovementArrows;
- uint16 w = disp.getWidth(kMovementArrowsIndice);
-
- disp.blitToScreen(arrowsBitmap, w, 0, 0, dest._x1, dest._x2, dest._y1, dest._y2, kColorNoTransparency);
-}
-void MenuMan::clearActingChampion() {
- ChampionMan &cm = *_vm->_championMan;
- if (cm._actingChampionOrdinal) {
- cm._actingChampionOrdinal--;
- cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kChampionAttributeActionHand, true);
- warning("MISSING CODE: F0292_CHAMPION_DrawState");
- cm._actingChampionOrdinal = indexToOrdinal(kChampionNone);
- _shouldRefreshActionArea = true;
- }
-}
-
-} \ No newline at end of file
+#include "menus.h"
+#include "gfx.h"
+#include "champion.h"
+#include "dungeonman.h"
+#include "objectman.h"
+
+
+namespace DM {
+
+byte gPalChangesActionAreaObjectIcon[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0}; // @ G0498_auc_Graphic560_PaletteChanges_ActionAreaObjectIcon
+
+MenuMan::MenuMan(DMEngine *vm): _vm(vm) {}
+
+void MenuMan::drawMovementArrows() {
+ DisplayMan &disp = *_vm->_displayMan;
+ byte *arrowsBitmap = disp.getBitmap(kMovementArrowsIndice);
+ Box &dest = gBoxMovementArrows;
+ uint16 w = disp.getWidth(kMovementArrowsIndice);
+
+ disp.blitToScreen(arrowsBitmap, w, 0, 0, dest._x1, dest._x2, dest._y1, dest._y2, kColorNoTransparency);
+}
+void MenuMan::clearActingChampion() {
+ ChampionMan &cm = *_vm->_championMan;
+ if (cm._actingChampionOrdinal) {
+ cm._actingChampionOrdinal--;
+ cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kChampionAttributeActionHand, true);
+ warning("MISSING CODE: F0292_CHAMPION_DrawState");
+ cm._actingChampionOrdinal = indexToOrdinal(kChampionNone);
+ _shouldRefreshActionArea = true;
+ }
+}
+
+void MenuMan::drawActionIcon(ChampionIndex championIndex) {
+ if (!_actionAreaContainsIcons)
+ return;
+ DisplayMan &dm = *_vm->_displayMan;
+ Champion &champion = _vm->_championMan->_champions[championIndex];
+
+ Box box;
+ box._x1 = championIndex * 22 + 233;
+ box._x2 = box._x1 + 19 + 1;
+ box._y1 = 86;
+ box._y2 = 120 + 1;
+ dm._useByteBoxCoordinates = false;
+ if (!champion._currHealth) {
+ dm.clearScreenBox(kColorBlack, box);
+ return;
+ }
+ byte *bitmapIcon = dm._tmpBitmap;
+ Thing thing = champion.getSlot(kChampionSlotActionHand);
+ IconIndice iconIndex;
+ if (thing == Thing::_thingNone) {
+ iconIndex = kIconIndiceActionEmptyHand;
+ } else if (gObjectInfo[_vm->_dungeonMan->getObjectInfoIndex(thing)]._actionSetIndex) {
+ iconIndex = _vm->_objectMan->getIconIndex(thing);
+ } else {
+ dm.clearBitmap(bitmapIcon, 16, 16, kColorCyan);
+ goto T0386006;
+ }
+ _vm->_objectMan->extractIconFromBitmap(iconIndex, bitmapIcon);
+ dm.blitToBitmapShrinkWithPalChange(bitmapIcon, 16, 16, bitmapIcon, 16, 16, gPalChangesActionAreaObjectIcon);
+T0386006:
+ dm.clearScreenBox(kColorCyan, box);
+ Box box2;
+ box2._x1 = box._x1 + 2;
+ box2._x2 = box._x2 - 2; // no need to add +1 for exclusive boundaries, box already has that
+ box2._y1 = 95;
+ box2._y2 = 110 + 1;
+ dm.blitToScreen(bitmapIcon, 16, 0, 0, box2._x1, box2._x2, box2._y1, box2._y2);
+ if (champion.getAttributes(kChampionAttributeDisableAction) || _vm->_championMan->_candidateChampionOrdinal || _vm->_championMan->_partyIsSleeping) { warning("MISSING CODE: F0136_VIDEO_ShadeScreenBox"); } } } \ No newline at end of file
diff --git a/engines/dm/menus.h b/engines/dm/menus.h
index ce6c1667fe..a35659da23 100644
--- a/engines/dm/menus.h
+++ b/engines/dm/menus.h
@@ -2,6 +2,7 @@
#define DM_MENUS_H
#include "dm.h"
+#include "champion.h"
namespace DM {
@@ -12,6 +13,7 @@ public:
bool _actionAreaContainsIcons; // @ G0509_B_ActionAreaContainsIcons
MenuMan(DMEngine *vm);
void clearActingChampion(); // @ F0388_MENUS_ClearActingChampion
+ void drawActionIcon(ChampionIndex championIndex); // @ F0386_MENUS_DrawActionIcon
void drawMovementArrows();
};
diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp
index bc0b923422..c237b914a2 100644
--- a/engines/dm/objectman.cpp
+++ b/engines/dm/objectman.cpp
@@ -30,7 +30,7 @@ IconIndice ObjectMan::getObjectType(Thing thing) {
byte gChargeCountToTorchType[16] = {0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3}; // @ G0029_auc_Graphic562_ChargeCountToTorchType
-int16 ObjectMan::getIconIndex(Thing thing) {
+IconIndice ObjectMan::getIconIndex(Thing thing) {
IconIndice iconIndex = getObjectType(thing);
if ((iconIndex != kIconIndiceNone) &&
diff --git a/engines/dm/objectman.h b/engines/dm/objectman.h
index 177d3bb0e3..908520c5f0 100644
--- a/engines/dm/objectman.h
+++ b/engines/dm/objectman.h
@@ -9,7 +9,7 @@ class ObjectMan {
public:
ObjectMan(DMEngine *vm);
IconIndice getObjectType(Thing thing); // @ F0032_OBJECT_GetType
- int16 getIconIndex(Thing thing); // @ F0033_OBJECT_GetIconIndex
+ IconIndice getIconIndex(Thing thing); // @ F0033_OBJECT_GetIconIndex
void extractIconFromBitmap(uint16 iconIndex, byte *srcBitmap); // F0036_OBJECT_ExtractIconFromBitmap
};