1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Remove no longer used code

This commit is contained in:
Ivan Savenko
2024-06-05 17:04:39 +00:00
parent 0e407540ec
commit 230add02e4
15 changed files with 0 additions and 112 deletions

View File

@@ -389,7 +389,6 @@ void ClientCommandManager::handleDef2bmpCommand(std::istringstream& singleWordBu
std::string URI; std::string URI;
singleWordBuffer >> URI; singleWordBuffer >> URI;
auto anim = GH.renderHandler().loadAnimation(AnimationPath::builtin(URI)); auto anim = GH.renderHandler().loadAnimation(AnimationPath::builtin(URI));
anim->preload();
anim->exportBitmaps(VCMIDirs::get().userExtractedPath()); anim->exportBitmaps(VCMIDirs::get().userExtractedPath());
} }

View File

@@ -926,8 +926,6 @@ EffectAnimation::EffectAnimation(BattleInterface & owner, const AnimationPath &
bool EffectAnimation::init() bool EffectAnimation::init()
{ {
animation->preload();
auto first = animation->getImage(0, 0, true); auto first = animation->getImage(0, 0, true);
if(!first) if(!first)
{ {

View File

@@ -128,18 +128,12 @@ BattleFieldController::BattleFieldController(BattleInterface & owner):
cellUnitMaxMovementHighlight = GH.renderHandler().loadImage(ImagePath::builtin("UnitMaxMovementHighlight.PNG"), EImageBlitMode::COLORKEY); cellUnitMaxMovementHighlight = GH.renderHandler().loadImage(ImagePath::builtin("UnitMaxMovementHighlight.PNG"), EImageBlitMode::COLORKEY);
attackCursors = GH.renderHandler().loadAnimation(AnimationPath::builtin("CRCOMBAT")); attackCursors = GH.renderHandler().loadAnimation(AnimationPath::builtin("CRCOMBAT"));
attackCursors->preload();
spellCursors = GH.renderHandler().loadAnimation(AnimationPath::builtin("CRSPELL")); spellCursors = GH.renderHandler().loadAnimation(AnimationPath::builtin("CRSPELL"));
spellCursors->preload();
initializeHexEdgeMaskToFrameIndex(); initializeHexEdgeMaskToFrameIndex();
rangedFullDamageLimitImages = GH.renderHandler().loadAnimation(AnimationPath::builtin("battle/rangeHighlights/rangeHighlightsGreen.json")); rangedFullDamageLimitImages = GH.renderHandler().loadAnimation(AnimationPath::builtin("battle/rangeHighlights/rangeHighlightsGreen.json"));
rangedFullDamageLimitImages->preload();
shootingRangeLimitImages = GH.renderHandler().loadAnimation(AnimationPath::builtin("battle/rangeHighlights/rangeHighlightsRed.json")); shootingRangeLimitImages = GH.renderHandler().loadAnimation(AnimationPath::builtin("battle/rangeHighlights/rangeHighlightsRed.json"));
shootingRangeLimitImages->preload();
flipRangeLimitImagesIntoPositions(rangedFullDamageLimitImages); flipRangeLimitImagesIntoPositions(rangedFullDamageLimitImages);
flipRangeLimitImagesIntoPositions(shootingRangeLimitImages); flipRangeLimitImagesIntoPositions(shootingRangeLimitImages);

View File

@@ -398,7 +398,6 @@ BattleHero::BattleHero(const BattleInterface & owner, const CGHeroInstance * her
animationPath = hero->type->heroClass->imageBattleMale; animationPath = hero->type->heroClass->imageBattleMale;
animation = GH.renderHandler().loadAnimation(animationPath); animation = GH.renderHandler().loadAnimation(animationPath);
animation->preload();
pos.w = 64; pos.w = 64;
pos.h = 136; pos.h = 136;
@@ -413,7 +412,6 @@ BattleHero::BattleHero(const BattleInterface & owner, const CGHeroInstance * her
else else
flagAnimation = GH.renderHandler().loadAnimation(AnimationPath::builtin("CMFLAGL")); flagAnimation = GH.renderHandler().loadAnimation(AnimationPath::builtin("CMFLAGL"));
flagAnimation->preload();
flagAnimation->playerColored(hero->tempOwner); flagAnimation->playerColored(hero->tempOwner);
switchToNextPhase(); switchToNextPhase();

View File

@@ -55,13 +55,11 @@ void BattleObstacleController::loadObstacleImage(const CObstacleInstance & oi)
auto animation = GH.renderHandler().createAnimation(); auto animation = GH.renderHandler().createAnimation();
animation->setCustom(animationName.getName(), 0, 0); animation->setCustom(animationName.getName(), 0, 0);
animationsCache[animationName] = animation; animationsCache[animationName] = animation;
animation->preload();
} }
else else
{ {
auto animation = GH.renderHandler().loadAnimation(animationName); auto animation = GH.renderHandler().loadAnimation(animationName);
animationsCache[animationName] = animation; animationsCache[animationName] = animation;
animation->preload();
} }
} }
obstacleAnimations[oi.uniqueID] = animationsCache[animationName]; obstacleAnimations[oi.uniqueID] = animationsCache[animationName];
@@ -87,8 +85,6 @@ void BattleObstacleController::obstacleRemoved(const std::vector<ObstacleChanges
continue; continue;
auto animation = GH.renderHandler().loadAnimation(animationPath); auto animation = GH.renderHandler().loadAnimation(animationPath);
animation->preload();
auto first = animation->getImage(0, 0); auto first = animation->getImage(0, 0);
if(!first) if(!first)
continue; continue;
@@ -115,8 +111,6 @@ void BattleObstacleController::obstaclePlaced(const std::vector<std::shared_ptr<
continue; continue;
auto animation = GH.renderHandler().loadAnimation(oi->getAppearAnimation()); auto animation = GH.renderHandler().loadAnimation(oi->getAppearAnimation());
animation->preload();
auto first = animation->getImage(0, 0); auto first = animation->getImage(0, 0);
if(!first) if(!first)
continue; continue;

View File

@@ -193,7 +193,6 @@ void BattleProjectileController::initStackProjectile(const CStack * stack)
std::shared_ptr<CAnimation> BattleProjectileController::createProjectileImage(const AnimationPath & path ) std::shared_ptr<CAnimation> BattleProjectileController::createProjectileImage(const AnimationPath & path )
{ {
std::shared_ptr<CAnimation> projectile = GH.renderHandler().loadAnimation(path); std::shared_ptr<CAnimation> projectile = GH.renderHandler().loadAnimation(path);
projectile->preload();
if(projectile->size(1) != 0) if(projectile->size(1) != 0)
logAnim->error("Expected empty group 1 in stack projectile"); logAnim->error("Expected empty group 1 in stack projectile");

View File

@@ -202,10 +202,6 @@ CreatureAnimation::CreatureAnimation(const AnimationPath & name_, TSpeedControll
forward = GH.renderHandler().loadAnimation(name_); forward = GH.renderHandler().loadAnimation(name_);
reverse = 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 necessary, add one frame into vcmi-only group DEAD
if(forward->size(size_t(ECreatureAnimType::DEAD)) == 0) if(forward->size(size_t(ECreatureAnimType::DEAD)) == 0)
{ {

View File

@@ -53,9 +53,6 @@ CursorHandler::CursorHandler()
GH.renderHandler().loadAnimation(AnimationPath::builtin("CRSPELL")) GH.renderHandler().loadAnimation(AnimationPath::builtin("CRSPELL"))
}; };
for (auto & cursor : cursors)
cursor->preload();
set(Cursor::Map::POINTER); set(Cursor::Map::POINTER);
showType = dynamic_cast<CursorSoftware *>(cursor.get()) ? Cursor::ShowType::SOFTWARE : Cursor::ShowType::HARDWARE; showType = dynamic_cast<CursorSoftware *>(cursor.get()) ? Cursor::ShowType::SOFTWARE : Cursor::ShowType::HARDWARE;
} }
@@ -105,7 +102,6 @@ void CursorHandler::dragAndDropCursor(std::shared_ptr<IImage> image)
void CursorHandler::dragAndDropCursor (const AnimationPath & path, size_t index) void CursorHandler::dragAndDropCursor (const AnimationPath & path, size_t index)
{ {
auto anim = GH.renderHandler().loadAnimation(path); auto anim = GH.renderHandler().loadAnimation(path);
anim->load(index);
dragAndDropCursor(anim->getImage(index)); dragAndDropCursor(anim->getImage(index));
} }

View File

@@ -104,10 +104,7 @@ void MapTileStorage::load(size_t index, const AnimationPath & filename, EImageBl
for(auto & entry : terrainAnimations) for(auto & entry : terrainAnimations)
{ {
if (!filename.empty()) if (!filename.empty())
{
entry = GH.renderHandler().loadAnimation(filename); entry = GH.renderHandler().loadAnimation(filename);
entry->preload();
}
else else
entry = GH.renderHandler().createAnimation(); entry = GH.renderHandler().createAnimation();
@@ -253,7 +250,6 @@ uint8_t MapRendererRoad::checksum(IMapRendererContext & context, const int3 & co
MapRendererBorder::MapRendererBorder() MapRendererBorder::MapRendererBorder()
{ {
animation = GH.renderHandler().loadAnimation(AnimationPath::builtin("EDG")); animation = GH.renderHandler().loadAnimation(AnimationPath::builtin("EDG"));
animation->preload();
} }
size_t MapRendererBorder::getIndexForTile(IMapRendererContext & context, const int3 & tile) size_t MapRendererBorder::getIndexForTile(IMapRendererContext & context, const int3 & tile)
@@ -315,9 +311,7 @@ uint8_t MapRendererBorder::checksum(IMapRendererContext & context, const int3 &
MapRendererFow::MapRendererFow() MapRendererFow::MapRendererFow()
{ {
fogOfWarFullHide = GH.renderHandler().loadAnimation(AnimationPath::builtin("TSHRC")); fogOfWarFullHide = GH.renderHandler().loadAnimation(AnimationPath::builtin("TSHRC"));
fogOfWarFullHide->preload();
fogOfWarPartialHide = GH.renderHandler().loadAnimation(AnimationPath::builtin("TSHRE")); fogOfWarPartialHide = GH.renderHandler().loadAnimation(AnimationPath::builtin("TSHRE"));
fogOfWarPartialHide->preload();
for(size_t i = 0; i < fogOfWarFullHide->size(); ++i) for(size_t i = 0; i < fogOfWarFullHide->size(); ++i)
fogOfWarFullHide->getImage(i)->setBlitMode(EImageBlitMode::OPAQUE); fogOfWarFullHide->getImage(i)->setBlitMode(EImageBlitMode::OPAQUE);
@@ -407,7 +401,6 @@ std::shared_ptr<CAnimation> MapRendererObjects::getAnimation(const AnimationPath
auto ret = GH.renderHandler().loadAnimation(filename); auto ret = GH.renderHandler().loadAnimation(filename);
animations[filename] = ret; animations[filename] = ret;
ret->preload();
if(generateMovementGroups) if(generateMovementGroups)
{ {
@@ -629,7 +622,6 @@ uint8_t MapRendererOverlay::checksum(IMapRendererContext & context, const int3 &
MapRendererPath::MapRendererPath() MapRendererPath::MapRendererPath()
: pathNodes(GH.renderHandler().loadAnimation(AnimationPath::builtin("ADAG"))) : pathNodes(GH.renderHandler().loadAnimation(AnimationPath::builtin("ADAG")))
{ {
pathNodes->preload();
} }
size_t MapRendererPath::selectImageReachability(bool reachableToday, size_t imageIndex) size_t MapRendererPath::selectImageReachability(bool reachableToday, size_t imageIndex)

View File

@@ -36,7 +36,6 @@ MapViewCache::MapViewCache(const std::shared_ptr<MapViewModel> & model)
, terrain(new Canvas(model->getCacheDimensionsPixels())) , terrain(new Canvas(model->getCacheDimensionsPixels()))
, terrainTransition(new Canvas(model->getPixelsVisibleDimensions())) , terrainTransition(new Canvas(model->getPixelsVisibleDimensions()))
{ {
iconsStorage->preload();
for(size_t i = 0; i < iconsStorage->size(); ++i) for(size_t i = 0; i < iconsStorage->size(); ++i)
iconsStorage->getImage(i)->setBlitMode(EImageBlitMode::COLORKEY); iconsStorage->getImage(i)->setBlitMode(EImageBlitMode::COLORKEY);

View File

@@ -187,50 +187,6 @@ std::shared_ptr<IImage> CAnimation::getImageImpl(size_t frame, size_t group, boo
return nullptr; 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 size_t CAnimation::size(size_t group) const
{ {
auto iter = source.find(group); auto iter = source.find(group);
@@ -270,4 +226,3 @@ void CAnimation::createFlippedGroup(const size_t sourceGroup, const size_t targe
image->verticalFlip(); image->verticalFlip();
} }
} }

View File

@@ -59,19 +59,6 @@ public:
void exportBitmaps(const boost::filesystem::path & path) const; 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) //total count of frames in group (including not loaded)
size_t size(size_t group=0) const; size_t size(size_t group=0) const;

View File

@@ -232,10 +232,6 @@ void CAnimImage::setSizeFromImage(const IImage &img)
void CAnimImage::init() void CAnimImage::init()
{ {
visible = true; visible = true;
anim->load(frame, group);
if (flags & CShowableAnim::BASE)
anim->load(0,group);
auto img = anim->getImage(frame, group); auto img = anim->getImage(frame, group);
if (img) if (img)
setSizeFromImage(*img); setSizeFromImage(*img);
@@ -287,7 +283,6 @@ void CAnimImage::setFrame(size_t Frame, size_t Group)
return; return;
if (anim->size(Group) > Frame) if (anim->size(Group) > Frame)
{ {
anim->load(Frame, Group);
frame = Frame; frame = Frame;
group = Group; group = Group;
if(auto img = anim->getImage(frame, 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), yOffset(0),
alpha(alpha) alpha(alpha)
{ {
anim->loadGroup(group);
last = anim->size(group); last = anim->size(group);
auto image = anim->getImage(0, group); auto image = anim->getImage(0, group);
@@ -341,11 +335,6 @@ CShowableAnim::CShowableAnim(int x, int y, const AnimationPath & name, ui8 Flags
addUsedEvents(TIME); addUsedEvents(TIME);
} }
CShowableAnim::~CShowableAnim()
{
anim->unloadGroup(group);
}
void CShowableAnim::setAlpha(ui32 alphaValue) void CShowableAnim::setAlpha(ui32 alphaValue)
{ {
alpha = std::min<ui32>(alphaValue, 255); alpha = std::min<ui32>(alphaValue, 255);
@@ -361,9 +350,6 @@ bool CShowableAnim::set(size_t Group, size_t from, size_t to)
if (max < from || max == 0) if (max < from || max == 0)
return false; return false;
anim->unloadGroup(group);
anim->loadGroup(Group);
group = Group; group = Group;
frame = first = from; frame = first = from;
last = max; last = max;
@@ -377,9 +363,6 @@ bool CShowableAnim::set(size_t Group)
return false; return false;
if (group != Group) if (group != Group)
{ {
anim->unloadGroup(group);
anim->loadGroup(Group);
first = 0; first = 0;
group = Group; group = Group;
last = anim->size(Group); last = anim->size(Group);

View File

@@ -178,7 +178,6 @@ public:
void setAlpha(ui32 alphaValue); 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(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 //set animation to group or part of group
bool set(size_t Group); bool set(size_t Group);

View File

@@ -42,7 +42,6 @@ void CMessage::init()
for(int i = 0; i < PlayerColor::PLAYER_LIMIT_I; i++) for(int i = 0; i < PlayerColor::PLAYER_LIMIT_I; i++)
{ {
dialogBorders[i] = GH.renderHandler().loadAnimation(AnimationPath::builtin("DIALGBOX")); dialogBorders[i] = GH.renderHandler().loadAnimation(AnimationPath::builtin("DIALGBOX"));
dialogBorders[i]->preload();
for(int j = 0; j < dialogBorders[i]->size(0); j++) for(int j = 0; j < dialogBorders[i]->size(0); j++)
{ {