aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-13 19:30:03 -0500
committerPaul Gilbert2015-01-13 19:30:03 -0500
commita856e58ee41505db36e208389d5931952540ca84 (patch)
tree7e2a95aaacd84756043b67c857e292e410e65d59
parent1a0a597ff8c02d103d56968bfd18de1908e219d6 (diff)
downloadscummvm-rg350-a856e58ee41505db36e208389d5931952540ca84.tar.gz
scummvm-rg350-a856e58ee41505db36e208389d5931952540ca84.tar.bz2
scummvm-rg350-a856e58ee41505db36e208389d5931952540ca84.zip
XEEN: Added Combat class and further map loading sprite setting
-rw-r--r--engines/xeen/combat.cpp37
-rw-r--r--engines/xeen/combat.h48
-rw-r--r--engines/xeen/interface.h5
-rw-r--r--engines/xeen/map.cpp94
-rw-r--r--engines/xeen/map.h2
-rw-r--r--engines/xeen/resources.cpp2
-rw-r--r--engines/xeen/resources.h2
7 files changed, 180 insertions, 10 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
new file mode 100644
index 0000000000..f870083e6f
--- /dev/null
+++ b/engines/xeen/combat.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "xeen/combat.h"
+#include "common/algorithm.h"
+
+namespace Xeen {
+
+Combat::Combat(XeenEngine *vm): _vm(vm) {
+ _attackMon1 = _attackMon2 = _attackMon3 = 0;
+ Common::fill(&_charsArray1[0], &_charsArray1[12], 0);
+ Common::fill(&_monPow[0], &_monPow[12], 0);
+ Common::fill(&_monsterScale[0], &_monsterScale[12], 0);
+ Common::fill(&_elemPow[0], &_elemPow[12], 0);
+ Common::fill(&_elemScale[0], &_elemScale[12], 0);
+}
+
+} // End of namespace Xeen
diff --git a/engines/xeen/combat.h b/engines/xeen/combat.h
new file mode 100644
index 0000000000..3360bbdddf
--- /dev/null
+++ b/engines/xeen/combat.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef XEEN_COMBAT_H
+#define XEEN_COMBAT_H
+
+#include "common/scummsys.h"
+
+namespace Xeen {
+
+class XeenEngine;
+
+class Combat {
+private:
+ XeenEngine *_vm;
+public:
+ int _charsArray1[12];
+ bool _monPow[12];
+ int _monsterScale[12];
+ int _elemPow[12];
+ int _elemScale[12];
+ int _attackMon1, _attackMon2, _attackMon3;
+public:
+ Combat(XeenEngine *vm);
+};
+
+} // End of namespace Xeen
+
+#endif /* XEEN_COMBAT_H */
diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h
index 0c014f6032..498de3c195 100644
--- a/engines/xeen/interface.h
+++ b/engines/xeen/interface.h
@@ -98,8 +98,6 @@ private:
SpriteResource *_partyFaces[MAX_ACTIVE_PARTY];
DrawStruct _faceDrawStructs[4];
DrawStruct _mainList[16];
- OutdoorDrawList _outdoorList;
- IndoorDrawList _indoorList;
int _combatCharIds[8];
int _batUIFrame;
@@ -167,6 +165,9 @@ private:
void updateAutoMap();
public:
+ OutdoorDrawList _outdoorList;
+ IndoorDrawList _indoorList;
+public:
Interface(XeenEngine *vm);
void setup();
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp
index 07cb0d600d..1a01b441f6 100644
--- a/engines/xeen/map.cpp
+++ b/engines/xeen/map.cpp
@@ -22,6 +22,7 @@
#include "common/serializer.h"
#include "xeen/map.h"
+#include "xeen/interface.h"
#include "xeen/resources.h"
#include "xeen/saves.h"
#include "xeen/screen.h"
@@ -866,6 +867,9 @@ Map::Map(XeenEngine *vm) : _vm(vm), _mobData(vm) {
void Map::load(int mapId) {
Screen &screen = *_vm->_screen;
+ IndoorDrawList &indoorList = _vm->_interface->_indoorList;
+ OutdoorDrawList &outdoorList = _vm->_interface->_outdoorList;
+
if (_vm->_falling) {
Window &w = screen._windows[9];
w.open();
@@ -1010,8 +1014,9 @@ void Map::load(int mapId) {
// TODO: Switch setting flags that don't seem to ever be used
// Reload the monster data for the main maze that we're loading
+ mapId = _vm->_party._mazeId;
Common::String filename = Common::String::format("maze%c%03d.mob",
- (_vm->_party._mazeId >= 100) ? 'x' : '0', _vm->_party._mazeId);
+ (mapId >= 100) ? 'x' : '0', mapId);
File mobFile(filename, *_vm->_saves);
XeenSerializer sMob(&mobFile, nullptr);
_mobData.synchronize(sMob, _monsterData);
@@ -1020,9 +1025,9 @@ void Map::load(int mapId) {
// Load sprites for the objects
for (uint i = 0; i < _mobData._objectSprites.size(); ++i) {
if (_vm->_party._cloudsEnd && _mobData._objectSprites[i]._spriteId == 85 &&
- _vm->_party._mazeId == 27 && isDarkCc) {
+ mapId == 27 && isDarkCc) {
// TODO: Flags set that don't seem to be used
- } else if (_vm->_party._mazeId == 12 && _vm->_party._gameFlags[43] &&
+ } else if (mapId == 12 && _vm->_party._gameFlags[43] &&
_mobData._objectSprites[i]._spriteId == 118 && !isDarkCc) {
filename = "085.obj";
_mobData._objectSprites[0]._spriteId = 85;
@@ -1053,7 +1058,25 @@ void Map::load(int mapId) {
// Handle loading miscellaneous sprites for the map
if (_isOutdoors) {
- warning("TODO");
+ warning("TODO"); // Sound loading
+
+ _skySprites.load(isDarkCc ? "sky.sky" : "night.sky");
+ _groundSprites.load("water.out");
+ _tileSprites.load("outdoor.til");
+ outdoorList._skySprite._sprites = &_skySprites;
+ outdoorList._groundSprite._sprites = &_groundSprites;
+
+ for (int i = 0; i < TOTAL_SURFACES; ++i) {
+ _wallSprites._surfaces[i].clear();
+ if (_mazeData[0]._wallTypes[i] != 0) {
+ _wallSprites._surfaces[i].load(Common::String::format("%s.wal",
+ SURFACE_TYPE_NAMES[i]));
+ }
+
+ _surfaceSprites[i].clear();
+ if (i != 0 && _mazeData[0]._wallTypes[i] != 0)
+ _surfaceSprites[i].load(OUTDOOR_SURFACES[_mazeData[0]._surfaceTypes[i]]);
+ }
} else {
warning("TODO"); // Sound loading
@@ -1072,7 +1095,7 @@ void Map::load(int mapId) {
_surfaceSprites[i].load(OUTDOOR_SURFACES[i]);
}
- _wallSprites._wal.clear();
+ _wallSprites._surfaces[0].clear();
Common::String fwlName = Common::String::format("%s.til",
TERRAIN_TYPES[_mazeData[0]._wallKind]);
_wallSprites._fwl1.load(fwlName);
@@ -1082,7 +1105,68 @@ void Map::load(int mapId) {
_wallSprites._swl.load(Common::String::format("s%s.swl",
TERRAIN_TYPES[_mazeData[0]._wallKind]));
+ // Set entries in the indoor draw list to the correct sprites
+ // for drawing various parts of the background
+ indoorList._swl_0F1R._sprites = &_wallSprites._swl;
+ indoorList._swl_0F1L._sprites = &_wallSprites._swl;
+ indoorList._swl_1F1R._sprites = &_wallSprites._swl;
+ indoorList._swl_1F1L._sprites = &_wallSprites._swl;
+ indoorList._swl_2F2R._sprites = &_wallSprites._swl;
+ indoorList._swl_2F1R._sprites = &_wallSprites._swl;
+ indoorList._swl_2F1L._sprites = &_wallSprites._swl;
+ indoorList._swl_2F2L._sprites = &_wallSprites._swl;
+
+ indoorList._swl_3F1R._sprites = &_wallSprites._swl;
+ indoorList._swl_3F2R._sprites = &_wallSprites._swl;
+ indoorList._swl_3F3R._sprites = &_wallSprites._swl;
+ indoorList._swl_3F4R._sprites = &_wallSprites._swl;
+ indoorList._swl_3F1L._sprites = &_wallSprites._swl;
+ indoorList._swl_3F2L._sprites = &_wallSprites._swl;
+ indoorList._swl_3F3L._sprites = &_wallSprites._swl;
+ indoorList._swl_3F4L._sprites = &_wallSprites._swl;
+
+ indoorList._swl_4F4R._sprites = &_wallSprites._swl;
+ indoorList._swl_4F3R._sprites = &_wallSprites._swl;
+ indoorList._swl_4F2R._sprites = &_wallSprites._swl;
+ indoorList._swl_4F1R._sprites = &_wallSprites._swl;
+ indoorList._swl_4F1L._sprites = &_wallSprites._swl;
+ indoorList._swl_4F2L._sprites = &_wallSprites._swl;
+ indoorList._swl_4F3L._sprites = &_wallSprites._swl;
+ indoorList._swl_4F4L._sprites = &_wallSprites._swl;
+
+ indoorList._fwl_4F4R._sprites = &_wallSprites._fwl4;
+ indoorList._fwl_4F3R._sprites = &_wallSprites._fwl4;
+ indoorList._fwl_4F2R._sprites = &_wallSprites._fwl4;
+ indoorList._fwl_4F1R._sprites = &_wallSprites._fwl4;
+ indoorList._fwl_4F._sprites = &_wallSprites._fwl4;
+ indoorList._fwl_4F1L._sprites = &_wallSprites._fwl4;
+ indoorList._fwl_4F2L._sprites = &_wallSprites._fwl4;
+ indoorList._fwl_4F3L._sprites = &_wallSprites._fwl4;
+ indoorList._fwl_4F4L._sprites = &_wallSprites._fwl4;
+
+ indoorList._fwl_2F1R._sprites = &_wallSprites._fwl3;
+ indoorList._fwl_2F._sprites = &_wallSprites._fwl3;
+ indoorList._fwl_2F1L._sprites = &_wallSprites._fwl3;
+ indoorList._fwl_3F2R._sprites = &_wallSprites._fwl3;
+ indoorList._fwl_3F1R._sprites = &_wallSprites._fwl3;
+ indoorList._fwl_3F._sprites = &_wallSprites._fwl3;
+ indoorList._fwl_3F1L._sprites = &_wallSprites._fwl3;
+ indoorList._fwl_3F2L._sprites = &_wallSprites._fwl3;
+
+ indoorList._fwl_1F._sprites = &_wallSprites._fwl1;
+ indoorList._fwl_1F1R._sprites = &_wallSprites._fwl1;
+ indoorList._fwl_1F1L._sprites = &_wallSprites._fwl1;
+
+ indoorList._horizon._sprites = &_groundSprites;
+ // Down show horizon for certain maps
+ if (_vm->_files->_isDarkCc) {
+ if ((mapId >= 89 && mapId <= 112) || mapId == 128 || mapId == 129)
+ indoorList._horizon._sprites = nullptr;
+ } else {
+ if (mapId >= 25 && mapId <= 27)
+ indoorList._horizon._sprites = nullptr;
+ }
}
}
diff --git a/engines/xeen/map.h b/engines/xeen/map.h
index d697243e0d..37eba7074c 100644
--- a/engines/xeen/map.h
+++ b/engines/xeen/map.h
@@ -271,7 +271,7 @@ public:
};
struct WallSprites {
- SpriteResource _wal;
+ SpriteResource _surfaces[TOTAL_SURFACES];
SpriteResource _fwl1;
SpriteResource _fwl2;
SpriteResource _fwl3;
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index d0f5d6a351..5740a419bd 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -70,7 +70,7 @@ const char *const TERRAIN_TYPES[6] = {
"town", "cave", "towr", "cstl", "dung", "scfi"
};
-const char *const OUTDOOR_WALLS[15] = {
+const char *const SURFACE_TYPE_NAMES[15] = {
nullptr, "mount", "ltree", "dtree", "grass", "snotree", "snomnt",
"dedltree", "mount", "lavamnt", "palm", "dmount", "dedltree",
"dedltree", "dedltree"
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index dbb00036ff..71ac91f641 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -34,7 +34,7 @@ extern const char *const OPTIONS_TITLE;
extern const char *const TERRAIN_TYPES[6];
-extern const char *const OUTDOOR_WALLS[15];
+extern const char *const SURFACE_TYPE_NAMES[15];
extern const char *const OUTDOOR_SURFACES[16];