Ejemplo n.º 1
0
LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream)
		: Control(engine, key),
		  _frameInfo(0),
		  _frameCount(0),
		  _startFrame(0),
		  _currentFrame(0),
		  _lastRenderedFrame(0),
		  _mouseIsCaptured(false),
		  _isReturning(false),
		  _accumulatedTime(0),
		  _returnRoutesCurrentFrame(0) {

	// Loop until we find the closing brace
	Common::String line = stream.readLine();
	trimCommentsAndWhiteSpace(&line);

	while (!stream.eos() && !line.contains('}')) {
		if (line.matchString("*descfile*", true)) {
			char levFileName[25];
			sscanf(line.c_str(), "%*[^(](%25[^)])", levFileName);

			parseLevFile(levFileName);
		} else if (line.matchString("*cursor*", true)) {
			char cursorName[25];
			sscanf(line.c_str(), "%*[^(](%25[^)])", cursorName);

			_cursorName = Common::String(cursorName);
		}

		line = stream.readLine();
		trimCommentsAndWhiteSpace(&line);
	}

	renderFrame(_currentFrame);
}
Ejemplo n.º 2
0
LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream)
	: Control(engine, key, CONTROL_LEVER),
	  _frameInfo(0),
	  _frameCount(0),
	  _startFrame(0),
	  _currentFrame(0),
	  _lastRenderedFrame(0),
	  _mouseIsCaptured(false),
	  _isReturning(false),
	  _accumulatedTime(0),
	  _returnRoutesCurrentFrame(0),
	  _animation(NULL),
	  _cursor(CursorIndex_Active),
	  _mirrored(false) {

	// Loop until we find the closing brace
	Common::String line = stream.readLine();
	_engine->getScriptManager()->trimCommentsAndWhiteSpace(&line);

	Common::String param;
	Common::String values;
	getParams(line, param, values);

	while (!stream.eos() && !line.contains('}')) {
		if (param.matchString("descfile", true)) {
			char levFileName[25];
			sscanf(values.c_str(), "%24s", levFileName);

			parseLevFile(levFileName);
		} else if (param.matchString("cursor", true)) {
			char cursorName[25];
			sscanf(values.c_str(), "%24s", cursorName);

			_cursor = _engine->getCursorManager()->getCursorId(Common::String(cursorName));
		}

		line = stream.readLine();
		_engine->getScriptManager()->trimCommentsAndWhiteSpace(&line);
		getParams(line, param, values);
	}

	renderFrame(_currentFrame);
}