|
@@ -99,7 +99,7 @@ void CMapHandler::prepareFOWDefs()
|
|
|
graphics->FoWpartialHide = CDefHandler::giveDef("TSHRE.DEF");
|
|
|
|
|
|
//adding necessary rotations
|
|
|
- static const int missRot [] = {22, 15, 2, 13, 12, 16, 18, 17, 20, 19, 7, 24, 26, 25, 30, 32, 27, 28};
|
|
|
+ static const int missRot [] = {22, 15, 2, 13, 12, 16, 28, 17, 20, 19, 7, 24, 26, 25, 30, 32, 27};
|
|
|
|
|
|
Cimage nw;
|
|
|
for(int g=0; g<ARRAY_COUNT(missRot); ++g)
|
|
@@ -753,43 +753,42 @@ void CMapHandler::terrainRect( int3 top_tile, ui8 anim, const std::vector< std::
|
|
|
}
|
|
|
// borders printed
|
|
|
|
|
|
-#ifdef MARK_GRID_POSITIONS
|
|
|
// print grid
|
|
|
- // TODO: This option should be activated by the console.
|
|
|
- srx = srx_init;
|
|
|
-
|
|
|
- for (int bx = 0; bx < dx; bx++, srx+=32)
|
|
|
+ if (settings["session"]["showGrid"].Bool())
|
|
|
{
|
|
|
- sry = sry_init;
|
|
|
+ srx = srx_init;
|
|
|
|
|
|
- for (int by = 0; by<dy; by++, sry+=32)
|
|
|
+ for (int bx = 0; bx < dx; bx++, srx+=32)
|
|
|
{
|
|
|
- SDL_Rect sr;
|
|
|
+ sry = sry_init;
|
|
|
|
|
|
- sr.x=srx;
|
|
|
- sr.y=sry;
|
|
|
- sr.h=sr.w=32;
|
|
|
-
|
|
|
- const int3 color(0x555555, 0x555555, 0x555555);
|
|
|
-
|
|
|
- if (sr.y >= extRect->y &&
|
|
|
- sr.y < extRect->y+extRect->h)
|
|
|
- for(int i=0;i<sr.w;i++)
|
|
|
- if (sr.x+i >= extRect->x &&
|
|
|
- sr.x+i < extRect->x+extRect->w)
|
|
|
- CSDL_Ext::SDL_PutPixelWithoutRefresh(extSurf,sr.x+i,sr.y,color.x,color.y,color.z);
|
|
|
-
|
|
|
- if (sr.x >= extRect->x &&
|
|
|
- sr.x < extRect->x+extRect->w)
|
|
|
- for(int i=0; i<sr.h;i++)
|
|
|
- if (sr.y+i >= extRect->y &&
|
|
|
- sr.y+i < extRect->y+extRect->h)
|
|
|
- CSDL_Ext::SDL_PutPixelWithoutRefresh(extSurf,sr.x,sr.y+i,color.x,color.y,color.z);
|
|
|
+ for (int by = 0; by<dy; by++, sry+=32)
|
|
|
+ {
|
|
|
+ SDL_Rect sr;
|
|
|
+
|
|
|
+ sr.x=srx;
|
|
|
+ sr.y=sry;
|
|
|
+ sr.h=sr.w=32;
|
|
|
+
|
|
|
+ const int3 color(0x555555, 0x555555, 0x555555);
|
|
|
+
|
|
|
+ if (sr.y >= extRect->y &&
|
|
|
+ sr.y < extRect->y+extRect->h)
|
|
|
+ for(int i=0;i<sr.w;i++)
|
|
|
+ if (sr.x+i >= extRect->x &&
|
|
|
+ sr.x+i < extRect->x+extRect->w)
|
|
|
+ CSDL_Ext::SDL_PutPixelWithoutRefresh(extSurf,sr.x+i,sr.y,color.x,color.y,color.z);
|
|
|
+
|
|
|
+ if (sr.x >= extRect->x &&
|
|
|
+ sr.x < extRect->x+extRect->w)
|
|
|
+ for(int i=0; i<sr.h;i++)
|
|
|
+ if (sr.y+i >= extRect->y &&
|
|
|
+ sr.y+i < extRect->y+extRect->h)
|
|
|
+ CSDL_Ext::SDL_PutPixelWithoutRefresh(extSurf,sr.x,sr.y+i,color.x,color.y,color.z);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // grid
|
|
|
-#endif
|
|
|
+ // grid
|
|
|
|
|
|
//applying sepia / gray effect
|
|
|
if(puzzleMode)
|
|
@@ -803,27 +802,45 @@ void CMapHandler::terrainRect( int3 top_tile, ui8 anim, const std::vector< std::
|
|
|
|
|
|
std::pair<SDL_Surface *, bool> CMapHandler::getVisBitmap( const int3 & pos, const std::vector< std::vector< std::vector<ui8> > > & visibilityMap ) const
|
|
|
{
|
|
|
- static const int visBitmaps[256] = {-1, 34, -1, 4, 22, 22, 4, 4, 36, 36, 38, 38, 47, 47, 38, 38, 3, 25, 12, 12, 3, 25, 12, 12,
|
|
|
- 9, 9, 6, 6, 9, 9, 6, 6, 35, 34, 4, 4, 22, 22, 4, 4, 36, 36, 38, 38, 47, 47, 38, 38, 26, 49, 28, 28, 26, 49, 28,
|
|
|
- 28, 9, 9, 6, 6, 9, 9, 6, 6, -3, 0, -3, 4, 0, 0, 4, 4, 37, 37, 7, 7, 50, 50, 7, 7, 13, 27, 44, 44, 13, 27, 44,
|
|
|
- 44, 8,8, 10, 10, 8, 8, 10, 10, 0, 0, 4, 4, 0, 0, 4, 4, 37, 37, 7, 7, 50, 50, 7, 7, 13, 27, 44, 44, 13, 27, 44,
|
|
|
- 44, 8, 8, 10, 10, 8, 8, 10, 10, 15, 15, 4, 4, 22, 22, 4, 4, 46, 46, 51, 51, 32, 32, 51, 51, 2, 25, 12, 12, 2,
|
|
|
- 25, 12, 12, 9, 9, 6, 6, 9, 9, 6, 6, 15, 15, 4, 4, 22, 22, 4, 4, 46, 46, 51, 51, 32, 32, 51, 51, 26, 49, 28, 28,
|
|
|
- 26, 49, 28, 28, 9, 9, 6, 6, 9, 9, 6, 6, 0, 0, 4, 4, 0, 0, 4, 4, 37, 37, 7, 7, 50, 50, 7, 7, 13, 27, 44, 44, 13,
|
|
|
- 27, 44, 44, 8, 8, 10, 10, 8, 8, 10, 10, 0, 0, 4, 4, 0, 0, 4, 4, 37, 37, 7, 7, 50, 50, 7, 7, 13, 27, 44, 44, 13,
|
|
|
- 27, 44, 44, 8, 8, 10, 10, 8, 8, 10, 10};
|
|
|
-
|
|
|
-
|
|
|
- //is tile visible. arrangement: (like num keyboard)
|
|
|
- bool d7 = (pos.x>0 && pos.y>0) ? visibilityMap[pos.x-1][pos.y-1][pos.z] : 0, //789
|
|
|
- d8 = (pos.y>0) ? visibilityMap[pos.x][pos.y-1][pos.z] : 0, //456
|
|
|
- d9 = (pos.y>0 && pos.x<sizes.x-1) ? visibilityMap[pos.x+1][pos.y-1][pos.z] : 0, //123
|
|
|
- d4 = (pos.x>0) ? visibilityMap[pos.x-1][pos.y][pos.z] : 0,
|
|
|
- //d5 = visibilityMap[pos.x][y][pos.z], //TODO use me - OMFG
|
|
|
- d6 = (pos.x<sizes.x-1) ? visibilityMap[pos.x+1][pos.y][pos.z] : 0,
|
|
|
- d1 = (pos.x>0 && pos.y<sizes.y-1) ? visibilityMap[pos.x-1][pos.y+1][pos.z] : 0,
|
|
|
- d2 = (pos.y<sizes.y-1) ? visibilityMap[pos.x][pos.y+1][pos.z] : 0,
|
|
|
- d3 = (pos.x<sizes.x-1 && pos.y<sizes.y-1) ? visibilityMap[pos.x+1][pos.y+1][pos.z] : 0;
|
|
|
+ //NOTE: some images have unused in VCMI pair (same blockmap but a bit different look)
|
|
|
+ // 0-1, 2-3, 4-5, 11-13, 13-14
|
|
|
+ static const int visBitmaps[256] = {
|
|
|
+ -1, 34, 4, 4, 22, 23, 4, 4, 36, 36, 38, 38, 47, 47, 38, 38, //16
|
|
|
+ 3, 25, 12, 12, 3, 25, 12, 12, 9, 9, 6, 6, 9, 9, 6, 6, //32
|
|
|
+ 35, 39, 48, 48, 41, 43, 48, 48, 36, 36, 38, 38, 47, 47, 38, 38, //48
|
|
|
+ 26, 49, 28, 28, 26, 49, 28, 28, 9, 9, 6, 6, 9, 9, 6, 6, //64
|
|
|
+ 0, 45, 29, 29, 24, 33, 29, 29, 37, 37, 7, 7, 50, 50, 7, 7, //80
|
|
|
+ 13, 27, 44, 44, 13, 27, 44, 44, 8, 8, 10, 10, 8, 8, 10, 10, //96
|
|
|
+ 0, 45, 29, 29, 24, 33, 29, 29, 37, 37, 7, 7, 50, 50, 7, 7, //112
|
|
|
+ 13, 27, 44, 44, 13, 27, 44, 44, 8, 8, 10, 10, 8, 8, 10, 10, //128
|
|
|
+ 15, 17, 30, 30, 16, 19, 30, 30, 46, 46, 40, 40, 32, 32, 40, 40, //144
|
|
|
+ 2, 25, 12, 12, 2, 25, 12, 12, 9, 9, 6, 6, 9, 9, 6, 6, //160
|
|
|
+ 18, 42, 31, 31, 20, 21, 31, 31, 46, 46, 40, 40, 32, 32, 40, 40, //176
|
|
|
+ 26, 49, 28, 28, 26, 49, 28, 28, 9, 9, 6, 6, 9, 9, 6, 6, //192
|
|
|
+ 0, 45, 29, 29, 24, 33, 29, 29, 37, 37, 7, 7, 50, 50, 7, 7, //208
|
|
|
+ 13, 27, 44, 44, 13, 27, 44, 44, 8, 8, 10, 10, 8, 8, 10, 10, //224
|
|
|
+ 0, 45, 29, 29, 24, 33, 29, 29, 37, 37, 7, 7, 50, 50, 7, 7, //240
|
|
|
+ 13, 27, 44, 44, 13, 27, 44, 44, 8, 8, 10, 10, 8, 8, 10, 10 //256
|
|
|
+ };
|
|
|
+
|
|
|
+ auto getTile = [&](int dx, int dy)
|
|
|
+ {
|
|
|
+ if ( dx + pos.x < 0 || dx + pos.x >= sizes.x
|
|
|
+ || dy + pos.y < 0 || dy + pos.y >= sizes.y)
|
|
|
+ return false;
|
|
|
+ return bool(visibilityMap[dx+pos.x][dy+pos.y][pos.z]);
|
|
|
+ };
|
|
|
+
|
|
|
+ //is tile visible. arrangement: (like num keyboard)
|
|
|
+ bool d7 = getTile(-1, -1), //789
|
|
|
+ d8 = getTile( 0, -1), //456
|
|
|
+ d9 = getTile(+1, -1), //123
|
|
|
+ d4 = getTile(-1, 0),
|
|
|
+
|
|
|
+ d6 = getTile(+1, 0),
|
|
|
+ d1 = getTile(-1, +1),
|
|
|
+ d2 = getTile( 0, +1),
|
|
|
+ d3 = getTile(+1, +1);
|
|
|
|
|
|
int retBitmapID = visBitmaps[d1 + d2 * 2 + d3 * 4 + d4 * 8 + d6 * 16 + d7 * 32 + d8 * 64 + d9 * 128]; // >=0 -> partial hide, <0 - full hide
|
|
|
if (retBitmapID < 0)
|