mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Fixed: #1082 Interface texturemaps can be configured in cfg file, png and tga inside interface texturemap treated equally.
This commit is contained in:
parent
a1fcd412b1
commit
61f2851a2b
4 changed files with 114 additions and 11 deletions
|
@ -169,6 +169,24 @@
|
|||
else \
|
||||
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
|
||||
|
@ -183,6 +201,7 @@
|
|||
#define READ_STRING_DEV(variableName) _READ_STRING(variableName)
|
||||
#define READ_CVECTOR_DEV(variableName) _READ_CVECTOR(variableName)
|
||||
#define READ_ENUM_ASINT_DEV(type, variableName) _READ_ENUM_ASINT(type, variableName)
|
||||
#define READ_STRINGVECTOR_DEV(variableName) _READ_STRINGVECTOR(variableName)
|
||||
#else // !FINAL_VERSION
|
||||
#define READ_BOOL_DEV(variableName)
|
||||
#define READ_INT_DEV(variableName)
|
||||
|
@ -192,6 +211,7 @@
|
|||
#define READ_STRING_DEV(variableName)
|
||||
#define READ_CVECTOR_DEV(variableName)
|
||||
#define READ_ENUM_ASINT_DEV(type, variableName)
|
||||
#define READ_STRINGVECTOR_DEV(variableName)
|
||||
#endif // !FINAL_VERSION
|
||||
|
||||
//-----------------------------------------------
|
||||
|
@ -206,6 +226,7 @@
|
|||
#define READ_STRING_FV(variableName) _READ_STRING(variableName)
|
||||
#define READ_CVECTOR_FV(variableName) _READ_CVECTOR(variableName)
|
||||
#define READ_ENUM_ASINT_FV(type, variableName) _READ_ENUM_ASINT(type, variableName)
|
||||
#define READ_STRINGVECTOR_FV(variableName) _READ_STRINGVECTOR(variableName)
|
||||
|
||||
///////////
|
||||
// USING //
|
||||
|
@ -278,6 +299,22 @@ CClientConfig::CClientConfig()
|
|||
Local = false; // Default is Net Mode.
|
||||
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;
|
||||
CreateAccountURL = "https://secure.ryzom.com/signup/from_client.php";
|
||||
ConditionsTermsURL = "https://secure.ryzom.com/signup/terms_of_use.php";
|
||||
|
@ -703,6 +740,18 @@ void CClientConfig::setValues()
|
|||
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
|
||||
ClientCfg.XMLLoginInterfaceFiles.clear ();
|
||||
CConfigFile::CVar *pcvXMLLoginInterface = ClientCfg.ConfigFile.getVarPtr("XMLLoginInterfaceFiles");
|
||||
|
|
|
@ -79,13 +79,24 @@ struct CClientConfig
|
|||
/// Selected slot in select char interface
|
||||
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
|
||||
std::vector<string> XMLLoginInterfaceFiles;
|
||||
|
||||
/// vector of XML file names that describe the interfaces config for outgame menus
|
||||
std::vector<string> XMLOutGameInterfaceFiles;
|
||||
|
||||
|
||||
/// vector of XML file names that describe the interfaces config
|
||||
std::vector<string> XMLInterfaceFiles;
|
||||
|
||||
|
|
|
@ -456,7 +456,19 @@ void CInterfaceManager::initLogin()
|
|||
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);
|
||||
|
||||
|
@ -534,7 +546,19 @@ void CInterfaceManager::initOutGame()
|
|||
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);
|
||||
|
||||
|
@ -801,14 +825,19 @@ void CInterfaceManager::initInGame()
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
void CInterfaceManager::loadIngameInterfaceTextures()
|
||||
{
|
||||
// The order is important here, because in a layer, global texture are rendered through this order
|
||||
loadTextures ("texture_interfaces_v3.tga", "texture_interfaces_v3.txt");
|
||||
nldebug("Textures Ingame Interface");
|
||||
|
||||
// DXTC contain all items and bricks bitmaps, they must come after standard texture
|
||||
loadTextures ("new_texture_interfaces_dxtc.tga", "new_texture_interfaces_dxtc.txt");
|
||||
for (vector<string>::iterator it = ClientCfg.TexturesInterface.begin(), end = ClientCfg.TexturesInterface.end(); it != end; ++it)
|
||||
{
|
||||
nldebug("Textures Ingame Interface: %s", (*it).c_str());
|
||||
loadTextures(*it + ".tga", *it + ".txt", false);
|
||||
}
|
||||
|
||||
// Added icons by Yubo's Team 2009
|
||||
loadTextures ("texture_extra.tga", "texture_extra.txt");
|
||||
for (vector<string>::iterator it = ClientCfg.TexturesInterfaceDXTC.begin(), end = ClientCfg.TexturesInterfaceDXTC.end(); it != end; ++it)
|
||||
{
|
||||
nldebug("Textures Ingame Interface DXTC: %s", (*it).c_str());
|
||||
loadTextures(*it + ".tga", *it + ".txt", true);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -744,6 +744,13 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std:
|
|||
image.UVMax.V = uvMaxV;
|
||||
sTGAname = tgaName;
|
||||
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.GlobalTexturePtr = &(_GlobalTextures.back());
|
||||
if (getTextureIdFromName(sTGAname) != -1)
|
||||
|
@ -1025,6 +1032,13 @@ sint32 CViewRenderer::getTextureIdFromName (const string &sName) const
|
|||
static string nameLwr;
|
||||
nameLwr= sName;
|
||||
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
|
||||
TTextureMap::const_iterator it= _TextureMap.find(nameLwr);
|
||||
|
|
Loading…
Reference in a new issue