Browse Source

Merge branch 'master' of github.com:diasurgical/devilution

pull/44/head
Anders Jenbo 7 years ago
parent
commit
189ce6ec2f
  1. 2
      README.md
  2. 613
      Source/control.cpp
  3. 6
      Source/control.h
  4. 8
      Source/drlg_l1.cpp
  5. 24
      Source/drlg_l2.cpp
  6. 71
      Source/drlg_l4.cpp
  7. 2
      Source/drlg_l4.h
  8. 72
      Source/engine.cpp
  9. 4
      Source/engine.h
  10. 4
      Source/error.cpp
  11. 2
      Source/gendung.cpp
  12. 2
      Source/gendung.h
  13. 42
      Source/gmenu.cpp
  14. 6
      Source/help.cpp
  15. 8
      Source/interfac.cpp
  16. 2
      Source/inv.cpp
  17. 136
      Source/items.cpp
  18. 6
      Source/items.h
  19. 8
      Source/lighting.cpp
  20. 19
      Source/minitext.cpp
  21. 1174
      Source/missiles.cpp
  22. 20
      Source/objects.cpp
  23. 4
      Source/plrmsg.cpp
  24. 4
      Source/quests.cpp
  25. 84
      Source/stores.cpp
  26. 4
      Source/town.cpp

2
README.md

@ -90,7 +90,7 @@ Install the some tools using [Homebrew](https://brew.sh/):
brew install automake autoconf libtool
```
Get and build the dependencies
Get and build the dependencies
```
$ ./xcode-build.sh --get-libs --build-libs
```

613
Source/control.cpp

@ -21,7 +21,7 @@ int dropGoldValue; // idb
BOOL drawmanaflag; // idb
BOOL chrbtnactive;
char sgszTalkMsg[80];
void *pPanelText;
BYTE *pPanelText;
int frame_4B8800; // idb
char *pLifeBuff;
void *pBtmBuff;
@ -111,33 +111,23 @@ const int lineoffset[25] = {
768 * 606 + 241,
768 * 617 + 241
};
const unsigned char fontidx[256] = {
0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 1, 67, 117,
101, 97, 97, 97, 97, 99, 101, 101, 101, 105,
105, 105, 65, 65, 69, 97, 65, 111, 111, 111,
117, 117, 121, 79, 85, 99, 76, 89, 80, 102,
97, 105, 111, 117, 110, 78, 97, 111, 63, 1,
1, 1, 1, 33, 60, 62, 111, 43, 50, 51,
39, 117, 80, 46, 44, 49, 48, 62, 1, 1,
1, 63, 65, 65, 65, 65, 65, 65, 65, 67,
69, 69, 69, 69, 73, 73, 73, 73, 68, 78,
79, 79, 79, 79, 79, 88, 48, 85, 85, 85,
85, 89, 98, 66, 97, 97, 97, 97, 97, 97,
97, 99, 101, 101, 101, 101, 105, 105, 105, 105,
111, 110, 111, 111, 111, 111, 111, 47, 48, 117,
117, 117, 117, 121, 98, 121
const unsigned char gbFontTransTbl[256] = {
'\0', 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
' ', '!', '\"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 0x01,
'C', 'u', 'e', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'i', 'i', 'i', 'A', 'A',
'E', 'a', 'A', 'o', 'o', 'o', 'u', 'u', 'y', 'O', 'U', 'c', 'L', 'Y', 'P', 'f',
'a', 'i', 'o', 'u', 'n', 'N', 'a', 'o', '?', 0x01, 0x01, 0x01, 0x01, '!', '<', '>',
'o', '+', '2', '3', '\'', 'u', 'P', '.', ',', '1', '0', '>', 0x01, 0x01, 0x01, '?',
'A', 'A', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I',
'D', 'N', 'O', 'O', 'O', 'O', 'O', 'X', '0', 'U', 'U', 'U', 'U', 'Y', 'b', 'B',
'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i',
'o', 'n', 'o', 'o', 'o', 'o', 'o', '/', '0', 'u', 'u', 'u', 'u', 'y', 'b', 'y'
};
/* data */
@ -662,162 +652,296 @@ void __fastcall ToggleSpell(int slot)
}
// 52571C: using guessed type int drawpanflag;
void __fastcall CPrintString(int No, unsigned int glyph, unsigned char col)
void __fastcall CPrintString(int nOffset, int nCel, char col)
{
int *v3; // ebx
char *v4; // esi
char *v5; // edi
INT_PTR v6; // ebx
signed int v7; // edx
unsigned int v8; // eax
unsigned int v9; // ecx
char v10; // cf
unsigned int v11; // ecx
signed int v12; // edx
int v13; // eax
int v14; // ecx
char v15; // al
signed int v16; // edx
int v17; // eax
int v18; // ecx
char v19; // al
signed int v20; // edx
int v21; // eax
int v22; // ecx
char v23; // al
v3 = (int *)((char *)pPanelText + 4 * glyph);
v4 = (char *)pPanelText + *v3;
v5 = (char *)gpBuffer + No;
v6 = (INT_PTR)&v4[v3[1] - *v3];
if ((_BYTE)col) {
if ((unsigned char)col == 1) {
do {
v12 = 13;
do {
while (1) {
v13 = (unsigned char)*v4++;
if ((v13 & 0x80u) == 0)
break;
_LOBYTE(v13) = -(char)v13;
v5 += v13;
v12 -= v13;
if (!v12)
goto LABEL_28;
/// ASSERT: assert(gpBuffer);
#if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
__asm {
mov ebx, pPanelText
mov eax, nCel
shl eax, 2
add ebx, eax
mov edx, [ebx+4]
sub edx, [ebx]
mov esi, pPanelText
add esi, [ebx]
mov edi, gpBuffer
add edi, nOffset
mov ebx, edx
add ebx, esi
xor edx, edx
mov dl, col
cmp edx, COL_WHITE
jz c0_label1
cmp edx, COL_BLUE
jz c1_label1
cmp edx, COL_RED
jz c2_label1
jmp d_label1
// Case 0
c0_label1:
mov edx, 13
c0_label2:
xor eax, eax
lodsb
or al, al
js c0_label6
sub edx, eax
mov ecx, eax
shr ecx, 1
jnb c0_label3
movsb
jecxz c0_label5
c0_label3:
shr ecx, 1
jnb c0_label4
movsw
jecxz c0_label5
c0_label4:
rep movsd
c0_label5:
or edx, edx
jz c0_label7
jmp c0_label2
c0_label6:
neg al
add edi, eax
sub edx, eax
jnz c0_label2
c0_label7:
sub edi, 768 + 13
cmp ebx, esi
jnz c0_label1
jmp labret
// Case 1
c1_label1:
mov edx, 13
c1_label2:
xor eax, eax
lodsb
or al, al
js c1_label6
sub edx, eax
mov ecx, eax
c1_label3:
lodsb
cmp al, PAL16_GRAY + 13
ja c1_label4
cmp al, PAL16_GRAY
jb c1_label5
sub al, PAL16_GRAY - (PAL16_BLUE + 2)
jmp c1_label5
c1_label4:
mov al, PAL16_BLUE + 15
c1_label5:
stosb
loop c1_label3
or edx, edx
jz c1_label7
jmp c1_label2
c1_label6:
neg al
add edi, eax
sub edx, eax
jnz c1_label2
c1_label7:
sub edi, 768 + 13
cmp ebx, esi
jnz c1_label1
jmp labret
// Case 2
c2_label1:
mov edx, 13
c2_label2:
xor eax, eax
lodsb
or al, al
js c2_label5
sub edx, eax
mov ecx, eax
c2_label3:
lodsb
cmp al, PAL16_GRAY
jb c2_label4
sub al, PAL16_GRAY - PAL16_RED
c2_label4:
stosb
loop c2_label3
or edx, edx
jz c2_label6
jmp c2_label2
c2_label5:
neg al
add edi, eax
sub edx, eax
jnz c2_label2
c2_label6:
sub edi, 768 + 13
cmp ebx, esi
jnz c2_label1
jmp labret
// Default
d_label1:
mov edx, 13
d_label2:
xor eax, eax
lodsb
or al, al
js d_label6
sub edx, eax
mov ecx, eax
d_label3:
lodsb
cmp al, PAL16_GRAY
jb d_label5
cmp al, PAL16_GRAY + 14
jnb d_label4
sub al, PAL16_GRAY - (PAL16_YELLOW + 2)
jmp d_label5
d_label4:
mov al, PAL16_YELLOW + 15
d_label5:
stosb
loop d_label3
or edx, edx
jz d_label7
jmp d_label2
d_label6:
neg al
add edi, eax
sub edx, eax
jnz d_label2
d_label7:
sub edi, 768 + 13
cmp ebx, esi
jnz d_label1
labret:
}
#else
int i;
BYTE width, pix;
BYTE *src, *dst, *end;
DWORD *pFrameTable;
pFrameTable = (DWORD *)&pPanelText[4 * nCel];
src = &pPanelText[pFrameTable[0]];
end = &src[pFrameTable[1] - pFrameTable[0]];
dst = &gpBuffer[nOffset];
switch(col) {
case COL_WHITE:
for(; src != end; dst -= 768 + 13) {
for(i = 13; i;) {
width = *src++;
if(!(width & 0x80)) {
i -= width;
if(width & 1) {
dst[0] = src[0];
src++;
dst++;
}
v12 -= v13;
v14 = v13;
do {
v15 = *v4++;
if ((unsigned char)v15 > 0xFDu) {
v15 = -65;
} else if ((unsigned char)v15 >= 0xF0u) {
v15 -= 62;
}
*v5++ = v15;
--v14;
} while (v14);
} while (v12);
LABEL_28:
v5 -= 781;
} while ((char *)v6 != v4);
} else if ((unsigned char)col == 2) {
do {
v16 = 13;
do {
while (1) {
v17 = (unsigned char)*v4++;
if ((v17 & 0x80u) == 0)
break;
_LOBYTE(v17) = -(char)v17;
v5 += v17;
v16 -= v17;
if (!v16)
goto LABEL_39;
width >>= 1;
if(width & 1) {
dst[0] = src[0];
dst[1] = src[1];
src += 2;
dst += 2;
}
v16 -= v17;
v18 = v17;
do {
v19 = *v4++;
if ((unsigned char)v19 >= 0xF0u)
v19 -= 16;
*v5++ = v19;
--v18;
} while (v18);
} while (v16);
LABEL_39:
v5 -= 781;
} while ((char *)v6 != v4);
} else {
do {
v20 = 13;
do {
while (1) {
v21 = (unsigned char)*v4++;
if ((v21 & 0x80u) == 0)
break;
_LOBYTE(v21) = -(char)v21;
v5 += v21;
v20 -= v21;
if (!v20)
goto LABEL_52;
width >>= 1;
while(width) {
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
dst[3] = src[3];
src += 4;
dst += 4;
width--;
}
v20 -= v21;
v22 = v21;
do {
v23 = *v4++;
if ((unsigned char)v23 >= 0xF0u) {
if ((unsigned char)v23 >= 0xFEu)
v23 = -49;
else
v23 -= 46;
}
*v5++ = v23;
--v22;
} while (v22);
} while (v20);
LABEL_52:
v5 -= 781;
} while ((char *)v6 != v4);
} else {
width = -(char)width;
dst += width;
i -= width;
}
}
}
} else {
do {
v7 = 13;
do {
while (1) {
v8 = (unsigned char)*v4++;
if ((v8 & 0x80u) == 0)
break;
_LOBYTE(v8) = -(char)v8;
v5 += v8;
v7 -= v8;
if (!v7)
goto LABEL_15;
break;
case COL_BLUE:
for(; src != end; dst -= 768 + 13) {
for(i = 13; i;) {
width = *src++;
if(!(width & 0x80)) {
i -= width;
while(width) {
pix = *src++;
if(pix > PAL16_GRAY + 13)
pix = PAL16_BLUE + 15;
else if(pix >= PAL16_GRAY)
pix -= PAL16_GRAY - (PAL16_BLUE + 2);
*dst++ = pix;
width--;
}
} else {
width = -(char)width;
dst += width;
i -= width;
}
v7 -= v8;
v9 = v8 >> 1;
if (v8 & 1) {
*v5++ = *v4++;
if (!v9)
continue;
}
}
break;
case COL_RED:
for(; src != end; dst -= 768 + 13) {
for(i = 13; i;) {
width = *src++;
if(!(width & 0x80)) {
i -= width;
while(width) {
pix = *src++;
if(pix >= PAL16_GRAY)
pix -= PAL16_GRAY - PAL16_RED;
*dst++ = pix;
width--;
}
} else {
width = -(char)width;
dst += width;
i -= width;
}
v10 = v9 & 1;
v11 = v8 >> 2;
if (v10) {
*(_WORD *)v5 = *(_WORD *)v4;
v4 += 2;
v5 += 2;
if (!v11)
continue;
}
}
break;
default:
for(; src != end; dst -= 768 + 13) {
for(i = 13; i;) {
width = *src++;
if(!(width & 0x80)) {
i -= width;
while(width) {
pix = *src++;
if(pix >= PAL16_GRAY) {
if(pix >= PAL16_GRAY + 14)
pix = PAL16_YELLOW + 15;
else
pix -= PAL16_GRAY - (PAL16_YELLOW + 2);
}
*dst++ = pix;
width--;
}
} else {
width = -(char)width;
dst += width;
i -= width;
}
qmemcpy(v5, v4, 4 * v11);
v4 += 4 * v11;
v5 += 4 * v11;
} while (v7);
LABEL_15:
v5 -= 781;
} while ((char *)v6 != v4);
}
}
break;
}
#endif
}
void __fastcall AddPanelString(char *str, BOOL just)
@ -1482,71 +1606,56 @@ void __cdecl CheckBtnUp()
void __cdecl FreeControlPan()
{
void *v0; // ecx
void *v1; // ecx
void *v2; // ecx
void *v3; // ecx
void *v4; // ecx
void *v5; // ecx
void *v6; // ecx
void *v7; // ecx
void *v8; // ecx
void *v9; // ecx
void *v10; // ecx
void *v11; // ecx
void *v12; // ecx
void *v13; // ecx
void *v14; // ecx
void *v15; // ecx
v0 = pBtmBuff;
pBtmBuff = 0;
mem_free_dbg(v0);
v1 = pManaBuff;
pManaBuff = 0;
mem_free_dbg(v1);
v2 = pLifeBuff;
pLifeBuff = 0;
mem_free_dbg(v2);
v3 = pPanelText;
pPanelText = 0;
mem_free_dbg(v3);
v4 = pChrPanel;
pChrPanel = 0;
mem_free_dbg(v4);
v5 = pSpellCels;
pSpellCels = 0;
mem_free_dbg(v5);
v6 = pPanelButtons;
pPanelButtons = 0;
mem_free_dbg(v6);
v7 = pMultiBtns;
pMultiBtns = 0;
mem_free_dbg(v7);
v8 = pTalkBtns;
pTalkBtns = 0;
mem_free_dbg(v8);
v9 = pChrButtons;
pChrButtons = 0;
mem_free_dbg(v9);
v10 = pDurIcons;
pDurIcons = 0;
mem_free_dbg(v10);
v11 = pQLogCel;
pQLogCel = 0;
mem_free_dbg(v11);
v12 = pSpellBkCel;
pSpellBkCel = 0;
mem_free_dbg(v12);
v13 = pSBkBtnCel;
pSBkBtnCel = 0;
mem_free_dbg(v13);
v14 = pSBkIconCels;
pSBkIconCels = 0;
mem_free_dbg(v14);
v15 = pGBoxBuff;
pGBoxBuff = 0;
mem_free_dbg(v15);
void *ptr;
ptr = pBtmBuff;
pBtmBuff = NULL;
mem_free_dbg(ptr);
ptr = pManaBuff;
pManaBuff = NULL;
mem_free_dbg(ptr);
ptr = pLifeBuff;
pLifeBuff = NULL;
mem_free_dbg(ptr);
ptr = pPanelText;
pPanelText = NULL;
mem_free_dbg(ptr);
ptr = pChrPanel;
pChrPanel = NULL;
mem_free_dbg(ptr);
ptr = pSpellCels;
pSpellCels = NULL;
mem_free_dbg(ptr);
ptr = pPanelButtons;
pPanelButtons = NULL;
mem_free_dbg(ptr);
ptr = pMultiBtns;
pMultiBtns = NULL;
mem_free_dbg(ptr);
ptr = pTalkBtns;
pTalkBtns = NULL;
mem_free_dbg(ptr);
ptr = pChrButtons;
pChrButtons = NULL;
mem_free_dbg(ptr);
ptr = pDurIcons;
pDurIcons = NULL;
mem_free_dbg(ptr);
ptr = pQLogCel;
pQLogCel = NULL;
mem_free_dbg(ptr);
ptr = pSpellBkCel;
pSpellBkCel = NULL;
mem_free_dbg(ptr);
ptr = pSBkBtnCel;
pSBkBtnCel = NULL;
mem_free_dbg(ptr);
ptr = pSBkIconCels;
pSBkIconCels = NULL;
mem_free_dbg(ptr);
ptr = pGBoxBuff;
pGBoxBuff = NULL;
mem_free_dbg(ptr);
}
int __fastcall control_WriteStringToBuffer(char *str)
@ -1560,7 +1669,7 @@ int __fastcall control_WriteStringToBuffer(char *str)
if (!*str)
return 1;
++str;
v1 += fontkern[fontframe[fontidx[v2]]];
v1 += fontkern[fontframe[gbFontTransTbl[v2]]];
} while (v1 < 125);
return 0;
}
@ -1696,7 +1805,7 @@ void __fastcall control_print_info_str(int y, char *str, BOOLEAN center, int lin
goto LABEL_14;
do {
++v8;
v7 += fontkern[fontframe[fontidx[v6]]] + 2;
v7 += fontkern[fontframe[gbFontTransTbl[v6]]] + 2;
v6 = *v8;
} while (*v8);
if (v7 < 288)
@ -1709,7 +1818,7 @@ void __fastcall control_print_info_str(int y, char *str, BOOLEAN center, int lin
if (!*v5)
break;
++v5;
v9 = fontidx[v11];
v9 = gbFontTransTbl[v11];
_LOBYTE(v9) = fontframe[v9];
v10 = (unsigned char)v9;
v4 += fontkern[(unsigned char)v9] + 2;
@ -1734,7 +1843,7 @@ void __fastcall PrintGameStr(int x, int y, char *str, int color)
v5 = screen_y_times_768[y + 160] + x + 64;
for (i = *str; *v4; i = *v4) {
++v4;
v7 = fontframe[fontidx[i]];
v7 = fontframe[gbFontTransTbl[i]];
if (v7)
CPrintString(v5, v7, color);
v5 += fontkern[v7] + 1;
@ -1991,7 +2100,7 @@ void __fastcall ADD_PlrStringXY(int x, int y, int width, char *pszStr, char col)
v11 = *pszStr;
do {
++v6;
v10 += fontkern[fontframe[fontidx[v11]]] + 1;
v10 += fontkern[fontframe[gbFontTransTbl[v11]]] + 1;
v11 = *v6;
} while (*v6);
}
@ -2000,7 +2109,7 @@ void __fastcall ADD_PlrStringXY(int x, int y, int width, char *pszStr, char col)
widthb = v9 + widtha;
while (v7) {
++pszStr;
v12 = fontframe[fontidx[v7]];
v12 = fontframe[gbFontTransTbl[v7]];
v13 = v12;
v9 += fontkern[v12] + 1;
if (v12) {
@ -2037,7 +2146,7 @@ void __fastcall MY_PlrStringXY(int x, int y, int width, char *pszStr, char col,
v11 = *pszStr;
do {
++v10;
v8 += base + fontkern[fontframe[fontidx[v11]]];
v8 += base + fontkern[fontframe[gbFontTransTbl[v11]]];
v11 = *v10;
} while (*v10);
}
@ -2046,7 +2155,7 @@ void __fastcall MY_PlrStringXY(int x, int y, int width, char *pszStr, char col,
widthb = v16 + widtha;
while (v7) {
++v6;
v12 = fontframe[fontidx[v7]];
v12 = fontframe[gbFontTransTbl[v7]];
v13 = v12;
v16 += base + fontkern[v12];
if (v12) {
@ -2415,7 +2524,7 @@ void __fastcall PrintSBookStr(int x, int y, BOOLEAN cjustflag, char *pszStr, int
goto LABEL_14;
do {
++v9;
v6 += fontkern[fontframe[fontidx[v8]]] + 1;
v6 += fontkern[fontframe[gbFontTransTbl[v8]]] + 1;
v8 = *v9;
} while (*v9);
if (v6 < 222)
@ -2428,7 +2537,7 @@ void __fastcall PrintSBookStr(int x, int y, BOOLEAN cjustflag, char *pszStr, int
if (!*v5)
break;
++v5;
v10 = fontframe[fontidx[v12]];
v10 = fontframe[gbFontTransTbl[v12]];
v11 = v10;
v7 += fontkern[v10] + 1;
if (v10) {
@ -2498,7 +2607,7 @@ void __fastcall DrawGoldSplit(int amount)
v3 = tempstr[0];
for (i = 0; i < v3; v3 = tempstr[i]) {
++i;
screen_x += fontkern[fontframe[fontidx[(unsigned char)v3]]] + 1;
screen_x += fontkern[fontframe[gbFontTransTbl[(unsigned char)v3]]] + 1;
}
screen_xa = screen_x + 452;
}
@ -2703,7 +2812,7 @@ char *__fastcall control_print_talk_msg(char *msg, int x, int y, int *a4, int ju
if (!v7)
return 0;
while (1) {
v10 = fontframe[fontidx[v7]];
v10 = fontframe[gbFontTransTbl[v7]];
v11 = v10;
a3 = v8 + fontkern[v10] + 1;
if (a3 > 514)

6
Source/control.h

@ -15,7 +15,7 @@ extern int lvlbtndown; // weak
extern int dropGoldValue; // idb
extern BOOL drawmanaflag; // idb
extern BOOL chrbtnactive;
extern void *pPanelText;
extern BYTE *pPanelText;
extern int frame_4B8800; // idb
extern char *pLifeBuff;
extern void *pBtmBuff;
@ -60,7 +60,7 @@ void __cdecl DrawSpellList();
void __cdecl SetSpell();
void __fastcall SetSpeedSpell(int slot);
void __fastcall ToggleSpell(int slot);
void __fastcall CPrintString(int No, unsigned int glyph, unsigned char col); /* check arg names */
void __fastcall CPrintString(int nOffset, int nCel, char col);
void __fastcall AddPanelString(char *str, BOOL just);
void __cdecl ClearPanel();
void __fastcall DrawPanelBox(int x, int y, int w, int h, int sx, int sy);
@ -123,7 +123,7 @@ void __fastcall control_up_down(char a1);
extern const unsigned char fontframe[127];
extern const unsigned char fontkern[68];
extern const int lineoffset[25];
extern const unsigned char fontidx[256];
extern const unsigned char gbFontTransTbl[256];
/* data */

8
Source/drlg_l1.cpp

@ -474,11 +474,11 @@ void __cdecl DRLG_LoadL1SP()
void __cdecl DRLG_FreeL1SP()
{
void *v0; // ecx
void *ptr;
v0 = pSetPiece;
pSetPiece = 0;
mem_free_dbg(v0);
ptr = pSetPiece;
pSetPiece = NULL;
mem_free_dbg(ptr);
}
void __fastcall DRLG_L5(int entry)

24
Source/drlg_l2.cpp

@ -758,11 +758,11 @@ void __cdecl DRLG_LoadL2SP()
void __cdecl DRLG_FreeL2SP()
{
char *v0; // ecx
char *ptr;
v0 = pSetPiece_2;
pSetPiece_2 = 0;
mem_free_dbg(v0);
ptr = pSetPiece_2;
pSetPiece_2 = NULL;
mem_free_dbg(ptr);
}
void __fastcall DRLG_L2(int entry)
@ -1859,19 +1859,21 @@ void __fastcall AddHall(int nX1, int nY1, int nX2, int nY2, int nHd)
void __fastcall GetHall(int *nX1, int *nY1, int *nX2, int *nY2, int *nHd)
{
HALLNODE *v5; // esi
HALLNODE *v6; // ecx
HALLNODE *p1;
HALLNODE *p2;
v5 = pHallList->pNext;
p1 = pHallList->pNext;
*nX1 = pHallList->nHallx1;
*nY1 = pHallList->nHally1;
*nX2 = pHallList->nHallx2;
*nY2 = pHallList->nHally2;
*nHd = pHallList->nHalldir;
v6 = pHallList;
pHallList = 0;
mem_free_dbg(v6);
pHallList = v5;
p2 = pHallList;
pHallList = NULL;
mem_free_dbg(p2);
pHallList = p1;
}
void __fastcall ConnectHall(int nX1, int nY1, int nX2, int nY2, int nHd)

71
Source/drlg_l4.cpp

@ -308,11 +308,11 @@ void __cdecl DRLG_LoadL4SP()
void __cdecl DRLG_FreeL4SP()
{
char *v0; // ecx
char *ptr;
v0 = pSetPiece_2;
pSetPiece_2 = 0;
mem_free_dbg(v0);
ptr = pSetPiece_2;
pSetPiece_2 = NULL;
mem_free_dbg(ptr);
}
void __fastcall DRLG_L4SetSPRoom(int rx1, int ry1)
@ -442,47 +442,42 @@ void __fastcall DRLG_L4SetRoom(unsigned char *pSetPiece, int rx1, int ry1)
}
}
void __fastcall DRLG_LoadDiabQuads(BOOLEAN preflag)
void __fastcall DRLG_LoadDiabQuads(BOOL preflag)
{
BOOLEAN v1; // esi
unsigned char *v2; // edi
char *v3; // ecx
unsigned char *v4; // edi
char *v5; // ecx
unsigned char *v6; // edi
char *v7; // ecx
unsigned char *v8; // esi
v1 = preflag;
v2 = LoadFileInMem("Levels\\L4Data\\diab1.DUN", 0);
BYTE *dun;
dun = LoadFileInMem("Levels\\L4Data\\diab1.DUN", 0);
diabquad1x = l4holdx + 4;
diabquad1y = l4holdy + 4;
DRLG_L4SetRoom(v2, l4holdx + 4, l4holdy + 4);
mem_free_dbg(v2);
v3 = "Levels\\L4Data\\diab2b.DUN";
if (!v1)
v3 = "Levels\\L4Data\\diab2a.DUN";
v4 = LoadFileInMem(v3, 0);
diabquad2y = l4holdy + 1;
DRLG_L4SetRoom(dun, diabquad1x, diabquad1y);
mem_free_dbg(dun);
if (!preflag)
dun = LoadFileInMem("Levels\\L4Data\\diab2a.DUN", 0);
else
dun = LoadFileInMem("Levels\\L4Data\\diab2b.DUN", 0);
diabquad2x = 27 - l4holdx;
DRLG_L4SetRoom(v4, 27 - l4holdx, l4holdy + 1);
mem_free_dbg(v4);
v5 = "Levels\\L4Data\\diab3b.DUN";
if (!v1)
v5 = "Levels\\L4Data\\diab3a.DUN";
v6 = LoadFileInMem(v5, 0);
diabquad2y = l4holdy + 1;
DRLG_L4SetRoom(dun, diabquad2x, diabquad2y);
mem_free_dbg(dun);
if (!preflag)
dun = LoadFileInMem("Levels\\L4Data\\diab3a.DUN", 0);
else
dun = LoadFileInMem("Levels\\L4Data\\diab3b.DUN", 0);
diabquad3x = l4holdx + 1;
diabquad3y = 27 - l4holdy;
DRLG_L4SetRoom(v6, l4holdx + 1, 27 - l4holdy);
mem_free_dbg(v6);
v7 = "Levels\\L4Data\\diab4b.DUN";
if (!v1)
v7 = "Levels\\L4Data\\diab4a.DUN";
v8 = LoadFileInMem(v7, 0);
diabquad4y = 28 - l4holdy;
DRLG_L4SetRoom(dun, diabquad3x, diabquad3y);
mem_free_dbg(dun);
if (!preflag)
dun = LoadFileInMem("Levels\\L4Data\\diab4a.DUN", 0);
else
dun = LoadFileInMem("Levels\\L4Data\\diab4b.DUN", 0);
diabquad4x = 28 - l4holdx;
DRLG_L4SetRoom(v8, 28 - l4holdx, 28 - l4holdy);
mem_free_dbg(v8);
diabquad4y = 28 - l4holdy;
DRLG_L4SetRoom(dun, diabquad4x, diabquad4y);
mem_free_dbg(dun);
}
// 5289C4: using guessed type int diabquad1x;
// 5289C8: using guessed type int diabquad1y;

2
Source/drlg_l4.h

@ -26,7 +26,7 @@ void __cdecl DRLG_FreeL4SP();
void __fastcall DRLG_L4SetSPRoom(int rx1, int ry1);
void __cdecl L4SaveQuads();
void __fastcall DRLG_L4SetRoom(unsigned char *pSetPiece, int rx1, int ry1);
void __fastcall DRLG_LoadDiabQuads(BOOLEAN preflag);
void __fastcall DRLG_LoadDiabQuads(BOOL preflag);
BOOLEAN __fastcall IsDURWall(char d);
BOOLEAN __fastcall IsDLLWall(char dd);
void __cdecl L4FixRim();

72
Source/engine.cpp

@ -17,8 +17,8 @@ static CRITICAL_SECTION sgMemCrit;
int SeedCount; // weak
int dword_52B99C; // BOOLEAN valid - if x/y are in bounds
const int rand_increment = 1; // unused
const int rand_multiplier = 0x015A4E35; // unused
const int rand_increment = 1;
const int rand_multiplier = 0x015A4E35;
void __fastcall CelDrawDatOnly(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth)
{
@ -1972,34 +1972,62 @@ void __fastcall CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nC
}
// 69CF0C: using guessed type int gpBufEnd;
void __fastcall ENG_set_pixel(int screen_x, int screen_y, UCHAR pixel)
void __fastcall ENG_set_pixel(int sx, int sy, BYTE col)
{
UCHAR *v3; // edi
BYTE *dst;
/// ASSERT: assert(gpBuffer);
if(sy < 0 || sy >= 640 || sx < 64 || sx >= 704)
return;
dst = &gpBuffer[sx + screen_y_times_768[sy]];
if (screen_y >= 0 && screen_y < 640 && screen_x >= 64 && screen_x < 704) {
v3 = (UCHAR *)gpBuffer + screen_y_times_768[screen_y] + screen_x;
if (v3 < gpBufEnd)
*v3 = pixel;
#if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
__asm {
mov edi, dst
cmp edi, gpBufEnd
jnb label1
mov al, col
mov [edi], al
label1:
}
#else
if(dst < gpBufEnd)
*dst = col;
#endif
}
// 69CF0C: using guessed type int gpBufEnd;
void __fastcall engine_draw_pixel(int x, int y)
void __fastcall engine_draw_pixel(int sx, int sy)
{
_BYTE *v2; // eax
BYTE *dst;
if (dword_52B970) {
if (!dword_52B99C || x >= 0 && x < 640 && y >= 64 && y < 704) {
v2 = (unsigned char *)gpBuffer + screen_y_times_768[x] + y;
goto LABEL_14;
}
} else if (!dword_52B99C || y >= 0 && y < 640 && x >= 64 && x < 704) {
v2 = (unsigned char *)gpBuffer + screen_y_times_768[y] + x;
LABEL_14:
if (v2 < gpBufEnd)
*v2 = gbPixelCol;
return;
/// ASSERT: assert(gpBuffer);
if(dword_52B970) {
if(dword_52B99C && (sx < 0 || sx >= 640 || sy < 64 || sy >= 704))
return;
dst = &gpBuffer[sy + screen_y_times_768[sx]];
} else {
if(dword_52B99C && (sy < 0 || sy >= 640 || sx < 64 || sx >= 704))
return;
dst = &gpBuffer[sx + screen_y_times_768[sy]];
}
#if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
__asm {
mov edi, dst
cmp edi, gpBufEnd
jnb label1
mov al, gbPixelCol
mov [edi], al
label1:
}
#else
if(dst < gpBufEnd)
*dst = gbPixelCol;
#endif
}
// 52B96C: using guessed type char gbPixelCol;
// 52B970: using guessed type int dword_52B970;
@ -2295,7 +2323,7 @@ void __fastcall SetRndSeed(int s)
int __cdecl GetRndSeed()
{
SeedCount++;
sglGameSeed = 0x015A4E35 * sglGameSeed + 1;
sglGameSeed = rand_multiplier * sglGameSeed + rand_increment;
return abs(sglGameSeed);
}
// 52B97C: using guessed type int sglGameSeed;

4
Source/engine.h

@ -33,8 +33,8 @@ void __fastcall Cel2DrawHdrLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, in
void __fastcall CelDecodeRect(BYTE *pBuff, int always_0, int hgt, int wdt, BYTE *pCelBuff, int nCel, int nWidth);
void __fastcall CelDecodeClr(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int always_0, int dir);
void __fastcall CelDrawHdrClrHL(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int always_0, int dir);
void __fastcall ENG_set_pixel(int screen_x, int screen_y, UCHAR pixel);
void __fastcall engine_draw_pixel(int x, int y);
void __fastcall ENG_set_pixel(int sx, int sy, BYTE col);
void __fastcall engine_draw_pixel(int sx, int sy);
void __fastcall DrawLine(int x0, int y0, int x1, int y1, UCHAR col);
int __fastcall GetDirection(int x1, int y1, int x2, int y2);
void __fastcall SetRndSeed(int s);

4
Source/error.cpp

@ -137,7 +137,7 @@ void __cdecl DrawDiabloMsg()
goto LABEL_27;
do {
v12 = (unsigned char)tempstr[v11++];
v10 += fontkern[fontframe[fontidx[v12]]] + 1;
v10 += fontkern[fontframe[gbFontTransTbl[v12]]] + 1;
} while (v11 < v9);
if (v10 < 442)
LABEL_27:
@ -145,7 +145,7 @@ void __cdecl DrawDiabloMsg()
v13 = 0;
if (v9 > 0) {
do {
v14 = fontframe[fontidx[(unsigned char)tempstr[v13]]];
v14 = fontframe[gbFontTransTbl[(unsigned char)tempstr[v13]]];
if (v14)
CPrintString(v8, v14, 3);
++v13;

2
Source/gendung.cpp

@ -34,7 +34,7 @@ BOOLEAN nTrapTable[2049];
BYTE leveltype;
unsigned char currlevel; // idb
char TransList[256];
BYTE nSolidTable[2049];
BOOLEAN nSolidTable[2049];
int level_frame_count[2048];
ScrollStruct ScrollInfo;
void *pDungeonCels;

2
Source/gendung.h

@ -32,7 +32,7 @@ extern BOOLEAN nTrapTable[2049];
extern BYTE leveltype;
extern unsigned char currlevel; // idb
extern char TransList[256];
extern BYTE nSolidTable[2049];
extern BOOLEAN nSolidTable[2049];
extern int level_frame_count[2048];
extern ScrollStruct ScrollInfo;
extern void *pDungeonCels;

42
Source/gmenu.cpp

@ -65,7 +65,7 @@ void __fastcall gmenu_print_text(int x, int y, char *pszStr)
v5 = x;
for (i = *pszStr; *v3; i = *v3) {
++v3;
v7 = lfontframe[fontidx[i]];
v7 = lfontframe[gbFontTransTbl[i]];
if (v7)
CelDecodeLightOnly(v5, v4, (BYTE *)BigTGold_cel, v7, 46);
v5 += lfontkern[v7] + 2;
@ -74,27 +74,23 @@ void __fastcall gmenu_print_text(int x, int y, char *pszStr)
void __cdecl FreeGMenu()
{
void *v0; // ecx
void *v1; // ecx
void *v2; // ecx
void *v3; // ecx
void *v4; // ecx
v0 = sgpLogo;
sgpLogo = 0;
mem_free_dbg(v0);
v1 = BigTGold_cel;
BigTGold_cel = 0;
mem_free_dbg(v1);
v2 = PentSpin_cel;
PentSpin_cel = 0;
mem_free_dbg(v2);
v3 = option_cel;
option_cel = 0;
mem_free_dbg(v3);
v4 = optbar_cel;
optbar_cel = 0;
mem_free_dbg(v4);
void *ptr;
ptr = sgpLogo;
sgpLogo = NULL;
mem_free_dbg(ptr);
ptr = BigTGold_cel;
BigTGold_cel = NULL;
mem_free_dbg(ptr);
ptr = PentSpin_cel;
PentSpin_cel = NULL;
mem_free_dbg(ptr);
ptr = option_cel;
option_cel = NULL;
mem_free_dbg(ptr);
ptr = optbar_cel;
optbar_cel = NULL;
mem_free_dbg(ptr);
}
void __cdecl gmenu_init_menu()
@ -282,7 +278,7 @@ int __fastcall gmenu_get_lfont(TMenuItem *pItem)
if (pItem->dwFlags & 0x40000000)
return 490;
v2 = pItem->pszStr;
for (i = 0;; i += lfontkern[lfontframe[fontidx[v4]]] + 2) {
for (i = 0;; i += lfontkern[lfontframe[gbFontTransTbl[v4]]] + 2) {
v4 = *v2;
if (!*v2)
break;

6
Source/help.cpp

@ -131,7 +131,7 @@ void __cdecl DrawHelp()
}
v5 = *v1;
tempstr[v2++] = *v1++;
v3 += fontkern[fontframe[fontidx[v5]]] + 1;
v3 += fontkern[fontframe[gbFontTransTbl[v5]]] + 1;
v4 = *v1;
if (*v1 == ('|')) {
if (v3 < 577)
@ -175,7 +175,7 @@ void __cdecl DrawHelp()
}
v10 = *v1;
tempstr[v7++] = *v1++;
v8 += fontkern[fontframe[fontidx[v10]]] + 1;
v8 += fontkern[fontframe[gbFontTransTbl[v10]]] + 1;
v9 = *v1;
if (*v1 == ('|')) {
if (v8 < 577)
@ -214,7 +214,7 @@ void __fastcall DrawHelpLine(int always_0, int help_line_nr, char *text, text_co
v5 = screen_y_times_768[SStringY[help_line_nr] + 204] + always_0 + 96;
for (i = *text; *text; i = *text) {
++text;
v7 = fontframe[fontidx[i]];
v7 = fontframe[gbFontTransTbl[i]];
v8 = v7;
v4 += fontkern[v7] + 1;
if (v7) {

8
Source/interfac.cpp

@ -225,11 +225,11 @@ void __fastcall ShowProgress(unsigned int uMsg)
void __cdecl FreeInterface()
{
void *v0; // ecx
void *ptr;
v0 = sgpBackCel;
sgpBackCel = 0;
mem_free_dbg(v0);
ptr = sgpBackCel;
sgpBackCel = NULL;
mem_free_dbg(ptr);
}
void __fastcall InitCutscene(unsigned int uMsg)

2
Source/inv.cpp

@ -432,7 +432,7 @@ void __cdecl DrawInvBelt()
&& plr[myplr].SpdList[i]._iStatFlag
&& plr[myplr].SpdList[i]._itype != ITYPE_GOLD) {
fi = i + 49;
ff = fontframe[fontidx[fi]];
ff = fontframe[gbFontTransTbl[fi]];
CPrintString(InvRect[i + 65].X + 64 + screen_y_times_768[InvRect[i + 65].Y + 159] - fontkern[ff] + 28, ff, 0);
}
}

136
Source/items.cpp

@ -651,19 +651,22 @@ void __cdecl InitItemGFX()
memset(UniqueItemFlag, 0, sizeof(UniqueItemFlag));
}
BOOLEAN __fastcall ItemPlace(int xp, int yp)
BOOL __fastcall ItemPlace(int xp, int yp)
{
int v2; // ecx
int v3; // eax
BOOLEAN result; // al
if (dMonster[xp][yp])
return FALSE;
if (dPlayer[xp][yp])
return FALSE;
if (dItem[xp][yp])
return FALSE;
if (dObject[xp][yp])
return FALSE;
if (dFlags[xp][yp] & DFLAG_POPULATED)
return FALSE;
if (nSolidTable[dPiece[xp][yp]])
return FALSE;
v2 = xp;
v3 = v2 * 112 + yp;
if (dMonster[0][v3] || dPlayer[v2][yp] || dItem[v2][yp] || dObject[v2][yp] || dFlags[v2][yp] & DFLAG_POPULATED)
result = 0;
else
result = nSolidTable[dPiece[0][v3]] == 0;
return result;
return TRUE;
}
void __cdecl AddInitItems()
@ -1166,41 +1169,39 @@ void __fastcall CalcSelfItems(int pnum)
void __fastcall CalcPlrItemMin(int pnum)
{
PlayerStruct *v1; // ecx
PlayerStruct *v2; // esi
ItemStruct *v3; // edi
int v4; // ebp
ItemStruct *v6; // edi
signed int v7; // ebp
PlayerStruct *p;
ItemStruct *pi;
int i;
v1 = &plr[pnum];
v2 = v1;
v3 = v1->InvList;
if (v1->_pNumInv) {
v4 = v1->_pNumInv;
do {
v3->_iStatFlag = ItemMinStats(v2, v3);
++v3;
--v4;
} while (v4);
p = &plr[pnum];
pi = p->InvList;
for (i = p->_pNumInv; i; i--) {
pi->_iStatFlag = ItemMinStats(p, pi);
pi++;
}
v6 = v2->SpdList;
v7 = MAXBELTITEMS;
do {
if (v6->_itype != -1) {
v6->_iStatFlag = ItemMinStats(v2, v6);
pi = p->SpdList;
for (i = MAXBELTITEMS; i != 0; i--) {
if (pi->_itype != -1) {
pi->_iStatFlag = ItemMinStats(p, pi);
}
++v6;
--v7;
} while (v7);
pi++;
}
}
BOOLEAN __fastcall ItemMinStats(PlayerStruct *p, ItemStruct *x)
BOOL __fastcall ItemMinStats(PlayerStruct *p, ItemStruct *x)
{
if (p->_pStrength < x->_iMinStr || p->_pMagic < x->_iMinMag || p->_pDexterity < x->_iMinDex)
return 0;
else
return 1;
if (p->_pMagic < x->_iMinMag)
return FALSE;
if (p->_pStrength < x->_iMinStr)
return FALSE;
if (p->_pDexterity < x->_iMinDex)
return FALSE;
return TRUE;
}
void __fastcall CalcPlrBookVals(int p)
@ -3696,7 +3697,7 @@ void __fastcall PrintItemPower(char plidx, ItemStruct *x)
}
}
void __cdecl DrawUBack()
void __cdecl DrawUTextBack()
{
CelDecodeOnly(88, 487, (BYTE *)pSTextBoxCels, 1, 271);
@ -3734,7 +3735,7 @@ void __fastcall PrintUString(int x, int y, int cjustflag, char *str, int col)
goto LABEL_16;
do {
v11 = (unsigned char)str[v9++];
v10 += fontkern[fontframe[fontidx[v11]]] + 1;
v10 += fontkern[fontframe[gbFontTransTbl[v11]]] + 1;
} while (v9 < v15);
if (v10 < 257)
LABEL_16:
@ -3745,7 +3746,7 @@ void __fastcall PrintUString(int x, int y, int cjustflag, char *str, int col)
a3 = 0;
if (v15 > 0) {
while (1) {
v13 = fontframe[fontidx[(unsigned char)v5[v12]]];
v13 = fontframe[gbFontTransTbl[(unsigned char)v5[v12]]];
v14 = v13;
v8 += fontkern[v13] + 1;
if (v13) {
@ -3763,22 +3764,39 @@ void __fastcall PrintUString(int x, int y, int cjustflag, char *str, int col)
void __fastcall DrawULine(int y)
{
char *v1; // esi
char *v2; // edi
signed int v3; // edx
/// ASSERT: assert(gpBuffer);
#if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
int yy;
yy = screen_y_times_768[SStringY[y] + 198] + 26 + 64;
__asm {
mov esi, gpBuffer
mov edi, esi
add esi, SCREENXY(26, 25)
add edi, yy
mov ebx, 768 - 266
mov edx, 3
copyline:
mov ecx, 266 / 4
rep movsd
movsw
add esi, ebx
add edi, ebx
dec edx
jnz copyline
}
#else
int i;
BYTE *src, *dst;
v1 = (char *)&gpBuffer[SCREENXY(26, 25)];
v2 = (char *)&gpBuffer[screen_y_times_768[SStringY[y] + 198] + 26 + 64];
v3 = 3;
do {
qmemcpy(v2, v1, 0x10A); /* find real fix */
v1 += 264;
v2 += 264;
*v2 = *v1;
v1 += 504;
v2 += 504;
--v3;
} while (v3);
src = &gpBuffer[SCREENXY(26, 25)];
dst = &gpBuffer[screen_y_times_768[SStringY[y] + 198] + 26 + 64];
for(i = 0; i < 3; i++, src += 768, dst += 768)
memcpy(dst, src, 266);
#endif
}
void __cdecl DrawUniqueInfo()
@ -3789,7 +3807,7 @@ void __cdecl DrawUniqueInfo()
if (!chrflag && !questlog) {
v0 = curruitem._iUid;
DrawUBack();
DrawUTextBack();
v1 = v0;
PrintUString(0, 2, 1, UniqueItemList[v1].UIName, 3);
DrawULine(5);

6
Source/items.h

@ -15,7 +15,7 @@ extern int numitems;
extern int gnNumGetRecords;
void __cdecl InitItemGFX();
BOOLEAN __fastcall ItemPlace(int xp, int yp);
BOOL __fastcall ItemPlace(int xp, int yp);
void __cdecl AddInitItems();
void __cdecl InitItems();
void __fastcall CalcPlrItemVals(int p, BOOL Loadgfx);
@ -23,7 +23,7 @@ void __fastcall CalcPlrScrolls(int p);
void __fastcall CalcPlrStaff(int pnum);
void __fastcall CalcSelfItems(int pnum);
void __fastcall CalcPlrItemMin(int pnum);
BOOLEAN __fastcall ItemMinStats(PlayerStruct *p, ItemStruct *x);
BOOL __fastcall ItemMinStats(PlayerStruct *p, ItemStruct *x);
void __fastcall CalcPlrBookVals(int p);
void __fastcall CalcPlrInv(int p, BOOL Loadgfx);
void __fastcall SetPlrHandItem(ItemStruct *h, int idata);
@ -80,7 +80,7 @@ void __fastcall DoRecharge(int pnum, int cii);
void __fastcall RechargeItem(ItemStruct *i, int r);
void __fastcall PrintItemOil(char IDidx);
void __fastcall PrintItemPower(char plidx, ItemStruct *x);
void __cdecl DrawUBack();
void __cdecl DrawUTextBack();
void __fastcall PrintUString(int x, int y, int cjustflag, char *str, int col);
void __fastcall DrawULine(int y);
void __cdecl DrawUniqueInfo();

8
Source/lighting.cpp

@ -942,11 +942,11 @@ void __fastcall DoVision(int nXPos, int nYPos, int nRadius, unsigned char doauto
void __cdecl FreeLightTable()
{
char *v0; // ecx
char *ptr;
v0 = pLightTbl;
pLightTbl = 0;
mem_free_dbg(v0);
ptr = pLightTbl;
pLightTbl = NULL;
mem_free_dbg(ptr);
}
void __cdecl InitLightTable()

19
Source/minitext.cpp

@ -43,15 +43,14 @@ int qscroll_spd_tbl[9] = { 2, 4, 6, 8, 0, -1, -2, -3, -4 };
void __cdecl FreeQuestText()
{
void *v0; // ecx
void *v1; // ecx
void *ptr;
v0 = pMedTextCels;
pMedTextCels = 0;
mem_free_dbg(v0);
v1 = pTextBoxCels;
pTextBoxCels = 0;
mem_free_dbg(v1);
ptr = pMedTextCels;
pMedTextCels = NULL;
mem_free_dbg(ptr);
ptr = pTextBoxCels;
pTextBoxCels = NULL;
mem_free_dbg(ptr);
}
void __cdecl InitQuestText()
@ -246,7 +245,7 @@ void __cdecl DrawQText()
if (*i == 124 || v1 >= 543)
break;
v4 = *i++;
v5 = fontidx[v4];
v5 = gbFontTransTbl[v4];
if (v5) {
qstr[v2] = v5;
v1 += mfontkern[mfontframe[v5]] + 2;
@ -271,7 +270,7 @@ void __cdecl DrawQText()
v9 = qstr;
do {
++v0;
v10 = mfontframe[fontidx[v8]];
v10 = mfontframe[gbFontTransTbl[v8]];
if (*v0 == 10)
++v0;
if (v10)

1174
Source/missiles.cpp

File diff suppressed because it is too large Load Diff

20
Source/objects.cpp

@ -413,13 +413,13 @@ void __cdecl InitObjectGFX()
void __cdecl FreeObjectGFX()
{
int i; // esi
void *v1; // ecx
int i;
void *ptr;
for (i = 0; i < numobjfiles; ++i) {
v1 = (void *)pObjCels[i];
pObjCels[i] = 0;
mem_free_dbg(v1);
for (i = 0; i < numobjfiles; i++) {
ptr = pObjCels[i];
pObjCels[i] = NULL;
mem_free_dbg(ptr);
}
numobjfiles = 0;
}
@ -2657,10 +2657,10 @@ void __fastcall ObjSetMini(int x, int y, int v)
mov v4, eax
}
#else
v1 = *((WORD *)&pMegaTiles[((WORD)v-1)*8])+1;
v2 = *((WORD *)&pMegaTiles[((WORD)v-1)*8]+1)+1;
v3 = *((WORD *)&pMegaTiles[((WORD)v-1)*8]+2)+1;
v4 = *((WORD *)&pMegaTiles[((WORD)v-1)*8]+3)+1;
v1 = *((WORD *)&pMegaTiles[((WORD)v - 1) * 8]) + 1;
v2 = *((WORD *)&pMegaTiles[((WORD)v - 1) * 8] + 1) + 1;
v3 = *((WORD *)&pMegaTiles[((WORD)v - 1) * 8] + 2) + 1;
v4 = *((WORD *)&pMegaTiles[((WORD)v - 1) * 8] + 3) + 1;
#endif
xx = 2 * x + 16;

4
Source/plrmsg.cpp

@ -120,7 +120,7 @@ void __fastcall PrintPlrMsg(unsigned int x, unsigned int y, unsigned int width,
while (1) {
if (*sstr) {
c = fontidx[(unsigned char)*sstr++];
c = gbFontTransTbl[(unsigned char)*sstr++];
c = fontframe[c];
len += fontkern[c] + 1;
if (!c) // allow wordwrap on blank glyph
@ -134,7 +134,7 @@ void __fastcall PrintPlrMsg(unsigned int x, unsigned int y, unsigned int width,
}
while (str < endstr) {
c = fontidx[(unsigned char)*str++];
c = gbFontTransTbl[(unsigned char)*str++];
c = fontframe[c];
if (c)
CPrintString(screen, c, col);

4
Source/quests.cpp

@ -931,7 +931,7 @@ void __fastcall PrintQLString(int x, int y, unsigned char cjustflag, char *str,
goto LABEL_24;
do {
v11 = (unsigned char)str[v9++];
v10 += fontkern[fontframe[fontidx[v11]]] + 1;
v10 += fontkern[fontframe[gbFontTransTbl[v11]]] + 1;
} while (v9 < v20);
if (v10 < 257)
LABEL_24:
@ -948,7 +948,7 @@ void __fastcall PrintQLString(int x, int y, unsigned char cjustflag, char *str,
v19 = 0;
if (v20 > 0) {
do {
v14 = fontframe[fontidx[(unsigned char)str[v13]]];
v14 = fontframe[gbFontTransTbl[(unsigned char)str[v13]]];
v15 = v14;
v8 += fontkern[v14] + 1;
if (v14 && v8 <= 257) {

84
Source/stores.cpp

@ -204,7 +204,7 @@ void __fastcall PrintSString(int x, int y, unsigned char cjustflag, char *str, i
if (v28 > 0) {
do {
v13 = (unsigned char)str[v11++];
v12 += fontkern[fontframe[fontidx[v13]]] + 1;
v12 += fontkern[fontframe[gbFontTransTbl[v13]]] + 1;
} while (v11 < v28);
}
if (v12 < v25)
@ -221,7 +221,7 @@ void __fastcall PrintSString(int x, int y, unsigned char cjustflag, char *str, i
v29 = 0;
if (v28 > 0) {
do {
v15 = fontframe[fontidx[(unsigned char)str[v29]]];
v15 = fontframe[gbFontTransTbl[(unsigned char)str[v29]]];
v16 = v15;
v17 = v30 + fontkern[v15] + 1;
v30 += fontkern[v15] + 1;
@ -238,9 +238,9 @@ void __fastcall PrintSString(int x, int y, unsigned char cjustflag, char *str, i
v19 = screen_y_times_768[v6 + 204] - v8 + 656;
v20 = strlen(valstr);
while ((--v20 & 0x80000000) == 0) {
v21 = fontframe[fontidx[(unsigned char)valstr[v20]]];
v21 = fontframe[gbFontTransTbl[(unsigned char)valstr[v20]]];
v19 += -1 - fontkern[v21];
if (fontframe[fontidx[(unsigned char)valstr[v20]]])
if (fontframe[gbFontTransTbl[(unsigned char)valstr[v20]]])
CPrintString(v19, v21, col);
}
v8 = v26;
@ -259,41 +259,49 @@ void __fastcall PrintSString(int x, int y, unsigned char cjustflag, char *str, i
void __fastcall DrawSLine(int y)
{
int v1; // eax
int v2; // eax
char *v3; // esi
char *v4; // edi
signed int v5; // edx
char *v6; // edi
char *v7; // esi
signed int v8; // [esp+0h] [ebp-10h]
signed int v9; // [esp+8h] [ebp-8h]
signed int v10; // [esp+Ch] [ebp-4h]
v1 = screen_y_times_768[SStringY[y] + 198];
if (stextsize == 1) {
v8 = 142170;
v2 = v1 + 90;
v10 = 146;
v9 = 182;
int xy, yy, width, line;
if(stextsize == 1) {
xy = SCREENXY(26, 25);
yy = screen_y_times_768[SStringY[y] + 198] + 26 + 64;
width = 586 / 4;
line = 768 - 586;
} else {
v8 = 142490;
v2 = v1 + 410;
v10 = 66;
v9 = 502;
}
v3 = (char *)gpBuffer + v8;
v4 = (char *)gpBuffer + v2;
v5 = 3;
do {
qmemcpy(v4, v3, 4 * v10);
v7 = &v3[4 * v10];
v6 = &v4[4 * v10];
*(_WORD *)v6 = *(_WORD *)v7;
v3 = &v7[v9 + 2];
v4 = &v6[v9 + 2];
--v5;
} while (v5);
xy = SCREENXY(346, 25);
yy = screen_y_times_768[SStringY[y] + 198] + 346 + 64;
width = 266 / 4;
line = 768 - 266;
}
/// ASSERT: assert(gpBuffer);
#if (_MSC_VER >= 800) && (_MSC_VER <= 1200)
__asm {
mov esi, gpBuffer
mov edi, esi
add esi, xy
add edi, yy
mov ebx, line
mov edx, 3
copyline:
mov ecx, width
rep movsd
movsw
add esi, ebx
add edi, ebx
dec edx
jnz copyline
}
#else
int i;
BYTE *src, *dst;
src = &gpBuffer[xy];
dst = &gpBuffer[yy];
for(i = 0; i < 3; i++, src += 768, dst += 768)
memcpy(dst, src, 768 - line);
#endif
}
// 6A09E0: using guessed type char stextsize;

4
Source/town.cpp

@ -476,7 +476,7 @@ void __fastcall town_draw_clipped_town_2(int x, int y, int a3, int a4, int a5, i
Cel2DrawHdrOnly(v13, sy, item[v12]._iAnimData, item[v12]._iAnimFrame, item[v12]._iAnimWidth, a5, 8);
}
if (dFlags[0][v9] & DFLAG_MONSTER) {
v14 = -1 - dMonster[x][y - 1]; // -1 - *(&dword_52D204 + v9); /* check */
v14 = -1 - dMonster[y][a3 - 1]; // -1 - *(&dword_52D204 + v9); /* check */
v15 = sx - towner[v14]._tAnimWidth2;
if (v14 == pcursmonst)
CelDrawHdrClrHL(
@ -508,7 +508,7 @@ void __fastcall town_draw_clipped_town_2(int x, int y, int a3, int a4, int a5, i
Cel2DrawHdrOnly(v19, sy, towner[v18]._tAnimData, towner[v18]._tAnimFrame, towner[v18]._tAnimWidth, a5, 8);
}
if (dFlags[0][v9] & DFLAG_PLAYER) {
v20 = -1 - dPlayer[x][y - 1]; // -1 - *((_BYTE *)&themeLoc[49].height + v9 + 3);
v20 = -1 - dPlayer[y][a3 - 1]; // -1 - *((_BYTE *)&themeLoc[49].height + v9 + 3);
v21 = v20;
v22 = sy + plr[v21]._pyoff;
v23 = sx + plr[v21]._pxoff - plr[v21]._pAnimWidth2;

Loading…
Cancel
Save