Beispiel #1
0
void Creature::load(const Aurora::GFF3Struct &creature) {
	Common::UString temp = creature.getString("ResRef");

	if (!temp.empty()) {
		try {
			Common::ScopedPtr<Aurora::GFF3File>
				cre(new Aurora::GFF3File(temp, Aurora::kFileTypeCRE, MKTAG('C', 'R', 'E', ' ')));

			loadBlueprint(cre->getTopLevel());

		} catch (Common::Exception &e) {
			e.add("Creature \"%s\" has no blueprint", temp.c_str());
			throw;
		}
	}

	// Tag
	_tag = creature.getString("Tag");

	// Appearance

	if (_appearance == Aurora::kFieldIDInvalid)
		throw Common::Exception("Creature without an appearance");

	loadAppearance();

	loadInstance(creature);
}
Beispiel #2
0
void Trigger::load(const Aurora::GFF3Struct &gff) {
	Common::UString temp = gff.getString("TemplateResRef");

	Common::ScopedPtr<Aurora::GFF3File> utt;
	if (!temp.empty())
		utt.reset(loadOptionalGFF3(temp, Aurora::kFileTypeUTT, MKTAG('U', 'T', 'T', ' ')));

	loadBlueprint(utt->getTopLevel());

	if (!utt)
		warning("Trigger \"%s\" has no blueprint", temp.c_str());

	float x, y, z;
	x = (float)gff.getDouble("XPosition");
	y = (float)gff.getDouble("YPosition");
	z = (float)gff.getDouble("ZPosition");
	glm::vec3 position(x, y, z);
	setPosition(x, y, z);

	x = (float)gff.getDouble("XOrientation");
	y = (float)gff.getDouble("YOrientation");
	z = (float)gff.getDouble("ZOrientation");
	glm::vec3 orientation(x, y, z);

	const Aurora::GFF3List &geometry = gff.getList("Geometry");
	for (Aurora::GFF3List::const_iterator p = geometry.begin();
			p != geometry.end();
			++p) {
		x = (float)(*p)->getDouble("PointX");
		y = (float)(*p)->getDouble("PointY");
		z = (float)(*p)->getDouble("PointZ");
		_geometry.push_back(position + glm::vec3(x, y, z));
	}
}
Beispiel #3
0
TerrariumEditor::TerrariumEditor(const std::string& blueprintName)
{
    loadBlueprint(blueprintName);
    loadRenderComponents();
    int winW = blueprint.width * blueprint.tileSize;
    int winH = blueprint.height * blueprint.tileSize;
    background.init(winW, winH, blueprint.dirtTexturePath, blueprint.dirtColor);
    spriteMap.init(blueprint.tileSize, blueprint.spriteSheetPath);
    state = State::idle;

    cursor.type = (EntityType)3;
    cursor.locker.xAxisLocked = false;
    cursor.locker.yAxisLocked = false;
    cursor.size = 2;
}
Beispiel #4
0
void Trigger::load(const Aurora::GFF3Struct &trigger) {
	Common::UString temp = trigger.getString("ResRef");

	if (!temp.empty()) {
		Aurora::GFF3File *trg = 0;
		try {
			trg = new Aurora::GFF3File(temp, Aurora::kFileTypeTRG, MKTAG('T', 'R', 'G', ' '));
			loadBlueprint(trg->getTopLevel());
		} catch (...) {
			warning("Trigger \"%s\" has no blueprint", temp.c_str());
			delete trg;
			throw;
		}
		delete trg;
	}

	loadInstance(trigger);
}
Beispiel #5
0
void Trigger::load(const Aurora::GFF3Struct &trigger) {
	Common::UString temp = trigger.getString("ResRef");

	if (!temp.empty()) {
		try {
			Common::ScopedPtr<Aurora::GFF3File>
				trg(new Aurora::GFF3File(temp, Aurora::kFileTypeTRG, MKTAG('T', 'R', 'G', ' ')));

			loadBlueprint(trg->getTopLevel());

		} catch (Common::Exception &e) {
			e.add("Trigger \"%s\" has no blueprint", temp.c_str());
			throw;
		}
	}

	loadInstance(trigger);
}