aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2007-02-17 09:56:09 +0000
committerSven Hesse2007-02-17 09:56:09 +0000
commit5df29654fc09e882e3581ff3ddfadaceb6e79e43 (patch)
tree5bdd4a1350d4020186ab79123d37768c64b8c1eb
parent546758a086eb711b7f91a2ac644f0df415d18c3e (diff)
downloadscummvm-rg350-5df29654fc09e882e3581ff3ddfadaceb6e79e43.tar.gz
scummvm-rg350-5df29654fc09e882e3581ff3ddfadaceb6e79e43.tar.bz2
scummvm-rg350-5df29654fc09e882e3581ff3ddfadaceb6e79e43.zip
- Added a warning when o1_checkData()/o2_checkData() can't find the file it's supposed to check
- Fixed the actor drawn over the background glitch in Bargon Attack - Plugged some leaks svn-id: r25651
-rw-r--r--engines/gob/gob.cpp3
-rw-r--r--engines/gob/inter_v1.cpp2
-rw-r--r--engines/gob/inter_v2.cpp4
-rw-r--r--engines/gob/map.cpp14
-rw-r--r--engines/gob/map.h5
-rw-r--r--engines/gob/map_v1.cpp23
-rw-r--r--engines/gob/map_v2.cpp8
-rw-r--r--engines/gob/mult.cpp19
-rw-r--r--engines/gob/mult.h2
-rw-r--r--engines/gob/mult_v1.cpp2
-rw-r--r--engines/gob/mult_v2.cpp9
-rw-r--r--engines/gob/scenery.cpp4
-rw-r--r--engines/gob/sound.cpp1
13 files changed, 66 insertions, 30 deletions
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index f06ab17c14..f1fcb47239 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -625,6 +625,7 @@ int GobEngine::init() {
}
else
error("GobEngine::init(): Unknown version of game engine");
+
_noMusic = MidiDriver::parseMusicDriver(ConfMan.get("music_driver")) == MD_NULL;
if (!_noMusic && !(_platform == Common::kPlatformAmiga) &&
!(_platform == Common::kPlatformAtariST) &&
@@ -633,6 +634,8 @@ int GobEngine::init() {
_adlib = new Adlib(this);
_vm = this;
+ _map->init();
+
_system->beginGFXTransaction();
initCommonGFX(false);
_system->initSize(320, 200);
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 7e066cc1b7..c6e898f3a3 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -1044,6 +1044,8 @@ bool Inter_v1::o1_checkData(char &cmdCount, int16 &counter, int16 &retFlag) {
WRITE_VAR_OFFSET(varOff, handle);
if (handle >= 0)
_vm->_dataio->closeData(handle);
+ else
+ warning("File \"%s\" not found", _vm->_global->_inter_resStr);
return false;
}
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index bd43ff5a23..cb973290aa 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -1465,8 +1465,10 @@ bool Inter_v2::o2_checkData(char &cmdCount, int16 &counter, int16 &retFlag) {
if (handle >= 0) {
_vm->_dataio->closeData(handle);
size = _vm->_dataio->getDataSize(_vm->_global->_inter_resStr);
- } else
+ } else {
size = -1;
+ warning("File \"%s\" not found", _vm->_global->_inter_resStr);
+ }
}
if (size == -1)
handle = -1;
diff --git a/engines/gob/map.cpp b/engines/gob/map.cpp
index b58ff5ec6a..ba6308e17a 100644
--- a/engines/gob/map.cpp
+++ b/engines/gob/map.cpp
@@ -70,6 +70,20 @@ Map::Map(GobEngine *vm) : _vm(vm) {
_avoDataPtr = 0;
}
+Map::~Map() {
+ if (_passMap)
+ delete[] _passMap;
+
+ if (_itemsMap) {
+ for (int i = 0; i < _mapHeight; i++)
+ delete[] _itemsMap[i];
+ delete[] _itemsMap;
+ }
+
+ if (_wayPoints)
+ delete[] _wayPoints;
+}
+
void Map::placeItem(int16 x, int16 y, int16 id) {
if ((_itemsMap[y][x] & 0xff00) != 0)
_itemsMap[y][x] = (_itemsMap[y][x] & 0xff00) | id;
diff --git a/engines/gob/map.h b/engines/gob/map.h
index 41c81e3ef2..1737c1d601 100644
--- a/engines/gob/map.h
+++ b/engines/gob/map.h
@@ -102,8 +102,9 @@ public:
virtual void findNearestToDest(Mult::Mult_Object *obj) = 0;
virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y) = 0;
+ virtual void init(void) = 0;
Map(GobEngine *vm);
- virtual ~Map() {};
+ virtual ~Map();
protected:
char *_avoDataPtr;
@@ -128,6 +129,7 @@ public:
_passMap[y * _mapWidth + x] = pass;
}
+ virtual void init(void);
Map_v1(GobEngine *vm);
virtual ~Map_v1();
};
@@ -151,6 +153,7 @@ public:
_passMap[y * heightOff + x] = pass;
}
+ virtual void init(void);
Map_v2(GobEngine *vm);
virtual ~Map_v2();
};
diff --git a/engines/gob/map_v1.cpp b/engines/gob/map_v1.cpp
index 892b848ef6..69b2b5f862 100644
--- a/engines/gob/map_v1.cpp
+++ b/engines/gob/map_v1.cpp
@@ -35,6 +35,12 @@
namespace Gob {
Map_v1::Map_v1(GobEngine *vm) : Map(vm) {
+}
+
+Map_v1::~Map_v1() {
+}
+
+void Map_v1::init(void) {
int i;
int j;
@@ -60,23 +66,6 @@ Map_v1::Map_v1(GobEngine *vm) : Map(vm) {
}
}
-Map_v1::~Map_v1() {
- int i;
-
- _mapWidth = 26;
- _mapHeight = 28;
-
- if (_passMap)
- delete[] _passMap;
- if (_itemsMap) {
- for (i = 0; i < _mapHeight; i++)
- delete[] _itemsMap[i];
- delete[] _itemsMap;
- }
- if (_wayPoints)
- delete[] _wayPoints;
-}
-
void Map_v1::loadMapObjects(char *avjFile) {
int16 i;
char avoName[128];
diff --git a/engines/gob/map_v2.cpp b/engines/gob/map_v2.cpp
index a9b7aca5fe..0aeae7b598 100644
--- a/engines/gob/map_v2.cpp
+++ b/engines/gob/map_v2.cpp
@@ -45,6 +45,9 @@ Map_v2::~Map_v2() {
_passMap = 0;
}
+void Map_v2::init(void) {
+}
+
void Map_v2::loadMapObjects(char *avjFile) {
int i;
int j;
@@ -103,6 +106,9 @@ void Map_v2::loadMapObjects(char *avjFile) {
else
wayPointsCount = _wayPointsCount == 0 ? 1 : _wayPointsCount;
+ if (_wayPoints)
+ delete[] _wayPoints;
+
_wayPoints = new Point[wayPointsCount];
for (i = 0; i < _wayPointsCount; i++) {
_wayPoints[i].x = mapData.readSByte();
@@ -182,6 +188,8 @@ void Map_v2::loadMapObjects(char *avjFile) {
_vm->_goblin->_soundSlotsCount = _vm->_inter->load16();
for (i = 0; i < _vm->_goblin->_soundSlotsCount; i++)
_vm->_goblin->_soundSlots[i] = _vm->_inter->loadSound(1);
+
+ delete[] extData;
}
void Map_v2::findNearestToGob(Mult::Mult_Object *obj) {
diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp
index b3650e423d..8991494e7f 100644
--- a/engines/gob/mult.cpp
+++ b/engines/gob/mult.cpp
@@ -90,6 +90,25 @@ Mult::Mult(GobEngine *vm) : _vm(vm) {
_orderArray = 0;
}
+Mult::~Mult() {
+ if (_objects)
+ delete[] _objects;
+ if (_orderArray)
+ delete[] _orderArray;
+ if (_renderData)
+ delete[] _renderData;
+ if (_renderData2)
+ delete[] _renderData2;
+ if (_multData)
+ delete _multData;
+ if (_animArrayX)
+ delete[] _animArrayX;
+ if (_animArrayY)
+ delete[] _animArrayY;
+ if (_animArrayData)
+ delete[] _animArrayData;
+}
+
void Mult::freeAll(void) {
int16 i;
diff --git a/engines/gob/mult.h b/engines/gob/mult.h
index 3912e53f51..a3011d7c35 100644
--- a/engines/gob/mult.h
+++ b/engines/gob/mult.h
@@ -271,7 +271,7 @@ public:
virtual void freeMultKeys(void) = 0;
Mult(GobEngine *vm);
- virtual ~Mult() {};
+ virtual ~Mult();
protected:
Video::Color _fadePal[5][16];
diff --git a/engines/gob/mult_v1.cpp b/engines/gob/mult_v1.cpp
index 40ed42dfce..70cf861fd4 100644
--- a/engines/gob/mult_v1.cpp
+++ b/engines/gob/mult_v1.cpp
@@ -183,6 +183,8 @@ void Mult_v1::loadMult(int16 resId) {
break;
}
}
+
+ delete[] extData;
}
void Mult_v1::setMultData(uint16 multindex) {
diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp
index 56f96f4d97..4a0e4fcfd6 100644
--- a/engines/gob/mult_v2.cpp
+++ b/engines/gob/mult_v2.cpp
@@ -49,18 +49,11 @@ Mult_v2::Mult_v2(GobEngine *vm) : Mult_v1(vm) {
}
Mult_v2::~Mult_v2() {
- int i;
-
freeMultKeys();
- for (i = 0; i < 8; i++) {
+ for (int i = 0; i < 8; i++) {
_multData = _multDatas[i];
freeMultKeys();
}
-
- if (_orderArray)
- delete[] _orderArray;
- if (_renderData2)
- delete[] _renderData2;
}
void Mult_v2::loadMult(int16 resId) {
diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp
index f15c25d30a..74fa602161 100644
--- a/engines/gob/scenery.cpp
+++ b/engines/gob/scenery.cpp
@@ -257,7 +257,7 @@ void Scenery::renderStatic(int16 scenery, int16 layer) {
}
planeCount = layerPtr->planeCount;
- for (order = 0; order < 10; order++) {
+ for (order = 0; order < 40; order++) {
for (plane = 0, planePtr = layerPtr->planes;
plane < planeCount; plane++, planePtr++) {
if (planePtr->drawOrder != order)
@@ -312,7 +312,7 @@ void Scenery::updateStatic(int16 orderFrom) {
planeCount = layerPtr->planeCount;
- for (order = orderFrom; order < 10; order++) {
+ for (order = orderFrom; order < 40; order++) {
for (planePtr = layerPtr->planes, plane = 0;
plane < planeCount; plane++, planePtr++) {
if (planePtr->drawOrder != order)
diff --git a/engines/gob/sound.cpp b/engines/gob/sound.cpp
index fd8d7488cb..a213d540b3 100644
--- a/engines/gob/sound.cpp
+++ b/engines/gob/sound.cpp
@@ -98,6 +98,7 @@ int Snd::SquareWaveStream::readBuffer(int16 *buffer, const int numSamples) {
Snd::Snd(GobEngine *vm) : _vm(vm) {
_cleanupFunc = 0;
_playingSound = 0;
+ _curSoundDesc = 0;
_rate = _vm->_mixer->getOutputRate();
_end = true;