mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
* bug 392 fixed
This commit is contained in:
parent
6d6a1af9ed
commit
5e0b0e49b2
@ -440,16 +440,9 @@ CTerrainRect::CTerrainRect()
|
||||
pos.w=ADVOPT.advmapW;
|
||||
pos.h=ADVOPT.advmapH;
|
||||
moveX = moveY = 0;
|
||||
arrows = CDefHandler::giveDef("ADAG.DEF");
|
||||
|
||||
for(size_t y=0; y < arrows->ourImages.size(); ++y)
|
||||
{
|
||||
CSDL_Ext::alphaTransform(arrows->ourImages[y].bitmap);
|
||||
}
|
||||
}
|
||||
CTerrainRect::~CTerrainRect()
|
||||
{
|
||||
delete arrows;
|
||||
}
|
||||
void CTerrainRect::activate()
|
||||
{
|
||||
@ -457,7 +450,7 @@ void CTerrainRect::activate()
|
||||
activateRClick();
|
||||
activateHover();
|
||||
activateMouseMove();
|
||||
};
|
||||
}
|
||||
void CTerrainRect::deactivate()
|
||||
{
|
||||
deactivateLClick();
|
||||
@ -465,7 +458,7 @@ void CTerrainRect::deactivate()
|
||||
deactivateHover();
|
||||
deactivateMouseMove();
|
||||
curHoveredTile = int3(-1,-1,-1); //we lost info about hovered tile when disabling
|
||||
};
|
||||
}
|
||||
void CTerrainRect::clickLeft(tribool down, bool previousState)
|
||||
{
|
||||
if ((down==false) || indeterminate(down))
|
||||
@ -782,6 +775,7 @@ void CTerrainRect::showPath(const SDL_Rect * extRect, SDL_Surface * to)
|
||||
pn+=25;
|
||||
if (pn>=0)
|
||||
{
|
||||
CDefEssential * arrows = graphics->heroMoveArrows;
|
||||
int x = 32*(currentPath->nodes[i].coord.x-adventureInt->position.x)+CGI->mh->offsetX + pos.x,
|
||||
y = 32*(currentPath->nodes[i].coord.y-adventureInt->position.y)+CGI->mh->offsetY + pos.y;
|
||||
if (x<0 || y<0 || x>pos.w || y>pos.h)
|
||||
@ -856,12 +850,12 @@ void CTerrainRect::show(SDL_Surface * to)
|
||||
CGI->mh->terrainRect
|
||||
(adventureInt->position, adventureInt->anim,
|
||||
&LOCPLINT->cb->getVisibilityMap(), true, adventureInt->heroAnim,
|
||||
to, &pos, moveX, moveY, false);
|
||||
to, &pos, moveX, moveY, false, int3());
|
||||
else
|
||||
CGI->mh->terrainRect
|
||||
(adventureInt->position, adventureInt->anim,
|
||||
&LOCPLINT->cb->getVisibilityMap(), true, adventureInt->heroAnim,
|
||||
to, &pos, 0, 0, false);
|
||||
to, &pos, 0, 0, false, int3());
|
||||
|
||||
//SDL_BlitSurface(teren,&genRect(pos.h,pos.w,0,0),screen,&genRect(547,594,7,6));
|
||||
//SDL_FreeSurface(teren);
|
||||
|
@ -81,7 +81,6 @@ public:
|
||||
int3 curHoveredTile;
|
||||
int moveX, moveY; //shift between actual position of screen and the one we wil blit; ranges from -31 to 31 (in pixels)
|
||||
|
||||
CDefHandler * arrows;
|
||||
CTerrainRect();
|
||||
~CTerrainRect();
|
||||
CGPath * currentPath;
|
||||
|
@ -5720,9 +5720,6 @@ CShipyardWindow::CShipyardWindow(const std::vector<si32> &cost, int state, int b
|
||||
CPuzzleWindow::CPuzzleWindow(const int3 &grailPos, float discoveredRatio)
|
||||
:animCount(0)
|
||||
{
|
||||
CDefHandler * arrows = CDefHandler::giveDef("ADAG.DEF");
|
||||
alphaTransform(arrows->ourImages[0].bitmap);
|
||||
|
||||
SDL_Surface * back = BitmapHandler::loadBitmap("PUZZLE.BMP", false);
|
||||
graphics->blueToPlayersAdv(back, LOCPLINT->playerID);
|
||||
//make transparency black
|
||||
@ -5741,23 +5738,7 @@ CPuzzleWindow::CPuzzleWindow(const int3 &grailPos, float discoveredRatio)
|
||||
CGI->mh->terrainRect
|
||||
(grailPos - moveInt, adventureInt->anim,
|
||||
&LOCPLINT->cb->getVisibilityMap(), true, adventureInt->heroAnim,
|
||||
background, &mapRect, 0, 0, true);
|
||||
|
||||
//printing X sign
|
||||
{
|
||||
int x = 32*moveInt.x - 16,
|
||||
y = 32*moveInt.y + 1;
|
||||
if (x<0 || y<0 || x>pos.w || y>pos.h)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
Rect dstRect = genRect(32, 32, x, y);
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(arrows->ourImages[0].bitmap, NULL, background, &dstRect);
|
||||
}
|
||||
}
|
||||
|
||||
delete arrows;
|
||||
background, &mapRect, 0, 0, true, moveInt);
|
||||
|
||||
int faction = LOCPLINT->cb->getStartInfo()->playerInfos.find(LOCPLINT->playerID)->second.castle;
|
||||
|
||||
|
@ -319,6 +319,7 @@ Graphics::Graphics()
|
||||
tasks += GET_DEF_ESS(abils44,"SECSKILL.DEF");
|
||||
tasks += GET_DEF_ESS(abils82,"SECSK82.DEF");
|
||||
tasks += GET_DEF_ESS(spellscr,"SPELLSCR.DEF");
|
||||
tasks += GET_DEF_ESS(heroMoveArrows,"ADAG.DEF");
|
||||
|
||||
std::ifstream ifs(DATA_DIR "/config/cr_bgs.txt");
|
||||
int id;
|
||||
@ -334,6 +335,11 @@ Graphics::Graphics()
|
||||
CThreadHelper th(&tasks,std::max((unsigned int)1,boost::thread::hardware_concurrency()));
|
||||
th.run();
|
||||
|
||||
for(size_t y=0; y < heroMoveArrows->ourImages.size(); ++y)
|
||||
{
|
||||
CSDL_Ext::alphaTransform(heroMoveArrows->ourImages[y].bitmap);
|
||||
}
|
||||
|
||||
//handling 32x32px imgs
|
||||
smi->notFreeImgs = true;
|
||||
for (size_t i=0; i<smi->ourImages.size(); ++i)
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
CDefEssential * un44; //many things
|
||||
CDefEssential * smallIcons, *resources32; //resources 32x32
|
||||
CDefEssential * flags;
|
||||
CDefEssential * heroMoveArrows;
|
||||
std::vector<CDefEssential *> heroAnims; // [class id: 0 - 17] //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
|
||||
std::vector<CDefEssential *> boatAnims; // [boat type: 0 - 3] //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
|
||||
std::map<std::string, CDefEssential*> mapObjectDefs; //pointers to loaded defs (key is filename, uppercase)
|
||||
|
@ -421,10 +421,7 @@ void CMapHandler::init()
|
||||
// top_tile top left tile to draw. Not necessarily visible.
|
||||
// extRect, extRect = map window on screen
|
||||
// moveX, moveY: when a hero is in movement indicates how to shift the map. Range is -31 to + 31.
|
||||
void CMapHandler::terrainRect(int3 top_tile, unsigned char anim,
|
||||
const std::vector< std::vector< std::vector<unsigned char> > > * visibilityMap,
|
||||
bool otherHeroAnim, unsigned char heroAnim, SDL_Surface * extSurf, const SDL_Rect * extRect,
|
||||
int moveX, int moveY, bool puzzleMode) const
|
||||
void CMapHandler::terrainRect( int3 top_tile, unsigned char anim, const std::vector< std::vector< std::vector<unsigned char> > > * visibilityMap, bool otherHeroAnim, unsigned char heroAnim, SDL_Surface * extSurf, const SDL_Rect * extRect, int moveX, int moveY, bool puzzleMode, int3 grailPosRel ) const
|
||||
{
|
||||
// Width and height of the portion of the map to process. Units in tiles.
|
||||
unsigned int dx = tilesW;
|
||||
@ -653,6 +650,15 @@ void CMapHandler::terrainRect(int3 top_tile, unsigned char anim,
|
||||
}
|
||||
}
|
||||
//objects blitted
|
||||
|
||||
//X sign
|
||||
if(puzzleMode)
|
||||
{
|
||||
if(bx == grailPosRel.x && by == grailPosRel.y)
|
||||
{
|
||||
CSDL_Ext::blit8bppAlphaTo24bpp(graphics->heroMoveArrows->ourImages[0].bitmap, NULL, extSurf, &sr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// terrain printed
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
void roadsRiverTerrainInit();
|
||||
void prepareFOWDefs();
|
||||
|
||||
void terrainRect(int3 top_tile, unsigned char anim, const std::vector< std::vector< std::vector<unsigned char> > > * visibilityMap, bool otherHeroAnim, unsigned char heroAnim, SDL_Surface * extSurf, const SDL_Rect * extRect, int moveX, int moveY, bool puzzleMode) const;
|
||||
void terrainRect(int3 top_tile, unsigned char anim, const std::vector< std::vector< std::vector<unsigned char> > > * visibilityMap, bool otherHeroAnim, unsigned char heroAnim, SDL_Surface * extSurf, const SDL_Rect * extRect, int moveX, int moveY, bool puzzleMode, int3 grailPosRel) const;
|
||||
void updateWater();
|
||||
unsigned char getHeroFrameNum(unsigned char dir, bool isMoving) const; //terrainRect helper function
|
||||
void validateRectTerr(SDL_Rect * val, const SDL_Rect * ext); //terrainRect helper
|
||||
|
Loading…
Reference in New Issue
Block a user