Browse Source

Migrate `Cl2DrawOutline` to accept a buffer

pull/1116/head
Gleb Mazovetskiy 5 years ago committed by Anders Jenbo
parent
commit
ba6a78ebc8
  1. 15
      Source/engine.cpp
  2. 13
      Source/engine.h
  3. 4
      Source/scrollrt.cpp

15
Source/engine.cpp

@ -1070,27 +1070,18 @@ void Cl2Draw(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int
Cl2BlitSafe(out, sx, sy, pRLEBytes, nDataSize, nWidth);
}
/**
* @brief Blit a solid colder shape one pixel larger then the given sprite shape, to the back buffer at the given coordianates
* @param col Color index from current palette
* @param sx Back buffer coordinate
* @param sy Back buffer coordinate
* @param pCelBuff CL2 buffer
* @param nCel CL2 frame number
* @param nWidth Width of sprite
*/
void Cl2DrawOutline(BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
void Cl2DrawOutline(CelOutputBuffer out, BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
{
int nDataSize;
BYTE *pRLEBytes;
assert(gpBuffer != NULL);
assert(out.begin != NULL);
assert(pCelBuff != NULL);
assert(nCel > 0);
pRLEBytes = CelGetFrameClipped(pCelBuff, nCel, &nDataSize);
CelOutputBuffer out = GlobalBackBuffer();
out.end -= out.line_width;
Cl2BlitOutlineSafe(out, sx, sy, pRLEBytes, nDataSize, nWidth, col);
}

13
Source/engine.h

@ -254,18 +254,19 @@ void SetPixel(CelOutputBuffer out, int sx, int sy, BYTE col);
void Cl2Draw(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth);
/**
* @brief Blit a solid colder shape one pixel larger then the given sprite shape, to the back buffer at the given coordianates
* @brief Blit a solid colder shape one pixel larger then the given sprite shape, to the given buffer at the given coordianates
* @param col Color index from current palette
* @param sx Back buffer coordinate
* @param sy Back buffer coordinate
* @param out Output buffer
* @param sx Output buffer coordinate
* @param sy Output buffer coordinate
* @param pCelBuff CL2 buffer
* @param nCel CL2 frame number
* @param nWidth Width of sprite
*/
void Cl2DrawOutline(BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth);
void Cl2DrawOutline(CelOutputBuffer out, BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth);
/**
* @brief Blit CL2 sprite, and apply a given lighting, to the back buffer at the given coordianates
* @brief Blit CL2 sprite, and apply a given lighting, to the given buffer at the given coordianates
* @param out Output buffer
* @param sx Output buffer coordinate
* @param sy Output buffer coordinate
@ -277,7 +278,7 @@ void Cl2DrawOutline(BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid
void Cl2DrawLightTbl(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, char light);
/**
* @brief Blit CL2 sprite, and apply lighting, to the back buffer at the given coordinates
* @brief Blit CL2 sprite, and apply lighting, to the given buffer at the given coordinates
* @param out Output buffer
* @param sx Output buffer coordinate
* @param sy Output buffer coordinate

4
Source/scrollrt.cpp

@ -431,7 +431,7 @@ static void DrawPlayer(CelOutputBuffer out, int pnum, int x, int y, int px, int
}
if (pnum == pcursplr)
Cl2DrawOutline(165, px, py, pCelBuff, nCel, nWidth);
Cl2DrawOutline(out, 165, px, py, pCelBuff, nCel, nWidth);
if (pnum == myplr) {
Cl2Draw(out, px, py, pCelBuff, nCel, nWidth);
@ -695,7 +695,7 @@ static void DrawMonsterHelper(CelOutputBuffer out, int x, int y, int oy, int sx,
px = sx + pMonster->_mxoff - pMonster->MType->width2;
py = sy + pMonster->_myoff;
if (mi == pcursmonst) {
Cl2DrawOutline(233, px, py, pMonster->_mAnimData, pMonster->_mAnimFrame, pMonster->MType->width);
Cl2DrawOutline(out, 233, px, py, pMonster->_mAnimData, pMonster->_mAnimFrame, pMonster->MType->width);
}
DrawMonster(out, x, y, px, py, mi);
}

Loading…
Cancel
Save