aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-02-18 20:53:24 -0500
committerPaul Gilbert2018-02-18 20:53:24 -0500
commit60e74af750a0a2aa9bbc9f89beb4058d54f729ba (patch)
tree19d591ac38927ed796c230db4537db2da92c862f
parent0b36518839f4933985ae56015be95a900c4e1e82 (diff)
downloadscummvm-rg350-60e74af750a0a2aa9bbc9f89beb4058d54f729ba.tar.gz
scummvm-rg350-60e74af750a0a2aa9bbc9f89beb4058d54f729ba.tar.bz2
scummvm-rg350-60e74af750a0a2aa9bbc9f89beb4058d54f729ba.zip
XEEN: Selection and creation fixes for Create Character dialog
-rw-r--r--engines/xeen/dialogs_create_char.cpp20
-rw-r--r--engines/xeen/resources.cpp10
2 files changed, 18 insertions, 12 deletions
diff --git a/engines/xeen/dialogs_create_char.cpp b/engines/xeen/dialogs_create_char.cpp
index 220a31009a..73aa4b3f02 100644
--- a/engines/xeen/dialogs_create_char.cpp
+++ b/engines/xeen/dialogs_create_char.cpp
@@ -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
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index b16c257b36..47d2959d8f 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -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...";