本文整理汇总了C++中aurora::GFFStruct::hasField方法的典型用法代码示例。如果您正苦于以下问题:C++ GFFStruct::hasField方法的具体用法?C++ GFFStruct::hasField怎么用?C++ GFFStruct::hasField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurora::GFFStruct
的用法示例。
在下文中一共展示了GFFStruct::hasField方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadProperties
void Creature::loadProperties(const Aurora::GFFStruct &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();
}
// Portrait
loadPortrait(gff);
// Appearance
_appearance = gff.getUint("Appearance_Type", _appearance);
// Static
_static = gff.getBool("Static", _static);
// Usable
_usable = gff.getBool("Useable", _usable);
}
示例2: loadGIT
void Area::loadGIT(const Aurora::GFFStruct &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"));
}
示例3: createText
KotORWidget::Text KotORWidget::createText(const Aurora::GFFStruct &gff) {
Text text;
if (gff.hasField("TEXT")) {
const Aurora::GFFStruct &t = gff.getStruct("TEXT");
text.font = t.getString("FONT");
text.text = t.getString("TEXT");
text.strRef = t.getUint("STRREF", Aurora::kStrRefInvalid);
const uint32 alignment = t.getUint("ALIGNMENT");
t.getVector("COLOR", text.r, text.g, text.b);
text.pulsing = t.getBool("PULSING");
if (text.text == "(Unitialized)")
text.text.clear();
if (text.strRef != Aurora::kStrRefInvalid)
text.text = TalkMan.getString(text.strRef);
// TODO: KotORWidget::getText(): Alignment
if (alignment == 18) {
text.halign = 0.5;
text.valign = 0.5;
}
}
return text;
}
示例4: loadProperties
void Situated::loadProperties(const Aurora::GFFStruct &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();
}
// Portrait
loadPortrait(gff);
// 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);
// Scripts
readScripts(gff);
}
示例5: createExtend
KotORWidget::Extend KotORWidget::createExtend(const Aurora::GFFStruct &gff) {
Extend extend;
if (gff.hasField("EXTENT")) {
const Aurora::GFFStruct &e = gff.getStruct("EXTENT");
extend.x = (float) e.getSint("LEFT");
extend.y = (float) e.getSint("TOP");
extend.w = (float) e.getSint("WIDTH");
extend.h = (float) e.getSint("HEIGHT");
}
return extend;
}
示例6: loadProperties
void Waypoint::loadProperties(const Aurora::GFFStruct &gff) {
// Tag
_tag = gff.getString("Tag", _tag);
// Map note
_hasMapNote = gff.getBool("MapNoteEnabled", _hasMapNote);
if (gff.hasField("MapNote")) {
Aurora::LocString mapNote;
gff.getLocString("MapNote", mapNote);
_mapNote = mapNote.getString();
}
}
示例7: createBorder
KotORWidget::Border KotORWidget::createBorder(const Aurora::GFFStruct &gff) {
Border border;
if (gff.hasField("BORDER")) {
const Aurora::GFFStruct &b = gff.getStruct("BORDER");
border.corner = b.getString("CORNER");
border.edge = b.getString("EDGE");
border.fill = b.getString("FILL");
border.fillStyle = b.getUint("FILLSTYLE");
border.dimension = b.getUint("DIMENSION");
border.innerOffset = b.getUint("INNEROFFSET");
b.getVector("COLOR", border.r, border.g, border.b);
border.pulsing = b.getBool("PULSING");
}
return border;
}
示例8: load
void Situated::load(const Aurora::GFFStruct &instance, const Aurora::GFFStruct *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::GFFStruct &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.0;
float rotY = Common::rad2deg(bearing);
float rotZ = 0.0;
if (instance.hasField("Orientation")) {
const Aurora::GFFStruct &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);
}