aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-09 22:27:48 -0500
committerPaul Gilbert2015-01-09 22:27:48 -0500
commit8f0c5543fbac066a9b0f216ae0747e6cff528a2c (patch)
tree02fb09f1288a65e6b3784be1ad7bf80cc7242ec0 /engines
parent08e64d0a6146b9fde774467cc1906f230571f72d (diff)
downloadscummvm-rg350-8f0c5543fbac066a9b0f216ae0747e6cff528a2c.tar.gz
scummvm-rg350-8f0c5543fbac066a9b0f216ae0747e6cff528a2c.tar.bz2
scummvm-rg350-8f0c5543fbac066a9b0f216ae0747e6cff528a2c.zip
XEEN: Beginning to implement setIndoorObjects
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/interface.cpp80
-rw-r--r--engines/xeen/interface.h10
-rw-r--r--engines/xeen/map.h2
-rw-r--r--engines/xeen/resources.cpp47
-rw-r--r--engines/xeen/resources.h10
5 files changed, 140 insertions, 9 deletions
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 6f0d4d580f..e960b3d89a 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -164,7 +164,11 @@ OutdoorDrawList::OutdoorDrawList() : _skySprite(_data[1]), _groundSprite(_data[2
/*------------------------------------------------------------------------*/
-IndoorDrawList::IndoorDrawList() : _skySprite(_data[1]), _groundSprite(_data[2]) {
+IndoorDrawList::IndoorDrawList() : _skySprite(_data[1]), _groundSprite(_data[2]),
+ _objects0(_data[149]), _objects1(_data[125]), _objects2(_data[126]),
+ _objects3(_data[127]), _objects4(_data[97]), _objects5(_data[98]),
+ _objects6(_data[99]), _objects7(_data[55]), _objects8(_data[56]),
+ _objects9(_data[58]), _objects10(_data[57]), _objects11(_data[59]) {
_data[0] = DrawStruct(0, 8, 8);
_data[1] = DrawStruct(1, 8, 25);
_data[2] = DrawStruct(0, 8, 67);
@@ -360,6 +364,9 @@ Interface::Interface(XeenEngine *vm) : ButtonContainer(), _vm(vm) {
_flag1 = false;
_flag2 = false;
_tillMove = 0;
+ _objNumber = 0;
+ _objectFlag2 = _objectFlag3 = _objectFlag4 = _objectFlag5 = false;
+ _objectFlag6 = _objectFlag7 = _objectFlag8 = false;
initDrawStructs();
}
@@ -846,7 +853,7 @@ void Interface::addCharacterToRoster() {
void Interface::draw3d(bool flag) {
Screen &screen = *_vm->_screen;
- EventsManager &events = *_vm->_events;
+// EventsManager &events = *_vm->_events;
if (!screen._windows[11]._enabled)
return;
@@ -869,12 +876,73 @@ void Interface::animate3d() {
}
-void Interface::setMonsters() {
+void Interface::setIndoorsMonsters() {
}
-void Interface::setObjects() {
+void Interface::setIndoorObjects() {
+ Common::Point mazePos = _vm->_party._mazePosition;
+ _objNumber = 0;
+ int objIndx = 0;
+ const int8 *posOffset = &SCREEN_POSITIONING[_vm->_party._mazeDirection * 48];
+ Common::Point pt;
+
+ // TODO: Fields loading
+ Common::Array<MazeObject> &objects = _vm->_map->_mobData._objects;
+ for (uint idx = 0; idx < objects.size(); ++idx) {
+ MazeObject &mazeObject = objects[idx];
+
+ // Determine which half of the X/Y lists to use
+ int listOffset;
+ if (_vm->_files->_isDarkCc) {
+ listOffset = mazeObject._spriteId == 47 ? 1 : 0;
+ } else {
+ listOffset = mazeObject._spriteId == 113 ? 1 : 0;
+ }
+
+ // Position 1
+ pt = Common::Point(mazePos.x + posOffset[2], mazePos.y + posOffset[194]);
+ if (pt == mazeObject._position && _indoorList._objects0._frame == -1) {
+ _indoorList._objects0._x = INDOOR_OBJECT_X[listOffset][0];
+ _indoorList._objects0._y = INDOOR_OBJECT_Y[listOffset][0];
+ _indoorList._objects0._frame = mazeObject._frame;
+ _indoorList._objects0._sprites = mazeObject._sprites;
+ _indoorList._objects0._flags &= ~SPRFLAG_HORIZ_FLIPPED;
+ if (mazeObject._flipped)
+ _indoorList._objects0._flags |= SPRFLAG_HORIZ_FLIPPED;
+ _objNumber = idx;
+ }
+
+ // Position 2
+ pt = Common::Point(mazePos.x + posOffset[7], mazePos.y + posOffset[199]);
+ if (pt == mazeObject._position && !_objectFlag2 && _indoorList._objects1._frame == -1) {
+ _indoorList._objects1._x = INDOOR_OBJECT_X[listOffset][1];
+ _indoorList._objects1._y = INDOOR_OBJECT_Y[listOffset][1];
+ _indoorList._objects1._frame = mazeObject._frame;
+ _indoorList._objects1._sprites = mazeObject._sprites;
+ _indoorList._objects1._flags &= ~SPRFLAG_HORIZ_FLIPPED;
+ if (mazeObject._flipped)
+ _indoorList._objects1._flags |= SPRFLAG_HORIZ_FLIPPED;
+ _objNumber = idx;
+ }
+
+ // Position 3
+ pt = Common::Point(mazePos.x + posOffset[5], mazePos.y + posOffset[197]);
+ if (pt == mazeObject._position && !_objectFlag2 && _indoorList._objects2._frame == -1) {
+ _indoorList._objects2._x = INDOOR_OBJECT_X[listOffset][1];
+ _indoorList._objects2._y = INDOOR_OBJECT_Y[listOffset][1];
+ _indoorList._objects2._frame = mazeObject._frame;
+ _indoorList._objects2._sprites = mazeObject._sprites;
+ _indoorList._objects2._flags &= ~SPRFLAG_HORIZ_FLIPPED;
+ if (mazeObject._flipped)
+ _indoorList._objects2._flags |= SPRFLAG_HORIZ_FLIPPED;
+ _objNumber = idx;
+ }
+
+ // Position 4 onwards
+ // TODO: Also resolve usage of _objectFlag* flags
+ }
}
void Interface::setOutdoorsMonsters() {
@@ -892,8 +960,8 @@ void Interface::startup() {
animate3d();
if (_vm->_map->_isOutdoors) {
- setMonsters();
- setObjects();
+ setIndoorsMonsters();
+ setIndoorObjects();
} else {
setOutdoorsMonsters();
setOutdoorsObjects();
diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h
index 60250bd8e8..5dc5e1ffbe 100644
--- a/engines/xeen/interface.h
+++ b/engines/xeen/interface.h
@@ -48,6 +48,9 @@ public:
DrawStruct _data[170];
DrawStruct &_skySprite;
DrawStruct &_groundSprite;
+ DrawStruct &_objects0, _objects1, _objects2, _objects3;
+ DrawStruct &_objects4, _objects5, _objects6, _objects7;
+ DrawStruct &_objects8, _objects9, _objects10, _objects11;
public:
IndoorDrawList();
@@ -95,6 +98,9 @@ private:
bool _flag1;
bool _flag2;
byte _tillMove;
+ int _objNumber;
+ bool _objectFlag2, _objectFlag3, _objectFlag4, _objectFlag5;
+ bool _objectFlag6, _objectFlag7, _objectFlag8;
void loadSprites();
@@ -114,9 +120,9 @@ private:
void animate3d();
- void setMonsters();
+ void setIndoorsMonsters();
- void setObjects();
+ void setIndoorObjects();
void setOutdoorsMonsters();
diff --git a/engines/xeen/map.h b/engines/xeen/map.h
index 1d11bdcfaa..30c2c643df 100644
--- a/engines/xeen/map.h
+++ b/engines/xeen/map.h
@@ -285,7 +285,6 @@ private:
XeenEngine *_vm;
MazeData _mazeData[9];
Common::String _mazeName;
- MonsterObjectData _mobData;
HeadData _headData;
SpriteResource _objPicSprites;
MonsterData _monsterData;
@@ -296,6 +295,7 @@ private:
bool _stepped;
public:
bool _isOutdoors;
+ MonsterObjectData _mobData;
public:
Map(XeenEngine *vm);
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index 3f59f3e1c9..35fa2cb2bf 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -303,4 +303,51 @@ 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 int INDOOR_OBJECT_X[2][12] = {
+ { 5, -7, -112, 98, -8, -65, 49, -9, -34, 16, -58, 40 },
+ { -35, -35, -142, 68, -35, -95, 19, -35, -62, -14, -98, 16 }
+};
+
+const int INDOOR_OBJECT_Y[2][12] = {
+ { 2, 25, 25, 25, 50, 50, 50, 58, 58, 58, 58, 58 },
+ { -65, -6, -6, -6, 36, 36, 36, 54, 54, 54, 54, 54 }
+};
+
+const int OUTDOOR_OBJECT_X[2][12] = {
+ { -5, -7, -112, 98, -8, -77, 61, -9, -43, 25, -74, 56 },
+ { -35, -35, -142, 68, -35, -95, 19, -35, -62, -24, -98, 16 }
+};
+
+const int OUTDOOR_OBJECT_Y[2][12] = {
+ { 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 69 },
+ { 70, 71, 72, 73, 74, 75, 90, 91, 92, 93, 94, 112 }
+};
+
} // End of namespace Xeen
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index 78104b233c..d8cc93b9f4 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -68,6 +68,16 @@ extern const char *const PLEASE_WAIT;
extern const char *const OOPS;
+extern const int8 SCREEN_POSITIONING[384];
+
+extern const int INDOOR_OBJECT_X[2][12];
+
+extern const int INDOOR_OBJECT_Y[2][12];
+
+extern const int OUTDOOR_OBJECT_X[2][12];
+
+extern const int OUTDOOR_OBJECT_Y[2][12];
+
} // End of namespace Xeen
#endif /* XEEN_RESOURCES_H */