1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Merge pull request #242 from dydzio0614/MapScrollCursor

Implement adventure map scroll cursor change
This commit is contained in:
ArseniyShestakov 2016-10-17 16:09:01 +03:00 committed by GitHub
commit eec14028fe
2 changed files with 33 additions and 0 deletions

View File

@ -59,6 +59,31 @@ using namespace CSDL_Ext;
CAdvMapInt *adventureInt;
static void setScrollingCursor(ui8 direction)
{
if(direction & CAdvMapInt::RIGHT)
{
if(direction & CAdvMapInt::UP)
CCS->curh->changeGraphic(ECursor::ADVENTURE, 33);
else if(direction & CAdvMapInt::DOWN)
CCS->curh->changeGraphic(ECursor::ADVENTURE, 35);
else
CCS->curh->changeGraphic(ECursor::ADVENTURE, 34);
}
else if(direction & CAdvMapInt::LEFT)
{
if(direction & CAdvMapInt::UP)
CCS->curh->changeGraphic(ECursor::ADVENTURE, 39);
else if(direction & CAdvMapInt::DOWN)
CCS->curh->changeGraphic(ECursor::ADVENTURE, 37);
else
CCS->curh->changeGraphic(ECursor::ADVENTURE, 38);
}
else if(direction & CAdvMapInt::UP)
CCS->curh->changeGraphic(ECursor::ADVENTURE, 32);
else if(direction & CAdvMapInt::DOWN)
CCS->curh->changeGraphic(ECursor::ADVENTURE, 36);
}
CTerrainRect::CTerrainRect()
: fadeSurface(nullptr),
@ -955,11 +980,18 @@ void CAdvMapInt::show(SDL_Surface * to)
if(scrollingDir)
{
setScrollingCursor(scrollingDir);
scrollingState = true;
updateScreen = true;
minimap.redraw();
if (mode == EAdvMapMode::WORLD_VIEW)
terrain.redraw();
}
else if(scrollingState)
{
CCS->curh->changeGraphic(ECursor::ADVENTURE, 0);
scrollingState = false;
}
}
if(updateScreen)
{

View File

@ -121,6 +121,7 @@ public:
enum{LEFT=1, RIGHT=2, UP=4, DOWN=8};
ui8 scrollingDir; //uses enum: LEFT RIGHT, UP, DOWN
bool scrollingState;
enum{NA, INGAME, WAITING} state;