mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-24 03:47:18 +02:00
part of minimap revealing
This commit is contained in:
parent
62237573c8
commit
4a6ffa94d0
@ -777,6 +777,23 @@ void CMinimap::deactivate()
|
||||
ClickableR::deactivate();
|
||||
Hoverable::deactivate();
|
||||
}
|
||||
void CMinimap::showTile(int3 pos)
|
||||
{
|
||||
int mw = map[0]->w, mh = map[0]->h,
|
||||
wo = mw/CGI->mh->sizes.x, ho = mh/CGI->mh->sizes.y;
|
||||
for (int ii=0; ii<wo; ii++)
|
||||
{
|
||||
for (int jj=0; jj<ho; jj++)
|
||||
{
|
||||
if ((pos.x+ii<this->pos.w-1) && (pos.y+jj<this->pos.h-1))
|
||||
CSDL_Ext::SDL_PutPixel(FoW[pos.z],pos.x+ii,pos.y+jj,0,0,0,0,128);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
void CMinimap::hideTile(int3 pos)
|
||||
{
|
||||
}
|
||||
CTerrainRect::CTerrainRect():currentPath(NULL)
|
||||
{
|
||||
tilesw=19;
|
||||
|
@ -151,7 +151,13 @@ bool CCallback::moveHero(int ID, CPath * path, int idtype, int pathType)
|
||||
int deltaX = (hero->getPosition(false).x-xd)*(hero->getPosition(false).x-xd);
|
||||
int deltaY = (hero->getPosition(false).y-yd)*(hero->getPosition(false).y-yd);
|
||||
if(deltaX+deltaY<hero->getSightDistance()*hero->getSightDistance())
|
||||
{
|
||||
if(gs->players[player].fogOfWarMap[xd][yd][hero->getPosition(false).z] == 0)
|
||||
{
|
||||
CGI->playerint[gs->players[player].serial]->tileRevealed(int3(xd, yd, hero->getPosition(false).z));
|
||||
}
|
||||
gs->players[player].fogOfWarMap[xd][yd][hero->getPosition(false).z] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1287,7 +1287,9 @@ void CPlayerInterface::removeObjToBlit(IShowable* obj)
|
||||
}
|
||||
void CPlayerInterface::tileRevealed(int3 pos)
|
||||
{
|
||||
adventureInt->minimap.showTile(pos);
|
||||
}
|
||||
void CPlayerInterface::tileHidden(int3 pos)
|
||||
{
|
||||
adventureInt->minimap.hideTile(pos);
|
||||
}
|
||||
|
@ -152,6 +152,8 @@ void CSDL_Ext::SDL_PutPixel(SDL_Surface *ekran, int x, int y, Uint8 R, Uint8 G,
|
||||
p[0] = B;
|
||||
p[1] = G;
|
||||
p[2] = R;
|
||||
if(ekran->format->BytesPerPixel==4)
|
||||
p[3] = A;
|
||||
#endif
|
||||
SDL_UpdateRect(ekran, x, y, 1, 1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user