Browse Source

Migrate `CelClippedDrawLight` to `CelClippedDrawLightTo`

pull/1116/head
Gleb Mazovetskiy 5 years ago committed by Anders Jenbo
parent
commit
14ae63d37d
  1. 8
      Source/engine.h
  2. 32
      Source/scrollrt.cpp

8
Source/engine.h

@ -133,10 +133,6 @@ inline void CelClippedDraw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
* @param nWidth Width of sprite
*/
void CelDrawLightTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, BYTE *tbl);
inline void CelDrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, BYTE *tbl)
{
CelDrawLightTo(GlobalBackBuffer(), sx, sy, pCelBuff, nCel, nWidth, tbl);
}
/**
* @brief Same as CelDrawLightTo but with the option to skip parts of the top and bottom of the sprite
@ -148,10 +144,6 @@ inline void CelDrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, B
* @param nWidth Width of sprite
*/
void CelClippedDrawLightTo(CelOutputBuffer out, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth);
inline void CelClippedDrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
{
return CelClippedDrawLightTo(GlobalBackBuffer(), sx, sy, pCelBuff, nCel, nWidth);
}
/**
* @brief Same as CelBlitLightTransSafeTo

32
Source/scrollrt.cpp

@ -478,13 +478,14 @@ void DrawDeadPlayer(int x, int y, int sx, int sy)
/**
* @brief Render an object sprite
* @param out Output buffer
* @param x dPiece coordinate
* @param y dPiece coordinate
* @param ox Back buffer coordinate
* @param oy Back buffer coordinate
* @param ox Output buffer coordinate
* @param oy Output buffer coordinate
* @param pre Is the sprite in the background
*/
static void DrawObject(int x, int y, int ox, int oy, BOOL pre)
static void DrawObject(CelOutputBuffer out, int x, int y, int ox, int oy, BOOL pre)
{
int sx, sy, xx, yy, nCel, frames;
char bv;
@ -525,11 +526,11 @@ static void DrawObject(int x, int y, int ox, int oy, BOOL pre)
}
if (bv == pcursobj)
CelBlitOutline(194, sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth);
CelBlitOutlineTo(out, 194, sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth);
if (object[bv]._oLight) {
CelClippedDrawLight(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth);
CelClippedDrawLightTo(out, sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth);
} else {
CelClippedDraw(sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth);
CelClippedDrawTo(out, sx, sy, object[bv]._oAnimData, object[bv]._oAnimFrame, object[bv]._oAnimWidth);
}
}
@ -595,13 +596,14 @@ static void drawFloor(int x, int y, int sx, int sy)
/**
* @brief Draw item for a given tile
* @param out Output buffer
* @param y dPiece coordinate
* @param x dPiece coordinate
* @param sx Back buffer coordinate
* @param sy Back buffer coordinate
* @param sx Output buffer coordinate
* @param sy Output buffer coordinate
* @param pre Is the sprite in the background
*/
static void DrawItem(int x, int y, int sx, int sy, BOOL pre)
static void DrawItem(CelOutputBuffer out, int x, int y, int sx, int sy, BOOL pre)
{
int nCel;
char bItem = dItem[x][y];
@ -633,9 +635,9 @@ static void DrawItem(int x, int y, int sx, int sy, BOOL pre)
int px = sx - pItem->_iAnimWidth2;
if (bItem - 1 == pcursitem || AutoMapShowItems) {
CelBlitOutline(181, px, sy, pCelBuff, nCel, pItem->_iAnimWidth);
CelBlitOutlineTo(out, 181, px, sy, pCelBuff, nCel, pItem->_iAnimWidth);
}
CelClippedDrawLight(px, sy, pCelBuff, nCel, pItem->_iAnimWidth);
CelClippedDrawLightTo(out, px, sy, pCelBuff, nCel, pItem->_iAnimWidth);
}
/**
@ -781,8 +783,8 @@ static void scrollrt_draw_dungeon(CelOutputBuffer out, int sx, int sy, int dx, i
}
} while (0);
}
DrawObject(sx, sy, dx, dy, 1);
DrawItem(sx, sy, dx, dy, 1);
DrawObject(out, sx, sy, dx, dy, 1);
DrawItem(out, sx, sy, dx, dy, 1);
if (bFlag & BFLAG_PLAYERLR) {
assert((DWORD)(sy - 1) < MAXDUNY);
DrawPlayerHelper(sx, sy - 1, dx, dy);
@ -800,8 +802,8 @@ static void scrollrt_draw_dungeon(CelOutputBuffer out, int sx, int sy, int dx, i
DrawMonsterHelper(sx, sy, 0, dx, dy);
}
DrawMissile(sx, sy, dx, dy, FALSE);
DrawObject(sx, sy, dx, dy, 0);
DrawItem(sx, sy, dx, dy, 0);
DrawObject(out, sx, sy, dx, dy, 0);
DrawItem(out, sx, sy, dx, dy, 0);
if (leveltype != DTYPE_TOWN) {
bArch = dSpecial[sx][sy];

Loading…
Cancel
Save