Skip to content

Commit

Permalink
XEEN: Display correct trainer message for whether chars can levelup
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Nov 23, 2017
1 parent d930243 commit 0b8278a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions engines/xeen/town.cpp
Expand Up @@ -44,7 +44,7 @@ Town::Town(XeenEngine *vm) : ButtonContainer(vm) {
_v10 = _v11 = 0;
_v12 = _v13 = 0;
_v14 = 0;
_v20 = 0;
_maxLevel = 0;
_v21 = 0;
_v22 = 0;
_v23 = 0;
Expand Down Expand Up @@ -431,42 +431,45 @@ Common::String Town::createTownText(Character &ch) {
if (_vm->_files->_isDarkCc) {
switch (party._mazeId) {
case 29:

This comment has been minimized.

Copy link
@darkstar

darkstar Nov 24, 2017

Contributor

I think these mazeIDs deserve some enums/constants ;-)

From my old notes (Google seems to back me up):
Clouds:
Vertigo could train up to 10, Rivercity up to 15 and Newcastle up to 20

Darkside:
Castleview could train up to 30, Sandcaster up to 50, Kalindra's Castle up to 100 and Olympus up to 200

This comment has been minimized.

Copy link
@dreammaster

dreammaster Nov 24, 2017

Author Member

Not a bad idea, thanks. Though it's probably better as simple comments than an enum.. given that each town consists of several map Ids, the Ids in this case only pertain to the portion of the town each trainer is in. So it would be redundant to have a whole bunch of enum values for each town like VERTIGO1/2/3/4 if they're never used.

_v20 = 30;
_maxLevel = 30;
break;
case 31:
_v20 = 50;
_maxLevel = 50;
break;
case 37:
_v20 = 200;
_maxLevel = 200;
break;
default:
_v20 = 100;
_maxLevel = 100;
break;
}
} else {
switch (party._mazeId) {
case 28:
_v20 = 10;
_maxLevel = 10;
break;
case 30:
_v20 = 15;
_maxLevel = 15;
break;
default:
_v20 = 20;
_maxLevel = 20;
break;
}
}

_experienceToNextLevel = ch.experienceToNextLevel();

if (_experienceToNextLevel >= 0x10000 && ch._level._permanent < _v20) {
if (_experienceToNextLevel && ch._level._permanent < _maxLevel) {
// Need more experience
int nextLevel = ch._level._permanent + 1;
return Common::String::format(Res.EXPERIENCE_FOR_LEVEL,
msg = Common::String::format(Res.EXPERIENCE_FOR_LEVEL,
ch._name.c_str(), _experienceToNextLevel, nextLevel);
} else if (ch._level._permanent >= 20) {
} else if (ch._level._permanent >= _maxLevel) {
// At maximum level
_experienceToNextLevel = 1;
msg = Common::String::format(Res.LEARNED_ALL, ch._name.c_str());
} else {
// Eligble for level increase
msg = Common::String::format(Res.ELIGIBLE_FOR_LEVEL,
ch._name.c_str(), ch._level._permanent + 1);
}
Expand Down Expand Up @@ -904,7 +907,7 @@ Character *Town::doTrainingOptions(Character *c) {
_drawFrameIndex = 0;

Common::String name;
if (c->_level._permanent >= _v20) {
if (c->_level._permanent >= _maxLevel) {
name = isDarkCc ? "gtlost.voc" : "trainin1.voc";
} else {
name = isDarkCc ? "gtlost.voc" : "trainin0.voc";
Expand Down
2 changes: 1 addition & 1 deletion engines/xeen/town.h
Expand Up @@ -54,7 +54,7 @@ class Town: public ButtonContainer {
int _v5, _v6;
int _v10, _v11, _v12;
int _v13, _v14;
uint _v20;
uint _maxLevel;
int _v21;
uint _v22;
int _v23;
Expand Down

0 comments on commit 0b8278a

Please sign in to comment.