|
|
|
|
@ -77,32 +77,12 @@ const BYTE fontkern[68] = {
|
|
|
|
|
3, 2, 7, 6, 3, 10, 10, 6, 6, 7, |
|
|
|
|
4, 4, 9, 6, 6, 12, 3, 7 |
|
|
|
|
}; |
|
|
|
|
const int lineoffset[25] = { |
|
|
|
|
BUFFER_WIDTH * 594 + 241, |
|
|
|
|
BUFFER_WIDTH * 32, |
|
|
|
|
BUFFER_WIDTH * 32, |
|
|
|
|
BUFFER_WIDTH * 32, |
|
|
|
|
BUFFER_WIDTH * 32 + 180, |
|
|
|
|
BUFFER_WIDTH * 582 + 241, |
|
|
|
|
BUFFER_WIDTH * 606 + 241, |
|
|
|
|
BUFFER_WIDTH * 32, |
|
|
|
|
BUFFER_WIDTH * 32, |
|
|
|
|
BUFFER_WIDTH * 32, |
|
|
|
|
BUFFER_WIDTH * 576 + 241, |
|
|
|
|
BUFFER_WIDTH * 594 + 241, |
|
|
|
|
BUFFER_WIDTH * 612 + 241, |
|
|
|
|
BUFFER_WIDTH * 32, |
|
|
|
|
BUFFER_WIDTH * 32, |
|
|
|
|
BUFFER_WIDTH * 572 + 241, |
|
|
|
|
BUFFER_WIDTH * 587 + 241, |
|
|
|
|
BUFFER_WIDTH * 601 + 241, |
|
|
|
|
BUFFER_WIDTH * 616 + 241, |
|
|
|
|
BUFFER_WIDTH * 32, |
|
|
|
|
BUFFER_WIDTH * 570 + 241, |
|
|
|
|
BUFFER_WIDTH * 582 + 241, |
|
|
|
|
BUFFER_WIDTH * 594 + 241, |
|
|
|
|
BUFFER_WIDTH * 606 + 241, |
|
|
|
|
BUFFER_WIDTH * 617 + 241 |
|
|
|
|
const int lineOffsets[5][5] = { |
|
|
|
|
{ 434 }, |
|
|
|
|
{ 422, 446 }, |
|
|
|
|
{ 416, 434, 452 }, |
|
|
|
|
{ 412, 427, 441, 456 }, |
|
|
|
|
{ 410, 422, 434, 446, 457 }, |
|
|
|
|
}; |
|
|
|
|
const BYTE gbFontTransTbl[256] = { |
|
|
|
|
// clang-format off
|
|
|
|
|
@ -441,21 +421,17 @@ void ToggleSpell(int slot)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CPrintString(int nOffset, int nCel, char col) |
|
|
|
|
void CPrintString(int sx, int sy, int nCel, char col) |
|
|
|
|
{ |
|
|
|
|
/// ASSERT: assert(gpBuffer);
|
|
|
|
|
|
|
|
|
|
int i, nDataSize; |
|
|
|
|
int i; |
|
|
|
|
BYTE pix; |
|
|
|
|
BYTE *src, *dst; |
|
|
|
|
BYTE tbl[256]; |
|
|
|
|
|
|
|
|
|
src = CelGetFrame(pPanelText, nCel, &nDataSize); |
|
|
|
|
dst = &gpBuffer[nOffset]; |
|
|
|
|
|
|
|
|
|
switch (col) { |
|
|
|
|
case COL_WHITE: |
|
|
|
|
CelBlit(dst, src, nDataSize, 13); |
|
|
|
|
CelDraw(sx, sy, pPanelText, nCel, 13); |
|
|
|
|
return; |
|
|
|
|
case COL_BLUE: |
|
|
|
|
for (i = 0; i < 256; i++) { |
|
|
|
|
@ -488,7 +464,7 @@ void CPrintString(int nOffset, int nCel, char col)
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
CelBlitLight(dst, src, nDataSize, 13, tbl); |
|
|
|
|
CelDrawLight(sx, sy, pPanelText, nCel, 13, tbl); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AddPanelString(char *str, BOOL just) |
|
|
|
|
@ -1185,45 +1161,47 @@ void control_print_info_str(int y, char *str, BOOL center, int lines)
|
|
|
|
|
{ |
|
|
|
|
BYTE c; |
|
|
|
|
char *tmp; |
|
|
|
|
int screen_x, line, nOffset; |
|
|
|
|
int lineOffset, strWidth, sx, sy; |
|
|
|
|
|
|
|
|
|
line = 0; |
|
|
|
|
nOffset = lineoffset[y + 5 * lines] + (SCREEN_WIDTH - PANEL_WIDTH) / 2; |
|
|
|
|
lineOffset = 0; |
|
|
|
|
sx = 177 + SCREEN_X; |
|
|
|
|
sy = lineOffsets[lines][y] + (SCREEN_WIDTH - PANEL_WIDTH) / 2 + SCREEN_Y; |
|
|
|
|
if (center == 1) { |
|
|
|
|
screen_x = 0; |
|
|
|
|
strWidth = 0; |
|
|
|
|
tmp = str; |
|
|
|
|
while (*tmp) { |
|
|
|
|
c = gbFontTransTbl[(BYTE)*tmp++]; |
|
|
|
|
screen_x += fontkern[fontframe[c]] + 1; |
|
|
|
|
strWidth += fontkern[fontframe[c]] + 1; |
|
|
|
|
} |
|
|
|
|
if (screen_x < 288) |
|
|
|
|
line = (288 - screen_x) >> 1; |
|
|
|
|
nOffset += line; |
|
|
|
|
if (strWidth < 288) |
|
|
|
|
lineOffset = (288 - strWidth) >> 1; |
|
|
|
|
sx += lineOffset; |
|
|
|
|
} |
|
|
|
|
while (*str) { |
|
|
|
|
c = gbFontTransTbl[(BYTE)*str++]; |
|
|
|
|
c = fontframe[c]; |
|
|
|
|
line += fontkern[c] + 2; |
|
|
|
|
lineOffset += fontkern[c] + 2; |
|
|
|
|
if (c) { |
|
|
|
|
if (line < 288) { |
|
|
|
|
CPrintString(nOffset, c, infoclr); |
|
|
|
|
if (lineOffset < 288) { |
|
|
|
|
CPrintString(sx, sy, c, infoclr); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
nOffset += fontkern[c] + 2; |
|
|
|
|
sx += fontkern[c] + 2; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PrintGameStr(int x, int y, char *str, int color) |
|
|
|
|
{ |
|
|
|
|
BYTE c; |
|
|
|
|
int off; |
|
|
|
|
off = BUFFER_WIDTH * (y + SCREEN_Y) + x + SCREEN_X; |
|
|
|
|
int sx, sy; |
|
|
|
|
sx = x + SCREEN_X; |
|
|
|
|
sy = y + SCREEN_Y; |
|
|
|
|
while (*str) { |
|
|
|
|
c = gbFontTransTbl[(BYTE)*str++]; |
|
|
|
|
c = fontframe[c]; |
|
|
|
|
if (c) |
|
|
|
|
CPrintString(off, c, color); |
|
|
|
|
off += fontkern[c] + 1; |
|
|
|
|
CPrintString(sx, sy, c, color); |
|
|
|
|
sx += fontkern[c] + 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1437,9 +1415,10 @@ void MY_PlrStringXY(int x, int y, int width, char *pszStr, char col, int base)
|
|
|
|
|
{ |
|
|
|
|
BYTE c; |
|
|
|
|
char *tmp; |
|
|
|
|
int nOffset, screen_x, line, widthOffset; |
|
|
|
|
int sx, sy, screen_x, line, widthOffset; |
|
|
|
|
|
|
|
|
|
nOffset = x + BUFFER_WIDTH * (y + SCREEN_Y) + SCREEN_X; |
|
|
|
|
sx = x + SCREEN_X; |
|
|
|
|
sy = y + SCREEN_Y; |
|
|
|
|
widthOffset = width - x + 1; |
|
|
|
|
line = 0; |
|
|
|
|
screen_x = 0; |
|
|
|
|
@ -1450,16 +1429,16 @@ void MY_PlrStringXY(int x, int y, int width, char *pszStr, char col, int base)
|
|
|
|
|
} |
|
|
|
|
if (screen_x < widthOffset) |
|
|
|
|
line = (widthOffset - screen_x) >> 1; |
|
|
|
|
nOffset += line; |
|
|
|
|
sx += line; |
|
|
|
|
while (*pszStr) { |
|
|
|
|
c = gbFontTransTbl[(BYTE)*pszStr++]; |
|
|
|
|
c = fontframe[c]; |
|
|
|
|
line += fontkern[c] + base; |
|
|
|
|
if (c) { |
|
|
|
|
if (line < widthOffset) |
|
|
|
|
CPrintString(nOffset, c, col); |
|
|
|
|
CPrintString(sx, sy, c, col); |
|
|
|
|
} |
|
|
|
|
nOffset += fontkern[c] + base; |
|
|
|
|
sx += fontkern[c] + base; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1734,9 +1713,9 @@ void PrintSBookStr(int x, int y, BOOL cjustflag, char *pszStr, char col)
|
|
|
|
|
{ |
|
|
|
|
BYTE c; |
|
|
|
|
char *tmp; |
|
|
|
|
int screen_x, line, width; |
|
|
|
|
int screen_x, line, sx; |
|
|
|
|
|
|
|
|
|
width = BUFFER_WIDTH * y + x + SCREEN_WIDTH - 320 + 120;; |
|
|
|
|
sx = x + SCREEN_WIDTH - 320 + 120; |
|
|
|
|
line = 0; |
|
|
|
|
if (cjustflag) { |
|
|
|
|
screen_x = 0; |
|
|
|
|
@ -1747,7 +1726,7 @@ void PrintSBookStr(int x, int y, BOOL cjustflag, char *pszStr, char col)
|
|
|
|
|
} |
|
|
|
|
if (screen_x < 222) |
|
|
|
|
line = (222 - screen_x) >> 1; |
|
|
|
|
width += line; |
|
|
|
|
sx += line; |
|
|
|
|
} |
|
|
|
|
while (*pszStr) { |
|
|
|
|
c = gbFontTransTbl[(BYTE)*pszStr++]; |
|
|
|
|
@ -1755,9 +1734,9 @@ void PrintSBookStr(int x, int y, BOOL cjustflag, char *pszStr, char col)
|
|
|
|
|
line += fontkern[c] + 1; |
|
|
|
|
if (c) { |
|
|
|
|
if (line <= 222) |
|
|
|
|
CPrintString(width, c, col); |
|
|
|
|
CPrintString(sx, y, c, col); |
|
|
|
|
} |
|
|
|
|
width += fontkern[c] + 1; |
|
|
|
|
sx += fontkern[c] + 1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1920,13 +1899,14 @@ void DrawTalkPan()
|
|
|
|
|
DrawPanelBox(170, sgbPlrTalkTbl + 80, 310, 55, 234, 576); |
|
|
|
|
msg = sgszTalkMsg; |
|
|
|
|
for (i = 0; i < 39; i += 13) { |
|
|
|
|
msg = control_print_talk_msg(msg, 0, i, &x, 0); |
|
|
|
|
x = 0; |
|
|
|
|
msg = control_print_talk_msg(msg, &x, i, 0); |
|
|
|
|
if (!msg) |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (msg) |
|
|
|
|
*msg = '\0'; |
|
|
|
|
CelBlitFrame(gpBuffer + x, pSPentSpn2Cels, frame, 12); |
|
|
|
|
CelDraw(x, i + 534, pSPentSpn2Cels, frame, 12); |
|
|
|
|
frame = (frame & 7) + 1; |
|
|
|
|
talk_btn = 0; |
|
|
|
|
for (i = 0; i < 4; i++) { |
|
|
|
|
@ -1952,21 +1932,21 @@ void DrawTalkPan()
|
|
|
|
|
CelDraw(172 + SCREEN_X, 436 + 18 * talk_btn + SCREEN_Y, pTalkBtns, nCel, 61); |
|
|
|
|
} |
|
|
|
|
if (plr[i].plractive) { |
|
|
|
|
control_print_talk_msg(plr[i]._pName, 46, 60 + talk_btn * 18, &x, color); |
|
|
|
|
x = 46; |
|
|
|
|
control_print_talk_msg(plr[i]._pName, &x, 60 + talk_btn * 18, color); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
talk_btn++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
char *control_print_talk_msg(char *msg, int x, int y, int *nOffset, int color) |
|
|
|
|
char *control_print_talk_msg(char *msg, int *x, int y, int color) |
|
|
|
|
{ |
|
|
|
|
BYTE c; |
|
|
|
|
int width; |
|
|
|
|
|
|
|
|
|
x += 264; |
|
|
|
|
width = x; |
|
|
|
|
*nOffset = BUFFER_WIDTH * (y + 534) + x; |
|
|
|
|
*x += 264; |
|
|
|
|
width = *x; |
|
|
|
|
while (*msg) { |
|
|
|
|
|
|
|
|
|
c = fontframe[gbFontTransTbl[(BYTE)*msg]]; |
|
|
|
|
@ -1975,9 +1955,9 @@ char *control_print_talk_msg(char *msg, int x, int y, int *nOffset, int color)
|
|
|
|
|
return msg; |
|
|
|
|
msg++; |
|
|
|
|
if (c) { |
|
|
|
|
CPrintString(*nOffset, c, color); |
|
|
|
|
CPrintString(*x, y + 534, c, color); |
|
|
|
|
} |
|
|
|
|
*nOffset += fontkern[c] + 1; |
|
|
|
|
*x += fontkern[c] + 1; |
|
|
|
|
} |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
|