diff options
author | Bendegúz Nagy | 2016-08-26 22:38:51 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | c392f7e9772ad2d5a23b6c8407afa0f32ce4ebbc (patch) | |
tree | abe345704697afa3654496bc844fa3f37be37671 | |
parent | b820a36d3a94e9510e313144378b789efe954fe4 (diff) | |
download | scummvm-rg350-c392f7e9772ad2d5a23b6c8407afa0f32ce4ebbc.tar.gz scummvm-rg350-c392f7e9772ad2d5a23b6c8407afa0f32ce4ebbc.tar.bz2 scummvm-rg350-c392f7e9772ad2d5a23b6c8407afa0f32ce4ebbc.zip |
DM: Add F0390_MENUS_RefreshActionAreaAndSetChampionDirectionMaximumDamageReceived
-rw-r--r-- | engines/dm/champion.cpp | 2 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 8 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 56 | ||||
-rw-r--r-- | engines/dm/menus.h | 4 |
4 files changed, 64 insertions, 6 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 03515a0a2a..f1c3c5ee77 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -255,7 +255,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { _candidateChampionOrdinal = prevChampCount + 1;
if (++_partyChampionCount == 1) {
_vm->_eventMan->commandSetLeader(kChampionFirst);
- _vm->_menuMan->_shouldRefreshActionArea = true;
+ _vm->_menuMan->_refreshActionArea = true;
} else {
_vm->_menuMan->clearActingChampion();
_vm->_menuMan->drawActionIcon((ChampionIndex)(_partyChampionCount - 1));
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index a28c14c000..eab2d1474c 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -213,16 +213,20 @@ void DMEngine::gameloop() { warning("DUMMY CODE: setting InventoryMan::_inventoryChampionOrdinal to zero"); _inventoryMan->_inventoryChampionOrdinal = 0; - warning("DUMMY CODE: clearing screen to black"); + warning("DUMMY CODE: clearing screen to black"); // in loop below while (true) { _stopWaitingForPlayerInput = false; + + _menuMan->refreshActionAreaAndSetChampDirMaxDamageReceived(); + //do { _eventMan->processInput(); _eventMan->processCommandQueue(); //} while (!_stopWaitingForPlayerInput || !_gameTimeTicking); if (!_inventoryMan->_inventoryChampionOrdinal && !_championMan->_partyIsSleeping) { - _displayMan->clearScreen(kColorBlack); // dummy code + Box box(0, 0 + 224 + 1, 33, 33 + 126 + 1); + _displayMan->clearScreenBox(kColorBlack, box); // dummy code _displayMan->drawDungeon(_dungeonMan->_currMap._partyDir, _dungeonMan->_currMap._partyPosX, _dungeonMan->_currMap._partyPosY); } // DUMMY CODE: next line diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index f83fa6ecab..25ed432621 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -38,8 +38,9 @@ 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) {
- _shouldRefreshActionArea = false;
+ _refreshActionArea = false;
_actionAreaContainsIcons = false;
+ _actionDamage = 0;
}
void MenuMan::drawMovementArrows() {
@@ -57,7 +58,7 @@ void MenuMan::clearActingChampion() { cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kChampionAttributeActionHand, true);
cm.drawChampionState((ChampionIndex)cm._actingChampionOrdinal);
cm._actingChampionOrdinal = _vm->indexToOrdinal(kChampionNone);
- _shouldRefreshActionArea = true;
+ _refreshActionArea = true;
}
}
@@ -118,4 +119,55 @@ void MenuMan::drawDisabledMenu() { }
}
+void MenuMan::refreshActionAreaAndSetChampDirMaxDamageReceived() {
+ ChampionMan &champMan = *_vm->_championMan;
+
+ if (!champMan._partyChampionCount)
+ return;
+
+ Champion *champ = nullptr;
+ if (champMan._partyIsSleeping || champMan._candidateChampionOrdinal) {
+ if (champMan._actingChampionOrdinal) {
+ clearActingChampion();
+ return;
+ }
+ if (!champMan._candidateChampionOrdinal)
+ return;
+ } else {
+ champ = champMan._champions;
+ int16 champIndex = kChampionFirst;
+
+ do {
+ if ((champIndex != champMan._leaderIndex)
+ && (_vm->indexToOrdinal(champIndex) != champMan._actingChampionOrdinal)
+ && (champ->_maximumDamageReceived)
+ && (champ->_dir != champ->_directionMaximumDamageReceived)) {
+
+ champ->_dir = (direction)champ->_directionMaximumDamageReceived;
+ champ->setAttributeFlag(kChampionAttributeIcon, true);
+ champMan.drawChampionState((ChampionIndex)champIndex);
+ }
+ champ->_maximumDamageReceived = 0;
+ champ++;
+ champIndex++;
+ } while (champIndex < champMan._partyChampionCount);
+ }
+
+ if (_refreshActionArea) {
+ if (!champMan._actingChampionOrdinal) {
+ if (_actionDamage) {
+ warning("MISSING CODE: F0385_MENUS_DrawActionDamage");
+ _actionDamage = 0;
+ } else {
+ _actionAreaContainsIcons = true;
+ warning("MISSING CODE: F0387_MENUS_DrawActionArea");
+ }
+ } else {
+ _actionAreaContainsIcons = false;
+ champ->setAttributeFlag(kChampionAttributeActionHand, true);
+ champMan.drawChampionState((ChampionIndex)_vm->ordinalToIndex(champMan._actingChampionOrdinal));
+ warning("MISSING CODE: F0387_MENUS_DrawActionArea");
+ }
+ }
+}
}
diff --git a/engines/dm/menus.h b/engines/dm/menus.h index 91f89cd7d5..3562ced34a 100644 --- a/engines/dm/menus.h +++ b/engines/dm/menus.h @@ -38,14 +38,16 @@ class MenuMan { public: explicit MenuMan(DMEngine *vm); - bool _shouldRefreshActionArea; // @ G0508_B_RefreshActionArea + bool _refreshActionArea; // @ G0508_B_RefreshActionArea bool _actionAreaContainsIcons; // @ G0509_B_ActionAreaContainsIcons + int16 _actionDamage; void clearActingChampion(); // @ F0388_MENUS_ClearActingChampion void drawActionIcon(ChampionIndex championIndex); // @ F0386_MENUS_DrawActionIcon void drawMovementArrows(); // @ F0395_MENUS_DrawMovementArrows void drawDisabledMenu(); // @ F0456_START_DrawDisabledMenus + void refreshActionAreaAndSetChampDirMaxDamageReceived(); // @ F0390_MENUS_RefreshActionAreaAndSetChampionDirectionMaximumDamageReceived }; } |