aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/map_v4.cpp
diff options
context:
space:
mode:
authorSven Hesse2009-06-24 21:49:37 +0000
committerSven Hesse2009-06-24 21:49:37 +0000
commitd03dc08b64073044267fb4b3ca6704fd62a19741 (patch)
treeb614178e652348fe9072479254ca333825a28a05 /engines/gob/map_v4.cpp
parentef33f98a1a966b3956990414e62584ec371a550e (diff)
downloadscummvm-rg350-d03dc08b64073044267fb4b3ca6704fd62a19741.tar.gz
scummvm-rg350-d03dc08b64073044267fb4b3ca6704fd62a19741.tar.bz2
scummvm-rg350-d03dc08b64073044267fb4b3ca6704fd62a19741.zip
Wrapping resources (out of TOT, EXT, IM? and EX? files) loading into its own class
svn-id: r41839
Diffstat (limited to 'engines/gob/map_v4.cpp')
-rw-r--r--engines/gob/map_v4.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/engines/gob/map_v4.cpp b/engines/gob/map_v4.cpp
index 76492eae1b..1db3d6a3f8 100644
--- a/engines/gob/map_v4.cpp
+++ b/engines/gob/map_v4.cpp
@@ -32,6 +32,7 @@
#include "gob/inter.h"
#include "gob/game.h"
#include "gob/script.h"
+#include "gob/resources.h"
#include "gob/mult.h"
namespace Gob {
@@ -49,7 +50,6 @@ void Map_v4::loadMapObjects(const char *avjFile) {
int16 mapWidth, mapHeight;
int16 tmp;
byte *variables;
- byte *extData;
uint32 tmpPos;
uint32 passPos;
@@ -66,8 +66,11 @@ void Map_v4::loadMapObjects(const char *avjFile) {
return;
}
- extData = _vm->_game->loadExtData(id, 0, 0);
- Common::MemoryReadStream mapData(extData, 4294967295U);
+ Resource *resource = _vm->_game->_resources->getResource(id);
+ if (!resource)
+ return;
+
+ Common::SeekableReadStream &mapData = *resource->stream();
_widthByte = mapData.readByte();
if (_widthByte == 4) {
@@ -99,7 +102,7 @@ void Map_v4::loadMapObjects(const char *avjFile) {
passPos = mapData.pos();
mapData.skip(_mapWidth * _mapHeight);
- if (*extData == 1)
+ if (resource->getData()[0] == 1)
wayPointsCount = _wayPointsCount = 40;
else
wayPointsCount = _wayPointsCount == 0 ? 1 : _wayPointsCount;
@@ -150,7 +153,7 @@ void Map_v4::loadMapObjects(const char *avjFile) {
for (int i = 0; i < _vm->_goblin->_soundSlotsCount; i++)
_vm->_goblin->_soundSlots[i] = _vm->_inter->loadSound(1);
- delete[] extData;
+ delete resource;
}
} // End of namespace Gob