Пример #1
0
WidgetCheckBox::WidgetCheckBox(::Engines::GUI &gui, const Common::UString &tag,
                               const Common::UString &model) :
	ModelWidget(gui, tag, model) {

	_model->setClickable(true);

	Graphics::Aurora::ModelNode *node = 0;

	_model->setState("uncheckeddown");
	if ((node = _model->getNode("XPlane")))
		node->setInvisible(true);

	_model->setState("checkedup");
	if ((node = _model->getNode("XPlane")))
		node->move(0.0, 0.0, -10.0);
	_model->setState("checkeddown");
	if ((node = _model->getNode("XPlane")))
		node->move(0.0, 0.0, -10.0);
	_model->setState("checkedhilite");
	if ((node = _model->getNode("XPlane")))
		node->move(0.0, 0.0, -10.0);

	_state = false;
	_down  = false;
	updateModel(false);
}
Пример #2
0
void Creature::loadHead(PartModels &parts) {
	if (!_model || parts.head.empty())
		return;

	Graphics::Aurora::ModelNode *headHook = _model->getNode("headhook");
	if (!headHook)
		return;

	headHook->addChild(loadModelObject(parts.head));
}
Пример #3
0
float Creature::getCameraHeight() const {
	float height = 1.8f;
	if (_model) {
		Graphics::Aurora::ModelNode *node = _model->getNode("camerahook");
		if (node) {
			float x, y, z;
			node->getPosition(x, y, z);
			height = z;
		}
	}
	return height;
}
Пример #4
0
void ChatModeButton::setPosition(float x, float y, float z) {
	WidgetButton::setPosition(x, y, z);

	getPosition(x, y, z);

	Graphics::Aurora::ModelNode *node = 0;

	float tX = 0.0, tY = 0.0, tZ = 0.0;
	if ((node = _model->getNode("text")))
		node->getPosition(tX, tY, tZ);

	_label->setPosition(x + tX, y + tY - (_label->getHeight() / 2.0), z - tZ);
}
Пример #5
0
void WidgetListBox::getProperties() {
	// Do we have a scroll bar?
	_hasScrollbar = _model->hasNode("scrollmin") && _model->hasNode("scrollmax");

	// Calculate content region

	Graphics::Aurora::ModelNode *node = 0;

	float topX = 8.0f, topY = getHeight() - 6.0f, topZ = 0.0f;
	if ((node = _model->getNode("text0")))
		node->getPosition(topX, topY, topZ);

	float bottomX = getWidth() - (_hasScrollbar ? 25.0f : 3.0f), bottomY = 3.0f, bottomZ = 0.0f;
	if ((node = _model->getNode("text1")))
		node->getPosition(bottomX, bottomY, bottomZ);

	_contentX = topX;
	_contentY = topY;

	_contentWidth  = bottomX - topX;
	_contentHeight = topY - bottomY;
}
Пример #6
0
// TODO: The disk rotation should feel more "natural", i.e. it should
//       be more sluggish.
void CompassWidget::setRotation(float x, float y, float UNUSED(z)) {
	_model->setRotation(-x, 0.0, 0.0);
	Graphics::Aurora::ModelNode *pointer = _model->getNode("cmp_pointer");
	if (pointer)
		pointer->setRotation(0.0, 0.0, y);
}
Пример #7
0
void Creature::loadModel() {
	if (_model)
		return;

	if (_appearanceID == Aurora::kFieldIDInvalid) {
		warning("Creature \"%s\" has no appearance", _tag.c_str());
		return;
	}

	const Aurora::TwoDARow &appearance = TwoDAReg.get2DA("appearance").getRow(_appearanceID);

	if (_portrait.empty())
		_portrait = appearance.getString("PORTRAIT");

	_environmentMap = appearance.getString("ENVMAP");

	if (appearance.getString("MODELTYPE") == "P") {
		getArmorModels();
		getPartModels();
		_model = loadModelObject(_partsSuperModelName);

		for (size_t i = 0; i < kBodyPartMAX; i++) {
			if (_bodyParts[i].modelName.empty())
				continue;

			TextureMan.startRecordNewTextures();

			// Try to load in the corresponding part model
			Graphics::Aurora::Model *partModel = loadModelObject(_bodyParts[i].modelName, _bodyParts[i].textureName);
			if (!partModel)
				continue;

			// Add the loaded model to the appropriate part node
			Graphics::Aurora::ModelNode *partNode = _model->getNode(kBodyPartNodes[i]);
			if (partNode)
				partNode->addChild(partModel);

			std::list<Common::UString> newTextures;
			TextureMan.stopRecordNewTextures(newTextures);

			for (std::list<Common::UString>::const_iterator t = newTextures.begin(); t != newTextures.end(); ++t) {
				Graphics::Aurora::TextureHandle texture = TextureMan.getIfExist(*t);
				if (texture.empty())
					continue;

				_bodyParts[i].textures.push_back(texture);
			}

			finishPLTs(_bodyParts[i].textures);
		}

	} else
		_model = loadModelObject(appearance.getString("RACE"));

	// Positioning

	float x, y, z, angle;

	getPosition(x, y, z);
	setPosition(x, y, z);

	getOrientation(x, y, z, angle);
	setOrientation(x, y, z, angle);

	// Clickable

	if (_model) {
		_model->setTag(_tag);
		_model->setClickable(isClickable());

		_ids.push_back(_model->getID());

		if (!_environmentMap.empty()) {
			Common::UString environmentMap = _environmentMap;
			if (environmentMap.equalsIgnoreCase("default"))
				environmentMap = _area ? _area->getEnvironmentMap() : "";

			_model->setEnvironmentMap(environmentMap);
		}
	}
}