Пример #1
0
void Creature::loadProperties(const Aurora::GFF3Struct &gff) {
	// Tag
	_tag = gff.getString("Tag", _tag);

	// Name

	Aurora::LocString firstName;
	gff.getLocString("FirstName", firstName);
	Aurora::LocString lastName;
	gff.getLocString("LastName", lastName);

	if (!firstName.empty()) {
		_name = firstName.getString();
		if (!lastName.empty())
			_name += " " + lastName.getString();
	}


	// Description
	_description = gff.getString("Description", _description);

	// Portrait
	loadPortrait(gff);

	// Equipment
	loadEquipment(gff);

	// Appearance
	_appearance = gff.getUint("Appearance_Type", _appearance);

	// Static
	_static = gff.getBool("Static", _static);

	// Usable
	_usable = gff.getBool("Useable", _usable);

	// PC
	_isPC = gff.getBool("IsPC", _isPC);

	// Gender
	_gender = Gender(gff.getUint("Gender"));

	// Race
	_race = Race(gff.getSint("Race", _race));
	_subRace = SubRace(gff.getSint("SubraceIndex", _subRace));

	// Hit Points
	_currentHitPoints = gff.getSint("CurrentHitPoints", _maxHitPoints);
	_maxHitPoints = gff.getSint("MaxHitPoints", _currentHitPoints);

	_minOneHitPoint = gff.getBool("Min1HP", _minOneHitPoint);

	// Faction
	_faction = Faction(gff.getUint("FactionID"));

	// Scripts
	readScripts(gff);

	_conversation = gff.getString("Conversation", _conversation);
}
Пример #2
0
void Situated::loadProperties(const Aurora::GFF3Struct &gff) {
	// Tag
	_tag = gff.getString("Tag", _tag);

	// Name
	_name = gff.getString("Name", _name);

	// Description
	_description = gff.getString("Description", _description);

	// Portrait
	loadPortrait(gff);

	// Appearance
	_appearanceID = gff.getUint("Appearance", _appearanceID);

	// Static
	_static = gff.getBool("Static", _static);

	// Usable
	_usable = gff.getBool("Useable", _usable);

	// Locked
	_locked = gff.getBool("Locked", _locked);

	// Scripts
	readScripts(gff);
}
Пример #3
0
void Situated::loadProperties(const Aurora::GFF3Struct &gff) {
	// Tag
	_tag = gff.getString("Tag", _tag);

	// Name
	_name = gff.getString("LocName", _name);

	// Description
	_description = gff.getString("Description", _description);

	// Appearance
	_appearanceID = gff.getUint("Appearance", _appearanceID);

	// Conversation
	_conversation = gff.getString("Conversation", _conversation);

	// Static
	_static = gff.getBool("Static", _static);

	// Usable
	_usable = gff.getBool("Useable", _usable);

	// Locked
	_locked = gff.getBool("Locked", _locked);

	// Tint
	readTint(gff, _tint);

	// Scripts and variables
	readScripts(gff);
	readVarTable(gff);
}
Пример #4
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);
}
Пример #5
0
void Area::loadARE(const Aurora::GFF3Struct &are) {
	// Tag

	_tag = are.getString("Tag");

	// Name

	_name = are.getString("Name");
	if (!_name.empty() && (*--_name.end() == '\n'))
		_name.erase(--_name.end());

	_displayName = createDisplayName(_name);

	// Tiles

	_width  = are.getUint("Width");
	_height = are.getUint("Height");

	_tilesetName = are.getString("Tileset");

	_tiles.resize(_width * _height);

	loadTiles(are.getList("Tile_List"));

	// Scripts
	readScripts(are);
}
Пример #6
0
void Creature::loadProperties(const Aurora::GFF3Struct &gff) {
	// Tag
	_tag = gff.getString("Tag", _tag);

	// Name
	_name = gff.getString("LocName", _name);

	// Description
	_description = gff.getString("Description", _description);

	// Portrait
	loadPortrait(gff);

	// Appearance
	_appearance = gff.getUint("Appearance_Type", _appearance);

	// Static
	_static = gff.getBool("Static", _static);

	// Usable
	_usable = gff.getBool("Useable", _usable);

	// PC
	_isPC = gff.getBool("IsPC", _isPC);

	// Scripts
	readScripts(gff);
}
Пример #7
0
void Trigger::loadBlueprint(const Aurora::GFF3Struct &gff) {
	Object::_tag = gff.getString("Tag");

	_name = gff.getString("LocalizedName");

	readScripts(gff);
}
Пример #8
0
void Door::loadObject(const Aurora::GFF3Struct &gff) {
	// State

	_state = (State) gff.getUint("AnimationState", (uint) _state);

	// Linked to

	_linkedTo       = gff.getString("LinkedTo"    , _linkedTo);
	_linkedToModule = gff.getString("TargetModule", _linkedToModule);
}
Пример #9
0
void Item::load(const Aurora::GFF3Struct &gff) {
	// Name and description
	_name = gff.getString("Name");
	_description = gff.getString("Description");

	// Base item
	_baseItem = gff.getSint("BaseItem");
	_itemClass = TwoDAReg.get2DA("baseitems").getRow(_baseItem).getString("itemclass");

	// Model variation
	_modelVariation = gff.getSint("ModelVariation");
}
Пример #10
0
void Waypoint::loadProperties(const Aurora::GFF3Struct &gff) {
	// Unique ID and tag

	_uniqueID = gff.getString("UniqueID", _uniqueID);
	_tag      = gff.getString("Tag", _tag);

	// Map note

	_hasMapNote = gff.getBool("HasMapNote", _hasMapNote);
	if (gff.hasField("MapNote"))
		gff.getLocString("MapNote", _mapNote);

	refreshLocalized();
}
Пример #11
0
void Waypoint::loadProperties(const Aurora::GFF3Struct &gff) {
	// Tag
	_tag = gff.getString("Tag", _tag);

	// Map note

	_hasMapNote     = gff.getBool("HasMapNote"    , _hasMapNote);
	_enabledMapNote = gff.getBool("MapNoteEnabled", _enabledMapNote);

	_mapNote = gff.getString("MapNote", _mapNote);

	// Scripts
	readScripts(gff);
}
Пример #12
0
void Waypoint::load(const Aurora::GFF3Struct &waypoint) {
	// Tag

	_tag = waypoint.getString("Tag", _tag);

	loadPositional(waypoint);

	// Map note

	_hasMapNote = waypoint.getBool("MapNoteEnabled", _hasMapNote);
	_displayMapNote = waypoint.getBool("MapNoteDisplay", _displayMapNote);
	_mapNoteType = waypoint.getSint("MapNoteType");
	if (waypoint.hasField("MapNote")) {
		_mapNote = waypoint.getString("MapNote");
	}
}
Пример #13
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));
	}
}
Пример #14
0
void Trigger::loadInstance(const Aurora::GFF3Struct &gff) {
	// Tag

	_tag = gff.getString("Tag", _tag);

	loadPositional(gff);

	const Aurora::GFF3List &geometry = gff.getList("Geometry");
	float x, y, z;

	Graphics::VertexDecl vertexDecl;

	vertexDecl.push_back(Graphics::VertexAttrib(Graphics::VPOSITION, 3, GL_FLOAT));

	_vertexBuffer.setVertexDeclLinear(geometry.size(), vertexDecl);

	float *v = reinterpret_cast<float *>(_vertexBuffer.getData());
	for (uint32 i = 0; i < geometry.size(); i++) {
		geometry[i]->getVector("Vertex", x, y, z);

		// Position
		*v++ = x;
		*v++ = y;
		*v++ = z;
	}
}
Пример #15
0
void Placeable::loadProperties(const Aurora::GFF3Struct &gff) {
	// Tag
	_tag = gff.getString("Tag", _tag);

	// Name and description
	gff.getLocString("LocName"     , _name);
	gff.getLocString("LocPopupText", _description);

	// Conversation
	_conversation = gff.getString("Conversation", _conversation);

	// Static and usable
	_static = !gff.getBool("Active" , !_static);
	_usable =  gff.getBool("Useable",  _usable);

	// Appearance
	_appearanceID = gff.getUint("Appearance", _appearanceID);

	// Position
	if (gff.hasField("XPosition")) {
		const float position[3] = {
			(float) gff.getDouble("XPosition"),
			(float) gff.getDouble("YPosition"),
			(float) gff.getDouble("ZPosition")
		};

		setPosition(position[0], position[1], position[2]);
	}

	// Orientation
	if (gff.hasField("XOrientation")) {
		const float orientation[4] = {
			(float) gff.getDouble("XOrientation"),
			(float) gff.getDouble("YOrientation"),
			(float) gff.getDouble("ZOrientation"),
			(float) Common::rad2deg(acos(gff.getDouble("WOrientation")) * 2.0)
		};

		setOrientation(orientation[0], orientation[1], orientation[2], orientation[3]);
	}

	// Variables and script
	readVarTable(gff);
	readScript(gff);
	enableEvents(true);
}
Пример #16
0
void Door::loadObject(const Aurora::GFF3Struct &gff) {
	_genericType = gff.getUint("GenericType", _genericType);

	// State

	_state = (State) gff.getUint("AnimationState", (uint) _state);

	// Linked to

	_linkedToFlag   = (LinkedToFlag) gff.getUint("LinkedToFlags", (uint) _linkedToFlag);
	_linkedTo       = gff.getString("LinkedTo", _linkedTo);
	_linkedToModule = gff.getString("LinkedToModule", _linkedToModule);

	_transitionDestination = gff.getString("TransitionDestin", _transitionDestination);

	_linkedToType = (ObjectType) (kObjectTypeDoor | kObjectTypeWaypoint);
}
Пример #17
0
void Waypoint::load(const Aurora::GFF3Struct &waypoint) {
	Common::UString temp = waypoint.getString("TemplateResRef");

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

	load(waypoint, utw ? &utw->getTopLevel() : 0);
}
Пример #18
0
void ScriptContainer::readScripts(const Aurora::GFF3Struct &gff) {
	clearScripts();

	for (size_t i = 0; i < ARRAYSIZE(kScriptNames); i++) {
		const Script script = kScriptNames[i].script;
		const char  *name   = kScriptNames[i].name;

		_scripts[script] = gff.getString(name, _scripts[script]);
	}
}
Пример #19
0
void Door::load(const Aurora::GFF3Struct &door) {
	Common::UString temp = door.getString("TemplateResRef");

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

	Situated::load(door, utd ? &utd->getTopLevel() : 0);

	setModelState();
}
Пример #20
0
void Situated::loadProperties(const Aurora::GFF3Struct &gff) {
    // Unique ID and tag
    _uniqueID = gff.getString("UniqueID", _uniqueID);
    _tag      = gff.getString("Tag", _tag);

    // Name
    if (gff.hasField("LocName")) {
        try {
            gff.getLocString("LocName", _name);
        } catch (...) {
        }
    }

    // Description
    if (gff.hasField("Description")) {
        try {
            gff.getLocString("Description", _description);
        } catch (...) {
        }
    }

    refreshLocalized();

    // Appearance
    _modelName = gff.getString("ModelName", _modelName);

    // Sounds
    _soundAppType = gff.getUint("SoundAppType", _soundAppType);

    // Conversation
    _conversation = gff.getString("Conversation", _conversation);

    // Static
    _static = gff.getBool("Static", _static);

    // Usable
    _usable = gff.getBool("Useable", _usable);

    // Locked
    _locked = gff.getBool("Locked", _locked);
}
Пример #21
0
void Situated::loadPortrait(const Aurora::GFF3Struct &gff) {
	uint32 portraitID = gff.getUint("PortraitId");
	if (portraitID != 0) {
		const Aurora::TwoDAFile &twoda = TwoDAReg.get2DA("portraits");

		Common::UString portrait = twoda.getRow(portraitID).getString("BaseResRef");
		if (!portrait.empty())
			_portrait = "po_" + portrait;
	}

	_portrait = gff.getString("Portrait", _portrait);
}
Пример #22
0
void Creature::load(const Aurora::GFF3Struct &creature) {
	Common::UString temp = creature.getString("TemplateResRef");

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

	load(creature, utc ? &utc->getTopLevel() : 0);

	if (!utc)
		warning("Creature \"%s\" has no blueprint", _tag.c_str());
}
Пример #23
0
void Creature::loadPortrait(const Aurora::GFF3Struct &gff, Common::UString &portrait) {
	uint32 portraitID = gff.getUint("PortraitId");
	if (portraitID != 0) {
		const Aurora::TwoDAFile &twoda = TwoDAReg.get2DA("portraits");

		Common::UString portrait2DA = twoda.getRow(portraitID).getString("BaseResRef");
		if (!portrait2DA.empty())
			portrait = "po_" + portrait2DA;
	}

	portrait = gff.getString("Portrait", portrait);
}
Пример #24
0
void Area::loadARE(const Aurora::GFF3Struct &are) {
	// Tag

	_tag = are.getString("Tag");

	// Name

	are.getLocString("Name", _name);
	refreshLocalized();

	// Generic properties

	if (are.hasField("AreaProperties"))
		loadProperties(are.getStruct("AreaProperties"));

	// Area geometry model

	_modelName = are.getString("Tileset");

	// Scripts
	readScripts(are);
}
Пример #25
0
void Situated::loadProperties(const Aurora::GFF3Struct &gff) {
	// Tag
	_tag = gff.getString("Tag", _tag);

	// Name
	if (gff.hasField("LocName")) {
		Aurora::LocString name;
		gff.getLocString("LocName", name);

		_name = name.getString();
	}

	// Description
	if (gff.hasField("Description")) {
		Aurora::LocString description;
		gff.getLocString("Description", description);

		_description = description.getString();
	}

	// Appearance
	_appearanceID = gff.getUint("Appearance", _appearanceID);

	// Conversation
	_conversation = gff.getString("Conversation", _conversation);

	// Static
	_static = gff.getBool("Static", _static);

	// Usable
	_usable = gff.getBool("Useable", _usable);

	// Locked
	_locked = gff.getBool("Locked", _locked);

	// Tint
	readTint(gff, _tint);
}
Пример #26
0
void Door::loadObject(const Aurora::GFF3Struct &gff) {
	// Generic type

	_genericType = gff.getUint("GenericType", _genericType);

	// State

	_state = (State) gff.getUint("AnimationState", (uint) _state);

	// Linked to

	_linkedToFlag = (LinkedToFlag) gff.getUint("LinkedToFlags", (uint) _linkedToFlag);
	_linkedTo     = gff.getString("LinkedTo", _linkedTo);
}
Пример #27
0
void Creature::load(const Aurora::GFF3Struct &utc) {
	// Unique ID and tag
	_uniqueID = utc.getString("UniqueID", _uniqueID);
	_tag      = utc.getString("Tag", _tag);

	// Name
	utc.getLocString("FirstName", _name);

	// Description
	utc.getLocString("Description", _description);

	// Static
	_static = false;

	// Usable
	_static = true;

	// PC
	_isPC = utc.getBool("IsPC", _isPC);

	// Scripts
	readScripts(utc);
}
Пример #28
0
void Placeable::load(const Aurora::GFF3Struct &placeable) {
	Common::UString temp = placeable.getString("TemplateResRef");

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

	Situated::load(placeable, utp ? &utp->getTopLevel() : 0);

	if (!utp)
		warning("Placeable \"%s\" has no blueprint", _tag.c_str());

	readScripts(utp->getTopLevel());
}
Пример #29
0
void Placeable::load(const Aurora::GFF3Struct &placeable) {
	Common::UString temp = placeable.getString("TemplateResRef");

	Aurora::GFF3File *utp = 0;
	if (!temp.empty()) {
		try {
			utp = new Aurora::GFF3File(temp, Aurora::kFileTypeUTP, MKTAG('U', 'T', 'P', ' '));
		} catch (...) {
		}
	}

	Situated::load(placeable, utp ? &utp->getTopLevel() : 0);

	delete utp;
}
Пример #30
0
void Waypoint::load(const Aurora::GFF3Struct &waypoint) {
	Common::UString temp = waypoint.getString("TemplateResRef");

	Aurora::GFF3File *utw = 0;
	if (!temp.empty()) {
		try {
			utw = new Aurora::GFF3File(temp, Aurora::kFileTypeUTW, MKTAG('U', 'T', 'W', ' '));
		} catch (...) {
		}
	}

	load(waypoint, utw ? &utw->getTopLevel() : 0);

	delete utw;
}