1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-03 18:14:01 +00:00

Allow custom capes in mods

This commit is contained in:
fgenesis 2015-03-09 04:55:03 +01:00
parent b70de7f94b
commit 9973afbac6
5 changed files with 18 additions and 25 deletions

View file

@ -4110,34 +4110,18 @@ void Avatar::refreshNormalForm()
if (c.empty()) if (c.empty())
c = "Naija"; c = "Naija";
refreshModel("Naija", c); refreshModel("Naija", c);
if (true) if(hair)
{ {
if (hair)
hair->alphaMod = 1.0; hair->alphaMod = 1.0;
if (!c.empty() && c!="Naija") if (!c.empty() && c!="Naija")
{ {
if (exists(core->getBaseTextureDirectory() + "naija/cape-"+c+".png"))
{
if (hair)
hair->setTexture("naija/cape-"+c); hair->setTexture("naija/cape-"+c);
} if (Texture::textureError != TEXERR_OK)
else
{
if (hair)
hair->alphaMod = 0; hair->alphaMod = 0;
} }
}
else else
{
if (hair)
hair->setTexture("naija/cape"); hair->setTexture("naija/cape");
} }
}
else
{
if (hair)
hair->alphaMod = 0.0;
}
} }
void Avatar::refreshModel(std::string file, const std::string &skin, bool forceIdle) void Avatar::refreshModel(std::string file, const std::string &skin, bool forceIdle)

View file

@ -4484,7 +4484,7 @@ Texture *Core::doTextureAdd(const std::string &texture, const std::string &loadN
{ {
t->addRef(); t->addRef();
Texture::textureError = TEXERR_OK; Texture::textureError = t->failed ? TEXERR_FILENOTFOUND : TEXERR_OK;
/* /*
std::ostringstream os; std::ostringstream os;

View file

@ -1328,8 +1328,11 @@ void RenderObject::setTexture(const std::string &n)
if (name.empty()) if (name.empty())
return; return;
if(texture && texture->name == core->getInternalTextureName(name)) if(texture && !texture->failed && texture->name == core->getInternalTextureName(name))
{
Texture::textureError = TEXERR_OK;
return; // no texture change return; // no texture change
}
Texture *oldtex = texture; Texture *oldtex = texture;
Texture *t = core->addTexture(name); Texture *t = core->addTexture(name);

View file

@ -68,6 +68,7 @@ Texture::Texture() : Resource()
repeat = false; repeat = false;
repeating = false; repeating = false;
failed = false;
pngSetStandardOrientation(0); pngSetStandardOrientation(0);
ow = oh = -1; ow = oh = -1;
@ -273,11 +274,13 @@ void Texture::reload()
void Texture::load(std::string file) void Texture::load(std::string file)
{ {
Texture::textureError = TEXERR_OK; Texture::textureError = TEXERR_OK;
failed = false;
if (file.size()<4) if (file.size()<4)
{ {
errorLog("Texture Name is Empty or Too Short"); errorLog("Texture Name is Empty or Too Short");
Texture::textureError = TEXERR_FILENOTFOUND; Texture::textureError = TEXERR_FILENOTFOUND;
failed = true;
return; return;
} }
@ -365,6 +368,7 @@ void Texture::load(std::string file)
Texture::textureError = TEXERR_FILENOTFOUND; Texture::textureError = TEXERR_FILENOTFOUND;
width = 64; width = 64;
height = 64; height = 64;
failed = true;
} }
} }
else else
@ -375,6 +379,7 @@ void Texture::load(std::string file)
Texture::textureError = TEXERR_FILENOTFOUND; Texture::textureError = TEXERR_FILENOTFOUND;
width = 64; width = 64;
height = 64; height = 64;
failed = true;
} }
} }
@ -464,6 +469,7 @@ void Texture::loadPNG(const std::string &file)
width = 64; width = 64;
height = 64; height = 64;
Texture::textureError = TEXERR_FILENOTFOUND; Texture::textureError = TEXERR_FILENOTFOUND;
failed = true;
} }
if(memptr) if(memptr)

View file

@ -62,7 +62,7 @@ public:
static ImageTGA *TGAloadMem(void *mem, int size); static ImageTGA *TGAloadMem(void *mem, int size);
static bool useMipMaps; static bool useMipMaps;
bool repeat, repeating; bool repeat, repeating, failed;
#ifdef BBGE_BUILD_OPENGL #ifdef BBGE_BUILD_OPENGL
static GLint filter; static GLint filter;