logic::CScreen* CScenariosXmlDao::readScreen(TiXmlElement* pScreenElement) { TiXmlHandle hScreen(pScreenElement); TiXmlElement* pPositionElement = hScreen.FirstChild("position").Element(); TiXmlElement* pOrientationElement = hScreen.FirstChild("orientation").Element(); TiXmlElement* pSkinsElement = hScreen.FirstChild("skins").Element(); string id = pScreenElement->Attribute("id"); float interval = 0; pSkinsElement->QueryFloatAttribute("interval", &interval); float x=0,y=0,z=0; pPositionElement->QueryFloatAttribute("x",&x); pPositionElement->QueryFloatAttribute("y",&y); pPositionElement->QueryFloatAttribute("z",&z); float orientation = 0; pOrientationElement->QueryFloatAttribute("value",&orientation); vector<string> skinList = readSkins(pSkinsElement); //cout<<"[ScenariosXmlDao::readScreen]Entidad "<<id<<", ["<<x<<", "<<y<<", "<<z<<"], "<<orientation<<"\n"; logic::CScreen* screen = new logic::CScreen(id, x, y, z, orientation, true); screen->setSkinList(skinList); screen->setInterval(interval); return screen; }
///////////////////////////////////////////////////////////////////////////// // CConfigDisplay message handlers BOOL CConfigDisplay::OnInitDialog() { AutoLog alog("CCD::OnInitDialog"); CPropertyPage::OnInitDialog(); m_FontPanel.Initialize(); m_FontTitles.Initialize(); m_FontColHdr.Initialize(); AutoBuf buf(5); int i; m_SizeTitles.ResetContent(); m_SizePanel.ResetContent(); m_SizeColHdr.ResetContent(); m_BorderWidth.ResetContent(); for (i = 5 ; i < 40; ++i) { sprintf(buf.p, "%d", i); m_SizeTitles.AddString(buf.p); m_SizePanel.AddString(buf.p); m_SizeColHdr.AddString(buf.p); } for (i = 0 ; i < 40; ++i) { sprintf(buf.p, "%d", i); m_BorderWidth.AddString(buf.p); } readSkins(); initFontSels(); int sel = m_SkinList.SelectString(-1, m_sSkinName); m_SkinList.SetCurSel(sel); OnSkinChoose(); sel = m_BorderWidth.SelectString(-1, numToString(m_vBorderWidth)); m_BorderWidth.SetCurSel(sel); showSample(); m_Modified = FALSE; #ifndef _DEBUG m_MakeDefault.ShowWindow(SW_HIDE); #endif EnableDisable(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CConfigDisplay::findGoodSkin() { CStringList list; CString skin ; readSkins(list); POSITION pos ; if (String::CStringListContains(list,"MBClassic")) { skin = "MBClassic"; } else { pos = list.GetHeadPosition(); if (!pos) return FALSE; skin = list.GetAt(pos); } return OnSkinChoose(skin); }
void CConfigDisplay::OnOK() { m2v(); copy2lf(m_lfTitles, m_lfPanel, m_lfColHdr/*,m_lfCurPlay*/); int sel = m_SkinList.GetCurSel(); if (sel > -1) { m_SkinList.GetLBText(sel, m_sSkinName); } else { m_SkinList.GetWindowText(m_sSkinName); } sel = m_BorderWidth.GetCurSel(); if (sel > -1) { CString tmp; m_BorderWidth.GetLBText(sel, tmp); m_vBorderWidth = atoi(tmp); } RegistryKey realreg( HKEY_LOCAL_MACHINE, RegKey ); realreg.Write(RegWindowsSkinName, m_sSkinName); CString skindefcustom = getSkin(MB_SKIN_DEF_CUSTOM, FALSE); RegistryKey regSDCustom(skindefcustom); // This ReadFile() preserves any extra settings in SkinDefCustom file // which may have been put there manually. regSDCustom.ReadFile(); StoreReg(regSDCustom); regSDCustom.WriteFile(); if (m_Modified) { init(); readSkins(); (*m_callbacks->redraw)(); } m_Modified = FALSE; modified(FALSE); sel = m_SkinList.SelectString(-1, m_sSkinName); m_SkinList.SetCurSel(sel); CPropertyPage::OnOK(); }
AHalfLifeDecoder::AHalfLifeDecoder(const char *fname) : AMeshDecoder(fname) { init(); openFile(fname); readHeader(); if(numbones) readBones(); if(numbonecontrollers) readBoneControllers(); if(numhitboxes) readHitBoxes(); if(numseq) readSeqs(); if(numseqgroups) readSeqGroups(); if(numtextures) readTextures(); if(numskinref*numskinfamilies) readSkins(); if(numbodyparts) readBodyParts(); if(numattachments) readAttachments(); if(soundtable) readSounds(); if(soundgroups) readSoundGroups(); if(numtransitions) readTransitions(); }
/** * Lee el tag XML multimedia y devuelve el objeto correspondiente * @param pMultFurElement * @return */ logic::CMultimediaFurniture* CScenariosXmlDao::readMultFur(TiXmlElement* pMultFurElement) { TiXmlHandle hMultFur(pMultFurElement); TiXmlElement* pPositionElement = hMultFur.FirstChild("position").Element(); TiXmlElement* pOrientationElement = hMultFur.FirstChild("orientation").Element(); TiXmlElement* pSkinsElement = hMultFur.FirstChild("skins").Element(); string id = pMultFurElement->Attribute("id"); bool reflect = false; logic::tRGBAColor color; if(pMultFurElement->Attribute("reflect")){ TiXmlElement* pColorElement = hMultFur.FirstChild("color").Element(); pColorElement->QueryFloatAttribute("r",&color.r); pColorElement->QueryFloatAttribute("g",&color.g); pColorElement->QueryFloatAttribute("b",&color.b); pColorElement->QueryFloatAttribute("a",&color.a); //cout<<"[ScenariosXmlDao::readScenario] Elemento: "<<id<<" REFLEJA!!\n"; reflect = true; } float interval = 0; pSkinsElement->QueryFloatAttribute("interval", &interval); float x=0,y=0,z=0; pPositionElement->QueryFloatAttribute("x",&x); pPositionElement->QueryFloatAttribute("y",&y); pPositionElement->QueryFloatAttribute("z",&z); float orientation = 0; pOrientationElement->QueryFloatAttribute("value",&orientation); vector<string> skinList = readSkins(pSkinsElement); logic::CMultimediaFurniture* mult = new logic::CMultimediaFurniture(id, x, y, z, orientation, true, 1.0); mult->setInterval(interval); mult->setSkinList(skinList); mult->setReflection(reflect); mult->setColor(color); return mult; }
vector<KeyFrame> ModelLoaderMD2::loadKeyFrames(const FileName &fileName, const FileName &skinName, TextureFactory &textureFactory) const { FILE *stream=0; // fopen_s(&stream, fileName.c_str(), "rb"); stream = fopen(fileName.c_str(), "rb"); VERIFY(stream && !ferror(stream), "MD2 failed to open: "+fileName.str()); Header header = readHeader(stream); Skin *skins = readSkins(stream, header); TexCoord *texCoords = readTexCoords(stream, header); Triangle *triangles = readTriangles(stream, header); Frame *frames = readFrames(stream, header); fclose(stream); Material skin; if (header.numOfSkins>0) { skin.setTexture(textureFactory.load(FileName((const char*)skins[0].name))); } else { skin.setTexture(textureFactory.load(skinName)); } vector<KeyFrame> keyFrames = buildKeyFrames(fileName, skin, header, texCoords, triangles, frames); delete [] skins; delete [] texCoords; delete [] triangles; delete [] frames; return keyFrames; }