From f60813d86fe27c138b003f718fa63e4187065a85 Mon Sep 17 00:00:00 2001 From: SoundSSGood <87084363+SoundSSGood@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:24:08 +0200 Subject: [PATCH 1/2] CHeroOverview secondary skill icons fixed --- client/widgets/CComponentHolder.cpp | 6 +++--- client/windows/CExchangeWindow.cpp | 2 +- client/windows/CHeroOverview.cpp | 5 +++-- client/windows/CHeroOverview.h | 3 ++- client/windows/CHeroWindow.cpp | 2 +- client/windows/GUIClasses.cpp | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/client/widgets/CComponentHolder.cpp b/client/widgets/CComponentHolder.cpp index 825d4ec67..e0f4196a3 100644 --- a/client/widgets/CComponentHolder.cpp +++ b/client/widgets/CComponentHolder.cpp @@ -266,11 +266,11 @@ CSecSkillPlace::CSecSkillPlace(const Point & position, const ImageSize & imageSi { OBJECT_CONSTRUCTION; - auto imagePath = AnimationPath::builtin("SECSKILL"); + auto imagePath = AnimationPath::builtin("SECSK82"); if(imageSize == ImageSize::MEDIUM) - imagePath = AnimationPath::builtin("SECSK32"); + imagePath = AnimationPath::builtin("SECSKILL"); if(imageSize == ImageSize::SMALL) - imagePath = AnimationPath::builtin("SECSK82"); + imagePath = AnimationPath::builtin("SECSK32"); image = std::make_shared(imagePath, 0); component.type = ComponentType::SEC_SKILL; diff --git a/client/windows/CExchangeWindow.cpp b/client/windows/CExchangeWindow.cpp index 81fd27888..b97696446 100644 --- a/client/windows/CExchangeWindow.cpp +++ b/client/windows/CExchangeWindow.cpp @@ -82,7 +82,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2, for(int m=0; m < hero->secSkills.size(); ++m) - secSkills[leftRight].push_back(std::make_shared(Point(32 + 36 * m + 454 * leftRight, qeLayout ? 83 : 88), CSecSkillPlace::ImageSize::MEDIUM, + secSkills[leftRight].push_back(std::make_shared(Point(32 + 36 * m + 454 * leftRight, qeLayout ? 83 : 88), CSecSkillPlace::ImageSize::SMALL, hero->secSkills[m].first, hero->secSkills[m].second)); specImages[leftRight] = std::make_shared(AnimationPath::builtin("UN32"), hero->getHeroType()->imageIndex, 0, 67 + 490 * leftRight, qeLayout ? 41 : 45); diff --git a/client/windows/CHeroOverview.cpp b/client/windows/CHeroOverview.cpp index ac1c9dd00..ae6c81409 100644 --- a/client/windows/CHeroOverview.cpp +++ b/client/windows/CHeroOverview.cpp @@ -18,7 +18,7 @@ #include "../render/Colors.h" #include "../render/IImage.h" #include "../renderSDL/RenderHandler.h" -#include "../widgets/CComponent.h" +#include"../widgets/CComponentHolder.h" #include "../widgets/Images.h" #include "../widgets/TextControls.h" #include "../widgets/GraphicalPrimitiveCanvas.h" @@ -206,7 +206,8 @@ void CHeroOverview::genControls() i = 0; for(auto & skill : (*CGI->heroh)[heroIdx]->secSkillsInit) { - imageSecSkills.push_back(std::make_shared(AnimationPath::builtin("SECSK32"), (*CGI->skillh)[skill.first]->getIconIndex(skill.second + 2), 0, 302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset))); + imageSecSkills.push_back(std::make_shared(Point(302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset)), + CSecSkillPlace::ImageSize::SMALL, skill.first, skill.second)); labelSecSkillsNames.push_back(std::make_shared(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) - 5, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->levels[skill.second - 1])); labelSecSkillsNames.push_back(std::make_shared(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) + 10, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->skillh)[skill.first]->getNameTranslated())); i++; diff --git a/client/windows/CHeroOverview.h b/client/windows/CHeroOverview.h index 64c9b16e9..d2ac4aa2e 100644 --- a/client/windows/CHeroOverview.h +++ b/client/windows/CHeroOverview.h @@ -19,6 +19,7 @@ class CComponentBox; class CTextBox; class TransparentFilledRectangle; class SimpleLine; +class CSecSkillPlace; class CHeroOverview : public CWindowObject { @@ -60,7 +61,7 @@ class CHeroOverview : public CWindowObject std::vector> labelSpellsNames; std::shared_ptr labelSecSkillTitle; - std::vector> imageSecSkills; + std::vector> imageSecSkills; std::vector> labelSecSkillsNames; void genBackground(); diff --git a/client/windows/CHeroWindow.cpp b/client/windows/CHeroWindow.cpp index 26a9e35f9..b0b495009 100644 --- a/client/windows/CHeroWindow.cpp +++ b/client/windows/CHeroWindow.cpp @@ -152,7 +152,7 @@ CHeroWindow::CHeroWindow(const CGHeroInstance * hero) for(int i = 0; i < std::min(hero->secSkills.size(), 8u); ++i) { Rect r = Rect(i%2 == 0 ? 18 : 162, 276 + 48 * (i/2), 136, 42); - secSkills.emplace_back(std::make_shared(r.topLeft(), CSecSkillPlace::ImageSize::LARGE)); + secSkills.emplace_back(std::make_shared(r.topLeft(), CSecSkillPlace::ImageSize::MEDIUM)); int x = (i % 2) ? 212 : 68; int y = 280 + 48 * (i/2); diff --git a/client/windows/GUIClasses.cpp b/client/windows/GUIClasses.cpp index 344b18deb..a15027290 100644 --- a/client/windows/GUIClasses.cpp +++ b/client/windows/GUIClasses.cpp @@ -896,7 +896,7 @@ CUniversityWindow::CItem::CItem(CUniversityWindow * _parent, int _ID, int X, int pos.x += X; pos.y += Y; - skill = std::make_shared(Point(), CSecSkillPlace::ImageSize::LARGE, _ID, 1); + skill = std::make_shared(Point(), CSecSkillPlace::ImageSize::MEDIUM, _ID, 1); skill->setClickPressedCallback([this](const CComponentHolder&, const Point& cursorPosition) { bool skillKnown = parent->hero->getSecSkillLevel(ID); From fa9201831b50c5666056f078463c5799430a6d47 Mon Sep 17 00:00:00 2001 From: SoundSSGood <87084363+SoundSSGood@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:45:44 +0200 Subject: [PATCH 2/2] QuickBackpack window position on shift+click slot fixed --- client/windows/CExchangeWindow.cpp | 4 ++-- client/windows/CHeroBackpackWindow.cpp | 2 +- client/windows/CHeroOverview.cpp | 4 ++-- client/windows/CHeroOverview.h | 2 +- client/windows/CHeroWindow.cpp | 2 +- client/windows/CKingdomInterface.cpp | 2 +- client/windows/CMarketWindow.cpp | 2 +- client/windows/CWindowWithArtifacts.cpp | 8 +++++--- client/windows/CWindowWithArtifacts.h | 2 +- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/client/windows/CExchangeWindow.cpp b/client/windows/CExchangeWindow.cpp index b97696446..35c5d8c7f 100644 --- a/client/windows/CExchangeWindow.cpp +++ b/client/windows/CExchangeWindow.cpp @@ -95,12 +95,12 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2, } artifs[0] = std::make_shared(Point(-334, 151)); - artifs[0]->clickPressedCallback = [this, hero = heroInst[0]](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(hero, artPlace.slot, true, false, false);}; + artifs[0]->clickPressedCallback = [this, hero = heroInst[0]](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(hero, artPlace.slot, true, false, false, cursorPosition);}; artifs[0]->showPopupCallback = [this, heroArts = artifs[0]](CArtPlace & artPlace, const Point & cursorPosition){showArtifactAssembling(*heroArts, artPlace, cursorPosition);}; artifs[0]->gestureCallback = [this, hero = heroInst[0]](const CArtPlace & artPlace, const Point & cursorPosition){showQuickBackpackWindow(hero, artPlace.slot, cursorPosition);}; artifs[0]->setHero(heroInst[0]); artifs[1] = std::make_shared(Point(98, 151)); - artifs[1]->clickPressedCallback = [this, hero = heroInst[1]](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(hero, artPlace.slot, true, false, false);}; + artifs[1]->clickPressedCallback = [this, hero = heroInst[1]](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(hero, artPlace.slot, true, false, false, cursorPosition);}; artifs[1]->showPopupCallback = [this, heroArts = artifs[1]](CArtPlace & artPlace, const Point & cursorPosition){showArtifactAssembling(*heroArts, artPlace, cursorPosition);}; artifs[1]->gestureCallback = [this, hero = heroInst[1]](const CArtPlace & artPlace, const Point & cursorPosition){showQuickBackpackWindow(hero, artPlace.slot, cursorPosition);}; artifs[1]->setHero(heroInst[1]); diff --git a/client/windows/CHeroBackpackWindow.cpp b/client/windows/CHeroBackpackWindow.cpp index ce8b90e46..94b7a622f 100644 --- a/client/windows/CHeroBackpackWindow.cpp +++ b/client/windows/CHeroBackpackWindow.cpp @@ -35,7 +35,7 @@ CHeroBackpackWindow::CHeroBackpackWindow(const CGHeroInstance * hero, const std: arts->moveBy(Point(windowMargin, windowMargin)); arts->clickPressedCallback = [this](const CArtPlace & artPlace, const Point & cursorPosition) { - clickPressedOnArtPlace(arts->getHero(), artPlace.slot, true, false, true); + clickPressedOnArtPlace(arts->getHero(), artPlace.slot, true, false, true, cursorPosition); }; arts->showPopupCallback = [this](CArtPlace & artPlace, const Point & cursorPosition) { diff --git a/client/windows/CHeroOverview.cpp b/client/windows/CHeroOverview.cpp index ae6c81409..1c1f0bacf 100644 --- a/client/windows/CHeroOverview.cpp +++ b/client/windows/CHeroOverview.cpp @@ -18,7 +18,7 @@ #include "../render/Colors.h" #include "../render/IImage.h" #include "../renderSDL/RenderHandler.h" -#include"../widgets/CComponentHolder.h" +#include "../widgets/CComponentHolder.h" #include "../widgets/Images.h" #include "../widgets/TextControls.h" #include "../widgets/GraphicalPrimitiveCanvas.h" @@ -206,7 +206,7 @@ void CHeroOverview::genControls() i = 0; for(auto & skill : (*CGI->heroh)[heroIdx]->secSkillsInit) { - imageSecSkills.push_back(std::make_shared(Point(302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset)), + secSkills.push_back(std::make_shared(Point(302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset)), CSecSkillPlace::ImageSize::SMALL, skill.first, skill.second)); labelSecSkillsNames.push_back(std::make_shared(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) - 5, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->levels[skill.second - 1])); labelSecSkillsNames.push_back(std::make_shared(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) + 10, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->skillh)[skill.first]->getNameTranslated())); diff --git a/client/windows/CHeroOverview.h b/client/windows/CHeroOverview.h index d2ac4aa2e..38e5fa683 100644 --- a/client/windows/CHeroOverview.h +++ b/client/windows/CHeroOverview.h @@ -61,7 +61,7 @@ class CHeroOverview : public CWindowObject std::vector> labelSpellsNames; std::shared_ptr labelSecSkillTitle; - std::vector> imageSecSkills; + std::vector> secSkills; std::vector> labelSecSkillsNames; void genBackground(); diff --git a/client/windows/CHeroWindow.cpp b/client/windows/CHeroWindow.cpp index b0b495009..5698d8328 100644 --- a/client/windows/CHeroWindow.cpp +++ b/client/windows/CHeroWindow.cpp @@ -209,7 +209,7 @@ void CHeroWindow::update() if(!arts) { arts = std::make_shared(Point(-65, -8)); - arts->clickPressedCallback = [this](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(curHero, artPlace.slot, true, false, false);}; + arts->clickPressedCallback = [this](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(curHero, artPlace.slot, true, false, false, cursorPosition);}; arts->showPopupCallback = [this](CArtPlace & artPlace, const Point & cursorPosition){showArtifactAssembling(*arts, artPlace, cursorPosition);}; arts->gestureCallback = [this](const CArtPlace & artPlace, const Point & cursorPosition){showQuickBackpackWindow(curHero, artPlace.slot, cursorPosition);}; arts->setHero(curHero); diff --git a/client/windows/CKingdomInterface.cpp b/client/windows/CKingdomInterface.cpp index 136f7317b..61254a60a 100644 --- a/client/windows/CKingdomInterface.cpp +++ b/client/windows/CKingdomInterface.cpp @@ -552,7 +552,7 @@ std::shared_ptr CKingdomInterface::createMainTab(size_t index) { newHeroSet->clickPressedCallback = [this, newHeroSet](const CArtPlace & artPlace, const Point & cursorPosition) { - clickPressedOnArtPlace(newHeroSet->getHero(), artPlace.slot, false, false, false); + clickPressedOnArtPlace(newHeroSet->getHero(), artPlace.slot, false, false, false, cursorPosition); }; newHeroSet->showPopupCallback = [this, newHeroSet](CArtPlace & artPlace, const Point & cursorPosition) { diff --git a/client/windows/CMarketWindow.cpp b/client/windows/CMarketWindow.cpp index 059e1f9f0..1fbd750fd 100644 --- a/client/windows/CMarketWindow.cpp +++ b/client/windows/CMarketWindow.cpp @@ -262,7 +262,7 @@ void CMarketWindow::createAltarArtifacts(const IMarket * market, const CGHeroIns const auto heroArts = altarArtifactsStorage->getAOHset(); heroArts->clickPressedCallback = [this, heroArts](const CArtPlace & artPlace, const Point & cursorPosition) { - clickPressedOnArtPlace(heroArts->getHero(), artPlace.slot, true, true, false); + clickPressedOnArtPlace(heroArts->getHero(), artPlace.slot, true, true, false, cursorPosition); }; heroArts->showPopupCallback = [this, heroArts](CArtPlace & artPlace, const Point & cursorPosition) { diff --git a/client/windows/CWindowWithArtifacts.cpp b/client/windows/CWindowWithArtifacts.cpp index b8d20b8f4..4356f89d8 100644 --- a/client/windows/CWindowWithArtifacts.cpp +++ b/client/windows/CWindowWithArtifacts.cpp @@ -71,7 +71,7 @@ const CArtifactInstance * CWindowWithArtifacts::getPickedArtifact() const } void CWindowWithArtifacts::clickPressedOnArtPlace(const CGHeroInstance * hero, const ArtifactPosition & slot, - bool allowExchange, bool altarTrading, bool closeWindow) + bool allowExchange, bool altarTrading, bool closeWindow, const Point & cursorPosition) { if(!LOCPLINT->makingTurn) return; @@ -85,8 +85,7 @@ void CWindowWithArtifacts::clickPressedOnArtPlace(const CGHeroInstance * hero, c } else if(GH.isKeyboardShiftDown()) { - if(ArtifactUtils::isSlotEquipment(slot)) - GH.windows().createAndPushWindow(hero, slot); + showQuickBackpackWindow(hero, slot, cursorPosition); } else if(auto art = hero->getArt(slot)) { @@ -134,6 +133,9 @@ void CWindowWithArtifacts::showQuickBackpackWindow(const CGHeroInstance * hero, if(!settings["general"]["enableUiEnhancements"].Bool()) return; + if(!ArtifactUtils::isSlotEquipment(slot)) + return; + GH.windows().createAndPushWindow(hero, slot); auto backpackWindow = GH.windows().topWindow(); backpackWindow->moveTo(cursorPosition - Point(1, 1)); diff --git a/client/windows/CWindowWithArtifacts.h b/client/windows/CWindowWithArtifacts.h index 9b83ec991..cd6a42484 100644 --- a/client/windows/CWindowWithArtifacts.h +++ b/client/windows/CWindowWithArtifacts.h @@ -28,7 +28,7 @@ public: const CGHeroInstance * getHeroPickedArtifact() const; const CArtifactInstance * getPickedArtifact() const; void clickPressedOnArtPlace(const CGHeroInstance * hero, const ArtifactPosition & slot, - bool allowExchange, bool altarTrading, bool closeWindow); + bool allowExchange, bool altarTrading, bool closeWindow, const Point & cursorPosition); void swapArtifactAndClose(const CArtifactsOfHeroBase & artsInst, const ArtifactPosition & slot, const ArtifactLocation & dstLoc); void showArtifactAssembling(const CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition) const; void showQuickBackpackWindow(const CGHeroInstance * hero, const ArtifactPosition & slot, const Point & cursorPosition) const;