Ejemplo n.º 1
0
bool Sc2::load(MfcArchive &file) {
    debugC(5, kDebugLoading, "Sc2::load()");

    _sceneId = file.readUint16LE();

    _motionController = (MotionController *)file.readClass();

    _count1 = file.readUint32LE();
    debugC(4, kDebugLoading, "count1: %d", _count1);
    if (_count1 > 0) {
        _data1 = (int32 *)malloc(_count1 * sizeof(int32));

        for (int i = 0; i < _count1; i++) {
            _data1[i] = file.readUint32LE();
        }
    } else {
        _data1 = 0;
    }

    _defPicAniInfosCount = file.readUint32LE();
    debugC(4, kDebugLoading, "defPicAniInfos: %d", _defPicAniInfosCount);
    if (_defPicAniInfosCount > 0) {
        _defPicAniInfos = (PicAniInfo **)malloc(_defPicAniInfosCount * sizeof(PicAniInfo *));

        for (int i = 0; i < _defPicAniInfosCount; i++) {
            _defPicAniInfos[i] = new PicAniInfo();

            _defPicAniInfos[i]->load(file);
        }
    } else {
        _defPicAniInfos = 0;
    }

    _picAniInfos = 0;
    _picAniInfosCount = 0;

    _entranceDataCount = file.readUint32LE();
    debugC(4, kDebugLoading, "_entranceData: %d", _entranceDataCount);

    if (_entranceDataCount > 0) {
        _entranceData = (EntranceInfo **)malloc(_entranceDataCount * sizeof(EntranceInfo *));

        for (int i = 0; i < _entranceDataCount; i++) {
            _entranceData[i] = new EntranceInfo();
            _entranceData[i]->load(file);
        }
    } else {
        _entranceData = 0;
    }

    if (file.size() - file.pos() > 0)
        error("Sc2::load(): (%d bytes left)", file.size() - file.pos());

    return true;
}
Ejemplo n.º 2
0
bool ObArray::load(MfcArchive &file) {
	debugC(5, kDebugLoading, "ObArray::load()");
	int count = file.readCount();

	resize(count);

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

		push_back(*t);
	}

	return true;
}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
bool ObList::load(MfcArchive &file) {
	debugC(5, kDebugLoading, "ObList::load()");
	int count = file.readCount();

	debugC(9, kDebugLoading, "ObList::count: %d:", count);

	for (int i = 0; i < count; i++) {
		debugC(9, kDebugLoading, "ObList::[%d]", i);
		CObject *t = file.readClass();

		push_back(t);
	}

	return true;
}
Ejemplo n.º 6
0
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;
}
Ejemplo n.º 7
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++) {
		ExCommand *tmp = (ExCommand *)file.readClass();

		_exCommands.push_back(tmp);
	}

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

	return true;
}