当前位置: 首页>>代码示例>>C++>>正文


C++ MemoryReadStream::readUint32LE方法代码示例

本文整理汇总了C++中common::MemoryReadStream::readUint32LE方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryReadStream::readUint32LE方法的具体用法?C++ MemoryReadStream::readUint32LE怎么用?C++ MemoryReadStream::readUint32LE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common::MemoryReadStream的用法示例。


在下文中一共展示了MemoryReadStream::readUint32LE方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: load

void AnimationResource::load(byte *source, int size) {
	Common::MemoryReadStream *sourceS = new Common::MemoryReadStream(source, size);

	sourceS->readUint32LE();
	sourceS->readUint32LE();
	sourceS->readUint16LE();

	_flags = sourceS->readUint16LE();
	_width = sourceS->readUint16LE();
	_height = sourceS->readUint16LE();
	sourceS->readUint32LE();
	uint16 frameCount = sourceS->readUint16LE();
	sourceS->readUint16LE();
	sourceS->readUint16LE();

	for (uint16 i = 0; i < frameCount; i++) {

		sourceS->seek(26 + i * 4);

		uint32 frameOffs = sourceS->readUint32LE();

		sourceS->seek(frameOffs);
		sourceS->readUint32LE();
		sourceS->readUint32LE();

		uint16 frameWidth = sourceS->readUint16LE();
		uint16 frameHeight = sourceS->readUint16LE();
		uint16 cmdOffs = sourceS->readUint16LE();
		sourceS->readUint16LE();
		uint16 pixelOffs = sourceS->readUint16LE();
		sourceS->readUint16LE();
		uint16 maskOffs = sourceS->readUint16LE();
		sourceS->readUint16LE();
		uint16 lineSize = sourceS->readUint16LE();

		Graphics::Surface *frame = new Graphics::Surface();
		frame->create(frameWidth, frameHeight, Graphics::PixelFormat::createFormatCLUT8());

		decompressImage(source + frameOffs, *frame, cmdOffs, pixelOffs, maskOffs, lineSize, 0, 0, 0, _flags & 1);

		_frames.push_back(frame);

	}

	delete sourceS;
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:46,代码来源:resource.cpp

示例2: dumpFaceMask

bool Node::dumpFaceMask(uint16 index, int face, DirectorySubEntry::ResourceType type) {
	static const int32 kMaskSize = 640 * 640;

	byte *mask = new byte[kMaskSize];
	memset(mask, 0, kMaskSize);
	uint32 headerOffset = 0;
	uint32 dataOffset = 0;

	const DirectorySubEntry *maskDesc = _vm->getFileDescription(0, index, face, type);

	if (!maskDesc) {
		delete[] mask;
		return false;
	}

	Common::MemoryReadStream *maskStream = maskDesc->getData();

	while (headerOffset < 400) {
		int blockX = (headerOffset / sizeof(dataOffset)) % 10;
		int blockY = (headerOffset / sizeof(dataOffset)) / 10;

		maskStream->seek(headerOffset, SEEK_SET);
		dataOffset = maskStream->readUint32LE();
		headerOffset = maskStream->pos();

		if (dataOffset != 0) {
			maskStream->seek(dataOffset, SEEK_SET);

			for(int i = 63; i >= 0; i--) {
				int x = 0;
				byte numValues = maskStream->readByte();
				for (int j = 0; j < numValues; j++) {
					byte repeat = maskStream->readByte();
					byte value = maskStream->readByte();
					for (int k = 0; k < repeat; k++) {
						mask[((blockY * 64) + i) * 640 + blockX * 64 + x] = value;
						x++;
					}
				}
			}
		}
	}

	delete maskStream;

	Common::DumpFile outFile;
	outFile.open(Common::String::format("dump/%d-%d.masku_%d", index, face, type));
	outFile.write(mask, kMaskSize);
	outFile.close();
	delete[] mask;

	return true;
}
开发者ID:YakBizzarro,项目名称:residual,代码行数:53,代码来源:node.cpp

示例3: loadEMI

void Costume::loadEMI(Common::MemoryReadStream &ms, Costume *prevCost) {
    Common::List<Component *>components;

    _numChores = ms.readUint32LE();
    _chores = new Chore[_numChores];
    for (int i = 0; i < _numChores; i++) {
        uint32 nameLength;
        Component *prevComponent = NULL;
        nameLength = ms.readUint32LE();
        ms.read(_chores[i]._name, nameLength);
        float length;
        ms.read(&length, 4);
        _chores[i]._length = (int)length;

        _chores[i]._owner = this;
        _chores[i]._numTracks = ms.readUint32LE();
        _chores[i]._tracks = new ChoreTrack[_chores[i]._numTracks];

        for (int k = 0; k < _chores[i]._numTracks; k++) {
            int componentNameLength = ms.readUint32LE();
            assert(componentNameLength < 64);

            char name[64];
            ms.read(name, componentNameLength);

            ms.readUint32LE();
            int parentID = ms.readUint32LE();
            if (parentID == -1 && prevCost) {
                MainModelComponent *mmc;

                // However, only the first item can actually share the
                // node hierarchy with the previous costume, so flag
                // that component so it knows what to do
                if (i == 0)
                    parentID = -2;
                prevComponent = prevCost->_components[0];
                mmc = dynamic_cast<MainModelComponent *>(prevComponent);
                // Make sure that the component is valid
                if (!mmc)
                    prevComponent = NULL;
            }
            // Actually load the appropriate component
            Component *component = loadComponentEMI(parentID < 0 ? NULL : _components[parentID], parentID, name, prevComponent);


            //Component *component = loadComponentEMI(name, parent);

            components.push_back(component);

            ChoreTrack &track = _chores[i]._tracks[k];
            track.numKeys = ms.readUint32LE();
            track.keys = new TrackKey[track.numKeys];

            // this is probably wrong
            track.compID = 0;
            for (int j = 0; j < track.numKeys; j++) {
                float time, value;
                ms.read(&time, 4);
                ms.read(&value, 4);
                track.keys[j].time = (int)time;
                track.keys[j].value = (int)value;
            }
        }
        //_chores[i]._tracks->compID;
    }

    _numComponents = components.size();
    _components = new Component *[_numComponents];
    int i = 0;
    for (Common::List<Component *>::iterator it = components.begin(); it != components.end(); ++it, ++i) {
        _components[i] = *it;
        if (!_components[i])
            continue;
        _components[i]->setCostume(this);
        _components[i]->init();
    }
}
开发者ID:ncrookston,项目名称:residual,代码行数:77,代码来源:costume.cpp


注:本文中的common::MemoryReadStream::readUint32LE方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。