diff options
author | Bendegúz Nagy | 2016-06-25 16:27:31 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 12d359166ca87d74cfe6598162d78da97939c0d3 (patch) | |
tree | 5f5768cc86a92aa1a93ce346b1463d4519b9f655 /engines | |
parent | d893075343c8b27a6f20eab436fea6aa6b02d800 (diff) | |
download | scummvm-rg350-12d359166ca87d74cfe6598162d78da97939c0d3.tar.gz scummvm-rg350-12d359166ca87d74cfe6598162d78da97939c0d3.tar.bz2 scummvm-rg350-12d359166ca87d74cfe6598162d78da97939c0d3.zip |
DM: Add F0387_MENUS_DrawActionArea
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dm/gfx.h | 3 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 2 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 55 | ||||
-rw-r--r-- | engines/dm/menus.h | 19 | ||||
-rw-r--r-- | engines/dm/text.cpp | 15 | ||||
-rw-r--r-- | engines/dm/text.h | 4 |
6 files changed, 93 insertions, 5 deletions
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 5db354d458..d3e19479d8 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -71,7 +71,8 @@ enum GraphicIndice { kChampionIcons = 28, // @ C028_GRAPHIC_CHAMPION_ICONS kFontGraphicIndice = 557, // @ C557_GRAPHIC_FONT kSlotBoxActingHandIndice = 35, // @ C035_GRAPHIC_SLOT_BOX_ACTING_HAND - kPanelRenameChampionIndice = 27 // @ C027_GRAPHIC_PANEL_RENAME_CHAMPION + kPanelRenameChampionIndice = 27, // @ C027_GRAPHIC_PANEL_RENAME_CHAMPION + kMenuActionAreaIndice = 10 // @ C010_GRAPHIC_MENU_ACTION_AREA }; extern uint16 gPalSwoosh[16]; diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index f6fe61f78f..550c4c85c6 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -37,7 +37,7 @@ namespace DM { Box gBoxFloppyZzzCross = Box(174, 218, 2, 12); // @ G0041_s_Graphic562_Box_ViewportFloppyZzzCross -Box gBoxPanel = Box(80, 223, 52, 124); +Box gBoxPanel = Box(80, 223, 52, 124); // @ G0032_s_Graphic562_Box_Panel Box gBoxFood = Box(112, 159, 60, 68); // @ G0035_s_Graphic562_Box_Food Box gBoxWater = Box(112, 159, 83, 91); // @ G0036_s_Graphic562_Box_Water Box gBoxPoisoned = Box(112, 207, 105, 119); // @ G0037_s_Graphic562_Box_Poisoned diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 25ed432621..ec87a3b77c 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -31,10 +31,15 @@ #include "dungeonman.h"
#include "objectman.h"
#include "inventory.h"
+#include "text.h"
namespace DM {
+Box gBoxActionArea3ActionMenu = Box(224, 319, 77, 121); // @ G0499_s_Graphic560_Box_ActionArea3ActionsMenu
+Box gBoxActionArea2ActionMenu = Box(224, 319, 77, 109); // @ G0500_s_Graphic560_Box_ActionArea2ActionsMenu
+Box gBoxActionArea1ActionMenu = Box(224, 319, 77, 97); // @ G0501_s_Graphic560_Box_ActionArea1ActionMenu
+Box gBoxActionArea = Box(224, 319, 77, 121); // @ G0001_s_Graphic562_Box_ActionArea
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) {
@@ -160,7 +165,7 @@ void MenuMan::refreshActionAreaAndSetChampDirMaxDamageReceived() { _actionDamage = 0;
} else {
_actionAreaContainsIcons = true;
- warning("MISSING CODE: F0387_MENUS_DrawActionArea");
+ drawActionArea();
}
} else {
_actionAreaContainsIcons = false;
@@ -170,4 +175,52 @@ void MenuMan::refreshActionAreaAndSetChampDirMaxDamageReceived() { }
}
}
+
+#define kChampionNameMaximumLength 7 // @ C007_CHAMPION_NAME_MAXIMUM_LENGTH
+#define kActionNameMaximumLength 12 // @ C012_ACTION_NAME_MAXIMUM_LENGTH
+
+void MenuMan::drawActionArea() {
+ DisplayMan &dispMan = *_vm->_displayMan;
+ ChampionMan &champMan = *_vm->_championMan;
+ TextMan &textMan = *_vm->_textMan;
+
+ warning("MISSING CODE: F0077_MOUSE_HidePointer_CPSE");
+ dispMan._useByteBoxCoordinates = false;
+ dispMan.clearScreenBox(kColorBlack, gBoxActionArea);
+ if (_actionAreaContainsIcons) {
+ for (uint16 champIndex = kChampionFirst; champIndex < champMan._partyChampionCount; ++champIndex)
+ drawActionIcon((ChampionIndex)champIndex);
+ } else if (champMan._actingChampionOrdinal) {
+ Box box = gBoxActionArea3ActionMenu;
+ if (_actionList._actionIndices[2] == kChampionActionNone)
+ box = gBoxActionArea2ActionMenu;
+ if (_actionList._actionIndices[1] == kChampionActionNone)
+ box = gBoxActionArea1ActionMenu;
+ dispMan.blitToScreen(dispMan.getBitmap(kMenuActionAreaIndice), 96, 0, 0, box, kColorNoTransparency);
+ textMan.printWithTrailingSpacesToScreen(235, 83, kColorBlack, kColorCyan, champMan._champions[_vm->ordinalToIndex(champMan._actingChampionOrdinal)]._name,
+ kChampionNameMaximumLength);
+ for (uint16 actionListIndex = 0; actionListIndex < 3; actionListIndex++) {
+ textMan.printWithTrailingSpacesToScreen(241, 93 + actionListIndex * 12, kColorCyan, kColorBlack,
+ getActionName(_actionList._actionIndices[actionListIndex]),
+ kActionNameMaximumLength);
+ }
+ }
+ warning("MISSING CODE: F0078_MOUSE_ShowPointer");
+ _refreshActionArea = false;
+}
+
+const char *gChampionActionNames[44] = {
+ "N", "BLOCK", "CHOP", "X", "BLOW HORN", "FLIP", "PUNCH",
+ "KICK", "WAR CRY", "STAB", "CLIMB DOWN", "FREEZE LIFE",
+ "HIT", "SWING", "STAB", "THRUST", "JAB", "PARRY", "HACK",
+ "BERZERK", "FIREBALL", "DISPELL", "CONFUSE", "LIGHTNING",
+ "DISRUPT", "MELEE", "X", "INVOKE", "SLASH", "CLEAVE",
+ "BASH", "STUN", "SHOOT", "SPELLSHIELD", "FIRESHIELD",
+ "FLUXCAGE", "HEAL", "CALM", "LIGHT", "WINDOW", "SPIT",
+ "BRANDISH", "THROW", "FUSE"};
+
+const char* MenuMan::getActionName(ChampionAction actionIndex) {
+ return (actionIndex == kChampionActionNone) ? "" : gChampionActionNames[actionIndex];
+}
+
}
diff --git a/engines/dm/menus.h b/engines/dm/menus.h index 3562ced34a..4ae7784c4d 100644 --- a/engines/dm/menus.h +++ b/engines/dm/menus.h @@ -33,6 +33,20 @@ namespace DM { +extern Box gBoxActionArea; + +class ActionList { +public: + byte _minimumSkillLevel[3]; /* Bit 7: requires charge, Bit 6-0: minimum skill level. */ + ChampionAction _actionIndices[3]; + ActionList() { + for (uint16 i = 0; i < 3; ++i) { + _minimumSkillLevel[i] = 0; + _actionIndices[i] = kChampionActionNone; + } + } +}; // @ ACTION_LIST + class MenuMan { DMEngine *_vm; public: @@ -40,7 +54,8 @@ public: bool _refreshActionArea; // @ G0508_B_RefreshActionArea bool _actionAreaContainsIcons; // @ G0509_B_ActionAreaContainsIcons - int16 _actionDamage; + int16 _actionDamage; // @ G0513_i_ActionDamage + ActionList _actionList; // @ G0713_s_ActionList void clearActingChampion(); // @ F0388_MENUS_ClearActingChampion void drawActionIcon(ChampionIndex championIndex); // @ F0386_MENUS_DrawActionIcon @@ -48,6 +63,8 @@ public: void drawMovementArrows(); // @ F0395_MENUS_DrawMovementArrows void drawDisabledMenu(); // @ F0456_START_DrawDisabledMenus void refreshActionAreaAndSetChampDirMaxDamageReceived(); // @ F0390_MENUS_RefreshActionAreaAndSetChampionDirectionMaximumDamageReceived + void drawActionArea(); // @ F0387_MENUS_DrawActionArea + const char* getActionName(ChampionAction actionIndex); // @ F0384_MENUS_GetActionName }; } diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp index 3adc1a9ecb..ab22ac473e 100644 --- a/engines/dm/text.cpp +++ b/engines/dm/text.cpp @@ -60,7 +60,7 @@ void TextMan::printTextToBitmap(byte* destBitmap, uint16 destPixelWidth, uint16 break; uint16 srcX = (1 + 5) * toupper(*begin); // 1 + 5 is not the letter width, arbitrary choice of the unpacking code _vm->_displayMan->blitToBitmap(srcBitmap, 6 * 128, (nextX == destX) ? (srcX + 1) : srcX, 0, destBitmap, destPixelWidth, - (nextX == destX) ? (nextX + 1) : nextX, nextX + kLetterWidth + 1, nextY, nextY + kLetterHeight, kColorNoTransparency, viewport); + (nextX == destX) ? (nextX + 1) : nextX, nextX + kLetterWidth + 1, nextY, nextY + kLetterHeight, kColorNoTransparency, viewport); nextX += kLetterWidth + 1; } } @@ -73,4 +73,17 @@ void TextMan::printToViewport(int16 posX, int16 posY, Color textColor, const cha printTextToScreen(posX, posY, textColor, kColorDarkestGray, text, gDungeonViewport); } +void TextMan::printWithTrailingSpaces(byte* destBitmap, int16 destPixelWidth, int16 destX, int16 destY, Color textColor, + Color bgColor, const char* text, int16 requiredTextLength, int16 destHeight, Viewport& viewport) { + Common::String str = text; + for (int16 i = str.size(); i < requiredTextLength; ++i) + str += ' '; + printTextToBitmap(destBitmap, destPixelWidth, destX, destY, textColor, bgColor, str.c_str(), destHeight, viewport); +} + +void TextMan::printWithTrailingSpacesToScreen(int16 destX, int16 destY, Color textColor, Color bgColor, const char* text, int16 strLenght, Viewport& viewport) { + printWithTrailingSpaces(_vm->_displayMan->_vgaBuffer, _vm->_displayMan->_screenWidth, destX, destY, + textColor, bgColor, text, strLenght, _vm->_displayMan->_screenHeight, viewport); +} + } diff --git a/engines/dm/text.h b/engines/dm/text.h index 1a413ee87f..b03d00a00d 100644 --- a/engines/dm/text.h +++ b/engines/dm/text.h @@ -41,6 +41,10 @@ public: Color textColor, Color bgColor, const char *text, uint16 destHeight, Viewport &viewport = gDefultViewPort); // @ F0040_TEXT_Print void printTextToScreen(uint16 destX, uint16 destY, Color textColor, Color bgColor, const char *text, Viewport &viewport = gDefultViewPort); // @ F0053_TEXT_PrintToLogicalScreen void printToViewport(int16 posX, int16 posY, Color textColor, const char *text); // @ F0052_TEXT_PrintToViewport + void printWithTrailingSpaces(byte *destBitmap, int16 destPixelWidth, int16 destX, int16 destY, Color textColor, Color bgColor, + const char *text, int16 strLenght, int16 destHeight, Viewport &viewport = gDefultViewPort); // @ F0041_TEXT_PrintWithTrailingSpaces + void printWithTrailingSpacesToScreen(int16 destX, int16 destY, Color textColor, Color bgColor, + const char *text, int16 strLenght, Viewport &viewport = gDefultViewPort); // @ F0041_TEXT_PrintWithTrailingSpaces }; } |