void cInterfaceWindow::AddButtonND(string image_name, int & ID, int x, int y, int width, int height, bool transparency, bool scale, bool cached) { DirPath dp = ButtonPath(image_name); string on = string(dp.c_str()) + "On.png"; string off = string(dp.c_str()) + "Off.png"; string disabled = ""; AddButton(off, disabled, on, ID, x, y, width, height, transparency, scale, cached); }
void cScrollBar::LoadInitial() { // load static class-wide shared base images into memory; only called once by first scrollbar created DirPath dp = ImagePath("Scroll"); string disabled = string(dp.c_str()) + "LongDisabled.png"; string off = string(dp.c_str()) + "LongOff.png"; string on = string(dp.c_str()) + "LongOn.png"; string bg = string(dp.c_str()) + "LongBackground.png"; string notches = string(dp.c_str()) + "Notches.png"; m_ImgBarBG = IMG_Load(bg.c_str()); SDL_Surface* TmpImg; TmpImg = IMG_Load(disabled.c_str()); m_ImgBarDisabled = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); TmpImg = IMG_Load(off.c_str()); m_ImgBarOff = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); TmpImg = IMG_Load(on.c_str()); m_ImgBarOn = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); TmpImg = IMG_Load(notches.c_str()); m_ImgNotches = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); m_NotchOffset = int(((double)m_ImgNotches->h / 2)); string updisabled = string(dp.c_str()) + "UpDisabled.png"; string upoff = string(dp.c_str()) + "UpOff.png"; string upon = string(dp.c_str()) + "UpOn.png"; string downdisabled = string(dp.c_str()) + "DownDisabled.png"; string downoff = string(dp.c_str()) + "DownOff.png"; string downon = string(dp.c_str()) + "DownOn.png"; TmpImg = IMG_Load(updisabled.c_str()); m_ImgButtonUpDisabled = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); TmpImg = IMG_Load(upoff.c_str()); m_ImgButtonUpOff = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); TmpImg = IMG_Load(upon.c_str()); m_ImgButtonUpOn = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); TmpImg = IMG_Load(downdisabled.c_str()); m_ImgButtonDownDisabled = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); TmpImg = IMG_Load(downoff.c_str()); m_ImgButtonDownOff = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); TmpImg = IMG_Load(downon.c_str()); m_ImgButtonDownOn = SDL_DisplayFormatAlpha(TmpImg); SDL_FreeSurface(TmpImg); }
void FileList::scan( const char * pattern ) { files.clear(); WIN32_FIND_DATAA FindFileData; HANDLE hFind; DirPath loc = folder; loc << pattern; std::string base = folder.c_str(); std::string filename; hFind = FindFirstFileA( loc.c_str(), &FindFileData ); /*int i = 0;*/ while( hFind != INVALID_HANDLE_VALUE ) { filename = FindFileData.cFileName; FileListEntry tempfile( base, filename ); files.push_back( tempfile ); if( FindNextFileA( hFind, &FindFileData ) == 0 ) { break; } } FindClose( hFind ); }
void sConfigData::get_resolution_data(TiXmlElement *el) { resolution.configXML = false; const char *pt; string testa = ""; if (pt = el->Attribute("Resolution")) get_att(el, "Resolution", testa); if (testa != "") { DirPath location = DirPath() << "Resources" << "Interface" << testa; XMLFileList test(location, "*.xml"); if (test.size() > 0) { resolution.resolution = testa; l.ss() << "Success: config.xml: Loading Interface: " << location.c_str(); l.ssend(); } else { l.ss() << "\n\nWarning: config.xml:\n'Resolution' attribute points to an invalid interface folder:\ndefaulting to 'J_1024x768'\n\n"; l.ssend(); } } else { l.ss() << "\n\nWarning: config.xml: No Resolution specified, using defaults.\n\n"; l.ssend(); } if (pt = el->Attribute("Width")) { get_att(el, "Width", &resolution.width); resolution.configXML = true; } if (pt = el->Attribute("Height")) { get_att(el, "Height", &resolution.height); resolution.configXML = true; } if (pt = el->Attribute("ScaleWidth")) { get_att(el, "ScaleWidth", &resolution.scalewidth); } if (pt = el->Attribute("ScaleHeight")) { get_att(el, "ScaleHeight", &resolution.scaleheight); } if (pt = el->Attribute("FullScreen")) { get_att(el, "FullScreen", resolution.fullscreen); } if (pt = el->Attribute("ListScrollAmount")) { get_att(el, "ListScrollAmount", &resolution.list_scroll); } if (pt = el->Attribute("TextScrollAmount")) { get_att(el, "TextScrollAmount", &resolution.text_scroll); } }
cScreenGangs::cScreenGangs() { DirPath dp = DirPath() << "Resources" << "Interface" << "gangs_screen.xml" ; m_filename = dp.c_str(); }
void MasterFile::LoadLegacy( std::string filename ) { files.clear(); std::ifstream ifs; char buffer[1024]; // power of 2 makes better use of memory /* * format the path for the master file. */ std::string mfile = filename + ".mast"; DirPath mastfile = DirPath() << "Saves" << mfile; filename = mastfile.c_str(); /* * open the file */ ifs.open( mastfile.c_str() ); /* * problem opening the file? */ if( !ifs.good() ) { ifs.close(); return; } /* * loop through the file, one line at a time */ while( ifs.good() ) { /* * Using "sizeof()" means that the size is right even if the * buffer size is later changed. */ ifs.getline(buffer, sizeof(buffer)-1, '\n'); if( std::string(buffer).empty() == false ) { /* * add the file to the map */ files[std::string(buffer)] = 1; } } ifs.close(); }
bool CGraphics::InitGraphics(string caption, int Width, int Height, int BPP) { cConfig cfg; if (Width == 0 || Height == 0) { if (cfg.resolution.configXML()) { m_ScreenWidth = _G.g_ScreenWidth = cfg.resolution.width(); m_ScreenHeight = _G.g_ScreenHeight = cfg.resolution.height(); _G.g_Fullscreen = cfg.resolution.fullscreen(); } else // `J` merged ScreenMode.txt into config.xml - left this in for legacy { char buffer[1000]; ifstream incol; // WD: Typecast to resolve ambiguous call in VS 2010 DirPath dp = DirPath() << "ScreenMode.txt"; g_LogFile.write("Reading Screen Mode"); incol.open(dp.c_str()); if (incol) { incol.ignore(1000, '\n'); // ignore first line incol >> _G.g_ScreenWidth >> _G.g_ScreenHeight; incol.ignore(1000, '\n'); // width/height incol.getline(buffer, 1000, '\n'); if (strcmp(buffer, "true") == 0) _G.g_Fullscreen = true; else _G.g_Fullscreen = false; } incol.close(); m_ScreenWidth = _G.g_ScreenWidth; m_ScreenHeight = _G.g_ScreenHeight; } } else {
cScreenGetInput::cScreenGetInput() { DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "getInput.xml"; m_filename = dp.c_str(); }
cScreenMayor::cScreenMayor() { DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "mayor_screen.xml"; m_filename = dp.c_str(); SetBribe = false; }
void LoadInterface() { cTariff tariff; stringstream ss; int r = 0, g = 0, b = 0, a = 0, c = 0, d = 0, e = 0, fontsize = 16, increment = 0, min = 0, max = 0, value = 0; string image = ""; string text = ""; string file = ""; bool Transparency = false, Scale = true, multi = false, events = false, liveUpdate = false; ifstream incol; g_LogFile.write("Begin Loading Interface"); // load interface colors int loadcolors = 0; // 0=default, 1=xml, 2=txt DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "InterfaceColors.xml"; TiXmlDocument docInterfaceColors(dp.c_str()); if (docInterfaceColors.LoadFile()) loadcolors = 1; else // try txt { if (cfg.debug.log_debug()) { g_LogFile.ss() << "Error: line " << docInterfaceColors.ErrorRow() << ", col " << docInterfaceColors.ErrorCol() << ": " << docInterfaceColors.ErrorDesc() << endl; g_LogFile.ssend(); } DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "InterfaceColors.txt"; incol.open(dp.c_str()); loadcolors = (incol.good()) ? 2 : 0; incol.close(); } if (loadcolors == 1) // load "InterfaceColors.xml" { g_LogFile.write("Loading InterfaceColors.xml"); string m_filename = dp.c_str(); TiXmlElement *el, *root_el = docInterfaceColors.RootElement(); for (el = root_el->FirstChildElement(); el; el = el->NextSiblingElement()) { string tag = el->ValueStr(); if (tag == "Color") { XmlUtil xu(m_filename); string name; int r, g, b; xu.get_att(el, "Name", name); xu.get_att(el, "R", r); xu.get_att(el, "G", g); xu.get_att(el, "B", b); if (name == "ImageBackground") { g_StaticImageR = r; g_StaticImageG = g; g_StaticImageB = b; } else if (name == "ChoiceBoxText") { g_ChoiceMessageTextR = r; g_ChoiceMessageTextG = g; g_ChoiceMessageTextB = b; } else if (name == "ChoiceBoxBorder") { g_ChoiceMessageBorderR = r; g_ChoiceMessageBorderG = g; g_ChoiceMessageBorderB = b; } else if (name == "ChoiceBoxBackground") { g_ChoiceMessageBackgroundR = r; g_ChoiceMessageBackgroundG = g; g_ChoiceMessageBackgroundB = b; } else if (name == "ChoiceBoxSelected") { g_ChoiceMessageSelectedR = r; g_ChoiceMessageSelectedG = g; g_ChoiceMessageSelectedB = b; } else if (name == "EditBoxBorder") { g_EditBoxBorderR = r; g_EditBoxBorderG = g; g_EditBoxBorderB = b; } else if (name == "EditBoxBackground") { g_EditBoxBackgroundR = r; g_EditBoxBackgroundG = g; g_EditBoxBackgroundB = b; } else if (name == "EditBoxSelected") { g_EditBoxSelectedR = r; g_EditBoxSelectedG = g; g_EditBoxSelectedB = b; } else if (name == "EditBoxText") { g_EditBoxTextR = r; g_EditBoxTextG = g; g_EditBoxTextB = b; } else if (name == "WindowBorder") { g_WindowBorderR = r; g_WindowBorderG = g; g_WindowBorderB = b; } else if (name == "WindowBackground") { g_WindowBackgroundR = r; g_WindowBackgroundG = g; g_WindowBackgroundB = b; } else if (name == "ListBoxBorder") { g_ListBoxBorderR = r; g_ListBoxBorderG = g; g_ListBoxBorderB = b; } else if (name == "ListBoxBackground") { g_ListBoxBackgroundR = r; g_ListBoxBackgroundG = g; g_ListBoxBackgroundB = b; } else if (name == "ListBoxElementBackground") { g_ListBoxElementBackgroundR = r; g_ListBoxElementBackgroundG = g; g_ListBoxElementBackgroundB = b; } else if (name == "ListBoxSpecialElement1") { g_ListBoxS1ElementBackgroundR = r; g_ListBoxS1ElementBackgroundG = g; g_ListBoxS1ElementBackgroundB = b; } else if (name == "ListBoxSpecialElement2") { g_ListBoxS2ElementBackgroundR = r; g_ListBoxS2ElementBackgroundG = g; g_ListBoxS2ElementBackgroundB = b; } else if (name == "ListBoxSpecialElement3") { g_ListBoxS3ElementBackgroundR = r; g_ListBoxS3ElementBackgroundG = g; g_ListBoxS3ElementBackgroundB = b; } else if (name == "ListBoxSelectedElement") { g_ListBoxSelectedElementR = r; g_ListBoxSelectedElementG = g; g_ListBoxSelectedElementB = b; } else if (name == "ListBoxSelectedSpecialElement1") { g_ListBoxSelectedS1ElementR = r; g_ListBoxSelectedS1ElementG = g; g_ListBoxSelectedS1ElementB = b; } else if (name == "ListBoxSelectedSpecialElement2") { g_ListBoxSelectedS2ElementR = r; g_ListBoxSelectedS2ElementG = g; g_ListBoxSelectedS2ElementB = b; } else if (name == "ListBoxSelectedSpecialElement3") { g_ListBoxSelectedS3ElementR = r; g_ListBoxSelectedS3ElementG = g; g_ListBoxSelectedS3ElementB = b; } else if (name == "ListBoxElementBorderTopLeft") { g_ListBoxElementBorderR = r; g_ListBoxElementBorderG = g; g_ListBoxElementBorderB = b; } else if (name == "ListBoxElementBorderBottomRight") { g_ListBoxElementBorderHR = r; g_ListBoxElementBorderHG = g; g_ListBoxElementBorderHB = b; } else if (name == "ListBoxFont") { g_ListBoxTextR = r; g_ListBoxTextG = g; g_ListBoxTextB = b; } else if (name == "ListBoxColumnHeaderBackground") { g_ListBoxHeaderBackgroundR = r; g_ListBoxHeaderBackgroundG = g; g_ListBoxHeaderBackgroundB = b; } else if (name == "ListBoxColumnHeaderBorderTopLeft") { g_ListBoxHeaderBorderR = r; g_ListBoxHeaderBorderG = g; g_ListBoxHeaderBorderB = b; } else if (name == "ListBoxColumnHeaderBorderBottomRight"){ g_ListBoxHeaderBorderHR = r; g_ListBoxHeaderBorderHG = g; g_ListBoxHeaderBorderHB = b; } else if (name == "ListBoxColumnHeaderFont") { g_ListBoxHeaderTextR = r; g_ListBoxHeaderTextG = g; g_ListBoxHeaderTextB = b; } else if (name == "MessageBoxBorder") { g_MessageBoxBorderR = r; g_MessageBoxBorderG = g; g_MessageBoxBorderB = b; } else if (name == "MessageBoxBackground0") { g_MessageBoxBackground0R = r; g_MessageBoxBackground0G = g; g_MessageBoxBackground0B = b; } else if (name == "MessageBoxBackground1") { g_MessageBoxBackground1R = r; g_MessageBoxBackground1G = g; g_MessageBoxBackground1B = b; } else if (name == "MessageBoxBackground2") { g_MessageBoxBackground2R = r; g_MessageBoxBackground2G = g; g_MessageBoxBackground2B = b; } else if (name == "MessageBoxBackground3") { g_MessageBoxBackground3R = r; g_MessageBoxBackground3G = g; g_MessageBoxBackground3B = b; } else if (name == "MessageBoxText") { g_MessageBoxTextR = r; g_MessageBoxTextG = g; g_MessageBoxTextB = b; } else if (name == "CheckboxBorder") { g_CheckBoxBorderR = r; g_CheckBoxBorderG = g; g_CheckBoxBorderB = b; } else if (name == "CheckboxBackground") { g_CheckBoxBackgroundR = r; g_CheckBoxBackgroundG = g; g_CheckBoxBackgroundB = b; } // ItemRarity is loaded in sConfig.cpp } } } else if (loadcolors==2) { g_LogFile.write("Loading InterfaceColors.txt"); incol.open(dp.c_str()); incol.seekg(0); incol >> r >> g >> b; incol.ignore(1000, '\n'); g_StaticImageR = r; g_StaticImageG = g; g_StaticImageB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ChoiceMessageTextR = r; g_ChoiceMessageTextG = g; g_ChoiceMessageTextB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ChoiceMessageBorderR = r; g_ChoiceMessageBorderG = g; g_ChoiceMessageBorderB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ChoiceMessageBackgroundR = r; g_ChoiceMessageBackgroundG = g; g_ChoiceMessageBackgroundB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ChoiceMessageSelectedR = r; g_ChoiceMessageSelectedG = g; g_ChoiceMessageSelectedB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_EditBoxBorderR = r; g_EditBoxBorderG = g; g_EditBoxBorderB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_EditBoxBackgroundR = r; g_EditBoxBackgroundG = g; g_EditBoxBackgroundB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_EditBoxSelectedR = r; g_EditBoxSelectedG = g; g_EditBoxSelectedB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_EditBoxTextR = r; g_EditBoxTextG = g; g_EditBoxTextB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_WindowBorderR = r; g_WindowBorderG = g; g_WindowBorderB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_WindowBackgroundR = r; g_WindowBackgroundG = g; g_WindowBackgroundB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxBorderR = r; g_ListBoxBorderG = g; g_ListBoxBorderB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxBackgroundR = r; g_ListBoxBackgroundG = g; g_ListBoxBackgroundB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxElementBackgroundR = r; g_ListBoxElementBackgroundG = g; g_ListBoxElementBackgroundB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxS1ElementBackgroundR = r; g_ListBoxS1ElementBackgroundG = g; g_ListBoxS1ElementBackgroundB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxS2ElementBackgroundR = r; g_ListBoxS2ElementBackgroundG = g; g_ListBoxS2ElementBackgroundB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxS3ElementBackgroundR = r; g_ListBoxS3ElementBackgroundG = g; g_ListBoxS3ElementBackgroundB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxSelectedElementR = r; g_ListBoxSelectedElementG = g; g_ListBoxSelectedElementB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxSelectedS1ElementR = r; g_ListBoxSelectedS1ElementG = g; g_ListBoxSelectedS1ElementB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxSelectedS2ElementR = r; g_ListBoxSelectedS2ElementG = g; g_ListBoxSelectedS2ElementB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxSelectedS3ElementR = r; g_ListBoxSelectedS3ElementG = g; g_ListBoxSelectedS3ElementB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxElementBorderR = r; g_ListBoxElementBorderG = g; g_ListBoxElementBorderB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxElementBorderHR = r; g_ListBoxElementBorderHG = g; g_ListBoxElementBorderHB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxTextR = r; g_ListBoxTextG = g; g_ListBoxTextB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxHeaderBackgroundR = r; g_ListBoxHeaderBackgroundG = g; g_ListBoxHeaderBackgroundB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxHeaderBorderR = r; g_ListBoxHeaderBorderG = g; g_ListBoxHeaderBorderB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxHeaderBorderHR = r; g_ListBoxHeaderBorderHG = g; g_ListBoxHeaderBorderHB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_ListBoxHeaderTextR = r; g_ListBoxHeaderTextG = g; g_ListBoxHeaderTextB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_MessageBoxBorderR = r; g_MessageBoxBorderG = g; g_MessageBoxBorderB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_MessageBoxBackground0R = r; g_MessageBoxBackground0G = g; g_MessageBoxBackground0B = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_MessageBoxBackground1R = r; g_MessageBoxBackground1G = g; g_MessageBoxBackground1B = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_MessageBoxBackground2R = r; g_MessageBoxBackground2G = g; g_MessageBoxBackground2B = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_MessageBoxBackground3R = r; g_MessageBoxBackground3G = g; g_MessageBoxBackground3B = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_MessageBoxTextR = r; g_MessageBoxTextG = g; g_MessageBoxTextB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_CheckBoxBorderR = r; g_CheckBoxBorderG = g; g_CheckBoxBorderB = b; incol >> r >> g >> b; incol.ignore(1000, '\n'); g_CheckBoxBackgroundR = r; g_CheckBoxBackgroundG = g; g_CheckBoxBackgroundB = b; incol.close(); }
// `J` Totally new method for image handling for .06.02.00 void cInterfaceWindow::PrepareImage(int id, sGirl* girl, int imagetype, bool rand, int ImageNum, bool gallery, string ImageName) { if (!girl) return; // no girl, no images if (m_Images[id] && m_Images[id]->m_AnimatedImage && m_Images[id]->m_AnimatedImage->getNumFrames() > 0) { AG_FreeSurfaces(m_Images[id]->m_AnimatedImage->getAFrames(), m_Images[id]->m_AnimatedImage->getNumFrames()); m_Images[id]->m_AnimatedImage->m_Gif = false; m_Images[id]->m_AnimatedImage = 0; } string girlName = girl->m_Name; int dir = 0; DirPath usedir = ""; DirPath imagedirCc = DirPath(cfg.folders.characters().c_str()) << girlName; // usedir = 1 DirPath imagedirCo = DirPath() << "Resources" << "Characters" << girlName; // usedir = 2 DirPath imagedirDc = DirPath(cfg.folders.defaultimageloc().c_str()); // usedir = -1 DirPath imagedirDo = DirPath() << "Resources" << "DefaultImages"; // usedir = -2 FileList tiCc(imagedirCc, "*.*"); FileList tiCo(imagedirCo, "*.*"); FileList tiDc(imagedirDc, "*.*"); FileList tiDo(imagedirDo, "*.*"); int totalimagesCc = tiCc.size(); int totalimagesCo = tiCo.size(); int totalimagesDc = tiDc.size(); int totalimagesDo = tiDo.size(); if (totalimagesCc + totalimagesCo + totalimagesDc + totalimagesDo < 1) // no images at all so return a blank image { m_Images[id]->m_Image = new CSurface(ImagePath("blank.png")); m_Images[id]->m_AnimatedImage = 0; m_Images[id]->m_Image->m_Message = "No image found."; return; } int tries = 40; if (gallery) tries = 0; else // try some corrections { if (cfg.folders.preferdefault() || totalimagesCc + totalimagesCo < 1) tries = 10; if (imagetype < 0 || imagetype > NUM_IMGTYPES) imagetype = IMGTYPE_PROFILE; if (girl->is_pregnant() && imagetype < IMGTYPE_PREGNANT) imagetype += PREG_OFFSET; if (!girl->is_pregnant() && imagetype == IMGTYPE_PREGNANT) imagetype = IMGTYPE_PROFILE; if (!girl->is_pregnant() && imagetype > IMGTYPE_PREGNANT) imagetype -= PREG_OFFSET; } string file = ""; string filename = ""; string ext = ""; bool imagechosen = false; do { int tryimagetype = TryImageType(imagetype, tries); // choose an image folder dir = 0; usedir = ""; string checkfor = pic_types[tryimagetype] + "*"; if (tryimagetype == IMGTYPE_PREGNANT) checkfor = "pregnant*.*"; if (totalimagesCc > 0) { FileList testall(imagedirCc, checkfor.c_str()); if (tryimagetype == IMGTYPE_PREGNANT) { for (u_int i = 0; i < numeric.size(); i++) { string t = ("preg" + numeric.substr(i, 1) + "*.*"); testall.add(t.c_str()); } } if (testall.size() > 0) { usedir = imagedirCc; dir = 1; } } if (dir == 0 && totalimagesCo > 0) // if config is not found, check for images in the original folder { FileList testall(imagedirCo, checkfor.c_str()); if (tryimagetype == IMGTYPE_PREGNANT) { for (u_int i = 0; i < numeric.size(); i++) { string t = ("preg" + numeric.substr(i, 1) + "*.*"); testall.add(t.c_str()); } } if (testall.size() > 0) { usedir = imagedirCo; dir = 2; } } if (dir == 0 && gallery) // gallery stops here if there are no images { m_Images[id]->m_Image = new CSurface(ImagePath("blank.png")); m_Images[id]->m_AnimatedImage = 0; m_Images[id]->m_Image->m_Message = "No images found."; break; } // if neither character folder has what we are looking for try the defaults if (totalimagesDc > 0 && dir == 0 && tries < 10) { FileList testall(imagedirDc, checkfor.c_str()); if (tryimagetype == IMGTYPE_PREGNANT) { for (u_int i = 0; i < numeric.size(); i++) { string t = ("preg" + numeric.substr(i, 1) + "*.*"); testall.add(t.c_str()); } } if (testall.size() > 0) { usedir = imagedirDc; dir = -1; } } if (totalimagesDo > 0 && dir == 0 && tries < 10) { FileList testall(imagedirDo, checkfor.c_str()); if (tryimagetype == IMGTYPE_PREGNANT) { for (u_int i = 0; i < numeric.size(); i++) { string t = ("preg" + numeric.substr(i, 1) + "*.*"); testall.add(t.c_str()); } } if (testall.size() > 0) { usedir = imagedirDo; dir = -2; } } if (dir == 0) { m_Images[id]->m_Image = new CSurface(ImagePath("blank.png")); m_Images[id]->m_AnimatedImage = 0; m_Images[id]->m_Image->m_Message = "No images found."; continue; } FileList testall(usedir, checkfor.c_str()); if (tryimagetype == IMGTYPE_PREGNANT) { for (u_int i = 0; i < numeric.size(); i++) { string t = ("preg" + numeric.substr(i, 1) + "*.*"); testall.add(t.c_str()); } } if (testall.size() <= 0) continue; int num = ImageNum; if (rand || ImageNum < 0 || ImageNum >= testall.size()) num = g_Dice%testall.size(); file = testall[num].full(); filename = testall[num].leaf(); ext = stringtolowerj(filename.substr(filename.find_last_of('.') + 1, filename.size())); if (ext == "ani") { DirPath anidir = usedir; anidir << "ani"; string name = filename; name.erase(name.size() - 4, 4); name += ".jpg"; FileList testani(anidir, name.c_str()); if (testani.size() <= 0) { if (gallery) { m_Images[id]->m_Image = new CSurface(ImagePath("blank.png")); m_Images[id]->m_AnimatedImage = 0; m_Images[id]->m_Image->m_Message = "Bad ani file: Missing its matching jpg file: " + file; return; } continue; } anidir << name; cImage* newImage = new cImage(); newImage->m_Surface = new CSurface(); newImage->m_Surface->LoadImage(anidir.c_str()); newImage->m_AniSurface = new cAnimatedSurface(); int numFrames, speed, aniwidth, aniheight; ifstream input; input.open(file.c_str()); if (!input) { g_LogFile.ss() << "Incorrect data file given for animation - " << file; g_LogFile.ssend(); if (gallery) { m_Images[id]->m_Image = new CSurface(ImagePath("blank.png")); m_Images[id]->m_AnimatedImage = 0; m_Images[id]->m_Image->m_Message = "Bad ani file: Incorrect data file given for animation: " + file; return; } } else { input >> numFrames >> speed >> aniwidth >> aniheight; m_Images[id]->m_AnimatedImage = new cAnimatedSurface(); m_Images[id]->m_AnimatedImage->SetData(0, 0, numFrames, speed, aniwidth, aniheight, newImage->m_Surface); imagechosen = true; m_Images[id]->m_Image->m_Message = file; } input.close(); } else if (ext == "gif") { const char* n = file.c_str(); int frames = AG_LoadGIF(n, NULL, 0); if (frames) { cImage* newImage = new cImage(); newImage->m_Surface = new CSurface(); newImage->m_Surface->LoadImage(file); newImage->m_AniSurface = new cAnimatedSurface(); AG_Frame* gpAG = new AG_Frame[frames]; AG_LoadGIF(n, gpAG, frames); m_Images[id]->m_Image = newImage->m_Surface; m_Images[id]->m_Image->m_Message = file; m_Images[id]->m_AnimatedImage = new cAnimatedSurface(); m_Images[id]->m_AnimatedImage->SetGifData(0, 0, frames, gpAG, newImage->m_Surface); imagechosen = true; } else // if it does not read as a gif, just load it as a normal image { m_Images[id]->m_Image = new CSurface(file); m_Images[id]->m_AnimatedImage = 0; imagechosen = true; } } else { m_Images[id]->m_Image = new CSurface(file); m_Images[id]->m_AnimatedImage = 0; imagechosen = true; } } while (!imagechosen && --tries > 0);
void cListBox::CreateListbox(int ID, int x, int y, int width, int height, int BorderSize, bool MultiSelect, bool ShowHeaders, bool HeaderDiv, bool HeaderSort) { SDL_Rect dest_rect; m_ShowHeaders = ShowHeaders; m_HeaderDividers = HeaderDiv; m_HeaderClicksSort = HeaderSort; m_ID = ID; m_BorderSize = BorderSize; SetPosition(x, y, width, height); m_Border = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, 0, 0, 0, 0); SDL_FillRect(m_Border, 0, SDL_MapRGB(m_Border->format, g_ListBoxBorderR, g_ListBoxBorderG, g_ListBoxBorderB)); m_Background = SDL_CreateRGBSurface(SDL_SWSURFACE, width - (BorderSize * 2) - 16, height - (BorderSize * 2), 32, 0, 0, 0, 0); SDL_FillRect(m_Background, 0, SDL_MapRGB(m_Background->format, g_ListBoxBackgroundR, g_ListBoxBackgroundG, g_ListBoxBackgroundB)); m_NumDrawnElements = height / LISTBOX_ITEMHEIGHT; if (m_ShowHeaders) // Account for headers if shown m_NumDrawnElements--; m_eWidth = (width - (BorderSize * 2)); m_eHeight = LISTBOX_ITEMHEIGHT; m_RedBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_RedBackground, 0, SDL_MapRGB(m_RedBackground->format, g_ListBoxS1ElementBackgroundR, g_ListBoxS1ElementBackgroundG, g_ListBoxS1ElementBackgroundB)); m_DarkBlueBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_DarkBlueBackground, 0, SDL_MapRGB(m_DarkBlueBackground->format, g_ListBoxS2ElementBackgroundR, g_ListBoxS2ElementBackgroundG, g_ListBoxS2ElementBackgroundB)); m_GreenBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_GreenBackground, 0, SDL_MapRGB(m_GreenBackground->format, g_ListBoxS3ElementBackgroundR, g_ListBoxS3ElementBackgroundG, g_ListBoxS3ElementBackgroundB)); m_YellowBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_YellowBackground, 0, SDL_MapRGB(m_YellowBackground->format, g_ListBoxS4ElementBackgroundR, g_ListBoxS4ElementBackgroundG, g_ListBoxS4ElementBackgroundB)); m_ElementBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_ElementBackground, 0, SDL_MapRGB(m_ElementBackground->format, g_ListBoxElementBackgroundR, g_ListBoxElementBackgroundG, g_ListBoxElementBackgroundB)); m_ElementSelectedBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_ElementSelectedBackground, 0, SDL_MapRGB(m_ElementSelectedBackground->format, g_ListBoxSelectedElementR, g_ListBoxSelectedElementG, g_ListBoxSelectedElementB)); m_SelectedRedBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_SelectedRedBackground, 0, SDL_MapRGB(m_SelectedRedBackground->format, g_ListBoxSelectedS1ElementR, g_ListBoxSelectedS1ElementG, g_ListBoxSelectedS1ElementB)); m_SelectedDarkBlueBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_SelectedDarkBlueBackground, 0, SDL_MapRGB(m_SelectedDarkBlueBackground->format, g_ListBoxSelectedS2ElementR, g_ListBoxSelectedS2ElementG, g_ListBoxSelectedS2ElementB)); m_SelectedGreenBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_SelectedGreenBackground, 0, SDL_MapRGB(m_SelectedGreenBackground->format, g_ListBoxSelectedS3ElementR, g_ListBoxSelectedS3ElementG, g_ListBoxSelectedS3ElementB)); m_SelectedYellowBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 2 - 16, m_eHeight - 2, 32, 0, 0, 0, 0); SDL_FillRect(m_SelectedYellowBackground, 0, SDL_MapRGB(m_SelectedYellowBackground->format, g_ListBoxSelectedS3ElementR, g_ListBoxSelectedS3ElementG, g_ListBoxSelectedS3ElementB)); m_ElementBorder = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - 16, m_eHeight, 32, 0, 0, 0, 0); SDL_FillRect(m_ElementBorder, 0, SDL_MapRGB(m_ElementBorder->format, g_ListBoxElementBorderR, g_ListBoxElementBorderG, g_ListBoxElementBorderB)); // "beveled" looking border for bottom & right sides of list element dest_rect.x = m_BorderSize; dest_rect.y = m_BorderSize; dest_rect.h = m_eHeight - m_BorderSize; dest_rect.w = m_eWidth - m_BorderSize - 16; SDL_FillRect(m_ElementBorder, &dest_rect, SDL_MapRGB(m_ElementBorder->format, g_ListBoxElementBorderHR, g_ListBoxElementBorderHG, g_ListBoxElementBorderHB)); if (ShowHeaders) { // background for optional column header box int scroll_space = (HeaderSort) ? 0 : 16; dest_rect.w = m_eWidth - m_BorderSize - scroll_space; m_HeaderBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, m_eWidth - scroll_space, m_eHeight, 32, 0, 0, 0, 0); SDL_FillRect(m_HeaderBackground, 0, SDL_MapRGB(m_HeaderBackground->format, g_ListBoxHeaderBorderR, g_ListBoxHeaderBorderG, g_ListBoxHeaderBorderB)); SDL_FillRect(m_HeaderBackground, &dest_rect, SDL_MapRGB(m_HeaderBackground->format, g_ListBoxHeaderBorderHR, g_ListBoxHeaderBorderHG, g_ListBoxHeaderBorderHB)); dest_rect.h = m_eHeight - (m_BorderSize * 2); dest_rect.w = m_eWidth - (m_BorderSize * 2) - scroll_space; SDL_FillRect(m_HeaderBackground, &dest_rect, SDL_MapRGB(m_HeaderBackground->format, g_ListBoxHeaderBackgroundR, g_ListBoxHeaderBackgroundG, g_ListBoxHeaderBackgroundB)); DirPath dp = ImagePath("ListboxSort"); string Asc = string(dp.c_str()) + "Asc.png"; string Desc = string(dp.c_str()) + "Desc.png"; string None = string(dp.c_str()) + "None.png"; if (m_HeaderSortAsc == 0) m_HeaderSortAsc = IMG_Load(Asc.c_str()); if (m_HeaderSortDesc == 0) m_HeaderSortDesc = IMG_Load(Desc.c_str()); if (m_HeaderUnSort == 0) m_HeaderUnSort = IMG_Load(None.c_str()); // draw the "un-sort" clickable header if (HeaderSort) { m_Divider.x = m_eWidth - 17; m_Divider.w = 2; SDL_FillRect( m_HeaderBackground, &m_Divider, SDL_MapRGB( m_HeaderBackground->format, g_ListBoxHeaderBorderHR, g_ListBoxHeaderBorderHG, g_ListBoxHeaderBorderHB ) ); m_Divider.x++; m_Divider.w = 1; m_Divider.h--; SDL_FillRect(m_HeaderBackground, &m_Divider, SDL_MapRGB(m_HeaderBackground->format, g_ListBoxHeaderBorderR, g_ListBoxHeaderBorderG, g_ListBoxHeaderBorderB)); m_Divider.h++; dest_rect.x = m_eWidth - 15; dest_rect.y = m_BorderSize; dest_rect.h = m_eHeight - 2; dest_rect.w = 14; SDL_BlitSurface(m_HeaderUnSort, 0, m_HeaderBackground, &dest_rect); } } m_Font.LoadFont(cfg.fonts.normal(), 10); m_Font.SetText(""); m_Font.SetColor(g_ListBoxTextR, g_ListBoxTextG, g_ListBoxTextB); m_MultiSelect = MultiSelect; m_Divider.h = m_eHeight - (m_BorderSize * 2) - 3; m_Divider.y = m_BorderSize + 1; }
void cChoiceManager::CreateChoiceBox(int x, int y, int width, int height, int ID, int numChoices, int itemHeight, int MaxStrLen, int fontsize) { DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "ChoiceBox.xml"; TiXmlDocument docChoiceBox(dp.c_str()); int a, b, c, d, e, f; if (docChoiceBox.LoadFile()) { //<Window Name = "ChoiceBox" XPos = "224" YPos = "127" Width = "352" Height = "160" RowHeight = "32" FontSize = "16" / > string m_filename = dp.c_str(); TiXmlElement *el, *root_el = docChoiceBox.RootElement(); for (el = root_el->FirstChildElement(); el; el = el->NextSiblingElement()) { XmlUtil xu(m_filename); xu.get_att(el, "XPos", a); xu.get_att(el, "YPos", b); xu.get_att(el, "Width", c); xu.get_att(el, "Height", d); xu.get_att(el, "RowHeight", e); xu.get_att(el, "FontSize", f); } if (a > 0) x = a; if (b > 0) y = b; if (c > 0) width = c; if (d > 0) height = d; if (e > 0) itemHeight = e; if (f > 0) fontsize = f; } cChoice* newChoice = 0; if (m_Font == 0) { m_Font = new cFont(); m_Font->LoadFont(cfg.fonts.normal(), fontsize); m_Font->SetText(""); m_Font->SetColor(0, 0, 0); } if (MaxStrLen == 0) { newChoice = new cChoice(); if ((height - 2) / itemHeight < numChoices) height = (numChoices*itemHeight) + 2; newChoice->m_NumDrawnElements = (height - 2) / itemHeight; newChoice->m_eWidth = (width - (18)); newChoice->m_eHeight = itemHeight; newChoice->m_NumChoices = numChoices; newChoice->m_CurrChoice = -1; newChoice->m_XPos = x; newChoice->m_YPos = y; newChoice->m_Width = width; newChoice->m_Height = height; newChoice->m_FontSize = fontsize; newChoice->m_Choices = new string[numChoices]; newChoice->m_ID = ID; newChoice->m_Border = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_Border, 0, SDL_MapRGB(newChoice->m_Border->format, 0, 0, 0)); newChoice->m_Background = SDL_CreateRGBSurface(SDL_SWSURFACE, width - (18), height - 2, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_Background, 0, SDL_MapRGB(newChoice->m_Background->format, 88, 163, 113)); newChoice->m_ElementBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_eWidth, newChoice->m_eHeight, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_ElementBackground, 0, SDL_MapRGB(newChoice->m_ElementBackground->format, 88, 163, 113)); newChoice->m_ElementSelectedBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_eWidth, newChoice->m_eHeight, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_ElementSelectedBackground, 0, SDL_MapRGB(newChoice->m_ElementSelectedBackground->format, 229, 227, 52)); if (newChoice->m_eWidth > 120) newChoice->m_HeaderBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_eWidth, 32, 32, 0, 0, 0, 0); else newChoice->m_HeaderBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, 120, 32, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_HeaderBackground, 0, SDL_MapRGB(newChoice->m_HeaderBackground->format, 229, 227, 52)); } else // autosize and center according to the max string size, also shut off the scroll box if not needed { newChoice = new cChoice(); int MaxWidth = 0, MaxHeight = 0; string temp = "W"; for (int i = 0; i<MaxStrLen - 1; i++) temp += "W"; m_Font->GetSize(temp, MaxWidth, MaxHeight); int newHeight = (MaxHeight*numChoices) + 2; if (newHeight > g_Graphics.GetHeight()) newHeight = g_Graphics.GetHeight() - 34; if (MaxWidth > g_Graphics.GetWidth()) MaxWidth = g_Graphics.GetWidth() - 2; newChoice->m_NumDrawnElements = newHeight / MaxHeight; if (newChoice->m_NumDrawnElements >= numChoices) { newChoice->m_ScrollDisabled = true; newChoice->m_eWidth = (MaxWidth); } else newChoice->m_eWidth = (MaxWidth - (18)); newChoice->m_eHeight = MaxHeight; newChoice->m_NumChoices = numChoices; newChoice->m_CurrChoice = -1; newChoice->m_Width = MaxWidth; newChoice->m_Height = newHeight; newChoice->m_FontSize = fontsize; newChoice->m_Choices = new string[numChoices]; newChoice->m_ID = ID; if (newChoice->m_ScrollDisabled) newChoice->m_Border = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_Width + 2, newChoice->m_Height + 2, 32, 0, 0, 0, 0); else newChoice->m_Border = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_Width + 20, newChoice->m_Height + 2, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_Border, 0, SDL_MapRGB(newChoice->m_Border->format, 0, 0, 0)); if (newChoice->m_ScrollDisabled) newChoice->m_Background = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_Width, newChoice->m_Height, 32, 0, 0, 0, 0); else newChoice->m_Background = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_Width - (18), newChoice->m_Height - 2, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_Background, 0, SDL_MapRGB(newChoice->m_Background->format, 88, 163, 113)); newChoice->m_ElementBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_eWidth, newChoice->m_eHeight, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_ElementBackground, 0, SDL_MapRGB(newChoice->m_ElementBackground->format, 88, 163, 113)); newChoice->m_ElementSelectedBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_eWidth, newChoice->m_eHeight, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_ElementSelectedBackground, 0, SDL_MapRGB(newChoice->m_ElementSelectedBackground->format, 229, 227, 52)); if (newChoice->m_eWidth > 120) newChoice->m_HeaderBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, newChoice->m_eWidth, 32, 32, 0, 0, 0, 0); else newChoice->m_HeaderBackground = SDL_CreateRGBSurface(SDL_SWSURFACE, 120, 32, 32, 0, 0, 0, 0); SDL_FillRect(newChoice->m_HeaderBackground, 0, SDL_MapRGB(newChoice->m_HeaderBackground->format, 229, 227, 52)); newChoice->m_XPos = ((g_Graphics.GetWidth() / 2) - (newChoice->m_Width / 2)); newChoice->m_YPos = ((g_Graphics.GetHeight() / 2) - (newChoice->m_Height / 2)); } if (m_UpOn == 0) m_UpOn = new ButtonSurface("UpOn"); if (m_UpOff == 0) m_UpOff = new ButtonSurface("UpOff"); m_CurrUp = m_UpOff; if (m_DownOn == 0) m_DownOn = new ButtonSurface("DownOn"); if (m_DownOff == 0) m_DownOff = new ButtonSurface("DownOff"); m_CurrDown = m_DownOff; if (!m_Parent) { m_Parent = newChoice; return; } cChoice* current = m_Parent; while (current->m_Next) current = current->m_Next; current->m_Next = newChoice; }
cScreenBrothelManagement::cScreenBrothelManagement() { DirPath dp = DirPath() << "Resources" << "Interface" << cfg.resolution.resolution() << "brothel_management.xml"; m_filename = dp.c_str(); }
/* * changed this to take a filename so we can pass config files on the command line * default is config.xml */ sConfigData::sConfigData(const char *a_filename) : fonts() { DirPath dp = DirPath() << a_filename; // `J` moved to root directory DirPath dpold = DirPath() << "Resources" << "Data" << a_filename; string filename = dp.c_str(); string filenameold = dpold.c_str(); l.ss() << "Loading configuration variables from '" << filename << "'"; l.ssend(); /* * make sure we have something playable, * even if the file doesn't load */ set_defaults(); /* * open the file - moan most eloqently in its absence */ TiXmlDocument doc(filename); TiXmlDocument docold(filenameold); if (!doc.LoadFile()) { l.ss() << "Can't load " << filename << " from root directory." << endl << "Error: line " << doc.ErrorRow() << ", col " << doc.ErrorCol() << ": " << doc.ErrorDesc() << endl << "Attempting to load old file " << filenameold << "." << endl; l.ssend(); doc = docold; } if (!doc.LoadFile()) { l.ss() << "can't load " << filename << endl << "Error: line " << doc.ErrorRow() << ", col " << doc.ErrorCol() << ": " << doc.ErrorDesc(); l.ssend(); /* * a bit of narrative for the players: makes it easier to tell * if the config isn't being found */ l.ss() << "*** Game will run with default pricing factors.\n*** This may seem a little easy. To fix this\n*** get a config.xml file from pinkpetal.org\n*** or make one with W***e Master Editor"; l.ssend(); return; } /* * get the docuement root */ TiXmlElement *el, *root_el = doc.RootElement(); /* * loop over the elements attached to the root */ for (el = root_el->FirstChildElement(); el; el = el->NextSiblingElement()) { string tag = el->ValueStr(); // now, depending on the tag name... if (el->ValueStr() == "Folders") { get_folders_data(el); continue; } if (el->ValueStr() == "Resolution") { get_resolution_data(el); continue; } if (el->ValueStr() == "Initial") { get_initial_values(el); continue; } if (el->ValueStr() == "Income") { get_income_factors(el); continue; } if (el->ValueStr() == "Expenses") { get_expense_factors(el); continue; } if (el->ValueStr() == "Gambling") { get_gambling_factors(el); continue; } if (el->ValueStr() == "Prostitution") { get_pros_factors(el); continue; } if (el->ValueStr() == "Catacombs") { get_catacombs_data(el); continue; } if (el->ValueStr() == "SlaveMarket") { get_slave_market_data(el);continue; } if (el->ValueStr() == "Pregnancy") { get_preg_factors(el); continue; } if (el->ValueStr() == "Tax") { get_tax_factors(el); continue; } if (el->ValueStr() == "Gangs") { get_gang_factors(el); continue; } if (el->ValueStr() == "Items") { get_item_data(el); continue; } if (el->ValueStr() == "Fonts") { get_font_data(el); continue; } if (el->ValueStr() == "Debug") { get_debug_flags(el); continue; } l.ss() << "Warning: config.xml: tag: '" << tag << "' unexpected"; l.ssend(); } // check interface for colors DirPath dpi = DirPath() << "Resources" << "Interface" << resolution.resolution << "InterfaceColors.xml"; TiXmlDocument doci(dpi.c_str()); if (doci.LoadFile()) { string m_filename = dpi.c_str(); TiXmlElement *el, *root_el = doci.RootElement(); for (el = root_el->FirstChildElement(); el; el = el->NextSiblingElement()) { string tag = el->ValueStr(); if (tag == "Color") { XmlUtil xu(m_filename); string name; int r, g, b; xu.get_att(el, "Name", name); xu.get_att(el, "R", r); xu.get_att(el, "G", g); xu.get_att(el, "B", b); /* */if (name == "ItemRarity0") ColorConvert.RGBToSDLColor(items.rarity_color[0], r, g, b); else if (name == "ItemRarity1") ColorConvert.RGBToSDLColor(items.rarity_color[1], r, g, b); else if (name == "ItemRarity2") ColorConvert.RGBToSDLColor(items.rarity_color[2], r, g, b); else if (name == "ItemRarity3") ColorConvert.RGBToSDLColor(items.rarity_color[3], r, g, b); else if (name == "ItemRarity4") ColorConvert.RGBToSDLColor(items.rarity_color[4], r, g, b); else if (name == "ItemRarity5") ColorConvert.RGBToSDLColor(items.rarity_color[5], r, g, b); else if (name == "ItemRarity6") ColorConvert.RGBToSDLColor(items.rarity_color[6], r, g, b); else if (name == "ItemRarity7") ColorConvert.RGBToSDLColor(items.rarity_color[7], r, g, b); else if (name == "ItemRarity8") ColorConvert.RGBToSDLColor(items.rarity_color[8], r, g, b); } } } fonts.detailfontsize = 9; // default to 9 then check if it is set in girl_details_screen.xml DirPath dpt = DirPath() << "Resources" << "Interface" << resolution.resolution << "girl_details_screen.xml"; TiXmlDocument doct(dp.c_str()); if (doct.LoadFile()) { string m_filename = dpt.c_str(); TiXmlElement *el, *root_el = doct.RootElement(); for (el = root_el->FirstChildElement(); el; el = el->NextSiblingElement()) { string tag = el->ValueStr(); if (tag == "Text") { XmlUtil xu(m_filename); string name; int f = 9; xu.get_att(el, "Name", name); xu.get_att(el, "FontSize", f, true); if (name == "GirlDescription" && f > 0) { fonts.detailfontsize = f; break; } } } } }