bool GameLoader::load(MfcArchive &file) { debugC(1, kDebugLoading, "GameLoader::load()"); _gameName = file.readPascalString(); debugC(1, kDebugLoading, "_gameName: %s", _gameName.c_str()); _gameProject = new GameProject(); _gameProject->load(file); g_fp->_gameProject = _gameProject; if (g_fp->_gameProjectVersion < 12) { error("Old gameProjectVersion: %d", g_fp->_gameProjectVersion); } _gameName = file.readPascalString(); debugC(1, kDebugLoading, "_gameName: %s", _gameName.c_str()); _inventory.load(file); _interactionController->load(file); debugC(1, kDebugLoading, "sceneTag count: %d", _gameProject->_sceneTagList->size()); _sc2array.resize(_gameProject->_sceneTagList->size()); int i = 0; for (SceneTagList::const_iterator it = _gameProject->_sceneTagList->begin(); it != _gameProject->_sceneTagList->end(); ++it, i++) { char tmp[12]; snprintf(tmp, 11, "%04d.sc2", it->_sceneId); debugC(1, kDebugLoading, "sc: %s", tmp); _sc2array[i].loadFile((const char *)tmp); } _preloadItems.load(file); _field_FA = file.readUint16LE(); _field_F8 = file.readUint16LE(); debugC(1, kDebugLoading, "_field_FA: %d\n_field_F8: %d", _field_FA, _field_F8); _gameVar = (GameVar *)file.readClass(); return true; }
bool GameProject::load(MfcArchive &file) { debug(5, "GameProject::load()"); _field_4 = 0; _headerFilename = 0; _field_10 = 12; g_fp->_gameProjectVersion = file.readUint32LE(); g_fp->_pictureScale = file.readUint16LE(); g_fp->_scrollSpeed = file.readUint32LE(); _headerFilename = file.readPascalString(); debug(1, "_gameProjectVersion = %d", g_fp->_gameProjectVersion); debug(1, "_pictureScale = %d", g_fp->_pictureScale); debug(1, "_scrollSpeed = %d", g_fp->_scrollSpeed); debug(1, "_headerFilename = %s", _headerFilename); _sceneTagList = new SceneTagList(); _sceneTagList->load(file); if (g_fp->_gameProjectVersion >= 3) _field_4 = file.readUint32LE(); if (g_fp->_gameProjectVersion >= 5) { file.readUint32LE(); file.readUint32LE(); } return true; }
bool GameVar::load(MfcArchive &file) { _varName = file.readPascalString(); _varType = file.readUint32LE(); debugCN(6, kDebugLoading, "[%03d] ", file.getLevel()); for (int i = 0; i < file.getLevel(); i++) debugCN(6, kDebugLoading, " "); debugCN(6, kDebugLoading, "<%s>: ", transCyrillic(_varName)); switch (_varType) { case 0: _value.intValue = file.readUint32LE(); debugC(6, kDebugLoading, "d --> %d", _value.intValue); break; case 1: _value.intValue = file.readUint32LE(); // FIXME debugC(6, kDebugLoading, "f --> %f", _value.floatValue); break; case 2: { Common::String str = file.readPascalString(); _value.stringValue = (char *)calloc(str.size() + 1, 1); Common::strlcpy(_value.stringValue, str.c_str(), str.size() + 1); debugC(6, kDebugLoading, "s --> %s", _value.stringValue); } break; default: error("Unknown var type: %d (0x%x)", _varType, _varType); } file.incLevel(); _parentVarObj = file.readClass<GameVar>(); _prevVarObj = file.readClass<GameVar>(); _nextVarObj = file.readClass<GameVar>(); _field_14 = file.readClass<GameVar>(); _subVars = file.readClass<GameVar>(); file.decLevel(); return true; }
bool ObjstateCommand::load(MfcArchive &file) { debug(5, "ObjStateCommand::load()"); _objtype = kObjTypeObjstateCommand; _cmd.load(file); _value = file.readUint32LE(); _objCommandName = file.readPascalString(); return true; }
bool GameVar::load(MfcArchive &file) { _varName = file.readPascalString(); _varType = file.readUint32LE(); debugN(6, "[%03d] ", file.getLevel()); for (int i = 0; i < file.getLevel(); i++) debugN(6, " "); debugN(6, "<%s>: ", transCyrillic((byte *)_varName)); switch (_varType) { case 0: _value.intValue = file.readUint32LE(); debug(6, "d --> %d", _value.intValue); break; case 1: _value.intValue = file.readUint32LE(); // FIXME debug(6, "f --> %f", _value.floatValue); break; case 2: _value.stringValue = file.readPascalString(); debug(6, "s --> %s", _value.stringValue); break; default: error("Unknown var type: %d (0x%x)", _varType, _varType); } file.incLevel(); _parentVarObj = (GameVar *)file.readClass(); _prevVarObj = (GameVar *)file.readClass(); _nextVarObj = (GameVar *)file.readClass(); _field_14 = (GameVar *)file.readClass(); _subVars = (GameVar *)file.readClass(); file.decLevel(); return true; }
bool MemoryObject::load(MfcArchive &file) { debugC(5, kDebugLoading, "MemoryObject::load()"); _memfilename = file.readPascalString(); while (_memfilename.contains('\\')) { _memfilename.deleteChar(0); } if (g_fp->_currArchive) { _mfield_14 = 0; _libHandle = g_fp->_currArchive; } return true; }
bool GameObject::load(MfcArchive &file) { debug(5, "GameObject::load()"); _okeyCode = 0; _flags = 0; _field_20 = 0; _id = file.readUint16LE(); _objectName = file.readPascalString(); _ox = file.readUint32LE(); _oy = file.readUint32LE(); _priority = file.readUint16LE(); if (g_fp->_gameProjectVersion >= 11) { _field_8 = file.readUint32LE(); } return true; }
bool Interaction::load(MfcArchive &file) { debug(5, "Interaction::load()"); _objectId1 = file.readUint16LE(); _objectId2 = file.readUint16LE(); _staticsId1 = file.readUint16LE(); _staticsId2 = file.readUint16LE(); _objectId3 = file.readUint16LE(); _objectState2 = file.readUint32LE(); _objectState1 = file.readUint32LE(); _xOffs = file.readUint32LE(); _yOffs = file.readUint32LE(); _sceneId = file.readUint32LE(); _flags = file.readUint32LE(); _actionName = file.readPascalString(); _messageQueue = (MessageQueue *)file.readClass(); return true; }
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++) { ExCommand *tmp = (ExCommand *)file.readClass(); _exCommands.push_back(tmp); } _id = -1; _field_14 = 0; _parId = 0; _isFinished = 0; return true; }
bool Background::load(MfcArchive &file) { debug(5, "Background::load()"); _bgname = file.readPascalString(); int count = file.readUint16LE(); for (int i = 0; i < count; i++) { PictureObject *pct = new PictureObject(); pct->load(file, i == 0); addPictureObject(pct); } assert(g_fp->_gameProjectVersion >= 4); _bigPictureArray1Count = file.readUint32LE(); assert(g_fp->_gameProjectVersion >= 5); _bigPictureArray2Count = file.readUint32LE(); _bigPictureArray = (BigPicture ***)calloc(_bigPictureArray1Count, sizeof(BigPicture **)); debug(6, "bigPictureArray[%d][%d]", _bigPictureArray1Count, _bigPictureArray2Count); for (int i = 0; i < _bigPictureArray1Count; i++) { _bigPictureArray[i] = (BigPicture **)calloc(_bigPictureArray2Count, sizeof(BigPicture *)); for (int j = 0; j < _bigPictureArray2Count; j++) { _bigPictureArray[i][j] = new BigPicture(); _bigPictureArray[i][j]->load(file); } } return true; }
bool Sound::load(MfcArchive &file, NGIArchive *archive) { debug(5, "Sound::load()"); MemoryObject::load(file); _id = file.readUint32LE(); _description = file.readPascalString(); assert(g_fp->_gameProjectVersion >= 6); _objectId = file.readUint16LE(); if (archive && archive->hasFile(_memfilename)) { Common::SeekableReadStream *s = archive->createReadStreamForMember(_memfilename); _soundData = (byte *)calloc(s->size(), 1); s->read(_soundData, s->size()); delete s; } return true; }