XEEN: Selection and creation fixes for Create Character dialog

This commit is contained in:
Paul Gilbert 2018-02-18 20:53:24 -05:00
parent 0b36518839
commit 60e74af750
2 changed files with 18 additions and 12 deletions

View File

@ -58,7 +58,7 @@ void CreateCharacterDialog::execute() {
Windows &windows = *_vm->_windows;
Window &w = windows[0];
Common::Array<int> freeCharList;
int classId;
int classId = -1;
int selectedClass = 0;
bool hasFadedIn = false;
bool restartFlag = true;
@ -75,8 +75,6 @@ void CreateCharacterDialog::execute() {
events.setCursor(0);
while (!_vm->shouldExit()) {
classId = -1;
if (restartFlag) {
// Build up list of roster slot indexes that are free
freeCharList.clear();
@ -85,7 +83,6 @@ void CreateCharacterDialog::execute() {
freeCharList.push_back(idx);
}
charIndex = 0;
//bool flag9 = true;
if (freeCharList.size() == XEEN_TOTAL_CHARACTERS)
break;
@ -131,11 +128,15 @@ void CreateCharacterDialog::execute() {
drawDice();
// Handling for different actions
if (_buttonValue == Common::KEYCODE_ESCAPE)
break;
switch (_buttonValue) {
case Common::KEYCODE_UP:
if (charIndex == 0)
continue;
--charIndex;
race = (Race)((freeCharList[charIndex] / 4) % 5);
sex = (Sex)(freeCharList[charIndex] & 1);
break;
@ -402,6 +403,8 @@ int CreateCharacterDialog::newCharDetails(Race race, Sex sex, int classId,
classColors[classNum] = 4;
}
}
if (classId != -1)
classColors[selectedClass] = 12;
// Return stats details and character class
msg = Common::String::format(Res.NEW_CHAR_STATS, Res.RACE_NAMES[race], Res.SEX_NAMES[sex],
@ -578,13 +581,16 @@ bool CreateCharacterDialog::saveCharacter(Character &c, int classId, Race race,
int result;
bool isDarkCc = _vm->_files->_isDarkCc;
saveButtons();
// Prompt for a character name
w.open();
w.writeString(Res.NAME_FOR_NEW_CHARACTER);
saveButtons();
result = Input::show(_vm, &w, name, 10, 200);
w.close();
restoreButtons();
w.close();
if (!result)
// Name aborted, so exit
return false;
// Save new character details

View File

@ -1519,14 +1519,14 @@ const char *const Resources::NEW_CHAR_STATS =
"\t022Sex\t055: %s\n"
"\t022Class\t055:\n"
"\x3r\t215\v031%d\t215\v055%d\t215\v079%d\t215\v103%d\t215\v127%d"
"\t215\v151%d\t215\v175%d\x3l\t242\v020\f%2dKnight\t242\v031\f%2d"
"Paladin\t242\v042\f%2dArcher\t242\v053\f%2dCleric\t242\v064\f%2d"
"Sorcerer\t242\v075\f%2dRobber\t242\v086\f%2dNinja\t242\v097\f%2d"
"Barbarian\t242\v108\f%2dDruid\t242\v119\f%2dRanger\f04\x3""c"
"\t215\v151%d\t215\v175%d\x3l\t242\v020\f%.2dKnight\t242\v031\f%.2d"
"Paladin\t242\v042\f%.2dArcher\t242\v053\f%.2dCleric\t242\v064\f%.2d"
"Sorcerer\t242\v075\f%.2dRobber\t242\v086\f%.2dNinja\t242\v097\f%.2d"
"Barbarian\t242\v108\f%.2dDruid\t242\v119\f%.2dRanger\f04\x3""c"
"\t265\v142Skills\x3l\t223\v155%s\t223\v170%s%s";
const char *const Resources::NAME_FOR_NEW_CHARACTER =
"\x3""cEnter a Name for this Character";
"\x3""cEnter a Name for this Character\n\n";
const char *const Resources::SELECT_CLASS_BEFORE_SAVING =
"\v006\x3""cSelect a Class before saving.\x3l";
const char *const Resources::EXCHANGE_ATTR_WITH = "Exchange %s with...";