mirror of
https://github.com/spiffcode/hostile-takeover.git
synced 2026-04-25 04:05:08 -06:00
Read RGBA mini-map data
This commit is contained in:
parent
00a92e2f6c
commit
8d2da3075c
@ -2283,12 +2283,15 @@ MiniMapControl::MiniMapControl()
|
||||
m_xOff = 0;
|
||||
m_yOff = 0;
|
||||
m_tInvalidateLast = 0;
|
||||
m_pbTileData = NULL;
|
||||
}
|
||||
|
||||
MiniMapControl::~MiniMapControl()
|
||||
{
|
||||
gpmm = NULL;
|
||||
delete m_pbm;
|
||||
delete[] m_pbTileData;
|
||||
m_pbTileData = NULL;
|
||||
}
|
||||
|
||||
int MiniMapControl::CalcWidth()
|
||||
@ -2393,16 +2396,23 @@ bool MiniMapControl::Init(Form *pfrm, IniReader *pini, FindProp *pfind)
|
||||
|
||||
TileMap *ptmap = gsim.GetLevel()->GetTileMap();
|
||||
MiniTileSetHeader *pmtseth = ptmap->GetMiniTileSetHeader(m_nScale);
|
||||
m_pbTileData = (byte *)(pmtseth + 1);
|
||||
m_pwTileMap = ptmap->m_pwMapData;
|
||||
m_pbFogMap = gsim.GetLevel()->GetFogMap()->GetMapPtr();
|
||||
ggobm.GetMapSize(&m_ctx, &m_cty);
|
||||
m_cbRowBytes = m_pbm->GetRowBytes();
|
||||
m_clrBlack = (byte)GetColor(kiclrBlack);
|
||||
m_clrWhite = (byte)GetColor(kiclrWhite);
|
||||
m_clrGalaxite = (byte)GetColor(kiclrGalaxite);
|
||||
m_cbRowBytes = m_ctx * m_nScale;
|
||||
m_clrBlack = GetColor(kiclrBlack);
|
||||
m_clrWhite = GetColor(kiclrWhite);
|
||||
m_clrGalaxite = GetColor(kiclrGalaxite);
|
||||
for (Side sideT = ksideNeutral; sideT < kcSides; sideT++)
|
||||
m_aclrSide[sideT] = (byte)GetSideColor(sideT);
|
||||
m_aclrSide[sideT] = GetSideColor(sideT);
|
||||
|
||||
// Cache the tile data
|
||||
|
||||
dword *pbtd = (dword *)(pmtseth + 1);
|
||||
m_pbTileData = new dword[pmtseth->cTiles];
|
||||
for (int i = 0; i < pmtseth->cTiles; i++, pbtd++) {
|
||||
m_pbTileData[i] = BigDword(*pbtd);
|
||||
}
|
||||
|
||||
// Calc powered radar flag
|
||||
|
||||
@ -2694,7 +2704,7 @@ void MiniMapControl::RedrawTRect(TRect *ptrc)
|
||||
|
||||
// Redraw this rect
|
||||
|
||||
byte *pbDst = m_pbm->GetBits() + (long)ptrc->top * m_cbRowBytes * m_nScale +
|
||||
dword *pbDst = m_pbm->GetBits() + (long)ptrc->top * m_cbRowBytes * m_nScale +
|
||||
ptrc->left * m_nScale + (long)m_yOff * m_cbRowBytes + m_xOff;
|
||||
int cbDstReturn = m_cbRowBytes - ptrc->Width() * m_nScale;
|
||||
long offset = (long)ptrc->top * m_ctx + ptrc->left;
|
||||
@ -2774,7 +2784,7 @@ void MiniMapControl::RedrawTRect(TRect *ptrc)
|
||||
if (punt != NULL) {
|
||||
dword wf = punt->GetFlags();
|
||||
if ((wf & (kfGobMobileUnit | kfGobActive)) != (kfGobMobileUnit)) {
|
||||
byte clr;
|
||||
dword clr;
|
||||
if (wf & kfGobSelected) {
|
||||
clr = m_clrWhite;
|
||||
} else {
|
||||
@ -2802,11 +2812,11 @@ void MiniMapControl::RedrawTRect(TRect *ptrc)
|
||||
// Tile
|
||||
|
||||
int nTile = (BigWord(*pwTileMap) & 0x7fc);
|
||||
byte *pbSrc = &m_pbTileData[nTile];
|
||||
*pbDst++ = *pbSrc++;
|
||||
*pbDst++ = *pbSrc++;
|
||||
*(pbDst + m_cbRowBytes - 2) = *pbSrc++;
|
||||
*(pbDst + m_cbRowBytes - 1) = *pbSrc++;
|
||||
dword pbSrc = m_pbTileData[nTile];
|
||||
*pbDst++ = pbSrc;
|
||||
*pbDst++ = pbSrc;
|
||||
*(pbDst + m_cbRowBytes - 2) = pbSrc;
|
||||
*(pbDst + m_cbRowBytes - 1) = pbSrc;
|
||||
continue;
|
||||
}
|
||||
pwTileMap += ctReturn;
|
||||
|
||||
@ -354,7 +354,6 @@ void FogMap::Draw(DibBitmap *pbm, int xMap, int yMap, UpdateMap *pupd)
|
||||
int cfInvalidNextScan = sizMap.cx - ctx;
|
||||
Assert(sizMap.cx >= ctx && sizMap.cy >= cty);
|
||||
|
||||
byte *pbDib = pbm->GetBits();
|
||||
byte *pbMapT = &m_pbMap[ty * m_ctxMap + tx];
|
||||
int cbNextScan = m_ctxMap - ctx;
|
||||
int xTile = tx * gcxTile - xMap;
|
||||
@ -362,7 +361,7 @@ void FogMap::Draw(DibBitmap *pbm, int xMap, int yMap, UpdateMap *pupd)
|
||||
int xTileStart = xTile;
|
||||
for (int tyT = ty; tyT < ty + cty; tyT++) {
|
||||
int cEmpty = 0;
|
||||
int xStart;
|
||||
int xStart = 0;
|
||||
for (int txT = tx; txT < tx + ctx; txT++) {
|
||||
byte bFog = *pbMapT++ & kbfFogMask;
|
||||
if (*pfInvalid++ == false)
|
||||
@ -439,7 +438,6 @@ void FogMap::DrawGalaxite(DibBitmap *pbm, int xMap, int yMap, UpdateMap *pupd, b
|
||||
int cty = (siz.cy + (gcyTile - 1)) / gcyTile + 1;
|
||||
if (ty + cty > m_ctyMap)
|
||||
cty = m_ctyMap - ty;
|
||||
byte *pbDib = pbm->GetBits();
|
||||
byte *pbMapT = &m_pbMap[ty * m_ctxMap + tx];
|
||||
int cbNextScan = m_ctxMap - ctx;
|
||||
int xTile = tx * gcxTile - xMap;
|
||||
|
||||
10
game/ht.h
10
game/ht.h
@ -3451,14 +3451,14 @@ private:
|
||||
int m_yOff;
|
||||
TCoord m_ctx;
|
||||
TCoord m_cty;
|
||||
byte *m_pbTileData;
|
||||
dword *m_pbTileData;
|
||||
word *m_pwTileMap;
|
||||
int m_cbRowBytes;
|
||||
byte *m_pbFogMap;
|
||||
byte m_clrWhite;
|
||||
byte m_clrBlack;
|
||||
byte m_clrGalaxite;
|
||||
byte m_aclrSide[kcSides];
|
||||
Color m_clrWhite;
|
||||
Color m_clrBlack;
|
||||
Color m_clrGalaxite;
|
||||
Color m_aclrSide[kcSides];
|
||||
};
|
||||
|
||||
// Pip Meter Control
|
||||
|
||||
Loading…
Reference in New Issue
Block a user