Browse Source

Calculate position of screen elements

pull/831/head^2
Tyler 6 years ago committed by Anders Jenbo
parent
commit
c803c6aa66
  1. 10
      Source/control.cpp
  2. 4
      Source/help.cpp
  3. 2
      Source/help.h
  4. 4
      Source/items.cpp
  5. 8
      Source/minitext.cpp
  6. 6
      Source/plrmsg.cpp
  7. 6
      Source/quests.cpp
  8. 20
      Source/stores.cpp

10
Source/control.cpp

@ -2351,16 +2351,16 @@ void DrawSpellBook()
spl = plr[myplr]._pMemSpells | plr[myplr]._pISpells | plr[myplr]._pAblSpells;
yp = 215;
yp = 55 + SCREEN_Y;
for (i = 1; i < 8; i++) {
sn = SpellPages[sbooktab][i - 1];
if (sn != -1 && spl & (__int64)1 << (sn - 1)) {
st = GetSBookTrans(sn, TRUE);
SetSpellTrans(st);
DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, SpellITbl[sn], 37);
DrawSpellCel(RIGHT_PANEL_X + 11, yp, pSBkIconCels, SpellITbl[sn], 37);
if (sn == plr[myplr]._pRSpell && st == plr[myplr]._pRSplType) {
SetSpellTrans(RSPLTYPE_SKILL);
DrawSpellCel(RIGHT_PANEL + 75, yp, pSBkIconCels, SPLICONLAST, 37);
DrawSpellCel(RIGHT_PANEL_X + 11, yp, pSBkIconCels, SPLICONLAST, 37);
}
PrintSBookStr(10, yp - 23, FALSE, spelldata[sn].sNameText, COL_WHITE);
switch (GetSBookTrans(sn, FALSE)) {
@ -2641,7 +2641,7 @@ char *control_print_talk_msg(char *msg, int x, int y, int *nOffset, int color)
c = fontframe[gbFontTransTbl[(BYTE)*msg]];
width += fontkern[c] + 1;
if (width > 514 + PANEL_LEFT)
if (width > 450 + PANEL_X)
return msg;
msg++;
if (c != 0) {
@ -2684,7 +2684,7 @@ void control_release_talk_btn()
if (talkflag) {
for (i = 0; i < sizeof(talkbtndown) / sizeof(talkbtndown[0]); i++)
talkbtndown[i] = FALSE;
if (MouseX >= 172 + PANEL_LEFT && MouseY >= 421 + PANEL_LEFT && MouseX <= -119 + PANEL_TOP && MouseY <= 123 + PANEL_TOP) {
if (MouseX >= 172 + PANEL_LEFT && MouseY >= 69 + PANEL_TOP && MouseX <= 233 + PANEL_LEFT && MouseY <= 123 + PANEL_TOP) {
off = (MouseY - (69 + PANEL_TOP)) / 18;
for (p = 0; p < MAX_PLRS && off != -1; p++) {

4
Source/help.cpp

@ -536,13 +536,13 @@ void DrawHelp()
PrintSString(0, 23, TRUE, "Press ESC to end or the arrow keys to scroll.", COL_GOLD, 0);
}
void DrawHelpLine(int always_0, int help_line_nr, char *text, char color)
void DrawHelpLine(int x, int y, char *text, char color)
{
int off, width;
BYTE c;
width = 0;
off = PitchTbl[SStringY[help_line_nr] + 204] + always_0 + 96 + PANEL_LEFT;
off = PitchTbl[SStringY[y] + 44 + SCREEN_Y] + x + 32 + PANEL_X;
while (*text) {
c = gbFontTransTbl[(BYTE)*text];
text++;

2
Source/help.h

@ -14,7 +14,7 @@ extern int HelpTop;
void InitHelp();
void DrawHelp();
void DrawHelpLine(int always_0, int help_line_nr, char *text, char color);
void DrawHelpLine(int x, int y, char *text, char color);
void DisplayHelp();
void HelpScrollUp();
void HelpScrollDown();

4
Source/items.cpp

@ -2941,7 +2941,7 @@ void PrintUString(int x, int y, BOOL cjustflag, char *str, int col)
int len, width, off, i, k;
BYTE c;
off = x + PitchTbl[SStringY[y] + 204] + 96;
off = x + PitchTbl[SStringY[y] + 44 + SCREEN_Y] + 32 + SCREEN_X;
len = strlen(str);
k = 0;
if (cjustflag) {
@ -2993,7 +2993,7 @@ void DrawULine(int y)
BYTE *src, *dst;
src = &gpBuffer[SCREENXY(PANEL_LEFT + 26, 25)];
dst = &gpBuffer[PitchTbl[SStringY[y] + 198] + 26 + PANEL_X];
dst = &gpBuffer[PitchTbl[SStringY[y] + 38 + SCREEN_Y] + 26 + PANEL_X];
for (i = 0; i < 3; i++, src += BUFFER_WIDTH, dst += BUFFER_WIDTH)
memcpy(dst, src, 266); // BUGFIX: should be 267

8
Source/minitext.cpp

@ -71,7 +71,7 @@ void InitQTextMsg(int m)
questlog = FALSE;
qtextptr = alltext[m].txtstr;
qtextflag = TRUE;
qtexty = 500;
qtexty = 340 + SCREEN_Y;
qtextSpd = qscroll_spd_tbl[alltext[m].txtspd - 1];
qtextDelay = qtextSpd;
sgLastScroll = GetTickCount();
@ -81,7 +81,7 @@ void InitQTextMsg(int m)
void DrawQTextBack()
{
CelDraw(PANEL_X + 24, 487, pTextBoxCels, 1, 591);
CelDraw(PANEL_X + 24, SCREEN_Y + 327, pTextBoxCels, 1, 591);
#define TRANS_RECT_X (PANEL_LEFT + 27)
#define TRANS_RECT_Y 28
@ -265,7 +265,7 @@ void DrawQText()
}
tx = 48 + PANEL_X;
ty += 38;
if (ty > 501) {
if (ty > 341 + SCREEN_Y) {
doneflag = TRUE;
}
}
@ -284,7 +284,7 @@ void DrawQText()
if (qtextDelay == 0) {
qtextDelay = qtextSpd;
}
if (qtexty <= 209) {
if (qtexty <= 49 + SCREEN_Y) {
qtexty += 38;
qtextptr = pnl;
if (*pnl == '|') {

6
Source/plrmsg.cpp

@ -87,15 +87,15 @@ void InitPlrMsg()
void DrawPlrMsg()
{
int i;
DWORD x = 74;
DWORD y = 230;
DWORD x = 10 + SCREEN_X;
DWORD y = 70 + SCREEN_Y;
DWORD width = 620;
_plrmsg *pMsg;
if (chrflag || questlog) {
if (invflag || sbookflag)
return;
x = 394;
x = 330 + SCREEN_X;
width = 300;
} else if (invflag || sbookflag)
width = 300;

6
Source/quests.cpp

@ -738,7 +738,7 @@ void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col)
BYTE c;
s = SStringY[y];
off = x + PitchTbl[SStringY[y] + 204] + 96;
off = x + PitchTbl[SStringY[y] + 44 + SCREEN_Y] + 32 + SCREEN_X;
len = strlen(str);
k = 0;
if (cjustflag) {
@ -750,7 +750,7 @@ void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col)
off += k;
}
if (qline == y) {
CelDraw(cjustflag ? x + k + 76 : x + 76, s + 205, pSPentSpn2Cels, ALLQUESTS, 12);
CelDraw(cjustflag ? x + k + 12 + SCREEN_X : x + 12 + SCREEN_X, s + 205, pSPentSpn2Cels, ALLQUESTS, 12);
}
for (i = 0; i < len; i++) {
c = fontframe[gbFontTransTbl[(BYTE)str[i]]];
@ -761,7 +761,7 @@ void PrintQLString(int x, int y, BOOL cjustflag, char *str, int col)
off += fontkern[c] + 1;
}
if (qline == y) {
CelDraw(cjustflag ? x + k + 100 : 340 - x, s + 205, pSPentSpn2Cels, ALLQUESTS, 12);
CelDraw(cjustflag ? x + k + 36 + SCREEN_X : 276 + SCREEN_X - x, s + 205, pSPentSpn2Cels, ALLQUESTS, 12);
}
}

20
Source/stores.cpp

@ -137,7 +137,7 @@ void FreeStoreMem()
void DrawSTextBack()
{
CelDraw(PANEL_X + 344, 487, pSTextBoxCels, 1, 271);
CelDraw(PANEL_X + 344, 327 + SCREEN_Y, pSTextBoxCels, 1, 271);
#define TRANS_RECT_X (PANEL_LEFT + 347)
#define TRANS_RECT_Y 28
@ -158,7 +158,7 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val)
xx = PANEL_X + 32;
else
xx = PANEL_X + 352;
off = xx + x + PitchTbl[s + 204];
off = xx + x + PitchTbl[s + 44 + SCREEN_Y];
len = strlen(str);
if (stextsize)
yy = 577;
@ -174,7 +174,7 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val)
off += k;
}
if (stextsel == y) {
CelDraw(cjustflag ? xx + x + k - 20 : xx + x - 20, s + 205, pSPentSpn2Cels, InStoreFlag, 12);
CelDraw(cjustflag ? xx + x + k - 20 : xx + x - 20, s + 45 + SCREEN_Y, pSPentSpn2Cels, InStoreFlag, 12);
}
for (i = 0; i < len; i++) {
c = fontframe[gbFontTransTbl[(BYTE)str[i]]];
@ -186,7 +186,7 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val)
}
if (!cjustflag && val >= 0) {
sprintf(valstr, "%i", val);
off = PitchTbl[s + 204] + PANEL_X + 592 - x;
off = PitchTbl[s + 44 + SCREEN_Y] + PANEL_X + 592 - x;
for (i = strlen(valstr) - 1; i >= 0; i--) {
c = fontframe[gbFontTransTbl[(BYTE)valstr[i]]];
off -= fontkern[c] + 1;
@ -196,7 +196,7 @@ void PrintSString(int x, int y, BOOL cjustflag, char *str, char col, int val)
}
}
if (stextsel == y) {
CelDraw(cjustflag ? (xx + x + k + 4) : (PANEL_X + 596 - x), s + 205, pSPentSpn2Cels, InStoreFlag, 12);
CelDraw(cjustflag ? (xx + x + k + 4) : (PANEL_X + 596 - x), s + 45 + SCREEN_Y, pSPentSpn2Cels, InStoreFlag, 12);
}
}
@ -207,12 +207,12 @@ void DrawSLine(int y)
sy = SStringY[y];
if (stextsize) {
xy = SCREENXY(PANEL_LEFT + 26, 25);
yy = PitchTbl[sy + 198] + 26 + PANEL_X;
yy = PitchTbl[sy + 38 + SCREEN_Y] + 26 + PANEL_X;
width = 586 / 4; // BUGFIX: should be 587, not 586
line = BUFFER_WIDTH - 586; // BUGFIX: should be 587, not 586
} else {
xy = SCREENXY(PANEL_LEFT + 346, 25);
yy = PitchTbl[sy + 198] + 346 + PANEL_X;
yy = PitchTbl[sy + 38 + SCREEN_Y] + 346 + PANEL_X;
width = 266 / 4; // BUGFIX: should be 267, not 266
line = BUFFER_WIDTH - 266; // BUGFIX: should be 267, not 266
}
@ -252,8 +252,8 @@ void DrawSSlider(int y1, int y2)
{
int yd1, yd2, yd3;
yd1 = SStringY[y1] + 204;
yd2 = SStringY[y2] + 204;
yd1 = SStringY[y1] + 44 + SCREEN_Y;
yd2 = SStringY[y2] + 44 + SCREEN_Y;
if (stextscrlubtn != -1)
CelDraw(PANEL_X + 601, yd1, pSTextSlidCels, 12, 12);
else
@ -274,7 +274,7 @@ void DrawSSlider(int y1, int y2)
yd3 = 1000 * (stextsval + ((yd3 - stextup) >> 2)) / (storenumh - 1) * (SStringY[y2] - SStringY[y1] - 24) / 1000;
else
yd3 = 0;
CelDraw(PANEL_X + 601, SStringY[y1 + 1] + 204 + yd3, pSTextSlidCels, 13, 12);
CelDraw(PANEL_X + 601, SStringY[y1 + 1] + 44 + SCREEN_Y + yd3, pSTextSlidCels, 13, 12);
}
void DrawSTextHelp()

Loading…
Cancel
Save