2013-06-04 20:24:40 +00:00
|
|
|
/* 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.
|
2014-02-18 01:34:20 +00:00
|
|
|
*
|
2013-06-04 20:24:40 +00:00
|
|
|
* 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.
|
2014-02-18 01:34:20 +00:00
|
|
|
*
|
2013-06-04 20:24:40 +00:00
|
|
|
* 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_UTILS_H
|
|
|
|
#define FULLPIPE_UTILS_H
|
|
|
|
|
2013-06-07 20:56:40 +00:00
|
|
|
#include "common/hash-str.h"
|
|
|
|
#include "common/array.h"
|
2013-06-19 18:46:25 +00:00
|
|
|
#include "common/file.h"
|
2013-06-07 20:56:40 +00:00
|
|
|
|
2013-06-04 20:24:40 +00:00
|
|
|
namespace Fullpipe {
|
|
|
|
|
2013-06-06 21:49:50 +00:00
|
|
|
class CObject;
|
2013-06-22 01:30:38 +00:00
|
|
|
class NGIArchive;
|
2013-06-06 21:49:50 +00:00
|
|
|
|
2013-06-07 20:56:40 +00:00
|
|
|
typedef Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ClassMap;
|
|
|
|
|
2013-06-20 21:21:37 +00:00
|
|
|
class MfcArchive : public Common::SeekableReadStream {
|
2013-06-07 20:56:40 +00:00
|
|
|
ClassMap _classMap;
|
2013-06-10 22:17:11 +00:00
|
|
|
Common::Array<CObject *> _objectMap;
|
|
|
|
Common::Array<int> _objectIdMap;
|
2013-06-07 20:56:40 +00:00
|
|
|
|
|
|
|
int _lastIndex;
|
2013-06-10 22:34:37 +00:00
|
|
|
int _level;
|
2013-06-07 20:56:40 +00:00
|
|
|
|
2013-06-20 21:21:37 +00:00
|
|
|
Common::SeekableReadStream *_stream;
|
|
|
|
|
2013-06-07 20:56:40 +00:00
|
|
|
public:
|
2013-06-20 21:21:37 +00:00
|
|
|
MfcArchive(Common::SeekableReadStream *file);
|
2013-06-07 20:56:40 +00:00
|
|
|
|
2013-06-08 14:05:51 +00:00
|
|
|
char *readPascalString(bool twoByte = false);
|
2013-06-07 20:56:40 +00:00
|
|
|
int readCount();
|
2013-06-16 13:10:46 +00:00
|
|
|
double readDouble();
|
2013-06-10 22:17:11 +00:00
|
|
|
CObject *parseClass(bool *isCopyReturned);
|
2013-06-09 22:03:15 +00:00
|
|
|
CObject *readClass();
|
2013-06-10 22:34:37 +00:00
|
|
|
|
|
|
|
void incLevel() { _level++; }
|
|
|
|
void decLevel() { _level--; }
|
|
|
|
int getLevel() { return _level; }
|
2013-06-20 21:21:37 +00:00
|
|
|
|
|
|
|
virtual bool eos() const { return _stream->eos(); }
|
|
|
|
virtual uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); }
|
|
|
|
virtual int32 pos() const { return _stream->pos(); }
|
|
|
|
virtual int32 size() const { return _stream->size(); }
|
|
|
|
virtual bool seek(int32 offset, int whence = SEEK_SET) { return _stream->seek(offset, whence); }
|
2013-06-04 20:24:40 +00:00
|
|
|
};
|
|
|
|
|
2013-08-26 19:17:20 +00:00
|
|
|
enum ObjType {
|
|
|
|
kObjTypeDefault,
|
2014-01-04 13:01:27 +00:00
|
|
|
kObjTypeExCommand,
|
|
|
|
kObjTypeExCommand2,
|
2014-05-01 06:44:47 +00:00
|
|
|
kObjTypeModalSaveGame,
|
2013-10-16 21:55:34 +00:00
|
|
|
kObjTypeMovGraph,
|
2013-10-17 19:44:30 +00:00
|
|
|
kObjTypeMovGraphLink,
|
2013-10-16 21:55:34 +00:00
|
|
|
kObjTypeMovGraphNode,
|
|
|
|
kObjTypeMctlCompound,
|
2013-09-04 21:13:16 +00:00
|
|
|
kObjTypeObjstateCommand,
|
2013-09-17 20:00:33 +00:00
|
|
|
kObjTypePictureObject,
|
2013-10-16 21:55:34 +00:00
|
|
|
kObjTypeStaticANIObject
|
2013-08-26 19:17:20 +00:00
|
|
|
};
|
|
|
|
|
2013-06-20 18:44:59 +00:00
|
|
|
class CObject {
|
2013-10-16 21:55:34 +00:00
|
|
|
public:
|
2013-08-26 19:17:20 +00:00
|
|
|
ObjType _objtype;
|
|
|
|
|
|
|
|
CObject() : _objtype(kObjTypeDefault) {}
|
2013-06-20 18:44:59 +00:00
|
|
|
virtual bool load(MfcArchive &in) { return true; }
|
|
|
|
virtual ~CObject() {}
|
|
|
|
|
|
|
|
bool loadFile(const char *fname);
|
|
|
|
};
|
|
|
|
|
2013-09-18 15:08:31 +00:00
|
|
|
class ObList : public Common::List<CObject *>, public CObject {
|
2013-06-20 18:44:59 +00:00
|
|
|
public:
|
|
|
|
virtual bool load(MfcArchive &file);
|
|
|
|
};
|
|
|
|
|
2013-06-21 01:49:28 +00:00
|
|
|
class MemoryObject : CObject {
|
2013-06-22 01:30:38 +00:00
|
|
|
friend class Picture;
|
2013-08-07 17:52:23 +00:00
|
|
|
friend class Scene;
|
2013-06-22 01:30:38 +00:00
|
|
|
|
2013-06-22 17:26:49 +00:00
|
|
|
protected:
|
2013-07-16 20:54:18 +00:00
|
|
|
char *_memfilename;
|
2013-08-12 09:32:49 +00:00
|
|
|
int _mfield_8;
|
|
|
|
int _mfield_C;
|
|
|
|
int _mfield_10;
|
|
|
|
char _mfield_14;
|
2013-07-11 05:09:11 +00:00
|
|
|
byte *_data;
|
2013-06-22 01:30:38 +00:00
|
|
|
int _dataSize;
|
2013-08-12 09:32:49 +00:00
|
|
|
int _mflags;
|
2013-06-22 01:30:38 +00:00
|
|
|
NGIArchive *_libHandle;
|
|
|
|
|
|
|
|
public:
|
|
|
|
MemoryObject();
|
2013-07-26 12:39:17 +00:00
|
|
|
virtual ~MemoryObject();
|
|
|
|
|
2013-06-22 01:30:38 +00:00
|
|
|
virtual bool load(MfcArchive &file);
|
|
|
|
void loadFile(char *filename);
|
2013-07-16 20:54:18 +00:00
|
|
|
void load() { loadFile(_memfilename); }
|
2013-07-12 06:03:02 +00:00
|
|
|
byte *getData();
|
2013-07-26 12:39:17 +00:00
|
|
|
byte *loadData();
|
2014-01-03 14:03:27 +00:00
|
|
|
int getDataSize() const { return _dataSize; }
|
2013-07-26 12:39:17 +00:00
|
|
|
|
|
|
|
bool testFlags();
|
|
|
|
|
|
|
|
void freeData();
|
2013-06-22 01:30:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class MemoryObject2 : public MemoryObject {
|
2013-07-12 06:03:02 +00:00
|
|
|
friend class Picture;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
byte **_rows;
|
2013-06-22 01:30:38 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
MemoryObject2();
|
2013-07-26 12:39:17 +00:00
|
|
|
virtual ~MemoryObject2();
|
2013-06-22 01:30:38 +00:00
|
|
|
virtual bool load(MfcArchive &file);
|
2013-07-26 12:39:17 +00:00
|
|
|
|
|
|
|
void copyData(byte *src, int dataSize);
|
2013-06-20 18:44:59 +00:00
|
|
|
};
|
|
|
|
|
2013-09-18 15:08:31 +00:00
|
|
|
class ObArray : public Common::Array<CObject>, public CObject {
|
2013-06-20 18:44:59 +00:00
|
|
|
public:
|
|
|
|
virtual bool load(MfcArchive &file);
|
|
|
|
};
|
|
|
|
|
2013-09-18 15:08:31 +00:00
|
|
|
class DWordArray : public Common::Array<int32>, public CObject {
|
2013-06-20 18:44:59 +00:00
|
|
|
public:
|
|
|
|
virtual bool load(MfcArchive &file);
|
|
|
|
};
|
|
|
|
|
2013-06-20 20:39:05 +00:00
|
|
|
char *genFileName(int superId, int sceneId, const char *ext);
|
2013-06-27 00:46:14 +00:00
|
|
|
byte *transCyrillic(byte *s);
|
2013-06-20 20:39:05 +00:00
|
|
|
|
2013-06-04 20:24:40 +00:00
|
|
|
} // End of namespace Fullpipe
|
|
|
|
|
|
|
|
#endif /* FULLPIPE_UTILS_H */
|