summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-09 15:47:25 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-09 15:47:43 +0300
commita102628a6acaa64ca4b31d588cc9eedbb334d077 (patch)
tree6548b1685fbd2bde00f6e823bfec3e6bd89e2de8 /src/being
parentd874b0d53b19d74d45402bd432b9092186c525ee (diff)
downloadplus-a102628a6acaa64ca4b31d588cc9eedbb334d077.tar.gz
plus-a102628a6acaa64ca4b31d588cc9eedbb334d077.tar.bz2
plus-a102628a6acaa64ca4b31d588cc9eedbb334d077.tar.xz
plus-a102628a6acaa64ca4b31d588cc9eedbb334d077.zip
Revert "Improve drawing player sprites performance."
This reverts commit 1dfc22f53967ad7e39d42ba8aabe0afa7445476e.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp42
-rw-r--r--src/being/being.h3
-rw-r--r--src/being/compoundsprite.cpp4
-rw-r--r--src/being/compoundsprite.h3
4 files changed, 13 insertions, 39 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index c20bb4ce1..57529b734 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -202,7 +202,6 @@ Being::Being(const BeingId id,
mPets(),
mOwner(nullptr),
mSpecialParticle(nullptr),
- mDrawSprites(),
#ifdef EATHENA_SUPPORT
mChat(nullptr),
mHorseInfo(nullptr),
@@ -350,7 +349,6 @@ Being::~Being()
}
}
mPets.clear();
- mDrawSprites.clear();
removeAllItemsParticles();
#ifdef EATHENA_SUPPORT
@@ -2581,7 +2579,6 @@ void Being::setSprite(const unsigned int slot,
if (beingEquipmentWindow)
beingEquipmentWindow->updateBeing(this);
}
- updateDrawSprites();
}
void Being::setSpriteID(const unsigned int slot,
@@ -2987,10 +2984,14 @@ void Being::drawPlayerSprites(Graphics *restrict const graphics,
const int posX,
const int posY) const restrict2
{
- const size_t sz = mDrawSprites.size();
- for (size_t f = 0; f < sz; f ++)
+ const int sz = CompoundSprite::getNumberOfLayers();
+ for (int f = 0; f < sz; f ++)
{
- Sprite *restrict const sprite = mDrawSprites[f];
+ const int rSprite = mSpriteHide[mSpriteRemap[f]];
+ if (rSprite == 1)
+ continue;
+
+ Sprite *restrict const sprite = mSprites[mSpriteRemap[f]];
if (sprite)
{
sprite->setAlpha(mAlpha);
@@ -3003,10 +3004,14 @@ void Being::drawSpritesSDL(Graphics *restrict const graphics,
const int posX,
const int posY) const restrict2
{
- const size_t sz = mDrawSprites.size();
+ const size_t sz = mSprites.size();
for (size_t f = 0; f < sz; f ++)
{
- const Sprite *restrict const sprite = mDrawSprites[f];
+ const int rSprite = mSpriteHide[mSpriteRemap[f]];
+ if (rSprite == 1)
+ continue;
+
+ const Sprite *restrict const sprite = mSprites[mSpriteRemap[f]];
if (sprite)
sprite->draw(graphics, posX, posY);
}
@@ -3565,7 +3570,6 @@ void Being::recalcSpritesOrder() restrict2
}
}
}
- updateDrawSprites();
}
int Being::searchSlotValue(const std::vector<int> &restrict slotRemap,
@@ -4403,26 +4407,6 @@ void Being::serverRemove() restrict2 noexcept
mTrickDead = false;
}
-void Being::updateDrawSprites()
-{
- if (mType != ActorType::Player)
- return;
- mDrawSprites.clear();
- const size_t sz = CompoundSprite::getNumberOfLayers();
- for (size_t f = 0; f < sz; f ++)
- {
- const int rSprite = mSpriteHide[mSpriteRemap[f]];
- if (rSprite == 1)
- continue;
-
- Sprite *const sprite = mSprites[mSpriteRemap[f]];
- if (sprite)
- {
- mDrawSprites.push_back(sprite);
- }
- }
-}
-
#ifdef EATHENA_SUPPORT
void Being::removeHorse() restrict2
{
diff --git a/src/being/being.h b/src/being/being.h
index f4c03af37..606db0a35 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -1136,8 +1136,6 @@ class Being notfinal : public ActorSprite,
const int offsetX,
const int offsetY) const A_NONNULL(2);
- void updateDrawSprites() override final;
-
const ActorTypeT mType;
/** Speech Bubble components */
@@ -1162,7 +1160,6 @@ class Being notfinal : public ActorSprite,
std::vector<Being*> mPets;
Being *restrict mOwner;
Particle *restrict mSpecialParticle;
- std::vector<Sprite*> mDrawSprites;
#ifdef EATHENA_SUPPORT
ChatObject *restrict mChat;
HorseInfo *restrict mHorseInfo;
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index 184823011..af2e60d55 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -263,7 +263,6 @@ void CompoundSprite::addSprite(Sprite *const sprite)
{
mSprites.push_back(sprite);
mNeedsRedraw = true;
- updateDrawSprites();
}
void CompoundSprite::setSprite(const size_t layer, Sprite *const sprite)
@@ -275,7 +274,6 @@ void CompoundSprite::setSprite(const size_t layer, Sprite *const sprite)
delete mSprites[layer];
mSprites[layer] = sprite;
mNeedsRedraw = true;
- updateDrawSprites();
}
void CompoundSprite::removeSprite(const int layer)
@@ -286,7 +284,6 @@ void CompoundSprite::removeSprite(const int layer)
delete2(mSprites[layer]);
mNeedsRedraw = true;
- updateDrawSprites();
}
void CompoundSprite::clear()
@@ -302,7 +299,6 @@ void CompoundSprite::clear()
imagesCache.clear();
delete2(mCacheItem);
mLastTime = 0;
- updateDrawSprites();
}
void CompoundSprite::ensureSize(const size_t layerCount)
diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h
index 96b14d653..71a77e87e 100644
--- a/src/being/compoundsprite.h
+++ b/src/being/compoundsprite.h
@@ -117,9 +117,6 @@ class CompoundSprite notfinal : public Sprite
void initCurrentCacheItem() const;
- virtual void updateDrawSprites()
- { }
-
typedef std::list<CompoundItem*> ImagesCache;
mutable ImagesCache imagesCache;
mutable CompoundItem *mCacheItem;