diff --git a/client/ClientCommandManager.cpp b/client/ClientCommandManager.cpp index b260ff4fb..dc0984e43 100644 --- a/client/ClientCommandManager.cpp +++ b/client/ClientCommandManager.cpp @@ -389,7 +389,6 @@ void ClientCommandManager::handleDef2bmpCommand(std::istringstream& singleWordBu std::string URI; singleWordBuffer >> URI; auto anim = GH.renderHandler().loadAnimation(AnimationPath::builtin(URI)); - anim->preload(); anim->exportBitmaps(VCMIDirs::get().userExtractedPath()); } diff --git a/client/battle/BattleAnimationClasses.cpp b/client/battle/BattleAnimationClasses.cpp index 19271b07c..8a98605f6 100644 --- a/client/battle/BattleAnimationClasses.cpp +++ b/client/battle/BattleAnimationClasses.cpp @@ -926,8 +926,6 @@ EffectAnimation::EffectAnimation(BattleInterface & owner, const AnimationPath & bool EffectAnimation::init() { - animation->preload(); - auto first = animation->getImage(0, 0, true); if(!first) { diff --git a/client/battle/BattleFieldController.cpp b/client/battle/BattleFieldController.cpp index 9df03805b..5767f1385 100644 --- a/client/battle/BattleFieldController.cpp +++ b/client/battle/BattleFieldController.cpp @@ -128,18 +128,12 @@ BattleFieldController::BattleFieldController(BattleInterface & owner): cellUnitMaxMovementHighlight = GH.renderHandler().loadImage(ImagePath::builtin("UnitMaxMovementHighlight.PNG"), EImageBlitMode::COLORKEY); attackCursors = GH.renderHandler().loadAnimation(AnimationPath::builtin("CRCOMBAT")); - attackCursors->preload(); - spellCursors = GH.renderHandler().loadAnimation(AnimationPath::builtin("CRSPELL")); - spellCursors->preload(); initializeHexEdgeMaskToFrameIndex(); rangedFullDamageLimitImages = GH.renderHandler().loadAnimation(AnimationPath::builtin("battle/rangeHighlights/rangeHighlightsGreen.json")); - rangedFullDamageLimitImages->preload(); - shootingRangeLimitImages = GH.renderHandler().loadAnimation(AnimationPath::builtin("battle/rangeHighlights/rangeHighlightsRed.json")); - shootingRangeLimitImages->preload(); flipRangeLimitImagesIntoPositions(rangedFullDamageLimitImages); flipRangeLimitImagesIntoPositions(shootingRangeLimitImages); diff --git a/client/battle/BattleInterfaceClasses.cpp b/client/battle/BattleInterfaceClasses.cpp index 69df2c11e..e8af74746 100644 --- a/client/battle/BattleInterfaceClasses.cpp +++ b/client/battle/BattleInterfaceClasses.cpp @@ -398,7 +398,6 @@ BattleHero::BattleHero(const BattleInterface & owner, const CGHeroInstance * her animationPath = hero->type->heroClass->imageBattleMale; animation = GH.renderHandler().loadAnimation(animationPath); - animation->preload(); pos.w = 64; pos.h = 136; @@ -413,7 +412,6 @@ BattleHero::BattleHero(const BattleInterface & owner, const CGHeroInstance * her else flagAnimation = GH.renderHandler().loadAnimation(AnimationPath::builtin("CMFLAGL")); - flagAnimation->preload(); flagAnimation->playerColored(hero->tempOwner); switchToNextPhase(); diff --git a/client/battle/BattleObstacleController.cpp b/client/battle/BattleObstacleController.cpp index 796e5c7d9..80ecacdf6 100644 --- a/client/battle/BattleObstacleController.cpp +++ b/client/battle/BattleObstacleController.cpp @@ -55,13 +55,11 @@ void BattleObstacleController::loadObstacleImage(const CObstacleInstance & oi) auto animation = GH.renderHandler().createAnimation(); animation->setCustom(animationName.getName(), 0, 0); animationsCache[animationName] = animation; - animation->preload(); } else { auto animation = GH.renderHandler().loadAnimation(animationName); animationsCache[animationName] = animation; - animation->preload(); } } obstacleAnimations[oi.uniqueID] = animationsCache[animationName]; @@ -87,8 +85,6 @@ void BattleObstacleController::obstacleRemoved(const std::vectorpreload(); - auto first = animation->getImage(0, 0); if(!first) continue; @@ -115,8 +111,6 @@ void BattleObstacleController::obstaclePlaced(const std::vectorgetAppearAnimation()); - animation->preload(); - auto first = animation->getImage(0, 0); if(!first) continue; diff --git a/client/battle/BattleProjectileController.cpp b/client/battle/BattleProjectileController.cpp index 6c5854fc0..c81852446 100644 --- a/client/battle/BattleProjectileController.cpp +++ b/client/battle/BattleProjectileController.cpp @@ -193,7 +193,6 @@ void BattleProjectileController::initStackProjectile(const CStack * stack) std::shared_ptr BattleProjectileController::createProjectileImage(const AnimationPath & path ) { std::shared_ptr projectile = GH.renderHandler().loadAnimation(path); - projectile->preload(); if(projectile->size(1) != 0) logAnim->error("Expected empty group 1 in stack projectile"); diff --git a/client/battle/CreatureAnimation.cpp b/client/battle/CreatureAnimation.cpp index ae00aa515..8627ebfc7 100644 --- a/client/battle/CreatureAnimation.cpp +++ b/client/battle/CreatureAnimation.cpp @@ -202,10 +202,6 @@ CreatureAnimation::CreatureAnimation(const AnimationPath & name_, TSpeedControll forward = GH.renderHandler().loadAnimation(name_); reverse = GH.renderHandler().loadAnimation(name_); - //todo: optimize - forward->preload(); - reverse->preload(); - // if necessary, add one frame into vcmi-only group DEAD if(forward->size(size_t(ECreatureAnimType::DEAD)) == 0) { diff --git a/client/gui/CursorHandler.cpp b/client/gui/CursorHandler.cpp index 2052ea2c9..b09517344 100644 --- a/client/gui/CursorHandler.cpp +++ b/client/gui/CursorHandler.cpp @@ -53,9 +53,6 @@ CursorHandler::CursorHandler() GH.renderHandler().loadAnimation(AnimationPath::builtin("CRSPELL")) }; - for (auto & cursor : cursors) - cursor->preload(); - set(Cursor::Map::POINTER); showType = dynamic_cast(cursor.get()) ? Cursor::ShowType::SOFTWARE : Cursor::ShowType::HARDWARE; } @@ -105,7 +102,6 @@ void CursorHandler::dragAndDropCursor(std::shared_ptr image) void CursorHandler::dragAndDropCursor (const AnimationPath & path, size_t index) { auto anim = GH.renderHandler().loadAnimation(path); - anim->load(index); dragAndDropCursor(anim->getImage(index)); } diff --git a/client/mapView/MapRenderer.cpp b/client/mapView/MapRenderer.cpp index 8c7509f80..7b97ec7fd 100644 --- a/client/mapView/MapRenderer.cpp +++ b/client/mapView/MapRenderer.cpp @@ -104,10 +104,7 @@ void MapTileStorage::load(size_t index, const AnimationPath & filename, EImageBl for(auto & entry : terrainAnimations) { if (!filename.empty()) - { entry = GH.renderHandler().loadAnimation(filename); - entry->preload(); - } else entry = GH.renderHandler().createAnimation(); @@ -253,7 +250,6 @@ uint8_t MapRendererRoad::checksum(IMapRendererContext & context, const int3 & co MapRendererBorder::MapRendererBorder() { animation = GH.renderHandler().loadAnimation(AnimationPath::builtin("EDG")); - animation->preload(); } size_t MapRendererBorder::getIndexForTile(IMapRendererContext & context, const int3 & tile) @@ -315,9 +311,7 @@ uint8_t MapRendererBorder::checksum(IMapRendererContext & context, const int3 & MapRendererFow::MapRendererFow() { fogOfWarFullHide = GH.renderHandler().loadAnimation(AnimationPath::builtin("TSHRC")); - fogOfWarFullHide->preload(); fogOfWarPartialHide = GH.renderHandler().loadAnimation(AnimationPath::builtin("TSHRE")); - fogOfWarPartialHide->preload(); for(size_t i = 0; i < fogOfWarFullHide->size(); ++i) fogOfWarFullHide->getImage(i)->setBlitMode(EImageBlitMode::OPAQUE); @@ -407,7 +401,6 @@ std::shared_ptr MapRendererObjects::getAnimation(const AnimationPath auto ret = GH.renderHandler().loadAnimation(filename); animations[filename] = ret; - ret->preload(); if(generateMovementGroups) { @@ -629,7 +622,6 @@ uint8_t MapRendererOverlay::checksum(IMapRendererContext & context, const int3 & MapRendererPath::MapRendererPath() : pathNodes(GH.renderHandler().loadAnimation(AnimationPath::builtin("ADAG"))) { - pathNodes->preload(); } size_t MapRendererPath::selectImageReachability(bool reachableToday, size_t imageIndex) diff --git a/client/mapView/MapViewCache.cpp b/client/mapView/MapViewCache.cpp index 2bd21ce8d..8534e8a6c 100644 --- a/client/mapView/MapViewCache.cpp +++ b/client/mapView/MapViewCache.cpp @@ -36,7 +36,6 @@ MapViewCache::MapViewCache(const std::shared_ptr & model) , terrain(new Canvas(model->getCacheDimensionsPixels())) , terrainTransition(new Canvas(model->getPixelsVisibleDimensions())) { - iconsStorage->preload(); for(size_t i = 0; i < iconsStorage->size(); ++i) iconsStorage->getImage(i)->setBlitMode(EImageBlitMode::COLORKEY); diff --git a/client/render/CAnimation.cpp b/client/render/CAnimation.cpp index b9b49d0c9..70f486886 100644 --- a/client/render/CAnimation.cpp +++ b/client/render/CAnimation.cpp @@ -187,50 +187,6 @@ std::shared_ptr CAnimation::getImageImpl(size_t frame, size_t group, boo return nullptr; } -void CAnimation::load() -{ - for (auto & elem : source) - for (size_t image=0; image < elem.second.size(); image++) - loadFrame(image, elem.first); -} - -void CAnimation::unload() -{ - for (auto & elem : source) - for (size_t image=0; image < elem.second.size(); image++) - unloadFrame(image, elem.first); - -} - -void CAnimation::preload() -{ - // TODO: remove -} - -void CAnimation::loadGroup(size_t group) -{ - if (vstd::contains(source, group)) - for (size_t image=0; image < source[group].size(); image++) - loadFrame(image, group); -} - -void CAnimation::unloadGroup(size_t group) -{ - if (vstd::contains(source, group)) - for (size_t image=0; image < source[group].size(); image++) - unloadFrame(image, group); -} - -void CAnimation::load(size_t frame, size_t group) -{ - loadFrame(frame, group); -} - -void CAnimation::unload(size_t frame, size_t group) -{ - unloadFrame(frame, group); -} - size_t CAnimation::size(size_t group) const { auto iter = source.find(group); @@ -270,4 +226,3 @@ void CAnimation::createFlippedGroup(const size_t sourceGroup, const size_t targe image->verticalFlip(); } } - diff --git a/client/render/CAnimation.h b/client/render/CAnimation.h index 9b31c6624..ce78b0e4d 100644 --- a/client/render/CAnimation.h +++ b/client/render/CAnimation.h @@ -59,19 +59,6 @@ public: void exportBitmaps(const boost::filesystem::path & path) const; - //all available frames - void load (); - void unload(); - void preload(); - - //all frames from group - void loadGroup (size_t group); - void unloadGroup(size_t group); - - //single image - void load (size_t frame, size_t group=0); - void unload(size_t frame, size_t group=0); - //total count of frames in group (including not loaded) size_t size(size_t group=0) const; diff --git a/client/widgets/Images.cpp b/client/widgets/Images.cpp index 0f67251d7..14151c5fe 100644 --- a/client/widgets/Images.cpp +++ b/client/widgets/Images.cpp @@ -232,10 +232,6 @@ void CAnimImage::setSizeFromImage(const IImage &img) void CAnimImage::init() { visible = true; - anim->load(frame, group); - if (flags & CShowableAnim::BASE) - anim->load(0,group); - auto img = anim->getImage(frame, group); if (img) setSizeFromImage(*img); @@ -287,7 +283,6 @@ void CAnimImage::setFrame(size_t Frame, size_t Group) return; if (anim->size(Group) > Frame) { - anim->load(Frame, Group); frame = Frame; group = Group; if(auto img = anim->getImage(frame, group)) @@ -326,7 +321,6 @@ CShowableAnim::CShowableAnim(int x, int y, const AnimationPath & name, ui8 Flags yOffset(0), alpha(alpha) { - anim->loadGroup(group); last = anim->size(group); auto image = anim->getImage(0, group); @@ -341,11 +335,6 @@ CShowableAnim::CShowableAnim(int x, int y, const AnimationPath & name, ui8 Flags addUsedEvents(TIME); } -CShowableAnim::~CShowableAnim() -{ - anim->unloadGroup(group); -} - void CShowableAnim::setAlpha(ui32 alphaValue) { alpha = std::min(alphaValue, 255); @@ -361,9 +350,6 @@ bool CShowableAnim::set(size_t Group, size_t from, size_t to) if (max < from || max == 0) return false; - anim->unloadGroup(group); - anim->loadGroup(Group); - group = Group; frame = first = from; last = max; @@ -377,9 +363,6 @@ bool CShowableAnim::set(size_t Group) return false; if (group != Group) { - anim->unloadGroup(group); - anim->loadGroup(Group); - first = 0; group = Group; last = anim->size(Group); diff --git a/client/widgets/Images.h b/client/widgets/Images.h index f7a53e718..49c6d40fe 100644 --- a/client/widgets/Images.h +++ b/client/widgets/Images.h @@ -178,7 +178,6 @@ public: void setAlpha(ui32 alphaValue); CShowableAnim(int x, int y, const AnimationPath & name, ui8 flags, ui32 frameTime, size_t Group=0, uint8_t alpha = UINT8_MAX); - ~CShowableAnim(); //set animation to group or part of group bool set(size_t Group); diff --git a/client/windows/CMessage.cpp b/client/windows/CMessage.cpp index 68351ba08..71d8a056e 100644 --- a/client/windows/CMessage.cpp +++ b/client/windows/CMessage.cpp @@ -42,7 +42,6 @@ void CMessage::init() for(int i = 0; i < PlayerColor::PLAYER_LIMIT_I; i++) { dialogBorders[i] = GH.renderHandler().loadAnimation(AnimationPath::builtin("DIALGBOX")); - dialogBorders[i]->preload(); for(int j = 0; j < dialogBorders[i]->size(0); j++) {