本文整理汇总了C++中aurora::GFF3Struct::hasField方法的典型用法代码示例。如果您正苦于以下问题:C++ GFF3Struct::hasField方法的具体用法?C++ GFF3Struct::hasField怎么用?C++ GFF3Struct::hasField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurora::GFF3Struct
的用法示例。
在下文中一共展示了GFF3Struct::hasField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void Situated::load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint) {
// General properties
if (blueprint)
loadProperties(*blueprint); // Blueprint
loadProperties(instance); // Instance
// Specialized object properties
if (blueprint)
loadObject(*blueprint); // Blueprint
loadObject(instance); // Instance
// Appearance
if (_appearanceID == Aurora::kFieldIDInvalid)
throw Common::Exception("Situated object without an appearance");
loadAppearance();
loadSounds();
// Position
float posX = instance.getDouble("X");
float posY = instance.getDouble("Y");
float posZ = instance.getDouble("Z");
if (instance.hasField("Position")) {
const Aurora::GFF3Struct &pos = instance.getStruct("Position");
posX = pos.getDouble("x");
posY = pos.getDouble("y");
posZ = pos.getDouble("z");
}
setPosition(posX, posY, posZ);
// Orientation
float bearing = instance.getDouble("Bearing");
float rotX = 0.0f;
float rotY = 0.0f;
float rotZ = 1.0f;
float rotW = Common::rad2deg(bearing);
if (instance.hasField("Orientation")) {
const Aurora::GFF3Struct &o = instance.getStruct("Orientation");
rotX = o.getDouble("x");
rotY = o.getDouble("y");
rotZ = o.getDouble("z");
rotW = -Common::rad2deg(acos(o.getDouble("w")) * 2.0);
}
setOrientation(rotX, rotY, rotZ, rotW);
}
示例2: loadBlueprint
void Creature::loadBlueprint(const Aurora::GFF3Struct &gff) {
if (gff.hasField("Looks")) {
const Aurora::GFF3Struct &looks = gff.getStruct("Looks");
// Appearance
_appearance = looks.getSint("Appearance", _appearance);
// Head
if (looks.hasField("HeadType")) {
_headType = looks.getSint("HeadType");
}
}
if (gff.hasField("Stats")) {
const Aurora::GFF3Struct &stats = gff.getStruct("Stats");
// Conversation
_conversation = stats.getString("Conversation", _conversation);
// AutoBalance
_autoBalance = stats.getBool("AutoBalance");
}
// Scripts
readScripts(gff);
}
示例3: loadGIT
void Area::loadGIT(const Aurora::GFF3Struct &git) {
if (git.hasField("AreaProperties"))
loadProperties(git.getStruct("AreaProperties"));
if (git.hasField("Placeable List"))
loadPlaceables(git.getList("Placeable List"));
if (git.hasField("Door List"))
loadDoors(git.getList("Door List"));
if (git.hasField("Creature List"))
loadCreatures(git.getList("Creature List"));
}
示例4: loadGIT
void Area::loadGIT(const Aurora::GFF3Struct &git) {
// Waypoints
if (git.hasField("WaypointList"))
loadWaypoints(git.getList("WaypointList"));
// Placeables
if (git.hasField("Placeable List"))
loadPlaceables(git.getList("Placeable List"));
// Doors
if (git.hasField("Door List"))
loadDoors(git.getList("Door List"));
}
示例5: readTint
bool readTint(const Aurora::GFF3Struct &gff, float t[3][4]) {
if (!gff.hasField("Tintable"))
return false;
const Aurora::GFF3Struct &tintable = gff.getStruct("Tintable");
if (!tintable.hasField("Tint"))
return false;
const Aurora::GFF3Struct &tint = tintable.getStruct("Tint");
for (int i = 0; i < 3; i++) {
Common::UString index = Common::UString::format("%d", i + 1);
if (!tint.hasField(index))
continue;
const Aurora::GFF3Struct &tintN = tint.getStruct(index);
t[i][0] = tintN.getUint("r", t[i][0] * 255) / 255.0f;
t[i][1] = tintN.getUint("g", t[i][1] * 255) / 255.0f;
t[i][2] = tintN.getUint("b", t[i][2] * 255) / 255.0f;
t[i][3] = tintN.getUint("a", t[i][3] * 255) / 255.0f;
}
return true;
}
示例6: loadProperties
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);
}
示例7: loadEquippedItems
void Creature::loadEquippedItems(const Aurora::GFF3Struct &gff) {
if (!gff.hasField("Equip_ItemList"))
return;
const Aurora::GFF3List &cEquipped = gff.getList("Equip_ItemList");
for (Aurora::GFF3List::const_iterator e = cEquipped.begin(); e != cEquipped.end(); ++e)
_equippedItems.push_back(new Item(**e));
}
示例8: loadEquipment
void Creature::loadEquipment(const Aurora::GFF3Struct &gff) {
if (!gff.hasField("Equip_ItemList"))
return;
for (const auto &i : gff.getList("Equip_ItemList")) {
InventorySlot slot = InventorySlot(static_cast<int>(std::log2f(i->getID())));
Common::UString tag = i->getString("EquippedRes");
equipItem(tag, slot, false);
}
}
示例9: load
void WidgetListBox::load(const Aurora::GFF3Struct &gff) {
KotORWidget::load(gff);
if (gff.hasField("PROTOITEM")) {
_protoItem = &gff.getStruct("PROTOITEM");
}
if (gff.hasField("LEFTSCROLLBAR")) {
_leftScrollBar = gff.getBool("LEFTSCROLLBAR");
}
if (gff.hasField("SCROLLBAR")) {
_scrollBar = &gff.getStruct("SCROLLBAR");
}
if (gff.hasField("PADDING")) {
_padding = gff.getSint("PADDING");
}
}
示例10: loadProperties
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);
}
示例11: loadGIT
void Area::loadGIT(const Aurora::GFF3Struct &git) {
// Generic properties
if (git.hasField("AreaProperties"))
loadProperties(git.getStruct("AreaProperties"));
// Waypoints
if (git.hasField("WaypointList"))
loadWaypoints(git.getList("WaypointList"));
// Placeables
if (git.hasField("Placeable List"))
loadPlaceables(git.getList("Placeable List"));
// Doors
if (git.hasField("Door List"))
loadDoors(git.getList("Door List"));
// Creatures
if (git.hasField("Creature List"))
loadCreatures(git.getList("Creature List"));
}
示例12: readScripts
void ScriptContainer::readScripts(const Aurora::GFF3Struct &gff) {
clearScripts();
if (gff.hasField("Scripts")) {
const Aurora::GFF3Struct &scripts = gff.getStruct("Scripts");
for (size_t i = 0; i < ARRAYSIZE(kScriptNames); i++) {
const Script script = kScriptNames[i].script;
const char *name = kScriptNames[i].name;
_scripts[script] = scripts.getString(name, _scripts[script]);
}
}
}
示例13: loadSAV
void Area::loadSAV(const Aurora::GFF3Struct &sav) {
if (sav.hasField("CreatureList")) {
const Aurora::GFF3Struct &creatures = sav.getStruct("CreatureList");
loadCreatures(creatures.getList("StaticList"));
loadCreatures(creatures.getList("DynamicList"));
}
// TODO load crowd list
if (sav.hasField("PlaceableList")) {
const Aurora::GFF3Struct &placeables = sav.getStruct("PlaceableList");
loadPlaceables(placeables.getList("StaticList"));
loadPlaceables(placeables.getList("DynamicList"));
}
// TODO load sound list
if (sav.hasField("TriggerList")) {
const Aurora::GFF3Struct &trigger = sav.getStruct("TriggerList");
loadTriggers(trigger.getList("StaticList"));
loadTriggers(trigger.getList("DynamicList"));
}
if (sav.hasField("WaypointList")) {
const Aurora::GFF3Struct &waypoints = sav.getStruct("WaypointList");
loadWaypoints(waypoints.getList("StaticList"));
loadWaypoints(waypoints.getList("DynamicList"));
}
// TODO load projectile list
// TODO load area of effect list
// TODO load store list
// TODO load apple list
// TODO load camera list
}
示例14: loadProperties
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);
}
示例15: loadProperties
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();
}