void Placeable::load(const Aurora::GFF4Struct &placeable) { _tag = placeable.getString(Aurora::kGFF4Tag); _id = placeable.getUint(40023, 0xFFFFFFFF); _typeID = placeable.getUint(40018, 0xFFFFFFFF); _appearanceID = 0xFFFFFFFF; if (_typeID < ARRAYSIZE(kTypeAppearances)) _appearanceID = kTypeAppearances[_typeID]; if (_appearanceID != 0xFFFFFFFF) { const Aurora::GDAFile &appearances = TwoDAReg.getGDA("appearances"); if (appearances.hasRow(_appearanceID)) { _modelName = appearances.getString(_appearanceID, 2122127238); _scale = appearances.getFloat (_appearanceID, "Scale", 1.0f); } } if (!_modelName.empty()) { /* TODO: This basically just protects against an exception for opening the * same archive twice when loading objects using the same model. * We should probably add some kind of reference counting somewhere... */ try { indexMandatoryArchive(_modelName + ".nsbtx", 100 + _id, &_modelTexture); } catch (...) { } _model = loadModelObject(_modelName); if (_model) { _model->setScale(_scale, _scale, _scale); _model->setClickable(true); _modelID = _model->getID(); } } if (placeable.hasField(Aurora::kGFF4Position)) { double x, y, z; placeable.getVector3(Aurora::kGFF4Position, x, y, z); setPosition(x, y, z); } double orientation = placeable.getDouble(Aurora::kGFF4Orientation); setOrientation(0.0f, Common::rad2deg(orientation), 0.0f); }
void ScriptContainer::readScript(const Aurora::GFF4Struct &gff) { clearScript(); for (size_t i = 0; i < ARRAYSIZE(kScriptFields); i++) _script = gff.getString(kScriptFields[i], _script); }
void Object::readVarTable(const Aurora::GFF4Struct &gff) { if (gff.hasField(kGFF4ScriptVarTable)) readVarTable(gff.getList(kGFF4ScriptVarTable)); }