aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2013-08-20 00:34:15 +0300
committerEugene Sandulenko2013-09-06 14:51:16 +0300
commit6ba453fa2a967f6081712efc5cb32c969b54472e (patch)
treeb87bdc9d76857d2d3af298f7e5c9abac952df4ac
parentf0795656929e09e74f85c427cbf506e35eefc44f (diff)
downloadscummvm-rg350-6ba453fa2a967f6081712efc5cb32c969b54472e.tar.gz
scummvm-rg350-6ba453fa2a967f6081712efc5cb32c969b54472e.tar.bz2
scummvm-rg350-6ba453fa2a967f6081712efc5cb32c969b54472e.zip
FULLPIPE: Fix number of bugs found by Coverity
-rw-r--r--engines/fullpipe/behavior.cpp7
-rw-r--r--engines/fullpipe/fullpipe.cpp27
-rw-r--r--engines/fullpipe/fullpipe.h4
-rw-r--r--engines/fullpipe/gfx.cpp11
-rw-r--r--engines/fullpipe/gfx.h4
-rw-r--r--engines/fullpipe/init.cpp12
-rw-r--r--engines/fullpipe/interaction.h1
-rw-r--r--engines/fullpipe/inventory.cpp8
-rw-r--r--engines/fullpipe/inventory.h5
-rw-r--r--engines/fullpipe/scene.cpp2
-rw-r--r--engines/fullpipe/scenes.cpp21
-rw-r--r--engines/fullpipe/scenes.h5
-rw-r--r--engines/fullpipe/stateloader.cpp2
-rw-r--r--engines/fullpipe/statics.cpp2
14 files changed, 72 insertions, 39 deletions
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp
index 2551133675..79ef86e8c5 100644
--- a/engines/fullpipe/behavior.cpp
+++ b/engines/fullpipe/behavior.cpp
@@ -300,11 +300,12 @@ BehaviorEntryInfo::BehaviorEntryInfo(CGameVar *subvar, Scene *sc, int *delay) {
if (vart)
_delay = vart->_value.intValue;
+ *delay = 0;
vart = subvar->getSubVarByName("dwPercent");
- if (vart)
+ if (vart) {
_percent = 0x7FFF * vart->_value.intValue / 1000;
-
- *delay = vart->_value.intValue;
+ *delay = vart->_value.intValue;
+ }
vart = subvar->getSubVarByName("dwFlags");
if (vart && vart->_varType == 2 && strstr(vart->_value.stringValue, "QDESC_AUTOSTART"))
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 740c2c2788..569958cf31 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -111,6 +111,29 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_cursorId = 0;
+ _keyState = Common::KEYCODE_INVALID;
+ _buttonState = 0;
+
+ _gameLoader = 0;
+ _gameProject = 0;
+
+ _updateFlag = true;
+ _flgCanOpenMap = true;
+
+ _sceneWidth = 1;
+ _sceneHeight = 1;
+
+ for (int i = 0; i < 11; i++)
+ _currSoundList1[i] = 0;
+
+ for (int i = 0; i < 200; i++)
+ _mapTable[i] = 0;
+
+ _inventoryScene = 0;
+ _inventory = 0;
+
+ _isSaveAllowed = true;
+
g_fullpipe = this;
g_vars = new Vars;
}
@@ -241,6 +264,7 @@ void FullpipeEngine::updateEvents() {
ex->handle();
break;
}
+ break;
case Common::EVENT_KEYUP:
if (!_inputArFlag) {
ex = new ExCommand(0, 17, 37, 0, 0, 0, 1, 0, 0, 0);
@@ -326,8 +350,7 @@ void FullpipeEngine::updateScreen() {
_modalObject->saveload();
CBaseModalObject *tmp = _modalObject->_parentObj;
- if (_modalObject)
- delete _modalObject;
+ delete _modalObject;
_modalObject = tmp;
}
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 404a70a7e1..69a1acc700 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -182,10 +182,6 @@ public:
void initCursors();
void addCursor(CursorInfo *cursorInfo, Scene *inv, int pictureId, int hotspotX, int hotspotY, int itemPictureOffsX, int itemPictureOffsY);
- CGameVar *_swallowedEgg1;
- CGameVar *_swallowedEgg2;
- CGameVar *_swallowedEgg3;
-
int32 _mapTable[200];
Scene *_inventoryScene;
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 63245a19e0..82014426c2 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -139,6 +139,9 @@ PictureObject::PictureObject() {
_ox = 0;
_oy = 0;
_picture = 0;
+ _ox2 = 0;
+ _oy2 = 0;
+ _pictureObject2List = 0;
}
PictureObject::PictureObject(PictureObject *src) : GameObject(src) {
@@ -237,7 +240,6 @@ GameObject::GameObject() {
_oy = 0;
_priority = 0;
_field_20 = 0;
- _field_6 = 0;
_field_8 = 0;
_objectName = 0;
}
@@ -257,6 +259,10 @@ GameObject::GameObject(GameObject *src) {
_field_8 = src->_field_8;
}
+GameObject::~GameObject() {
+ free(_objectName);
+}
+
bool GameObject::load(MfcArchive &file) {
debug(5, "GameObject::load()");
_okeyCode = 0;
@@ -309,6 +315,9 @@ Picture::Picture() {
_alpha = -1;
_paletteData = 0;
_convertedBitmap = 0;
+ _memoryObject2 = 0;
+ _width = 0;
+ _height = 0;
}
Picture::~Picture() {
diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h
index 45414eb331..18a48228e5 100644
--- a/engines/fullpipe/gfx.h
+++ b/engines/fullpipe/gfx.h
@@ -23,8 +23,6 @@
#ifndef FULLPIPE_GFX_H
#define FULLPIPE_GFX_H
-class Common::ReadStream;
-
namespace Fullpipe {
class DynamicPhase;
@@ -121,7 +119,6 @@ class BigPicture : public Picture {
class GameObject : public CObject {
public:
int16 _okeyCode;
- int16 _field_6;
int _field_8;
int16 _flags;
int16 _id;
@@ -134,6 +131,7 @@ class GameObject : public CObject {
public:
GameObject();
GameObject(GameObject *src);
+ ~GameObject();
virtual bool load(MfcArchive &file);
void setOXY(int x, int y);
diff --git a/engines/fullpipe/init.cpp b/engines/fullpipe/init.cpp
index f4a62aabb3..c334542247 100644
--- a/engines/fullpipe/init.cpp
+++ b/engines/fullpipe/init.cpp
@@ -139,18 +139,6 @@ void FullpipeEngine::setLevelStates() {
}
}
-void FullpipeEngine::setSwallowedEggsState() {
- CGameVar *v = _gameLoader->_gameVar->getSubVarByName("OBJSTATES")->getSubVarByName(sO_GulpedEggs);
-
- _swallowedEgg1 = v->getSubVarByName(sO_Egg1);
- _swallowedEgg2 = v->getSubVarByName(sO_Egg2);
- _swallowedEgg3 = v->getSubVarByName(sO_Egg3);
-
- _swallowedEgg1->_value.intValue = 0;
- _swallowedEgg2->_value.intValue = 0;
- _swallowedEgg3->_value.intValue = 0;
-}
-
void FullpipeEngine::addCursor(CursorInfo *cursorInfo, Scene *inv, int pictureId, int hotspotX, int hotspotY, int itemPictureOffsX, int itemPictureOffsY) {
cursorInfo->pictureId = pictureId;
cursorInfo->picture = inv->getPictureObjectById(pictureId, 0)->_picture;
diff --git a/engines/fullpipe/interaction.h b/engines/fullpipe/interaction.h
index 5931f1a388..f86e8e9405 100644
--- a/engines/fullpipe/interaction.h
+++ b/engines/fullpipe/interaction.h
@@ -39,7 +39,6 @@ class CInteraction : public CObject {
int16 _objectId3;
int16 _staticsId1;
int16 _staticsId2;
- int16 _field_E;
int _objectState1;
int _objectState2;
int _xOffs;
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index c45c66dc7e..8dc856e9c5 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -44,7 +44,7 @@ bool CInventory::load(MfcArchive &file) {
t->flags = file.readUint32LE();
t->field_C = 0;
t->field_A = -536;
- _itemsPool.push_back(*t);
+ _itemsPool.push_back(t);
}
return true;
@@ -55,7 +55,7 @@ int CInventory::getInventoryPoolItemIndexById(int itemId) {
return -1;
for (uint i = 0; i < _itemsPool.size(); i++) {
- if (_itemsPool[i].id == itemId)
+ if (_itemsPool[i]->id == itemId)
return i;
}
@@ -68,7 +68,7 @@ bool CInventory::setItemFlags(int itemId, int flags) {
if (idx < 0)
return false;
else
- _itemsPool[idx].flags = flags;
+ _itemsPool[idx]->flags = flags;
return true;
}
@@ -90,7 +90,7 @@ bool CInventory2::loadPartial(MfcArchive &file) { // CInventory2_SerializePartia
InventoryItem *t = new InventoryItem();
t->itemId = file.readUint16LE();
t->count = file.readUint16LE();
- _inventoryItems.push_back(*t);
+ _inventoryItems.push_back(t);
}
return true;
diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h
index accfb08afa..8b7c854e9a 100644
--- a/engines/fullpipe/inventory.h
+++ b/engines/fullpipe/inventory.h
@@ -41,12 +41,11 @@ struct InventoryPoolItem {
int flags;
};
-typedef Common::Array<InventoryPoolItem> InventoryPoolItems;
+typedef Common::Array<InventoryPoolItem *> InventoryPoolItems;
class CInventory : public CObject {
protected:
int16 _sceneId;
- int16 _field_6;
InventoryPoolItems _itemsPool;
public:
@@ -62,7 +61,7 @@ struct InventoryItem {
int16 count;
};
-typedef Common::Array<InventoryItem> InventoryItems;
+typedef Common::Array<InventoryItem *> InventoryItems;
class PictureObject;
diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp
index da89611c9b..8c53444b81 100644
--- a/engines/fullpipe/scene.cpp
+++ b/engines/fullpipe/scene.cpp
@@ -507,7 +507,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
bgNumX++;
if (bgNumX >= _bigPictureArray1Count) {
- if (!((PictureObject *)_picObjList[0])->_flags & 0x2)
+ if (!(((PictureObject *)_picObjList[0])->_flags & 0x2))
break;
bgNumX = 0;
}
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index 09fc158fa8..70b3dff51b 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -60,6 +60,13 @@ Vars::Vars() {
sceneIntro_skipIntro = true;
sceneIntro_playing = false;
sceneIntro_needBlackout = false;
+
+ swallowedEgg1 = 0;
+ swallowedEgg2 = 0;
+ swallowedEgg3 = 0;
+
+ scene01_picSc01Osk = 0;
+ scene01_picSc01Osk2 = 0;
}
bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
@@ -1141,6 +1148,18 @@ int sceneIntro_updateCursor() {
return 0;
}
+void FullpipeEngine::setSwallowedEggsState() {
+ CGameVar *v = _gameLoader->_gameVar->getSubVarByName("OBJSTATES")->getSubVarByName(sO_GulpedEggs);
+
+ g_vars->swallowedEgg1 = v->getSubVarByName(sO_Egg1);
+ g_vars->swallowedEgg2 = v->getSubVarByName(sO_Egg2);
+ g_vars->swallowedEgg3 = v->getSubVarByName(sO_Egg3);
+
+ g_vars->swallowedEgg1->_value.intValue = 0;
+ g_vars->swallowedEgg2->_value.intValue = 0;
+ g_vars->swallowedEgg3->_value.intValue = 0;
+}
+
void sceneIntro_initScene(Scene *sc) {
g_fullpipe->_gameLoader->loadScene(SC_INTRO2);
@@ -1169,8 +1188,6 @@ void scene01_fixEntrance() {
}
void scene01_initScene(Scene *sc, int entrance) {
- g_vars->scene01_unused = 0;
-
g_vars->scene01_picSc01Osk = sc->getPictureObjectById(PIC_SC1_OSK, 0);
g_vars->scene01_picSc01Osk->_flags &= 0xFFFB;
diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index da3ac5162c..ae5f2dafb1 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -31,6 +31,10 @@ class Vars {
public:
Vars();
+ CGameVar *swallowedEgg1;
+ CGameVar *swallowedEgg2;
+ CGameVar *swallowedEgg3;
+
StaticANIObject *sceneIntro_aniin1man;
bool sceneIntro_needSleep;
bool sceneIntro_needGetup;
@@ -38,7 +42,6 @@ class Vars {
bool sceneIntro_playing;
bool sceneIntro_needBlackout;
- int scene01_unused;
PictureObject *scene01_picSc01Osk;
PictureObject *scene01_picSc01Osk2;
};
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 97306c1815..40169ddf9f 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -370,7 +370,7 @@ bool Sc2::load(MfcArchive &file) {
debug(4, "_entranceData: %d", _entranceDataCount);
if (_entranceDataCount > 0) {
- _entranceData = (EntranceInfo **)malloc(_defPicAniInfosCount * sizeof(EntranceInfo *));
+ _entranceData = (EntranceInfo **)malloc(_entranceDataCount * sizeof(EntranceInfo *));
for (int i = 0; i < _entranceDataCount; i++) {
_entranceData[i] = new EntranceInfo();
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index ce782d1d48..3308b05e49 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -393,7 +393,7 @@ Statics *StaticANIObject::addReverseStatics(Statics *st) {
}
void StaticANIObject::draw() {
- if (_flags & 4 == 0)
+ if ((_flags & 4) == 0)
return;
Common::Point point;