mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-10 08:23:22 +00:00
Refactor texture loading code; should fix a crash that started appearing recently.
This commit is contained in:
parent
66cf20ffa9
commit
f0d580d873
22 changed files with 255 additions and 387 deletions
|
@ -847,16 +847,17 @@ void AquariaMenuItem::useSound(const std::string &tex)
|
|||
useSfx = tex;
|
||||
}
|
||||
|
||||
void AquariaMenuItem::useQuad(const std::string &tex)
|
||||
bool AquariaMenuItem::useQuad(const std::string &tex)
|
||||
{
|
||||
if (quad)
|
||||
{
|
||||
debugLog("trying to call useQuad twice on the same object");
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
quad = new Quad;
|
||||
quad->setTexture(tex);
|
||||
bool good = quad->setTexture(tex);
|
||||
addChild(quad, PM_POINTER);
|
||||
return good;
|
||||
}
|
||||
|
||||
void AquariaMenuItem::useGlow(const std::string &tex, int w, int h)
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
XMLElement *ability, *xmlItem;
|
||||
int choice;
|
||||
Quad *glow, *quad;
|
||||
void useQuad(const std::string &tex);
|
||||
bool useQuad(const std::string &tex);
|
||||
void useGlow(const std::string &tex, int w, int h);
|
||||
void useSound(const std::string &tex);
|
||||
|
||||
|
|
|
@ -4115,8 +4115,7 @@ void Avatar::refreshNormalForm()
|
|||
hair->alphaMod = 1.0;
|
||||
if (!c.empty() && c!="Naija")
|
||||
{
|
||||
hair->setTexture("naija/cape-"+c);
|
||||
if (Texture::textureError != TEXERR_OK)
|
||||
if(!hair->setTexture("naija/cape-"+c))
|
||||
hair->alphaMod = 0;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2222,7 +2222,7 @@ void DSQ::refreshResourcesForPatch(const std::string& name)
|
|||
{
|
||||
for(int i = 0; i < dsq->resources.size(); ++i)
|
||||
{
|
||||
Resource *r = dsq->resources[i];
|
||||
Texture *r = dsq->resources[i];
|
||||
if(files.find(r->name) != files.end())
|
||||
r->reload();
|
||||
}
|
||||
|
@ -2313,7 +2313,7 @@ void DSQ::shutdown()
|
|||
SkeletalSprite::clearCache();
|
||||
|
||||
|
||||
cursor->setTexturePointer(0, RenderObject::NO_ADD_REF);
|
||||
cursor->setTexturePointer(0);
|
||||
|
||||
UNREFTEX(texCursor);
|
||||
UNREFTEX(texCursorSwim);
|
||||
|
@ -2410,7 +2410,7 @@ void DSQ::setTexturePointers()
|
|||
texCursorSing = core->addTexture("cursor-sing");
|
||||
|
||||
if (cursor)
|
||||
cursor->setTexturePointer(texCursor, RenderObject::NO_ADD_REF);
|
||||
cursor->setTexturePointer(texCursor);
|
||||
}
|
||||
|
||||
void DSQ::setCursor(CursorType type)
|
||||
|
@ -2418,22 +2418,22 @@ void DSQ::setCursor(CursorType type)
|
|||
switch(type)
|
||||
{
|
||||
case CURSOR_NORMAL:
|
||||
cursor->setTexturePointer(texCursor, RenderObject::NO_ADD_REF);
|
||||
cursor->setTexturePointer(texCursor);
|
||||
break;
|
||||
case CURSOR_LOOK:
|
||||
cursor->setTexturePointer(texCursorLook, RenderObject::NO_ADD_REF);
|
||||
cursor->setTexturePointer(texCursorLook);
|
||||
break;
|
||||
case CURSOR_BURST:
|
||||
cursor->setTexturePointer(texCursorBurst, RenderObject::NO_ADD_REF);
|
||||
cursor->setTexturePointer(texCursorBurst);
|
||||
break;
|
||||
case CURSOR_SWIM:
|
||||
cursor->setTexturePointer(texCursorSwim, RenderObject::NO_ADD_REF);
|
||||
cursor->setTexturePointer(texCursorSwim);
|
||||
break;
|
||||
case CURSOR_SING:
|
||||
cursor->setTexturePointer(texCursorSing, RenderObject::NO_ADD_REF);
|
||||
cursor->setTexturePointer(texCursorSing);
|
||||
break;
|
||||
default:
|
||||
cursor->setTexturePointer(texCursor, RenderObject::NO_ADD_REF);
|
||||
cursor->setTexturePointer(texCursor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4550,7 +4550,7 @@ void DSQ::onUpdate(float dt)
|
|||
if (isDeveloperKeys() && fpsText && cmDebug && cmDebug->alpha == 1)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "FPS: " << core->fps << " | ROC: " << core->renderObjectCount << " | RC: " << Core::dbg_numRenderCalls;
|
||||
os << "FPS: " << core->fps << " | ROC: " << core->renderObjectCount << " | RC: " << Core::dbg_numRenderCalls << " | RES: " << core->resources.size();
|
||||
os << " | p: " << core->processedRenderObjectCount << " | t: " << core->totalRenderObjectCount;
|
||||
os << " | s: " << dsq->continuity.seconds;
|
||||
os << " | evQ: " << core->eventQueue.getSize();
|
||||
|
|
|
@ -1262,7 +1262,7 @@ public:
|
|||
Quad *bar_left, *bar_right, *bar_up, *bar_down;
|
||||
Quad *barFade_left, *barFade_right;
|
||||
|
||||
Texture *texCursor, *texCursorSwim, *texCursorBurst, *texCursorSing, *texCursorLook;
|
||||
CountedPtr<Texture> texCursor, texCursorSwim, texCursorBurst, texCursorSing, texCursorLook;
|
||||
|
||||
void setBlackBarsColor(Vector color);
|
||||
|
||||
|
|
|
@ -66,14 +66,14 @@ namespace MiniMapRenderSpace
|
|||
const int healthMarkerSize = 20;
|
||||
|
||||
|
||||
Texture *texCook = 0;
|
||||
Texture *texWaterBit = 0;
|
||||
Texture *texMinimapBtm = 0;
|
||||
Texture *texMinimapTop = 0;
|
||||
Texture *texRipple = 0;
|
||||
Texture *texNaija = 0;
|
||||
Texture *texHealthBar = 0;
|
||||
Texture *texMarker = 0;
|
||||
CountedPtr<Texture> texCook = 0;
|
||||
CountedPtr<Texture> texWaterBit = 0;
|
||||
CountedPtr<Texture> texMinimapBtm = 0;
|
||||
CountedPtr<Texture> texMinimapTop = 0;
|
||||
CountedPtr<Texture> texRipple = 0;
|
||||
CountedPtr<Texture> texNaija = 0;
|
||||
CountedPtr<Texture> texHealthBar = 0;
|
||||
CountedPtr<Texture> texMarker = 0;
|
||||
|
||||
float waterSin = 0;
|
||||
|
||||
|
|
|
@ -640,8 +640,7 @@ bool ModIconOnline::fixIcon()
|
|||
quad->setDecayRate(2);
|
||||
quad = 0;
|
||||
}
|
||||
useQuad(iconfile);
|
||||
result = Texture::textureError == TEXERR_OK;
|
||||
result = useQuad(iconfile);
|
||||
}
|
||||
if(!quad)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue