From d6497f78f0fe9f996be3ace6c4ef320dd58ba1c7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 Jan 2015 21:50:20 -0500 Subject: XEEN: Implement setIndoorsWallPics --- engines/xeen/interface.cpp | 6 +- engines/xeen/interface_map.cpp | 229 ++++++++++++++++++++++++++++++++++++++++- engines/xeen/interface_map.h | 4 +- engines/xeen/map.cpp | 1 + engines/xeen/map.h | 1 + 5 files changed, 232 insertions(+), 9 deletions(-) (limited to 'engines/xeen') diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index eb607db7a2..7476abfa31 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -661,9 +661,9 @@ void Interface::draw3d(bool updateFlag) { } } - setIndoorsMonsters(); + setIndoorsAttackingMonsters(); setIndoorObjects(); - setIndoorWallPics(); + setIndoorsWallPics(); _indoorList[161]._sprites = nullptr; _indoorList[160]._sprites = nullptr; @@ -756,7 +756,7 @@ void Interface::startup() { animate3d(); if (_vm->_map->_isOutdoors) { - setIndoorsMonsters(); + setIndoorsAttackingMonsters(); setIndoorObjects(); } else { setOutdoorsMonsters(); diff --git a/engines/xeen/interface_map.cpp b/engines/xeen/interface_map.cpp index ba5cdbc7d0..d95868dd8a 100644 --- a/engines/xeen/interface_map.cpp +++ b/engines/xeen/interface_map.cpp @@ -374,7 +374,7 @@ InterfaceMap::InterfaceMap(XeenEngine *vm): _vm(vm) { _combatFloatCounter = 0; } -void InterfaceMap::setIndoorsMonsters() { +void InterfaceMap::setIndoorsAttackingMonsters() { Combat &combat = *_vm->_combat; Map &map = *_vm->_map; Direction dir = _vm->_party._mazeDirection; @@ -820,8 +820,230 @@ void InterfaceMap::setIndoorObjects() { } } -void InterfaceMap::setIndoorWallPics() { - // TODO +void InterfaceMap::setIndoorsWallPics() { + Map &map = *_vm->_map; + const Common::Point &mazePos = _vm->_party._mazePosition; + Direction dir = _vm->_party._mazeDirection; + + Common::fill(&_wp[0], &_wp[20], -1); + + for (uint idx = 0; idx < map._mobData._wallItems.size(); ++idx) { + MazeWallItem &wallItem = map._mobData._wallItems[idx]; + if (wallItem._direction != dir) + continue; + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][2]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][2])) { + if (_wp[1] == -1) { + _indoorList[148]._frame = wallItem._frame; + _indoorList[148]._sprites = wallItem._sprites; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][7]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][7])) { + if (!_wo[27] && _wp[1] == -1) { + _indoorList[123]._frame = wallItem._frame; + _indoorList[123]._sprites = wallItem._sprites; + _wp[4] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][5]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][5])) { + if (_wo[27] && _wo[25]) { + } else if (_wo[27] && _wo[28]) { + } else if (_wo[23] && _wo[25]) { + } else if (_wo[23] && _wo[28]) { + } else if (_wp[3] == -1) { + _indoorList[122]._frame = wallItem._frame; + _indoorList[122]._sprites = wallItem._sprites; + _wp[3] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][9]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][9])) { + if (_wo[27] && _wo[26]) { + } else if (_wo[27] && _wo[29]) { + } else if (_wo[24] && _wo[26]) { + } else if (_wo[24] && _wo[29]) { + } else if (_wp[5] == -1) { + _indoorList[124]._frame = wallItem._frame; + _indoorList[124]._sprites = wallItem._sprites; + _wp[5] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][14]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][14])) { + if (!_wo[22] && !_wo[27] && !_wp[8]) { + _indoorList[94]._frame = wallItem._frame; + _indoorList[94]._sprites = wallItem._sprites; + _wp[8] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][12]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][12])) { + if (_wo[27]) { + } else if (_wo[22] && _wo[23]) { + } else if (_wo[22] && _wo[20]) { + } else if (_wo[23] && _wo[17]) { + } else if (_wo[20] && _wo[17]) { + } else if (_wp[7] == -1) { + _indoorList[93]._frame = wallItem._frame; + _indoorList[93]._sprites = wallItem._sprites; + _wp[7] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][16]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][16])) { + if (_wo[27]) { + } else if (_wo[22] && _wo[24]) { + } else if (_wo[22] && _wo[21]) { + } else if (_wo[24] && _wo[19]) { + } else if (_wo[21] && _wo[19]) { + } else if (_wp[9] == -1) { + _indoorList[95]._frame = wallItem._frame; + _indoorList[95]._sprites = wallItem._sprites; + _wp[9] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][12]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][12])) { + if (_wo[27]) { + } else if (_wo[25] && _wo[28]) { + } else if (_wo[20] && _wo[16]) { + } else if (_wp[6] == -1) { + _indoorList[92]._frame = wallItem._frame; + _indoorList[92]._sprites = wallItem._sprites; + _wp[6] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][16]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][16])) { + if (!_wo[26] && !_wo[29] && !_wo[21] && !_wo[18] && _wp[10] == -1) { + _indoorList[96]._frame = wallItem._frame; + _indoorList[96]._sprites = wallItem._sprites; + _wp[10] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][27]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][27])) { + if (!_wo[27] && !_wo[22] && !_wo[15] && _wp[15] == -1) { + _indoorList[50]._frame = wallItem._frame; + _indoorList[50]._sprites = wallItem._sprites; + _wp[15] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][25]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][25])) { + if (_wo[27]) { + } else if (_wo[27] && _wo[22]) { + } else if (_wo[15] && _wo[17]) { + } else if (_wo[15] && _wo[12]) { + } else if (_wo[12] && _wo[7]) { + } else if (_wo[17] && _wo[7]) { + } else if (_wp[14] == -1) { + _indoorList[49]._frame = wallItem._frame; + _indoorList[49]._sprites = wallItem._sprites; + _wp[14] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][23]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][23])) { + if (_wo[27]) { + } else if (_wo[22] && _wo[20]) { + } else if (_wo[22] && _wo[23]) { + } else if (_wo[20] && _wo[17]) { + } else if (_wo[23] && _wo[17]) { + } else if (_wo[12] && _wo[8]) { + } else if (_wp[13] == -1) { + _indoorList[48]._frame = wallItem._frame; + _indoorList[48]._sprites = wallItem._sprites; + _wp[13] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][29]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][29])) { + if (_wo[27] || _wo[22]) { + } else if (_wo[15] && _wo[19]) { + } else if (_wo[15] && _wo[14]) { + } else if (_wo[14] && _wo[9]) { + } else if (_wo[19] && _wo[9]) { + } else if (_wp[16] == -1) { + _indoorList[51]._frame = wallItem._frame; + _indoorList[51]._sprites = wallItem._sprites; + _wp[16] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][31]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][31])) { + if (_wo[27]) { + } else if (_wo[22] && _wo[21]) { + } else if (_wo[22] && _wo[24]) { + } else if (_wo[21] && _wo[19]) { + } else if (_wo[24] && _wo[19]) { + } else if (!_wo[14] && !_wo[10] && _wp[17] == -1) { + _indoorList[52]._frame = wallItem._frame; + _indoorList[52]._sprites = wallItem._sprites; + _wp[17] = idx; + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][23]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][23])) { + if (!_wo[27] && !_wo[20] && !_wo[12] && !_wo[23] && !_wo[8] && !_wo[30]) { + if (_wp[12] == -1) { + _indoorList[47]._frame = wallItem._frame; + _indoorList[47]._sprites = wallItem._sprites; + _wp[12] = idx; + } + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][31]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][31])) { + if (!_wo[27] && !_wo[21] && !_wo[14] && !_wo[24] && !_wo[10] && !_wo[31]) { + if (_wp[18] == -1) { + _indoorList[53]._frame = wallItem._frame; + _indoorList[53]._sprites = wallItem._sprites; + _wp[18] = idx; + } + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][23]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][23])) { + if (!_wo[25] && !_wo[28] && !_wo[20] && !_wo[11] && !_wo[16] && !_wo[30] && !_wo[32]) { + if (_wp[11] == -1) { + _indoorList[46]._frame = wallItem._frame; + _indoorList[46]._sprites = wallItem._sprites; + _wp[11] = idx; + } + } + } + + if (mazePos.x == (wallItem._position.x + SCREEN_POSITIONING_X[dir][31]) && + mazePos.y == (wallItem._position.y + SCREEN_POSITIONING_Y[dir][31])) { + if (!_wo[26] && !_wo[20] && !_wo[21] && !_wo[13] && !_wo[18] && !_wo[31] && !_wo[33]) { + if (_wp[19] == -1) { + _indoorList[54]._frame = wallItem._frame; + _indoorList[54]._sprites = wallItem._sprites; + _wp[19] = idx; + } + } + } + } } void InterfaceMap::setOutdoorsMonsters() { @@ -835,7 +1057,6 @@ void InterfaceMap::setOutdoorsObjects() { void InterfaceMap::drawIndoors() { Map &map = *_vm->_map; int surfaceId; - int idx; for (int cellIndex = 0; cellIndex < 25; ++cellIndex) { map.getCell(DRAW_NUMBERS[cellIndex]); diff --git a/engines/xeen/interface_map.h b/engines/xeen/interface_map.h index ea40c30a79..ae9abd2e5e 100644 --- a/engines/xeen/interface_map.h +++ b/engines/xeen/interface_map.h @@ -105,11 +105,11 @@ public: public: InterfaceMap(XeenEngine *vm); - void setIndoorsMonsters(); + void setIndoorsAttackingMonsters(); void setIndoorObjects(); - void setIndoorWallPics(); + void setIndoorsWallPics(); void drawIndoors(); diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index abb2cf68f2..a5a40c9029 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -650,6 +650,7 @@ MazeMonster::MazeMonster() { MazeWallItem::MazeWallItem() { _id = 0; + _frame = 0; _spriteId = 0; _direction = DIR_NORTH; _sprites = nullptr; diff --git a/engines/xeen/map.h b/engines/xeen/map.h index 6ac8b36973..8e6fee2811 100644 --- a/engines/xeen/map.h +++ b/engines/xeen/map.h @@ -264,6 +264,7 @@ class MazeWallItem { public: Common::Point _position; int _id; + int _frame; int _spriteId; Direction _direction; SpriteResource *_sprites; -- cgit v1.2.3