Esempio n. 1
0
bool Day::readData()
{
    if (loaded) return true;

    loaded = true;

    readGlobalObjects();
    RoadManager::readRoads(DAY_ROADS(raceName, dayName), roadMap, false, true);

    return true;
}
Esempio n. 2
0
void ScummEngine_v4::readIndexFile() {
	uint16 blocktype;
	uint32 itemsize;
	int numblock = 0;

	debug(9, "readIndexFile()");

	closeRoom();
	openRoom(0);

	while (true) {
		// Figure out the sizes of various resources
		itemsize = _fileHandle->readUint32LE();
		blocktype = _fileHandle->readUint16LE();
		if (_fileHandle->eos() || _fileHandle->err())
			break;

		switch (blocktype) {
		case 0x4E52:	// 'NR'
			_fileHandle->readUint16LE();
			break;
		case 0x5230:	// 'R0'
			_numRooms = _fileHandle->readUint16LE();
			break;
		case 0x5330:	// 'S0'
			_numScripts = _fileHandle->readUint16LE();
			break;
		case 0x4E30:	// 'N0'
			_numSounds = _fileHandle->readUint16LE();
			break;
		case 0x4330:	// 'C0'
			_numCostumes = _fileHandle->readUint16LE();
			break;
		case 0x4F30:	// 'O0'
			_numGlobalObjects = _fileHandle->readUint16LE();

			// Indy3 FM-TOWNS has 32 extra bytes of unknown meaning
			if (_game.id == GID_INDY3 && _game.platform == Common::kPlatformFMTowns)
				itemsize += 32;
			break;
		}
		_fileHandle->seek(itemsize - 8, SEEK_CUR);
	}

	_fileHandle->seek(0, SEEK_SET);

	readMAXS(0);
	allocateArrays();

	while (true) {
		itemsize = _fileHandle->readUint32LE();

		if (_fileHandle->eos() || _fileHandle->err())
			break;

		blocktype = _fileHandle->readUint16LE();

		numblock++;

		switch (blocktype) {

		case 0x4E52:	// 'NR'
			// Names of rooms. Maybe we should put them into a table, for use by the debugger?
			for (int room; (room = _fileHandle->readByte()); ) {
				char buf[10];
				_fileHandle->read(buf, 9);
				buf[9] = 0;
				for (int i = 0; i < 9; i++)
					buf[i] ^= 0xFF;
				debug(5, "Room %d: '%s'", room, buf);
			}
			break;

		case 0x5230:	// 'R0'
			readResTypeList(rtRoom);
			break;

		case 0x5330:	// 'S0'
			readResTypeList(rtScript);
			break;

		case 0x4E30:	// 'N0'
			readResTypeList(rtSound);
			break;

		case 0x4330:	// 'C0'
			readResTypeList(rtCostume);
			break;

		case 0x4F30:	// 'O0'
			readGlobalObjects();
			break;

		default:
			error("Bad ID %c%c found in directory", blocktype & 0xFF, blocktype >> 8);
		}
	}
	closeRoom();
}