Browse Source

Use BUFFER_WIDTH

pull/133/head
Manuel K 7 years ago
parent
commit
97c1edd3a0
  1. 2
      Source/automap.cpp
  2. 2
      Source/capture.cpp
  3. 102
      Source/control.cpp
  4. 162
      Source/engine.cpp
  5. 4
      Source/inv.cpp
  6. 4
      Source/items.cpp
  7. 4
      Source/minitext.cpp
  8. 86
      Source/scrollrt.cpp
  9. 8
      Source/stores.cpp
  10. 66
      Source/town.cpp

2
Source/automap.cpp

@ -173,7 +173,7 @@ void DrawAutomap()
return;
}
gpBufEnd = (unsigned char *)&gpBuffer[(VIEWPORT_HEIGHT + SCREEN_Y) * 768];
gpBufEnd = (unsigned char *)&gpBuffer[(VIEWPORT_HEIGHT + SCREEN_Y) * BUFFER_WIDTH];
MapX = (ViewX - 16) >> 1;
while (MapX + AutoMapXOfs < 0)

2
Source/capture.cpp

@ -20,7 +20,7 @@ void CaptureScreen()
lock_buf(2);
success = CaptureHdr(hObject, 640, 480);
if (success) {
success = CapturePix(hObject, 640, 480, 768, &gpBuffer[SCREENXY(0, 0)]);
success = CapturePix(hObject, 640, 480, BUFFER_WIDTH, &gpBuffer[SCREENXY(0, 0)]);
if (success) {
success = CapturePal(hObject, palette);
}

102
Source/control.cpp

@ -76,31 +76,31 @@ const unsigned char fontkern[68] = {
4, 4, 9, 6, 6, 12, 3, 7
};
const int lineoffset[25] = {
768 * 594 + 241,
768 * 32,
768 * 32,
768 * 32,
768 * 32 + 180,
768 * 582 + 241,
768 * 606 + 241,
768 * 32,
768 * 32,
768 * 32,
768 * 576 + 241,
768 * 594 + 241,
768 * 612 + 241,
768 * 32,
768 * 32,
768 * 572 + 241,
768 * 587 + 241,
768 * 601 + 241,
768 * 616 + 241,
768 * 32,
768 * 570 + 241,
768 * 582 + 241,
768 * 594 + 241,
768 * 606 + 241,
768 * 617 + 241
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 unsigned char gbFontTransTbl[256] = {
// clang-format off
@ -240,7 +240,7 @@ void DrawSpellCel(int xp, int yp, BYTE *Trans, int nCel, int w)
sub edx, eax
jnz label2
label7:
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, w
cmp esi, end
jnz label1
@ -255,7 +255,7 @@ void DrawSpellCel(int xp, int yp, BYTE *Trans, int nCel, int w)
src = &Trans[pFrameTable[0]];
end = &src[pFrameTable[1] - pFrameTable[0]];
for (; src != end; dst -= 768 + w) {
for (; src != end; dst -= BUFFER_WIDTH + w) {
for (i = w; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -615,7 +615,7 @@ void CPrintString(int nOffset, int nCel, char col)
sub edx, eax
jnz c0_label2
c0_label7:
sub edi, 768 + 13
sub edi, BUFFER_WIDTH + 13
cmp ebx, esi
jnz c0_label1
jmp labret
@ -652,7 +652,7 @@ void CPrintString(int nOffset, int nCel, char col)
sub edx, eax
jnz c1_label2
c1_label7:
sub edi, 768 + 13
sub edi, BUFFER_WIDTH + 13
cmp ebx, esi
jnz c1_label1
jmp labret
@ -684,7 +684,7 @@ void CPrintString(int nOffset, int nCel, char col)
sub edx, eax
jnz c2_label2
c2_label6:
sub edi, 768 + 13
sub edi, BUFFER_WIDTH + 13
cmp ebx, esi
jnz c2_label1
jmp labret
@ -721,7 +721,7 @@ void CPrintString(int nOffset, int nCel, char col)
sub edx, eax
jnz d_label2
d_label7:
sub edi, 768 + 13
sub edi, BUFFER_WIDTH + 13
cmp ebx, esi
jnz d_label1
@ -740,7 +740,7 @@ void CPrintString(int nOffset, int nCel, char col)
switch (col) {
case COL_WHITE:
for (; src != end; dst -= 768 + 13) {
for (; src != end; dst -= BUFFER_WIDTH + 13) {
for (i = 13; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -776,7 +776,7 @@ void CPrintString(int nOffset, int nCel, char col)
}
break;
case COL_BLUE:
for (; src != end; dst -= 768 + 13) {
for (; src != end; dst -= BUFFER_WIDTH + 13) {
for (i = 13; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -799,7 +799,7 @@ void CPrintString(int nOffset, int nCel, char col)
}
break;
case COL_RED:
for (; src != end; dst -= 768 + 13) {
for (; src != end; dst -= BUFFER_WIDTH + 13) {
for (i = 13; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -820,7 +820,7 @@ void CPrintString(int nOffset, int nCel, char col)
}
break;
default:
for (; src != end; dst -= 768 + 13) {
for (; src != end; dst -= BUFFER_WIDTH + 13) {
for (i = 13; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -870,7 +870,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy)
/// ASSERT: assert(gpBuffer);
nSrcOff = x + 640 * y;
nDstOff = sx + 768 * sy;
nDstOff = sx + BUFFER_WIDTH * sy;
#ifdef USE_ASM
__asm {
@ -898,7 +898,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy)
label4:
add esi, 640
sub esi, ebx
add edi, 768
add edi, BUFFER_WIDTH
sub edi, ebx
dec edx
jnz label1
@ -910,7 +910,7 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy)
src = &pBtmBuff[nSrcOff];
dst = &gpBuffer[nDstOff];
for (hgt = h; hgt; hgt--, src += 640 - w, dst += 768 - w) {
for (hgt = h; hgt; hgt--, src += 640 - w, dst += BUFFER_WIDTH - w) {
wdt = w;
if (wdt & 1) {
dst[0] = src[0];
@ -945,7 +945,7 @@ void SetFlaskHeight(BYTE *pCelBuff, int min, int max, int c, int r)
/// ASSERT: assert(gpBuffer);
nSrcOff = 88 * min;
nDstOff = c + 768 * r;
nDstOff = c + BUFFER_WIDTH * r;
w = max - min;
#ifdef USE_ASM
@ -958,7 +958,7 @@ void SetFlaskHeight(BYTE *pCelBuff, int min, int max, int c, int r)
label1:
mov ecx, 88 / 4
rep movsd
add edi, 768 - 88
add edi, BUFFER_WIDTH - 88
dec edx
jnz label1
}
@ -968,7 +968,7 @@ void SetFlaskHeight(BYTE *pCelBuff, int min, int max, int c, int r)
src = &pCelBuff[nSrcOff];
dst = &gpBuffer[nDstOff];
for (; w; w--, src += 88, dst += 768)
for (; w; w--, src += 88, dst += BUFFER_WIDTH)
memcpy(dst, src, 88);
#endif
}
@ -994,7 +994,7 @@ void DrawFlask(BYTE *pCelBuff, int w, int nSrcOff, BYTE *pBuff, int nDstOff, int
loop label2
add esi, w
sub esi, 59
add edi, 768 - 59
add edi, BUFFER_WIDTH - 59
dec edx
jnz label1
}
@ -1005,7 +1005,7 @@ void DrawFlask(BYTE *pCelBuff, int w, int nSrcOff, BYTE *pBuff, int nDstOff, int
src = &pCelBuff[nSrcOff];
dst = &pBuff[nDstOff];
for (hgt = h; hgt; hgt--, src += w - 59, dst += 768 - 59) {
for (hgt = h; hgt; hgt--, src += w - 59, dst += BUFFER_WIDTH - 59) {
for (wdt = 59; wdt; wdt--) {
if (*src)
*dst = *src;
@ -1028,9 +1028,9 @@ void DrawLifeFlask()
filled = 11;
filled += 2;
DrawFlask(pLifeBuff, 88, 277, gpBuffer, 768 * 499 + 173, filled);
DrawFlask(pLifeBuff, 88, 277, gpBuffer, BUFFER_WIDTH * 499 + 173, filled);
if (filled != 13)
DrawFlask(pBtmBuff, 640, 640 * filled + 2029, gpBuffer, 768 * filled + 768 * 499 + 173, 13 - filled);
DrawFlask(pBtmBuff, 640, 640 * filled + 2029, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173, 13 - filled);
}
void UpdateLifeFlask()
@ -1058,9 +1058,9 @@ void DrawManaFlask()
filled = 11;
filled += 2;
DrawFlask(pManaBuff, 88, 277, gpBuffer, 768 * 499 + 173 + 366, filled);
DrawFlask(pManaBuff, 88, 277, gpBuffer, BUFFER_WIDTH * 499 + 173 + 366, filled);
if (filled != 13)
DrawFlask(pBtmBuff, 640, 640 * filled + 2029 + 366, gpBuffer, 768 * filled + 768 * 499 + 173 + 366, 13 - filled);
DrawFlask(pBtmBuff, 640, 640 * filled + 2029 + 366, gpBuffer, BUFFER_WIDTH * filled + BUFFER_WIDTH * 499 + 173 + 366, 13 - filled);
}
void control_update_life_mana()
@ -2100,7 +2100,7 @@ void RedBack()
xlat
stosb
loop lx_label2
add edi, 768 - 640
add edi, BUFFER_WIDTH - 640
dec edx
jnz lx_label1
}
@ -2121,7 +2121,7 @@ void RedBack()
l4_label3:
stosb
loop l4_label2
add edi, 768 - 640
add edi, BUFFER_WIDTH - 640
dec edx
jnz l4_label1
}
@ -2133,7 +2133,7 @@ void RedBack()
if (leveltype != DTYPE_HELL) {
dst = &gpBuffer[SCREENXY(0, 0)];
tbl = &pLightTbl[idx];
for (h = VIEWPORT_HEIGHT; h; h--, dst += 768 - 640) {
for (h = VIEWPORT_HEIGHT; h; h--, dst += BUFFER_WIDTH - 640) {
for (w = 640; w; w--) {
*dst = tbl[*dst];
dst++;
@ -2142,7 +2142,7 @@ void RedBack()
} else {
dst = &gpBuffer[SCREENXY(0, 0)];
tbl = &pLightTbl[idx];
for (h = VIEWPORT_HEIGHT; h; h--, dst += 768 - 640) {
for (h = VIEWPORT_HEIGHT; h; h--, dst += BUFFER_WIDTH - 640) {
for (w = 640; w; w--) {
if (*dst >= 32)
*dst = tbl[*dst];

162
Source/engine.cpp

@ -34,7 +34,7 @@ void CelDrawDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
__asm {
mov esi, pRLEBytes
mov edi, pDecodeTo
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, nWidth
mov w, eax
mov ebx, nDataSize
@ -82,7 +82,7 @@ void CelDrawDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
dst = pDecodeTo;
w = nWidth;
for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w) {
for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w) {
for (i = w; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -256,7 +256,7 @@ void CelDecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
mov tbl, eax
mov esi, pRLEBytes
mov edi, pDecodeTo
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, nWidth
mov w, eax
mov ebx, nDataSize
@ -353,7 +353,7 @@ void CelDecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
tbl = &pLightTbl[light_table_index * 256];
w = nWidth;
for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w) {
for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w) {
for (i = w; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -411,7 +411,7 @@ void CelDecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW
mov tbl, eax
mov esi, pRLEBytes
mov edi, pDecodeTo
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, nWidth
mov w, eax
mov ebx, nDataSize
@ -518,7 +518,7 @@ void CelDecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW
w = nWidth;
shift = (BYTE)dst & 1;
for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w, shift = (shift + 1) & 1) {
for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w, shift = (shift + 1) & 1) {
for (i = w; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -743,9 +743,9 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in
__asm {
mov esi, src
mov edi, dst
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, nWidth
mov w, eax /* use C for w? w = 768 + nWidth */
mov w, eax /* use C for w? w = BUFFER_WIDTH + nWidth */
mov ebx, nDataSize
add ebx, esi
label1:
@ -788,7 +788,7 @@ void CelDrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in
end = &src[nDataSize];
for (; src != end; dst -= 768 + nWidth) {
for (; src != end; dst -= BUFFER_WIDTH + nWidth) {
for (w = nWidth; w;) {
width = *src++;
if (!(width & 0x80)) {
@ -828,7 +828,7 @@ void Cel2DecDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
__asm {
mov esi, pRLEBytes
mov edi, pDecodeTo
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, nWidth
mov w, eax
mov ebx, nDataSize
@ -882,7 +882,7 @@ void Cel2DecDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
dst = pDecodeTo;
w = nWidth;
for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w) {
for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w) {
for (i = w; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -1024,7 +1024,7 @@ void Cel2DecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW
mov tbl, eax
mov esi, pRLEBytes
mov edi, pDecodeTo
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, nWidth
mov w, eax
mov ebx, nDataSize
@ -1128,7 +1128,7 @@ void Cel2DecDatLightOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nW
tbl = &pLightTbl[light_table_index * 256];
w = nWidth;
for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w) {
for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w) {
for (i = w; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -1195,7 +1195,7 @@ void Cel2DecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int n
mov tbl, eax
mov esi, pRLEBytes
mov edi, pDecodeTo
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, nWidth
mov w, eax
mov ebx, nDataSize
@ -1308,7 +1308,7 @@ void Cel2DecDatLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int n
w = nWidth;
shift = (BYTE)dst & 1;
for (; src != &pRLEBytes[nDataSize]; dst -= 768 + w, shift = (shift + 1) & 1) {
for (; src != &pRLEBytes[nDataSize]; dst -= BUFFER_WIDTH + w, shift = (shift + 1) & 1) {
for (i = w; i;) {
width = *src++;
if (!(width & 0x80)) {
@ -1504,7 +1504,7 @@ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i
tbl = &pLightTbl[idx];
#ifdef USE_ASM
w = 768 + nWidth;
w = BUFFER_WIDTH + nWidth;
__asm {
mov esi, src
@ -1557,7 +1557,7 @@ void Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i
end = &src[nDataSize];
for (; src != end; dst -= 768 + nWidth) {
for (; src != end; dst -= BUFFER_WIDTH + nWidth) {
for (w = nWidth; w;) {
width = *src++;
if (!(width & 0x80)) {
@ -1754,7 +1754,7 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth
__asm {
mov esi, src
mov edi, dst
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, nWidth
mov w, eax
mov ebx, nDataSize
@ -1773,10 +1773,10 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth
lodsb
or al, al
jz label4
mov [edi-768], ah
mov [edi-BUFFER_WIDTH], ah
mov [edi-1], ah
mov [edi+1], ah
mov [edi+768], ah
mov [edi+BUFFER_WIDTH], ah
label4:
inc edi
loop label3
@ -1817,17 +1817,17 @@ void CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth
end = &src[nDataSize];
dst = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]];
for (; src != end; dst -= 768 + nWidth) {
for (; src != end; dst -= BUFFER_WIDTH + nWidth) {
for (w = nWidth; w;) {
width = *src++;
if (!(width & 0x80)) {
w -= width;
while (width) {
if (*src++) {
dst[-768] = col;
dst[-BUFFER_WIDTH] = col;
dst[-1] = col;
dst[1] = col;
dst[768] = col;
dst[BUFFER_WIDTH] = col;
}
dst++;
width--;
@ -1895,7 +1895,7 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi
__asm {
mov esi, src
mov edi, dst
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, nWidth
mov w, eax
mov ebx, nDataSize
@ -1915,7 +1915,7 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi
add edi, eax
jmp label9
label3:
sub ecx, 768
sub ecx, BUFFER_WIDTH
cmp edi, ecx
jnb label6
mov ecx, eax
@ -1924,10 +1924,10 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi
lodsb
or al, al
jz label5
mov [edi-768], ah
mov [edi-BUFFER_WIDTH], ah
mov [edi-1], ah
mov [edi+1], ah
mov [edi+768], ah
mov [edi+BUFFER_WIDTH], ah
label5:
inc edi
loop label4
@ -1939,7 +1939,7 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi
lodsb
or al, al
jz label8
mov [edi-768], ah
mov [edi-BUFFER_WIDTH], ah
mov [edi-1], ah
mov [edi+1], ah
label8:
@ -1983,16 +1983,16 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi
end = &src[nDataSize];
dst = &gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]];
for (; src != end; dst -= 768 + nWidth) {
for (; src != end; dst -= BUFFER_WIDTH + nWidth) {
for (w = nWidth; w;) {
width = *src++;
if (!(width & 0x80)) {
w -= width;
if (dst < gpBufEnd) {
if (dst >= gpBufEnd - 768) {
if (dst >= gpBufEnd - BUFFER_WIDTH) {
while (width) {
if (*src++) {
dst[-768] = col;
dst[-BUFFER_WIDTH] = col;
dst[-1] = col;
dst[1] = col;
}
@ -2002,10 +2002,10 @@ void CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWi
} else {
while (width) {
if (*src++) {
dst[-768] = col;
dst[-BUFFER_WIDTH] = col;
dst[-1] = col;
dst[1] = col;
dst[768] = col;
dst[BUFFER_WIDTH] = col;
}
dst++;
width--;
@ -2588,7 +2588,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
test ebx, ebx
jnz label10
mov ebx, nWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
jmp label10
label6:
@ -2606,7 +2606,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
sub ebx, edx
jnz label9
mov ebx, nWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
label9:
test eax, eax
@ -2645,7 +2645,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
} else {
@ -2659,7 +2659,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
}
@ -2676,7 +2676,7 @@ void Cl2DecDatFrm1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
}
}
@ -2759,8 +2759,8 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
sub ebx, eax
mov [edi+eax], dl
label2:
mov [edi-768], dl
mov [edi+768], dl
mov [edi-BUFFER_WIDTH], dl
mov [edi+BUFFER_WIDTH], dl
dec eax
lea edi, [edi+1]
jnz label2
@ -2775,8 +2775,8 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
jz label5
mov [edi-1], dl
mov [edi+1], dl
mov [edi-768], dl
mov [edi+768], dl
mov [edi-BUFFER_WIDTH], dl
mov [edi+BUFFER_WIDTH], dl
label5:
dec eax
lea edi, [edi+1]
@ -2785,7 +2785,7 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
test ebx, ebx
jnz label11
mov ebx, nWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
jmp label11
label7:
@ -2803,7 +2803,7 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
sub ebx, edx
jnz label10
mov ebx, nWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
label10:
test eax, eax
@ -2838,14 +2838,14 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
dst[-1] = col;
dst[width] = col;
while (width) {
dst[-768] = col;
dst[768] = col;
dst[-BUFFER_WIDTH] = col;
dst[BUFFER_WIDTH] = col;
dst++;
width--;
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
}
@ -2856,15 +2856,15 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
if (*src++) {
dst[-1] = col;
dst[1] = col;
dst[-768] = col;
dst[768] = col;
dst[-BUFFER_WIDTH] = col;
dst[BUFFER_WIDTH] = col;
}
dst++;
width--;
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
}
@ -2881,7 +2881,7 @@ void Cl2DecDatFrm2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
}
}
@ -2991,7 +2991,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
test ebx, ebx
jnz label10
mov ebx, sgnWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
jmp label10
label6:
@ -3009,7 +3009,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
sub ebx, edx
jnz label9
mov ebx, sgnWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
label9:
test eax, eax
@ -3050,7 +3050,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
}
if (!w) {
w = sgnWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
} else {
@ -3064,7 +3064,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
}
if (!w) {
w = sgnWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
}
@ -3081,7 +3081,7 @@ void Cl2DecDatLightTbl1(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
}
if (!w) {
w = sgnWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
}
}
@ -3228,7 +3228,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
test ebx, ebx
jnz label11
mov ebx, nWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
jmp label11
label7:
@ -3246,7 +3246,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
sub ebx, edx
jnz label10
mov ebx, nWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
label10:
test eax, eax
@ -3286,7 +3286,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
}
@ -3302,7 +3302,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
} else {
@ -3322,7 +3322,7 @@ void Cl2DecDatFrm4(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
}
}
@ -3365,14 +3365,14 @@ void Cl2DecodeClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid
if (!nDataSize)
nDataSize = pFrameTable[nCel + 1] - pFrameTable[nCel];
gpBufEnd -= 768;
gpBufEnd -= BUFFER_WIDTH;
Cl2DecDatClrHL(
&gpBuffer[sx + PitchTbl[sy - 16 * CelSkip]],
pRLEBytes + nDataStart,
nDataSize - nDataStart,
nWidth,
col);
gpBufEnd += 768;
gpBufEnd += BUFFER_WIDTH;
}
// 69CF0C: using guessed type int gpBufEnd;
@ -3411,8 +3411,8 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
sub ebx, eax
mov [edi+eax], dl
label2:
mov [edi-768], dl
mov [edi+768], dl
mov [edi-BUFFER_WIDTH], dl
mov [edi+BUFFER_WIDTH], dl
dec eax
lea edi, [edi+1]
jnz label2
@ -3432,8 +3432,8 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
jz label6
mov [edi-1], dl
mov [edi+1], dl
mov [edi-768], dl
mov [edi+768], dl
mov [edi-BUFFER_WIDTH], dl
mov [edi+BUFFER_WIDTH], dl
label6:
dec eax
lea edi, [edi+1]
@ -3442,7 +3442,7 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
test ebx, ebx
jnz label13
mov ebx, nWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
jmp label13
label9:
@ -3460,7 +3460,7 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
sub ebx, edx
jnz label12
mov ebx, nWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
label12:
test eax, eax
@ -3495,14 +3495,14 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
dst[-1] = col;
dst[width] = col;
while (width) {
dst[-768] = col;
dst[768] = col;
dst[-BUFFER_WIDTH] = col;
dst[BUFFER_WIDTH] = col;
dst++;
width--;
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
}
@ -3514,15 +3514,15 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
if (*src++) {
dst[-1] = col;
dst[1] = col;
dst[-768] = col;
dst[768] = col;
dst[-BUFFER_WIDTH] = col;
dst[BUFFER_WIDTH] = col;
}
dst++;
width--;
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
} else {
@ -3542,7 +3542,7 @@ void Cl2DecDatClrHL(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth,
}
if (!w) {
w = nWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
}
}
@ -3660,7 +3660,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
test ebx, ebx
jnz label11
mov ebx, sgnWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
jmp label11
label7:
@ -3678,7 +3678,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
sub ebx, edx
jnz label10
mov ebx, sgnWidth
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
label10:
test eax, eax
@ -3720,7 +3720,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
}
if (!w) {
w = sgnWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
}
@ -3736,7 +3736,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
}
if (!w) {
w = sgnWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
continue;
} else {
@ -3756,7 +3756,7 @@ void Cl2DecDatLightTbl2(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWi
}
if (!w) {
w = sgnWidth;
dst -= 768 + w;
dst -= BUFFER_WIDTH + w;
}
}
}

4
Source/inv.cpp

@ -141,7 +141,7 @@ void InvDrawSlotBack(int X, int Y, int W, int H)
label5:
inc edi
loop label2
sub edi, 768
sub edi, BUFFER_WIDTH
sub edi, ebx
dec edx
jnz label1
@ -150,7 +150,7 @@ void InvDrawSlotBack(int X, int Y, int W, int H)
int wdt, hgt;
BYTE pix;
for (hgt = H; hgt; hgt--, dst -= 768 + W) {
for (hgt = H; hgt; hgt--, dst -= BUFFER_WIDTH + W) {
for (wdt = W; wdt; wdt--) {
pix = *dst;
if (pix >= PAL16_BLUE) {

4
Source/items.cpp

@ -2935,7 +2935,7 @@ void DrawULine(int y)
mov edi, esi
add esi, SCREENXY(26, 25)
add edi, yy
mov ebx, 768 - 266
mov ebx, BUFFER_WIDTH - 266
mov edx, 3
copyline:
mov ecx, 266 / 4
@ -2953,7 +2953,7 @@ void DrawULine(int y)
src = &gpBuffer[SCREENXY(26, 25)];
dst = &gpBuffer[PitchTbl[SStringY[y] + 198] + 26 + 64];
for (i = 0; i < 3; i++, src += 768, dst += 768)
for (i = 0; i < 3; i++, src += BUFFER_WIDTH, dst += BUFFER_WIDTH)
memcpy(dst, src, 266);
#endif
}

4
Source/minitext.cpp

@ -143,7 +143,7 @@ void PrintQTextChr(int sx, int sy, BYTE *pCelBuff, int nCel)
sub edx, eax
jnz label2
label8:
sub edi, 768 + 22
sub edi, BUFFER_WIDTH + 22
cmp ebx, esi
jnz label1
}
@ -157,7 +157,7 @@ void PrintQTextChr(int sx, int sy, BYTE *pCelBuff, int nCel)
src = &pCelBuff[pFrameTable[0]];
end = &src[pFrameTable[1] - pFrameTable[0]];
for (; src != end; dst -= 768 + 22) {
for (; src != end; dst -= BUFFER_WIDTH + 22) {
for (i = 22; i;) {
width = *src++;
if (!(width & 0x80)) {

86
Source/scrollrt.cpp

@ -552,27 +552,27 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag)
drawLowerScreen(dst);
}
arch_draw_type = 0;
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[3];
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[5];
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[7];
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[9];
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[11];
if (level_cel_block != 0 && leveltype == DTYPE_HELL) {
drawLowerScreen(dst);
@ -615,7 +615,7 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag)
}
arch_draw_type = 0;
for (i = 2; i < MicroTileLen; i += 2) {
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[i];
if (level_cel_block != 0) {
drawLowerScreen(dst);
@ -648,27 +648,27 @@ void scrollrt_draw_lower(int x, int y, int sx, int sy, int chunks, int eflag)
drawLowerScreen(dst);
}
arch_draw_type = 0;
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[2];
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[4];
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[6];
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[8];
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[10];
if (level_cel_block != 0 && leveltype == DTYPE_HELL) {
drawLowerScreen(dst);
@ -775,7 +775,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy,
DrawClippedPlayer(p, sx, sy - 1, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, 0, 8);
if(eflag && pPlayer->_peflag != 0) {
if(pPlayer->_peflag == 2) {
scrollrt_draw_clipped_e_flag(pBuff - (768 * 16 + 96), sx - 2, sy + 1, dx - 96, dy - 16);
scrollrt_draw_clipped_e_flag(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, dx - 96, dy - 16);
}
scrollrt_draw_clipped_e_flag(pBuff - 64, sx - 1, sy + 1, dx - 64, dy);
}
@ -818,7 +818,7 @@ void scrollrt_draw_clipped_dungeon(BYTE *pBuff, int sx, int sy, int dx, int dy,
DrawClippedPlayer(p, sx, sy, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, 0, 8);
if(eflag && pPlayer->_peflag != 0) {
if(pPlayer->_peflag == 2) {
scrollrt_draw_clipped_e_flag(pBuff - (768 * 16 + 96), sx - 2, sy + 1, dx - 96, dy - 16);
scrollrt_draw_clipped_e_flag(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, dx - 96, dy - 16);
}
scrollrt_draw_clipped_e_flag(pBuff - 64, sx - 1, sy + 1, dx - 64, dy);
}
@ -1025,7 +1025,7 @@ void scrollrt_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int a4, int a5)
dst = pBuff;
arch_draw_type = 0;
for (i = 2; i < MicroTileLen; i += 2) {
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[i];
if (level_cel_block != 0) {
drawLowerScreen(dst);
@ -1059,7 +1059,7 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu
level_piece_id = dPiece[x][y];
light_table_index = dLight[x][y];
if (level_piece_id != 0) {
dst = &gpBuffer[sx - (768 * 32 - 32) + PitchTbl[sy]];
dst = &gpBuffer[sx - (BUFFER_WIDTH * 32 - 32) + PitchTbl[sy]];
cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]);
for (i = 0; i < (MicroTileLen >> 1) - 1; i++) {
if (skipChunks <= i) {
@ -1068,10 +1068,10 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu
drawLowerScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
if (CelSkip < 8) {
scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - 768 * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0);
scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0);
}
}
}
@ -1092,7 +1092,7 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu
level_piece_id = dPiece[x][y];
light_table_index = dLight[x][y];
if (level_piece_id != 0) {
dst = &gpBuffer[sx - 768 * 32 + PitchTbl[sy]];
dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]];
cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]);
i = 0;
while (i < (MicroTileLen >> 1) - 1) {
@ -1107,10 +1107,10 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu
}
}
i++;
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
if (CelSkip < 8) {
scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - 768 * 32 * (skipChunks + 1)], x, y, skipChunks, CelSkip, sx, sy, 1);
scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 32 * (skipChunks + 1)], x, y, skipChunks, CelSkip, sx, sy, 1);
}
}
}
@ -1124,7 +1124,7 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu
level_piece_id = dPiece[x][y];
light_table_index = dLight[x][y];
if (level_piece_id != 0) {
dst = &gpBuffer[sx - 768 * 32 + PitchTbl[sy]];
dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]];
cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]);
for (i = 0; i < (MicroTileLen >> 1) - 1; i++) {
if (skipChunks <= i) {
@ -1133,10 +1133,10 @@ void scrollrt_draw_lower_2(int x, int y, int sx, int sy, int chunks, int skipChu
drawLowerScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
if (CelSkip < 8) {
scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - 768 * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0);
scrollrt_draw_clipped_dungeon_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * CelSkip], x, y, skipChunks, CelSkip, sx, sy, 0);
}
}
}
@ -1239,7 +1239,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks
DrawClippedPlayer(p, sx, sy - 1, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, CelSkip, 8);
if(eflag && pPlayer->_peflag != 0) {
if(pPlayer->_peflag == 2) {
scrollrt_draw_clipped_e_flag_2(pBuff - (768 * 16 + 96), sx - 2, sy + 1, skipChunks, CelSkip, dx - 96, dy - 16);
scrollrt_draw_clipped_e_flag_2(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, skipChunks, CelSkip, dx - 96, dy - 16);
}
scrollrt_draw_clipped_e_flag_2(pBuff - 64, sx - 1, sy + 1, skipChunks, CelSkip, dx - 64, dy);
}
@ -1282,7 +1282,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks
DrawClippedPlayer(p, sx, sy, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, CelSkip, 8);
if(eflag && pPlayer->_peflag != 0) {
if(pPlayer->_peflag == 2) {
scrollrt_draw_clipped_e_flag_2(pBuff - (768 * 16 + 96), sx - 2, sy + 1, skipChunks, CelSkip, dx - 96, dy - 16);
scrollrt_draw_clipped_e_flag_2(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, skipChunks, CelSkip, dx - 96, dy - 16);
}
scrollrt_draw_clipped_e_flag_2(pBuff - 64, sx - 1, sy + 1, skipChunks, CelSkip, dx - 64, dy);
}
@ -1368,7 +1368,7 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s
level_piece_id = dPiece[x][y];
light_table_index = dLight[x][y];
dst = &pBuff[768 * 32 * skipChunks];
dst = &pBuff[BUFFER_WIDTH * 32 * skipChunks];
cel_transparency_active = (unsigned char)(nTransTable[level_piece_id] & TransList[dTransVal[x][y]]);
pMap = &dpiece_defs_map_1[IsometricCoord(x, y)];
@ -1383,7 +1383,7 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s
drawLowerScreen(dst + 32);
}
case 1:
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[4];
if (level_cel_block != 0) {
drawLowerScreen(dst);
@ -1393,7 +1393,7 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s
drawLowerScreen(dst + 32);
}
case 2:
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[6];
if (level_cel_block != 0) {
drawLowerScreen(dst);
@ -1403,7 +1403,7 @@ void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, s
drawLowerScreen(dst + 32);
}
case 3:
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
level_cel_block = pMap->mt[8];
if (level_cel_block != 0) {
drawLowerScreen(dst);
@ -1453,21 +1453,21 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks
arch_draw_type = 0;
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
if (capChunks >= 1) {
level_cel_block = pMap->mt[3];
if (level_cel_block != 0) {
drawUpperScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
if (capChunks >= 2) {
level_cel_block = pMap->mt[5];
if (level_cel_block != 0) {
drawUpperScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
if (capChunks >= 3) {
level_cel_block = pMap->mt[7];
if (level_cel_block != 0) {
@ -1505,7 +1505,7 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks
}
arch_draw_type = 0;
for (i = 1; i < (MicroTileLen >> 1) - 1; i++) {
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
if (capChunks >= i) {
level_cel_block = pMap->mt[2 * i];
if (level_cel_block != 0) {
@ -1542,21 +1542,21 @@ void scrollrt_draw_upper(int x, int y, int sx, int sy, int chunks, int capChunks
}
}
arch_draw_type = 0;
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
if (capChunks >= 1) {
level_cel_block = pMap->mt[2];
if (level_cel_block != 0) {
drawUpperScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
if (capChunks >= 2) {
level_cel_block = pMap->mt[4];
if (level_cel_block != 0) {
drawUpperScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
if (capChunks >= 3) {
level_cel_block = pMap->mt[6];
if (level_cel_block != 0) {
@ -1660,7 +1660,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa
DrawPlayer(p, sx, sy - 1, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, 0, CelCap);
if (eflag && pPlayer->_peflag != 0) {
if (pPlayer->_peflag == 2) {
scrollrt_draw_e_flag(pBuff - (768 * 16 + 96), sx - 2, sy + 1, capChunks, CelCap, dx - 96, dy - 16);
scrollrt_draw_e_flag(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, capChunks, CelCap, dx - 96, dy - 16);
}
scrollrt_draw_e_flag(pBuff - 64, sx - 1, sy + 1, capChunks, CelCap, dx - 64, dy);
}
@ -1703,7 +1703,7 @@ void scrollrt_draw_dungeon(BYTE *pBuff, int sx, int sy, int capChunks, int CelCa
DrawPlayer(p, sx, sy, px, py, pPlayer->_pAnimData, pPlayer->_pAnimFrame, pPlayer->_pAnimWidth, 0, CelCap);
if (eflag && pPlayer->_peflag != 0) {
if (pPlayer->_peflag == 2) {
scrollrt_draw_e_flag(pBuff - (768 * 16 + 96), sx - 2, sy + 1, capChunks, CelCap, dx - 96, dy - 16);
scrollrt_draw_e_flag(pBuff - (BUFFER_WIDTH * 16 + 96), sx - 2, sy + 1, capChunks, CelCap, dx - 96, dy - 16);
}
scrollrt_draw_e_flag(pBuff - 64, sx - 1, sy + 1, capChunks, CelCap, dx - 64, dy);
}
@ -1905,7 +1905,7 @@ void scrollrt_draw_e_flag(BYTE *pBuff, int x, int y, int capChunks, int CelCap,
arch_draw_type = 0;
for (i = 1; i < (MicroTileLen >> 1) - 1; i++) {
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
if (capChunks >= i) {
level_cel_block = pMap->mt[2 * i];
if (level_cel_block != 0) {
@ -2039,7 +2039,7 @@ void DrawZoom(int x, int y)
add edi, edx
add esi, ecx
mov ebx, edi
add ebx, 768
add ebx, BUFFER_WIDTH
mov edx, 176
label1:
mov ecx, wdt
@ -2053,7 +2053,7 @@ void DrawZoom(int x, int y)
add ebx, 2
dec ecx
jnz label2
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, wdt
sub esi, eax
add eax, eax
@ -2068,9 +2068,9 @@ void DrawZoom(int x, int y)
src = &gpBuffer[nSrcOff];
dst1 = &gpBuffer[nDstOff];
dst2 = &gpBuffer[nDstOff + 768];
dst2 = &gpBuffer[nDstOff + BUFFER_WIDTH];
for (hgt = 176; hgt != 0; hgt--, src -= 768 + wdt, dst1 -= 2 * (768 + wdt), dst2 -= 2 * (768 + wdt)) {
for (hgt = 176; 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;

8
Source/stores.cpp

@ -201,12 +201,12 @@ void DrawSLine(int y)
xy = SCREENXY(26, 25);
yy = PitchTbl[SStringY[y] + 198] + 26 + 64;
width = 586 / 4;
line = 768 - 586;
line = BUFFER_WIDTH - 586;
} else {
xy = SCREENXY(346, 25);
yy = PitchTbl[SStringY[y] + 198] + 346 + 64;
width = 266 / 4;
line = 768 - 266;
line = BUFFER_WIDTH - 266;
}
/// ASSERT: assert(gpBuffer);
@ -235,8 +235,8 @@ void DrawSLine(int y)
src = &gpBuffer[xy];
dst = &gpBuffer[yy];
for (i = 0; i < 3; i++, src += 768, dst += 768)
memcpy(dst, src, 768 - line);
for (i = 0; i < 3; i++, src += BUFFER_WIDTH, dst += BUFFER_WIDTH)
memcpy(dst, src, BUFFER_WIDTH - line);
#endif
}

66
Source/town.cpp

@ -17,7 +17,7 @@ void town_clear_upper_buf(BYTE *pBuff)
mov ecx, ebx
rep stosd
add edi, edx
sub edi, 768 + 64
sub edi, BUFFER_WIDTH + 64
or edx, edx
jz label2
sub edx, 2
@ -33,7 +33,7 @@ void town_clear_upper_buf(BYTE *pBuff)
mov ecx, ebx
rep stosd
add edi, edx
sub edi, 768 + 64
sub edi, BUFFER_WIDTH + 64
dec ebx
add edx, 2
cmp edx, 32
@ -47,13 +47,13 @@ void town_clear_upper_buf(BYTE *pBuff)
dst = pBuff;
for (i = 30, j = 1; i >= 0 && dst >= gpBufEnd; i -= 2, j++, dst -= 768 + 64) {
for (i = 30, j = 1; i >= 0 && dst >= gpBufEnd; i -= 2, j++, dst -= BUFFER_WIDTH + 64) {
dst += i;
for (k = 0; k < 4 * j; k++)
*dst++ = 0;
dst += i;
}
for (i = 2, j = 15; i != 32 && dst >= gpBufEnd; i += 2, j--, dst -= 768 + 64) {
for (i = 2, j = 15; i != 32 && dst >= gpBufEnd; i += 2, j--, dst -= BUFFER_WIDTH + 64) {
dst += i;
for (k = 0; k < 4 * j; k++)
*dst++ = 0;
@ -83,7 +83,7 @@ void town_clear_low_buf(BYTE *pBuff)
rep stosd
add edi, edx
label3:
sub edi, 768 + 64
sub edi, BUFFER_WIDTH + 64
or edx, edx
jz label4
sub edx, 2
@ -103,7 +103,7 @@ void town_clear_low_buf(BYTE *pBuff)
rep stosd
add edi, edx
label7:
sub edi, 768 + 64
sub edi, BUFFER_WIDTH + 64
dec ebx
add edx, 2
cmp edx, 32
@ -115,7 +115,7 @@ void town_clear_low_buf(BYTE *pBuff)
dst = pBuff;
for (i = 30, j = 1; i >= 0; i -= 2, j++, dst -= 768 + 64) {
for (i = 30, j = 1; i >= 0; i -= 2, j++, dst -= BUFFER_WIDTH + 64) {
if (dst < gpBufEnd) {
dst += i;
for (k = 0; k < 4 * j; k++)
@ -125,7 +125,7 @@ void town_clear_low_buf(BYTE *pBuff)
dst += 64;
}
}
for (i = 2, j = 15; i != 32; i += 2, j--, dst -= 768 + 64) {
for (i = 2, j = 15; i != 32; i += 2, j--, dst -= BUFFER_WIDTH + 64) {
if (dst < gpBufEnd) {
dst += i;
for (k = 0; k < 4 * j; k++)
@ -156,7 +156,7 @@ void town_special_lower(BYTE *pBuff, int nCel)
mov esi, pSpecialCels
add esi, [ebx]
mov edi, pBuff
mov eax, 768 + 64
mov eax, BUFFER_WIDTH + 64
mov w, eax
mov ebx, end
add ebx, esi
@ -210,7 +210,7 @@ void town_special_lower(BYTE *pBuff, int nCel)
dst = pBuff;
end = &src[pFrameTable[nCel + 1] - pFrameTable[nCel]];
for(; src != end; dst -= 768 + 64) {
for(; src != end; dst -= BUFFER_WIDTH + 64) {
for(w = 64; w;) {
width = *src++;
if(!(width & 0x80)) {
@ -270,7 +270,7 @@ void town_special_upper(BYTE *pBuff, int nCel)
mov esi, pSpecialCels
add esi, [ebx]
mov edi, pBuff
mov eax, 768 + 64
mov eax, BUFFER_WIDTH + 64
mov w, eax
mov ebx, end
add ebx, esi
@ -322,7 +322,7 @@ void town_special_upper(BYTE *pBuff, int nCel)
dst = pBuff;
end = &src[pFrameTable[nCel + 1] - pFrameTable[nCel]];
for(; src != end; dst -= 768 + 64) {
for(; src != end; dst -= BUFFER_WIDTH + 64) {
for(w = 64; w;) {
width = *src++;
if(!(width & 0x80)) {
@ -380,7 +380,7 @@ void town_draw_clipped_e_flag(BYTE *pBuff, int x, int y, int sx, int sy)
if (level_cel_block != 0) {
drawLowerScreen(dst + 32);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
town_draw_clipped_town(pBuff, x, y, sx, sy, 0);
@ -473,7 +473,7 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag)
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
town_draw_clipped_town(&gpBuffer[sx + PitchTbl[sy]], x, y, sx, sy, 0);
} else {
@ -502,7 +502,7 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag)
if (level_cel_block != 0) {
drawLowerScreen(dst + 32);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
town_draw_clipped_town(&gpBuffer[sx + PitchTbl[sy]], x, y, sx, sy, 1);
} else {
@ -527,7 +527,7 @@ void town_draw_lower(int x, int y, int sx, int sy, int a5, int some_flag)
if (level_cel_block != 0) {
drawLowerScreen(dst);
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
town_draw_clipped_town(&gpBuffer[sx + PitchTbl[sy]], x, y, sx, sy, 0);
} else {
@ -548,7 +548,7 @@ void town_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int a4, int a5, int s
if (a4 == 0) {
dst = pBuff;
} else {
dst = &pBuff[768 * 32 * a4];
dst = &pBuff[BUFFER_WIDTH * 32 * a4];
}
pMap = &dpiece_defs_map_1[IsometricCoord(x, y)];
@ -564,7 +564,7 @@ void town_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int a4, int a5, int s
drawLowerScreen(dst + 32);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
if (a5 < 8) {
@ -650,7 +650,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl
if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) {
level_cel_block = dPiece[x][y];
if (level_cel_block != 0) {
dst = &gpBuffer[sx - (768 * 32 - 32) + PitchTbl[sy]];
dst = &gpBuffer[sx - (BUFFER_WIDTH * 32 - 32) + PitchTbl[sy]];
pMap = &dpiece_defs_map_1[IsometricCoord(x, y)];
for (i = 0; i < 7; i++) {
if (a6 <= i) {
@ -659,7 +659,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl
drawLowerScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
if (dir < 8) {
town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0);
@ -679,7 +679,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl
if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) {
level_cel_block = dPiece[x][y];
if (level_cel_block != 0) {
dst = &gpBuffer[sx - 768 * 32 + PitchTbl[sy]];
dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]];
pMap = &dpiece_defs_map_1[IsometricCoord(x, y)];
for (i = 0; i < 7; i++) {
if (a6 <= i) {
@ -692,10 +692,10 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl
drawLowerScreen(dst + 32);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
if (dir < 8) {
town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy] - 768 * 16 * dir], x, y, a6, dir, sx, sy, 1);
town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy] - BUFFER_WIDTH * 16 * dir], x, y, a6, dir, sx, sy, 1);
}
} else {
town_clear_low_buf(&gpBuffer[sx + PitchTbl[sy]]);
@ -712,7 +712,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl
if (y >= 0 && y < MAXDUNY && x >= 0 && x < MAXDUNX) {
level_cel_block = dPiece[x][y];
if (level_cel_block != 0) {
dst = &gpBuffer[sx - 768 * 32 + PitchTbl[sy]];
dst = &gpBuffer[sx - BUFFER_WIDTH * 32 + PitchTbl[sy]];
pMap = &dpiece_defs_map_1[IsometricCoord(x, y)];
for (i = 0; i < 7; i++) {
if (a6 <= i) {
@ -721,7 +721,7 @@ void town_draw_lower_2(int x, int y, int sx, int sy, int a5, int a6, int some_fl
drawLowerScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
if (dir < 8) {
town_draw_clipped_town_2(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0);
@ -755,7 +755,7 @@ void town_draw_e_flag(BYTE *pBuff, int x, int y, int a4, int dir, int sx, int sy
drawUpperScreen(dst + 32);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
town_draw_town_all(pBuff, x, y, a4, dir, sx, sy, 0);
@ -856,7 +856,7 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag
drawUpperScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0);
} else {
@ -887,7 +887,7 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag
drawUpperScreen(dst + 32);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 1);
} else {
@ -914,7 +914,7 @@ void town_draw_upper(int x, int y, int sx, int sy, int a5, int a6, int some_flag
drawUpperScreen(dst);
}
}
dst -= 768 * 32;
dst -= BUFFER_WIDTH * 32;
}
town_draw_town_all(&gpBuffer[sx + PitchTbl[sy]], x, y, a6, dir, sx, sy, 0);
} else {
@ -1164,7 +1164,7 @@ void T_DrawZoom(int x, int y)
add edi, edx
add esi, ecx
mov ebx, edi
add ebx, 768
add ebx, BUFFER_WIDTH
mov edx, 176
label1:
mov ecx, wdt
@ -1178,7 +1178,7 @@ void T_DrawZoom(int x, int y)
add ebx, 2
dec ecx
jnz label2
mov eax, 768
mov eax, BUFFER_WIDTH
add eax, wdt
sub esi, eax
add eax, eax
@ -1193,9 +1193,9 @@ void T_DrawZoom(int x, int y)
src = &gpBuffer[nSrcOff];
dst1 = &gpBuffer[nDstOff];
dst2 = &gpBuffer[nDstOff + 768];
dst2 = &gpBuffer[nDstOff + BUFFER_WIDTH];
for (hgt = 176; hgt != 0; hgt--, src -= 768 + wdt, dst1 -= 2 * (768 + wdt), dst2 -= 2 * (768 + wdt)) {
for (hgt = 176; 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;

Loading…
Cancel
Save