diff options
author | Filippos Karapetis | 2008-04-20 14:43:56 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-04-20 14:43:56 +0000 |
commit | d0590a09eac68d5cde64d37fb2e5bbd1471a676a (patch) | |
tree | 3e29857746449aaea4c9834bedad0d18ce487ff7 /engines/made/database.h | |
parent | d484c7ed434e9f8e8267049fccbe3dbb5c39fe0b (diff) | |
download | scummvm-rg350-d0590a09eac68d5cde64d37fb2e5bbd1471a676a.tar.gz scummvm-rg350-d0590a09eac68d5cde64d37fb2e5bbd1471a676a.tar.bz2 scummvm-rg350-d0590a09eac68d5cde64d37fb2e5bbd1471a676a.zip |
Initial import of the work in progress MADE engine
svn-id: r31599
Diffstat (limited to 'engines/made/database.h')
-rw-r--r-- | engines/made/database.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/engines/made/database.h b/engines/made/database.h new file mode 100644 index 0000000000..d5468db607 --- /dev/null +++ b/engines/made/database.h @@ -0,0 +1,105 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#ifndef MADE_DATABASE_H +#define MADE_DATABASE_H + +#include "common/array.h" +#include "common/util.h" +#include "common/file.h" +#include "common/stream.h" + +namespace Made { + +class Object { +public: + Object(); + ~Object(); + void load(Common::SeekableReadStream &source); + void load(byte *source); + + uint16 getFlags() const; + uint16 getClass() const; + uint16 getSize() const; + + byte getCount1() const; + byte getCount2() const; + + byte *getData(); + const char *getString(); + + bool isObject(); + bool isVector(); + bool isConstant() const { return !(getFlags() & 1); } + + int16 getVectorSize(); + int16 getVectorItem(int16 index); + void setVectorItem(int16 index, int16 value); + + void dump(const char *filename); + +protected: + bool _freeData; + uint16 _objSize; + byte *_objData; +}; + +class GameDatabase { +public: + + GameDatabase(); + ~GameDatabase(); + + void open(const char *filename); + + Object *getObject(int16 index) const { + if (index >= 1) + return _objects[index - 1]; + else + return NULL; + } + + int16 getMainCodeObjectIndex() const { return _mainCodeObjectIndex; } + + int16 getVar(int16 index); + void setVar(int16 index, int16 value); + + int16 *getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag); + int16 getObjectProperty(int16 objectIndex, int16 propertyId); + int16 setObjectProperty(int16 objectIndex, int16 propertyId, int16 value); + + void dumpObject(int16 index); + +protected: + Common::File _fd; + Common::Array<Object*> _objects; + byte *_gameState; + uint32 _gameStateSize; + int16 _mainCodeObjectIndex; +}; + +} // End of namespace Made + +#endif /* MADE_H */ |