XEEN: Fixes for display of party dialog

This commit is contained in:
Paul Gilbert 2015-02-11 20:04:38 -05:00
parent 50ae4f9522
commit 2f39bd5cd2
5 changed files with 22 additions and 11 deletions

View File

@ -32,6 +32,7 @@ namespace Xeen {
PartyDialog::PartyDialog(XeenEngine *vm) : ButtonContainer(),
PartyDrawer(vm), _vm(vm) {
initDrawStructs();
}
void PartyDialog::show(XeenEngine *vm) {
@ -68,7 +69,7 @@ void PartyDialog::execute() {
Window &w = screen._windows[11];
w.open();
setupFaces(startingChar, false);
w.writeString(_displayText);
w.writeString(Common::String::format(PARTY_DIALOG_TEXT, _partyDetails.c_str()));
w.drawList(&_faceDrawStructs[0], 4);
_uiSprites.draw(w, 0, Common::Point(16, 100));
@ -99,8 +100,10 @@ void PartyDialog::execute() {
bool breakFlag = false;
while (!_vm->shouldQuit() && !breakFlag) {
events.pollEventsAndWait();
checkEvents(_vm);
do {
events.pollEventsAndWait();
checkEvents(_vm);
} while (!_vm->shouldQuit() && !_buttonValue);
switch (_buttonValue) {
case Common::KEYCODE_ESCAPE:
@ -226,7 +229,7 @@ void PartyDialog::loadButtons() {
addButton(Common::Rect(87, 100, 111, 120), Common::KEYCODE_d, &_uiSprites);
addButton(Common::Rect(122, 100, 146, 120), Common::KEYCODE_r, &_uiSprites);
addButton(Common::Rect(157, 100, 181, 120), Common::KEYCODE_c, &_uiSprites);
addButton(Common::Rect(192, 100, 116, 120), Common::KEYCODE_x, &_uiSprites);
addButton(Common::Rect(192, 100, 216, 120), Common::KEYCODE_x, &_uiSprites);
addButton(Common::Rect(0, 0, 0, 0), Common::KEYCODE_ESCAPE, &_uiSprites, false);
addButton(Common::Rect(16, 16, 48, 48), Common::KEYCODE_1, &_uiSprites, false);
addButton(Common::Rect(117, 16, 149, 48), Common::KEYCODE_2, &_uiSprites, false);
@ -247,7 +250,7 @@ void PartyDialog::setupBackground() {
}
/**
* Sets up the faces for display in the party dialog
* Sets up the faces from the avaialble roster for display in the party dialog
*/
void PartyDialog::setupFaces(int firstDisplayChar, bool updateFlag) {
Party &party = *_vm->_party;
@ -285,10 +288,11 @@ void PartyDialog::setupFaces(int firstDisplayChar, bool updateFlag) {
if ((firstDisplayChar + posIndex) >= (int)_charList.size())
_faceDrawStructs[posIndex]._sprites = nullptr;
else
_faceDrawStructs[posIndex]._sprites = party._roster[posIndex]._faceSprites;
_faceDrawStructs[posIndex]._sprites = party._roster[
_charList[firstDisplayChar + posIndex]]._faceSprites;
}
_displayText = Common::String::format(PARTY_DETAILS,
_partyDetails = Common::String::format(PARTY_DETAILS,
charNames[0].c_str(), charRaces[0].c_str(), charSex[0].c_str(), charClasses[0].c_str(),
charNames[1].c_str(), charRaces[1].c_str(), charSex[1].c_str(), charClasses[1].c_str(),
charNames[2].c_str(), charRaces[2].c_str(), charSex[2].c_str(), charClasses[2].c_str(),
@ -300,7 +304,7 @@ void PartyDialog::startingCharChanged(int firstDisplayChar) {
Window &w = _vm->_screen->_windows[11];
setupFaces(firstDisplayChar, true);
w.writeString(_displayText);
w.writeString(_partyDetails);
w.drawList(_faceDrawStructs, 4);
_uiSprites.draw(w, 0, Common::Point(16, 100));

View File

@ -36,7 +36,7 @@ private:
XeenEngine *_vm;
SpriteResource _uiSprites;
DrawStruct _faceDrawStructs[4];
Common::String _displayText;
Common::String _partyDetails;
Common::Array<int> _charList;
PartyDialog(XeenEngine *vm);
@ -49,8 +49,6 @@ private:
void setupBackground();
void drawParty(bool updateFlag);
void setupFaces(int firstDisplayChar, bool updateFlag);
void startingCharChanged(int firstDisplayChar);

View File

@ -31,6 +31,8 @@
#include "xeen/resources.h"
#include "xeen/xeen.h"
#include "xeen/dialogs_party.h"
namespace Xeen {
PartyDrawer::PartyDrawer(XeenEngine *vm): _vm(vm) {
@ -501,6 +503,9 @@ void Interface::perform() {
Quests::show(_vm);
break;
case Common::KEYCODE_x:
// ****DEBUG***
PartyDialog::show(_vm); //***DEBUG****
default:
break;
}

View File

@ -354,6 +354,9 @@ const char *const PARTY_DETAILS = "\015\003l\002\014""00"
"\013""052""\011""136%s"
"\013""060""\011""136%s"
"\013""068""\011""136%s";
const char *const PARTY_DIALOG_TEXT =
"%s\x2\x3""c\v106\t013Up\t048Down\t083\f37D\fdel\t118\f37R\fdem"
"\t153\f37C\fdreate\t188E\f37x\fdit\x1";
const int FACE_CONDITION_FRAMES[17] = {
2, 2, 2, 1, 1, 4, 4, 4, 3, 2, 4, 3, 3, 5, 6, 7, 0

View File

@ -105,6 +105,7 @@ extern const char *const HEROISM;
extern const char *const IN_PARTY;
extern const char *const PARTY_DETAILS;
extern const char *const PARTY_DIALOG_TEXT;
extern const int FACE_CONDITION_FRAMES[17];