Show walls on mini-map

This commit is contained in:
Nathan Fulton 2017-04-29 22:23:13 -04:00
parent 8d2da3075c
commit 278aecfb70
2 changed files with 28 additions and 2 deletions

View File

@ -2398,11 +2398,13 @@ bool MiniMapControl::Init(Form *pfrm, IniReader *pini, FindProp *pfind)
MiniTileSetHeader *pmtseth = ptmap->GetMiniTileSetHeader(m_nScale);
m_pwTileMap = ptmap->m_pwMapData;
m_pbFogMap = gsim.GetLevel()->GetFogMap()->GetMapPtr();
m_pbTrMap = gsim.GetLevel()->GetTerrainMap()->GetMapPtr();
ggobm.GetMapSize(&m_ctx, &m_cty);
m_cbRowBytes = m_ctx * m_nScale;
m_clrBlack = GetColor(kiclrBlack);
m_clrWhite = GetColor(kiclrWhite);
m_clrGalaxite = GetColor(kiclrGalaxite);
m_clrWall = GetColor(kiclrSideNeutral);
for (Side sideT = ksideNeutral; sideT < kcSides; sideT++)
m_aclrSide[sideT] = GetSideColor(sideT);
@ -2710,11 +2712,14 @@ void MiniMapControl::RedrawTRect(TRect *ptrc)
long offset = (long)ptrc->top * m_ctx + ptrc->left;
byte *pbFogMap = m_pbFogMap + offset;
word *pwTileMap = m_pwTileMap + offset;
byte *pbTrMap = m_pbTrMap + offset;
int ctReturn = m_ctx - ptrc->Width();
#define HasWall(btt) ((btt) == kttWall)
if (m_nScale == 1) {
for (TCoord ty = ptrc->top; ty < ptrc->bottom; ty++) {
for (TCoord tx = ptrc->left; tx < ptrc->right; tx++, pbFogMap++, pwTileMap++) {
for (TCoord tx = ptrc->left; tx < ptrc->right; tx++, pbFogMap++, pwTileMap++, pbTrMap++) {
// Fogged?
if (IsFogOpaque(*pbFogMap)) {
@ -2744,6 +2749,13 @@ void MiniMapControl::RedrawTRect(TRect *ptrc)
}
}
// Wall?
if (HasWall(*pbTrMap)) {
*pbDst++ = m_clrWall;
continue;
}
// Galaxite?
if (HasGalaxite(*pbFogMap)) {
@ -2759,11 +2771,12 @@ void MiniMapControl::RedrawTRect(TRect *ptrc)
}
pwTileMap += ctReturn;
pbFogMap += ctReturn;
pbTrMap += ctReturn;
pbDst += cbDstReturn;
}
} else if (m_nScale == 2) {
for (TCoord ty = ptrc->top; ty < ptrc->bottom; ty++) {
for (TCoord tx = ptrc->left; tx < ptrc->right; tx++, pbFogMap++, pwTileMap++) {
for (TCoord tx = ptrc->left; tx < ptrc->right; tx++, pbFogMap++, pwTileMap++, pbTrMap++) {
// Fogged?
if (IsFogOpaque(*pbFogMap)) {
@ -2799,6 +2812,16 @@ void MiniMapControl::RedrawTRect(TRect *ptrc)
}
}
// Wall?
if (HasWall(*pbTrMap)) {
*pbDst++ = m_clrWall;
*pbDst++ = m_clrWall;
*(pbDst + m_cbRowBytes - 2) = m_clrWall;
*(pbDst + m_cbRowBytes - 1) = m_clrWall;
continue;
}
// Galaxite?
if (HasGalaxite(*pbFogMap)) {
@ -2821,6 +2844,7 @@ void MiniMapControl::RedrawTRect(TRect *ptrc)
}
pwTileMap += ctReturn;
pbFogMap += ctReturn;
pbTrMap += ctReturn;
pbDst += cbDstReturn + m_cbRowBytes;
}
}

View File

@ -3455,9 +3455,11 @@ private:
word *m_pwTileMap;
int m_cbRowBytes;
byte *m_pbFogMap;
byte *m_pbTrMap;
Color m_clrWhite;
Color m_clrBlack;
Color m_clrGalaxite;
Color m_clrWall;
Color m_aclrSide[kcSides];
};