Fixed: #1082 Interface texturemaps can be configured in cfg file, png and tga inside interface texturemap treated equally.

This commit is contained in:
kaetemi 2010-08-27 22:15:51 +02:00
parent a1fcd412b1
commit 61f2851a2b
4 changed files with 114 additions and 11 deletions

View file

@ -169,6 +169,24 @@
else \ else \
cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \ cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
//-----------------------------------------------
/// Macro to read a String Vector from the CFG.
/// variableName : Variable Name to Read and Set.
//-----------------------------------------------
#define _READ_STRINGVECTOR(variableName) \
/* Read the Variable Value From Script */ \
varPtr = ClientCfg.ConfigFile.getVarPtr(#variableName); \
/* Value found, set the Variable */ \
if(varPtr) \
{ \
ClientCfg.variableName.clear (); \
int iSz = varPtr->size(); \
for (int i = 0; i < iSz; i++) \
ClientCfg.variableName.push_back(varPtr->asString(i)); \
} \
/* Use the Default Value */ \
else \
cfgWarning("CFG: Default value used for '"#variableName"' !!!"); \
//----------------------------------------------- //-----------------------------------------------
// Macro for the dev version // Macro for the dev version
@ -183,6 +201,7 @@
#define READ_STRING_DEV(variableName) _READ_STRING(variableName) #define READ_STRING_DEV(variableName) _READ_STRING(variableName)
#define READ_CVECTOR_DEV(variableName) _READ_CVECTOR(variableName) #define READ_CVECTOR_DEV(variableName) _READ_CVECTOR(variableName)
#define READ_ENUM_ASINT_DEV(type, variableName) _READ_ENUM_ASINT(type, variableName) #define READ_ENUM_ASINT_DEV(type, variableName) _READ_ENUM_ASINT(type, variableName)
#define READ_STRINGVECTOR_DEV(variableName) _READ_STRINGVECTOR(variableName)
#else // !FINAL_VERSION #else // !FINAL_VERSION
#define READ_BOOL_DEV(variableName) #define READ_BOOL_DEV(variableName)
#define READ_INT_DEV(variableName) #define READ_INT_DEV(variableName)
@ -192,6 +211,7 @@
#define READ_STRING_DEV(variableName) #define READ_STRING_DEV(variableName)
#define READ_CVECTOR_DEV(variableName) #define READ_CVECTOR_DEV(variableName)
#define READ_ENUM_ASINT_DEV(type, variableName) #define READ_ENUM_ASINT_DEV(type, variableName)
#define READ_STRINGVECTOR_DEV(variableName)
#endif // !FINAL_VERSION #endif // !FINAL_VERSION
//----------------------------------------------- //-----------------------------------------------
@ -206,6 +226,7 @@
#define READ_STRING_FV(variableName) _READ_STRING(variableName) #define READ_STRING_FV(variableName) _READ_STRING(variableName)
#define READ_CVECTOR_FV(variableName) _READ_CVECTOR(variableName) #define READ_CVECTOR_FV(variableName) _READ_CVECTOR(variableName)
#define READ_ENUM_ASINT_FV(type, variableName) _READ_ENUM_ASINT(type, variableName) #define READ_ENUM_ASINT_FV(type, variableName) _READ_ENUM_ASINT(type, variableName)
#define READ_STRINGVECTOR_FV(variableName) _READ_STRINGVECTOR(variableName)
/////////// ///////////
// USING // // USING //
@ -278,6 +299,22 @@ CClientConfig::CClientConfig()
Local = false; // Default is Net Mode. Local = false; // Default is Net Mode.
FSHost = ""; // Default Host. FSHost = ""; // Default Host.
#if 1 // Yubo hack
// The order is important here, because in a layer, global texture are rendered through this order
TexturesInterface.push_back("texture_interfaces_v3");
// DXTC contain all items and bricks bitmaps, they must come after standard texture
TexturesInterface.push_back("new_texture_interfaces_dxtc");
// Added icons by Yubo's Team 2009
TexturesInterface.push_back("texture_extra");
#else
TexturesInterface.push_back("texture_interfaces_v3");
TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc");
#endif
TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui");
TexturesLoginInterface.push_back("texture_interfaces_v3_login");
DisplayAccountButtons = true; DisplayAccountButtons = true;
CreateAccountURL = "https://secure.ryzom.com/signup/from_client.php"; CreateAccountURL = "https://secure.ryzom.com/signup/from_client.php";
ConditionsTermsURL = "https://secure.ryzom.com/signup/terms_of_use.php"; ConditionsTermsURL = "https://secure.ryzom.com/signup/terms_of_use.php";
@ -703,6 +740,18 @@ void CClientConfig::setValues()
ClientCfg.SelectedSlot = 0; ClientCfg.SelectedSlot = 0;
} }
// interface textures login menus
READ_STRINGVECTOR_FV(TexturesLoginInterface);
READ_STRINGVECTOR_FV(TexturesLoginInterfaceDXTC);
// interface textures outgame menus
READ_STRINGVECTOR_FV(TexturesOutGameInterface);
READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC);
// interface textures ingame and r2
READ_STRINGVECTOR_FV(TexturesInterface);
READ_STRINGVECTOR_FV(TexturesInterfaceDXTC);
// interface files login menus // interface files login menus
ClientCfg.XMLLoginInterfaceFiles.clear (); ClientCfg.XMLLoginInterfaceFiles.clear ();
CConfigFile::CVar *pcvXMLLoginInterface = ClientCfg.ConfigFile.getVarPtr("XMLLoginInterfaceFiles"); CConfigFile::CVar *pcvXMLLoginInterface = ClientCfg.ConfigFile.getVarPtr("XMLLoginInterfaceFiles");

View file

@ -79,13 +79,24 @@ struct CClientConfig
/// Selected slot in select char interface /// Selected slot in select char interface
uint8 SelectedSlot; uint8 SelectedSlot;
/// Textures for interface login
std::vector<string> TexturesLoginInterface;
std::vector<string> TexturesLoginInterfaceDXTC;
/// Textures for interface outgame
std::vector<string> TexturesOutGameInterface;
std::vector<string> TexturesOutGameInterfaceDXTC;
/// Textures for ingame interface and r2 interface
std::vector<string> TexturesInterface;
std::vector<string> TexturesInterfaceDXTC;
/// vector of XML file names that describe the interfaces config for login /// vector of XML file names that describe the interfaces config for login
std::vector<string> XMLLoginInterfaceFiles; std::vector<string> XMLLoginInterfaceFiles;
/// vector of XML file names that describe the interfaces config for outgame menus /// vector of XML file names that describe the interfaces config for outgame menus
std::vector<string> XMLOutGameInterfaceFiles; std::vector<string> XMLOutGameInterfaceFiles;
/// vector of XML file names that describe the interfaces config /// vector of XML file names that describe the interfaces config
std::vector<string> XMLInterfaceFiles; std::vector<string> XMLInterfaceFiles;

View file

@ -456,7 +456,19 @@ void CInterfaceManager::initLogin()
return; return;
} }
loadTextures ("texture_interfaces_v3_login.tga", "texture_interfaces_v3_login.txt"); nldebug("Textures Login Interface");
for (vector<string>::iterator it = ClientCfg.TexturesLoginInterface.begin(), end = ClientCfg.TexturesLoginInterface.end(); it != end; ++it)
{
nldebug("Textures Login Interface: %s", (*it).c_str());
loadTextures(*it + ".tga", *it + ".txt", false);
}
for (vector<string>::iterator it = ClientCfg.TexturesLoginInterfaceDXTC.begin(), end = ClientCfg.TexturesLoginInterfaceDXTC.end(); it != end; ++it)
{
nldebug("Textures Login Interface DXTC: %s", (*it).c_str());
loadTextures(*it + ".tga", *it + ".txt", true);
}
parseInterface (ClientCfg.XMLLoginInterfaceFiles, false); parseInterface (ClientCfg.XMLLoginInterfaceFiles, false);
@ -534,7 +546,19 @@ void CInterfaceManager::initOutGame()
return; return;
} }
loadTextures ("texture_interfaces_v3_outgame_ui.tga", "texture_interfaces_v3_outgame_ui.txt"); nldebug("Textures OutGame Interface");
for (vector<string>::iterator it = ClientCfg.TexturesOutGameInterface.begin(), end = ClientCfg.TexturesOutGameInterface.end(); it != end; ++it)
{
nldebug("Textures OutGame Interface: %s", (*it).c_str());
loadTextures(*it + ".tga", *it + ".txt", false);
}
for (vector<string>::iterator it = ClientCfg.TexturesOutGameInterfaceDXTC.begin(), end = ClientCfg.TexturesOutGameInterfaceDXTC.end(); it != end; ++it)
{
nldebug("Textures OutGame Interface DXTC: %s", (*it).c_str());
loadTextures(*it + ".tga", *it + ".txt", true);
}
parseInterface (ClientCfg.XMLOutGameInterfaceFiles, false); parseInterface (ClientCfg.XMLOutGameInterfaceFiles, false);
@ -801,14 +825,19 @@ void CInterfaceManager::initInGame()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceManager::loadIngameInterfaceTextures() void CInterfaceManager::loadIngameInterfaceTextures()
{ {
// The order is important here, because in a layer, global texture are rendered through this order nldebug("Textures Ingame Interface");
loadTextures ("texture_interfaces_v3.tga", "texture_interfaces_v3.txt");
// DXTC contain all items and bricks bitmaps, they must come after standard texture for (vector<string>::iterator it = ClientCfg.TexturesInterface.begin(), end = ClientCfg.TexturesInterface.end(); it != end; ++it)
loadTextures ("new_texture_interfaces_dxtc.tga", "new_texture_interfaces_dxtc.txt"); {
nldebug("Textures Ingame Interface: %s", (*it).c_str());
loadTextures(*it + ".tga", *it + ".txt", false);
}
// Added icons by Yubo's Team 2009 for (vector<string>::iterator it = ClientCfg.TexturesInterfaceDXTC.begin(), end = ClientCfg.TexturesInterfaceDXTC.end(); it != end; ++it)
loadTextures ("texture_extra.tga", "texture_extra.txt"); {
nldebug("Textures Ingame Interface DXTC: %s", (*it).c_str());
loadTextures(*it + ".tga", *it + ".txt", true);
}
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View file

@ -744,6 +744,13 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
image.UVMax.V = uvMaxV; image.UVMax.V = uvMaxV;
sTGAname = tgaName; sTGAname = tgaName;
sTGAname = strlwr(sTGAname); sTGAname = strlwr(sTGAname);
string::size_type stripPng = sTGAname.find(".png");
if (stripPng != string::npos)
{
sTGAname[stripPng + 1] = 't';
sTGAname[stripPng + 2] = 'g';
sTGAname[stripPng + 3] = 'a';
}
image.Name = sTGAname; image.Name = sTGAname;
image.GlobalTexturePtr = &(_GlobalTextures.back()); image.GlobalTexturePtr = &(_GlobalTextures.back());
if (getTextureIdFromName(sTGAname) != -1) if (getTextureIdFromName(sTGAname) != -1)
@ -1025,6 +1032,13 @@ sint32 CViewRenderer::getTextureIdFromName (const string &sName) const
static string nameLwr; static string nameLwr;
nameLwr= sName; nameLwr= sName;
strlwr(nameLwr); strlwr(nameLwr);
string::size_type stripPng = nameLwr.find(".png");
if (stripPng != string::npos)
{
nameLwr[stripPng + 1] = 't';
nameLwr[stripPng + 2] = 'g';
nameLwr[stripPng + 3] = 'a';
}
// Search in map // Search in map
TTextureMap::const_iterator it= _TextureMap.find(nameLwr); TTextureMap::const_iterator it= _TextureMap.find(nameLwr);