aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen
diff options
context:
space:
mode:
authorPaul Gilbert2017-12-15 22:21:06 -0500
committerPaul Gilbert2017-12-15 22:21:06 -0500
commitc969669309e6d1dc073351067eec4fe89a0cbf6b (patch)
tree974a11ee5d84dbb2e6e5f31aaa393d4bf0bc5696 /engines/xeen
parentf281985680f9c7c317670dbcf0a79a92100042c0 (diff)
downloadscummvm-rg350-c969669309e6d1dc073351067eec4fe89a0cbf6b.tar.gz
scummvm-rg350-c969669309e6d1dc073351067eec4fe89a0cbf6b.tar.bz2
scummvm-rg350-c969669309e6d1dc073351067eec4fe89a0cbf6b.zip
XEEN: Implementing Arena location logic
Diffstat (limited to 'engines/xeen')
-rw-r--r--engines/xeen/locations.cpp71
-rw-r--r--engines/xeen/locations.h5
-rw-r--r--engines/xeen/resources.cpp6
-rw-r--r--engines/xeen/resources.h3
4 files changed, 82 insertions, 3 deletions
diff --git a/engines/xeen/locations.cpp b/engines/xeen/locations.cpp
index 08041394d9..0ba0d9c035 100644
--- a/engines/xeen/locations.cpp
+++ b/engines/xeen/locations.cpp
@@ -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;
}
/*------------------------------------------------------------------------*/
diff --git a/engines/xeen/locations.h b/engines/xeen/locations.h
index e23c3406fd..4c2122457d 100644
--- a/engines/xeen/locations.h
+++ b/engines/xeen/locations.h
@@ -239,6 +239,11 @@ class ArenaLocation : public BaseLocation {
public:
ArenaLocation();
virtual ~ArenaLocation() {}
+
+ /**
+ * Show the town location
+ */
+ virtual int show();
};
class CutsceneLocation : public BaseLocation {
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index 59add7aedb..c85523dd62 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -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
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index 0326e7b010..0cb9dab3c0 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -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