ManaPlus
|
#include <compoundsprite.h>
Public Types | |
typedef std::vector< Sprite * >::iterator | SpriteIterator |
typedef std::vector< Sprite * >::const_iterator | SpriteConstIterator |
Public Member Functions | |
CompoundSprite () | |
~CompoundSprite () | |
bool | reset () |
bool | play (const std::string &action) |
bool | update (const int time) |
void | drawSimple (Graphics *const graphics, const int posX, const int posY) const |
int | getWidth () const |
int | getHeight () const |
const Image * | getImage () const |
bool | setSpriteDirection (const SpriteDirection::Type direction) |
int | getNumberOfLayers () const |
unsigned int | getCurrentFrame () const |
unsigned int | getFrameCount () const |
void | addSprite (Sprite *const sprite) |
void | setSprite (const size_t layer, Sprite *const sprite) |
void | removeSprite (const int layer) |
void | clear () |
void | ensureSize (const size_t layerCount) |
void | drawSprites (Graphics *const graphics, const int posX, const int posY) const |
virtual void | drawSpritesSDL (Graphics *const graphics, const int posX, const int posY) const |
void | setAlpha (float alpha) |
bool | updateNumber (const unsigned num) |
int | getLastTime () const |
int | getStartTime () const |
Public Member Functions inherited from Sprite | |
virtual | ~Sprite () |
virtual void | draw (Graphics *const graphics, const int posX, const int posY) const =0 |
virtual float | getAlpha () const |
virtual const void * | getHash () const |
virtual const void * | getHash2 () const |
Static Public Member Functions | |
static void | setEnableDelay (bool b) |
Data Fields | |
std::vector< Sprite * > | mSprites |
Protected Types | |
typedef std::list< CompoundItem * > | ImagesCache |
Protected Member Functions | |
void | redraw () const |
void | updateImages () const |
bool | updateFromCache () const |
void | initCurrentCacheItem () const |
Protected Member Functions inherited from Sprite | |
Sprite () | |
Protected Attributes | |
ImagesCache | imagesCache |
CompoundItem * | mCacheItem |
Image * | mImage |
Image * | mAlphaImage |
int | mOffsetX |
int | mOffsetY |
int | mStartTime |
int | mLastTime |
int | mNextRedrawTime |
bool | mNeedsRedraw |
bool | mEnableAlphaFix |
bool | mDisableAdvBeingCaching |
bool | mDisableBeingCaching |
Protected Attributes inherited from Sprite | |
float | mAlpha |
Static Protected Attributes | |
static bool | mEnableDelay = true |
Definition at line 37 of file compoundsprite.h.
|
protected |
Definition at line 122 of file compoundsprite.h.
typedef std::vector<Sprite*>::const_iterator CompoundSprite::SpriteConstIterator |
Definition at line 41 of file compoundsprite.h.
typedef std::vector<Sprite*>::iterator CompoundSprite::SpriteIterator |
Definition at line 40 of file compoundsprite.h.
CompoundSprite::CompoundSprite | ( | ) |
Definition at line 72 of file compoundsprite.cpp.
References Sprite::mAlpha.
CompoundSprite::~CompoundSprite | ( | ) |
void CompoundSprite::addSprite | ( | Sprite *const | sprite | ) |
Definition at line 271 of file compoundsprite.cpp.
References mNeedsRedraw, and mSprites.
Referenced by ActorSprite::setupSpriteDisplay().
void CompoundSprite::clear | ( | ) |
Definition at line 298 of file compoundsprite.cpp.
References delete2, delete_all(), imagesCache, mCacheItem, mLastTime, mNeedsRedraw, and mSprites.
Referenced by ActorSprite::setupSpriteDisplay(), and ~CompoundSprite().
void CompoundSprite::drawSimple | ( | Graphics *const | graphics, |
const int | posX, | ||
const int | posY | ||
) | const |
Definition at line 149 of file compoundsprite.cpp.
References Graphics::drawImage(), drawSprites(), FUNC_BLOCK, Sprite::mAlpha, mAlphaImage, mImage, mNeedsRedraw, mOffsetX, mOffsetY, mSprites, and updateImages().
Referenced by FloorItem::draw(), Being::drawElementalSpriteAt(), Being::drawHomunculusSpriteAt(), Being::drawMercenarySpriteAt(), Being::drawMonsterSpriteAt(), Being::drawOtherSpriteAt(), and Being::drawPortalSpriteAt().
void CompoundSprite::drawSprites | ( | Graphics *const | graphics, |
const int | posX, | ||
const int | posY | ||
) | const |
Definition at line 176 of file compoundsprite.cpp.
References FOR_EACH, Sprite::mAlpha, and mSprites.
Referenced by drawSimple().
|
virtual |
void CompoundSprite::ensureSize | ( | const size_t | layerCount | ) |
|
virtual |
Returns the current frame number for the sprite.
Implements Sprite.
Definition at line 251 of file compoundsprite.cpp.
|
virtual |
Returns the frame count for the sprite.
Implements Sprite.
Definition at line 261 of file compoundsprite.cpp.
References FOR_EACH, and mSprites.
Referenced by Being::logic().
|
virtual |
Gets the height in pixels of the first sprite in the list.
Implements Sprite.
Definition at line 213 of file compoundsprite.cpp.
References anonymous_namespace{stringutils.cpp}::base, FOR_EACH, and mSprites.
Referenced by ActorSprite::getHeight(), and Being::getHeight().
|
virtual |
Returns a reference to the current image being drawn.
Implements Sprite.
Definition at line 225 of file compoundsprite.cpp.
References mImage.
|
inline |
int CompoundSprite::getNumberOfLayers | ( | ) | const |
Definition at line 244 of file compoundsprite.cpp.
References CAST_S32, mAlphaImage, mImage, and mSprites.
Referenced by Being::drawPlayerSprites(), Being::getNumberOfLayers(), and Being::searchSlotValue().
|
inline |
|
virtual |
Gets the width in pixels of the first sprite in the list.
Implements Sprite.
Definition at line 201 of file compoundsprite.cpp.
References anonymous_namespace{stringutils.cpp}::base, FOR_EACH, and mSprites.
Referenced by ActorSprite::getWidth(), and Being::getWidth().
|
protected |
Definition at line 525 of file compoundsprite.cpp.
References CompoundItem::alphaImage, CompoundItem::data, FOR_EACH, CompoundItem::image, mAlphaImage, mCacheItem, mImage, and mSprites.
Referenced by updateImages().
|
virtual |
Plays an action using the current direction.
Implements Sprite.
Definition at line 115 of file compoundsprite.cpp.
References FOR_EACH, mLastTime, mNeedsRedraw, and mSprites.
|
protected |
< Surface is in video memory
< Surface is in video memory
Definition at line 323 of file compoundsprite.cpp.
References SurfaceGraphics::beginDraw(), BlitMode::BLIT_GFX, BUFFER_HEIGHT, BUFFER_WIDTH, delete2, drawSpritesSDL(), Game::getCurrentMap(), Map::getTileWidth(), imageHelper, Game::instance(), ImageHelper::loadSurface(), mAlphaImage, mapTileSize, ImageHelper::mEnableAlpha, mImage, mOffsetX, mOffsetY, MSDL_CreateRGBSurface, MSDL_FreeSurface, SurfaceGraphics::setBlitMode(), and SurfaceGraphics::setTarget().
Referenced by updateImages().
void CompoundSprite::removeSprite | ( | const int | layer | ) |
|
virtual |
Resets the sprite.
Implements Sprite.
Definition at line 101 of file compoundsprite.cpp.
References FOR_EACH, mLastTime, mNeedsRedraw, and mSprites.
Referenced by Ea::PlayerRecv::processPlayerWarp().
|
virtual |
Sets the alpha value of the animated sprite
Reimplemented from Sprite.
Definition at line 397 of file compoundsprite.cpp.
References FOR_EACH, imageHelper, Sprite::mAlpha, mEnableAlphaFix, mSprites, RENDER_SOFTWARE, and ImageHelper::useOpenGL().
Referenced by ActorSprite::setAlpha().
|
inlinestatic |
Definition at line 102 of file compoundsprite.h.
References mEnableDelay.
Referenced by Game::Game().
void CompoundSprite::setSprite | ( | const size_t | layer, |
Sprite *const | sprite | ||
) |
Definition at line 277 of file compoundsprite.cpp.
References mNeedsRedraw, and mSprites.
Referenced by Being::setGender(), Being::setHairTempSprite(), Being::setSpriteCards(), Being::setSpriteColor(), Being::setSpriteColorId(), Being::setSpriteId(), and Being::setTempSprite().
|
virtual |
Sets the direction.
Implements Sprite.
Definition at line 230 of file compoundsprite.cpp.
References FOR_EACH, mLastTime, mNeedsRedraw, and mSprites.
Referenced by Being::setDirection().
|
virtual |
Inform the animation of the passed time so that it can output the correct animation frame.
Implements Sprite.
Definition at line 134 of file compoundsprite.cpp.
References A_UNLIKELY, FOR_EACH, mLastTime, mNeedsRedraw, mSprites, and mStartTime.
Referenced by ActorSprite::logic().
|
protected |
Definition at line 456 of file compoundsprite.cpp.
References cache_clean_part, cache_max_size, CompoundItem::data, FOR_EACH, CompoundItem::image, imagesCache, mAlphaImage, mCacheItem, mImage, and mSprites.
Referenced by updateImages().
|
protected |
Definition at line 417 of file compoundsprite.cpp.
References get_elapsed_time1(), imageHelper, initCurrentCacheItem(), mDisableAdvBeingCaching, mDisableBeingCaching, mEnableDelay, mImage, mNeedsRedraw, mNextRedrawTime, mSprites, redraw(), RENDER_SOFTWARE, tick_time, updateFromCache(), and ImageHelper::useOpenGL().
Referenced by Being::drawCompound(), and drawSimple().
|
virtual |
Implements Sprite.
Definition at line 542 of file compoundsprite.cpp.
References FOR_EACH, and mSprites.
Referenced by Being::updatePercentHP().
|
mutableprotected |
Definition at line 123 of file compoundsprite.h.
Referenced by clear(), and updateFromCache().
|
mutableprotected |
Definition at line 127 of file compoundsprite.h.
Referenced by Being::drawCompound(), drawSimple(), getNumberOfLayers(), initCurrentCacheItem(), redraw(), updateFromCache(), and ~CompoundSprite().
|
mutableprotected |
Definition at line 124 of file compoundsprite.h.
Referenced by clear(), initCurrentCacheItem(), and updateFromCache().
|
protected |
Definition at line 140 of file compoundsprite.h.
Referenced by updateImages().
|
protected |
Definition at line 141 of file compoundsprite.h.
Referenced by updateImages().
|
protected |
Definition at line 139 of file compoundsprite.h.
Referenced by setAlpha().
|
staticprotected |
Definition at line 137 of file compoundsprite.h.
Referenced by setEnableDelay(), and updateImages().
|
mutableprotected |
Definition at line 126 of file compoundsprite.h.
Referenced by Being::drawCompound(), drawSimple(), getImage(), getNumberOfLayers(), initCurrentCacheItem(), redraw(), updateFromCache(), updateImages(), and ~CompoundSprite().
|
protected |
Definition at line 132 of file compoundsprite.h.
Referenced by clear(), getLastTime(), play(), reset(), setSpriteDirection(), and update().
|
mutableprotected |
Definition at line 138 of file compoundsprite.h.
Referenced by addSprite(), clear(), Being::drawCompound(), drawSimple(), play(), removeSprite(), reset(), setSprite(), setSpriteDirection(), update(), and updateImages().
|
mutableprotected |
Definition at line 134 of file compoundsprite.h.
Referenced by updateImages().
|
mutableprotected |
Definition at line 129 of file compoundsprite.h.
Referenced by Being::drawCompound(), drawSimple(), and redraw().
|
mutableprotected |
Definition at line 130 of file compoundsprite.h.
Referenced by Being::drawCompound(), drawSimple(), and redraw().
std::vector<Sprite*> CompoundSprite::mSprites |
Definition at line 111 of file compoundsprite.h.
Referenced by addSprite(), BeingEquipBackend::BeingEquipBackend(), clear(), ActorManager::cloneBeing(), Being::drawCompound(), drawSimple(), drawSprites(), drawSpritesSDL(), ensureSize(), getCurrentFrame(), getFrameCount(), getHeight(), getNumberOfLayers(), getWidth(), LocalPlayer::imitateOutfit(), initCurrentCacheItem(), NpcDialog::logic(), play(), Being::recalcSpritesOrder(), removeSprite(), reset(), setAlpha(), setSprite(), setSpriteDirection(), ActorSprite::setupSpriteDisplay(), NpcDialog::showAvatar(), update(), updateFromCache(), updateImages(), and updateNumber().
|
protected |
Definition at line 131 of file compoundsprite.h.
Referenced by getStartTime(), and update().