1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-27 21:49:10 +02:00

Added similar screen for Obelisk, moved assets to dedicated folder

This commit is contained in:
Ivan Savenko 2025-01-06 13:05:45 +00:00
parent 6d0dc9c5bb
commit 19c981fc56
20 changed files with 57 additions and 6 deletions

View File

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 147 B

View File

Before

Width:  |  Height:  |  Size: 141 B

After

Width:  |  Height:  |  Size: 141 B

View File

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

View File

Before

Width:  |  Height:  |  Size: 138 B

After

Width:  |  Height:  |  Size: 138 B

View File

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 137 B

View File

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 139 B

View File

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View File

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 208 B

View File

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

View File

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 182 B

View File

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 210 B

View File

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 198 B

View File

@ -417,11 +417,11 @@ TeleporterPopup::TeleporterPopup(const Point & position, const CGTeleport * tele
ImagePath image;
if (!vstd::contains(entrances, exit))
image = ImagePath::builtin("portalExit");
image = ImagePath::builtin("minimapIcons/portalExit");
else if (!vstd::contains(exits, exit))
image = ImagePath::builtin("portalEntrance");
image = ImagePath::builtin("minimapIcons/portalEntrance");
else
image = ImagePath::builtin("portalBidirectional");
image = ImagePath::builtin("minimapIcons/portalBidirectional");
minimap->addIcon(position, image);
}
@ -452,15 +452,15 @@ KeymasterPopup::KeymasterPopup(const Point & position, const CGKeys * keymasterO
{
case Obj::KEYMASTER:
if (mapObject->subID == keymasterOrGuard->subID)
minimap->addIcon(mapObject->visitablePos(), ImagePath::builtin("keymaster"));
minimap->addIcon(mapObject->visitablePos(), ImagePath::builtin("minimapIcons/keymaster"));
break;
case Obj::BORDERGUARD:
if (mapObject->subID == keymasterOrGuard->subID)
minimap->addIcon(mapObject->visitablePos(), ImagePath::builtin("borderguard"));
minimap->addIcon(mapObject->visitablePos(), ImagePath::builtin("minimapIcons/borderguard"));
break;
case Obj::BORDER_GATE:
if (mapObject->subID == keymasterOrGuard->subID)
minimap->addIcon(mapObject->visitablePos(), ImagePath::builtin("bordergate"));
minimap->addIcon(mapObject->visitablePos(), ImagePath::builtin("minimapIcons/bordergate"));
break;
}
}
@ -468,6 +468,37 @@ KeymasterPopup::KeymasterPopup(const Point & position, const CGKeys * keymasterO
fitToScreen(10);
}
ObeliskPopup::ObeliskPopup(const Point & position, const CGObelisk * obelisk)
: CWindowObject(BORDERED | RCLICK_POPUP)
{
OBJECT_CONSTRUCTION;
pos.w = 322;
pos.h = 220;
filledBackground = std::make_shared<FilledTexturePlayerColored>(Rect(0, 0, pos.w, pos.h));
labelTitle = std::make_shared<CLabel>(pos.w / 2, 20, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, obelisk->getObjectName());
labelDescription = std::make_shared<CLabel>(pos.w / 2, 40, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, obelisk->getObjectDescription(LOCPLINT->playerID));
minimap = std::make_shared<MinimapWithIcons>(Point(0,20));
const auto allObjects = LOCPLINT->cb->getAllVisitableObjs();
for (const auto mapObject : allObjects)
{
if (!mapObject)
continue;
if (mapObject->ID != Obj::OBELISK)
continue;
if (mapObject->wasVisited(LOCPLINT->playerID))
minimap->addIcon(mapObject->visitablePos(), ImagePath::builtin("minimapIcons/obeliskVisited"));
else
minimap->addIcon(mapObject->visitablePos(), ImagePath::builtin("minimapIcons/obelisk"));
}
center(position);
fitToScreen(10);
}
std::shared_ptr<WindowBase>
CRClickPopup::createCustomInfoWindow(Point position, const CGObjectInstance * specific) //specific=0 => draws info about selected town/hero
{
@ -501,6 +532,8 @@ CRClickPopup::createCustomInfoWindow(Point position, const CGObjectInstance * sp
case Obj::BORDERGUARD:
case Obj::BORDER_GATE:
return std::make_shared<KeymasterPopup>(position, dynamic_cast<const CGKeys *>(specific));
case Obj::OBELISK:
return std::make_shared<ObeliskPopup>(position, dynamic_cast<const CGObelisk *>(specific));
default:
return std::shared_ptr<WindowBase>();
}

View File

@ -22,6 +22,7 @@ class CGGarrison;
class CGCreature;
class CGTeleport;
class CGKeys;
class CGObelisk;
VCMI_LIB_NAMESPACE_END
@ -153,3 +154,14 @@ class KeymasterPopup : public CWindowObject
public:
KeymasterPopup(const Point & position, const CGKeys * keymasterOrGuard);
};
class ObeliskPopup : public CWindowObject
{
std::shared_ptr<FilledTexturePlayerColored> filledBackground;
std::shared_ptr<MinimapWithIcons> minimap;
std::shared_ptr<CLabel> labelTitle;
std::shared_ptr<CLabel> labelDescription;
public:
ObeliskPopup(const Point & position, const CGObelisk * obelisk);
};

View File

@ -1289,6 +1289,11 @@ std::string CGObelisk::getHoverText(PlayerColor player) const
return getObjectName() + " " + visitedTxt(wasVisited(player));
}
std::string CGObelisk::getObjectDescription(PlayerColor player) const
{
return visitedTxt(wasVisited(player));
}
void CGObelisk::setPropertyDer(ObjProperty what, ObjPropertyID identifier)
{
switch(what)

View File

@ -406,6 +406,7 @@ public:
void onHeroVisit(const CGHeroInstance * h) const override;
void initObj(vstd::RNG & rand) override;
std::string getHoverText(PlayerColor player) const override;
std::string getObjectDescription(PlayerColor player) const;
template <typename Handler> void serialize(Handler &h)
{