diff options
| author | Paul Gilbert | 2018-04-06 19:11:26 -0400 | 
|---|---|---|
| committer | Paul Gilbert | 2018-04-06 19:11:26 -0400 | 
| commit | 37b9de6d2564a9170b99711a7dd2327a882a5609 (patch) | |
| tree | a982f5e13a57c89c33727392f8e74a21e7c8b17c | |
| parent | 70b76dc8deb3f9ac21ad782eba07c8e8dacb6338 (diff) | |
| download | scummvm-rg350-37b9de6d2564a9170b99711a7dd2327a882a5609.tar.gz scummvm-rg350-37b9de6d2564a9170b99711a7dd2327a882a5609.tar.bz2 scummvm-rg350-37b9de6d2564a9170b99711a7dd2327a882a5609.zip | |
XEEN: Cleanup of monster move check method
| -rw-r--r-- | engines/xeen/combat.cpp | 11 | ||||
| -rw-r--r-- | engines/xeen/combat.h | 8 | ||||
| -rw-r--r-- | engines/xeen/saves.cpp | 1 | 
3 files changed, 11 insertions, 9 deletions
| diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index e8ae670288..2293dcd612 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -491,12 +491,12 @@ void Combat::moveMonsters() {  							switch (party._mazeDirection) {  							case DIR_NORTH:  							case DIR_SOUTH: -								if (monsterCanMove(pt, Res.MONSTER_GRID_BITMASK[MONSTER_GRID_BITINDEX1[arrIndex]], +								if (canMonsterMove(pt, Res.MONSTER_GRID_BITMASK[MONSTER_GRID_BITINDEX1[arrIndex]],  										MONSTER_GRID_X[arrIndex], MONSTER_GRID_Y[arrIndex], idx)) {  									// Move the monster  									moveMonster(idx, Common::Point(MONSTER_GRID_X[arrIndex], MONSTER_GRID_Y[arrIndex]));  								} else { -									if (monsterCanMove(pt, Res.MONSTER_GRID_BITMASK[MONSTER_GRID_BITINDEX2[arrIndex]], +									if (canMonsterMove(pt, Res.MONSTER_GRID_BITMASK[MONSTER_GRID_BITINDEX2[arrIndex]],  										arrIndex >= 21 && arrIndex <= 27 ? MONSTER_GRID3[arrIndex] : 0,  										arrIndex >= 21 && arrIndex <= 27 ? 0 : MONSTER_GRID3[arrIndex],  										idx)) { @@ -511,7 +511,7 @@ void Combat::moveMonsters() {  							case DIR_EAST:  							case DIR_WEST: -								if (monsterCanMove(pt, Res.MONSTER_GRID_BITMASK[MONSTER_GRID_BITINDEX2[arrIndex]], +								if (canMonsterMove(pt, Res.MONSTER_GRID_BITMASK[MONSTER_GRID_BITINDEX2[arrIndex]],  									arrIndex >= 21 && arrIndex <= 27 ? MONSTER_GRID3[arrIndex] : 0,  									arrIndex >= 21 && arrIndex <= 27 ? 0 : MONSTER_GRID3[arrIndex],  									idx)) { @@ -520,7 +520,7 @@ void Combat::moveMonsters() {  									} else {  										moveMonster(idx, Common::Point(0, MONSTER_GRID3[arrIndex]));  									} -								} else if (monsterCanMove(pt, Res.MONSTER_GRID_BITMASK[MONSTER_GRID_BITINDEX1[arrIndex]], +								} else if (canMonsterMove(pt, Res.MONSTER_GRID_BITMASK[MONSTER_GRID_BITINDEX1[arrIndex]],  										MONSTER_GRID_X[arrIndex], MONSTER_GRID_Y[arrIndex], idx)) {  									moveMonster(idx, Common::Point(MONSTER_GRID_X[arrIndex], MONSTER_GRID_Y[arrIndex]));  								} @@ -670,8 +670,7 @@ void Combat::setupMonsterAttack(int monsterDataIndex, const Common::Point &pt) {  	}  } -bool Combat::monsterCanMove(const Common::Point &pt, int wallShift, -		int xDiff, int yDiff, int monsterId) { +bool Combat::canMonsterMove(const Common::Point &pt, int wallShift, int xDiff, int yDiff, int monsterId) {  	Map &map = *_vm->_map;  	MazeMonster &monster = map._mobData._monsters[monsterId];  	MonsterStruct &monsterData = *monster._monsterData; diff --git a/engines/xeen/combat.h b/engines/xeen/combat.h index deefe33874..c3fa987fb1 100644 --- a/engines/xeen/combat.h +++ b/engines/xeen/combat.h @@ -273,9 +273,13 @@ public:  	/**  	 * Determines whether a given monster can move +	 * @param pt			Monster position +	 * @param wallShift		Shift mask for determining direction being moved +	 * @param xDiff			X Delta for move +	 * @param yDiff			Y Delta for move +	 * @param monsterId		Monster number being tested  	 */ -	bool monsterCanMove(const Common::Point &pt, int wallShift, -		int v1, int v2, int monsterId); +	bool canMonsterMove(const Common::Point &pt, int wallShift, int xDiff, int yDiff, int monsterId);  	/**  	 * Moves a monster by a given delta amount if it's a valid move diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp index 7eadac139c..1f58562bf0 100644 --- a/engines/xeen/saves.cpp +++ b/engines/xeen/saves.cpp @@ -259,7 +259,6 @@ bool SavesManager::loadGame() {  bool SavesManager::saveGame() {  	Map &map = *g_vm->_map; -	Windows &windows = *g_vm->_windows;  	if (map.mazeData()._mazeFlags & RESTRICTION_SAVE) {  		ErrorScroll::show(g_vm, Res.SAVE_OFF_LIMITS, WT_NONFREEZED_WAIT); | 
