From d8e23aa558ffda15e36d087dee6e3f3d1db659ff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 Jan 2015 20:35:32 -0500 Subject: XEEN: Split up SCREEN_POSITIONING array and fix data --- engines/xeen/interface.cpp | 47 +++++++++++++++++++++++++++++- engines/xeen/interface.h | 19 +++++++++++-- engines/xeen/resources.cpp | 71 ++++++++++++++++++++++++++++++---------------- engines/xeen/resources.h | 4 ++- 4 files changed, 112 insertions(+), 29 deletions(-) (limited to 'engines') diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index 9e02806750..0ae64ca9c0 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -363,6 +363,7 @@ Interface::Interface(XeenEngine *vm) : ButtonContainer(), _vm(vm) { _flag1 = false; _animCounter = 0; _isAnimReset = false; + _charsShooting = false; _tillMove = 0; _objNumber = 0; @@ -873,6 +874,8 @@ void Interface::draw3d(bool flag) { Direction partyDirection = _vm->_party._mazeDirection; int objNum = _objNumber - 1; + // Loop to update the frame numbers for each maze object, applying the animation frame + // limits as specified by the map's _animationInfo listing for (uint i = 0; i < _vm->_map->_mobData._objects.size(); ++i) { MazeObject &mazeObject = _vm->_map->_mobData._objects[i]; AnimationEntry &animEntry = _vm->_map->_animationInfo[mazeObject._spriteId]; @@ -895,6 +898,40 @@ void Interface::draw3d(bool flag) { mazeObject._flipped = animEntry._flipped._flags[directionIndex]; } + if (_vm->_map->_isOutdoors) { + error("TODO: draw3d outdoors handling"); + } else { + // Default all the parts of draw struct not to be drawn by default + for (int idx = 3; idx < _indoorList.size(); ++idx) + _indoorList[idx]._frame = -1; + + if (_flag1) { + for (int idx = 0; idx < 96; ++idx) { + if (_indoorList[79 + idx]._sprites != nullptr) { + _indoorList[79 + idx]._frame = 0; + } else if (_indoorList[111 + idx]._sprites != nullptr) { + _indoorList[111 + idx]._frame = 1; + } else if (_indoorList[135 + idx]._sprites != nullptr) { + _indoorList[135 + idx]._frame = 2; + } else if (_indoorList[162 + idx]._sprites != nullptr) { + _indoorList[162 + idx]._frame = 0; + } + } + } else if (_charsShooting) { + for (int idx = 0; idx < 96; ++idx) { + if (_indoorList[162 + idx]._sprites != nullptr) { + _indoorList[162 + idx]._frame = 0; + } else if (_indoorList[135 + idx]._sprites != nullptr) { + _indoorList[135 + idx]._frame = 1; + } else if (_indoorList[111 + idx]._sprites != nullptr) { + _indoorList[111 + idx]._frame = 2; + } else if (_indoorList[79 + idx]._sprites != nullptr) { + _indoorList[79 + idx]._frame = 0; + } + } + } + } + // TODO: more warning("TODO"); @@ -911,7 +948,7 @@ void Interface::setIndoorsMonsters() { void Interface::setIndoorObjects() { Common::Point mazePos = _vm->_party._mazePosition; _objNumber = 0; - const int8 *posOffset = &SCREEN_POSITIONING[_vm->_party._mazeDirection * 48]; + const int8 *posOffset = &SCREEN_POSITIONING_X[_vm->_party._mazeDirection][0]; Common::Point pt; Common::Array &objects = _vm->_map->_mobData._objects; @@ -1158,4 +1195,12 @@ void Interface::setMainButtons() { addButton(Common::Rect(239, 47, 312, 57), 51, &_iconSprites, false); } +void Interface::setMazeBits() { + +} + +void Interface::getCell() { +} + + } // End of namespace Xeen diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h index d161169d68..1c110352bb 100644 --- a/engines/xeen/interface.h +++ b/engines/xeen/interface.h @@ -40,7 +40,12 @@ public: public: OutdoorDrawList(); - DrawStruct &operator[](int idx) { return _data[idx]; } + DrawStruct &operator[](int idx) { + assert(idx < size()); + return _data[idx]; + } + + int size() const { return 132; } }; class IndoorDrawList { @@ -54,7 +59,12 @@ public: public: IndoorDrawList(); - DrawStruct &operator[](int idx) { return _data[idx]; } + DrawStruct &operator[](int idx) { + assert(idx < size()); + return _data[idx]; + } + + int size() const { return 170; } }; @@ -98,6 +108,7 @@ private: bool _flag1; int _animCounter; bool _isAnimReset; + bool _charsShooting; byte _tillMove; int _objNumber; byte _wp[20]; @@ -132,6 +143,10 @@ private: void moveMonsters(); void setMainButtons(); + + void setMazeBits(); + + void getCell(); public: Interface(XeenEngine *vm); diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp index e660014ec3..0737e1462d 100644 --- a/engines/xeen/resources.cpp +++ b/engines/xeen/resources.cpp @@ -303,31 +303,52 @@ const char *const PLEASE_WAIT = "\014""d\003""c\011""000" const char *const OOPS = "\003""c\011""000\013""002Oops..."; -const int8 SCREEN_POSITIONING[384] = { - -1, 0, 0, 0, 1, -1, 0, 0, 0, 1, -2, -1, -1, 0, 0, 0, - 1, 1, 2, -4, -3, -3, -2, -2, -1, -1, 0, 0, 0, 1, 1, 2, - 2, 3, 3, 4, -3, -2, -1, 0, 0, 1, 2, 3, -4, 4, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 1, - 1, 0, 0, 0, -1, 1, 0, 0, 0, -1, 2, 1, 1, 0, 0, 0, - -1, -1, -2, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, -1, -1, -2, - -2, -3, -3, -4, 3, 2, 1, 0, 0, -1, -2, -3, 4, -4, 0, 0, - 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, - -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, -1, - 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 1, - 1, 0, 0, 0, -1, 1, 0, 0, 0, -1, 2, 1, 1, 0, 0, 0, - -1, -1, -2, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, -1, -1, -2, - -2, -3, -3, -4, 3, 2, 1, 0, 0, -1, -2, -3, 4, -4, 0, 0, - 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, - -2, -2, -2, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - -3, -3, -3, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, -1, - -1, 0, 0, 0, 1, -1, 0, 0, 0, 1, -2, -1, -1, 0, 0, 0, - 1, 1, 2, -4, -3, -3, -2, -2, -1, -1, 0, 0, 0, 1, 1, 2, - 2, 3, 3, 4, -3, -2, -1, 0, 0, 1, 2, 3, -4, 4, 0, 0, +const int8 SCREEN_POSITIONING_X[4][48] = { + { + -1, 0, 0, 0, 1, -1, 0, 0, 0, 1, -2, -1, + -1, 0, 0, 0, 1, 1, 2, -4, -3, -3, -2, -2, + -1, -1, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, + -3, -2, -1, 0, 0, 1, 2, 3, -4, 4, 0, 0 + }, { + 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 1 + }, { + 1, 0, 0, 0, -1, 1, 0, 0, 0, -1, 2, 1, + 1, 0, 0, 0, -1, -1, -2, 4, 3, 3, 2, 2, + 1, 1, 0, 0, 0, -1, -1, -2, -2, -3, -3, -4, + 3, 2, 1, 0, 0, -1, -2, -3, 4, -4, 0, 0 + }, { + 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, + -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, + -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, -1 + } +}; + +const int8 SCREEN_POSITIONING_Y[4][48] = { + { + 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 1 + }, { + 1, 0, 0, 0, -1, 1, 0, 0, 0, -1, 2, 1, + 1, 0, 0, 0, -1, -1, -2, 4, 3, 3, 2, 2, + 1, 1, 0, 0, 0, -1, -1, -2, -2, -3, -3, -4, + 3, 2, 1, 0, 0, -1, -2, -3, 4, -4, 0, 0 + }, { + 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3, + -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, + -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, -1 + }, { + -1, 0, 0, 0, 1, -1, 0, 0, 0, 1, -2, -1, + -1, 0, 0, 0, 1, 1, 2, -4, -3, -3, -2, -2, + -1, -1, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, + -3, -2, -1, 0, 0, 1, 2, 3, -4, 4, 0, 0 + } }; const int INDOOR_OBJECT_X[2][12] = { diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h index 35b82566b3..36c2cb0e12 100644 --- a/engines/xeen/resources.h +++ b/engines/xeen/resources.h @@ -68,7 +68,9 @@ extern const char *const PLEASE_WAIT; extern const char *const OOPS; -extern const int8 SCREEN_POSITIONING[384]; +extern const int8 SCREEN_POSITIONING_X[4][48]; + +extern const int8 SCREEN_POSITIONING_Y[4][48]; extern const int INDOOR_OBJECT_X[2][12]; -- cgit v1.2.3