Added similar screen for Obelisk, moved assets to dedicated folder
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 141 B After Width: | Height: | Size: 141 B |
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
BIN
Mods/vcmi/Content/Sprites/minimapIcons/obelisk.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
Mods/vcmi/Content/Sprites/minimapIcons/obeliskVisited.png
Normal file
After Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 391 B After Width: | Height: | Size: 391 B |
BIN
Mods/vcmi/Content/Sprites2x/minimapIcons/obelisk.png
Normal file
After Width: | Height: | Size: 154 B |
BIN
Mods/vcmi/Content/Sprites2x/minimapIcons/obeliskVisited.png
Normal file
After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
@ -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>();
|
||||
}
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|