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


C++ SeekableReadStream::readByte方法代码示例

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


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

示例1: loadActions

void GameModule::loadActions(Common::SeekableReadStream &s) {
	debug(0, "GameModule::loadActions()");

	s.seek(0x180);
	_actionsCount = s.readUint32LE();
	uint32 offs = s.readUint32LE();
	_actions = new Action[_actionsCount];
	for (int i = 0; i < _actionsCount; ++i) {
		s.seek(offs + i * 72);
		debug(0, "Action(%d) offs: %08X", i, offs + i * 72);
		_actions[i].conditions = readConditions(s);
		for (int j = 0; j < 8; ++j) {
			_actions[i].results.actionResults[j].kind = s.readByte();
			_actions[i].results.actionResults[j].value1 = s.readByte();
			_actions[i].results.actionResults[j].value2 = s.readUint16LE();
		}
		const int actionListCount = s.readUint32LE();
		const uint32 actionListOffs = s.readUint32LE();
		s.seek(actionListOffs);
		for (int j = 0; j < actionListCount; ++j) {
			ActionCommand actionCommand;
			actionCommand.cmd = s.readUint16LE();
			actionCommand.sceneObjectIndex = s.readUint16LE();
			actionCommand.timeStamp = s.readUint32LE();
			actionCommand.walkDest = readPoint(s);
			actionCommand.param = s.readUint32LE();
			_actions[i].actionCommands.push_back(actionCommand);
		}
	}
}
开发者ID:86400,项目名称:scummvm,代码行数:30,代码来源:gamemodule.cpp

示例2: setFontMads

void Font::setFontMads(const char *filename) {
	MadsPack fontData(filename, _vm);
	Common::SeekableReadStream *fontFile = fontData.getItemStream(0);

	_maxHeight = fontFile->readByte();
	_maxWidth = fontFile->readByte();

	_charWidths = new uint8[128];
	// Char data is shifted by 1
	_charWidths[0] = 0;
	fontFile->read(_charWidths + 1, 127);
	fontFile->readByte();	// remainder

	_charOffs = new uint16[128];

	uint32 startOffs = 2 + 128 + 256;
	uint32 fontSize = fontFile->size() - startOffs;

	// Char data is shifted by 1
	_charOffs[0] = 0;
	for (int i = 1; i < 128; i++)
		_charOffs[i] = fontFile->readUint16LE() - startOffs;
	fontFile->readUint16LE();	// remainder

	_charData = new uint8[fontSize];
	fontFile->read(_charData, fontSize);

	delete fontFile;
}
开发者ID:St0rmcrow,项目名称:scummvm,代码行数:29,代码来源:font.cpp

示例3: loadGridDefaults

void Resource::loadGridDefaults() {
	Common::SeekableReadStream *stream = _bkg->createReadStreamForIndex(0);
	_firstGrid = stream->readUint16LE();
	_firstGridFragment = stream->readUint16LE();
	_firstLibrary = stream->readUint16LE();
	_firstBlock = stream->readUint16LE();
	_numBlocks = stream->readUint16LE();
	_numScenes = 0;
	delete stream;
	stream = _bkg->createReadStreamForIndex(_firstBlock + _numBlocks);
	for (;;) {
		byte opcode = stream->readByte();
		byte id = stream->readByte();
		if (opcode == 0) {
			break;
		} else if (opcode == 1) {
			_scenes[_numScenes]._isIsland = false;
		} else if (opcode == 2) {
			_scenes[_numScenes]._isIsland = true;
		}
		_scenes[_numScenes]._id = id;
		++_numScenes;
	}
	delete stream;
}
开发者ID:klusark,项目名称:twin,代码行数:25,代码来源:resource.cpp

示例4: getName

Common::String MohawkEngine_Riven::getName(uint16 nameResource, uint16 nameID) {
	Common::SeekableReadStream* nameStream = getResource(ID_NAME, nameResource);
	uint16 fieldCount = nameStream->readUint16BE();
	uint16* stringOffsets = new uint16[fieldCount];
	Common::String name;
	char c;

	if (nameID < fieldCount) {
		for (uint16 i = 0; i < fieldCount; i++)
			stringOffsets[i] = nameStream->readUint16BE();
		for (uint16 i = 0; i < fieldCount; i++)
			nameStream->readUint16BE();	// Skip unknown values

		nameStream->seek(stringOffsets[nameID], SEEK_CUR);
		c = (char)nameStream->readByte();

		while (c) {
			name += c;
			c = (char)nameStream->readByte();
		}
	}

	delete nameStream;
	delete[] stringOffsets;
	return name;
}
开发者ID:AlbanBedel,项目名称:scummvm,代码行数:26,代码来源:riven.cpp

示例5: readColorMap

bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth) {
	_colorMap = new byte[3 * _colorMapLength];
	for (int i = 0; i < _colorMapLength * 3; i += 3) {
		byte r, g, b;
		if (_colorMapEntryLength == 32) {
			byte a;
			Graphics::PixelFormat format(4, 8, 8, 8, 0, 16, 8, 0, 24);
			uint32 color = tga.readUint32LE();
			format.colorToARGB(color, a, r, g, b);
		} else if (_colorMapEntryLength == 24) {
			r = tga.readByte();
			g = tga.readByte();
			b = tga.readByte();
		} else if (_colorMapEntryLength == 16) {
			byte a;
			Graphics::PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 15);
			uint16 color = tga.readUint16LE();
			format.colorToARGB(color, a, r, g, b);
		} else {
			warning("Unsupported image type: %d", imageType);
			r = g = b = 0;
		}
#ifdef SCUMM_LITTLE_ENDIAN
		_colorMap[i] = r;
		_colorMap[i + 1] = g;
		_colorMap[i + 2] = b;
#else
		_colorMap[i] = b;
		_colorMap[i + 1] = g;
		_colorMap[i + 2] = r;
#endif
	}
	return true;
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:34,代码来源:tga.cpp

示例6: loadPalette

void ImageFile::loadPalette(Common::SeekableReadStream &stream) {
	// Check for palette
	uint16 width        = stream.readUint16LE() + 1;
	uint16 height       = stream.readUint16LE() + 1;
	byte   paletteBase  = stream.readByte();
	byte   rleEncoded   = stream.readByte();
	byte   offsetX      = stream.readByte();
	byte   offsetY      = stream.readByte();
	uint32 palSignature = 0;

	if ((width == 390) && (height == 2) && (!paletteBase) && (!rleEncoded) && (!offsetX) && (!offsetY)) {
		// We check for these specific values
		// We can't do "width * height", because at least the first German+Spanish menu bar is 60 x 13
		// which is 780, which is the size of the palette. We obviously don't want to detect it as palette.

		// As another security measure, we also check for the signature text
		palSignature = stream.readUint32BE();
		if (palSignature != MKTAG('V', 'G', 'A', ' ')) {
			// signature mismatch, rewind
			stream.seek(-12, SEEK_CUR);
			return;
		}
		// Found palette, so read it in
		stream.seek(8, SEEK_CUR); // Skip over the rest of the signature text "VGA palette"
		for (int idx = 0; idx < PALETTE_SIZE; ++idx)
			_palette[idx] = VGA_COLOR_TRANS(stream.readByte());
	} else {
		// Not a palette, so rewind to start of frame data for normal frame processing
		stream.seek(-8, SEEK_CUR);
	}
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:31,代码来源:image_file.cpp

示例7: loadPic

void DrasculaEngine::loadPic(const char *NamePcc, byte *targetSurface, int colorCount) {
	debug(5, "loadPic(%s)", NamePcc);

	uint dataSize = 0;
	byte *pcxData;

	Common::SeekableReadStream *stream = _archives.open(NamePcc);
	if (!stream)
		error("missing game data %s %c", NamePcc, 7);

	dataSize = stream->size() - 128 - (256 * 3);
	pcxData = (byte *)malloc(dataSize);

	stream->seek(128, SEEK_SET);
	stream->read(pcxData, dataSize);

	decodeRLE(pcxData, targetSurface);
	free(pcxData);

	for (int i = 0; i < 256; i++) {
		cPal[i * 3 + 0] = stream->readByte();
		cPal[i * 3 + 1] = stream->readByte();
		cPal[i * 3 + 2] = stream->readByte();
	}

	delete stream;

	setRGB((byte *)cPal, colorCount);
}
开发者ID:SinSiXX,项目名称:scummvm,代码行数:29,代码来源:graphics.cpp

示例8: load

void ActorType::load(byte *dataStart, Common::SeekableReadStream &stream) {
	_actorTypeId = stream.readUint32LE();
	_surfInfo.load(stream);
	uint32 pointsConfigOffs = stream.readUint32LE();
	uint namedPointsCount = stream.readUint16LE();
	stream.skip(2); // Skip padding
	uint32 namedPointsOffs = stream.readUint32LE();
	_color.r = stream.readByte();
	_color.g = stream.readByte();
	_color.b = stream.readByte();
	stream.readByte(); // Skip padding
	_scale = stream.readByte();
	_priority = stream.readByte();
	_value1E = stream.readUint16LE();
	_pathWalkPointsIndex = stream.readUint16LE();
	_scaleLayerIndex = stream.readUint16LE();
	_pathWalkRectIndex = stream.readUint16LE();
	_priorityLayerIndex = stream.readUint16LE();
	_regionLayerIndex = stream.readUint16LE();
	_flags = stream.readUint16LE();
	_pointsConfig = dataStart + pointsConfigOffs;
	stream.seek(namedPointsOffs);
	_namedPoints.load(namedPointsCount, stream);
	debug(5, "ActorType::load() _actorTypeId: %08X; _color(%d,%d,%d); _scale: %d; _priority: %d; _value1E: %d",
		_actorTypeId, _color.r, _color.g, _color.b, _scale, _priority, _value1E);
	debug(5, "ActorType::load() _pathWalkPointsIndex: %d; _scaleLayerIndex: %d; _pathWalkRectIndex: %d",
		_pathWalkPointsIndex, _scaleLayerIndex, _pathWalkRectIndex);
	debug(5, "ActorType::load() _priorityLayerIndex: %d; _regionLayerIndex: %d; _flags: %04X",
		_priorityLayerIndex, _regionLayerIndex,_flags);
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:30,代码来源:actorresource.cpp

示例9: loadStream

bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
	int x = 0, y = 0;

	// If the stream has exactly the required number of bits for this image,
	// we assume it is uncompressed.
	if (stream.size() * 8 == _surface->pitch * _surface->h) {
		debugC(3, kDebugImages, "Skipping compression");
		for (y = 0; y < _surface->h; y++) {
			for (x = 0; x < _surface->pitch; ) {
				byte color = stream.readByte();
				for (int c = 0; c < 8; c++)
					*((byte *)_surface->getBasePtr(x++, y)) = (color & (1 << (7 - c))) ? 0 : 0xff;
			}
		}

		return true;
	}

	while (y < _surface->h) {
		int n = stream.readSByte();
		int count;
		int b = 0;
		int state = 0;

		if (stream.eos())
			break;

		if ((n >= 0) && (n <= 127)) { // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally.
			count = n + 1;
			state = 1;
		} else if ((n >= -127) && (n <= -1)) { // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times.
			b = stream.readByte();
			count = -n + 1;
			state = 2;
		} else { // Else if n is -128, noop.
			count = 0;
		}

		for (int i = 0; i < count && y < _surface->h; i++) {
			byte color = 0;
			if (state == 1) {
				color = stream.readByte();
			} else if (state == 2)
				color = b;

			for (int c = 0; c < 8; c++) {
				*((byte *)_surface->getBasePtr(x, y)) = (color & (1 << (7 - c))) ? 0 : 0xff;
				x++;
				if (x == _surface->pitch) {
					y++;
					x = 0;
					break;
				}
			}
		}
	}

	return true;
}
开发者ID:86400,项目名称:scummvm,代码行数:59,代码来源:images.cpp

示例10: load

void AmazonResources::load(Common::SeekableReadStream &s) {
	Resources::load(s);
	uint count;

	// Load the version specific data
	NO_HELP_MESSAGE = readString(s);
	NO_HINTS_MESSAGE = readString(s);
	RIVER_HIT1 = readString(s);
	RIVER_HIT2 = readString(s);
	BAR_MESSAGE = readString(s);

	for (int idx = 0; idx < 3; ++idx)
		HELPLVLTXT[idx] = readString(s);
	for (int idx = 0; idx < 9; ++idx)
		IQLABELS[idx] = readString(s);

	CANT_GET_THERE = readString(s);

	// Get the offset of the general shared data for the game
	uint entryOffset = findEntry(_vm->getGameID(), 2, 0, (Common::Language)0);
	s.seek(entryOffset);

	// Read in the cursor list
	count = s.readUint16LE();
	CURSORS.resize(count);
	for (uint idx = 0; idx < count; ++idx) {
		uint count2 = s.readUint16LE();
		CURSORS[idx].resize(count2);
		s.read(&CURSORS[idx][0], count2);
	}

	// Load font data
	count = s.readUint16LE();
	Common::Array<int> index;
	Common::Array<byte> data;

	index.resize(count);
	for (uint idx = 0; idx < count; ++idx)
		index[idx] = s.readSint16LE();

	count = s.readUint16LE();
	data.resize(count);
	for (uint idx = 0; idx < count; ++idx)
		data[idx] = s.readByte();
	_font3x5 = new AmazonFont(&index[0], &data[0]);

	count = s.readUint16LE();
	index.resize(count);
	for (uint idx = 0; idx < count; ++idx)
		index[idx] = s.readSint16LE();

	count = s.readUint16LE();
	data.resize(count);
	for (uint idx = 0; idx < count; ++idx)
		data[idx] = s.readByte();
	_font6x6 = new AmazonFont(&index[0], &data[0]);
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:57,代码来源:amazon_resources.cpp

示例11: readPascalString

Common::String DirectorEngine::readPascalString(Common::SeekableReadStream &stream) {
	byte length = stream.readByte();
	Common::String x;

	while (length--)
		x += (char)stream.readByte();

	return x;
}
开发者ID:iskrich,项目名称:director,代码行数:9,代码来源:director.cpp

示例12: readConditions

Conditions GameModule::readConditions(Common::SeekableReadStream &s) {
	Conditions c;
	for (int i = 0; i < 8; ++i) {
		c.conditions[i].cond = s.readByte();
		c.conditions[i].value1 = s.readByte();
		c.conditions[i].value2 = s.readUint16LE();
	}
	return c;
}
开发者ID:86400,项目名称:scummvm,代码行数:9,代码来源:gamemodule.cpp

示例13: sizeof

void Map_v2::loadGoblinStates(Common::SeekableReadStream &data, int index) {
	Mult::Mult_GobState *statesPtr;
	Mult::Mult_GobState *gobState;
	int8 indices[102];
	uint8 statesCount;
	uint8 dataCount;
	int16 state;
	uint32 tmpPos;

	memset(indices, -1, 101);
	_vm->_mult->_objects[index].goblinStates = new Mult::Mult_GobState*[101];
	memset(_vm->_mult->_objects[index].goblinStates, 0,
			101 * sizeof(Mult::Mult_GobState *));

	data.read(indices, 100);
	tmpPos = data.pos();
	statesCount = 0;
	for (int i = 0; i < 100; i++) {
		if (indices[i] != -1) {
			statesCount++;
			data.skip(4);
			dataCount = data.readByte();
			statesCount += dataCount;
			data.skip(dataCount * 9);
		}
	}

	data.seek(tmpPos);

	statesPtr = new Mult::Mult_GobState[statesCount];
	_vm->_mult->_objects[index].goblinStates[0] = statesPtr;
	for (int i = 0; i < 100; i++) {
		state = indices[i];
		if (state != -1) {
			_vm->_mult->_objects[index].goblinStates[state] = statesPtr++;
			gobState = _vm->_mult->_objects[index].goblinStates[state];

			gobState[0].animation = data.readSint16LE();
			gobState[0].layer = data.readSint16LE();
			dataCount = data.readByte();
			gobState[0].dataCount = dataCount;
			for (uint8 j = 1; j <= dataCount; j++) {
				data.skip(1);
				gobState[j].sndItem = data.readSByte();
				data.skip(1);
				gobState[j].sndFrame = data.readByte();
				data.skip(1);
				gobState[j].freq = data.readSint16LE();
				gobState[j].repCount = data.readSByte();
				gobState[j].speaker = data.readByte();
				statesPtr++;
			}
		}
	}
}
开发者ID:tramboi,项目名称:scummvm-test,代码行数:55,代码来源:map_v2.cpp

示例14: loadPaletteRange

void IFFDecoder::loadPaletteRange(Common::SeekableReadStream &stream, const uint32 size) {
	PaletteRange range;

	range.timer = stream.readSint16BE();
	range.step = stream.readSint16BE();
	range.flags = stream.readSint16BE();
	range.first = stream.readByte();
	range.last = stream.readByte();

	_paletteRanges.push_back(range);
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:11,代码来源:iff.cpp

示例15: load

void CBaseStarEntry::load(Common::SeekableReadStream &s) {
	_field0 = s.readByte();
	_field1 = s.readByte();
	_field2 = s.readByte();
	_field3 = s.readByte();
	*((uint32 *)&_value) = s.readUint32LE();		// FIXME
	_val._v1 = s.readUint32LE();
	_val._v2 = s.readUint32LE();
	_val._v3 = s.readUint32LE();

	for (int idx = 0; idx < 5; ++idx)
		_data[idx] = s.readUint32LE();
}
开发者ID:86400,项目名称:scummvm,代码行数:13,代码来源:base_star.cpp


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