diff --git a/client/widgets/CArtifactHolder.cpp b/client/widgets/CArtifactHolder.cpp index b53237c9a..3b8b563d4 100644 --- a/client/widgets/CArtifactHolder.cpp +++ b/client/widgets/CArtifactHolder.cpp @@ -18,6 +18,7 @@ #include "../windows/GUIClasses.h" #include "../render/Canvas.h" #include "../render/Colors.h" +#include "../render/IRenderHandler.h" #include "../CPlayerInterface.h" #include "../CGameInfo.h" @@ -25,6 +26,7 @@ #include "../../lib/CGeneralTextHandler.h" #include "../../lib/ArtifactUtils.h" #include "../../lib/mapObjects/CGHeroInstance.h" +#include "../../lib/CConfigHandler.h" void CArtPlace::setInternals(const CArtifactInstance * artInst) { @@ -33,12 +35,12 @@ void CArtPlace::setInternals(const CArtifactInstance * artInst) if(!artInst) { image->disable(); + imageSpell->disable(); text.clear(); hoverText = CGI->generaltexth->allTexts[507]; return; } - image->enable(); - image->setFrame(artInst->artType->getIconIndex()); + if(artInst->getTypeId() == ArtifactID::SPELL_SCROLL) { auto spellID = artInst->getScrollSpellID(); @@ -48,14 +50,31 @@ void CArtPlace::setInternals(const CArtifactInstance * artInst) baseType = CComponent::spell; type = spellID; bonusValue = 0; + + if(!settings["general"]["enableUiEnhancements"].Bool()) + { + image->enable(); + imageSpell->disable(); + image->setFrame(artInst->artType->getIconIndex()); + } + else + { + imageSpell->enable(); + image->disable(); + imageSpell->setFrame(spellID.num); + } } } else { + image->enable(); + imageSpell->disable(); + image->setFrame(artInst->artType->getIconIndex()); baseType = CComponent::artifact; type = artInst->getTypeId(); bonusValue = 0; } + text = artInst->getDescription(); } @@ -247,9 +266,13 @@ void CHeroArtPlace::createImage() else if(ourArt) imageIndex = ourArt->artType->getIconIndex(); + imageSpell = std::make_shared(GH.renderHandler().loadAnimation(AnimationPath::builtin("spellscr")), 0, Rect(0, 5, 44, 34)); image = std::make_shared(AnimationPath::builtin("artifact"), imageIndex); if(!ourArt) + { image->disable(); + imageSpell->disable(); + } selection = std::make_shared(AnimationPath::builtin("artifact"), ArtifactID::ART_SELECTION); selection->disable(); diff --git a/client/widgets/CArtifactHolder.h b/client/widgets/CArtifactHolder.h index d8cc43aba..f4403c1ca 100644 --- a/client/widgets/CArtifactHolder.h +++ b/client/widgets/CArtifactHolder.h @@ -34,6 +34,7 @@ class CArtPlace : public LRClickableAreaWTextComp { protected: std::shared_ptr image; + std::shared_ptr imageSpell; const CArtifactInstance * ourArt; void setInternals(const CArtifactInstance * artInst); diff --git a/client/widgets/CWindowWithArtifacts.cpp b/client/widgets/CWindowWithArtifacts.cpp index 7725c16c3..4941db0c6 100644 --- a/client/widgets/CWindowWithArtifacts.cpp +++ b/client/widgets/CWindowWithArtifacts.cpp @@ -14,6 +14,10 @@ #include "../gui/CursorHandler.h" #include "../gui/WindowHandler.h" +#include "../render/IRenderHandler.h" +#include "../render/CAnimation.h" +#include "../render/IImage.h" + #include "CComponent.h" #include "../windows/CHeroWindow.h" @@ -270,7 +274,16 @@ void CWindowWithArtifacts::artifactMoved(const ArtifactLocation & srcLoc, const if(pickedArtInst) { markPossibleSlots(); - CCS->curh->dragAndDropCursor(AnimationPath::builtin("artifact"), pickedArtInst->artType->getIconIndex()); + + if(pickedArtInst->getTypeId() == ArtifactID::SPELL_SCROLL && pickedArtInst->getScrollSpellID().num >= 0 && settings["general"]["enableUiEnhancements"].Bool()) + { + auto anim = GH.renderHandler().loadAnimation(AnimationPath::builtin("spellscr")); + anim->load(pickedArtInst->getScrollSpellID().num); + std::shared_ptr img = anim->getImage(pickedArtInst->getScrollSpellID().num); + CCS->curh->dragAndDropCursor(img->scaleFast(Point(44, 34))); + } + else + CCS->curh->dragAndDropCursor(AnimationPath::builtin("artifact"), pickedArtInst->artType->getIconIndex()); } else {