void TXI::load(Common::SeekableReadStream &stream) { _empty = false; while (!stream.eos()) { Common::UString line = Common::readStringLine(stream, Common::kEncodingASCII); if (line.empty()) break; if (_mode == kModeUpperLeftCoords) { std::sscanf(line.c_str(), "%f %f %f", &_features.upperLeftCoords[_curCoords].x, &_features.upperLeftCoords[_curCoords].y, &_features.upperLeftCoords[_curCoords].z); if (++_curCoords >= _features.upperLeftCoords.size()) _mode = kModeNormal; continue; } if (_mode == kModeLowerRightCoords) { std::sscanf(line.c_str(), "%f %f %f", &_features.lowerRightCoords[_curCoords].x, &_features.lowerRightCoords[_curCoords].y, &_features.lowerRightCoords[_curCoords].z); if (++_curCoords >= _features.lowerRightCoords.size()) _mode = kModeNormal; continue; } Common::UString args; TXICommand command = parseTXICommand(line, args); if (command == TXICommandAlphaMean) Common::parseString(args, _features.alphaMean); else if (command == TXICommandArturoHeight) Common::parseString(args, _features.arturoHeight); else if (command == TXICommandArturoWidth) Common::parseString(args, _features.arturoWidth); else if (command == TXICommandBaselineHeight) Common::parseString(args, _features.baselineHeight); else if (command == TXICommandBlending) _features.blending = parseBlending(args.c_str()); else if (command == TXICommandBumpMapScaling) Common::parseString(args, _features.bumpMapScaling); else if (command == TXICommandBumpMapTexture) _features.bumpMapTexture = args; else if (command == TXICommandBumpyShinyTexture) _features.bumpyShinyTexture = args; else if (command == TXICommandCanDownsample) Common::parseString(args, _features.canDownsample); else if (command == TXICommandCaretIndent) Common::parseString(args, _features.caretIndent); else if (command == TXICommandChannelScale) Common::parseString(args, _features.channelScale); else if (command == TXICommandChannelTranslate) Common::parseString(args, _features.channelTranslate); else if (command == TXICommandClamp) Common::parseString(args, _features.clamp); else if (command == TXICommandCodepage) Common::parseString(args, _features.codepage); else if (command == TXICommandCols) Common::parseString(args, _features.cols); else if (command == TXICommandCompressTexture) Common::parseString(args, _features.compressTexture); else if (command == TXICommandControllerScript) _features.controllerScript = args; else if (command == TXICommandCube) Common::parseString(args, _features.cube); else if (command == TXICommandDBMapping) Common::parseString(args, _features.dbMapping); else if (command == TXICommandDecal) Common::parseString(args, _features.decal); else if (command == TXICommandDefaultBPP) Common::parseString(args, _features.defaultBPP); else if (command == TXICommandDefaultHeight) Common::parseString(args, _features.defaultHeight); else if (command == TXICommandDefaultWidth) Common::parseString(args, _features.defaultWidth); else if (command == TXICommandDistort) Common::parseString(args, _features.distort); else if (command == TXICommandDistortAngle) Common::parseString(args, _features.distortAngle); else if (command == TXICommandDistortionAmplitude) Common::parseString(args, _features.distortionAmplitude); else if (command == TXICommandDownsampleFactor) Common::parseString(args, _features.downsampleFactor); else if (command == TXICommandDownsampleMax) Common::parseString(args, _features.downsampleMax); else if (command == TXICommandDownsampleMin) Common::parseString(args, _features.downsampleMin); else if (command == TXICommandEnvMapTexture) _features.envMapTexture = args; else if (command == TXICommandFileRange) Common::parseString(args, _features.fileRange); else if (command == TXICommandFilter) Common::parseString(args, _features.filter); else if (command == TXICommandFontHeight) Common::parseString(args, _features.fontHeight); else if (command == TXICommandFontWidth) Common::parseString(args, _features.fontWidth); else if (command == TXICommandFPS) Common::parseString(args, _features.fps); else if (command == TXICommandIsBumpMap) Common::parseString(args, _features.isBumpMap); else if (command == TXICommandIsDoubleByte) Common::parseString(args, _features.isDoubleByte); else if (command == TXICommandIsLightMap) Common::parseString(args, _features.isLightMap); else if (command == TXICommandLowerRightCoords) { int count; Common::parseString(args, count); _mode = kModeLowerRightCoords; _curCoords = 0; _features.lowerRightCoords.resize(count); } else if (command == TXICommandMaxSizeHQ) Common::parseString(args, _features.maxSizeHQ); else if (command == TXICommandMaxSizeLQ) Common::parseString(args, _features.maxSizeLQ); else if (command == TXICommandMinSizeHQ) Common::parseString(args, _features.minSizeHQ); else if (command == TXICommandMinSizeLQ) Common::parseString(args, _features.minSizeLQ); else if (command == TXICommandMipMap) Common::parseString(args, _features.mipMap); else if (command == TXICommandNumChars) Common::parseString(args, _features.numChars); else if (command == TXICommandNumCharsPerSheet) Common::parseString(args, _features.numCharsPerSheet); else if (command == TXICommandNumX) Common::parseString(args, _features.numX); else if (command == TXICommandNumY) Common::parseString(args, _features.numY); else if (command == TXICommandOnDemand) Common::parseString(args, _features.onDemand); else if (command == TXICommandPriority) Common::parseString(args, _features.priority); else if (command == TXICommandProcedureType) _features.procedureType = args; else if (command == TXICommandRows) Common::parseString(args, _features.rows); else if (command == TXICommandSpacingB) Common::parseString(args, _features.spacingB); else if (command == TXICommandSpacingR) Common::parseString(args, _features.spacingR); else if (command == TXICommandSpeed) Common::parseString(args, _features.speed); else if (command == TXICommandTemporary) Common::parseString(args, _features.temporary); else if (command == TXICommandTextureWidth) Common::parseString(args, _features.textureWidth); else if (command == TXICommandUnique) Common::parseString(args, _features.unique); else if (command == TXICommandUpperLeftCoords) { int count; Common::parseString(args, count); _mode = kModeUpperLeftCoords; _curCoords = 0; _features.upperLeftCoords.resize(count); } else if (command == TXICommandWaterHeight) Common::parseString(args, _features.waterHeight); else if (command == TXICommandWaterWidth) Common::parseString(args, _features.waterWidth); else if (command == TXICommandXBoxDownsample) Common::parseString(args, _features.xBoxDownsample); } }
void TXI::load(Common::SeekableReadStream &stream) { while (!stream.eos()) { Common::UString line; line.readLineASCII(stream); if (line.empty()) break; if (_mode == kModeUpperLeftCoords) { std::sscanf(line.c_str(), "%f %f %f", &_features.upperLeftCoords[_curCoords].x, &_features.upperLeftCoords[_curCoords].y, &_features.upperLeftCoords[_curCoords].z); if (++_curCoords >= _features.upperLeftCoords.size()) _mode = kModeNormal; continue; } if (_mode == kModeLowerRightCoords) { std::sscanf(line.c_str(), "%f %f %f", &_features.lowerRightCoords[_curCoords].x, &_features.lowerRightCoords[_curCoords].y, &_features.lowerRightCoords[_curCoords].z); if (++_curCoords >= _features.lowerRightCoords.size()) _mode = kModeNormal; continue; } int skip = 0; TXICommand command = parseTXICommand(line, skip); if (command == TXICommandAlphaMean) line.parse(_features.alphaMean, skip); else if (command == TXICommandArturoHeight) line.parse(_features.arturoHeight, skip); else if (command == TXICommandArturoWidth) line.parse(_features.arturoWidth, skip); else if (command == TXICommandBaselineHeight) line.parse(_features.baselineHeight, skip); else if (command == TXICommandBlending) _features.blending = parseBlending(line.c_str() + skip); else if (command == TXICommandBumpMapScaling) line.parse(_features.bumpMapScaling, skip); else if (command == TXICommandBumpMapTexture) _features.bumpMapTexture = line.c_str() + skip; else if (command == TXICommandBumpyShinyTexture) _features.bumpyShinyTexture = line.c_str() + skip; else if (command == TXICommandCanDownsample) line.parse(_features.canDownsample, skip); else if (command == TXICommandCaretIndent) line.parse(_features.caretIndent, skip); else if (command == TXICommandChannelScale) line.parse(_features.channelScale, skip); else if (command == TXICommandChannelTranslate) line.parse(_features.channelTranslate, skip); else if (command == TXICommandClamp) line.parse(_features.clamp, skip); else if (command == TXICommandCodepage) line.parse(_features.codepage, skip); else if (command == TXICommandCols) line.parse(_features.cols, skip); else if (command == TXICommandCompressTexture) line.parse(_features.compressTexture, skip); else if (command == TXICommandControllerScript) _features.controllerScript = line.c_str() + skip; else if (command == TXICommandCube) line.parse(_features.cube, skip); else if (command == TXICommandDBMapping) line.parse(_features.dbMapping, skip); else if (command == TXICommandDecal) line.parse(_features.decal, skip); else if (command == TXICommandDefaultBPP) line.parse(_features.defaultBPP, skip); else if (command == TXICommandDefaultHeight) line.parse(_features.defaultHeight, skip); else if (command == TXICommandDefaultWidth) line.parse(_features.defaultWidth, skip); else if (command == TXICommandDistort) line.parse(_features.distort, skip); else if (command == TXICommandDistortAngle) line.parse(_features.distortAngle, skip); else if (command == TXICommandDistortionAmplitude) line.parse(_features.distortionAmplitude, skip); else if (command == TXICommandDownsampleFactor) line.parse(_features.downsampleFactor, skip); else if (command == TXICommandDownsampleMax) line.parse(_features.downsampleMax, skip); else if (command == TXICommandDownsampleMin) line.parse(_features.downsampleMin, skip); else if (command == TXICommandEnvMapTexture) _features.envMapTexture = line.c_str() + skip; else if (command == TXICommandFileRange) line.parse(_features.fileRange, skip); else if (command == TXICommandFilter) line.parse(_features.filter, skip); else if (command == TXICommandFontHeight) line.parse(_features.fontHeight, skip); else if (command == TXICommandFontWidth) line.parse(_features.fontWidth, skip); else if (command == TXICommandFPS) line.parse(_features.fps, skip); else if (command == TXICommandIsBumpMap) line.parse(_features.isBumpMap, skip); else if (command == TXICommandIsDoubleByte) line.parse(_features.isDoubleByte, skip); else if (command == TXICommandIsLightMap) line.parse(_features.isLightMap, skip); else if (command == TXICommandLowerRightCoords) { int count; line.parse(count, skip); _mode = kModeLowerRightCoords; _curCoords = 0; _features.lowerRightCoords.resize(count); } else if (command == TXICommandMaxSizeHQ) line.parse(_features.maxSizeHQ, skip); else if (command == TXICommandMaxSizeLQ) line.parse(_features.maxSizeLQ, skip); else if (command == TXICommandMinSizeHQ) line.parse(_features.minSizeHQ, skip); else if (command == TXICommandMinSizeLQ) line.parse(_features.minSizeLQ, skip); else if (command == TXICommandMipMap) line.parse(_features.mipMap, skip); else if (command == TXICommandNumChars) line.parse(_features.numChars, skip); else if (command == TXICommandNumCharsPerSheet) line.parse(_features.numCharsPerSheet, skip); else if (command == TXICommandNumX) line.parse(_features.numX, skip); else if (command == TXICommandNumY) line.parse(_features.numY, skip); else if (command == TXICommandOnDemand) line.parse(_features.onDemand, skip); else if (command == TXICommandPriority) line.parse(_features.priority, skip); else if (command == TXICommandProcedureType) _features.procedureType = line.c_str() + skip; else if (command == TXICommandRows) line.parse(_features.rows, skip); else if (command == TXICommandSpacingB) line.parse(_features.spacingB, skip); else if (command == TXICommandSpacingR) line.parse(_features.spacingR, skip); else if (command == TXICommandSpeed) line.parse(_features.speed, skip); else if (command == TXICommandTemporary) line.parse(_features.temporary, skip); else if (command == TXICommandTextureWidth) line.parse(_features.textureWidth, skip); else if (command == TXICommandUnique) line.parse(_features.unique, skip); else if (command == TXICommandUpperLeftCoords) { int count; line.parse(count, skip); _mode = kModeUpperLeftCoords; _curCoords = 0; _features.upperLeftCoords.resize(count); } else if (command == TXICommandWaterHeight) line.parse(_features.waterHeight, skip); else if (command == TXICommandWaterWidth) line.parse(_features.waterWidth, skip); else if (command == TXICommandXBoxDownsample) line.parse(_features.xBoxDownsample, skip); } }