Browse Source

Migrate `CelBlitOutline` to `CelBlitOutlineTo`

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

4
Source/engine.h

@ -252,10 +252,6 @@ inline void CelDrawLightRedSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nW
* @param nWidth Width of sprite
*/
void CelBlitOutlineTo(CelOutputBuffer out, BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth);
inline void CelBlitOutline(BYTE col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth)
{
return CelBlitOutlineTo(GlobalBackBuffer(), col, sx, sy, pCelBuff, nCel, nWidth);
}
/**
* @brief Set the value of a single pixel in the back buffer, checks bounds

34
Source/inv.cpp

@ -186,9 +186,9 @@ void DrawInv(CelOutputBuffer out)
color = ICOL_RED;
}
if (frame <= 179) {
CelBlitOutline(color, RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels, frame, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels, frame, frame_width);
} else {
CelBlitOutline(color, RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 133, 59 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
}
}
@ -222,9 +222,9 @@ void DrawInv(CelOutputBuffer out)
color = ICOL_RED;
}
if (frame <= 179) {
CelBlitOutline(color, RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels, frame, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels, frame, frame_width);
} else {
CelBlitOutline(color, RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 48, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
}
}
@ -258,9 +258,9 @@ void DrawInv(CelOutputBuffer out)
color = ICOL_RED;
}
if (frame <= 179) {
CelBlitOutline(color, RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels, frame, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels, frame, frame_width);
} else {
CelBlitOutline(color, RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 249, 205 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
}
}
@ -294,9 +294,9 @@ void DrawInv(CelOutputBuffer out)
color = ICOL_RED;
}
if (frame <= 179) {
CelBlitOutline(color, RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels, frame, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels, frame, frame_width);
} else {
CelBlitOutline(color, RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 205, 60 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
}
}
@ -333,9 +333,9 @@ void DrawInv(CelOutputBuffer out)
color = ICOL_RED;
}
if (frame <= 179) {
CelBlitOutline(color, screen_x, screen_y, pCursCels, frame, frame_width);
CelBlitOutlineTo(out, color, screen_x, screen_y, pCursCels, frame, frame_width);
} else {
CelBlitOutline(color, screen_x, screen_y, pCursCels2, frame - 179, frame_width);
CelBlitOutlineTo(out, color, screen_x, screen_y, pCursCels2, frame - 179, frame_width);
}
}
@ -391,9 +391,9 @@ void DrawInv(CelOutputBuffer out)
color = ICOL_RED;
}
if (frame <= 179) {
CelBlitOutline(color, screen_x, screen_y, pCursCels, frame, frame_width);
CelBlitOutlineTo(out, color, screen_x, screen_y, pCursCels, frame, frame_width);
} else {
CelBlitOutline(color, screen_x, screen_y, pCursCels2, frame - 179, frame_width);
CelBlitOutlineTo(out, color, screen_x, screen_y, pCursCels2, frame - 179, frame_width);
}
}
@ -427,9 +427,9 @@ void DrawInv(CelOutputBuffer out)
color = ICOL_RED;
}
if (frame <= 179) {
CelBlitOutline(color, RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels, frame, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels, frame, frame_width);
} else {
CelBlitOutline(color, RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
CelBlitOutlineTo(out, color, RIGHT_PANEL_X + 133, 160 + SCREEN_Y, pCursCels2, frame - 179, frame_width);
}
}
@ -477,13 +477,15 @@ void DrawInv(CelOutputBuffer out)
color = ICOL_RED;
}
if (frame <= 179) {
CelBlitOutline(
CelBlitOutlineTo(
out,
color,
InvRect[j + SLOTXY_INV_FIRST].X + RIGHT_PANEL_X,
InvRect[j + SLOTXY_INV_FIRST].Y + SCREEN_Y - 1,
pCursCels, frame, frame_width);
} else {
CelBlitOutline(
CelBlitOutlineTo(
out,
color,
InvRect[j + SLOTXY_INV_FIRST].X + RIGHT_PANEL_X,
InvRect[j + SLOTXY_INV_FIRST].Y + SCREEN_Y - 1,

15
Source/scrollrt.cpp

@ -139,9 +139,9 @@ static void scrollrt_draw_cursor_back_buffer()
}
/**
* @brief Draw the cursor on the back buffer
* @brief Draw the cursor on the given buffer
*/
static void scrollrt_draw_cursor_item()
static void scrollrt_draw_cursor_item(CelOutputBuffer out)
{
int i, mx, my;
BYTE *src, *dst;
@ -200,6 +200,7 @@ static void scrollrt_draw_cursor_item()
mx++;
my++;
gpBufEnd = &gpBuffer[BUFFER_WIDTH * (gnScreenHeight + SCREEN_Y) - cursW - 2];
out.end = gpBufEnd;
if (pcurs >= CURSOR_FIRSTITEM) {
col = PAL16_YELLOW + 5;
@ -210,14 +211,14 @@ static void scrollrt_draw_cursor_item()
col = PAL16_RED + 5;
}
if (pcurs <= 179) {
CelBlitOutline(col, mx + SCREEN_X, my + cursH + SCREEN_Y - 1, pCursCels, pcurs, cursW);
CelBlitOutlineTo(out, col, mx + SCREEN_X, my + cursH + SCREEN_Y - 1, pCursCels, pcurs, cursW);
if (col != PAL16_RED + 5) {
CelClippedDrawSafe(mx + SCREEN_X, my + cursH + SCREEN_Y - 1, pCursCels, pcurs, cursW);
} else {
CelDrawLightRedSafe(mx + SCREEN_X, my + cursH + SCREEN_Y - 1, pCursCels, pcurs, cursW, 1);
}
} else {
CelBlitOutline(col, mx + SCREEN_X, my + cursH + SCREEN_Y - 1, pCursCels2, pcurs - 179, cursW);
CelBlitOutlineTo(out, col, mx + SCREEN_X, my + cursH + SCREEN_Y - 1, pCursCels2, pcurs - 179, cursW);
if (col != PAL16_RED + 5) {
CelClippedDrawSafe(mx + SCREEN_X, my + cursH + SCREEN_Y - 1, pCursCels2, pcurs - 179, cursW);
} else {
@ -660,7 +661,7 @@ static void DrawMonsterHelper(CelOutputBuffer out, int x, int y, int oy, int sx,
if (leveltype == DTYPE_TOWN) {
px = sx - towner[mi]._tAnimWidth2;
if (mi == pcursmonst) {
CelBlitOutline(166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth);
CelBlitOutlineTo(out, 166, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth);
}
assert(towner[mi]._tAnimData);
CelClippedDrawTo(out, px, sy, towner[mi]._tAnimData, towner[mi]._tAnimFrame, towner[mi]._tAnimWidth);
@ -1506,7 +1507,7 @@ void scrollrt_draw_game_screen(BOOL draw_cursor)
if (draw_cursor) {
lock_buf(0);
scrollrt_draw_cursor_item();
scrollrt_draw_cursor_item(GlobalBackBuffer());
unlock_buf(0);
}
@ -1573,7 +1574,7 @@ void DrawAndBlit()
hgt = gnScreenHeight;
}
DrawXPBar();
scrollrt_draw_cursor_item();
scrollrt_draw_cursor_item(out);
DrawFPS(out);

Loading…
Cancel
Save