mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Fixed visibility of corner gems
This commit is contained in:
parent
a015bf6507
commit
4958190e82
@ -659,7 +659,7 @@ static bool recreateWindow(int w, int h, int bpp, bool fullscreen, int displayIn
|
|||||||
|
|
||||||
// TODO: CONFIGURABLE ADVMAP
|
// TODO: CONFIGURABLE ADVMAP
|
||||||
static const std::vector<Point> supportedResolutions = {
|
static const std::vector<Point> supportedResolutions = {
|
||||||
{ 800, 600 }
|
{ 1280, 720 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,8 +32,10 @@
|
|||||||
CAdventureMapWidget::CAdventureMapWidget()
|
CAdventureMapWidget::CAdventureMapWidget()
|
||||||
: state(EGameState::NOT_INITIALIZED)
|
: state(EGameState::NOT_INITIALIZED)
|
||||||
{
|
{
|
||||||
pos.w = 800;
|
pos.x = pos.y = 0;
|
||||||
pos.h = 600;
|
pos.w = GH.screenDimensions().x;
|
||||||
|
pos.h = GH.screenDimensions().y;
|
||||||
|
|
||||||
REGISTER_BUILDER("adventureInfobar", &CAdventureMapWidget::buildInfobox );
|
REGISTER_BUILDER("adventureInfobar", &CAdventureMapWidget::buildInfobox );
|
||||||
REGISTER_BUILDER("adventureMapImage", &CAdventureMapWidget::buildMapImage );
|
REGISTER_BUILDER("adventureMapImage", &CAdventureMapWidget::buildMapImage );
|
||||||
REGISTER_BUILDER("adventureMapButton", &CAdventureMapWidget::buildMapButton );
|
REGISTER_BUILDER("adventureMapButton", &CAdventureMapWidget::buildMapButton );
|
||||||
@ -154,7 +156,12 @@ std::shared_ptr<CIntObject> CAdventureMapWidget::buildMapButton(const JsonNode &
|
|||||||
std::shared_ptr<CIntObject> CAdventureMapWidget::buildMapContainer(const JsonNode & input)
|
std::shared_ptr<CIntObject> CAdventureMapWidget::buildMapContainer(const JsonNode & input)
|
||||||
{
|
{
|
||||||
auto position = readTargetArea(input["area"]);
|
auto position = readTargetArea(input["area"]);
|
||||||
auto result = std::make_shared<CAdventureMapContainerWidget>();
|
std::shared_ptr<CAdventureMapContainerWidget> result;
|
||||||
|
|
||||||
|
if (input["overlay"].Bool())
|
||||||
|
result = std::make_shared<CAdventureMapOverlayWidget>();
|
||||||
|
else
|
||||||
|
result = std::make_shared<CAdventureMapContainerWidget>();
|
||||||
|
|
||||||
result->moveBy(position.topLeft());
|
result->moveBy(position.topLeft());
|
||||||
subwidgetSizes.push_back(position);
|
subwidgetSizes.push_back(position);
|
||||||
@ -388,3 +395,8 @@ void CAdventureMapIcon::setPlayer(const PlayerColor & player)
|
|||||||
{
|
{
|
||||||
image->setFrame(index + player.getNum() * iconsPerPlayer);
|
image->setFrame(index + player.getNum() * iconsPerPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAdventureMapOverlayWidget::show(SDL_Surface * to)
|
||||||
|
{
|
||||||
|
CIntObject::showAll(to);
|
||||||
|
}
|
||||||
|
@ -91,6 +91,12 @@ class CAdventureMapContainerWidget : public CIntObject
|
|||||||
std::vector<std::shared_ptr<CIntObject>> ownedChildren;
|
std::vector<std::shared_ptr<CIntObject>> ownedChildren;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CAdventureMapOverlayWidget : public CAdventureMapContainerWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void show(SDL_Surface * to) override;
|
||||||
|
};
|
||||||
|
|
||||||
/// Small helper class that provides player-colorable icon using animation file
|
/// Small helper class that provides player-colorable icon using animation file
|
||||||
class CAdventureMapIcon : public CIntObject
|
class CAdventureMapIcon : public CIntObject
|
||||||
{
|
{
|
||||||
|
@ -11,8 +11,10 @@
|
|||||||
|
|
||||||
#include "../gui/CIntObject.h"
|
#include "../gui/CIntObject.h"
|
||||||
|
|
||||||
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
enum class EGameResID : int8_t;
|
enum class EGameResID : int8_t;
|
||||||
using GameResID = Identifier<EGameResID>;
|
using GameResID = Identifier<EGameResID>;
|
||||||
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|
||||||
/// Resources bar which shows information about how many gold, crystals,... you have
|
/// Resources bar which shows information about how many gold, crystals,... you have
|
||||||
/// Current date is displayed too
|
/// Current date is displayed too
|
||||||
|
@ -128,9 +128,9 @@ void CFilledTexture::showAll(SDL_Surface *to)
|
|||||||
{
|
{
|
||||||
CSDL_Ext::CClipRectGuard guard(to, pos);
|
CSDL_Ext::CClipRectGuard guard(to, pos);
|
||||||
|
|
||||||
for (int y=pos.top(); y < pos.bottom(); y+= texture->height())
|
for (int y=pos.top(); y < pos.bottom(); y+= imageArea.h)
|
||||||
{
|
{
|
||||||
for (int x=pos.left(); x < pos.right(); x+=texture->width())
|
for (int x=pos.left(); x < pos.right(); x+= imageArea.w)
|
||||||
texture->draw(to, x, y, &imageArea);
|
texture->draw(to, x, y, &imageArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,114 +9,103 @@
|
|||||||
|
|
||||||
// widgets that are only visible in game view mode
|
// widgets that are only visible in game view mode
|
||||||
"gameViewWidgets" : [ "townListContainer", "heroListContainer", "buttonsContainer", "infobox" ],
|
"gameViewWidgets" : [ "townListContainer", "heroListContainer", "buttonsContainer", "infobox" ],
|
||||||
|
|
||||||
// widgets that should be drawn on top of game area
|
|
||||||
// NOTE: semi-transparency is not supported, only fully transparent/fully opaque
|
|
||||||
"overlayWidgets" : [ "gemTopLeft", "gemTopRight", "gemBottomLeft", "gemBottomRight" ]
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"items":
|
"items":
|
||||||
[
|
[
|
||||||
// GEMS - set of images with different image for each player
|
// Background sections - left side
|
||||||
{
|
{
|
||||||
"type": "adventureMapIcon",
|
"type": "adventureMapImage",
|
||||||
"name" : "gemTopLeft",
|
"name" : "backgroundLeftTop",
|
||||||
"image" : "agemUL.def",
|
"image" : "AdvMap.pcx",
|
||||||
"index" : 0,
|
"area" : { "left": 0, "top" : 0, "width" : 7, "height" : 52 }
|
||||||
"perPlayer" : 1,
|
|
||||||
"area" : { "left": 7, "top" : 7, "width" : 46, "height" : 46 }
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "adventureMapIcon",
|
"type": "adventureMapImage",
|
||||||
"name" : "gemTopRight",
|
"name" : "backgroundLeftCenter",
|
||||||
"image" : "agemUR.def",
|
"image" : "AdvMap.pcx",
|
||||||
"index" : 0,
|
"area" : { "left": 0, "top" : 52, "width" : 7, "bottom" : 91 }
|
||||||
"perPlayer" : 1,
|
|
||||||
"area" : { "right": 198, "top" : 7, "width" : 46, "height" : 46 }
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "adventureMapIcon",
|
"type": "adventureMapImage",
|
||||||
"name" : "gemBottomLeft",
|
"name" : "backgroundLeftBottom",
|
||||||
"image" : "agemLL.def",
|
"image" : "AdvMap.pcx",
|
||||||
"index" : 0,
|
"area" : { "left": 0, "bottom" : 0, "width" : 7, "height" : 91 }
|
||||||
"perPlayer" : 1,
|
|
||||||
"area" : { "left": 7, "bottom" : 46, "width" : 46, "height" : 46 }
|
|
||||||
},
|
},
|
||||||
{
|
// Background sections - top side
|
||||||
"type": "adventureMapIcon",
|
|
||||||
"name" : "gemBottomRight",
|
|
||||||
"image" : "agemLR.def",
|
|
||||||
"index" : 0,
|
|
||||||
"perPlayer" : 1,
|
|
||||||
"area" : { "right": 198, "bottom" : 46, "width" : 46, "height" : 46 }
|
|
||||||
},
|
|
||||||
|
|
||||||
// Background sections
|
|
||||||
{
|
{
|
||||||
"type": "adventureMapImage",
|
"type": "adventureMapImage",
|
||||||
"name" : "backgroundTopLeft",
|
"name" : "backgroundTopLeft",
|
||||||
"image" : "AdvMap.pcx",
|
"image" : "AdvMap.pcx",
|
||||||
"area" : { "left": 0, "top" : 0, "width" : 7, "height" : 7 }
|
"area" : { "left": 7, "top" : 0, "width" : 193, "height" : 7 }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "adventureMapImage",
|
"type": "adventureMapImage",
|
||||||
"name" : "backgroundBottomLeft",
|
"name" : "backgroundTopCenter",
|
||||||
"image" : "AdvMap.pcx",
|
"image" : "AdvMap.pcx",
|
||||||
"area" : { "left": 0, "bottom" : 0, "width" : 7, "height" : 46 }
|
"area" : { "left": 200, "top" : 0, "right" : 244, "height" : 7 }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "adventureMapImage",
|
"type": "adventureMapImage",
|
||||||
"name" : "backgroundTopRight",
|
"name" : "backgroundTopRight",
|
||||||
"image" : "AdvMap.pcx",
|
"image" : "AdvMap.pcx",
|
||||||
"area" : { "right": 0, "top" : 0, "width" : 199, "height" : 196 }
|
"area" : { "width": 45, "top" : 0, "right" : 199, "height" : 7 }
|
||||||
|
},
|
||||||
|
// Background sections - bottom side
|
||||||
|
{
|
||||||
|
"type": "adventureMapImage",
|
||||||
|
"name" : "backgroundBottomLeft",
|
||||||
|
"image" : "AdvMap.pcx",
|
||||||
|
"area" : { "left": 7, "bottom" : 0, "width" : 44, "height" : 47 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "adventureMapImage",
|
||||||
|
"name" : "backgroundBottomCenter",
|
||||||
|
"image" : "AdvMap.pcx",
|
||||||
|
"area" : { "left": 51, "bottom" : 0, "right" : 244, "height" : 47 }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "adventureMapImage",
|
"type": "adventureMapImage",
|
||||||
"name" : "backgroundBottomRight",
|
"name" : "backgroundBottomRight",
|
||||||
"image" : "AdvMap.pcx",
|
"image" : "AdvMap.pcx",
|
||||||
|
"area" : { "width": 45, "bottom" : 0, "right" : 199, "height" : 47 }
|
||||||
|
},
|
||||||
|
// Background sections - side panel
|
||||||
|
{
|
||||||
|
"type": "adventureMapImage",
|
||||||
|
"name" : "backgroundRightMinimap",
|
||||||
|
"image" : "AdvMap.pcx",
|
||||||
|
"area" : { "right": 0, "top" : 0, "width" : 199, "height" : 196 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "adventureMapImage",
|
||||||
|
"name" : "backgroundRightInfobar",
|
||||||
|
"image" : "AdvMap.pcx",
|
||||||
"area" : { "bottom": 0, "right" : 0, "width" : 199, "height" : 211 }
|
"area" : { "bottom": 0, "right" : 0, "width" : 199, "height" : 211 }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "adventureMapImage",
|
"type": "adventureMapImage",
|
||||||
"name": "sideBorderLeft",
|
"name": "backgroundHeroListBorderLeft",
|
||||||
"image" : "AdvMap.pcx",
|
"image" : "AdvMap.pcx",
|
||||||
"area": { "top": 7, "left" : 0, "bottom" : 46, "width" : 7 }
|
"area": { "top": 196, "bottom" : 211, "right" : 191, "width" : 8 }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "adventureMapImage",
|
"type": "adventureMapImage",
|
||||||
"name": "sideBorderTop",
|
"name": "backgroundHeroListBorderRight",
|
||||||
"image" : "AdvMap.pcx",
|
"image" : "AdvMap.pcx",
|
||||||
"area": { "top": 0, "left" : 7, "right" : 199, "height" : 7 }
|
"area": { "top": 196, "bottom" : 211, "right" : 121, "width" : 6 }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "adventureMapImage",
|
"type": "adventureMapImage",
|
||||||
"name": "sideBorderBottom",
|
"name": "backgroundTownListBorderLeft",
|
||||||
"image" : "AdvMap.pcx",
|
"image" : "AdvMap.pcx",
|
||||||
"area": { "bottom": 0, "right" : 199, "left" : 0, "height" : 47 }
|
"area": { "top": 196, "bottom" : 211, "right" : 53, "width" : 4 }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "adventureMapImage",
|
"type": "adventureMapImage",
|
||||||
"name": "heroListBorderLeft",
|
"name": "backgroundTownListBorderRight",
|
||||||
"image" : "AdvMap.pcx",
|
"image" : "AdvMap.pcx",
|
||||||
"area": { "top": 196, "bottom" : 210, "right" : 192, "width" : 7 }
|
"area": { "top": 196, "bottom" : 211, "right" : 0, "width" : 5 }
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "adventureMapImage",
|
|
||||||
"name": "heroListBorderRight",
|
|
||||||
"image" : "AdvMap.pcx",
|
|
||||||
"area": { "top": 196, "bottom" : 210, "right" : 122, "width" : 3 }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "adventureMapImage",
|
|
||||||
"name": "townListBorderLeft",
|
|
||||||
"image" : "AdvMap.pcx",
|
|
||||||
"area": { "top": 196, "bottom" : 210, "right" : 54, "width" : 3 }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "adventureMapImage",
|
|
||||||
"name": "townListBorderRight",
|
|
||||||
"image" : "AdvMap.pcx",
|
|
||||||
"area": { "top": 196, "bottom" : 210, "right" : 0, "width" : 3 }
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Game area
|
// Game area
|
||||||
@ -607,6 +596,71 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
// GEMS - set of images with different image for each player
|
||||||
|
{
|
||||||
|
"type": "adventureMapContainer",
|
||||||
|
"name" : "overlayGemTopLeft",
|
||||||
|
"overlay" : true,
|
||||||
|
"area": { "left": 6, "top" : 6, "width" : 46, "height" : 46 },
|
||||||
|
"items" : [
|
||||||
|
{
|
||||||
|
"type": "adventureMapIcon",
|
||||||
|
"name" : "gemTopLeft",
|
||||||
|
"image" : "agemUL.def",
|
||||||
|
"index" : 0,
|
||||||
|
"perPlayer" : 1,
|
||||||
|
"area" : { "left": 0, "top" : 0, "right" : 0, "bottom" : 0 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "adventureMapContainer",
|
||||||
|
"name" : "overlayGemTopRight",
|
||||||
|
"overlay" : true,
|
||||||
|
"area": { "right": 198, "top" : 6, "width" : 46, "height" : 46 },
|
||||||
|
"items" : [
|
||||||
|
{
|
||||||
|
"type": "adventureMapIcon",
|
||||||
|
"name" : "gemTopRight",
|
||||||
|
"image" : "agemUR.def",
|
||||||
|
"index" : 0,
|
||||||
|
"perPlayer" : 1,
|
||||||
|
"area" : { "left": 0, "top" : 0, "right" : 0, "bottom" : 0 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "adventureMapContainer",
|
||||||
|
"name" : "overlayGemBottomLeft",
|
||||||
|
"overlay" : true,
|
||||||
|
"area": { "left": 6, "bottom" : 46, "width" : 46, "height" : 46 },
|
||||||
|
"items" : [
|
||||||
|
{
|
||||||
|
"type": "adventureMapIcon",
|
||||||
|
"name" : "gemBottomLeft",
|
||||||
|
"image" : "agemLL.def",
|
||||||
|
"index" : 0,
|
||||||
|
"perPlayer" : 1,
|
||||||
|
"area" : { "left": 0, "top" : 0, "right" : 0, "bottom" : 0 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "adventureMapContainer",
|
||||||
|
"name" : "overlayGemBottomRight",
|
||||||
|
"overlay" : true,
|
||||||
|
"area": { "right": 198, "bottom" : 46, "width" : 46, "height" : 46 },
|
||||||
|
"items" : [
|
||||||
|
{
|
||||||
|
"type": "adventureMapIcon",
|
||||||
|
"name" : "gemBottomRight",
|
||||||
|
"image" : "agemLR.def",
|
||||||
|
"index" : 0,
|
||||||
|
"perPlayer" : 1,
|
||||||
|
"area" : { "left": 0, "top" : 0, "right" : 0, "bottom" : 0 }
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user