DM: Add F0390_MENUS_RefreshActionAreaAndSetChampionDirectionMaximumDamageReceived

This commit is contained in:
Bendegúz Nagy 2016-08-26 22:38:51 +02:00
parent b820a36d3a
commit c392f7e977
4 changed files with 64 additions and 6 deletions

View File

@ -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));

View File

@ -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

View File

@ -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");
}
}
}
}

View File

@ -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
};
}