private void lbxTextures_SelectedIndexChanged(object sender, EventArgs e) { if (lbxTextures.SelectedIndex == -1 || lbxTextures.SelectedIndex >= lbxTextures.Items.Count) { return; } string texName = lbxTextures.Items[lbxTextures.SelectedIndex].ToString(); if (rbTexAllInBMD.Checked && m_Model.m_Textures.ContainsKey(texName)) { if (m_Model.m_Textures[texName].m_PalID >= 0 && m_Model.m_Textures[texName].m_PalID < lbxPalettes.Items.Count) { lbxPalettes.SelectedIndex = (int)m_Model.m_Textures[texName].m_PalID; } } if (rbTexAllInBMD.Checked && lbxPalettes.SelectedIndex != -1) { string palName = lbxPalettes.SelectedItem.ToString(); BMD.Texture currentTexture = m_Model.ReadTexture(m_Model.m_TextureIDs[texName], m_Model.m_PaletteIDs[palName]); LoadBitmap(currentTexture); lblTexture.Text = "Texture: (ID " + m_Model.m_TextureIDs[texName] + ")"; } if (rbTexAsRefInBTP.Checked) { txtBTPTextureName.Text = texName; if (m_Model.m_TextureIDs.ContainsKey(texName)) { lblTexture.Text = "Texture: (ID " + m_Model.m_TextureIDs[texName] + ")"; } } }