XEEN: Further refactoring for party dialog setup

This commit is contained in:
Paul Gilbert 2015-02-09 22:01:01 -05:00
parent c798a55510
commit a612dd686c
7 changed files with 34 additions and 52 deletions

@ -40,6 +40,7 @@ void PartyDialog::execute() {
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
bool modeFlag = false;
loadButtons();
setupBackground();
@ -73,10 +74,7 @@ void PartyDialog::execute() {
_iconSprites.draw(w, 10, Common::Point(192, 100));
screen.loadPalette("mm4.pal");
/*
if (flag) {
if (modeFlag) {
screen._windows[0].update();
events.setCursor(0);
screen.fadeIn(4);
@ -94,7 +92,6 @@ void PartyDialog::execute() {
}
}
// TODO
bool breakFlag = false;
while (!_vm->shouldQuit() && !breakFlag) {
events.pollEventsAndWait();
@ -105,13 +102,13 @@ void PartyDialog::execute() {
case Common::KEYCODE_SPACE:
case Common::KEYCODE_e:
case Common::KEYCODE_x:
if (_vm->_party->_partyCount == 0) {
if (party._partyCount == 0) {
ErrorScroll::show(_vm, NO_ONE_TO_ADVENTURE_WITH);
} else {
if (_vm->_mode != MODE_0) {
for (_intrIndex1 = 4; _intrIndex1 >= 0; --_intrIndex1) {
for (int idx = 4; idx >= 0; --idx) {
events.updateGameCounter();
drawViewBackground(_intrIndex1);
screen.frameWindow(idx);
w.update();
while (events.timeElapsed() < 1)
@ -120,10 +117,10 @@ void PartyDialog::execute() {
}
w.close();
_vm->_party->_realPartyCount = _vm->_party->_partyCount;
_vm->_party->_mazeId = _vm->_party->_priorMazeId;
party._realPartyCount = party._partyCount;
party._mazeId = party._priorMazeId;
_vm->_party->copyPartyToRoster(_vm->_roster);
party.copyPartyToRoster();
_vm->_saves->writeCharFile();
breakFlag = true;
break;
@ -143,18 +140,17 @@ void PartyDialog::execute() {
} else {
screen.fadeOut(4);
w.close();
moveCharacterToRoster();
party.copyPartyToRoster();
_vm->_saves->writeCharFile();
screen.fadeOut(4);
flag = true;
_buttonsLoaded = true;
goto start;
modeFlag = true;
breakFlag = true;
}
break;
case Common::KEYCODE_d:
break;
case Common::KEYCODE_r:
if (_vm->_party->_partyCount > 0) {
if (party._partyCount > 0) {
// TODO
}
break;
@ -187,12 +183,6 @@ void PartyDialog::execute() {
}
}
}
for (int i = 0; i < TOTAL_CHARACTERS; ++i)
_charFaces[i].clear();
*/
// TODO
}
}
void PartyDialog::loadButtons() {
@ -237,7 +227,7 @@ void PartyDialog::setupFaces(int charIndex, Common::Array<int> xeenSideChars, bo
for (posIndex = 0; posIndex < 4; ++posIndex) {
charId = xeenSideChars[charIndex];
bool isInParty = _vm->_party->isInParty(charId);
bool isInParty = party.isInParty(charId);
if (charId == 0xff) {
while ((int)_buttons.size() >(7 + posIndex))

@ -85,7 +85,6 @@ void Interface::loadPartyIcons() {
}
void Interface::charIconsPrint(bool updateFlag) {
Resources &res = *_vm->_resources;
Screen &screen = *_vm->_screen;
bool stateFlag = _vm->_mode == MODE_COMBAT;
_restoreSprites.draw(screen, 0, Common::Point(8, 149));
@ -153,27 +152,6 @@ void Interface::sortFaces() {
}
}
void Interface::drawViewBackground(int bgType) {
if (bgType >= 4)
return;
if (bgType == 0) {
// Totally black background
_vm->_screen->fillRect(Common::Rect(8, 8, 224, 140), 0);
} else {
const byte *lookup = BACKGROUND_XLAT + bgType;
for (int yp = 8; yp < 140; ++yp) {
byte *destP = (byte *)_vm->_screen->getBasePtr(8, yp);
for (int xp = 8; xp < 224; ++xp, ++destP)
*destP = lookup[*destP];
}
}
}
void Interface::moveCharacterToRoster() {
error("TODO");
}
void Interface::startup() {
Screen &screen = *_vm->_screen;
_iconSprites.load("main.icn");

@ -57,10 +57,6 @@ private:
void setupBackground();
void drawViewBackground(int bgType);
void moveCharacterToRoster();
void setMainButtons();
void chargeStep();

@ -231,9 +231,9 @@ bool Party::isInParty(int charId) {
return false;
}
void Party::copyPartyToRoster(Roster &r) {
void Party::copyPartyToRoster() {
for (int i = 0; i < _partyCount; ++i) {
r[_partyMembers[i]] = _activeParty[i];
_roster[_partyMembers[i]] = _activeParty[i];
}
}

@ -138,7 +138,7 @@ public:
bool isInParty(int charId);
void copyPartyToRoster(Roster &r);
void copyPartyToRoster();
void changeTime(int numMinutes);

@ -481,5 +481,21 @@ void Screen::restoreBackground(int slot) {
_savedScreens[slot - 1].blitTo(*this);
}
void Screen::frameWindow(uint bgType) {
if (bgType >= 4)
return;
if (bgType == 0) {
// Totally black background
_vm->_screen->fillRect(Common::Rect(8, 8, 224, 140), 0);
} else {
const byte *lookup = BACKGROUND_XLAT + bgType;
for (int yp = 8; yp < 140; ++yp) {
byte *destP = (byte *)_vm->_screen->getBasePtr(8, yp);
for (int xp = 8; xp < 224; ++xp, ++destP)
*destP = lookup[*destP];
}
}
}
} // End of namespace Xeen

@ -156,6 +156,8 @@ public:
void saveBackground(int slot = 1);
void restoreBackground(int slot = 1);
void frameWindow(uint bgType);
};
} // End of namespace Xeen