[Scummvm-git-logs] scummvm master -> c969669309e6d1dc073351067eec4fe89a0cbf6b

dreammaster dreammaster at scummvm.org
Sat Dec 16 04:21:16 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c969669309 XEEN: Implementing Arena location logic


Commit: c969669309e6d1dc073351067eec4fe89a0cbf6b
    https://github.com/scummvm/scummvm/commit/c969669309e6d1dc073351067eec4fe89a0cbf6b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-12-15T22:21:06-05:00

Commit Message:
XEEN: Implementing Arena location logic

Changed paths:
    engines/xeen/locations.cpp
    engines/xeen/locations.h
    engines/xeen/resources.cpp
    engines/xeen/resources.h


diff --git a/engines/xeen/locations.cpp b/engines/xeen/locations.cpp
index 0804139..0ba0d9c 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 e23c340..4c21224 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 59add7a..c85523d 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 0326e7b..0cb9dab 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





More information about the Scummvm-git-logs mailing list