Browse Source

Merge remote-tracking branch 'refs/remotes/devilution/master'

pull/393/head
Anders Jenbo 6 years ago
parent
commit
d46ae517d0
  1. 42
      Source/control.cpp
  2. 2
      Source/gmenu.cpp
  3. 6
      Source/minitext.cpp
  4. 16
      Source/scrollrt.cpp
  5. 14
      Source/stores.cpp
  6. 2
      defs.h

42
Source/control.cpp

@ -429,6 +429,13 @@ void ToggleSpell(int slot)
}
}
/**
* @brief Print letter to the backbuffer
* @param sx Backbuffer offset
* @param sy Backbuffer offset
* @param nCel Number of letter in Windows-1252
* @param col text_color color value
*/
void CPrintString(int sx, int sy, int nCel, char col)
{
/// ASSERT: assert(gpBuffer);
@ -497,7 +504,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy)
/// ASSERT: assert(gpBuffer);
nSrcOff = x + PANEL_WIDTH * y;
nDstOff = sx + BUFFER_WIDTH * sy + PANEL_LEFT;
nDstOff = sx + BUFFER_WIDTH * sy;
int hgt;
BYTE *src, *dst;
@ -545,7 +552,7 @@ void SetFlaskHeight(BYTE *pCelBuff, int min, int max, int sx, int sy)
* into the target buffer.
* @param pCelBuff The flask cel buffer.
* @param w Width of the cel.
* @param nSrcOffset Offset of the source buffer from where the bytes will start to be copied from.
* @param nSrcOff Offset of the source buffer from where the bytes will start to be copied from.
* @param pBuff Target buffer.
* @param nDstOff Offset of the target buffer where the bytes will start to be copied to.
* @param h How many lines of the source buffer that will be copied.
@ -584,9 +591,9 @@ void DrawLifeFlask()
filled = 11;
filled += 2;
DrawFlask(pLifeBuff, 88, 277, gpBuffer, BUFFER_WIDTH * 499 + 173, filled);
DrawFlask(pLifeBuff, 88, 277, gpBuffer, SCREENXY(PANEL_LEFT + 109, PANEL_TOP - 13), filled);
if (filled != 13)
DrawFlask(pBtmBuff, PANEL_WIDTH, PANEL_WIDTH * filled + 2029, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173, 13 - filled);
DrawFlask(pBtmBuff, PANEL_WIDTH, PANEL_WIDTH * (filled + 3) + 109, gpBuffer, SCREENXY(PANEL_LEFT + 109, PANEL_TOP - 13 + filled), 13 - filled);
}
/**
@ -619,9 +626,9 @@ void DrawManaFlask()
filled = 11;
filled += 2;
DrawFlask(pManaBuff, 88, 277, gpBuffer, BUFFER_WIDTH * 499 + 173 + 366, filled);
DrawFlask(pManaBuff, 88, 277, gpBuffer, SCREENXY(PANEL_LEFT + 475, PANEL_TOP - 13), filled);
if (filled != 13)
DrawFlask(pBtmBuff, PANEL_WIDTH, PANEL_WIDTH * filled + 2029 + 366, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173 + 366, 13 - filled);
DrawFlask(pBtmBuff, PANEL_WIDTH, PANEL_WIDTH * (filled + 3) + 475, gpBuffer, SCREENXY(PANEL_LEFT + 475, PANEL_TOP - 13 + filled), 13 - filled);
}
void control_update_life_mana()
@ -772,9 +779,9 @@ void DrawCtrlPan()
for (i = 0; i < 6; i++) {
if (!panbtn[i])
DrawPanelBox(PanBtnPos[i][0] - PANEL_LEFT, PanBtnPos[i][1] - (PANEL_TOP - 16), 71, 20, PanBtnPos[i][0] + PANEL_X, PanBtnPos[i][1] + SCREEN_Y);
DrawPanelBox(PanBtnPos[i][0] - PANEL_LEFT, PanBtnPos[i][1] - (PANEL_TOP - 16), 71, 20, PanBtnPos[i][0] + SCREEN_X, PanBtnPos[i][1] + SCREEN_Y);
else
CelDraw(PanBtnPos[i][0] + PANEL_X, PanBtnPos[i][1] + (PANEL_Y - 334), pPanelButtons, i + 1, 71);
CelDraw(PanBtnPos[i][0] + SCREEN_X, PanBtnPos[i][1] + (PANEL_Y - 334), pPanelButtons, i + 1, 71);
}
if (numpanbtns == 8) {
CelDraw(87 + PANEL_X, 122 + PANEL_Y, pMultiBtns, panbtn[6] + 1, 33);
@ -1453,7 +1460,16 @@ void DrawChr()
}
void MY_PlrStringXY(int x, int y, int width, char *pszStr, char col, int base)
/**
* @brief Render text string to back buffer
* @param x Screen coordinate
* @param y Screen coordinate
* @param endX End of line in screen coordinate
* @param pszStr String to print, in Windows-1252 encoding
* @param col text_color color value
* @param base Letter spacing
*/
void MY_PlrStringXY(int x, int y, int endX, char *pszStr, char col, int base)
{
BYTE c;
char *tmp;
@ -1461,7 +1477,7 @@ void MY_PlrStringXY(int x, int y, int width, char *pszStr, char col, int base)
sx = x + SCREEN_X;
sy = y + SCREEN_Y;
widthOffset = width - x + 1;
widthOffset = endX - x + 1;
line = 0;
screen_x = 0;
tmp = pszStr;
@ -1503,7 +1519,7 @@ void DrawLevelUpIcon()
if (!stextflag) {
nCel = lvlbtndown ? 3 : 2;
ADD_PlrStringXY(0, 303, 120, "Level Up", COL_WHITE);
ADD_PlrStringXY(PANEL_LEFT + 0, PANEL_TOP - 49, PANEL_LEFT + 120, "Level Up", COL_WHITE);
CelDraw(40 + PANEL_X, -17 + PANEL_Y, pChrButtons, nCel, 41);
}
}
@ -1647,7 +1663,7 @@ void RedBack()
if (leveltype != DTYPE_HELL) {
dst = &gpBuffer[SCREENXY(0, 0)];
tbl = &pLightTbl[idx];
for (h = PANEL_TOP; h; h--, dst += BUFFER_WIDTH - SCREEN_WIDTH) {
for (h = VIEWPORT_HEIGHT; h; h--, dst += BUFFER_WIDTH - SCREEN_WIDTH) {
for (w = SCREEN_WIDTH; w; w--) {
*dst = tbl[*dst];
dst++;
@ -1656,7 +1672,7 @@ void RedBack()
} else {
dst = &gpBuffer[SCREENXY(0, 0)];
tbl = &pLightTbl[idx];
for (h = PANEL_TOP; h; h--, dst += BUFFER_WIDTH - SCREEN_WIDTH) {
for (h = VIEWPORT_HEIGHT; h; h--, dst += BUFFER_WIDTH - SCREEN_WIDTH) {
for (w = SCREEN_WIDTH; w; w--) {
if (*dst >= 32)
*dst = tbl[*dst];

2
Source/gmenu.cpp

@ -45,7 +45,7 @@ void gmenu_draw_pause()
RedBack();
if (!sgpCurrentMenu) {
light_table_index = 0;
gmenu_print_text(316 + PANEL_LEFT, -16 + PANEL_TOP, "Pause");
gmenu_print_text(316 + PANEL_LEFT, 336, "Pause");
}
}

6
Source/minitext.cpp

@ -75,7 +75,7 @@ void InitQTextMsg(int m)
void DrawQTextBack()
{
CelDraw(PANEL_X + 24, 487, pTextBoxCels, 1, 591);
trans_rect(27, 28, 585, 297);
trans_rect(PANEL_LEFT + 27, 28, 585, 297);
}
void PrintQTextChr(int sx, int sy, BYTE *pCelBuff, int nCel)
@ -106,7 +106,7 @@ void DrawQText()
p = qtextptr;
pnl = NULL;
tx = 112;
tx = 48 + PANEL_X;
ty = qtexty;
doneflag = FALSE;
@ -149,7 +149,7 @@ void DrawQText()
if (pnl == NULL) {
pnl = p;
}
tx = 112;
tx = 48 + PANEL_X;
ty += 38;
if (ty > 501) {
doneflag = TRUE;

16
Source/scrollrt.cpp

@ -825,23 +825,21 @@ static void DrawGame(int x, int y)
if (zoomflag)
return;
nSrcOff = SCREENXY(32, 159);
nDstOff = SCREENXY(0, 350);
nSrcOff = SCREENXY(32, VIEWPORT_HEIGHT / 2 - 17);
nDstOff = SCREENXY(0, VIEWPORT_HEIGHT - 2);
wdt = SCREEN_WIDTH / 2;
if (SCREEN_WIDTH == PANEL_WIDTH && SCREEN_HEIGHT == VIEWPORT_HEIGHT + PANEL_HEIGHT) {
if (chrflag || questlog) {
nSrcOff = SCREENXY(112, 159);
nDstOff = SCREENXY(320, 350);
nSrcOff = SCREENXY(112, VIEWPORT_HEIGHT / 2 - 17);
nDstOff = SCREENXY(320, VIEWPORT_HEIGHT - 2);
wdt = (SCREEN_WIDTH - 320) / 2;
} else if (invflag || sbookflag) {
nSrcOff = SCREENXY(112, 159);
nDstOff = SCREENXY(0, 350);
nSrcOff = SCREENXY(112, VIEWPORT_HEIGHT / 2 - 17);
nDstOff = SCREENXY(0, VIEWPORT_HEIGHT - 2);
wdt = (SCREEN_WIDTH - 320) / 2;
}
}
assert(gpBuffer);
int hgt;
BYTE *src, *dst1, *dst2;
@ -849,7 +847,7 @@ static void DrawGame(int x, int y)
dst1 = &gpBuffer[nDstOff];
dst2 = &gpBuffer[nDstOff + BUFFER_WIDTH];
for (hgt = 176; hgt != 0; hgt--, src -= BUFFER_WIDTH + wdt, dst1 -= 2 * (BUFFER_WIDTH + wdt), dst2 -= 2 * (BUFFER_WIDTH + wdt)) {
for (hgt = VIEWPORT_HEIGHT / 2; hgt != 0; hgt--, src -= BUFFER_WIDTH + wdt, dst1 -= 2 * (BUFFER_WIDTH + wdt), dst2 -= 2 * (BUFFER_WIDTH + wdt)) {
for (i = wdt; i != 0; i--) {
*dst1++ = *src;
*dst1++ = *src;

14
Source/stores.cpp

@ -117,7 +117,7 @@ void FreeStoreMem()
void DrawSTextBack()
{
CelDraw(PANEL_X + 344, 487, pSTextBoxCels, 1, 271);
trans_rect(347, 28, 265, 297);
trans_rect(PANEL_LEFT + 347, 28, 265, 297);
}
void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val)
@ -161,7 +161,7 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val)
}
if (!cjustflag && val >= 0) {
sprintf(valstr, "%i", val);
sx = 656 - x;
sx = PANEL_X + 592 - x;
for (i = strlen(valstr) - 1; i >= 0; i--) {
c = fontframe[gbFontTransTbl[(BYTE)valstr[i]]];
sx -= fontkern[c] + 1;
@ -171,7 +171,7 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val)
}
}
if (stextsel == y) {
CelDraw(cjustflag ? xx + x + k + 4 : 660 - x, s + 205, pSPentSpn2Cels, PentSpn2Frame, 12);
CelDraw(cjustflag ? (xx + x + k + 4) : (PANEL_X + 596 - x), s + 205, pSPentSpn2Cels, PentSpn2Frame, 12);
}
}
@ -181,13 +181,13 @@ void DrawSLine(int y)
sy = y * 12;
if (stextsize == 1) {
xy = SCREENXY(26, 25);
yy = BUFFER_WIDTH * (sy + 198) + 26 + 64;
xy = SCREENXY(PANEL_LEFT + 26, 25);
yy = BUFFER_WIDTH * (sy + 198) + 26 + PANEL_X;
width = 586 / 4;
line = BUFFER_WIDTH - 586;
} else {
xy = SCREENXY(346, 25);
yy = BUFFER_WIDTH * (sy + 198) + 346 + 64;
xy = SCREENXY(PANEL_LEFT + 346, 25);
yy = BUFFER_WIDTH * (sy + 198) + 346 + PANEL_X;
width = 266 / 4;
line = BUFFER_WIDTH - 266;
}

2
defs.h

@ -128,7 +128,7 @@
#define RIGHT_PANEL (SCREEN_WIDTH - 320)
#define RIGHT_PANEL_X (SCREEN_X + RIGHT_PANEL)
#if SCREEN_WIDTH == PANEL_WIDTH
#if SCREEN_WIDTH <= PANEL_WIDTH
#define VIEWPORT_HEIGHT (SCREEN_HEIGHT - PANEL_HEIGHT)
#else
#define VIEWPORT_HEIGHT SCREEN_HEIGHT

Loading…
Cancel
Save