本文整理汇总了C++中aurora::GFF3Struct::getStruct方法的典型用法代码示例。如果您正苦于以下问题:C++ GFF3Struct::getStruct方法的具体用法?C++ GFF3Struct::getStruct怎么用?C++ GFF3Struct::getStruct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurora::GFF3Struct
的用法示例。
在下文中一共展示了GFF3Struct::getStruct方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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;
}
示例4: 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");
}
}
示例5: 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
}
示例6: 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"));
}
示例7: 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]);
}
}
}
示例8: 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"));
}
示例9: loadARE
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);
}
示例10: loadProperties
//.........这里部分代码省略.........
// Conversation
_conversation = gff.getString("Conversation", _conversation);
// Sound Set
_soundSet = gff.getUint("SoundSetFile", Aurora::kFieldIDInvalid);
// Gender
_gender = gff.getUint("Gender", _gender);
// Race
_race = gff.getUint("Race", _race);
// Subrace
_subRace = gff.getUint("Subrace", _subRace);
// PC and DM
_isPC = gff.getBool("IsPC", _isPC);
_isDM = gff.getBool("IsDM", _isDM);
// Age
_age = gff.getUint("Age", _age);
// Experience
_xp = gff.getUint("Experience", _xp);
// Abilities
_abilities[kAbilityStrength] = gff.getUint("Str", _abilities[kAbilityStrength]);
_abilities[kAbilityDexterity] = gff.getUint("Dex", _abilities[kAbilityDexterity]);
_abilities[kAbilityConstitution] = gff.getUint("Con", _abilities[kAbilityConstitution]);
_abilities[kAbilityIntelligence] = gff.getUint("Int", _abilities[kAbilityIntelligence]);
_abilities[kAbilityWisdom] = gff.getUint("Wis", _abilities[kAbilityWisdom]);
_abilities[kAbilityCharisma] = gff.getUint("Cha", _abilities[kAbilityCharisma]);
// Classes
loadClasses(gff, _classes, _hitDice);
// Skills
if (gff.hasField("SkillList")) {
_skills.clear();
const Aurora::GFF3List &skills = gff.getList("SkillList");
for (Aurora::GFF3List::const_iterator s = skills.begin(); s != skills.end(); ++s) {
const Aurora::GFF3Struct &skill = **s;
_skills.push_back(skill.getSint("Rank"));
}
}
// Feats
if (gff.hasField("FeatList")) {
_feats.clear();
const Aurora::GFF3List &feats = gff.getList("FeatList");
for (Aurora::GFF3List::const_iterator f = feats.begin(); f != feats.end(); ++f) {
const Aurora::GFF3Struct &feat = **f;
_feats.push_back(feat.getUint("Feat"));
}
}
// Deity
_deity = gff.getString("Deity", _deity);
// Health
if (gff.hasField("HitPoints")) {
_baseHP = gff.getSint("HitPoints");
_bonusHP = gff.getSint("MaxHitPoints", _baseHP) - _baseHP;
_currentHP = gff.getSint("CurrentHitPoints", _baseHP);
}
// Alignment
_goodEvil = gff.getUint("GoodEvil", _goodEvil);
_lawChaos = gff.getUint("LawfulChaotic", _lawChaos);
// Appearance
_appearanceID = gff.getUint("Appearance_Type", _appearanceID);
_appearanceHead = gff.getUint("Appearance_Head" , _appearanceHead);
_appearanceMHair = gff.getUint("Appearance_Hair" , _appearanceMHair);
_appearanceFHair = gff.getUint("Appearance_FHair", _appearanceFHair);
_armorVisualType = gff.getUint("ArmorVisualType", _armorVisualType);
_armorVariation = gff.getUint("Variation" , _armorVariation);
if (gff.hasField("Boots")) {
const Aurora::GFF3Struct &boots = gff.getStruct("Boots");
_bootsVisualType = boots.getUint("ArmorVisualType", _bootsVisualType);
_bootsVariation = boots.getUint("Variation" , _bootsVariation);
}
// Scripts and variables
readScripts(gff);
readVarTable(gff);
}
示例11: 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 = Common::rad2deg(bearing);
float rotZ = 0.0f;
if (instance.hasField("Orientation")) {
const Aurora::GFF3Struct &o = instance.getStruct("Orientation");
float oX = o.getDouble("x");
float oY = o.getDouble("y");
float oZ = o.getDouble("z");
float oW = o.getDouble("w");
// Convert quaternions to roll/pitch/yaw
rotY = 180.0f - Common::rad2deg(atan2(2 * (oX*oY + oZ*oW), 1 - 2 * (oY*oY + oZ*oZ)));
rotX = 180.0f - Common::rad2deg(asin(2 * (oX*oZ - oW*oY)));
rotZ = Common::rad2deg(atan2(2 * (oX*oW + oY*oZ), 1 - 2 * (oZ*oZ + oW*oW)));
}
setOrientation(rotX, rotY, rotZ);
}
示例12: catch
void GFF3Dumper::dumpField(const Aurora::GFF3Struct &strct, const Common::UString &field) {
Aurora::GFF3Struct::FieldType type = strct.getType(field);
Common::UString typeName;
if (((size_t) type) < ARRAYSIZE(kGFF3FieldTypeNames))
typeName = kGFF3FieldTypeNames[(int)type];
else
typeName = "filetype" + Common::composeString((uint64) type);
Common::UString label = field;
// Structs already open their own tag
if (type != Aurora::GFF3Struct::kFieldTypeStruct) {
_xml->openTag(typeName);
_xml->addProperty("label", label);
}
switch (type) {
case Aurora::GFF3Struct::kFieldTypeChar:
_xml->setContents(Common::composeString(strct.getUint(field)));
break;
case Aurora::GFF3Struct::kFieldTypeByte:
case Aurora::GFF3Struct::kFieldTypeUint16:
case Aurora::GFF3Struct::kFieldTypeUint32:
case Aurora::GFF3Struct::kFieldTypeUint64:
_xml->setContents(Common::composeString(strct.getUint(field)));
break;
case Aurora::GFF3Struct::kFieldTypeSint16:
case Aurora::GFF3Struct::kFieldTypeSint32:
case Aurora::GFF3Struct::kFieldTypeSint64:
_xml->setContents(Common::composeString(strct.getSint(field)));
break;
case Aurora::GFF3Struct::kFieldTypeFloat:
case Aurora::GFF3Struct::kFieldTypeDouble:
_xml->setContents(Common::UString::format("%.6f", strct.getDouble(field)));
break;
case Aurora::GFF3Struct::kFieldTypeStrRef:
_xml->setContents(strct.getString(field));
break;
case Aurora::GFF3Struct::kFieldTypeExoString:
case Aurora::GFF3Struct::kFieldTypeResRef:
try {
_xml->setContents(strct.getString(field));
} catch (...) {
_xml->addProperty("base64", "true");
Common::SeekableReadStream *data = strct.getData(field);
_xml->setContents(*data);
delete data;
}
break;
case Aurora::GFF3Struct::kFieldTypeLocString:
{
Aurora::LocString locString;
strct.getLocString(field, locString);
_xml->addProperty("strref", Common::composeString(locString.getID()));
dumpLocString(locString);
}
break;
case Aurora::GFF3Struct::kFieldTypeVoid:
_xml->setContents(*strct.getData(field));
break;
case Aurora::GFF3Struct::kFieldTypeStruct:
dumpStruct(strct.getStruct(field), label);
break;
case Aurora::GFF3Struct::kFieldTypeList:
dumpList(strct.getList(field));
break;
case Aurora::GFF3Struct::kFieldTypeOrientation:
{
double a = 0.0, b = 0.0, c = 0.0, d = 0.0;
strct.getOrientation(field, a, b, c, d);
_xml->breakLine();
_xml->openTag("double");
_xml->setContents(Common::UString::format("%.6f", a));
_xml->closeTag();
_xml->breakLine();
_xml->openTag("double");
_xml->setContents(Common::UString::format("%.6f", b));
_xml->closeTag();
_xml->breakLine();
_xml->openTag("double");
_xml->setContents(Common::UString::format("%.6f", c));
//.........这里部分代码省略.........