private void SetSelected(VMEntity entity) { SelectedEntity = entity; propertyGrid.SelectedObject = entity; bhavList.Items.Clear(); var resource = entity.Object; var bhavs = resource.Resource.List<BHAV>(); if (bhavs != null) { foreach (var bhav in bhavs) { bhavList.Items.Add(bhav); } } interactionList.Items.Clear(); if (entity.TreeTable != null) { TreeTableSel = entity.TreeTable; foreach (var interaction in entity.TreeTable.Interactions) { interactionList.Items.Add(entity.TreeTableStrings.GetString((int)interaction.TTAIndex)); } } }
public VMEntity(GameObject obj) { this.Object = obj; /** * For some reason, in the aquarium object (maybe others) the numAttributes is set to 0 * but it should be 4. There are 4 entries in the label table. Go figure? */ ObjectData = new short[80]; RTTI = new VMEntityRTTI(); var numAttributes = obj.OBJ.NumAttributes; if (obj.OBJ.UsesInTable == 0) EntryPoints = GenerateFunctionTable(obj.OBJ); else { var OBJfChunks = obj.Resource.List<OBJf>(); if (OBJfChunks != null) EntryPoints = OBJfChunks[0].functions; } var GLOBChunks = obj.Resource.List<GLOB>(); if (GLOBChunks != null) { SemiGlobal = Content.Get().WorldObjectGlobals.Get(GLOBChunks[0].Name); } var attributeTable = obj.Resource.Get<STR>(256); if (attributeTable != null) { numAttributes = (ushort)Math.Max(numAttributes, attributeTable.Length); RTTI.AttributeLabels = new string[numAttributes]; for (var i = 0; i < numAttributes; i++) { RTTI.AttributeLabels[i] = attributeTable.GetString(i); } } TreeTable = obj.Resource.Get<TTAB>(obj.OBJ.TreeTableID); if (TreeTable != null) TreeTableStrings = obj.Resource.Get<TTAs>(obj.OBJ.TreeTableID); if (TreeTable == null && SemiGlobal != null) { TreeTable = SemiGlobal.Resource.Get<TTAB>(obj.OBJ.TreeTableID); //tree not in local, try semiglobal TreeTableStrings = SemiGlobal.Resource.Get<TTAs>(obj.OBJ.TreeTableID); } //no you cannot get global tree tables don't even ask this.Attributes = new short[numAttributes]; if (obj.OBJ.GUID == 0x98E0F8BD) { this.Attributes[0] = 2; } }