XEEN: Fixes for map loading cells and indoor sprite list references

This commit is contained in:
Paul Gilbert 2015-01-16 21:26:06 -05:00
parent 484901e7a2
commit 6bfd599535
4 changed files with 55 additions and 54 deletions

View File

@ -662,7 +662,7 @@ void Interface::draw3d(bool updateFlag) {
}
setIndoorsAttackingMonsters();
setIndoorObjects();
setIndoorsObjects();
setIndoorsWallPics();
_indoorList[161]._sprites = nullptr;
@ -757,7 +757,7 @@ void Interface::startup() {
animate3d();
if (_vm->_map->_isOutdoors) {
setIndoorsAttackingMonsters();
setIndoorObjects();
setIndoorsObjects();
} else {
setOutdoorsMonsters();
setOutdoorsObjects();
@ -816,7 +816,7 @@ void Interface::setMainButtons() {
void Interface::setMazeBits() {
Common::fill(&_wo[0], &_wo[308], 0);
switch (_vm->_map->getCell(0)) {
switch (_vm->_map->getCell(0) - 1) {
case 0:
++_wo[125];
break;
@ -886,7 +886,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(2)) {
switch (_vm->_map->getCell(2) - 1) {
case 0:
++_wo[127];
break;
@ -956,7 +956,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(4)) {
switch (_vm->_map->getCell(4) - 1) {
case 0:
++_wo[126];
break;
@ -1002,7 +1002,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(5)) {
switch (_vm->_map->getCell(5) - 1) {
case 0:
++_wo[122];
break;
@ -1068,7 +1068,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(7)) {
switch (_vm->_map->getCell(7) - 1) {
case 0:
++_wo[124];
break;
@ -1140,7 +1140,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(9)) {
switch (_vm->_map->getCell(9) - 1) {
case 0:
++_wo[123];
break;
@ -1186,7 +1186,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(10)) {
switch (_vm->_map->getCell(10) - 1) {
case 0:
++_wo[117];
break;
@ -1255,7 +1255,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(12)) {
switch (_vm->_map->getCell(12) - 1) {
case 0:
++_wo[118];
break;
@ -1325,7 +1325,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(14)) {
switch (_vm->_map->getCell(14) - 1) {
case 0:
++_wo[121];
break;
@ -1395,7 +1395,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(16)) {
switch (_vm->_map->getCell(16) - 1) {
case 0:
++_wo[120];
break;
@ -1465,7 +1465,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(18)) {
switch (_vm->_map->getCell(18) - 1) {
case 0:
++_wo[119];
break;
@ -1511,7 +1511,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(19)) {
switch (_vm->_map->getCell(19) - 1) {
case 0:
++_wo[108];
break;
@ -1580,7 +1580,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(21)) {
switch (_vm->_map->getCell(21) - 1) {
case 0:
++_wo[109];
break;
@ -1650,7 +1650,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(23)) {
switch (_vm->_map->getCell(23) - 1) {
case 0:
++_wo[110];
break;
@ -1720,7 +1720,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(25)) {
switch (_vm->_map->getCell(25) - 1) {
case 0:
++_wo[111];
break;
@ -1790,7 +1790,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(27)) {
switch (_vm->_map->getCell(27) - 1) {
case 0:
++_wo[116];
break;
@ -1860,7 +1860,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(29)) {
switch (_vm->_map->getCell(29) - 1) {
case 0:
++_wo[115];
break;
@ -1930,7 +1930,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(31)) {
switch (_vm->_map->getCell(31) - 1) {
case 0:
++_wo[114];
break;
@ -1999,7 +1999,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(33)) {
switch (_vm->_map->getCell(33) - 1) {
case 0:
++_wo[112];
break;
@ -2069,7 +2069,7 @@ void Interface::setMazeBits() {
break;
}
switch (_vm->_map->getCell(35)) {
switch (_vm->_map->getCell(35) - 1) {
case 0:
++_wo[113];
break;

View File

@ -166,7 +166,7 @@ OutdoorDrawList::OutdoorDrawList() : _skySprite(_data[1]), _groundSprite(_data[2
IndoorDrawList::IndoorDrawList() :
_sky(_data[1]), _ground(_data[2]), _horizon(_data[28]),
_swl_0F1R(_data[ 46]), _swl_0F1L(_data[44]), _swl_1F1R(_data[134]),
_swl_0F1R(_data[146]), _swl_0F1L(_data[144]), _swl_1F1R(_data[134]),
_swl_1F1L(_data[133]), _swl_2F2R(_data[110]), _swl_2F1R(_data[109]),
_swl_2F1L(_data[108]), _swl_2F2L(_data[107]), _swl_3F1R(_data[ 78]),
_swl_3F2R(_data[ 77]), _swl_3F3R(_data[ 76]), _swl_3F4R(_data[ 75]),
@ -377,6 +377,7 @@ InterfaceMap::InterfaceMap(XeenEngine *vm): _vm(vm) {
void InterfaceMap::setIndoorsAttackingMonsters() {
Combat &combat = *_vm->_combat;
Map &map = *_vm->_map;
Common::Point mazePos = _vm->_party._mazePosition;
Direction dir = _vm->_party._mazeDirection;
const int INDOOR_MONSTERS_Y[4] = { 2, 34, 53, 59 };
@ -392,8 +393,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
// The following long sequence sets up monsters in the various positions
if (monster._position.x == SCREEN_POSITIONING_X[dir][2] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][2]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][2]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][2])) {
monster._isAttacking = true;
if (combat._attackMonsters[0] == -1) {
combat._attackMonsters[0] = monsterIdx;
@ -407,8 +408,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][7] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][7]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][7]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][7])) {
monster._isAttacking = true;
if (!_wo[27]) {
if (combat._attackMonsters[3] == -1) {
@ -424,8 +425,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][5] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][5]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][5]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][5])) {
if (_wo[27] && _wo[25]) {
} else if (_wo[27] && _wo[28]) {
} else if (_wo[23] & _wo[25]) {
@ -440,8 +441,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][9] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][9]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][9]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][9])) {
if (_wo[27] && _wo[26]) {
} else if (_wo[27] && _wo[29]) {
} else if (_wo[24] & _wo[26]) {
@ -456,8 +457,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][14] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][14]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][14]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][14])) {
monster._isAttacking = true;
if (!_wo[22] && !_wo[27]) {
@ -474,8 +475,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][12] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][12]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][12]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][12])) {
if (_wo[27]) {
} else if (_wo[22] && _wo[23]) {
} else if (_wo[22] & _wo[20]) {
@ -493,8 +494,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][16] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][16]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][16]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][16])) {
if (_wo[27]) {
} else if (_wo[22] && _wo[24]) {
} else if (_wo[22] & _wo[21]) {
@ -513,8 +514,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][27] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][27]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][27]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][27])) {
if (!_wo[27] && !_wo[22] && _wo[15]) {
monster._isAttacking = true;
@ -531,8 +532,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][25] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][25]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][25]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][25])) {
if (_wo[27] || _wo[22]) {
} else if (_wo[15] && _wo[17]) {
} else if (_wo[15] && _wo[12]) {
@ -554,8 +555,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][23] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][23]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][23]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][23])) {
if (_wo[27]) {
} else if (_wo[22] && _wo[20]) {
} else if (_wo[22] && _wo[23]) {
@ -572,8 +573,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][29] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][29]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][29]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][29])) {
if (_wo[27] || _wo[22]) {
} else if (_wo[15] && _wo[19]) {
} else if (_wo[15] && _wo[14]) {
@ -595,8 +596,8 @@ void InterfaceMap::setIndoorsAttackingMonsters() {
}
}
if (monster._position.x == SCREEN_POSITIONING_X[dir][31] &&
monster._position.y == SCREEN_POSITIONING_Y[dir][31]) {
if (monster._position.x == (mazePos.x + SCREEN_POSITIONING_X[dir][31]) &&
monster._position.y == (mazePos.y + SCREEN_POSITIONING_Y[dir][31])) {
if (_wo[27]) {
} else if (_wo[22] && _wo[21]) {
} else if (_wo[22] && _wo[24]) {
@ -642,7 +643,7 @@ void InterfaceMap::setMonsterSprite(DrawStruct &drawStruct, MazeMonster &monster
drawStruct._flags = MONSTER_EFFECT_FLAGS[monster._effect2][monster._effect3];
}
void InterfaceMap::setIndoorObjects() {
void InterfaceMap::setIndoorsObjects() {
Common::Point mazePos = _vm->_party._mazePosition;
Direction dir = _vm->_party._mazeDirection;
Common::Point pt;

View File

@ -107,7 +107,7 @@ public:
void setIndoorsAttackingMonsters();
void setIndoorObjects();
void setIndoorsObjects();
void setIndoorsWallPics();

View File

@ -950,7 +950,7 @@ void Map::load(int mapId) {
if (mapId != 0) {
// Load in the maze's data file
Common::String datName = Common::String::format("maze%c%03d.dat",
(_vm->_party._mazeId >= 100) ? 'x' : '0', _vm->_party._mazeId);
(mapId >= 100) ? 'x' : '0', mapId);
File datFile(datName);
mazeData->synchronize(datFile);
datFile.close();
@ -1435,11 +1435,11 @@ int Map::getCell(int idx) {
_currentWall._data = 0x8888;
return 0x8888;
}
_mazeDataIndex = 0;
while (_mazeData[_mazeDataIndex]._mazeId != mapId)
++_mazeDataIndex;
}
_mazeDataIndex = 0;
while (_mazeData[_mazeDataIndex]._mazeId != mapId)
++_mazeDataIndex;
}
MazeWallLayers &wallLayers = _mazeData[_mazeDataIndex]._wallData[pt.y][pt.x];