Пример #1
0
// ------------------------------------------------------------------------------------------------
void CMacroCmdManager::initInGame()
{
	// Get all custom icon bitmaps
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CViewRenderer &rVR = *CViewRenderer::getInstance();
	CInterfaceOptions *pIO = CWidgetManager::getInstance()->getOptions("macro_custom_icon");
	if (pIO != NULL)
	{
		string sTmp;
		uint i, nOpt;

		const string prefix[3] = { "bg_", "fg_", "ov_" };
		vector<sint32> *wheretostock[3] = { &_OptBackId, &_OptIconId, &_OptOverId };

		for (nOpt = 0; nOpt < 3; nOpt++)
		{
			i = 0;
			do
			{
				sTmp = pIO->getValStr(prefix[nOpt]+NLMISC::toString(i));
				if (!sTmp.empty())
				{
					sint32 nTexId = rVR.getTextureIdFromName(sTmp);
					wheretostock[nOpt]->push_back(nTexId);
				}
				++i;
			}
			while (!sTmp.empty());
		}
	}

	// Do not begin at 0
	NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:ACT_NUMBER")->setValue64(0);

	// Create the NewKey container. Can edit key, and can assign all actions (not only macroisable ones)
	NewKey = new CModalContainerEditCmd;
	NewKey->create("newkey", true, true);

	// Create the EditCmd container. Cannot edit key, and can assign only macroisable actions
	EditCmd = new CModalContainerEditCmd;
	EditCmd->create("editcmd", false, false);

	// Put the macro id generator after the last macro ID
	for (uint i = 0; i < _Macros.size(); ++i)
	{
		if (_Macros[i].ID >= _MacroIDGenerator)
		{
			_MacroIDGenerator = _Macros[i].ID + 1;
		}
	}
}
Пример #2
0
// ***************************************************************************
bool CGroupFrame::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup)
{
	if(!CInterfaceGroup::parse(cur, parentGroup))
		return false;

	// display
	CXMLAutoPtr ptr((const char*) xmlGetProp (cur, (xmlChar*)"display"));
	_DisplayFrame = true;
	_DisplayFrameDefined= false;
	if (ptr)
	{
		_DisplayFrame = convertBool (ptr);
		_DisplayFrameDefined= true;
	}

	// color
	ptr = (char*) xmlGetProp( cur, (xmlChar*)"color" );
	_Color = CRGBA(255,255,255,255);
	_ColorDefined= false;
	if (ptr)
	{
		_Color = convertColor (ptr);
		_ColorDefined= true;
	}

	// Get the borders texture
	_DispTypeDefined= false;
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CViewRenderer &rVR = pIM->getViewRenderer();

	ptr = (char*) xmlGetProp( cur, (xmlChar*)"options" );
	CInterfaceOptions *pIO = NULL;

	if (ptr)
		pIO = pIM->getOptions(ptr);

	// The first type in display type struct is the default display type
	if (_DispTypes.size() == 0)
	{
		SDisplayType dt;
		dt.Name = "default";
		// get texture ids.
		dt.BorderIds[TextTL]= rVR.getTextureIdFromName ("w_modal_tl.tga");
		dt.BorderIds[TextTM]= rVR.getTextureIdFromName ("w_modal_t.tga");
		dt.BorderIds[TextTR]= rVR.getTextureIdFromName ("w_modal_tr.tga");
		// middle
		dt.BorderIds[TextML]= rVR.getTextureIdFromName ("w_modal_l.tga");
		dt.BorderIds[TextMM]= rVR.getTextureIdFromName ("w_modal_blank.tga");
		dt.BorderIds[TextMR]= rVR.getTextureIdFromName ("w_modal_r.tga");
		// bottom
		dt.BorderIds[TextBL]= rVR.getTextureIdFromName ("w_modal_bl.tga");
		dt.BorderIds[TextBM]= rVR.getTextureIdFromName ("w_modal_b.tga");
		dt.BorderIds[TextBR]= rVR.getTextureIdFromName ("w_modal_br.tga");
		// get size
		rVR.getTextureSizeFromId (dt.BorderIds[TextTL], dt.LeftBorder, dt.TopBorder);
		rVR.getTextureSizeFromId (dt.BorderIds[TextBR], dt.RightBorder, dt.BottomBorder);
		_DispTypes.push_back(dt);
	}

	if (pIO != NULL)
	{
		_DispTypeDefined= true;

		// Look if we find the type...
		uint32 i;
		for (i = 0; i < _DispTypes.size(); ++i)
			if (_DispTypes[i].Name == string((const char*)ptr))
				break;

		if (i == _DispTypes.size())
		{
			SDisplayType dt;
			dt.Name = string((const char*)ptr);
			// get texture ids.
			dt.BorderIds[TextTL]= rVR.getTextureIdFromName (pIO->getValStr("tx_tl"));
			dt.BorderIds[TextTM]= rVR.getTextureIdFromName (pIO->getValStr("tx_t"));
			dt.BorderIds[TextTR]= rVR.getTextureIdFromName (pIO->getValStr("tx_tr"));
			// middle
			dt.BorderIds[TextML]= rVR.getTextureIdFromName (pIO->getValStr("tx_l"));
			dt.BorderIds[TextMM]= rVR.getTextureIdFromName (pIO->getValStr("tx_blank"));
			dt.BorderIds[TextMR]= rVR.getTextureIdFromName (pIO->getValStr("tx_r"));
			// bottom
			dt.BorderIds[TextBL]= rVR.getTextureIdFromName (pIO->getValStr("tx_bl"));
			dt.BorderIds[TextBM]= rVR.getTextureIdFromName (pIO->getValStr("tx_b"));
			dt.BorderIds[TextBR]= rVR.getTextureIdFromName (pIO->getValStr("tx_br"));

			// Tile
			dt.TileBorder[TextTM] = (uint8)pIO->getValSInt32("tile_t");
			dt.TileBorder[TextML] = (uint8)pIO->getValSInt32("tile_l");
			dt.TileBorder[TextMM] = (uint8)pIO->getValSInt32("tile_blank");
			dt.TileBorder[TextMR] = (uint8)pIO->getValSInt32("tile_r");
			dt.TileBorder[TextBM] = (uint8)pIO->getValSInt32("tile_b");

			// get size
			rVR.getTextureSizeFromId (dt.BorderIds[TextTL], dt.LeftBorder, dt.TopBorder);
			rVR.getTextureSizeFromId (dt.BorderIds[TextBR], dt.RightBorder, dt.BottomBorder);
			_DispTypes.push_back(dt);
		}
		_DispType = (uint8)i;
	}
	else
	{
		_DispType = 0;
	}


	return true;
}