2017-07-13 10:26:03 +02:00
|
|
|
/*
|
|
|
|
* AdventureMapClasses.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2012-06-13 16:04:06 +03:00
|
|
|
#pragma once
|
|
|
|
|
2014-07-15 10:14:49 +03:00
|
|
|
#include "ObjectLists.h"
|
|
|
|
#include "../../lib/FunctionList.h"
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2012-06-13 16:04:06 +03:00
|
|
|
class CArmedInstance;
|
|
|
|
class CGGarrison;
|
|
|
|
class CGObjectInstance;
|
|
|
|
class CGHeroInstance;
|
|
|
|
class CGTownInstance;
|
|
|
|
struct Component;
|
|
|
|
struct InfoAboutArmy;
|
|
|
|
struct InfoAboutHero;
|
|
|
|
struct InfoAboutTown;
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
|
|
|
class CAnimation;
|
|
|
|
class CAnimImage;
|
|
|
|
class CShowableAnim;
|
|
|
|
class CFilledTexture;
|
|
|
|
class CButton;
|
|
|
|
class CComponent;
|
2018-04-07 13:34:11 +02:00
|
|
|
class CHeroTooltip;
|
|
|
|
class CTownTooltip;
|
|
|
|
class CTextBox;
|
2023-01-30 18:25:47 +02:00
|
|
|
class IImage;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
class CMinimap;
|
|
|
|
|
|
|
|
class CMinimapInstance : public CIntObject
|
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
CMinimap * parent;
|
2012-06-13 16:04:06 +03:00
|
|
|
SDL_Surface * minimap;
|
|
|
|
int level;
|
|
|
|
|
|
|
|
//get color of selected tile on minimap
|
|
|
|
const SDL_Color & getTileColor(const int3 & pos);
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
void blitTileWithColor(const SDL_Color & color, const int3 & pos, SDL_Surface * to, int x, int y);
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
//draw minimap already scaled.
|
|
|
|
//result is not antialiased. Will result in "missing" pixels on huge maps (>144)
|
|
|
|
void drawScaled(int level);
|
|
|
|
public:
|
|
|
|
CMinimapInstance(CMinimap * parent, int level);
|
|
|
|
~CMinimapInstance();
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
void showAll(SDL_Surface * to) override;
|
|
|
|
void tileToPixels (const int3 & tile, int & x, int & y, int toX = 0, int toY = 0);
|
|
|
|
void refreshTile(const int3 & pos);
|
2012-06-13 16:04:06 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Minimap which is displayed at the right upper corner of adventure map
|
|
|
|
class CMinimap : public CIntObject
|
|
|
|
{
|
2012-07-08 19:36:20 +03:00
|
|
|
protected:
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CPicture> aiShield; //the graphic displayed during AI turn
|
|
|
|
std::shared_ptr<CMinimapInstance> minimap;
|
2012-06-13 16:04:06 +03:00
|
|
|
int level;
|
|
|
|
|
|
|
|
//to initialize colors
|
2022-09-29 11:44:46 +02:00
|
|
|
std::map<TerrainId, std::pair<SDL_Color, SDL_Color> > loadColors();
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void hover (bool on) override;
|
|
|
|
void mouseMoved (const SDL_MouseMotionEvent & sEvent) override;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
2012-07-07 11:45:45 +03:00
|
|
|
void moveAdvMapSelection();
|
|
|
|
|
2012-06-13 16:04:06 +03:00
|
|
|
public:
|
|
|
|
// terrainID -> (normal color, blocked color)
|
2022-09-29 11:44:46 +02:00
|
|
|
const std::map<TerrainId, std::pair<SDL_Color, SDL_Color> > colors;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
CMinimap(const Rect & position);
|
|
|
|
|
|
|
|
//should be called to invalidate whole map - different player or level
|
2012-07-08 19:36:20 +03:00
|
|
|
int3 translateMousePosition();
|
2012-06-13 16:04:06 +03:00
|
|
|
void update();
|
|
|
|
void setLevel(int level);
|
|
|
|
void setAIRadar(bool on);
|
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void showAll(SDL_Surface * to) override;
|
2012-06-13 16:04:06 +03:00
|
|
|
|
|
|
|
void hideTile(const int3 &pos); //puts FoW
|
|
|
|
void showTile(const int3 &pos); //removes FoW
|
|
|
|
};
|
|
|
|
|