XEEN: Implementing Arena location logic

This commit is contained in:
Paul Gilbert 2017-12-15 22:21:06 -05:00
parent f281985680
commit c969669309
4 changed files with 82 additions and 3 deletions

View File

@ -412,8 +412,7 @@ void BankLocation::depositWithdrawl(PartyBank whereId) {
if (whereId == WHERE_BANK) {
gold = party._bankGold;
gems = party._bankGems;
}
else {
} else {
gold = party._gold;
gems = party._gems;
}
@ -424,7 +423,6 @@ void BankLocation::depositWithdrawl(PartyBank whereId) {
windows[35].writeString(msg);
windows[35].update();
}
// TODO
} while (!g_vm->shouldQuit() && _buttonValue != Common::KEYCODE_ESCAPE);
for (uint idx = 0; idx < _buttons.size(); ++idx)
@ -1103,7 +1101,74 @@ Character *TrainingLocation::doOptions(Character *c) {
/*------------------------------------------------------------------------*/
ArenaLocation::ArenaLocation() : BaseLocation(ARENA) {
}
int ArenaLocation::show() {
Map &map = *g_vm->_map;
Party &party = *g_vm->_party;
Resources &res = *g_vm->_resources;
Windows &windows = *g_vm->_windows;
const char *SUFFIXES[10] = { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" };
if (map._mobData._monsters.size() > 0) {
for (uint idx = 0; idx < map._mobData._monsters.size(); ++idx) {
MazeMonster &monster = map._mobData._monsters[idx];
if (monster._position.x != 0x80 && monster._position.y != 0x80) {
LocationMessage::show(27, Res.WARZONE_BATTLE_MASTER,
map._events._text[4], 300);
party._mazeDirection = DIR_EAST;
party.moveToRunLocation();
windows.closeAll();
return 0;
}
}
// Give each character the award
for (int idx = 0; idx < party._activeParty.size(); ++idx) {
party._activeParty[idx]._awards[9]++;
}
Common::String format = map._events._text[3];
Common::String count = Common::String::format("%05u", party._activeParty[0]._awards[9]);
int numIdx = count[3] == '1' ? 0 : count[4] - '0';
Common::String msg = Common::String::format(format.c_str(), count.c_str(), SUFFIXES[numIdx]);
LocationMessage::show(27, Res.WARZONE_BATTLE_MASTER, msg, 1);
map.load(28);
party._mazeDirection = DIR_EAST;
party.moveToRunLocation();
windows.closeAll();
return 0;
}
for (uint idx = 0; idx < party._activeParty.size(); ++idx) {
if (party._activeParty[idx]._awards[idx] >= 99) {
LocationMessage::show(27, Res.WARZONE_BATTLE_MASTER, Res.WARZONE_MAXED, 1);
map.load(28);
party._mazeDirection = DIR_EAST;
party.moveToRunLocation();
windows.closeAll();
return 0;
}
}
bool check = LocationMessage::show(27, Res.WARZONE_BATTLE_MASTER,
map._events._text[0].c_str(), 300);
if (!check) {
LocationMessage::show(27, Res.WARZONE_BATTLE_MASTER,
map._events._text[1].c_str(), 300);
windows.closeAll();
map.load(6);
party._mazePosition = Common::Point(12, 4);
party._mazeDirection = DIR_WEST;
return 0;
}
LocationMessage::show(27, Res.WARZONE_BATTLE_MASTER, Res.WARZONE_LEVEL, 2);
// TODO
return 0;
}
/*------------------------------------------------------------------------*/

View File

@ -239,6 +239,11 @@ class ArenaLocation : public BaseLocation {
public:
ArenaLocation();
virtual ~ArenaLocation() {}
/**
* Show the town location
*/
virtual int show();
};
class CutsceneLocation : public BaseLocation {

View File

@ -1618,4 +1618,10 @@ const char *const Resources::AWARDS_TEXT =
const char *const Resources::NO_AWARDS = "\x3""cNo Awards";
const char *const Resources::WARZONE_BATTLE_MASTER = "The Warzone\n\t125Battle Master";
const char *const Resources::WARZONE_MAXED = "What! You again? Go pick on someone your own size!";
const char *const Resources::WARZONE_LEVEL = "What level of monsters? (1-10)\n";
} // End of namespace Xeen

View File

@ -347,6 +347,9 @@ public:
static const char *const AWARDS_FOR;
static const char *const AWARDS_TEXT;
static const char *const NO_AWARDS;
static const char *const WARZONE_BATTLE_MASTER;
static const char *const WARZONE_MAXED;
static const char *const WARZONE_LEVEL;
public:
/**
* Initializes an instnace of the resources