Skip to content

Commit

Permalink
FULLPIPE: Further work on sceneSwitcher()
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Sep 6, 2013
1 parent 3ab56b0 commit c76bec2
Show file tree
Hide file tree
Showing 15 changed files with 396 additions and 167 deletions.
14 changes: 13 additions & 1 deletion engines/fullpipe/fullpipe.cpp
Expand Up @@ -30,6 +30,7 @@
#include "fullpipe/fullpipe.h"
#include "fullpipe/objectnames.h"
#include "fullpipe/objects.h"
#include "fullpipe/messagequeue.h"

namespace Fullpipe {

Expand Down Expand Up @@ -58,21 +59,32 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)

_needQuit = false;

_aniMan = 0;
_scene2 = 0;

_globalMessageQueueList = 0;

g_fullpipe = this;
}

FullpipeEngine::~FullpipeEngine() {
delete _rnd;
delete _globalMessageQueueList;
}

Common::Error FullpipeEngine::run() {
void FullpipeEngine::initialize() {
_globalMessageQueueList = new GlobalMessageQueueList;
}

Common::Error FullpipeEngine::run() {
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
// Initialize backend
initGraphics(800, 600, true, &format);

_backgroundSurface.create(800, 600, format);

initialize();

_isSaveAllowed = false;

loadGam("fullpipe.gam");
Expand Down
8 changes: 8 additions & 0 deletions engines/fullpipe/fullpipe.h
Expand Up @@ -49,6 +49,8 @@ class CGameVar;
class CInventory2;
class Scene;
class NGIArchive;
class StaticANIObject;
class GlobalMessageQueueList;

class FullpipeEngine : public ::Engine {
protected:
Expand All @@ -59,6 +61,8 @@ class FullpipeEngine : public ::Engine {
FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc);
virtual ~FullpipeEngine();

void initialize();

// Detection related functions
const ADGameDescription *_gameDescription;
const char *getGameId() const;
Expand Down Expand Up @@ -87,6 +91,10 @@ class FullpipeEngine : public ::Engine {
bool _flgSoundList;

Common::Rect _sceneRect;
Scene *_scene2;
StaticANIObject *_aniMan;

GlobalMessageQueueList *_globalMessageQueueList;

bool _needQuit;

Expand Down
13 changes: 13 additions & 0 deletions engines/fullpipe/gfx.cpp
Expand Up @@ -162,6 +162,12 @@ bool PictureObject::load(MfcArchive &file, bool bigPicture) {
return true;
}

Common::Point *PictureObject::getDimensions(Common::Point *p) {
_picture->getDimensions(p);

return p;
}

GameObject::GameObject() {
_field_4 = 0;
_flags = 0;
Expand Down Expand Up @@ -273,6 +279,13 @@ void Picture::init() {
_bitmap->_flags |= 0x1000000;
}

Common::Point *Picture::getDimensions(Common::Point *p) {
p->x = _width;
p->y = _height;

return p;
}

void Picture::getDibInfo() {
int off = _dataSize & ~0xf;

Expand Down
3 changes: 3 additions & 0 deletions engines/fullpipe/gfx.h
Expand Up @@ -82,6 +82,8 @@ class Picture : public MemoryObject {

byte getAlpha() { return (byte)_alpha; }
void setAlpha(byte alpha) { _alpha = alpha; }

Common::Point *getDimensions(Common::Point *p);
};

class BigPicture : public Picture {
Expand Down Expand Up @@ -118,6 +120,7 @@ class PictureObject : public GameObject {
public:
PictureObject();
bool load(MfcArchive &file, bool bigPicture);
Common::Point *getDimensions(Common::Point *p);
};

class Background : public CObject {
Expand Down
90 changes: 90 additions & 0 deletions engines/fullpipe/messagequeue.cpp
@@ -0,0 +1,90 @@
/* 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 "fullpipe/fullpipe.h"

#include "fullpipe/objects.h"
#include "fullpipe/messagequeue.h"

namespace Fullpipe {

MessageQueue::MessageQueue() {
_field_14 = 0;
_parId = 0;
_dataId = 0;
_id = 0;
_isFinished = 0;
_flags = 0;
}

bool MessageQueue::load(MfcArchive &file) {
debug(5, "MessageQueue::load()");

_dataId = file.readUint16LE();

int count = file.readUint16LE();

assert(g_fullpipe->_gameProjectVersion >= 12);

_queueName = file.readPascalString();

for (int i = 0; i < count; i++) {
CObject *tmp = file.readClass();

_exCommands.push_back(tmp);
}

_id = -1;
_field_14 = 0;
_parId = 0;
_isFinished = 0;

return true;
}

MessageQueue *GlobalMessageQueueList::getMessageQueueById(int id) {
for (CPtrList::iterator s = begin(); s != end(); ++s) {
if (((MessageQueue *)s)->_id == id)
return (MessageQueue *)s;
}

return 0;
}

void GlobalMessageQueueList::deleteQueueById(int id) {
for (uint i = 0; i < size(); i++)
if (((MessageQueue *)((*this).operator[](i)))->_id == id) {
delete (MessageQueue *)remove_at(i);

disableQueueById(id);
return;
}
}

void GlobalMessageQueueList::disableQueueById(int id) {
for (CPtrList::iterator s = begin(); s != end(); ++s) {
if (((MessageQueue *)s)->_parId == id)
((MessageQueue *)s)->_parId = 0;
}
}

} // End of namespace Fullpipe
67 changes: 67 additions & 0 deletions engines/fullpipe/messagequeue.h
@@ -0,0 +1,67 @@
/* 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 FULLPIPE_MESSAGEQUEUE_H
#define FULLPIPE_MESSAGEQUEUE_H

#include "fullpipe/utils.h"
#include "fullpipe/inventory.h"
#include "fullpipe/gfx.h"
#include "fullpipe/sound.h"
#include "fullpipe/scene.h"

namespace Fullpipe {

class MessageQueue : public CObject {
friend class GlobalMessageQueueList;

protected:
int _id;
int _flags;
char *_queueName;
int16 _dataId;
int16 _field_12;
int _field_14;
CPtrList _exCommands;
int _counter;
int _field_38;
int _isFinished;
int _parId;
int _flag1;

public:
MessageQueue();
virtual bool load(MfcArchive &file);

int getFlags() { return _flags; }
};

class GlobalMessageQueueList : public CPtrList {
public:
MessageQueue *getMessageQueueById(int id);
void deleteQueueById(int id);
void disableQueueById(int id);
};

} // End of namespace Fullpipe

#endif /* FULLPIPE_MESSAGEQUEUE_H */
1 change: 1 addition & 0 deletions engines/fullpipe/module.mk
Expand Up @@ -5,6 +5,7 @@ MODULE_OBJS = \
fullpipe.o \
gfx.o \
inventory.o \
messagequeue.o \
motion.o \
ngiarchive.o \
scene.o \
Expand Down
21 changes: 2 additions & 19 deletions engines/fullpipe/objects.h
Expand Up @@ -31,6 +31,8 @@

namespace Fullpipe {

class MessageQueue;

class GameProject : public CObject {
public:
int _field_4;
Expand All @@ -44,25 +46,6 @@ class GameProject : public CObject {
virtual bool load(MfcArchive &file);
};

class MessageQueue : public CObject {
int _id;
int _flags;
char *_queueName;
int16 _dataId;
int16 _field_12;
int _field_14;
CPtrList _exCommands;
int _counter;
int _field_38;
int _isFinished;
int _parId;
int _flag1;

public:
MessageQueue();
virtual bool load(MfcArchive &file);
};

class CInteraction : public CObject {
int16 _objectId1;
int16 _objectId2;
Expand Down
38 changes: 37 additions & 1 deletion engines/fullpipe/scene.cpp
Expand Up @@ -25,6 +25,9 @@
#include "fullpipe/objects.h"
#include "fullpipe/ngiarchive.h"
#include "fullpipe/statics.h"
#include "fullpipe/messagequeue.h"

#include "fullpipe/gameobj.h"

namespace Fullpipe {

Expand Down Expand Up @@ -234,6 +237,38 @@ void Scene::init() {
warning("STUB: Scene::init()");
}

StaticANIObject *Scene::getAniMan() {
StaticANIObject *aniMan = getStaticANIObject1ById(ANI_MAN, -1);

deleteStaticANIObject(aniMan);

return aniMan;
}

StaticANIObject *Scene::getStaticANIObject1ById(int obj, int a3) {
for (CPtrList::iterator s = _staticANIObjectList1.begin(); s != _staticANIObjectList1.end(); ++s) {
StaticANIObject *o = (StaticANIObject *)s;
if (o->_id == obj && (a3 == -1 || o->_field_4 == a3))
return o;
}

return 0;
}

void Scene::deleteStaticANIObject(StaticANIObject *obj) {
for (uint n = 0; n < _staticANIObjectList1.size(); n++)
if ((StaticANIObject *)_staticANIObjectList1[n] == obj) {
_staticANIObjectList1.remove_at(n);
break;
}

for (uint n = 0; n < _staticANIObjectList2.size(); n++)
if ((StaticANIObject *)_staticANIObjectList2[n] == obj) {
_staticANIObjectList2.remove_at(n);
break;
}
}

void Scene::draw(int par) {
updateScrolling(par);

Expand All @@ -257,9 +292,10 @@ void Scene::draw(int par) {
}

void Scene::updateScrolling(int par) {
warning("STUB Scene::updateScrolling()");
}

void Scene::drawContent(int minPri, int maxPri, bool drawBG) {
void Scene::drawContent(int minPri, int maxPri, bool drawBg) {
if (!_picObjList.size() && !_bigPictureArray1Count)
return;

Expand Down
3 changes: 3 additions & 0 deletions engines/fullpipe/scene.h
Expand Up @@ -45,6 +45,9 @@ class Scene : public Background {
void draw(int par);
void drawContent(int minPri, int maxPri, bool drawBG);
void updateScrolling(int par);
StaticANIObject *getAniMan();
StaticANIObject *getStaticANIObject1ById(int obj, int a3);
void deleteStaticANIObject(StaticANIObject * obj);
};

class SceneTag : public CObject {
Expand Down

0 comments on commit c76bec2

Please sign in to comment.